axmol/cocos/2d/renderer/QuadCommand.h

70 lines
1.6 KiB
C
Raw Normal View History

//
// Created by NiTe Luo on 11/6/13.
//
#ifndef _CC_QUADCOMMAND_H_
#define _CC_QUADCOMMAND_H_
#include "RenderCommand.h"
2013-11-08 07:48:37 +08:00
#include "CCGLProgram.h"
NS_CC_BEGIN
class QuadCommand : public RenderCommand
{
2013-11-07 06:57:42 +08:00
public:
2013-11-08 07:48:37 +08:00
QuadCommand(int viewport, int32_t depth, GLuint textureID, GLProgram* shader, BlendFunc blendType, V3F_C4B_T2F_Quad quad);
~QuadCommand();
2013-11-07 06:57:42 +08:00
// +----------+----------+-----+-----------------------------------+
// | | | | | |
2013-11-11 16:14:29 +08:00
// | ViewPort | Transluc | | Depth | Material ID |
// | 3 bits | 1 bit | | 24 bits | 24 bit2 |
2013-11-07 06:57:42 +08:00
// +----------+----------+-----+----------------+------------------+
virtual int64_t generateID();
2013-11-08 07:48:37 +08:00
void useMaterial();
2013-11-07 06:57:42 +08:00
//TODO use material to decide if it is translucent
inline bool isTranslucent() { return true; }
2013-11-07 06:57:42 +08:00
inline int32_t getMaterialID() { return _materialID; }
inline GLuint getTextureID() { return _textureID; }
2013-11-07 06:57:42 +08:00
inline V3F_C4B_T2F_Quad* getQuad() { return &_quad; }
2013-11-11 16:14:29 +08:00
inline int getQuadCount() { return _quadCount; }
2013-11-08 07:48:37 +08:00
inline GLProgram* getShader() { return _shader; }
2013-11-07 06:57:42 +08:00
inline BlendFunc getBlendType() { return _blendType; }
protected:
int32_t _materialID;
//Key Data
int _viewport; /// Which view port it belongs to
2013-11-07 06:57:42 +08:00
//TODO use material to determine if it's translucent
int32_t _depth;
2013-11-07 06:57:42 +08:00
//Maternal
GLuint _textureID;
2013-11-08 07:48:37 +08:00
GLProgram* _shader;
// GLuint _shaderID;
2013-11-07 06:57:42 +08:00
BlendFunc _blendType;
V3F_C4B_T2F_Quad _quad;
2013-11-11 16:14:29 +08:00
int _quadCount;
};
NS_CC_END
#endif //_CC_QUADCOMMAND_H_