@@ -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
17691781RMAPI 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+
30823099inline 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