axmol/cocos/2d/renderer/CustomCommand.cpp

55 lines
801 B
C++
Raw Normal View History

2013-11-09 04:06:39 +08:00
//
// Created by NiTe Luo on 11/8/13.
//
#include "CustomCommand.h"
NS_CC_BEGIN
RenderCommandPool<CustomCommand> CustomCommand::_commandPool;
2013-11-09 04:06:39 +08:00
CustomCommand::CustomCommand()
2013-11-09 04:06:39 +08:00
:RenderCommand()
, _viewport(0)
, _depth(0)
2013-11-09 04:06:39 +08:00
, func(nullptr)
{
_type = RenderCommand::Type::CUSTOM_COMMAND;
2013-11-09 04:06:39 +08:00
}
void CustomCommand::init(int viewport, int32_t depth)
{
_viewport = viewport;
_depth = depth;
}
2013-11-09 04:06:39 +08:00
CustomCommand::~CustomCommand()
{
}
int64_t CustomCommand::generateID()
{
_id = 0;
_id = (int64_t)_viewport << 61
| (int64_t)1 << 60 // translucent
2013-11-11 16:14:29 +08:00
| (int64_t)_depth << 36;
2013-11-09 04:06:39 +08:00
return _id;
}
void CustomCommand::execute()
{
if(func)
{
func();
}
}
void CustomCommand::releaseToCommandPool()
{
getCommandPool().pushBackCommand(this);
}
2013-11-09 04:06:39 +08:00
NS_CC_END