Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
RasterizerStateDescription.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System.Runtime.InteropServices;
4 
5 using SiliconStudio.Core;
6 
7 namespace SiliconStudio.Paradox.Graphics
8 {
9  /// <summary>
10  /// Describes a rasterizer state.
11  /// </summary>
12  [DataContract]
13  [StructLayout(LayoutKind.Sequential)]
15  {
16  /// <summary>
17  /// Initializes a new instance of the <see cref="RasterizerStateDescription"/> class.
18  /// </summary>
19  /// <param name="cullMode">The cull mode.</param>
20  public RasterizerStateDescription(CullMode cullMode) : this()
21  {
22  SetDefault();
23  CullMode = cullMode;
24  }
25 
26  /// <summary>
27  /// Determines the fill mode to use when rendering (see <see cref="FillMode"/>).
28  /// </summary>
30 
31  /// <summary>
32  /// Indicates triangles facing the specified direction are not drawn (see <see cref="CullMode"/>).
33  /// </summary>
35 
36  /// <summary>
37  /// Determines if a triangle is front- or back-facing. If this parameter is true, then a triangle will be considered front-facing if its vertices are counter-clockwise on the render target and considered back-facing if they are clockwise. If this parameter is false then the opposite is true.
38  /// </summary>
40 
41  /// <summary>
42  /// Depth value added to a given pixel.
43  /// </summary>
44  public int DepthBias;
45 
46  /// <summary>
47  /// Gets or sets the depth bias for polygons, which is the amount of bias to apply to the depth of a primitive to alleviate depth testing problems for primitives of similar depth. The default value is 0.
48  /// </summary>
49  public float DepthBiasClamp;
50 
51  /// <summary>
52  /// Scalar on a given pixel's slope.
53  /// </summary>
54  public float SlopeScaleDepthBias;
55 
56  /// <summary>
57  /// Enable clipping based on distance.
58  /// </summary>
59  public bool DepthClipEnable;
60 
61  /// <summary>
62  /// Enable scissor-rectangle culling. All pixels ouside an active scissor rectangle are culled.
63  /// </summary>
64  public bool ScissorTestEnable;
65 
66  /// <summary>
67  /// Enable multisample antialiasing.
68  /// </summary>
69  public bool MultiSampleAntiAlias;
70 
71  /// <summary>
72  /// Enable line antialiasing; only applies if doing line drawing and MultisampleEnable is false.
73  /// </summary>
75 
76  /// <summary>
77  /// Sets default values for this instance.
78  /// </summary>
79  public void SetDefault()
80  {
81  CullMode = CullMode.Back;
82  FillMode = FillMode.Solid;
83  DepthClipEnable = true;
84  FrontFaceCounterClockwise = false;
85  ScissorTestEnable = false;
86  MultiSampleAntiAlias = false;
87  MultiSampleAntiAliasLine = false;
88  DepthBias = 0;
89  DepthBiasClamp = 0f;
90  SlopeScaleDepthBias = 0f;
91  }
92 
93  /// <summary>
94  /// Gets default values for this instance.
95  /// </summary>
97  {
98  get
99  {
100  var desc = new RasterizerStateDescription();
101  desc.SetDefault();
102  return desc;
103  }
104  }
105  }
106 }
FillMode FillMode
Determines the fill mode to use when rendering (see FillMode).
bool MultiSampleAntiAliasLine
Enable line antialiasing; only applies if doing line drawing and MultisampleEnable is false...
CullMode CullMode
Indicates triangles facing the specified direction are not drawn (see CullMode).
Use the default mode depending on the type of the field/property.
CullMode
Indicates triangles facing a particular direction are not drawn.
Definition: CullMode.cs:14
bool FrontFaceCounterClockwise
Determines if a triangle is front- or back-facing. If this parameter is true, then a triangle will be...
void SetDefault()
Sets default values for this instance.
RasterizerStateDescription(CullMode cullMode)
Initializes a new instance of the RasterizerStateDescription class.
bool ScissorTestEnable
Enable scissor-rectangle culling. All pixels ouside an active scissor rectangle are culled...
float DepthBiasClamp
Gets or sets the depth bias for polygons, which is the amount of bias to apply to the depth of a prim...