mirror of https://github.com/axmolengine/axmol.git
Camera is working again
Projection is passed in the shader. Since P is in the shader, QuadCommand uses `Vec3Transform` instead of `Vec3TransformCoord` since it is faster.
This commit is contained in:
parent
d13612ef32
commit
1dc169b19f
|
@ -38,7 +38,7 @@ varying vec2 v_texCoord; \n\
|
||||||
\n\
|
\n\
|
||||||
void main() \n\
|
void main() \n\
|
||||||
{ \n\
|
{ \n\
|
||||||
gl_Position = a_position; \n\
|
gl_Position = CC_PMatrix * a_position; \n\
|
||||||
v_fragmentColor = a_color; \n\
|
v_fragmentColor = a_color; \n\
|
||||||
v_texCoord = a_texCoord; \n\
|
v_texCoord = a_texCoord; \n\
|
||||||
} \n\
|
} \n\
|
||||||
|
|
|
@ -58,12 +58,6 @@ void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram*
|
||||||
_capacity = quadCount;
|
_capacity = quadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmMat4 p, mvp;
|
|
||||||
kmGLGetMatrix(KM_GL_PROJECTION, &p);
|
|
||||||
|
|
||||||
kmMat4Multiply(&mvp, &p, &mv);
|
|
||||||
|
|
||||||
|
|
||||||
_quadCount = quadCount;
|
_quadCount = quadCount;
|
||||||
memcpy(_quad, quad, sizeof(V3F_C4B_T2F_Quad) * quadCount);
|
memcpy(_quad, quad, sizeof(V3F_C4B_T2F_Quad) * quadCount);
|
||||||
|
|
||||||
|
@ -74,7 +68,7 @@ void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram*
|
||||||
vec1.x = q->bl.vertices.x;
|
vec1.x = q->bl.vertices.x;
|
||||||
vec1.y = q->bl.vertices.y;
|
vec1.y = q->bl.vertices.y;
|
||||||
vec1.z = q->bl.vertices.z;
|
vec1.z = q->bl.vertices.z;
|
||||||
kmVec3TransformCoord(&out1, &vec1, &mvp);
|
kmVec3Transform(&out1, &vec1, &mv);
|
||||||
q->bl.vertices.x = out1.x;
|
q->bl.vertices.x = out1.x;
|
||||||
q->bl.vertices.y = out1.y;
|
q->bl.vertices.y = out1.y;
|
||||||
q->bl.vertices.z = out1.z;
|
q->bl.vertices.z = out1.z;
|
||||||
|
@ -83,7 +77,7 @@ void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram*
|
||||||
vec2.x = q->br.vertices.x;
|
vec2.x = q->br.vertices.x;
|
||||||
vec2.y = q->br.vertices.y;
|
vec2.y = q->br.vertices.y;
|
||||||
vec2.z = q->br.vertices.z;
|
vec2.z = q->br.vertices.z;
|
||||||
kmVec3TransformCoord(&out2, &vec2, &mvp);
|
kmVec3Transform(&out2, &vec2, &mv);
|
||||||
q->br.vertices.x = out2.x;
|
q->br.vertices.x = out2.x;
|
||||||
q->br.vertices.y = out2.y;
|
q->br.vertices.y = out2.y;
|
||||||
q->br.vertices.z = out2.z;
|
q->br.vertices.z = out2.z;
|
||||||
|
@ -92,7 +86,7 @@ void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram*
|
||||||
vec3.x = q->tr.vertices.x;
|
vec3.x = q->tr.vertices.x;
|
||||||
vec3.y = q->tr.vertices.y;
|
vec3.y = q->tr.vertices.y;
|
||||||
vec3.z = q->tr.vertices.z;
|
vec3.z = q->tr.vertices.z;
|
||||||
kmVec3TransformCoord(&out3, &vec3, &mvp);
|
kmVec3Transform(&out3, &vec3, &mv);
|
||||||
q->tr.vertices.x = out3.x;
|
q->tr.vertices.x = out3.x;
|
||||||
q->tr.vertices.y = out3.y;
|
q->tr.vertices.y = out3.y;
|
||||||
q->tr.vertices.z = out3.z;
|
q->tr.vertices.z = out3.z;
|
||||||
|
@ -101,7 +95,7 @@ void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram*
|
||||||
vec4.x = q->tl.vertices.x;
|
vec4.x = q->tl.vertices.x;
|
||||||
vec4.y = q->tl.vertices.y;
|
vec4.y = q->tl.vertices.y;
|
||||||
vec4.z = q->tl.vertices.z;
|
vec4.z = q->tl.vertices.z;
|
||||||
kmVec3TransformCoord(&out4, &vec4, &mvp);
|
kmVec3Transform(&out4, &vec4, &mv);
|
||||||
q->tl.vertices.x = out4.x;
|
q->tl.vertices.x = out4.x;
|
||||||
q->tl.vertices.y = out4.y;
|
q->tl.vertices.y = out4.y;
|
||||||
q->tl.vertices.z = out4.z;
|
q->tl.vertices.z = out4.z;
|
||||||
|
|
Loading…
Reference in New Issue