BsPhysXPrerequisites.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 bs
  10. {
  11. /** @addtogroup Plugins
  12. * @{
  13. */
  14. /** @defgroup PhysX BansheePhysX
  15. * NVIDIA %PhysX implementation of Banshee's physics.
  16. * @{
  17. */
  18. /** @cond RTTI */
  19. /** @defgroup RTTI-Impl-PhysX RTTI types
  20. * Types containing RTTI for specific classes.
  21. */
  22. /** @endcond */
  23. /** @} */
  24. /** @} */
  25. class PhysXRigidbody;
  26. class PhsyXMaterial;
  27. class FPhysXCollider;
  28. /** @addtogroup PhysX
  29. * @{
  30. */
  31. /** Type IDs used by the RTTI system for the PhysX library. */
  32. enum TypeID_BansheeEditor
  33. {
  34. TID_FPhysXMesh = 100000,
  35. };
  36. /** Converts a Banshee vector to a PhysX vector. */
  37. inline const physx::PxVec3& toPxVector(const Vector3& input)
  38. {
  39. return *(physx::PxVec3*)&input;
  40. }
  41. /** Converts a Banshee vector to a PhysX vector. */
  42. inline const physx::PxVec4& toPxVector(const Vector4& input)
  43. {
  44. return *(physx::PxVec4*)&input;
  45. }
  46. /** Converts a Banshee quaternion to a PhysX quaternion. */
  47. inline const physx::PxQuat& toPxQuaternion(const Quaternion& input)
  48. {
  49. return *(physx::PxQuat*)&input;
  50. }
  51. /** Converts a Banshee position/rotation pair to a PhysX transform. */
  52. inline physx::PxTransform toPxTransform(const Vector3& pos, const Quaternion& rot)
  53. {
  54. return physx::PxTransform(toPxVector(pos), toPxQuaternion(rot));
  55. }
  56. /** Converts a PhysX vector to a Banshee vector. */
  57. inline const Vector3& fromPxVector(const physx::PxVec3& input)
  58. {
  59. return *(Vector3*)&input;
  60. }
  61. /** Converts a PhysX vector to a Banshee vector. */
  62. inline const Vector4& fromPxVector(const physx::PxVec4& input)
  63. {
  64. return *(Vector4*)&input;
  65. }
  66. /** Converts a PhysX quaternion to a Banshee quaternion. */
  67. inline const Quaternion& fromPxQuaternion(const physx::PxQuat& input)
  68. {
  69. return *(Quaternion*)&input;
  70. }
  71. /** Flags used on PhysX shape filters. */
  72. enum class PhysXObjectFilterFlag
  73. {
  74. NoReport = 1 << 0, /**< Don't report collision events. */
  75. ReportBasic = 1 << 1, /**< Report start/begin collision events. */
  76. ReportAll = 1 << 2, /**< Report start/begin, as well as persistant collision events. */
  77. CCD = 1 << 3 /**< Use continous collision detection for this shape. */
  78. };
  79. /** @copydoc PhysXObjectFilterFlag */
  80. typedef Flags<PhysXObjectFilterFlag> PhysXObjectFilterFlags;
  81. BS_FLAGS_OPERATORS(PhysXObjectFilterFlag)
  82. /** @} */
  83. }