diff --git a/cocos/2d/renderer/QuadCommand.cpp b/cocos/2d/renderer/QuadCommand.cpp index 1dd38714a4..f0a09f8d46 100644 --- a/cocos/2d/renderer/QuadCommand.cpp +++ b/cocos/2d/renderer/QuadCommand.cpp @@ -19,6 +19,11 @@ QuadCommand::QuadCommand(int viewport, int32_t depth, GLuint textureID, GLuint s _type = QUAD_COMMAND; } +QuadCommand::~QuadCommand() +{ + +} + int64_t QuadCommand::generateID() { _id = 0; diff --git a/cocos/2d/renderer/QuadCommand.h b/cocos/2d/renderer/QuadCommand.h index 6a0d7cf729..74c9293abc 100644 --- a/cocos/2d/renderer/QuadCommand.h +++ b/cocos/2d/renderer/QuadCommand.h @@ -16,6 +16,7 @@ class QuadCommand : public RenderCommand { public: QuadCommand(int viewport, int32_t depth, GLuint textureID, GLuint shaderID, BlendFunc blendType, V3F_C4B_T2F_Quad quad); + ~QuadCommand(); // +----------+----------+-----+-----------------------------------+ // | | | | | | @@ -26,12 +27,17 @@ public: //TODO use material to decide if it is translucent inline bool isTranslucent() { return true; } + inline bool isCommand() { return false; } + inline int32_t getMaterialID() { return _materialID; } inline GLuint getTextureID() { return _textureID; } + inline V3F_C4B_T2F_Quad* getQuad() { return &_quad; } + inline GLuint getShaderID() { return _shaderID; } + inline BlendFunc getBlendType() { return _blendType; } protected: @@ -39,11 +45,15 @@ protected: //Key Data int _viewport; /// Which view port it belongs to + //TODO use material to determine if it's translucent int32_t _depth; + //Maternal GLuint _textureID; + GLuint _shaderID; + BlendFunc _blendType; V3F_C4B_T2F_Quad _quad; diff --git a/cocos/2d/renderer/RenderCommand.cpp b/cocos/2d/renderer/RenderCommand.cpp index baa691bbff..6b94fd977d 100644 --- a/cocos/2d/renderer/RenderCommand.cpp +++ b/cocos/2d/renderer/RenderCommand.cpp @@ -13,6 +13,9 @@ RenderCommand::RenderCommand() _type = UNKNOWN_COMMAND; } +RenderCommand::~RenderCommand() +{ +} void printBits(size_t const size, void const * const ptr) { diff --git a/cocos/2d/renderer/RenderCommand.h b/cocos/2d/renderer/RenderCommand.h index 57ad8864c1..c7d8650ad5 100644 --- a/cocos/2d/renderer/RenderCommand.h +++ b/cocos/2d/renderer/RenderCommand.h @@ -27,6 +27,7 @@ class RenderCommand public: RenderCommand(); + virtual ~RenderCommand(); virtual int64_t generateID() = 0; /** diff --git a/cocos/2d/renderer/Renderer.cpp b/cocos/2d/renderer/Renderer.cpp index c05ce1415a..adfbca4298 100644 --- a/cocos/2d/renderer/Renderer.cpp +++ b/cocos/2d/renderer/Renderer.cpp @@ -27,17 +27,11 @@ Renderer *Renderer::getInstance() } Renderer::Renderer() -:_currentMaterialID(0) +:_lastMaterialID(0) { _shaderProgram = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR); } -void Renderer::setOpenGLView(EGLView *newOpenGLView) -{ - //TODO move render related logic to render - _openGLView = newOpenGLView; -} - void Renderer::addRenderCommand(RenderCommand *command) { command->generateID(); diff --git a/cocos/2d/renderer/Renderer.h b/cocos/2d/renderer/Renderer.h index 65048f06b1..d1336372a9 100644 --- a/cocos/2d/renderer/Renderer.h +++ b/cocos/2d/renderer/Renderer.h @@ -20,7 +20,7 @@ class Renderer public: static Renderer* getInstance(); - void setOpenGLView(EGLView *newOpenGLView); + //TODO support multiple viewport void addRenderCommand(RenderCommand* commnad); void render(); @@ -28,10 +28,10 @@ protected: Renderer(); protected: - EGLView* _openGLView; vector _renderQueue; GLProgram* _shaderProgram; - int _currentMaterialID; + int _lastMaterialID; + V3F_C4B_T2F_Quad* _quadBuffer; }; NS_CC_END