|
@@ -150,7 +150,7 @@ void update()
|
|
|
uint32_t i, j;
|
|
|
uint32_t faceCount;
|
|
|
uint32_t timeToWait = FRAME_TARGET_TIME - (SDL_GetTicks() - previousFrameTime);
|
|
|
- matrix4_t scaleMatrix, translateMatrix;
|
|
|
+ matrix4_t scaleMatrix, translateMatrix, rotationXMatrix, rotationYMatrix, rotationZMatrix;
|
|
|
if (timeToWait <= FRAME_TARGET_TIME)
|
|
|
{
|
|
|
SDL_Delay(timeToWait);
|
|
@@ -168,7 +168,11 @@ void update()
|
|
|
mesh.translation.z = 5;
|
|
|
|
|
|
scaleMatrix = mat4Scale(mesh.scale.x, mesh.scale.y, mesh.scale.z);
|
|
|
+ rotationXMatrix = mat4RotationX(mesh.rotation.x);
|
|
|
+ rotationYMatrix = mat4RotationY(mesh.rotation.y);
|
|
|
+ rotationZMatrix = mat4RotationZ(mesh.rotation.z);
|
|
|
translateMatrix = mat4Translate(mesh.translation.x, mesh.translation.y, mesh.translation.z);
|
|
|
+
|
|
|
arrayEmpty(projectedTriangles);
|
|
|
|
|
|
faceCount = arrayGetSize(mesh.faces);
|
|
@@ -188,6 +192,10 @@ void update()
|
|
|
{
|
|
|
transformedVertices[j] = vec4FromVec3(vertices[j]);
|
|
|
|
|
|
+ transformedVertices[j] = mat4ProdVec4(rotationXMatrix, transformedVertices[j]);
|
|
|
+ transformedVertices[j] = mat4ProdVec4(rotationYMatrix, transformedVertices[j]);
|
|
|
+ transformedVertices[j] = mat4ProdVec4(rotationZMatrix, transformedVertices[j]);
|
|
|
+
|
|
|
transformedVertices[j] = mat4ProdVec4(scaleMatrix, transformedVertices[j]);
|
|
|
transformedVertices[j] = mat4ProdVec4(translateMatrix, transformedVertices[j]);
|
|
|
}
|