comment out director::getMatrix temporarily

This commit is contained in:
Huabing.Xu 2014-04-03 10:33:59 +08:00
parent dd4d45ea90
commit 79f62f4351
4 changed files with 51 additions and 43 deletions

View File

@ -579,38 +579,38 @@ void Director::pushMatrix(MATRIX_STACK_TYPE type)
}
}
kmMat4 Director::getMatrix(MATRIX_STACK_TYPE type)
{
if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
{
kmMat4 result;
kmGLGetMatrix(KM_GL_MODELVIEW, &result);
return result;
return _modelViewMatrixStack.top();
}
else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
{
kmMat4 result;
kmGLGetMatrix(KM_GL_PROJECTION, &result);
return result;
return _projectionMatrixStack.top();
}
else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
{
kmMat4 result;
kmGLGetMatrix(KM_GL_TEXTURE, &result);
return result;
return _textureMatrixStack.top();
}
else
{
CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
kmMat4 result;
kmGLGetMatrix(KM_GL_MODELVIEW, &result);
return result;
return _modelViewMatrixStack.top();
}
}
//kmMat4 Director::getMatrix(MATRIX_STACK_TYPE type)
//{
// if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
// {
// kmMat4 result;
// kmGLGetMatrix(KM_GL_MODELVIEW, &result);
// return result;
// return _modelViewMatrixStack.top();
// }
// else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
// {
// kmMat4 result;
// kmGLGetMatrix(KM_GL_PROJECTION, &result);
// return result;
// return _projectionMatrixStack.top();
// }
// else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
// {
// kmMat4 result;
// kmGLGetMatrix(KM_GL_TEXTURE, &result);
// return result;
// return _textureMatrixStack.top();
// }
// else
// {
// CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
// kmMat4 result;
// kmGLGetMatrix(KM_GL_MODELVIEW, &result);
// return result;
// return _modelViewMatrixStack.top();
// }
//}
void Director::setProjection(Projection projection)
{
@ -741,7 +741,8 @@ static void GLToClipTransform(kmMat4 *transformOut)
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 projection;
projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
//projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
kmGLGetMatrix(KM_GL_PROJECTION, &projection);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
//if needed, we need to undo the rotation for Landscape orientation in order to get the correct positions
@ -749,8 +750,8 @@ static void GLToClipTransform(kmMat4 *transformOut)
#endif
kmMat4 modelview;
modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
//modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
kmGLGetMatrix(KM_GL_MODELVIEW, &modelview);
kmMat4Multiply(transformOut, &projection, &modelview);
}

View File

@ -105,7 +105,7 @@ public:
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);
//kmMat4 getMatrix(MATRIX_STACK_TYPE type);
public:
static const char *EVENT_PROJECTION_CHANGED;
static const char* EVENT_AFTER_UPDATE;

View File

@ -629,8 +629,13 @@ void GLProgram::setUniformLocationWithMatrix4fv(GLint location, const GLfloat* m
void GLProgram::setUniformsForBuiltins()
{
Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 matrixMV;
kmGLGetMatrix(KM_GL_MODELVIEW, &matrixMV);
//matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
kmGLGetMatrix(KM_GL_MODELVIEW, &matrixMV);
setUniformsForBuiltins(matrixMV);
}
@ -638,8 +643,8 @@ void GLProgram::setUniformsForBuiltins()
void GLProgram::setUniformsForBuiltins(const kmMat4 &matrixMV)
{
kmMat4 matrixP;
kmGLGetMatrix(KM_GL_PROJECTION, &matrixP);
//= Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
kmGLGetMatrix(KM_GL_PROJECTION, &matrixP);
if(_flags.usesP)
setUniformLocationWithMatrix4fv(_uniforms[UNIFORM_P_MATRIX], matrixP.mat, 1);

View File

@ -953,10 +953,12 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
// IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack,
// To ease the migration to v3.0, we still support the kmMat4 stack,
// but it is deprecated and your code should not rely on it
kmGLPushMatrix();
kmGLLoadMatrix(&_modelViewTransform);
Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
int i = 0;
@ -987,7 +989,7 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
// reset for next frame
_orderOfArrival = 0;
kmGLPopMatrix();
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}
kmMat4 Node::transform(const kmMat4& parentTransform)