Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
MeshCommand Class Reference

Command used to draw a mesh. More...

Inherits RenderCommand.

Public Member Functions

 MeshCommand ()
 Constructor.
 
virtual ~MeshCommand ()
 Destructor.
 
void init (float globalZOrder, Material *material, GLuint vertexBuffer, GLuint indexBuffer, GLenum primitive, GLenum indexFormat, ssize_t indexCount, const Mat4 &mv, uint32_t flags)
 Init the mesh command. More...
 
void init (float globalZOrder, GLuint textureID, GLProgramState *glProgramState, RenderState::StateBlock *stateBlock, GLuint vertexBuffer, GLuint indexBuffer, GLenum primitive, GLenum indexFormat, ssize_t indexCount, const Mat4 &mv, uint32_t flags)
 Init the mesh command. More...
 
void setDisplayColor (const Vec4 &color)
 Set display color, the final color is the diplay color multiply texture color if it has. More...
 
void setMatrixPalette (const Vec4 *matrixPalette)
 Set matrix palette used to draw skeletal model. More...
 
var setMatrixPalette ( var matrixPalette)
 Set matrix palette used to draw skeletal model. More...
 
local setMatrixPalette ( local matrixPalette)
 Set matrix palette used to draw skeletal model. More...
 
void setMatrixPaletteSize (int size)
 Set matrix palette size. More...
 
void setLightMask (unsigned int lightmask)
 Set light mask, only the light whose light flag & light mask is not zero will illuminates this mesh. More...
 
void execute ()
 Execute the command, which will call openGL function to draw the mesh.
 
void preBatchDraw ()
 Used for batch, Renderer will batch all the mesh with the same material id, it calls preBatchDraw, then calls batchDraw for each mesh, calls postBatchDraw at last.
 
void batchDraw ()
 Used for batch, Renderer will batch all the mesh with the same material id, it calls preBatchDraw, then calls batchDraw for each mesh, calls postBatchDraw at last.
 
void postBatchDraw ()
 Used for batch, Renderer will batch all the mesh with the same material id, it calls preBatchDraw, then calls batchDraw for each mesh, calls postBatchDraw at last.
 
void genMaterialID (GLuint texID, void *glProgramState, GLuint vertexBuffer, GLuint indexBuffer, BlendFunc blend)
 Generate material id, material id is used to batch the same mesh. More...
 
var genMaterialID ( var texID, var glProgramState, var vertexBuffer, var indexBuffer, var blend)
 Generate material id, material id is used to batch the same mesh. More...
 
local genMaterialID ( local texID, local glProgramState, local vertexBuffer, local indexBuffer, local blend)
 Generate material id, material id is used to batch the same mesh. More...
 
uint32_t getMaterialID () const
 Get material id. More...
 
- 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 separately. More...
 
