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

Command used to render primitive, similar to QuadCommand. More...

#include <CCPrimitiveCommand.h>

Inheritance diagram for PrimitiveCommand:
RenderCommand

Public Member Functions

void init (float globalOrder, GLuint textureID, GLProgramState *glProgramState, BlendFunc blendType, Primitive *primitive, const Mat4 &mv, uint32_t flags)
 Initializes the command. More...
 
local init ( local globalOrder, local textureID, local glProgramState, local blendType, local primitive, local mv, local flags)
 Initializes the command. More...
 
void init (float globalOrder, GLuint textureID, GLProgramState *glProgramState, BlendFunc blendType, Primitive *primitive, const Mat4 &mv)
uint32_t getMaterialID () const
 Get the generated material ID. More...
 
GLuint getTextureID () const
 Get the texture ID used for drawing. More...
 
GLProgramStategetGLProgramState () const
 Get the glprogramstate used for drawing. More...
 
BlendFunc getBlendType () const
 Get the blend funcion for drawing. More...
 
const Mat4getModelView () const
 Get the modelview matrix when draw the primtive. More...
 
void execute () const
 Execute and draw the commmand, called by renderer. More...
 
 PrimitiveCommand ()
 ~PrimitiveCommand ()
- 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 Attributes

uint32_t _materialID
GLuint _textureID
GLProgramState_glProgramState
BlendFunc _blendType
Primitive_primitive
Mat4 _mv
- 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...
 
- Protected Member Functions inherited from RenderCommand
 RenderCommand ()
 Constructor. More...
 
virtual ~RenderCommand ()
 Desctructor. More...
 
local ~RenderCommand ()
 Desctructor. More...
 
void printID ()

Detailed Description

Command used to render primitive, similar to QuadCommand.

Every QuadCommand will have generate material ID by give textureID, glProgramState, Blend function. However, primitive command could not be batched.

Constructor & Destructor Documentation

and Destructor.

and Destructor.

local PrimitiveCommand ( )

and Destructor.

var ~PrimitiveCommand ( )
local ~PrimitiveCommand ( )

Member Function Documentation

void execute ( ) const

Execute and draw the commmand, called by renderer.

var execute ( )

Execute and draw the commmand, called by renderer.

local execute ( )

Execute and draw the commmand, called by renderer.

BlendFunc getBlendType ( ) const
inline

Get the blend funcion for drawing.

var getBlendType ( )
inline

Get the blend funcion for drawing.

local getBlendType ( )
inline

Get the blend funcion for drawing.

GLProgramState* getGLProgramState ( ) const
inline

Get the glprogramstate used for drawing.

var getGLProgramState ( )
inline

Get the glprogramstate used for drawing.

local getGLProgramState ( )
inline

Get the glprogramstate used for drawing.

uint32_t getMaterialID ( ) const
inline

Get the generated material ID.

var getMaterialID ( )
inline

Get the generated material ID.

local getMaterialID ( )
inline

Get the generated material ID.

const Mat4& getModelView ( ) const
inline

Get the modelview matrix when draw the primtive.

var getModelView ( )
inline

Get the modelview matrix when draw the primtive.

local getModelView ( )
inline

Get the modelview matrix when draw the primtive.

GLuint getTextureID ( ) const
inline

Get the texture ID used for drawing.

var getTextureID ( )
inline

Get the texture ID used for drawing.

local getTextureID ( )
inline

Get the texture ID used for drawing.

void init ( float  globalOrder,
GLuint  textureID,
GLProgramState glProgramState,
BlendFunc  blendType,
Primitive primitive,
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.
primitiveRendered primitive 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  primitive,
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.
primitiveRendered primitive 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  primitive,
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.
primitiveRendered primitive 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,
Primitive primitive,
const Mat4 mv 
)
var init ( var  globalOrder,
var  textureID,
var  glProgramState,
var  blendType,
var  primitive,
var  mv 
)
local init ( local  globalOrder,
local  textureID,
local  glProgramState,
local  blendType,
local  primitive,
local  mv 
)

Member Data Documentation

BlendFunc _blendType
protected
var _blendType
protected
local _blendType
protected
GLProgramState* _glProgramState
protected
var _glProgramState
protected
local _glProgramState
protected
uint32_t _materialID
protected
var _materialID
protected
Mat4 _mv
protected
var _mv
protected
local _mv
protected
Primitive* _primitive
protected
var _primitive
protected
local _primitive
protected
GLuint _textureID
protected
var _textureID
protected
local _textureID
protected

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