123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- #ifndef __CC_TRIANGLES_COMMAND__
- #define __CC_TRIANGLES_COMMAND__
- #include "renderer/CCRenderCommand.h"
- #include "renderer/CCGLProgramState.h"
- NS_CC_BEGIN
- class CC_DLL TrianglesCommand : public RenderCommand
- {
- public:
-
- struct Triangles
- {
-
- V3F_C4B_T2F* verts;
-
- unsigned short* indices;
-
- int vertCount;
-
- int indexCount;
- };
-
- TrianglesCommand();
-
- ~TrianglesCommand();
-
-
- void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv, uint32_t flags);
-
- CC_DEPRECATED_ATTRIBUTE void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv);
- void init(float globalOrder, Texture2D* textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles, const Mat4& mv, uint32_t flags);
-
- void useMaterial() const;
-
- uint32_t getMaterialID() const { return _materialID; }
-
- GLuint getTextureID() const { return _textureID; }
-
- const Triangles& getTriangles() const { return _triangles; }
-
- ssize_t getVertexCount() const { return _triangles.vertCount; }
-
- ssize_t getIndexCount() const { return _triangles.indexCount; }
-
- const V3F_C4B_T2F* getVertices() const { return _triangles.verts; }
-
- const unsigned short* getIndices() const { return _triangles.indices; }
-
- GLProgramState* getGLProgramState() const { return _glProgramState; }
-
- BlendFunc getBlendType() const { return _blendType; }
-
- const Mat4& getModelView() const { return _mv; }
-
- protected:
-
- void generateMaterialID();
-
-
- uint32_t _materialID;
-
- GLuint _textureID;
-
- GLProgramState* _glProgramState;
-
- BlendFunc _blendType;
-
- Triangles _triangles;
-
- Mat4 _mv;
- GLuint _alphaTextureID;
- };
- NS_CC_END
- #endif
|