CmMeshRTTI.h 901 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmRTTIType.h"
  4. #include "CmMesh.h"
  5. namespace CamelotEngine
  6. {
  7. class MeshRTTI : public RTTIType<Mesh, Resource, MeshRTTI>
  8. {
  9. MeshDataPtr getMeshData(Mesh* obj) { return obj->getMeshData(); }
  10. void setMeshData(Mesh* obj, MeshDataPtr meshData) { obj->setMeshData(meshData); }
  11. public:
  12. MeshRTTI()
  13. {
  14. addReflectablePtrField("mMeshData", 0, &MeshRTTI::getMeshData, &MeshRTTI::setMeshData);
  15. }
  16. virtual void onDeserializationEnded(IReflectable* obj)
  17. {
  18. Mesh* mesh = static_cast<Mesh*>(obj);
  19. mesh->initialize();
  20. }
  21. virtual std::shared_ptr<IReflectable> newRTTIObject()
  22. {
  23. return std::shared_ptr<Mesh>(Mesh::createEmpty());
  24. }
  25. virtual const String& getRTTIName()
  26. {
  27. static String name = "Mesh";
  28. throw name;
  29. }
  30. virtual UINT32 getRTTIId()
  31. {
  32. return TID_Mesh;
  33. }
  34. };
  35. }