Specialize GroupCommand and CustomCommand, change generateCommand to new.

This commit is contained in:
boyu0 2013-12-26 15:41:47 +08:00
parent 963d637198
commit f878864794
22 changed files with 75 additions and 43 deletions

View File

@ -151,7 +151,7 @@ void AtlasNode::draw(void)
auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP); auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP);
QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); QuadCommand* cmd = new QuadCommand();
cmd->init(0, cmd->init(0,
_vertexZ, _vertexZ,
_textureAtlas->getTexture()->getName(), _textureAtlas->getTexture()->getName(),

View File

@ -209,20 +209,20 @@ void ClippingNode::visit()
Renderer* renderer = Director::getInstance()->getRenderer(); Renderer* renderer = Director::getInstance()->getRenderer();
GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); GroupCommand* groupCommand = new GroupCommand();
groupCommand->init(0,_vertexZ); groupCommand->init(0,_vertexZ);
renderer->addCommand(groupCommand); renderer->addCommand(groupCommand);
renderer->pushGroup(groupCommand->getRenderQueueID()); renderer->pushGroup(groupCommand->getRenderQueueID());
CustomCommand* beforeVisitCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* beforeVisitCmd = new CustomCommand();
beforeVisitCmd->init(0,_vertexZ); beforeVisitCmd->init(0,_vertexZ);
beforeVisitCmd->func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this); beforeVisitCmd->func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this);
renderer->addCommand(beforeVisitCmd); renderer->addCommand(beforeVisitCmd);
_stencil->visit(); _stencil->visit();
CustomCommand* afterDrawStencilCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* afterDrawStencilCmd = new CustomCommand();
afterDrawStencilCmd->init(0,_vertexZ); afterDrawStencilCmd->init(0,_vertexZ);
afterDrawStencilCmd->func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this); afterDrawStencilCmd->func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this);
renderer->addCommand(afterDrawStencilCmd); renderer->addCommand(afterDrawStencilCmd);
@ -253,7 +253,7 @@ void ClippingNode::visit()
this->draw(); this->draw();
} }
CustomCommand* afterVisitCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* afterVisitCmd = new CustomCommand();
afterVisitCmd->init(0,_vertexZ); afterVisitCmd->init(0,_vertexZ);
afterVisitCmd->func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this); afterVisitCmd->func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this);
renderer->addCommand(afterVisitCmd); renderer->addCommand(afterVisitCmd);

View File

@ -241,7 +241,7 @@ void DrawNode::render()
void DrawNode::draw() void DrawNode::draw()
{ {
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(DrawNode::onDraw, this); cmd->func = CC_CALLBACK_0(DrawNode::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -564,7 +564,7 @@ void LayerColor::updateColor()
void LayerColor::draw() void LayerColor::draw()
{ {
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(LayerColor::onDraw, this); cmd->func = CC_CALLBACK_0(LayerColor::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -358,7 +358,7 @@ void MotionStreak::draw()
if(_nuPoints <= 1) if(_nuPoints <= 1)
return; return;
kmGLGetMatrix(KM_GL_MODELVIEW,&_cachedMV); kmGLGetMatrix(KM_GL_MODELVIEW,&_cachedMV);
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0,_vertexZ); cmd->init(0,_vertexZ);
cmd->func = CC_CALLBACK_0(MotionStreak::onDraw, this); cmd->func = CC_CALLBACK_0(MotionStreak::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -92,7 +92,7 @@ void NodeGrid::visit()
Renderer* renderer = Director::getInstance()->getRenderer(); Renderer* renderer = Director::getInstance()->getRenderer();
GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); GroupCommand* groupCommand = new GroupCommand();
groupCommand->init(0,_vertexZ); groupCommand->init(0,_vertexZ);
renderer->addCommand(groupCommand); renderer->addCommand(groupCommand);
renderer->pushGroup(groupCommand->getRenderQueueID()); renderer->pushGroup(groupCommand->getRenderQueueID());
@ -105,7 +105,7 @@ void NodeGrid::visit()
_nodeGrid->set2DProjection(); _nodeGrid->set2DProjection();
} }
CustomCommand* gridBeginCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* gridBeginCmd = new CustomCommand();
gridBeginCmd->init(0,_vertexZ); gridBeginCmd->init(0,_vertexZ);
gridBeginCmd->func = CC_CALLBACK_0(NodeGrid::onGridBeginDraw, this); gridBeginCmd->func = CC_CALLBACK_0(NodeGrid::onGridBeginDraw, this);
renderer->addCommand(gridBeginCmd); renderer->addCommand(gridBeginCmd);
@ -154,7 +154,7 @@ void NodeGrid::visit()
director->setProjection(beforeProjectionType); director->setProjection(beforeProjectionType);
} }
CustomCommand* gridEndCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* gridEndCmd = new CustomCommand();
gridEndCmd->init(0,_vertexZ); gridEndCmd->init(0,_vertexZ);
gridEndCmd->func = CC_CALLBACK_0(NodeGrid::onGridEndDraw, this); gridEndCmd->func = CC_CALLBACK_0(NodeGrid::onGridEndDraw, this);
renderer->addCommand(gridEndCmd); renderer->addCommand(gridEndCmd);

View File

@ -392,7 +392,7 @@ void ParticleBatchNode::draw(void)
kmMat4 mv; kmMat4 mv;
kmGLGetMatrix(KM_GL_MODELVIEW, &mv); kmGLGetMatrix(KM_GL_MODELVIEW, &mv);
QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); QuadCommand* cmd = new QuadCommand();
cmd->init(0, cmd->init(0,
_vertexZ, _vertexZ,
_textureAtlas->getTexture()->getName(), _textureAtlas->getTexture()->getName(),

View File

@ -443,7 +443,7 @@ void ParticleSystemQuad::draw()
auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP); auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP);
QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); QuadCommand* cmd = new QuadCommand();
cmd->init(0, _vertexZ, _texture->getName(), shader, _blendFunc, _quads, _particleIdx, _modelViewTransform); cmd->init(0, _vertexZ, _texture->getName(), shader, _blendFunc, _quads, _particleIdx, _modelViewTransform);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);
} }

