mirror of https://github.com/axmolengine/axmol.git
Disable 3D rendering support for commands that needs to execute in order
This commit is contained in:
parent
4a440e66c9
commit
0bddeb88c8
|
@ -246,12 +246,12 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32
|
|||
|
||||
//Add group command
|
||||
|
||||
_groupCommand.init(_globalZOrder, _modelViewTransform, flags);
|
||||
_groupCommand.init(_globalZOrder);
|
||||
renderer->addCommand(&_groupCommand);
|
||||
|
||||
renderer->pushGroup(_groupCommand.getRenderQueueID());
|
||||
|
||||
_beforeVisitCmd.init(_globalZOrder, _modelViewTransform, flags);
|
||||
_beforeVisitCmd.init(_globalZOrder);
|
||||
_beforeVisitCmd.func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this);
|
||||
renderer->addCommand(&_beforeVisitCmd);
|
||||
if (_alphaThreshold < 1)
|
||||
|
@ -274,7 +274,7 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32
|
|||
}
|
||||
_stencil->visit(renderer, _modelViewTransform, flags);
|
||||
|
||||
_afterDrawStencilCmd.init(_globalZOrder, _modelViewTransform, flags);
|
||||
_afterDrawStencilCmd.init(_globalZOrder);
|
||||
_afterDrawStencilCmd.func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this);
|
||||
renderer->addCommand(&_afterDrawStencilCmd);
|
||||
|
||||
|
@ -306,7 +306,7 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32
|
|||
this->draw(renderer, _modelViewTransform, flags);
|
||||
}
|
||||
|
||||
_afterVisitCmd.init(_globalZOrder, _modelViewTransform, flags);
|
||||
_afterVisitCmd.init(_globalZOrder);
|
||||
_afterVisitCmd.func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this);
|
||||
renderer->addCommand(&_afterVisitCmd);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ void NodeGrid::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t p
|
|||
_modelViewTransform = this->transform(parentTransform);
|
||||
_transformUpdated = false;
|
||||
|
||||
_groupCommand.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_groupCommand.init(_globalZOrder);
|
||||
renderer->addCommand(&_groupCommand);
|
||||
renderer->pushGroup(_groupCommand.getRenderQueueID());
|
||||
|
||||
|
@ -111,7 +111,7 @@ void NodeGrid::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t p
|
|||
_nodeGrid->set2DProjection();
|
||||
}
|
||||
|
||||
_gridBeginCommand.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_gridBeginCommand.init(_globalZOrder);
|
||||
_gridBeginCommand.func = CC_CALLBACK_0(NodeGrid::onGridBeginDraw, this);
|
||||
renderer->addCommand(&_gridBeginCommand);
|
||||
|
||||
|
@ -160,7 +160,7 @@ void NodeGrid::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t p
|
|||
director->setProjection(beforeProjectionType);
|
||||
}
|
||||
|
||||
_gridEndCommand.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_gridEndCommand.init(_globalZOrder);
|
||||
_gridEndCommand.func = CC_CALLBACK_0(NodeGrid::onGridEndDraw, this);
|
||||
renderer->addCommand(&_gridEndCommand);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
public:
|
||||
|
||||
void init(float globalZOrder, const Mat4& modelViewTransform, uint32_t flags);
|
||||
CC_DEPRECATED_ATTRIBUTE void init(float globalZOrder, const Mat4& modelViewTransform, uint32_t flags);
|
||||
void init(float depth);
|
||||
|
||||
void execute();
|
||||
|
|
|
@ -77,14 +77,6 @@ GroupCommand::GroupCommand()
|
|||
_renderQueueID = Director::getInstance()->getRenderer()->getGroupCommandManager()->getGroupID();
|
||||
}
|
||||
|
||||
void GroupCommand::init(float globalZOrder, const cocos2d::Mat4 &modelViewTransform, uint32_t flags)
|
||||
{
|
||||
RenderCommand::init(globalZOrder, modelViewTransform, flags);
|
||||
auto manager = Director::getInstance()->getRenderer()->getGroupCommandManager();
|
||||
manager->releaseGroupID(_renderQueueID);
|
||||
_renderQueueID = manager->getGroupID();
|
||||
}
|
||||
|
||||
void GroupCommand::init(float globalOrder)
|
||||
{
|
||||
_globalOrder = globalOrder;
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
GroupCommand();
|
||||
~GroupCommand();
|
||||
|
||||
void init(float globalZOrder, const Mat4& modelViewTransform, uint32_t flags);
|
||||
void init(float depth);
|
||||
|
||||
inline int getRenderQueueID() const {return _renderQueueID;}
|
||||
|
|
|
@ -251,18 +251,18 @@ void Layout::stencilClippingVisit(Renderer *renderer, const Mat4& parentTransfor
|
|||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
||||
//Add group command
|
||||
|
||||
_groupCommand.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_groupCommand.init(_globalZOrder);
|
||||
renderer->addCommand(&_groupCommand);
|
||||
|
||||
renderer->pushGroup(_groupCommand.getRenderQueueID());
|
||||
|
||||
_beforeVisitCmdStencil.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_beforeVisitCmdStencil.init(_globalZOrder);
|
||||
_beforeVisitCmdStencil.func = CC_CALLBACK_0(Layout::onBeforeVisitStencil, this);
|
||||
renderer->addCommand(&_beforeVisitCmdStencil);
|
||||
|
||||
_clippingStencil->visit(renderer, _modelViewTransform, flags);
|
||||
|
||||
_afterDrawStencilCmd.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_afterDrawStencilCmd.init(_globalZOrder);
|
||||
_afterDrawStencilCmd.func = CC_CALLBACK_0(Layout::onAfterDrawStencil, this);
|
||||
renderer->addCommand(&_afterDrawStencilCmd);
|
||||
|
||||
|
@ -310,7 +310,7 @@ void Layout::stencilClippingVisit(Renderer *renderer, const Mat4& parentTransfor
|
|||
(*it)->visit(renderer, _modelViewTransform, flags);
|
||||
|
||||
|
||||
_afterVisitCmdStencil.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_afterVisitCmdStencil.init(_globalZOrder);
|
||||
_afterVisitCmdStencil.func = CC_CALLBACK_0(Layout::onAfterVisitStencil, this);
|
||||
renderer->addCommand(&_afterVisitCmdStencil);
|
||||
|
||||
|
@ -424,13 +424,13 @@ void Layout::onAfterVisitScissor()
|
|||
|
||||
void Layout::scissorClippingVisit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags)
|
||||
{
|
||||
_beforeVisitCmdScissor.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_beforeVisitCmdScissor.init(_globalZOrder);
|
||||
_beforeVisitCmdScissor.func = CC_CALLBACK_0(Layout::onBeforeVisitScissor, this);
|
||||
renderer->addCommand(&_beforeVisitCmdScissor);
|
||||
|
||||
ProtectedNode::visit(renderer, parentTransform, parentFlags);
|
||||
|
||||
_afterVisitCmdScissor.init(_globalZOrder, _modelViewTransform, parentFlags);
|
||||
_afterVisitCmdScissor.init(_globalZOrder);
|
||||
_afterVisitCmdScissor.func = CC_CALLBACK_0(Layout::onAfterVisitScissor, this);
|
||||
renderer->addCommand(&_afterVisitCmdScissor);
|
||||
}
|
||||
|
|
|
@ -516,7 +516,7 @@ void ScrollView::addChild(Node * child, int zOrder, const std::string &name)
|
|||
void ScrollView::beforeDraw()
|
||||
{
|
||||
//ScrollView don't support drawing in 3D space
|
||||
_beforeDrawCommand.init(_globalZOrder, _modelViewTransform, 0);
|
||||
_beforeDrawCommand.init(_globalZOrder);
|
||||
_beforeDrawCommand.func = CC_CALLBACK_0(ScrollView::onBeforeDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(&_beforeDrawCommand);
|
||||
}
|
||||
|
@ -553,8 +553,7 @@ void ScrollView::onBeforeDraw()
|
|||
|
||||
void ScrollView::afterDraw()
|
||||
{
|
||||
//ScrollView don't support drawing in 3D space
|
||||
_afterDrawCommand.init(_globalZOrder, _modelViewTransform, 0);
|
||||
_afterDrawCommand.init(_globalZOrder);
|
||||
_afterDrawCommand.func = CC_CALLBACK_0(ScrollView::onAfterDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(&_afterDrawCommand);
|
||||
}
|
||||
|
|
|
@ -617,7 +617,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const Mat4 &transform, uint3
|
|||
|
||||
auto iter = _renderCmds.begin();
|
||||
|
||||
iter->init(_globalZOrder, transform, flags);
|
||||
iter->init(_globalZOrder);
|
||||
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onEnableStencil, this);
|
||||
renderer->addCommand(&(*iter));
|
||||
++iter;
|
||||
|
@ -633,7 +633,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const Mat4 &transform, uint3
|
|||
_sprites.at(i)->setPosition( spritePoint );
|
||||
_spritesStencil.at(i)->setPosition( spritePoint );
|
||||
|
||||
iter->init(_globalZOrder, transform, flags);
|
||||
iter->init(_globalZOrder);
|
||||
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onBeforeDrawClip, this, i, stencilPoint);
|
||||
renderer->addCommand(&(*iter));
|
||||
++iter;
|
||||
|
@ -646,7 +646,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const Mat4 &transform, uint3
|
|||
_spritesStencil.at(i)->visit(renderer, _modelViewTransform, flags);
|
||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
|
||||
iter->init(_globalZOrder, transform, flags);
|
||||
iter->init(_globalZOrder);
|
||||
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onBeforeDrawSprite, this, i, winPoint);
|
||||
renderer->addCommand(&(*iter));
|
||||
++iter;
|
||||
|
@ -657,7 +657,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const Mat4 &transform, uint3
|
|||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
}
|
||||
|
||||
iter->init(_globalZOrder, transform, flags);
|
||||
iter->init(_globalZOrder);
|
||||
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onDisableStencil, this);
|
||||
renderer->addCommand(&(*iter));
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ SpriteInGroupCommand* SpriteInGroupCommand::create(const std::string &filename)
|
|||
void SpriteInGroupCommand::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
{
|
||||
CCASSERT(renderer, "Render is null");
|
||||
_spriteWrapperCommand.init(_globalZOrder, transform, flags);
|
||||
_spriteWrapperCommand.init(_globalZOrder);
|
||||
renderer->addCommand(&_spriteWrapperCommand);
|
||||
renderer->pushGroup(_spriteWrapperCommand.getRenderQueueID());
|
||||
Sprite::draw(renderer, transform, flags);
|
||||
|
|
Loading…
Reference in New Issue