Ocular Engine
DepthStencilState.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_GRAPHICS_DEPTH_STENCIL_STATE__H__
19 #define __H__OCULAR_GRAPHICS_DEPTH_STENCIL_STATE__H__
20 
21 //------------------------------------------------------------------------------------------
22 
27 namespace Ocular
28 {
33  namespace Graphics
34  {
38  enum class DepthStencilComparison
39  {
40  AlwaysPass = 0,
41  NeverPass,
42  Equal,
43  NotEqual,
44  Less,
45  LessEqual,
46  Greater,
47  GreaterEqual,
48  Undefined
49  };
50 
54  enum class StencilOperation
55  {
56  Keep = 0,
57  Replace,
58  Zero,
59  Invert,
60  IncreaseClamp,
61  DecreaseClamp,
62  IncreaseWrap,
63  DecreaseWrap,
64  Undefined
65  };
66 
71  {
73  : depthBias(0.0f),
74  depthBiasClamp(0.0f),
75  slopeScaledDepthBias(0.0f)
76  {
77 
78  }
79 
80  //------------------------------------------------------------
81 
82  float depthBias;
83  float depthBiasClamp;
84  float slopeScaledDepthBias;
85  };
86 
91  {
93  : stencilPassOp(StencilOperation::Keep),
94  stencilFailOp(StencilOperation::Keep),
95  stencilPassDepthFailOp(StencilOperation::Keep),
96  comparisonFunction(DepthStencilComparison::AlwaysPass)
97  {
98 
99  }
100 
101  //------------------------------------------------------------
102 
103  StencilOperation stencilPassOp;
104  StencilOperation stencilFailOp;
105  StencilOperation stencilPassDepthFailOp;
106 
107  DepthStencilComparison comparisonFunction;
108  };
109 
114  {
116  : enableDepthTesting(true),
117  enableStencilTesting(false),
118  stencilReferenceValue(0),
119  stencilReadMask(0xFF),
120  stencilWriteMask(0xFF)
121  {
122 
123  }
124 
125  //------------------------------------------------------------
126 
127  DepthBiasState depthBias;
128 
129  bool enableDepthTesting;
130  bool enableStencilTesting;
131 
132  uint8_t stencilReferenceValue;
133  uint8_t stencilReadMask;
134  uint8_t stencilWriteMask;
135 
136  StencilFaceDescr frontFace;
137  StencilFaceDescr backFace;
138  };
139 
140  }
144 }
149 //------------------------------------------------------------------------------------------
150 
151 #endif
StencilOperation stencilFailOp
Operation to perform when stencil testing fails.
Definition: DepthStencilState.hpp:104
Definition: DepthStencilState.hpp:70
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: DepthStencilState.hpp:90
StencilOperation stencilPassOp
Operation to perform when both stencil and depth testing passes.
Definition: DepthStencilState.hpp:103
Definition: DepthStencilState.hpp:113
DepthStencilComparison comparisonFunction
Function to compare source data against destination data.
Definition: DepthStencilState.hpp:107
StencilOperation stencilPassDepthFailOp
Operation to perform when stencil testing passes, but depth testing fails.
Definition: DepthStencilState.hpp:105