BsCD6JointRTTI.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 "BsRTTIType.h"
  6. #include "BsCD6Joint.h"
  7. #include "BsGameObjectRTTI.h"
  8. namespace BansheeEngine
  9. {
  10. /** @cond RTTI */
  11. /** @addtogroup RTTI-Impl-Core
  12. * @{
  13. */
  14. float stiffness = 0.0f;
  15. float damping = 0.0f;
  16. float forceLimit = FLT_MAX;
  17. bool acceleration = false;
  18. class BS_CORE_EXPORT CD6JointRTTI : public RTTIType<CD6Joint, CJoint, CD6JointRTTI>
  19. {
  20. D6Joint::Motion& getMotion(CD6Joint* obj, UINT32 idx) { return obj->mMotion[idx]; }
  21. void setMotion(CD6Joint* obj, UINT32 idx, D6Joint::Motion& value) { obj->mMotion[idx] = value; }
  22. UINT32 getMotionCount(CD6Joint* obj) { return (UINT32)D6Joint::Motion::Count; }
  23. void setMotionCount(CD6Joint* obj, UINT32 size) { /* Do nothing */ }
  24. float& getDriveStiffness(CD6Joint* obj, UINT32 idx) { return obj->mDrive[idx].stiffness; }
  25. void setDriveStiffness(CD6Joint* obj, UINT32 idx, float& value) { obj->mDrive[idx].stiffness = value; }
  26. float& getDriveDamping(CD6Joint* obj, UINT32 idx) { return obj->mDrive[idx].damping; }
  27. void setDriveDamping(CD6Joint* obj, UINT32 idx, float& value) { obj->mDrive[idx].damping = value; }
  28. float& getDriveForceLimit(CD6Joint* obj, UINT32 idx) { return obj->mDrive[idx].forceLimit; }
  29. void setDriveForceLimit(CD6Joint* obj, UINT32 idx, float& value) { obj->mDrive[idx].forceLimit = value; }
  30. bool& getDriveAcceleration(CD6Joint* obj, UINT32 idx) { return obj->mDrive[idx].acceleration; }
  31. void setDriveAcceleration(CD6Joint* obj, UINT32 idx, bool& value) { obj->mDrive[idx].acceleration = value; }
  32. UINT32 getDriveCount(CD6Joint* obj) { return (UINT32)D6Joint::DriveType::Count; }
  33. void setDriveCount(CD6Joint* obj, UINT32 size) { /* Do nothing */ }
  34. BS_PLAIN_MEMBER_NAMED(mLimitLinearExtent, mLimitLinear.extent)
  35. BS_PLAIN_MEMBER_NAMED(mLimitLinearContactDist, mLimitTwist.contactDist)
  36. BS_PLAIN_MEMBER_NAMED(mLimitLinearRestitution, mLimitTwist.restitution)
  37. BS_PLAIN_MEMBER_NAMED(mLimitLinearSpringDamping, mLimitTwist.spring.damping)
  38. BS_PLAIN_MEMBER_NAMED(mLimitLinearSpringStiffness, mLimitTwist.spring.stiffness)
  39. BS_PLAIN_MEMBER_NAMED(mLimitTwistLower, mLimitTwist.lower)
  40. BS_PLAIN_MEMBER_NAMED(mLimitTwistUpper, mLimitTwist.upper)
  41. BS_PLAIN_MEMBER_NAMED(mLimitTwistContactDist, mLimitTwist.contactDist)
  42. BS_PLAIN_MEMBER_NAMED(mLimitTwistRestitution, mLimitTwist.restitution)
  43. BS_PLAIN_MEMBER_NAMED(mLimitTwistSpringDamping, mLimitTwist.spring.damping)
  44. BS_PLAIN_MEMBER_NAMED(mLimitTwistSpringStiffness, mLimitTwist.spring.stiffness)
  45. BS_PLAIN_MEMBER_NAMED(mLimitSwingYLimitAngle, mLimitSwing.yLimitAngle)
  46. BS_PLAIN_MEMBER_NAMED(mLimitSwingZLimitAngle, mLimitSwing.zLimitAngle)
  47. BS_PLAIN_MEMBER_NAMED(mLimitSwingContactDist, mLimitSwing.contactDist)
  48. BS_PLAIN_MEMBER_NAMED(mLimitSwingRestitution, mLimitSwing.restitution)
  49. BS_PLAIN_MEMBER_NAMED(mLimitSwingSpringDamping, mLimitSwing.spring.damping)
  50. BS_PLAIN_MEMBER_NAMED(mLimitSwingSpringStiffness, mLimitSwing.spring.stiffness)
  51. BS_PLAIN_MEMBER(mDrivePosition)
  52. BS_PLAIN_MEMBER(mDriveRotation)
  53. BS_PLAIN_MEMBER(mDriveLinearVelocity)
  54. BS_PLAIN_MEMBER(mDriveAngularVelocity)
  55. public:
  56. CD6JointRTTI()
  57. {
  58. addPlainArrayField("mMotion", 0, &CD6JointRTTI::getMotion, &CD6JointRTTI::getMotionCount,
  59. &CD6JointRTTI::setMotion, &CD6JointRTTI::setMotionCount);
  60. addPlainArrayField("mDriveStiffnes", 1, &CD6JointRTTI::getDriveStiffness, &CD6JointRTTI::getDriveCount,
  61. &CD6JointRTTI::setDriveStiffness, &CD6JointRTTI::setDriveCount);
  62. addPlainArrayField("mDriveDamping", 2, &CD6JointRTTI::getDriveDamping, &CD6JointRTTI::getDriveCount,
  63. &CD6JointRTTI::setDriveDamping, &CD6JointRTTI::setDriveCount);
  64. addPlainArrayField("mDriveForceLimit", 3, &CD6JointRTTI::getDriveForceLimit, &CD6JointRTTI::getDriveCount,
  65. &CD6JointRTTI::setDriveForceLimit, &CD6JointRTTI::setDriveCount);
  66. addPlainArrayField("mDriveAcceleartion", 4, &CD6JointRTTI::getDriveAcceleration, &CD6JointRTTI::getDriveCount,
  67. &CD6JointRTTI::setDriveAcceleration, &CD6JointRTTI::setDriveCount);
  68. BS_ADD_PLAIN_FIELD(mLimitLinearExtent, 5);
  69. BS_ADD_PLAIN_FIELD(mLimitLinearContactDist, 6);
  70. BS_ADD_PLAIN_FIELD(mLimitLinearRestitution, 7);
  71. BS_ADD_PLAIN_FIELD(mLimitLinearSpringDamping, 8);
  72. BS_ADD_PLAIN_FIELD(mLimitLinearSpringStiffness, 9);
  73. BS_ADD_PLAIN_FIELD(mLimitTwistLower, 10);
  74. BS_ADD_PLAIN_FIELD(mLimitTwistUpper, 11);
  75. BS_ADD_PLAIN_FIELD(mLimitTwistContactDist, 12);
  76. BS_ADD_PLAIN_FIELD(mLimitTwistRestitution, 13);
  77. BS_ADD_PLAIN_FIELD(mLimitTwistSpringDamping, 14);
  78. BS_ADD_PLAIN_FIELD(mLimitTwistSpringStiffness, 15);
  79. BS_ADD_PLAIN_FIELD(mLimitSwingYLimitAngle, 16);
  80. BS_ADD_PLAIN_FIELD(mLimitSwingZLimitAngle, 17);
  81. BS_ADD_PLAIN_FIELD(mLimitSwingContactDist, 18);
  82. BS_ADD_PLAIN_FIELD(mLimitSwingRestitution, 19);
  83. BS_ADD_PLAIN_FIELD(mLimitSwingSpringDamping, 20);
  84. BS_ADD_PLAIN_FIELD(mLimitSwingSpringStiffness, 21);
  85. BS_ADD_PLAIN_FIELD(mDrivePosition, 22);
  86. BS_ADD_PLAIN_FIELD(mDriveRotation, 23);
  87. BS_ADD_PLAIN_FIELD(mDriveLinearVelocity, 24);
  88. BS_ADD_PLAIN_FIELD(mDriveAngularVelocity, 25);
  89. }
  90. const String& getRTTIName() override
  91. {
  92. static String name = "CD6Joint";
  93. return name;
  94. }
  95. UINT32 getRTTIId() override
  96. {
  97. return TID_CD6Joint;
  98. }
  99. SPtr<IReflectable> newRTTIObject() override
  100. {
  101. return GameObjectRTTI::createGameObject<CD6Joint>();
  102. }
  103. };
  104. /** @} */
  105. /** @endcond */
  106. }