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

Command used to render one or more Triangles, which is similar to QuadCommand. More...

Inherits RenderCommand.

Classes

struct  Triangles
 The structure of Triangles. More...
 

Public Member Functions

 TrianglesCommand ()
 Construtor.
 
 ~TrianglesCommand ()
 Destructor.
 
void init (float globalOrder, GLuint textureID, GLProgramState *glProgramState, BlendFunc blendType, const Triangles &triangles, const Mat4 &mv, uint32_t flags)
 Initializes the command. More...
 
local init ( local globalOrder, local textureID, local glProgramState, local blendType, local triangles, local mv, local flags)
 Initializes the command. More...
 
void init (float globalOrder, GLuint textureID, GLProgramState *glProgramState, BlendFunc blendType, const Triangles &triangles, const Mat4 &mv)
 Deprecated function, the params is similar as the upper init function, with flags equals 0. More...
 
void useMaterial () const
 Apply the texture, shaders, programs, blend functions to GPU pipeline.
 
uint32_t getMaterialID () const
 Get the material id of command. More...
 
GLuint getTextureID () const
 Get the openGL texture handle. More...
 
const TrianglesgetTriangles () const
 Get a const reference of triangles. More...
 
ssize_t getVertexCount () const
 Get the vertex count in the triangles. More...
 
ssize_t getIndexCount () const
 Get the index count of the triangles. More...
 
const V3F_C4B_T2FgetVertices () const
 Get the vertex data pointer. More...
 
local getVertices ()
 Get the vertex data pointer. More...
 
const unsigned short * getIndices () const
 Get the index data pointer. More...
 
GLProgramStategetGLProgramState () const
 Get the GLProgram and uniform. More...
 
local getGLProgramState ()
 Get the GLProgram and uniform. More...
 
BlendFunc getBlendType () const
 Get the blend function. More...
 
const Mat4getModelView () const
 Get the model view matrix. 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 render one or more Triangles, which is similar to QuadCommand.

Every TrianglesCommand will have generate material ID by give textureID, glProgramState, Blend function if the material id is the same, these TrianglesCommands could be batched to save draw call.

Member Function Documentation

void init ( float  globalOrder,
GLuint  textureID,
GLProgramState glProgramState,
BlendFunc  blendType,
const Triangles triangles,
const Mat4 mv,
uint32_t  flags 
)

Initializes the command.

GlobalZOrder of the command. The openGL handle of the used texture. The specified glProgram and its uniform. Blend function for the command. Rendered triangles for the command. ModelView matrix for the command. to indicate that the command is using 3D rendering or not.

var init ( var  globalOrder,
var  textureID,
var  glProgramState,
var  blendType,
var  triangles,
var  mv,
var  flags 
)

Initializes the command.

GlobalZOrder of the command. The openGL handle of the used texture. The specified glProgram and its uniform. Blend function for the command. Rendered triangles for the command. ModelView matrix for the command. to indicate that the command is using 3D rendering or not.

local init ( local  globalOrder,
local  textureID,
local  glProgramState,
local  blendType,
local  triangles,
local  mv,
local  flags 
)

Initializes the command.

GlobalZOrder of the command. The openGL handle of the used texture. The specified glProgram and its uniform. Blend function for the command. Rendered triangles for the command. ModelView matrix for the command. to indicate that the command is using 3D rendering or not.

void init ( float  globalOrder,
GLuint  textureID,
GLProgramState glProgramState,
BlendFunc  blendType,
const Triangles triangles,
const Mat4 mv 
)

Deprecated function, the params is similar as the upper init function, with flags equals 0.

GlobalZOrder of the command. The openGL handle of the used texture. The specified glProgram and its uniform. Blend function for the command. Rendered triangles for the command. ModelView matrix for the command.

var init ( var  globalOrder,
var  textureID,
var  glProgramState,
var  blendType,
var  triangles,
var  mv 
)

Deprecated function, the params is similar as the upper init function, with flags equals 0.

GlobalZOrder of the command. The openGL handle of the used texture. The specified glProgram and its uniform. Blend function for the command. Rendered triangles for the command. ModelView matrix for the command.

local init ( local  globalOrder,
local  textureID,
local  glProgramState,
local  blendType,
local  triangles,
local  mv 
)

Deprecated function, the params is similar as the upper init function, with flags equals 0.

GlobalZOrder of the command. The openGL handle of the used texture. The specified glProgram and its uniform. Blend function for the command. Rendered triangles for the command. ModelView matrix for the command.

uint32_t getMaterialID ( ) const
inline

Get the material id of command.

Material ID.

var getMaterialID ( )
inline

Get the material id of command.

Material ID.

local getMaterialID ( )
inline

Get the material id of command.

Material ID.

GLuint getTextureID ( ) const
inline

Get the openGL texture handle.

openGL texture handle.

var getTextureID ( )
inline

Get the openGL texture handle.

openGL texture handle.

local getTextureID ( )
inline

Get the openGL texture handle.

openGL texture handle.

const Triangles& getTriangles ( ) const
inline

Get a const reference of triangles.

The triangles to be rendered.

var getTriangles ( )
inline

Get a const reference of triangles.

The triangles to be rendered.

local getTriangles ( )
inline

Get a const reference of triangles.

The triangles to be rendered.

ssize_t getVertexCount ( ) const
inline

Get the vertex count in the triangles.

the vertex count.

var getVertexCount ( )
inline

Get the vertex count in the triangles.

the vertex count.

local getVertexCount ( )
inline

Get the vertex count in the triangles.

the vertex count.

ssize_t getIndexCount ( ) const
inline

Get the index count of the triangles.

The index count.

var getIndexCount ( )
inline

Get the index count of the triangles.

The index count.

local getIndexCount ( )
inline

Get the index count of the triangles.

The index count.

const V3F_C4B_T2F* getVertices ( ) const
inline

Get the vertex data pointer.

The pointer of the vertex data.

var getVertices ( )
inline

Get the vertex data pointer.

The pointer of the vertex data.

local getVertices ( )
inline

Get the vertex data pointer.

The pointer of the vertex data.

const unsigned short* getIndices ( ) const
inline

Get the index data pointer.

The pointer of index data.

var getIndices ( )
inline

Get the index data pointer.

The pointer of index data.

local getIndices ( )
inline

Get the index data pointer.

The pointer of index data.

GLProgramState* getGLProgramState ( ) const
inline

Get the GLProgram and uniform.

GLProgram and its uniform.

var getGLProgramState ( )
inline

Get the GLProgram and uniform.

GLProgram and its uniform.

local getGLProgramState ( )
inline

Get the GLProgram and uniform.

GLProgram and its uniform.

BlendFunc getBlendType ( ) const
inline

Get the blend function.

The blend function.

var getBlendType ( )
inline

Get the blend function.

The blend function.

local getBlendType ( )
inline

Get the blend function.

The blend function.

const Mat4& getModelView ( ) const
inline

Get the model view matrix.

The ModelView matrix.

var getModelView ( )
inline

Get the model view matrix.

The ModelView matrix.

local getModelView ( )
inline

Get the model view matrix.

The ModelView matrix.


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