cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CustomCommand Class Reference

Custom command is used for call custom openGL command which can not be done by other commands, such as stencil function, depth functions etc. More...

#include <CCCustomCommand.h>

Inheritance diagram for CustomCommand:
RenderCommand

Public Member Functions

 CustomCommand ()
 Constructor. More...
 
 ~CustomCommand ()
 Destructor. More...
 
void init (float globalZOrder, const Mat4 &modelViewTransform, uint32_t flags)
 Init function. More...
 
local init ( local globalZOrder, local modelViewTransform, local flags)
 Init function. More...
 
void init (float globalZOrder)
 Init function. More...
 
void execute ()
 Execute the render command and call callback functions. More...
 
bool isTranslucent ()
- Public Member Functions inherited from RenderCommand
void init (float globalZOrder, const Mat4 &modelViewTransform, uint32_t flags)
 Init function, will be called by all the render commands. More...
 
float getGlobalOrder () const
 Get global Z order. More...
 
Type getType () const
 Returns the Command type. More...
 
bool isTransparent () const
 Retruns whether is transparent. More...
 
void setTransparent (bool isTransparent)
 Set transparent flag. More...
 
bool isSkipBatching () const
 Get skip batching status, if a rendering is skip batching, it will be forced to be rendering seperately. More...
 
void setSkipBatching (bool value)
 Set skip batching. More...
 
local setSkipBatching ( local value)
 Set skip batching. More...
 
bool is3D () const
 Whether the command should be rendered at 3D mode. More...
 
void set3D (bool value)
 Set the command rendered in 3D mode or not. More...
 
float getDepth () const
 Get the depth by current model view matrix. More...
 

Public Attributes

std::function< void()> func
 Callback function. More...
 

Additional Inherited Members

- Public Types inherited from RenderCommand
enum  Type {
  UNKNOWN_COMMAND, QUAD_COMMAND, CUSTOM_COMMAND, BATCH_COMMAND,
  GROUP_COMMAND, MESH_COMMAND, PRIMITIVE_COMMAND, TRIANGLES_COMMAND
}
 Enum the type of render command. More...
 
- Protected Member Functions inherited from RenderCommand
 RenderCommand ()
 Constructor. More...
 
virtual ~RenderCommand ()
 Desctructor. More...
 
local ~RenderCommand ()
 Desctructor. More...
 
void printID ()
- Protected Attributes inherited from RenderCommand
Type _type
 Type used in order to avoid dynamic cast, faster. More...
 
float _globalOrder
 Commands are sort by global Z order. More...
 
bool _isTransparent
 Transparent flag. More...
 
bool _skipBatching
 QuadCommand and TrianglesCommand could be auto batched if there material ID is the same, however, if a command is skip batching, it would be forced to draw in a seperate function call, and break the batch. More...
 
bool _is3D
 Is the command been rendered on 3D pass. More...
 
float _depth
 Depth from the model view matrix. More...
 

Detailed Description

Custom command is used for call custom openGL command which can not be done by other commands, such as stencil function, depth functions etc.

The render command is executed by calling a call back function.

Constructor & Destructor Documentation

Constructor.

var CustomCommand ( )

Constructor.

local CustomCommand ( )

Constructor.

Destructor.

var ~CustomCommand ( )

Destructor.

local ~CustomCommand ( )

Destructor.

Member Function Documentation

void execute ( )

Execute the render command and call callback functions.

var execute ( )

Execute the render command and call callback functions.

local execute ( )

Execute the render command and call callback functions.

void init ( float  globalZOrder,
const Mat4 modelViewTransform,
uint32_t  flags 
)

Init function.

Parameters
globalZOrderGlobalZOrder of the render command.
modelViewTransformWhen in 3D mode, depth sorting needs modelViewTransform.
flagsUse to identify that the render command is 3D mode or not.
var init ( var  globalZOrder,
var  modelViewTransform,
var  flags 
)

Init function.

Parameters
globalZOrderGlobalZOrder of the render command.
modelViewTransformWhen in 3D mode, depth sorting needs modelViewTransform.
flagsUse to identify that the render command is 3D mode or not.
local init ( local  globalZOrder,
local  modelViewTransform,
local  flags 
)

Init function.

Parameters
globalZOrderGlobalZOrder of the render command.
modelViewTransformWhen in 3D mode, depth sorting needs modelViewTransform.
flagsUse to identify that the render command is 3D mode or not.
void init ( float  globalZOrder)

Init function.

The render command will be in 2D mode.

Parameters
globalZOrderGlobalZOrder of the render command.
var init ( var  globalZOrder)

Init function.

The render command will be in 2D mode.

Parameters
globalZOrderGlobalZOrder of the render command.
local init ( local  globalZOrder)

Init function.

The render command will be in 2D mode.

Parameters
globalZOrderGlobalZOrder of the render command.
bool isTranslucent ( )
inline
var isTranslucent ( )
inline
local isTranslucent ( )
inline

Member Data Documentation

std::function<void()> func

Callback function.

var func

Callback function.

local func

Callback function.


The documentation for this class was generated from the following file: