summaryrefslogtreecommitdiffhomepage
path: root/src/models.c
diff options
context:
space:
mode:
authorRay <[email protected]>2017-05-04 17:42:24 +0200
committerRay <[email protected]>2017-05-04 17:42:24 +0200
commit3bdf367711c73317b433e67a26e2d6a952928146 (patch)
treedf0f1dbc5cde1ec76c2c9b7d9bf0c298107a76ca /src/models.c
parent70a7c656684beec828d29d94cc556c3a25ac75b8 (diff)
downloadraylib-3bdf367711c73317b433e67a26e2d6a952928146.tar.gz
raylib-3bdf367711c73317b433e67a26e2d6a952928146.zip
Support model.transform
Combine it with transform introduced as function parameters
Diffstat (limited to 'src/models.c')
-rw-r--r--src/models.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/models.c b/src/models.c
index fa6faf16..2459edf1 100644
--- a/src/models.c
+++ b/src/models.c
@@ -1218,11 +1218,13 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota
Matrix matRotation = MatrixRotate(rotationAxis, rotationAngle*DEG2RAD);
Matrix matScale = MatrixScale(scale.x, scale.y, scale.z);
Matrix matTranslation = MatrixTranslate(position.x, position.y, position.z);
+
+ Matrix matTransform = MatrixMultiply(MatrixMultiply(matScale, matRotation), matTranslation);
// Combine model transformation matrix (model.transform) with matrix generated by function parameters (matTransform)
//Matrix matModel = MatrixMultiply(model.transform, matTransform); // Transform to world-space coordinates
- model.transform = MatrixMultiply(MatrixMultiply(matScale, matRotation), matTranslation);
+ model.transform = MatrixMultiply(model.transform, matTransform);
model.material.colDiffuse = tint; // TODO: Multiply tint color by diffuse color?
rlglDrawMesh(model.mesh, model.material, model.transform);