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

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

#include <CCTrianglesCommand.h>

Inheritance diagram for TrianglesCommand:
RenderCommand

Classes

struct  Triangles
 The structure of Triangles. More...
 

Public Member Functions

 TrianglesCommand ()
 Construtor. More...
 
 ~TrianglesCommand ()
 Destructor. More...
 
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. More...
 
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...
 
const unsigned short * getIndices () const
 Get the index data pointer. More...
 
GLProgramStategetGLProgramState () const
 Get the glprogramstate. More...
 
local getGLProgramState ()
 Get the glprogramstate. 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 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...
 

Protected Member Functions

void generateMaterialID ()
 Generate the material ID by textureID, glProgramState, and blend function. More...
 
- Protected Member Functions inherited from RenderCommand
 RenderCommand ()
 Constructor. More...
 
virtual ~RenderCommand ()
 Desctructor. More...
 
local ~RenderCommand ()
 Desctructor. More...
 
void printID ()

Protected Attributes

uint32_t _materialID
 Generated material id. More...
 
GLuint _textureID
 OpenGL handle for texture. More...
 
GLProgramState_glProgramState
 GLprogramstate for the commmand. More...
 
var _glProgramState
 GLprogramstate for the commmand. More...
 
local _glProgramState
 GLprogramstate for the commmand. More...
 
BlendFunc _blendType
 Blend function when rendering the triangles. More...
 
Triangles _triangles
 Rendered triangles. More...
 
Mat4 _mv
 Model view matrix when rendering the triangles. More...
 
- 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...
 

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.

Constructor & Destructor Documentation

Construtor.

Construtor.

local TrianglesCommand ( )

Construtor.

Destructor.

var ~TrianglesCommand ( )

Destructor.

local ~TrianglesCommand ( )

Destructor.

Member Function Documentation

void generateMaterialID ( )
protected

Generate the material ID by textureID, glProgramState, and blend function.

var generateMaterialID ( )
protected

Generate the material ID by textureID, glProgramState, and blend function.

local generateMaterialID ( )
protected

Generate the material ID by textureID, glProgramState, and blend function.

BlendFunc getBlendType ( ) const
inline

Get the blend function.

var getBlendType ( )
inline

Get the blend function.

local getBlendType ( )
inline

Get the blend function.

GLProgramState* getGLProgramState ( ) const
inline

Get the glprogramstate.

var getGLProgramState ( )
inline

Get the glprogramstate.

local getGLProgramState ( )
inline

Get the glprogramstate.

ssize_t getIndexCount ( ) const
inline

Get the index count of the triangles.

var getIndexCount ( )
inline

Get the index count of the triangles.

local getIndexCount ( )
inline

Get the index count of the triangles.

const unsigned short* getIndices ( ) const
inline

Get the index data pointer.

var getIndices ( )
inline

Get the index data pointer.

local getIndices ( )
inline

Get the index data pointer.

uint32_t getMaterialID ( ) const
inline

Get the material id of command.

var getMaterialID ( )
inline

Get the material id of command.

local getMaterialID ( )
inline

Get the material id of command.

const Mat4& getModelView ( ) const
inline

Get the model view matrix.

var getModelView ( )
inline

Get the model view matrix.

local getModelView ( )
inline

Get the model view matrix.

GLuint getTextureID ( ) const
inline

Get the openGL texture handle.

var getTextureID ( )
inline

Get the openGL texture handle.

local getTextureID ( )
inline

Get the openGL texture handle.

const Triangles& getTriangles ( ) const
inline

Get a const reference of triangles.

var getTriangles ( )
inline

Get a const reference of triangles.

local getTriangles ( )
inline

Get a const reference of triangles.

ssize_t getVertexCount ( ) const
inline

Get the vertex count in the triangles.

var getVertexCount ( )
inline

Get the vertex count in the triangles.

local getVertexCount ( )
inline

Get the vertex count in the triangles.

const V3F_C4B_T2F* getVertices ( ) const
inline

Get the vertex data pointer.

var getVertices ( )
inline

Get the vertex data pointer.

local getVertices ( )
inline

Get the vertex data pointer.

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

Initializes the command.

Parameters
globalOrderGlobalZOrder of the command.
textureIDThe openGL handle of the used texture.
glProgramStateThe specified glProgram and its uniform.
blendTypeBlend function for the command.
trianglesRendered triangles for the command.
mvModelView matrix for the command.
flagsto 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.

Parameters
globalOrderGlobalZOrder of the command.
textureIDThe openGL handle of the used texture.
glProgramStateThe specified glProgram and its uniform.
blendTypeBlend function for the command.
trianglesRendered triangles for the command.
mvModelView matrix for the command.
flagsto 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.

Parameters
globalOrderGlobalZOrder of the command.
textureIDThe openGL handle of the used texture.
glProgramStateThe specified glProgram and its uniform.
blendTypeBlend function for the command.
trianglesRendered triangles for the command.
mvModelView matrix for the command.
flagsto 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.

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.

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.

void useMaterial ( ) const

Apply the texture, shaders, programs, blend functions to GPU pipeline.

var useMaterial ( )

Apply the texture, shaders, programs, blend functions to GPU pipeline.

local useMaterial ( )

Apply the texture, shaders, programs, blend functions to GPU pipeline.

Member Data Documentation

BlendFunc _blendType
protected

Blend function when rendering the triangles.

var _blendType
protected

Blend function when rendering the triangles.

local _blendType
protected

Blend function when rendering the triangles.

GLProgramState* _glProgramState
protected

GLprogramstate for the commmand.

encapsulate shaders and uniforms.

var _glProgramState
protected

GLprogramstate for the commmand.

encapsulate shaders and uniforms.

local _glProgramState
protected

GLprogramstate for the commmand.

encapsulate shaders and uniforms.

uint32_t _materialID
protected

Generated material id.

Mat4 _mv
protected

Model view matrix when rendering the triangles.

var _mv
protected

Model view matrix when rendering the triangles.

local _mv
protected

Model view matrix when rendering the triangles.

GLuint _textureID
protected

OpenGL handle for texture.

var _textureID
protected

OpenGL handle for texture.

local _textureID
protected

OpenGL handle for texture.

Triangles _triangles
protected

Rendered triangles.

var _triangles
protected

Rendered triangles.

local _triangles
protected

Rendered triangles.


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