diff options
| author | raysan5 <raysan5@gmail.com> | 2014-04-19 16:36:49 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2014-04-19 16:36:49 +0200 |
| commit | f06a15ac8b3fe92d101ae795225fbf56fa670dba (patch) | |
| tree | cdfba90ee24fd078a15c89d8753ee3e11d8e229b /src/raymath.c | |
| parent | 650a8f7f159d3ce2addb1b0fdb31c3f460005391 (diff) | |
| download | raylib-f06a15ac8b3fe92d101ae795225fbf56fa670dba.tar.gz raylib-f06a15ac8b3fe92d101ae795225fbf56fa670dba.zip | |
raylib 1.1
View CHANGELOG for a detailed list of changes
Diffstat (limited to 'src/raymath.c')
| -rw-r--r-- | src/raymath.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/raymath.c b/src/raymath.c index fa4bac90..af39da34 100644 --- a/src/raymath.c +++ b/src/raymath.c @@ -435,7 +435,7 @@ Matrix MatrixSubstract(Matrix left, Matrix right) } // Returns translation matrix -// TODO: REVIEW +// TODO: Review this function Matrix MatrixTranslate(float x, float y, float z) { /* @@ -478,6 +478,7 @@ Matrix MatrixTranslate(float x, float y, float z) } // Returns rotation matrix +// TODO: Review this function Matrix MatrixRotate(float angleX, float angleY, float angleZ) { Matrix result; @@ -492,6 +493,7 @@ Matrix MatrixRotate(float angleX, float angleY, float angleZ) } // Create rotation matrix from axis and angle +// TODO: Test this function Matrix MatrixFromAxisAngle(Vector3 axis, float angle) { Matrix result; @@ -545,7 +547,8 @@ Matrix MatrixFromAxisAngle(Vector3 axis, float angle) return result; }; -// Create rotation matrix from axis and angle +// Create rotation matrix from axis and angle (version 2) +// TODO: Test this function Matrix MatrixFromAxisAngle2(Vector3 axis, float angle) { Matrix result; @@ -661,6 +664,21 @@ Matrix MatrixScale(float x, float y, float z) return result; } +// Returns transformation matrix for a given translation, rotation and scale +// NOTE: Transformation order is rotation -> scale -> translation +Matrix MatrixTransform(Vector3 translation, Vector3 rotation, Vector3 scale) +{ + Matrix result = MatrixIdentity(); + + Matrix mRotation = MatrixRotate(rotation.x, rotation.y, rotation.z); + Matrix mScale = MatrixScale(scale.x, scale.y, scale.z); + Matrix mTranslate = MatrixTranslate(translation.x, translation.y, translation.z); + + result = MatrixMultiply(MatrixMultiply(mRotation, mScale), mTranslate); + + return result; +} + // Returns two matrix multiplication // NOTE: When multiplying matrices... the order matters! Matrix MatrixMultiply(Matrix left, Matrix right) |
