2013-11-09 04:06:39 +08:00
|
|
|
//
|
|
|
|
// Created by NiTe Luo on 11/8/13.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _CC_CUSTOMCOMMAND_H_
|
|
|
|
#define _CC_CUSTOMCOMMAND_H_
|
|
|
|
|
|
|
|
#include "RenderCommand.h"
|
2013-12-03 14:08:47 +08:00
|
|
|
#include "RenderCommandPool.h"
|
2013-11-09 04:06:39 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class CustomCommand : public RenderCommand
|
|
|
|
{
|
2013-12-03 14:08:47 +08:00
|
|
|
protected:
|
2013-12-03 11:17:21 +08:00
|
|
|
CustomCommand();
|
2013-11-09 04:06:39 +08:00
|
|
|
~CustomCommand();
|
2013-12-03 14:08:47 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
void init(int viewport, int32_t depth);
|
2013-11-09 04:06:39 +08:00
|
|
|
|
|
|
|
// +----------+----------+-----+-----------------------------------+
|
|
|
|
// | | | | | |
|
2013-11-11 16:14:29 +08:00
|
|
|
// | ViewPort | Transluc | | Depth | |
|
|
|
|
// | 3 bits | 1 bit | | 24 bits | |
|
2013-11-09 04:06:39 +08:00
|
|
|
// +----------+----------+-----+----------------+------------------+
|
|
|
|
virtual int64_t generateID();
|
|
|
|
|
|
|
|
void execute();
|
|
|
|
|
|
|
|
inline bool isTranslucent() { return true; }
|
2013-12-03 14:08:47 +08:00
|
|
|
virtual void releaseToCommandPool() override;
|
2013-11-09 04:06:39 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
function<void()> func;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int _viewport;
|
|
|
|
|
|
|
|
int32_t _depth;
|
2013-12-03 14:08:47 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
friend class RenderCommandPool<CustomCommand>;
|
|
|
|
static RenderCommandPool<CustomCommand>& getCommandPool() { return _commandPool; }
|
|
|
|
protected:
|
|
|
|
static RenderCommandPool<CustomCommand> _commandPool;
|
2013-11-09 04:06:39 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif //_CC_CUSTOMCOMMAND_H_
|