void setSkipBatching (bool 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...
 

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...
 

Detailed Description

Command used to draw a mesh.

Member Function Documentation

void init ( float  globalZOrder,
Material material,
GLuint  vertexBuffer,
GLuint  indexBuffer,
GLenum  primitive,
GLenum  indexFormat,
ssize_t  indexCount,
const Mat4 mv,
uint32_t  flags 
)

Init the mesh command.

GlobalZOrder of the render command. material used for draw mesh. vertex buffer to be drawn. index buffer to be draw. Specifices what kind of primitives to render, GL_TRIANGLES, GL_TRIANGLE_STRIP, and so on. Please refer to glDrawElements Specifies the type of the values in index buffer. It GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT. number of index. Model view transform used for rendering. Indicate the render command should be rendered in 3D mode or not.

var init ( var  globalZOrder,
var  material,
var  vertexBuffer,
var  indexBuffer,
var  primitive,
var  indexFormat,
var  indexCount,
var  mv,
var  flags 
)

Init the mesh command.

GlobalZOrder of the render command. material used for draw mesh. vertex buffer to be drawn. index buffer to be draw. Specifices what kind of primitives to render, GL_TRIANGLES, GL_TRIANGLE_STRIP, and so on. Please refer to glDrawElements Specifies the type of the values in index buffer. It GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT. number of index. Model view transform used for rendering. Indicate the render command should be rendered in 3D mode or not.

local init ( local  globalZOrder,
local  material,
local  vertexBuffer,
local  indexBuffer,
local  primitive,
local  indexFormat,
local  indexCount,
local  mv,
local  flags 
)

Init the mesh command.

GlobalZOrder of the render command. material used for draw mesh. vertex buffer to be drawn. index buffer to be draw. Specifices what kind of primitives to render, GL_TRIANGLES, GL_TRIANGLE_STRIP, and so on. Please refer to glDrawElements Specifies the type of the values in index buffer. It GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT. number of index. Model view transform used for rendering. Indicate the render command should be rendered in 3D mode or not.

void init ( float  globalZOrder,
GLuint  textureID,
GLProgramState glProgramState,
RenderState::StateBlock stateBlock,
GLuint  vertexBuffer,
GLuint  indexBuffer,
GLenum  primitive,
GLenum  indexFormat,
ssize_t  indexCount,
const Mat4 mv,
uint32_t  flags 
)

Init the mesh command.

GlobalZOrder of the render command. the texture id to be used drawing the mesh. GLProgramState used to draw the mesh. render state used to draw the mesh. vertex buffer to be drawn. index buffer to be draw. Specifices what kind of primitives to render, GL_TRIANGLES, GL_TRIANGLE_STRIP, and so on. Please refer to glDrawElements Specifies the type of the values in index buffer. It GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT. number of index. Model view transform used for rendering. Indicate the render command should be rendered in 3D mode or not.

var init ( var  globalZOrder,
var  textureID,
var  glProgramState,
var  stateBlock,
var  vertexBuffer,
var  indexBuffer,
var  primitive,
var  indexFormat,
var  indexCount,
var  mv,
var  flags 
)

Init the mesh command.

GlobalZOrder of the render command. the texture id to be used drawing the mesh. GLProgramState used to draw the mesh. render state used to draw the mesh. vertex buffer to be drawn. index buffer to be draw. Specifices what kind of primitives to render, GL_TRIANGLES, GL_TRIANGLE_STRIP, and so on. Please refer to glDrawElements Specifies the type of the values in index buffer. It GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT. number of index. Model view transform used for rendering. Indicate the render command should be rendered in 3D mode or not.

local init ( local  globalZOrder,
local  textureID,
local  glProgramState,
local  stateBlock,
local  vertexBuffer,
local  indexBuffer,
local  primitive,
local  indexFormat,
local  indexCount,
local  mv,
local  flags 
)

Init the mesh command.

GlobalZOrder of the render command. the texture id to be used drawing the mesh. GLProgramState used to draw the mesh. render state used to draw the mesh. vertex buffer to be drawn. index buffer to be draw. Specifices what kind of primitives to render, GL_TRIANGLES, GL_TRIANGLE_STRIP, and so on. Please refer to glDrawElements Specifies the type of the values in index buffer. It GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT. number of index. Model view transform used for rendering. Indicate the render command should be rendered in 3D mode or not.

void setDisplayColor ( const Vec4 color)

Set display color, the final color is the diplay color multiply texture color if it has.

Color to be shown.

var setDisplayColor ( var  color)

Set display color, the final color is the diplay color multiply texture color if it has.

Color to be shown.

local setDisplayColor ( local  color)

Set display color, the final color is the diplay color multiply texture color if it has.

Color to be shown.

void setMatrixPalette ( const Vec4 matrixPalette)

Set matrix palette used to draw skeletal model.

Matrix palette.

var setMatrixPalette ( var  matrixPalette)

Set matrix palette used to draw skeletal model.

Matrix palette.

local setMatrixPalette ( local  matrixPalette)

Set matrix palette used to draw skeletal model.

Matrix palette.

void setMatrixPaletteSize ( int  size)

Set matrix palette size.

Matrix palette size.

var setMatrixPaletteSize ( var  size)

Set matrix palette size.

Matrix palette size.

local setMatrixPaletteSize ( local  size)

Set matrix palette size.

Matrix palette size.

void setLightMask ( unsigned int  lightmask)

Set light mask, only the light whose light flag & light mask is not zero will illuminates this mesh.

light mask.

var setLightMask ( var  lightmask)

Set light mask, only the light whose light flag & light mask is not zero will illuminates this mesh.

light mask.

local setLightMask ( local  lightmask)

Set light mask, only the light whose light flag & light mask is not zero will illuminates this mesh.

light mask.

void genMaterialID ( GLuint  texID,
void *  glProgramState,
GLuint  vertexBuffer,
GLuint  indexBuffer,
BlendFunc  blend 
)

Generate material id, material id is used to batch the same mesh.

texture id. GLProgramState used to draw the mesh. vertex buffer. index buffer. blend function.

var genMaterialID ( var  texID,
var  glProgramState,
var  vertexBuffer,
var  indexBuffer,
var  blend 
)

Generate material id, material id is used to batch the same mesh.

texture id. GLProgramState used to draw the mesh. vertex buffer. index buffer. blend function.

local genMaterialID ( local  texID,
local  glProgramState,
local  vertexBuffer,
local  indexBuffer,
local  blend 
)

Generate material id, material id is used to batch the same mesh.

texture id. GLProgramState used to draw the mesh. vertex buffer. index buffer. blend function.

uint32_t getMaterialID ( ) const

Get material id.

material id.

var getMaterialID ( )

Get material id.

material id.

local getMaterialID ( )

Get material id.

material id.


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