2013-11-14 09:31:12 +08:00
|
|
|
//
|
|
|
|
// Created by NiTe Luo on 11/13/13.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _CC_GROUPCOMMAND_H_
|
|
|
|
#define _CC_GROUPCOMMAND_H_
|
|
|
|
|
|
|
|
#include "CCPlatformMacros.h"
|
|
|
|
#include "RenderCommand.h"
|
2013-12-03 14:08:47 +08:00
|
|
|
#include "RenderCommandPool.h"
|
2013-11-15 08:39:03 +08:00
|
|
|
#include <map>
|
2013-11-14 09:31:12 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
2013-11-15 08:39:03 +08:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class GroupCommandManager : public Object
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static GroupCommandManager* getInstance();
|
|
|
|
|
|
|
|
~GroupCommandManager();
|
|
|
|
|
|
|
|
bool init();
|
|
|
|
|
|
|
|
int getGroupID();
|
|
|
|
void releaseGroupID(int groupID);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
GroupCommandManager();
|
|
|
|
map<int, bool> _groupMapping;
|
|
|
|
};
|
2013-11-14 09:31:12 +08:00
|
|
|
|
|
|
|
class GroupCommand : public RenderCommand
|
|
|
|
{
|
2013-12-03 14:08:47 +08:00
|
|
|
protected:
|
2013-12-03 11:24:03 +08:00
|
|
|
GroupCommand();
|
2013-11-14 09:31:12 +08:00
|
|
|
~GroupCommand();
|
2013-12-03 14:08:47 +08:00
|
|
|
public:
|
|
|
|
void init(int viewport, int32_t depth);
|
2013-11-14 09:31:12 +08:00
|
|
|
|
|
|
|
// +----------+----------+-----+-----------------------------------+
|
|
|
|
// | | | | | |
|
|
|
|
// | ViewPort | Transluc | | Depth | |
|
|
|
|
// | 3 bits | 1 bit | | 24 bits | |
|
|
|
|
// +----------+----------+-----+----------------+------------------+
|
|
|
|
virtual int64_t generateID() override;
|
|
|
|
|
|
|
|
inline bool isTranslucent() {return true;}
|
|
|
|
inline int getRenderQueueID() {return _renderQueueID;}
|
2013-12-03 14:08:47 +08:00
|
|
|
virtual void releaseToCommandPool() override;
|
|
|
|
|
2013-11-14 09:31:12 +08:00
|
|
|
protected:
|
|
|
|
int _viewport;
|
|
|
|
int32_t _depth;
|
|
|
|
int _renderQueueID;
|
2013-12-03 14:08:47 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
friend class RenderCommandPool<GroupCommand>;
|
|
|
|
static RenderCommandPool<GroupCommand>& getCommandPool() { return _commandPool; }
|
|
|
|
protected:
|
|
|
|
static RenderCommandPool<GroupCommand> _commandPool;
|
2013-11-14 09:31:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif //_CC_GROUPCOMMAND_H_
|