BsDepthStencilStateRTTI.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsRTTIType.h"
  4. #include "BsDepthStencilState.h"
  5. #include "BsRenderStateManager.h"
  6. namespace BansheeEngine
  7. {
  8. /** @cond RTTI */
  9. /** @addtogroup RTTI-Impl-Core
  10. * @{
  11. */
  12. class BS_CORE_EXPORT DepthStencilStateRTTI : public RTTIType<DepthStencilState, IReflectable, DepthStencilStateRTTI>
  13. {
  14. private:
  15. DEPTH_STENCIL_STATE_DESC& getData(DepthStencilState* obj) { return obj->mProperties.mData; }
  16. void setData(DepthStencilState* obj, DEPTH_STENCIL_STATE_DESC& val) { obj->mProperties.mData = val; }
  17. public:
  18. DepthStencilStateRTTI()
  19. {
  20. addPlainField("mData", 0, &DepthStencilStateRTTI::getData, &DepthStencilStateRTTI::setData);
  21. }
  22. void onDeserializationEnded(IReflectable* obj) override
  23. {
  24. DepthStencilState* depthStencilState = static_cast<DepthStencilState*>(obj);
  25. depthStencilState->initialize();
  26. }
  27. const String& getRTTIName() override
  28. {
  29. static String name = "DepthStencilState";
  30. return name;
  31. }
  32. UINT32 getRTTIId() override
  33. {
  34. return TID_DepthStencilState;
  35. }
  36. std::shared_ptr<IReflectable> newRTTIObject() override
  37. {
  38. return RenderStateManager::instance()._createDepthStencilStatePtr(DEPTH_STENCIL_STATE_DESC());
  39. }
  40. };
  41. /** @} */
  42. /** @endcond */
  43. }