BsCJointRTTI.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 "BsCJoint.h"
  7. namespace BansheeEngine
  8. {
  9. /** @cond RTTI */
  10. /** @addtogroup RTTI-Impl-Core
  11. * @{
  12. */
  13. class BS_CORE_EXPORT CJointRTTI : public RTTIType<CJoint, Component, CJointRTTI>
  14. {
  15. BS_REFL_MEMBER_NAMED(mBodyA, mBodies[0]);
  16. BS_REFL_MEMBER_NAMED(mBodyB, mBodies[1]);
  17. BS_PLAIN_MEMBER_NAMED(mPositionA, mPositions[0]);
  18. BS_PLAIN_MEMBER_NAMED(mPositionB, mPositions[1]);
  19. BS_PLAIN_MEMBER_NAMED(mRotationA, mRotations[0]);
  20. BS_PLAIN_MEMBER_NAMED(mRotationB, mRotations[1]);
  21. float& getBreakForce(OwnerType* obj) { return obj->mDesc.breakForce; }
  22. void setBreakForce(OwnerType* obj, float& val) { obj->mDesc.breakForce = val; }
  23. float& getBreakTorque(OwnerType* obj) { return obj->mDesc.breakTorque; }
  24. void setBreakTorque(OwnerType* obj, float& val) { obj->mDesc.breakTorque = val; }
  25. bool& getEnableCollision(OwnerType* obj) { return obj->mDesc.enableCollision; }
  26. void setEnableCollision(OwnerType* obj, bool& val) { obj->mDesc.enableCollision = val; }
  27. public:
  28. CJointRTTI()
  29. {
  30. BS_ADD_REFL_FIELD(mBodyA, 0);
  31. BS_ADD_REFL_FIELD(mBodyB, 1);
  32. BS_ADD_PLAIN_FIELD(mPositionA, 2);
  33. BS_ADD_PLAIN_FIELD(mPositionB, 3);
  34. BS_ADD_PLAIN_FIELD(mRotationA, 4);
  35. BS_ADD_PLAIN_FIELD(mRotationB, 5);
  36. BS_ADD_PLAIN_FIELD(BreakForce, 6);
  37. BS_ADD_PLAIN_FIELD(BreakTorque, 7);
  38. BS_ADD_PLAIN_FIELD(EnableCollision, 8);
  39. }
  40. const String& getRTTIName() override
  41. {
  42. static String name = "CJoint";
  43. return name;
  44. }
  45. UINT32 getRTTIId() override
  46. {
  47. return TID_CJoint;
  48. }
  49. SPtr<IReflectable> newRTTIObject() override
  50. {
  51. BS_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");
  52. return nullptr;
  53. }
  54. };
  55. /** @} */
  56. /** @endcond */
  57. }