| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #pragma once |
| 4 | |
| 5 | #include "BsCorePrerequisites.h" |
| 6 | #include "Reflection/BsRTTIType.h" |
| 7 | #include "Components/BsCJoint.h" |
| 8 | |
| 9 | namespace bs |
| 10 | { |
| 11 | /** @cond RTTI */ |
| 12 | /** @addtogroup RTTI-Impl-Core |
| 13 | * @{ |
| 14 | */ |
| 15 | |
| 16 | class BS_CORE_EXPORT CJointRTTI : public RTTIType<CJoint, Component, CJointRTTI> |
| 17 | { |
| 18 | BS_BEGIN_RTTI_MEMBERS |
| 19 | BS_RTTI_MEMBER_REFL_NAMED(mBodyA, mBodies[0], 0) |
| 20 | BS_RTTI_MEMBER_REFL_NAMED(mBodyB, mBodies[1], 1) |
| 21 | |
| 22 | BS_RTTI_MEMBER_PLAIN_NAMED(mPositionA, mPositions[0], 2) |
| 23 | BS_RTTI_MEMBER_PLAIN_NAMED(mPositionB, mPositions[1], 3) |
| 24 | |
| 25 | BS_RTTI_MEMBER_PLAIN_NAMED(mRotationA, mRotations[0], 4) |
| 26 | BS_RTTI_MEMBER_PLAIN_NAMED(mRotationB, mRotations[1], 5) |
| 27 | BS_END_RTTI_MEMBERS |
| 28 | |
| 29 | float& getBreakForce(OwnerType* obj) { return obj->mDesc.breakForce; } |
| 30 | void setBreakForce(OwnerType* obj, float& val) { obj->mDesc.breakForce = val; } |
| 31 | |
| 32 | float& getBreakTorque(OwnerType* obj) { return obj->mDesc.breakTorque; } |
| 33 | void setBreakTorque(OwnerType* obj, float& val) { obj->mDesc.breakTorque = val; } |
| 34 | |
| 35 | bool& getEnableCollision(OwnerType* obj) { return obj->mDesc.enableCollision; } |
| 36 | void setEnableCollision(OwnerType* obj, bool& val) { obj->mDesc.enableCollision = val; } |
| 37 | |
| 38 | public: |
| 39 | CJointRTTI() |
| 40 | { |
| 41 | addPlainField("BreakForce" , 6, &CJointRTTI::getBreakForce, &CJointRTTI::setBreakForce); |
| 42 | addPlainField("BreakTorque" , 7, &CJointRTTI::getBreakTorque, &CJointRTTI::setBreakTorque); |
| 43 | addPlainField("EnableCollision" , 8, &CJointRTTI::getEnableCollision, &CJointRTTI::setEnableCollision); |
| 44 | } |
| 45 | |
| 46 | const String& getRTTIName() override |
| 47 | { |
| 48 | static String name = "CJoint" ; |
| 49 | return name; |
| 50 | } |
| 51 | |
| 52 | UINT32 getRTTIId() override |
| 53 | { |
| 54 | return TID_CJoint; |
| 55 | } |
| 56 | |
| 57 | SPtr<IReflectable> newRTTIObject() override |
| 58 | { |
| 59 | BS_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class." ); |
| 60 | return nullptr; |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | /** @} */ |
| 65 | /** @endcond */ |
| 66 | } |
| 67 | |