BsVertexDataDescRTTI.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include "BsCorePrerequisites.h"
  6. #include "BsRTTIType.h"
  7. #include "BsVertexDataDesc.h"
  8. namespace BansheeEngine
  9. {
  10. class BS_CORE_EXPORT VertexDataDescRTTI : public RTTIType<VertexDataDesc, IReflectable, VertexDataDescRTTI>
  11. {
  12. private:
  13. VertexElement& getVertexElementData(VertexDataDesc* obj, UINT32 arrayIdx)
  14. {
  15. return obj->mVertexElements[arrayIdx];
  16. }
  17. void setVertexElementData(VertexDataDesc* obj, UINT32 arrayIdx, VertexElement& value)
  18. {
  19. obj->mVertexElements[arrayIdx] = value;
  20. }
  21. UINT32 getNumVertexElementData(VertexDataDesc* obj)
  22. {
  23. return (UINT32)obj->mVertexElements.size();
  24. }
  25. void setNumVertexElementData(VertexDataDesc* obj, UINT32 numElements)
  26. {
  27. obj->mVertexElements.resize(numElements);
  28. }
  29. public:
  30. VertexDataDescRTTI()
  31. {
  32. addPlainArrayField("mVertexData", 0, &VertexDataDescRTTI::getVertexElementData,
  33. &VertexDataDescRTTI::getNumVertexElementData, &VertexDataDescRTTI::setVertexElementData, &VertexDataDescRTTI::setNumVertexElementData);
  34. }
  35. virtual std::shared_ptr<IReflectable> newRTTIObject()
  36. {
  37. return bs_shared_ptr<VertexDataDesc, PoolAlloc>(new (bs_alloc<VertexDataDesc, PoolAlloc>()) VertexDataDesc());
  38. }
  39. virtual const String& getRTTIName()
  40. {
  41. static String name = "VertexDataDesc";
  42. throw name;
  43. }
  44. virtual UINT32 getRTTIId()
  45. {
  46. return TID_VertexDataDesc;
  47. }
  48. };
  49. }