mirror of https://github.com/axmolengine/axmol.git
refactor: group command use a non parameter constructor and a reentrant init function
This commit is contained in:
parent
d33f05b3f0
commit
d4b9e0538b
|
@ -63,15 +63,23 @@ void GroupCommandManager::releaseGroupID(int groupID)
|
|||
_groupMapping[groupID] = false;
|
||||
}
|
||||
|
||||
GroupCommand::GroupCommand(int viewport, int32_t depth)
|
||||
GroupCommand::GroupCommand()
|
||||
:RenderCommand()
|
||||
, _viewport(viewport)
|
||||
, _depth(depth)
|
||||
, _viewport(0)
|
||||
, _depth(0)
|
||||
{
|
||||
_type = GROUP_COMMAND;
|
||||
_renderQueueID = GroupCommandManager::getInstance()->getGroupID();
|
||||
}
|
||||
|
||||
void GroupCommand::init(int viewport, int32_t depth)
|
||||
{
|
||||
_viewport = viewport;
|
||||
_depth = depth;
|
||||
GroupCommandManager::getInstance()->releaseGroupID(_renderQueueID);
|
||||
_renderQueueID = GroupCommandManager::getInstance()->getGroupID();
|
||||
}
|
||||
|
||||
GroupCommand::~GroupCommand()
|
||||
{
|
||||
GroupCommandManager::getInstance()->releaseGroupID(_renderQueueID);
|
||||
|
|
|
@ -35,7 +35,8 @@ class GroupCommand : public RenderCommand
|
|||
{
|
||||
|
||||
public:
|
||||
GroupCommand(int viewport, int32_t depth);
|
||||
GroupCommand();
|
||||
void init(int viewport, int32_t depth);
|
||||
~GroupCommand();
|
||||
|
||||
// +----------+----------+-----+-----------------------------------+
|
||||
|
|
|
@ -85,7 +85,8 @@ void NewClippingNode::visit()
|
|||
|
||||
Renderer* renderer = Renderer::getInstance();
|
||||
|
||||
GroupCommand* groupCommand = new GroupCommand(0,_vertexZ);
|
||||
GroupCommand* groupCommand = new GroupCommand();
|
||||
groupCommand->init(0,_vertexZ);
|
||||
renderer->addCommand(groupCommand);
|
||||
|
||||
renderer->pushGroup(groupCommand->getRenderQueueID());
|
||||
|
|
Loading…
Reference in New Issue