From 97abaff4c5daad57c50822fb15b790a7241c7775 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 25 Nov 2019 11:29:04 +0100 Subject: Support rlPushMatrix() and rlPopMatrix() on mesh drawing --- src/rlgl.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/rlgl.h b/src/rlgl.h index 5c71c478..1297c53d 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -2664,16 +2664,13 @@ void rlDrawMesh(Mesh mesh, Material material, Matrix transform) Matrix matView = modelview; // View matrix (camera) Matrix matProjection = projection; // Projection matrix (perspective) - // TODO: Matrix nightmare! Trying to combine stack matrices with view matrix and local model transform matrix.. - // There is some problem in the order matrices are multiplied... it requires some time to figure out... - Matrix matStackTransform = MatrixIdentity(); - // TODO: Consider possible transform matrices in the stack // Is this the right order? or should we start with the first stored matrix instead of the last one? + //Matrix matStackTransform = MatrixIdentity(); //for (int i = stackCounter; i > 0; i--) matStackTransform = MatrixMultiply(stack[i], matStackTransform); - Matrix matModel = MatrixMultiply(transform, matStackTransform); // Apply local model transformation - Matrix matModelView = MatrixMultiply(matModel, matView); // Transform to camera-space coordinates + // Transform to camera-space coordinates + Matrix matModelView = MatrixMultiply(transform, MatrixMultiply(transformMatrix, matView)); //----------------------------------------------------- // Bind active texture maps (if available) -- cgit v1.2.3