BsDepthStencilState.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. DepthStencilStatePtr DepthStencilState::create(const DEPTH_STENCIL_STATE_DESC& desc)
  46. {
  47. return RenderStateManager::instance().createDepthStencilState(desc);
  48. }
  49. /************************************************************************/
  50. /* RTTI */
  51. /************************************************************************/
  52. RTTITypeBase* DepthStencilState::getRTTIStatic()
  53. {
  54. return DepthStencilStateRTTI::instance();
  55. }
  56. RTTITypeBase* DepthStencilState::getRTTI() const
  57. {
  58. return DepthStencilState::getRTTIStatic();
  59. }
  60. }