BsPhysXPrerequisites.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. #include "foundation\PxVec3.h"
  6. #include "foundation\PxVec4.h"
  7. #include "foundation\PxQuat.h"
  8. #include "foundation\PxTransform.h"
  9. namespace BansheeEngine
  10. {
  11. #if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(BS_STATIC_LIB)
  12. # ifdef BS_PHYSX_EXPORTS
  13. # define BS_PHYSX_EXPORT __declspec(dllexport)
  14. # else
  15. # if defined( __MINGW32__ )
  16. # define BS_PHYSX_EXPORT
  17. # else
  18. # define BS_PHYSX_EXPORT __declspec(dllimport)
  19. # endif
  20. # endif
  21. #else
  22. # define BS_PHYSX_EXPORT
  23. #endif
  24. class PhysXRigidbody;
  25. class PhsyXMaterial;
  26. class FPhysXCollider;
  27. /** Type IDs used by the RTTI system for the PhysX library. */
  28. enum TypeID_BansheeEditor
  29. {
  30. TID_PhysXMesh = 100000,
  31. };
  32. inline const physx::PxVec3& toPxVector(const Vector3& input)
  33. {
  34. return *(physx::PxVec3*)&input;
  35. }
  36. inline const physx::PxVec4& toPxVector(const Vector4& input)
  37. {
  38. return *(physx::PxVec4*)&input;
  39. }
  40. inline const physx::PxQuat& toPxQuaternion(const Quaternion& input)
  41. {
  42. return *(physx::PxQuat*)&input;
  43. }
  44. inline physx::PxTransform toPxTransform(const Vector3& pos, const Quaternion& rot)
  45. {
  46. return physx::PxTransform(toPxVector(pos), toPxQuaternion(rot));
  47. }
  48. inline const Vector3& fromPxVector(const physx::PxVec3& input)
  49. {
  50. return *(Vector3*)&input;
  51. }
  52. inline const Vector4& fromPxVector(const physx::PxVec4& input)
  53. {
  54. return *(Vector4*)&input;
  55. }
  56. inline const Quaternion& fromPxQuaternion(const physx::PxQuat& input)
  57. {
  58. return *(Quaternion*)&input;
  59. }
  60. }