Skip to content

Commit 936e8ae

Browse files
committed
Merge branch 'master' of https://github.com/raysan5/raylib
2 parents ea92677 + 3bea7f5 commit 936e8ae

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/raymath.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,6 +1765,18 @@ RMAPI Matrix MatrixMultiply(Matrix left, Matrix right)
17651765
return result;
17661766
}
17671767

1768+
RMAPI Matrix MatrixMultiplyValue(Matrix left, float value)
1769+
{
1770+
Matrix result = {
1771+
left.m0 * value, left.m4 * value, left.m8 * value, left.m12 * value,
1772+
left.m1 * value, left.m5 * value, left.m9 * value, left.m13 * value,
1773+
left.m2 * value, left.m6 * value, left.m10 * value, left.m14 * value,
1774+
left.m3 * value, left.m7 * value, left.m11 * value, left.m15 * value
1775+
};
1776+
1777+
return result;
1778+
}
1779+
17681780
// Get translation matrix
17691781
RMAPI Matrix MatrixTranslate(float x, float y, float z)
17701782
{
@@ -3079,6 +3091,11 @@ inline const Quaternion& operator *= (Quaternion& lhs, const Matrix& rhs)
30793091
}
30803092

30813093
// Matrix operators
3094+
static constexpr Matrix MatrixUnit = { 1, 0, 0, 0,
3095+
0, 1, 0, 0,
3096+
0, 0, 1, 0,
3097+
0, 0, 0, 1 };
3098+
30823099
inline Matrix operator + (const Matrix& lhs, const Matrix& rhs)
30833100
{
30843101
return MatrixAdd(lhs, rhs);
@@ -3111,6 +3128,18 @@ inline const Matrix& operator *= (Matrix& lhs, const Matrix& rhs)
31113128
lhs = MatrixMultiply(lhs, rhs);
31123129
return lhs;
31133130
}
3131+
3132+
inline Matrix operator * (const Matrix& lhs, const float value)
3133+
{
3134+
return MatrixMultiplyValue(lhs, value);
3135+
}
3136+
3137+
inline const Matrix& operator *= (Matrix& lhs, const float value)
3138+
{
3139+
lhs = MatrixMultiplyValue(lhs, value);
3140+
return lhs;
3141+
}
3142+
31143143
//-------------------------------------------------------------------------------
31153144
#endif // C++ operators
31163145

0 commit comments

Comments
 (0)