View File

@ -532,7 +532,7 @@ void ProgressTimer::draw()
if( ! _vertexData || ! _sprite) if( ! _vertexData || ! _sprite)
return; return;
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(ProgressTimer::onDraw, this); cmd->func = CC_CALLBACK_0(ProgressTimer::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -329,7 +329,7 @@ void RenderTexture::beginWithClear(float r, float g, float b, float a, float dep
this->begin(); this->begin();
//clear screen //clear screen
CustomCommand* clearCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* clearCmd = new CustomCommand();
clearCmd->init(0, _vertexZ); clearCmd->init(0, _vertexZ);
clearCmd->func = CC_CALLBACK_0(RenderTexture::onClear, this); clearCmd->func = CC_CALLBACK_0(RenderTexture::onClear, this);
Director::getInstance()->getRenderer()->addCommand(clearCmd); Director::getInstance()->getRenderer()->addCommand(clearCmd);
@ -348,7 +348,7 @@ void RenderTexture::clearDepth(float depthValue)
this->begin(); this->begin();
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(RenderTexture::onClearDepth, this); cmd->func = CC_CALLBACK_0(RenderTexture::onClearDepth, this);
@ -614,7 +614,7 @@ void RenderTexture::draw()
begin(); begin();
//clear screen //clear screen
CustomCommand* clearCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* clearCmd = new CustomCommand();
clearCmd->init(0, _vertexZ); clearCmd->init(0, _vertexZ);
clearCmd->func = CC_CALLBACK_0(RenderTexture::onClear, this); clearCmd->func = CC_CALLBACK_0(RenderTexture::onClear, this);
Director::getInstance()->getRenderer()->addCommand(clearCmd); Director::getInstance()->getRenderer()->addCommand(clearCmd);
@ -643,14 +643,14 @@ void RenderTexture::begin()
kmGLPushMatrix(); kmGLPushMatrix();
kmGLGetMatrix(KM_GL_MODELVIEW, &_transformMatrix); kmGLGetMatrix(KM_GL_MODELVIEW, &_transformMatrix);
GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); GroupCommand* groupCommand = new GroupCommand();
groupCommand->init(0, _vertexZ); groupCommand->init(0, _vertexZ);
Renderer *renderer = Director::getInstance()->getRenderer(); Renderer *renderer = Director::getInstance()->getRenderer();
renderer->addCommand(groupCommand); renderer->addCommand(groupCommand);
renderer->pushGroup(groupCommand->getRenderQueueID()); renderer->pushGroup(groupCommand->getRenderQueueID());
CustomCommand* beginCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* beginCmd = new CustomCommand();
beginCmd->init(0, _vertexZ); beginCmd->init(0, _vertexZ);
beginCmd->func = CC_CALLBACK_0(RenderTexture::onBegin, this); beginCmd->func = CC_CALLBACK_0(RenderTexture::onBegin, this);
@ -659,7 +659,7 @@ void RenderTexture::begin()
void RenderTexture::end() void RenderTexture::end()
{ {
CustomCommand* endCmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* endCmd = new CustomCommand();
endCmd->init(0, _vertexZ); endCmd->init(0, _vertexZ);
endCmd->func = CC_CALLBACK_0(RenderTexture::onEnd, this); endCmd->func = CC_CALLBACK_0(RenderTexture::onEnd, this);

View File

@ -360,7 +360,7 @@ void SpriteBatchNode::draw()
kmMat4 mv; kmMat4 mv;
kmGLGetMatrix(KM_GL_MODELVIEW, &mv); kmGLGetMatrix(KM_GL_MODELVIEW, &mv);
QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); QuadCommand* cmd = new QuadCommand();
cmd->init(0, cmd->init(0,
_vertexZ, _vertexZ,
_textureAtlas->getTexture()->getName(), _textureAtlas->getTexture()->getName(),

View File

@ -33,6 +33,10 @@ NS_CC_BEGIN
class CustomCommand : public RenderCommand class CustomCommand : public RenderCommand
{ {
public:
CustomCommand();
~CustomCommand();
public: public:
static RenderCommandPool<CustomCommand>& getCommandPool() { return _commandPool; } static RenderCommandPool<CustomCommand>& getCommandPool() { return _commandPool; }
@ -52,9 +56,6 @@ public:
std::function<void()> func; std::function<void()> func;
protected: protected:
CustomCommand();
~CustomCommand();
int _viewport; int _viewport;
int32_t _depth; int32_t _depth;
static RenderCommandPool<CustomCommand> _commandPool; static RenderCommandPool<CustomCommand> _commandPool;
@ -62,6 +63,21 @@ protected:
friend class RenderCommandPool<CustomCommand>; friend class RenderCommandPool<CustomCommand>;
}; };
template <>
class RenderCommandPool<CustomCommand>
{
public:
CustomCommand* generateCommand()
{
return new CustomCommand();
}
void pushBackCommand(CustomCommand* ptr)
{
delete ptr;
}
};
NS_CC_END NS_CC_END
#endif //_CC_CUSTOMCOMMAND_H_ #endif //_CC_CUSTOMCOMMAND_H_

View File

@ -52,6 +52,10 @@ protected:
class GroupCommand : public RenderCommand class GroupCommand : public RenderCommand
{ {
public:
GroupCommand();
~GroupCommand();
public: public:
static RenderCommandPool<GroupCommand>& getCommandPool() { return _commandPool; } static RenderCommandPool<GroupCommand>& getCommandPool() { return _commandPool; }
@ -69,9 +73,6 @@ public:
virtual void releaseToCommandPool() override; virtual void releaseToCommandPool() override;
protected: protected:
GroupCommand();
~GroupCommand();
int _viewport; int _viewport;
int32_t _depth; int32_t _depth;
int _renderQueueID; int _renderQueueID;
@ -80,6 +81,21 @@ protected:
friend class RenderCommandPool<GroupCommand>; friend class RenderCommandPool<GroupCommand>;
}; };
template <>
class RenderCommandPool<GroupCommand>
{
public:
GroupCommand* generateCommand()
{
return new GroupCommand();
}
void pushBackCommand(GroupCommand* ptr)
{
delete ptr;
}
};
NS_CC_END NS_CC_END
#endif //_CC_GROUPCOMMAND_H_ #endif //_CC_GROUPCOMMAND_H_

View File

@ -147,7 +147,7 @@ void BatchNode::draw()
void BatchNode::generateGroupCommand() void BatchNode::generateGroupCommand()
{ {
Renderer* renderer = Director::getInstance()->getRenderer(); Renderer* renderer = Director::getInstance()->getRenderer();
GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); GroupCommand* groupCommand = new GroupCommand();
groupCommand->init(0,_vertexZ); groupCommand->init(0,_vertexZ);
renderer->addCommand(groupCommand); renderer->addCommand(groupCommand);

View File

@ -219,7 +219,7 @@ void Skin::draw()
kmGLGetMatrix(KM_GL_MODELVIEW, &mv); kmGLGetMatrix(KM_GL_MODELVIEW, &mv);
//TODO implement z order //TODO implement z order
QuadCommand* renderCommand = QuadCommand::getCommandPool().generateCommand(); QuadCommand* renderCommand = new QuadCommand();
renderCommand->init(0, _vertexZ, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, mv); renderCommand->init(0, _vertexZ, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, mv);
Director::getInstance()->getRenderer()->addCommand(renderCommand); Director::getInstance()->getRenderer()->addCommand(renderCommand);
} }

View File

@ -1289,7 +1289,7 @@ void ActionFollow::onEnter()
void ActionFollow::draw() void ActionFollow::draw()
{ {
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(ActionFollow::onDraw, this); cmd->func = CC_CALLBACK_0(ActionFollow::onDraw, this);
@ -1606,7 +1606,7 @@ void ActionCatmullRomStacked::draw()
kmGLPopMatrix(); kmGLPopMatrix();
kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2);
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(ActionCatmullRomStacked::onDraw, this); cmd->func = CC_CALLBACK_0(ActionCatmullRomStacked::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);
@ -1722,7 +1722,7 @@ void ActionCardinalSplineStacked::draw()
kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2);
kmGLPopMatrix(); kmGLPopMatrix();
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(ActionCardinalSplineStacked::onDraw, this); cmd->func = CC_CALLBACK_0(ActionCardinalSplineStacked::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);
@ -2085,7 +2085,7 @@ void ActionCatmullRom::draw()
kmGLPopMatrix(); kmGLPopMatrix();
kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2);
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(ActionCatmullRom::onDraw, this); cmd->func = CC_CALLBACK_0(ActionCatmullRom::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);
@ -2186,7 +2186,7 @@ void ActionCardinalSpline::draw()
kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2);
kmGLPopMatrix(); kmGLPopMatrix();
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand* cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(ActionCardinalSpline::onDraw, this); cmd->func = CC_CALLBACK_0(ActionCardinalSpline::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -149,7 +149,7 @@ void Box2DTestLayer::draw()
kmGLPushMatrix(); kmGLPushMatrix();
kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV);
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(Box2DTestLayer::onDraw, this); cmd->func = CC_CALLBACK_0(Box2DTestLayer::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -116,7 +116,7 @@ DrawPrimitivesTest::DrawPrimitivesTest()
void DrawPrimitivesTest::draw() void DrawPrimitivesTest::draw()
{ {
CustomCommand * cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand * cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this); cmd->func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -1094,7 +1094,7 @@ std::string TestBoundingBox::title() const
} }
void TestBoundingBox::draw() void TestBoundingBox::draw()
{ {
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(TestBoundingBox::onDraw, this); cmd->func = CC_CALLBACK_0(TestBoundingBox::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -209,7 +209,7 @@ void Atlas1::draw()
// GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// GL_TEXTURE_2D // GL_TEXTURE_2D
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(Atlas1::onDraw, this); cmd->func = CC_CALLBACK_0(Atlas1::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);
@ -526,7 +526,7 @@ Atlas4::Atlas4()
void Atlas4::draw() void Atlas4::draw()
{ {
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(Atlas4::onDraw, this); cmd->func = CC_CALLBACK_0(Atlas4::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);
@ -1613,7 +1613,7 @@ std::string LabelBMFontBounds::subtitle() const
void LabelBMFontBounds::draw() void LabelBMFontBounds::draw()
{ {
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(LabelBMFontBounds::onDraw, this); cmd->func = CC_CALLBACK_0(LabelBMFontBounds::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -589,7 +589,7 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::SimpleSprite::crea
void SpriteRenderTextureBug::SimpleSprite::draw() void SpriteRenderTextureBug::SimpleSprite::draw()
{ {
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(SpriteRenderTextureBug::SimpleSprite::onBeforeDraw, this); cmd->func = CC_CALLBACK_0(SpriteRenderTextureBug::SimpleSprite::onBeforeDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);

View File

@ -196,7 +196,7 @@ void ShaderNode::setPosition(const Point &newPosition)
void ShaderNode::draw() void ShaderNode::draw()
{ {
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(ShaderNode::onDraw, this); cmd->func = CC_CALLBACK_0(ShaderNode::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);
@ -532,7 +532,7 @@ void SpriteBlur::initProgram()
void SpriteBlur::draw() void SpriteBlur::draw()
{ {
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); CustomCommand *cmd = new CustomCommand();
cmd->init(0, _vertexZ); cmd->init(0, _vertexZ);
cmd->func = CC_CALLBACK_0(SpriteBlur::onDraw, this); cmd->func = CC_CALLBACK_0(SpriteBlur::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(cmd); Director::getInstance()->getRenderer()->addCommand(cmd);