BsCD6JointRTTI.h 5.8 KB

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