CmRasterizerState.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmCommonEnums.h"
  4. #include "CmResource.h"
  5. namespace CamelotFramework
  6. {
  7. struct CM_EXPORT RASTERIZER_STATE_DESC
  8. {
  9. RASTERIZER_STATE_DESC()
  10. : polygonMode(PM_SOLID)
  11. , cullMode(CULL_COUNTERCLOCKWISE)
  12. , depthBias(0)
  13. , depthBiasClamp(0.0f)
  14. , slopeScaledDepthBias(0.0f)
  15. , depthClipEnable(true)
  16. , scissorEnable(false)
  17. , multisampleEnable(true)
  18. , antialiasedLineEnable(false)
  19. { }
  20. PolygonMode polygonMode;
  21. CullingMode cullMode;
  22. int depthBias;
  23. float depthBiasClamp;
  24. float slopeScaledDepthBias;
  25. bool depthClipEnable;
  26. bool scissorEnable;
  27. bool multisampleEnable;
  28. bool antialiasedLineEnable;
  29. };
  30. // TODO Low priority - Write doc explaining various states
  31. class CM_EXPORT RasterizerState : public Resource
  32. {
  33. public:
  34. virtual ~RasterizerState() {}
  35. PolygonMode getPolygonMode() const { return mData.polygonMode; }
  36. CullingMode getCullMode() const { return mData.cullMode; }
  37. int getDepthBias() const { return mData.depthBias; }
  38. float getDepthBiasClamp() const { return mData.depthBiasClamp; }
  39. float getSlopeScaledDepthBias() const { return mData.slopeScaledDepthBias; }
  40. bool getDepthClipEnable() const { return mData.depthClipEnable; }
  41. bool getScissorEnable() const { return mData.scissorEnable; }
  42. bool getMultisampleEnable() const { return mData.multisampleEnable; }
  43. bool getAntialiasedLineEnable() const { return mData.antialiasedLineEnable; }
  44. static HRasterizerState create(const RASTERIZER_STATE_DESC& desc);
  45. /**
  46. * @brief Returns the default rasterizer state;
  47. */
  48. static const RasterizerStatePtr& getDefault();
  49. protected:
  50. friend class RenderStateManager;
  51. virtual void initialize(const RASTERIZER_STATE_DESC& desc);
  52. RASTERIZER_STATE_DESC mData;
  53. /************************************************************************/
  54. /* RTTI */
  55. /************************************************************************/
  56. public:
  57. friend class RasterizerStateRTTI;
  58. static RTTITypeBase* getRTTIStatic();
  59. virtual RTTITypeBase* getRTTI() const;
  60. };
  61. }