mirror of https://github.com/axmolengine/axmol.git
[ci skip] update comments CCGLProgramStateCache.h, CCPrimitive.h CCPrimitiveCommand.h
This commit is contained in:
parent
126186e413
commit
027106c9ee
|
@ -38,19 +38,23 @@ class GLProgram;
|
|||
|
||||
class GLProgramState;
|
||||
|
||||
//
|
||||
//
|
||||
// GLProgramStateCache
|
||||
//
|
||||
//
|
||||
/**
|
||||
Some GLprogram state could be shared. GLProgramStateCache is used to cache this, and will reuse the
|
||||
old GLProgramState, which will accelerate the creation of game objects such as sprites, particles etc.
|
||||
*/
|
||||
class CC_DLL GLProgramStateCache
|
||||
{
|
||||
public:
|
||||
/**Get the GLProgramStateCache singleton instance.*/
|
||||
static GLProgramStateCache* getInstance();
|
||||
/**Destroy the GLProgramStateCache singleton.*/
|
||||
static void destroyInstance();
|
||||
|
||||
/**Get the shared GLProgramState by the owner GLProgram.*/
|
||||
GLProgramState* getGLProgramState(GLProgram* program);
|
||||
/**Remove all the cached GLProgramState.*/
|
||||
void removeAllGLProgramState();
|
||||
/**Remove unused GLProgramState.*/
|
||||
void removeUnusedGLProgramState();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -31,23 +31,37 @@ NS_CC_BEGIN
|
|||
|
||||
class IndexBuffer;
|
||||
|
||||
/**
|
||||
Primitive can support sending points, lines and triangles to glpipeline, which is an abstraction
|
||||
of primitive data.
|
||||
*/
|
||||
class CC_DLL Primitive : public Ref
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Create an instance of primitive.
|
||||
@param verts VertexData used in the primitive.
|
||||
@param indices Optional index data.
|
||||
@param type The type (Points, Lines, Triangles) used.
|
||||
*/
|
||||
static Primitive* create(VertexData* verts, IndexBuffer* indices, int type);
|
||||
|
||||
/**Get the vertexData.*/
|
||||
const VertexData* getVertexData() const;
|
||||
|
||||
/**Get the optional index data, will return null if index data is not used.*/
|
||||
const IndexBuffer* getIndexData() const;
|
||||
|
||||
/**Get the primitive type.*/
|
||||
int getType() const { return _type; }
|
||||
|
||||
//called by rendering framework
|
||||
/**called by rendering framework, will send the data to GLPipeline.*/
|
||||
void draw();
|
||||
|
||||
/**Get the start index of primtive.*/
|
||||
int getStart() const { return _start; }
|
||||
/**Get the number of vertices or indices used for drawing.*/
|
||||
int getCount() const { return _count; }
|
||||
/**Setter for the start index.*/
|
||||
void setStart(int start) { _start = start; }
|
||||
/**Setter for the count. */
|
||||
void setCount(int count) { _count = count; }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -30,21 +30,45 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
class GLProgramState;
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
class CC_DLL PrimitiveCommand : public RenderCommand
|
||||
{
|
||||
public:
|
||||
/**@{
|
||||
@Constructor and Destructor.
|
||||
*/
|
||||
PrimitiveCommand();
|
||||
~PrimitiveCommand();
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** Initializes the command.
|
||||
@param globalOrder GlobalZOrder of the command.
|
||||
@param textureID The openGL handle of the used texture.
|
||||
@param glProgramState The specified glProgram and its uniform.
|
||||
@param blendType Blend function for the command.
|
||||
@param primitive Rendered primitive for the command.
|
||||
@param mv ModelView matrix for the command.
|
||||
@param flags to 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, uint32_t flags);
|
||||
CC_DEPRECATED_ATTRIBUTE void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, Primitive* primitive,const Mat4& mv);
|
||||
|
||||
/**Get the generated material ID.*/
|
||||
inline uint32_t getMaterialID() const { return _materialID; }
|
||||
/**Get the texture ID used for drawing.*/
|
||||
inline GLuint getTextureID() const { return _textureID; }
|
||||
/**Get the glprogramstate used for drawing.*/
|
||||
inline GLProgramState* getGLProgramState() const { return _glProgramState; }
|
||||
/**Get the blend funcion for drawing.*/
|
||||
inline BlendFunc getBlendType() const { return _blendType; }
|
||||
/**Get the modelview matrix when draw the primtive.*/
|
||||
inline const Mat4& getModelView() const { return _mv; }
|
||||
|
||||
/**Execute and draw the commmand, called by renderer.*/
|
||||
void execute() const;
|
||||
protected:
|
||||
|
||||
|
|
Loading…
Reference in New Issue