BsDepthStencilState.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "BsDepthStencilState.h"
  2. #include "BsRenderStateManager.h"
  3. #include "BsRenderAPI.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. const SPtr<DepthStencilStateCore>& DepthStencilStateCore::getDefault()
  22. {
  23. return RenderStateCoreManager::instance().getDefaultDepthStencilState();
  24. }
  25. DepthStencilState::DepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc)
  26. :mProperties(desc)
  27. {
  28. }
  29. SPtr<DepthStencilStateCore> DepthStencilState::getCore() const
  30. {
  31. return std::static_pointer_cast<DepthStencilStateCore>(mCoreSpecific);
  32. }
  33. SPtr<CoreObjectCore> DepthStencilState::createCore() const
  34. {
  35. return RenderStateCoreManager::instance().createDepthStencilStateInternal(mProperties.mData);
  36. }
  37. const DepthStencilStatePtr& DepthStencilState::getDefault()
  38. {
  39. return RenderStateManager::instance().getDefaultDepthStencilState();
  40. }
  41. const DepthStencilProperties& DepthStencilState::getProperties() const
  42. {
  43. return mProperties;
  44. }
  45. HDepthStencilState DepthStencilState::create(const DEPTH_STENCIL_STATE_DESC& desc)
  46. {
  47. DepthStencilStatePtr depthStencilPtr = RenderStateManager::instance().createDepthStencilState(desc);
  48. return static_resource_cast<DepthStencilState>(gResources()._createResourceHandle(depthStencilPtr));
  49. }
  50. /************************************************************************/
  51. /* RTTI */
  52. /************************************************************************/
  53. RTTITypeBase* DepthStencilState::getRTTIStatic()
  54. {
  55. return DepthStencilStateRTTI::instance();
  56. }
  57. RTTITypeBase* DepthStencilState::getRTTI() const
  58. {
  59. return DepthStencilState::getRTTIStatic();
  60. }
  61. }