mirror of https://github.com/axmolengine/axmol.git
Layercolor uses the new API
This commit is contained in:
parent
ba2f65c6b2
commit
8df96b1a6e
|
@ -690,7 +690,6 @@ void LayerColor::updateColor()
|
||||||
|
|
||||||
void LayerColor::draw()
|
void LayerColor::draw()
|
||||||
{
|
{
|
||||||
kmGLGetMatrix(KM_GL_MODELVIEW, &_transformMatrix);
|
|
||||||
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand();
|
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand();
|
||||||
cmd->init(0, _vertexZ);
|
cmd->init(0, _vertexZ);
|
||||||
cmd->func = CC_CALLBACK_0(LayerColor::onDraw, this);
|
cmd->func = CC_CALLBACK_0(LayerColor::onDraw, this);
|
||||||
|
@ -699,12 +698,6 @@ void LayerColor::draw()
|
||||||
|
|
||||||
void LayerColor::onDraw()
|
void LayerColor::onDraw()
|
||||||
{
|
{
|
||||||
//TODO we can just reuse the base MV matrix instead of save and reset everytime
|
|
||||||
//TODO need to find out where do we set the base MV matrix
|
|
||||||
kmMat4 prevMatrix;
|
|
||||||
kmGLGetMatrix(KM_GL_MODELVIEW, &prevMatrix);
|
|
||||||
kmGLLoadMatrix(&_transformMatrix);
|
|
||||||
|
|
||||||
CC_NODE_DRAW_SETUP();
|
CC_NODE_DRAW_SETUP();
|
||||||
|
|
||||||
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR );
|
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR );
|
||||||
|
@ -728,8 +721,6 @@ void LayerColor::onDraw()
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
CC_INCREMENT_GL_DRAWS(1);
|
CC_INCREMENT_GL_DRAWS(1);
|
||||||
|
|
||||||
kmGLLoadMatrix(&prevMatrix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerColor::setColor(const Color3B &color)
|
void LayerColor::setColor(const Color3B &color)
|
||||||
|
|
|
@ -299,7 +299,6 @@ protected:
|
||||||
Vertex2F _squareVertices[4];
|
Vertex2F _squareVertices[4];
|
||||||
Color4F _squareColors[4];
|
Color4F _squareColors[4];
|
||||||
|
|
||||||
kmMat4 _transformMatrix;
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
CC_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ class NewDrawNode : public DrawNode
|
||||||
public:
|
public:
|
||||||
static NewDrawNode* create();
|
static NewDrawNode* create();
|
||||||
|
|
||||||
virtual ~NewDrawNode();
|
|
||||||
|
|
||||||
virtual bool init();
|
virtual bool init();
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
|
@ -27,8 +25,8 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NewDrawNode();
|
NewDrawNode();
|
||||||
|
virtual ~NewDrawNode();
|
||||||
|
|
||||||
kmMat4 _transformMatrix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
Loading…
Reference in New Issue