Diligent Engine  v.2.4.g
RasterizerState.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
30 // clang-format off
31 
34 
35 #include "GraphicsTypes.h"
36 
38 
39 
40 
47 {
50 
54 
58 
61 };
62 
64 
70 {
73 
77 
82 
87 
90 };
91 
92 
94 
97 {
101 
105 
111  Bool FrontCounterClockwise DEFAULT_INITIALIZER(False);
112 
115  Bool DepthClipEnable DEFAULT_INITIALIZER(True);
116 
119  Bool ScissorEnable DEFAULT_INITIALIZER(False);
120 
123  Bool AntialiasedLineEnable DEFAULT_INITIALIZER(False);
124 
128 
132  Float32 DepthBiasClamp DEFAULT_INITIALIZER(0.f);
133 
136  Float32 SlopeScaledDepthBias DEFAULT_INITIALIZER(0.f);
137 
138 
139 #if DILIGENT_CPP_INTERFACE
140 
142 
144  CULL_MODE _CullMode,
145  Bool _FrontCounterClockwise = RasterizerStateDesc{}.FrontCounterClockwise,
146  Bool _DepthClipEnable = RasterizerStateDesc{}.DepthClipEnable,
147  Bool _ScissorEnable = RasterizerStateDesc{}.ScissorEnable,
148  Bool _AntialiasedLineEnable = RasterizerStateDesc{}.AntialiasedLineEnable,
149  Int32 _DepthBias = RasterizerStateDesc{}.DepthBias,
150  Float32 _DepthBiasClamp = RasterizerStateDesc{}.DepthBiasClamp,
151  Float32 _SlopeScaledDepthBias = RasterizerStateDesc{}.SlopeScaledDepthBias)noexcept :
152  FillMode {_FillMode },
153  CullMode {_CullMode },
154  FrontCounterClockwise {_FrontCounterClockwise},
155  DepthClipEnable {_DepthClipEnable },
156  ScissorEnable {_ScissorEnable },
157  AntialiasedLineEnable {_AntialiasedLineEnable},
158  DepthBias {_DepthBias },
159  DepthBiasClamp {_DepthBiasClamp },
160  SlopeScaledDepthBias {_SlopeScaledDepthBias }
161  {
162  }
163 
165 
170  bool operator == (const RasterizerStateDesc& RHS)const
171  {
172  return FillMode == RHS.FillMode &&
173  CullMode == RHS.CullMode &&
174  FrontCounterClockwise == RHS.FrontCounterClockwise &&
175  DepthBias == RHS.DepthBias &&
176  DepthBiasClamp == RHS.DepthBiasClamp &&
177  SlopeScaledDepthBias == RHS.SlopeScaledDepthBias &&
178  DepthClipEnable == RHS.DepthClipEnable &&
179  ScissorEnable == RHS.ScissorEnable &&
180  AntialiasedLineEnable == RHS.AntialiasedLineEnable;
181  }
182 #endif
183 };
185 
Diligent::Float32
float Float32
32-bit float
Definition: BasicTypes.h:43
Diligent::FILL_MODE_SOLID
@ FILL_MODE_SOLID
Rasterize triangles using solid fill. Direct3D counterpart: D3D11_FILL_SOLID/D3D12_FILL_MODE_SOLID....
Definition: RasterizerState.h:57
Diligent::FILL_MODE
FILL_MODE
Fill mode.
Definition: RasterizerState.h:46
Diligent::operator==
bool operator==(const Plane3D &p1, const Plane3D &p2)
Definition: AdvancedMath.hpp:442
Diligent::CULL_MODE_BACK
@ CULL_MODE_BACK
Do not draw triangles that are back-facing. Front- and back-facing triangles are determined by the Ra...
Definition: RasterizerState.h:86
Diligent::RasterizerStateDesc
Rasterizer state description.
Definition: RasterizerState.h:96
Diligent::CULL_MODE_NUM_MODES
@ CULL_MODE_NUM_MODES
Helper value that stores the total number of cull modes in the enumeration.
Definition: RasterizerState.h:89
Diligent::Int32
int32_t Int32
32-bit signed integer
Definition: BasicTypes.h:46
Diligent::Int8
int8_t Int8
8-bit signed integer
Definition: BasicTypes.h:48
Diligent::RasterizerStateDesc::SlopeScaledDepthBias
Float32 SlopeScaledDepthBias
Scalar that scales the given pixel's slope before adding to the pixel's depth. Default value: 0.
Definition: RasterizerState.h:136
Diligent::RasterizerStateDesc::AntialiasedLineEnable
Bool AntialiasedLineEnable
Specifies whether to enable line antialiasing. Default value: False.
Definition: RasterizerState.h:123
Diligent::CULL_MODE
CULL_MODE
Cull mode.
Definition: RasterizerState.h:69
Diligent::RasterizerStateDesc::RasterizerStateDesc
RasterizerStateDesc(FILL_MODE _FillMode, CULL_MODE _CullMode, Bool _FrontCounterClockwise=RasterizerStateDesc{}.FrontCounterClockwise, Bool _DepthClipEnable=RasterizerStateDesc{}.DepthClipEnable, Bool _ScissorEnable=RasterizerStateDesc{}.ScissorEnable, Bool _AntialiasedLineEnable=RasterizerStateDesc{}.AntialiasedLineEnable, Int32 _DepthBias=RasterizerStateDesc{}.DepthBias, Float32 _DepthBiasClamp=RasterizerStateDesc{}.DepthBiasClamp, Float32 _SlopeScaledDepthBias=RasterizerStateDesc{}.SlopeScaledDepthBias) noexcept
Definition: RasterizerState.h:143
DILIGENT_END_NAMESPACE
#define DILIGENT_END_NAMESPACE
Definition: CommonDefinitions.h:86
Diligent::FILL_MODE_NUM_MODES
@ FILL_MODE_NUM_MODES
Helper value that stores the total number of fill modes in the enumeration.
Definition: RasterizerState.h:60
Diligent::RasterizerStateDesc::ScissorEnable
Bool ScissorEnable
Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled....
Definition: RasterizerState.h:119
Diligent::CULL_MODE_UNDEFINED
@ CULL_MODE_UNDEFINED
Undefined cull mode.
Definition: RasterizerState.h:72
Diligent::RasterizerStateDesc::RasterizerStateDesc
RasterizerStateDesc() noexcept
Definition: RasterizerState.h:141
Diligent::CULL_MODE_FRONT
@ CULL_MODE_FRONT
Do not draw triangles that are front-facing. Front- and back-facing triangles are determined by the R...
Definition: RasterizerState.h:81
Diligent::RasterizerStateDesc::DepthBiasClamp
Float32 DepthBiasClamp
Maximum depth bias of a pixel.
Definition: RasterizerState.h:132
DEFAULT_INITIALIZER
#define DEFAULT_INITIALIZER(x)
Definition: CommonDefinitions.h:93
Diligent::Bool
bool Bool
Boolean.
Definition: BasicTypes.h:59
Diligent::CULL_MODE_NONE
@ CULL_MODE_NONE
Draw all triangles. Direct3D counterpart: D3D11_CULL_NONE/D3D12_CULL_MODE_NONE. OpenGL counterpart:...
Definition: RasterizerState.h:76
Diligent::RasterizerStateDesc::FillMode
FILL_MODE FillMode
Determines traingle fill mode, see Diligent::FILL_MODE for details. Default value: Diligent::FILL_MOD...
Definition: RasterizerState.h:100
DILIGENT_TYPED_ENUM
#define DILIGENT_TYPED_ENUM(EnumName, EnumType)
Definition: CommonDefinitions.h:88
Diligent::FILL_MODE_UNDEFINED
@ FILL_MODE_UNDEFINED
Undefined fill mode.
Definition: RasterizerState.h:49
Diligent::FILL_MODE_WIREFRAME
@ FILL_MODE_WIREFRAME
Rasterize triangles using wireframe fill. Direct3D counterpart: D3D11_FILL_WIREFRAME/D3D12_FILL_MOD...
Definition: RasterizerState.h:53
Diligent::RasterizerStateDesc::CullMode
CULL_MODE CullMode
Determines traingle cull mode, see Diligent::CULL_MODE for details. Default value: Diligent::CULL_MOD...
Definition: RasterizerState.h:104
Diligent::RasterizerStateDesc::DepthBias
Int32 DepthBias
Constant value added to the depth of a given pixel. Default value: 0.
Definition: RasterizerState.h:127
DILIGENT_BEGIN_NAMESPACE
#define DILIGENT_BEGIN_NAMESPACE(Name)
Definition: CommonDefinitions.h:82
Diligent::RasterizerStateDesc::FrontCounterClockwise
Bool FrontCounterClockwise
Determines if a triangle is front- or back-facing. If this parameter is True, a triangle will be cons...
Definition: RasterizerState.h:111
GraphicsTypes.h
Diligent::RasterizerStateDesc::DepthClipEnable
Bool DepthClipEnable
Enable clipping against near and far clip planes. Default value: True.
Definition: RasterizerState.h:115
Diligent::RasterizerStateDesc
struct RasterizerStateDesc RasterizerStateDesc
Definition: RasterizerState.h:184
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37