Diligent Engine API Reference
RasterizerState.h
1 /* Copyright 2015-2018 Egor Yusov
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12  *
13  * In no event and under no legal theory, whether in tort (including negligence),
14  * contract, or otherwise, unless required by applicable law (such as deliberate
15  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16  * liable for any damages, including any direct, indirect, special, incidental,
17  * or consequential damages of any character arising as a result of this License or
18  * out of the use or inability to use the software (including but not limited to damages
19  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20  * all other commercial damages or losses), even if such Contributor has been advised
21  * of the possibility of such damages.
22  */
23 
24 #pragma once
25 
28 
29 #include "BasicTypes.h"
30 
31 namespace Diligent
32 {
33 
35 
40 enum FILL_MODE : Int32
41 {
44 
48 
52 
55 };
56 
58 
63 enum CULL_MODE : Int32
64 {
67 
71 
76 
81 
84 };
85 
86 
88 
91 {
94 
97 
103 
105  Int32 DepthBias;
106 
109  Float32 DepthBiasClamp;
110 
113 
118 
121 
124 
126 
139  CULL_MODE _CullMode = CULL_MODE_BACK,
140  Bool _FrontCounterClockwise = False,
141  Int32 _DepthBias = 0,
142  Float32 _DepthBiasClamp = 0.f,
143  Float32 _SlopeScaledDepthBias = 0.f,
144  Bool _DepthClipEnable = True,
145  Bool _ScissorEnable = False,
146  Bool _AntialiasedLineEnable = False) :
147  FillMode ( _FillMode ),
148  CullMode ( _CullMode ),
149  FrontCounterClockwise( _FrontCounterClockwise ),
150  DepthBias ( _DepthBias ),
151  DepthBiasClamp ( _DepthBiasClamp ),
152  SlopeScaledDepthBias ( _SlopeScaledDepthBias ),
153  DepthClipEnable ( _DepthClipEnable ),
154  ScissorEnable ( _ScissorEnable ),
155  AntialiasedLineEnable( _AntialiasedLineEnable )
156  {
157  }
158 
159 
161 
166  bool operator == (const RasterizerStateDesc& RHS)const
167  {
168  return FillMode == RHS.FillMode &&
169  CullMode == RHS.CullMode &&
171  DepthBias == RHS.DepthBias &&
175  ScissorEnable == RHS.ScissorEnable &&
177  }
178 };
179 
180 }
Rasterize triangles using wireframe fill. Direct3D counterpart: D3D11_FILL_WIREFRAME/D3D12_FILL_MOD...
Definition: RasterizerState.h:47
bool operator==(const RasterizerStateDesc &RHS) const
Tests if two structures are equivalent.
Definition: RasterizerState.h:166
Int32 DepthBias
Constant value added to the depth of a given pixel.
Definition: RasterizerState.h:105
Helper value that stores the total number of fill modes in the enumeration.
Definition: RasterizerState.h:54
Undefined fill mode.
Definition: RasterizerState.h:43
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
FILL_MODE FillMode
Determines traingle fill mode, see Diligent::FILL_MODE for details.
Definition: RasterizerState.h:93
Bool DepthClipEnable
Enable clipping based on distance.
Definition: RasterizerState.h:117
Bool FrontCounterClockwise
Determines if a triangle is front- or back-facing. If this parameter is True, a triangle will be cons...
Definition: RasterizerState.h:102
Rasterize triangles using solid fill. Direct3D counterpart: D3D11_FILL_SOLID/D3D12_FILL_MODE_SOLID...
Definition: RasterizerState.h:51
Bool ScissorEnable
Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled...
Definition: RasterizerState.h:120
Undefined cull mode.
Definition: RasterizerState.h:66
CULL_MODE CullMode
Determines traingle cull mode, see Diligent::CULL_MODE for details.
Definition: RasterizerState.h:96
Float32 SlopeScaledDepthBias
Scalar that scales the given pixel's slope before adding to the pixel's depth.
Definition: RasterizerState.h:112
Rasterizer state description.
Definition: RasterizerState.h:90
RasterizerStateDesc(FILL_MODE _FillMode=FILL_MODE_SOLID, CULL_MODE _CullMode=CULL_MODE_BACK, Bool _FrontCounterClockwise=False, Int32 _DepthBias=0, Float32 _DepthBiasClamp=0.f, Float32 _SlopeScaledDepthBias=0.f, Bool _DepthClipEnable=True, Bool _ScissorEnable=False, Bool _AntialiasedLineEnable=False)
Initializes the structure members.
Definition: RasterizerState.h:138
Draw all triangles. Direct3D counterpart: D3D11_CULL_NONE/D3D12_CULL_MODE_NONE. OpenGL counterpart:...
Definition: RasterizerState.h:70
FILL_MODE
Fill mode.
Definition: RasterizerState.h:40
Helper value that stores the total number of cull modes in the enumeration.
Definition: RasterizerState.h:83
Do not draw triangles that are front-facing. Front- and back-facing triangles are determined by the R...
Definition: RasterizerState.h:75
Float32 DepthBiasClamp
Maximum depth bias of a pixel.
Definition: RasterizerState.h:109
Do not draw triangles that are back-facing. Front- and back-facing triangles are determined by the Ra...
Definition: RasterizerState.h:80
CULL_MODE
Cull mode.
Definition: RasterizerState.h:63
Bool AntialiasedLineEnable
Specifies whether to enable line antialiasing.
Definition: RasterizerState.h:123