BsRenderStateManager.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 "BsModule.h"
  7. namespace BansheeEngine
  8. {
  9. /**
  10. * @brief Handles creation of various render states.
  11. */
  12. class BS_CORE_EXPORT RenderStateManager : public Module<RenderStateManager>
  13. {
  14. public:
  15. /**
  16. * @brief Creates and initializes a new SamplerState.
  17. */
  18. SamplerStatePtr createSamplerState(const SAMPLER_STATE_DESC& desc) const;
  19. /**
  20. * @brief Creates and initializes a new DepthStencilState.
  21. */
  22. DepthStencilStatePtr createDepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc) const;
  23. /**
  24. * @brief Creates and initializes a new RasterizerState.
  25. */
  26. RasterizerStatePtr createRasterizerState(const RASTERIZER_STATE_DESC& desc) const;
  27. /**
  28. * @brief Creates and initializes a new BlendState.
  29. */
  30. BlendStatePtr createBlendState(const BLEND_STATE_DESC& desc) const;
  31. /**
  32. * @brief Creates a completely empty and uninitialized SamplerState.
  33. * Should only be used for VERY specific purposes, like deserialization,
  34. * as it requires additional manual initialization that is not required normally.
  35. */
  36. SamplerStatePtr createEmptySamplerState() const;
  37. /**
  38. * @brief Creates a completely empty and uninitialized DepthStencilState.
  39. * Should only be used for VERY specific purposes, like deserialization,
  40. * as it requires additional manual initialization that is not required normally.
  41. */
  42. DepthStencilStatePtr createEmptyDepthStencilState() const;
  43. /**
  44. * @brief Creates a completely empty and uninitialized RasterizerState.
  45. * Should only be used for VERY specific purposes, like deserialization,
  46. * as it requires additional manual initialization that is not required normally.
  47. */
  48. RasterizerStatePtr createEmptyRasterizerState() const;
  49. /**
  50. * @brief Creates a completely empty and uninitialized BlendState.
  51. * Should only be used for VERY specific purposes, like deserialization,
  52. * as it requires additional manual initialization that is not required normally.
  53. */
  54. BlendStatePtr createEmptyBlendState() const;
  55. /**
  56. * @brief Gets a sampler state initialized with default options.
  57. */
  58. const SamplerStatePtr& getDefaultSamplerState() const;
  59. /**
  60. * @brief Gets a blend state initialized with default options.
  61. */
  62. const BlendStatePtr& getDefaultBlendState() const;
  63. /**
  64. * @brief Gets a rasterizer state initialized with default options.
  65. */
  66. const RasterizerStatePtr& getDefaultRasterizerState() const;
  67. /**
  68. * @brief Gets a depth stencil state initialized with default options.
  69. */
  70. const DepthStencilStatePtr& getDefaultDepthStencilState() const;
  71. protected:
  72. /**
  73. * @copydoc createSamplerState
  74. */
  75. virtual SamplerStatePtr createSamplerStateImpl() const;
  76. /**
  77. * @copydoc createBlendState
  78. */
  79. virtual BlendStatePtr createBlendStateImpl() const;
  80. /**
  81. * @copydoc createRasterizerState
  82. */
  83. virtual RasterizerStatePtr createRasterizerStateImpl() const;
  84. /**
  85. * @copydoc createDepthStencilState
  86. */
  87. virtual DepthStencilStatePtr createDepthStencilStateImpl() const;
  88. private:
  89. mutable SamplerStatePtr mDefaultSamplerState;
  90. mutable BlendStatePtr mDefaultBlendState;
  91. mutable RasterizerStatePtr mDefaultRasterizerState;
  92. mutable DepthStencilStatePtr mDefaultDepthStencilState;
  93. };
  94. }