mirror of https://github.com/axmolengine/axmol.git
comment out director::getMatrix temporarily
This commit is contained in:
parent
dd4d45ea90
commit
79f62f4351
|
@ -579,38 +579,38 @@ void Director::pushMatrix(MATRIX_STACK_TYPE type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kmMat4 Director::getMatrix(MATRIX_STACK_TYPE type)
|
//kmMat4 Director::getMatrix(MATRIX_STACK_TYPE type)
|
||||||
{
|
//{
|
||||||
if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
|
// if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
|
||||||
{
|
// {
|
||||||
kmMat4 result;
|
// kmMat4 result;
|
||||||
kmGLGetMatrix(KM_GL_MODELVIEW, &result);
|
// kmGLGetMatrix(KM_GL_MODELVIEW, &result);
|
||||||
return result;
|
// return result;
|
||||||
return _modelViewMatrixStack.top();
|
// return _modelViewMatrixStack.top();
|
||||||
}
|
// }
|
||||||
else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
|
// else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
|
||||||
{
|
// {
|
||||||
kmMat4 result;
|
// kmMat4 result;
|
||||||
kmGLGetMatrix(KM_GL_PROJECTION, &result);
|
// kmGLGetMatrix(KM_GL_PROJECTION, &result);
|
||||||
return result;
|
// return result;
|
||||||
return _projectionMatrixStack.top();
|
// return _projectionMatrixStack.top();
|
||||||
}
|
// }
|
||||||
else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
|
// else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
|
||||||
{
|
// {
|
||||||
kmMat4 result;
|
// kmMat4 result;
|
||||||
kmGLGetMatrix(KM_GL_TEXTURE, &result);
|
// kmGLGetMatrix(KM_GL_TEXTURE, &result);
|
||||||
return result;
|
// return result;
|
||||||
return _textureMatrixStack.top();
|
// return _textureMatrixStack.top();
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
|
// CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
|
||||||
kmMat4 result;
|
// kmMat4 result;
|
||||||
kmGLGetMatrix(KM_GL_MODELVIEW, &result);
|
// kmGLGetMatrix(KM_GL_MODELVIEW, &result);
|
||||||
return result;
|
// return result;
|
||||||
return _modelViewMatrixStack.top();
|
// return _modelViewMatrixStack.top();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void Director::setProjection(Projection projection)
|
void Director::setProjection(Projection projection)
|
||||||
{
|
{
|
||||||
|
@ -741,7 +741,8 @@ static void GLToClipTransform(kmMat4 *transformOut)
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
||||||
|
|
||||||
kmMat4 projection;
|
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 CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||||
//if needed, we need to undo the rotation for Landscape orientation in order to get the correct positions
|
//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
|
#endif
|
||||||
|
|
||||||
kmMat4 modelview;
|
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);
|
kmMat4Multiply(transformOut, &projection, &modelview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
void loadIdentityMatrix(MATRIX_STACK_TYPE type);
|
void loadIdentityMatrix(MATRIX_STACK_TYPE type);
|
||||||
void loadMatrix(MATRIX_STACK_TYPE type, const kmMat4& mat);
|
void loadMatrix(MATRIX_STACK_TYPE type, const kmMat4& mat);
|
||||||
void multiplyMatrix(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:
|
public:
|
||||||
static const char *EVENT_PROJECTION_CHANGED;
|
static const char *EVENT_PROJECTION_CHANGED;
|
||||||
static const char* EVENT_AFTER_UPDATE;
|
static const char* EVENT_AFTER_UPDATE;
|
||||||
|
|
|
@ -629,8 +629,13 @@ void GLProgram::setUniformLocationWithMatrix4fv(GLint location, const GLfloat* m
|
||||||
|
|
||||||
void GLProgram::setUniformsForBuiltins()
|
void GLProgram::setUniformsForBuiltins()
|
||||||
{
|
{
|
||||||
|
Director* director = Director::getInstance();
|
||||||
|
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
||||||
|
|
||||||
kmMat4 matrixMV;
|
kmMat4 matrixMV;
|
||||||
kmGLGetMatrix(KM_GL_MODELVIEW, &matrixMV);
|
//matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
|
kmGLGetMatrix(KM_GL_MODELVIEW, &matrixMV);
|
||||||
|
|
||||||
|
|
||||||
setUniformsForBuiltins(matrixMV);
|
setUniformsForBuiltins(matrixMV);
|
||||||
}
|
}
|
||||||
|
@ -638,8 +643,8 @@ void GLProgram::setUniformsForBuiltins()
|
||||||
void GLProgram::setUniformsForBuiltins(const kmMat4 &matrixMV)
|
void GLProgram::setUniformsForBuiltins(const kmMat4 &matrixMV)
|
||||||
{
|
{
|
||||||
kmMat4 matrixP;
|
kmMat4 matrixP;
|
||||||
|
//= Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||||
kmGLGetMatrix(KM_GL_PROJECTION, &matrixP);
|
kmGLGetMatrix(KM_GL_PROJECTION, &matrixP);
|
||||||
|
|
||||||
if(_flags.usesP)
|
if(_flags.usesP)
|
||||||
setUniformLocationWithMatrix4fv(_uniforms[UNIFORM_P_MATRIX], matrixP.mat, 1);
|
setUniformLocationWithMatrix4fv(_uniforms[UNIFORM_P_MATRIX], matrixP.mat, 1);
|
||||||
|
|
|
@ -953,10 +953,12 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
|
||||||
|
|
||||||
|
|
||||||
// IMPORTANT:
|
// 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
|
// but it is deprecated and your code should not rely on it
|
||||||
kmGLPushMatrix();
|
Director* director = Director::getInstance();
|
||||||
kmGLLoadMatrix(&_modelViewTransform);
|
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;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -987,7 +989,7 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
|
||||||
// reset for next frame
|
// reset for next frame
|
||||||
_orderOfArrival = 0;
|
_orderOfArrival = 0;
|
||||||
|
|
||||||
kmGLPopMatrix();
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
kmMat4 Node::transform(const kmMat4& parentTransform)
|
kmMat4 Node::transform(const kmMat4& parentTransform)
|
||||||
|
|
Loading…
Reference in New Issue