-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Add utilities to convert bullet vector and matrices to moto.
To helper function were added to convert data from bullet to moto and the inverse, they are: ToMoto(btVector3/btVector4/btQuaternion/btMatrix3x3) ToBullet(MT_Vector3/MT_Vector4/MT_Quaternion/MT_Matrix3x3) In the same time PHY_MotionState now use only Moto type instead of float arrays or references.
- Loading branch information
1 parent
4fd1407
commit 5e9e083
Showing
17 changed files
with
199 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#ifndef __CCD_MATH_UTILS__ | ||
#define __CCD_MATH_UTILS__ | ||
|
||
#include "MT_Vector3.h" | ||
#include "MT_Vector4.h" | ||
#include "MT_Quaternion.h" | ||
#include "MT_Matrix3x3.h" | ||
|
||
#include "LinearMath/btVector3.h" | ||
#include "LinearMath/btQuaternion.h" | ||
#include "LinearMath/btMatrix3x3.h" | ||
|
||
inline MT_Vector3 ToMoto(const btVector3& vec) | ||
{ | ||
return MT_Vector3(vec.x(), vec.y(), vec.z()); | ||
} | ||
|
||
inline MT_Vector4 ToMoto(const btVector4& vec) | ||
{ | ||
return MT_Vector4(vec.x(), vec.y(), vec.z(), vec.w()); | ||
} | ||
|
||
inline MT_Matrix3x3 ToMoto(const btMatrix3x3& mat) | ||
{ | ||
return MT_Matrix3x3(mat[0][0], mat[0][1], mat[0][2], | ||
mat[1][0], mat[1][1], mat[1][2], | ||
mat[2][0], mat[2][1], mat[2][2]); | ||
} | ||
|
||
inline MT_Quaternion ToMoto(const btQuaternion& quat) | ||
{ | ||
return MT_Quaternion(quat.x(), quat.y(), quat.z(), quat.w()); | ||
} | ||
|
||
inline btVector3 ToBullet(const MT_Vector3& vec) | ||
{ | ||
return btVector3(vec.x(), vec.y(), vec.z()); | ||
} | ||
|
||
inline btVector4 ToBullet(const MT_Vector4& vec) | ||
{ | ||
return btVector4(vec.x(), vec.y(), vec.z(), vec.w()); | ||
} | ||
|
||
inline btMatrix3x3 ToBullet(const MT_Matrix3x3& mat) | ||
{ | ||
return btMatrix3x3(mat[0][0], mat[0][1], mat[0][2], | ||
mat[1][0], mat[1][1], mat[1][2], | ||
mat[2][0], mat[2][1], mat[2][2]); | ||
} | ||
|
||
inline btQuaternion ToBullet(const MT_Quaternion& quat) | ||
{ | ||
return btQuaternion(quat.x(), quat.y(), quat.z(), quat.w()); | ||
} | ||
|
||
#endif // __CCD_MATH_UTILS__ |
Oops, something went wrong.