mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 19:38:15 +00:00
[Raymath] Add matrix operators to raymath for C++ (#4409)
* Add matrix operators to raymath for C++ * Fix spaces
This commit is contained in:
@@ -2895,6 +2895,40 @@ inline const Quaternion& operator *= (Quaternion& lhs, const Matrix& rhs)
|
|||||||
lhs = QuaternionTransform(lhs, rhs);
|
lhs = QuaternionTransform(lhs, rhs);
|
||||||
return lhs;
|
return lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Matrix operators
|
||||||
|
inline Matrix operator + (const Matrix& lhs, const Matrix& rhs)
|
||||||
|
{
|
||||||
|
return MatrixAdd(lhs, rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Matrix& operator += (Matrix& lhs, const Matrix& rhs)
|
||||||
|
{
|
||||||
|
lhs = MatrixAdd(lhs, rhs);
|
||||||
|
return lhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Matrix operator - (const Matrix& lhs, const Matrix& rhs)
|
||||||
|
{
|
||||||
|
return MatrixSubtract(lhs, rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Matrix& operator -= (Matrix& lhs, const Matrix& rhs)
|
||||||
|
{
|
||||||
|
lhs = MatrixSubtract(lhs, rhs);
|
||||||
|
return lhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Matrix operator * (const Matrix& lhs, const Matrix& rhs)
|
||||||
|
{
|
||||||
|
return MatrixMultiply(lhs, rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Matrix& operator *= (Matrix& lhs, const Matrix& rhs)
|
||||||
|
{
|
||||||
|
lhs = MatrixMultiply(lhs, rhs);
|
||||||
|
return lhs;
|
||||||
|
}
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
#endif // C++ operators
|
#endif // C++ operators
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user