Skip to content

Commit a2fcbc9

Browse files
authored
[Raymath] Add matrix operators to raymath for C++ (#4409)
* Add matrix operators to raymath for C++ * Fix spaces
1 parent f60c6d4 commit a2fcbc9

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/raymath.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2895,6 +2895,40 @@ inline const Quaternion& operator *= (Quaternion& lhs, const Matrix& rhs)
28952895
lhs = QuaternionTransform(lhs, rhs);
28962896
return lhs;
28972897
}
2898+
2899+
// Matrix operators
2900+
inline Matrix operator + (const Matrix& lhs, const Matrix& rhs)
2901+
{
2902+
return MatrixAdd(lhs, rhs);
2903+
}
2904+
2905+
inline const Matrix& operator += (Matrix& lhs, const Matrix& rhs)
2906+
{
2907+
lhs = MatrixAdd(lhs, rhs);
2908+
return lhs;
2909+
}
2910+
2911+
inline Matrix operator - (const Matrix& lhs, const Matrix& rhs)
2912+
{
2913+
return MatrixSubtract(lhs, rhs);
2914+
}
2915+
2916+
inline const Matrix& operator -= (Matrix& lhs, const Matrix& rhs)
2917+
{
2918+
lhs = MatrixSubtract(lhs, rhs);
2919+
return lhs;
2920+
}
2921+
2922+
inline Matrix operator * (const Matrix& lhs, const Matrix& rhs)
2923+
{
2924+
return MatrixMultiply(lhs, rhs);
2925+
}
2926+
2927+
inline const Matrix& operator *= (Matrix& lhs, const Matrix& rhs)
2928+
{
2929+
lhs = MatrixMultiply(lhs, rhs);
2930+
return lhs;
2931+
}
28982932
//-------------------------------------------------------------------------------
28992933
#endif // C++ operators
29002934

0 commit comments

Comments
 (0)