add loadIdentityMatrix in Director

This commit is contained in:
Huabing.Xu 2014-04-02 16:47:23 +08:00
parent 106a0da87b
commit 78eea4a735
2 changed files with 28 additions and 7 deletions

View File

@ -461,6 +461,26 @@ void Director::popMatrix(MATRIX_STACK_TYPE type)
}
}
void Director::loadIdentityMatrix(MATRIX_STACK_TYPE type)
{
if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
{
kmMat4Identity(&_modelViewMatrixStack.top());
}
else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
{
kmMat4Identity(&_projectionMatrixStack.top());
}
else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
{
kmMat4Identity(&_textureMatrixStack.top());
}
else
{
CCASSERT(false, "unknow matrix stack type");
}
}
void Director::loadMatrix(MATRIX_STACK_TYPE type, const kmMat4& mat)
{
if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)

View File

@ -84,15 +84,15 @@ and when to execute the Scenes.
- GL_COLOR_ARRAY is enabled
- GL_TEXTURE_COORD_ARRAY is enabled
*/
enum class MATRIX_STACK_TYPE
{
MATRIX_STACK_MODELVIEW,
MATRIX_STACK_PROJECTION,
MATRIX_STACK_TEXTURE
};
class CC_DLL Director : public Ref
{
public:
enum class MATRIX_STACK_TYPE
{
MATRIX_STACK_MODELVIEW,
MATRIX_STACK_PROJECTION,
MATRIX_STACK_TEXTURE
};
private:
std::stack<kmMat4> _modelViewMatrixStack;
std::stack<kmMat4> _projectionMatrixStack;
@ -102,6 +102,7 @@ protected:
public:
void pushMatrix(MATRIX_STACK_TYPE type);
void popMatrix(MATRIX_STACK_TYPE type);
void loadIdentityMatrix(MATRIX_STACK_TYPE type);
void loadMatrix(MATRIX_STACK_TYPE type, const kmMat4& mat);
void multiplyMatrix(MATRIX_STACK_TYPE type, const kmMat4& mat);
kmMat4 getMatrix(MATRIX_STACK_TYPE type);