2
0

BsPhysicsMeshRTTI.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 "BsPhysicsMesh.h"
  7. #include "BsPhysics.h"
  8. namespace BansheeEngine
  9. {
  10. /** @cond RTTI */
  11. /** @addtogroup RTTI-Impl-Core
  12. * @{
  13. */
  14. class BS_CORE_EXPORT PhysicsMeshRTTI : public RTTIType<PhysicsMesh, Resource, PhysicsMeshRTTI>
  15. {
  16. private:
  17. BS_BEGIN_RTTI_MEMBERS
  18. BS_RTTI_MEMBER_REFLPTR(mInternal, 0)
  19. BS_END_RTTI_MEMBERS
  20. public:
  21. PhysicsMeshRTTI()
  22. :mInitMembers(this)
  23. { }
  24. void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
  25. {
  26. PhysicsMesh* mesh = static_cast<PhysicsMesh*>(obj);
  27. mesh->initialize();
  28. }
  29. const String& getRTTIName() override
  30. {
  31. static String name = "PhysicsMesh";
  32. return name;
  33. }
  34. UINT32 getRTTIId() override
  35. {
  36. return TID_PhysicsMesh;
  37. }
  38. SPtr<IReflectable> newRTTIObject() override
  39. {
  40. SPtr<PhysicsMesh> mesh = gPhysics().createMesh(nullptr, PhysicsMeshType::Convex);
  41. mesh->_setThisPtr(mesh);
  42. return mesh;
  43. }
  44. };
  45. class BS_CORE_EXPORT FPhysicsMeshRTTI : public RTTIType<FPhysicsMesh, IReflectable, FPhysicsMeshRTTI>
  46. {
  47. private:
  48. BS_BEGIN_RTTI_MEMBERS
  49. BS_RTTI_MEMBER_PLAIN(mType, 0)
  50. BS_END_RTTI_MEMBERS
  51. public:
  52. FPhysicsMeshRTTI()
  53. :mInitMembers(this)
  54. { }
  55. const String& getRTTIName() override
  56. {
  57. static String name = "FPhysicsMesh";
  58. return name;
  59. }
  60. UINT32 getRTTIId() override
  61. {
  62. return TID_FPhysicsMesh;
  63. }
  64. SPtr<IReflectable> newRTTIObject() override
  65. {
  66. BS_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");
  67. return nullptr;
  68. }
  69. };
  70. /** @} */
  71. /** @endcond */
  72. }