remove kmMat4 in Render.cpp GLProgram, Grid, Layer

This commit is contained in:
Huabing.Xu 2014-04-10 22:38:57 +08:00
parent 84cf5ca895
commit d70305cf3b
4 changed files with 15 additions and 17 deletions

View File

@ -632,7 +632,7 @@ void GLProgram::setUniformsForBuiltins()
Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 matrixMV;
Matrix matrixMV;
matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
setUniformsForBuiltins(matrixMV);

View File

@ -188,8 +188,8 @@ void GridBase::set2DProjection()
glViewport(0, 0, (GLsizei)(size.width), (GLsizei)(size.height) );
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
kmMat4 orthoMatrix;
kmMat4OrthographicProjection(&orthoMatrix, 0, size.width, 0, size.height, -1, 1);
Matrix orthoMatrix;
Matrix::createOrthographicOffCenter(0, size.width, 0, size.height, -1, 1, &orthoMatrix);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, orthoMatrix);
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);

View File

@ -589,11 +589,11 @@ void LayerColor::draw(Renderer *renderer, const Matrix &transform, bool transfor
for(int i = 0; i < 4; ++i)
{
kmVec3 pos;
Vector4 pos;
pos.x = _squareVertices[i].x; pos.y = _squareVertices[i].y; pos.z = _positionZ;
kmMat4 modelViewTransformInKazmath = _modelViewTransform;
kmVec3TransformCoord(&pos, &pos, &modelViewTransformInKazmath);
_noMVPVertices[i] = Vector3(pos.x,pos.y,pos.z);
pos.w = 1;
_modelViewTransform.transformVector(&pos);
_noMVPVertices[i] = Vector3(pos.x,pos.y,pos.z)/pos.w;
}
}

View File

@ -359,22 +359,20 @@ void Renderer::convertToWorldCoordinates(V3F_C4B_T2F_Quad* quads, ssize_t quanti
// kmMat4 matrixP, mvp;
// kmGLGetMatrix(KM_GL_PROJECTION, &matrixP);
// kmMat4Multiply(&mvp, &matrixP, &modelView);
kmMat4 modelView2 = modelView;
for(ssize_t i=0; i<quantity; ++i)
{
V3F_C4B_T2F_Quad *q = &quads[i];
Vector3 *vec1 = (Vector3*)&q->bl.vertices;
modelView.transformPoint(vec1);
kmVec3 *vec1 = (kmVec3*)&q->bl.vertices;
kmVec3Transform(vec1, vec1, &modelView2);
Vector3 *vec2 = (Vector3*)&q->br.vertices;
modelView.transformPoint(vec2);
kmVec3 *vec2 = (kmVec3*)&q->br.vertices;
kmVec3Transform(vec2, vec2, &modelView2);
Vector3 *vec3 = (Vector3*)&q->tr.vertices;
modelView.transformPoint(vec3);
kmVec3 *vec3 = (kmVec3*)&q->tr.vertices;
kmVec3Transform(vec3, vec3, &modelView2);
kmVec3 *vec4 = (kmVec3*)&q->tl.vertices;
kmVec3Transform(vec4, vec4, &modelView2);
Vector3 *vec4 = (Vector3*)&q->tl.vertices;
modelView.transformPoint(vec4);
}
}