BsDepthStencilState.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "BsDepthStencilState.h"
  2. #include "BsRenderStateManager.h"
  3. #include "BsRenderSystem.h"
  4. #include "BsDepthStencilStateRTTI.h"
  5. #include "BsException.h"
  6. #include "BsResources.h"
  7. namespace BansheeEngine
  8. {
  9. DepthStencilProperties::DepthStencilProperties(const DEPTH_STENCIL_STATE_DESC& desc)
  10. :mData(desc)
  11. {
  12. }
  13. DepthStencilStateCore::DepthStencilStateCore(const DEPTH_STENCIL_STATE_DESC& desc)
  14. : mProperties(desc)
  15. {
  16. }
  17. const DepthStencilProperties& DepthStencilStateCore::getProperties() const
  18. {
  19. return mProperties;
  20. }
  21. DepthStencilState::DepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc)
  22. :mProperties(desc)
  23. {
  24. }
  25. SPtr<DepthStencilStateCore> DepthStencilState::getCore() const
  26. {
  27. return std::static_pointer_cast<DepthStencilStateCore>(mCoreSpecific);
  28. }
  29. SPtr<CoreObjectCore> DepthStencilState::createCore() const
  30. {
  31. return RenderStateCoreManager::instance().createDepthStencilStateInternal(mProperties.mData);
  32. }
  33. const DepthStencilStatePtr& DepthStencilState::getDefault()
  34. {
  35. return RenderStateManager::instance().getDefaultDepthStencilState();
  36. }
  37. const DepthStencilProperties& DepthStencilState::getProperties() const
  38. {
  39. return mProperties;
  40. }
  41. HDepthStencilState DepthStencilState::create(const DEPTH_STENCIL_STATE_DESC& desc)
  42. {
  43. DepthStencilStatePtr depthStencilPtr = RenderStateManager::instance().createDepthStencilState(desc);
  44. return static_resource_cast<DepthStencilState>(gResources()._createResourceHandle(depthStencilPtr));
  45. }
  46. /************************************************************************/
  47. /* RTTI */
  48. /************************************************************************/
  49. RTTITypeBase* DepthStencilState::getRTTIStatic()
  50. {
  51. return DepthStencilStateRTTI::instance();
  52. }
  53. RTTITypeBase* DepthStencilState::getRTTI() const
  54. {
  55. return DepthStencilState::getRTTIStatic();
  56. }
  57. }