3 * Copyright (c) 2007-2010 SlimDX Group
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
6 * of this software and associated documentation files (the "Software"), to deal
\r
7 * in the Software without restriction, including without limitation the rights
\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
9 * copies of the Software, and to permit persons to whom the Software is
\r
10 * furnished to do so, subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in
\r
13 * all copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
26 #include "RasterizerStateDescription11.h"
\r
30 namespace Direct3D11
\r
32 RasterizerStateDescription::RasterizerStateDescription( const D3D11_RASTERIZER_DESC& native )
\r
34 m_FillMode = static_cast<Direct3D11::FillMode>( native.FillMode );
\r
35 m_CullMode = static_cast<Direct3D11::CullMode>( native.CullMode );
\r
36 m_FrontCounterClockwise = native.FrontCounterClockwise ? true : false;
\r
37 m_DepthBias = native.DepthBias;
\r
38 m_DepthBiasClamp = native.DepthBiasClamp;
\r
39 m_SlopeScaledDepthBias = native.SlopeScaledDepthBias;
\r
40 m_DepthClipEnable = native.DepthClipEnable ? true : false;
\r
41 m_ScissorEnable = native.ScissorEnable ? true : false;
\r
42 m_MultisampleEnable = native.MultisampleEnable ? true : false;
\r
43 m_AntialiasedLineEnable = native.AntialiasedLineEnable ? true : false;
\r
46 D3D11_RASTERIZER_DESC RasterizerStateDescription::CreateNativeVersion()
\r
48 D3D11_RASTERIZER_DESC native;
\r
49 native.FillMode = static_cast<D3D11_FILL_MODE>( m_FillMode );
\r
50 native.CullMode = static_cast<D3D11_CULL_MODE>( m_CullMode );
\r
51 native.FrontCounterClockwise = m_FrontCounterClockwise;
\r
52 native.DepthBias = m_DepthBias;
\r
53 native.DepthBiasClamp = m_DepthBiasClamp;
\r
54 native.SlopeScaledDepthBias = m_SlopeScaledDepthBias;
\r
55 native.DepthClipEnable = m_DepthClipEnable;
\r
56 native.ScissorEnable = m_ScissorEnable;
\r
57 native.MultisampleEnable = m_MultisampleEnable;
\r
58 native.AntialiasedLineEnable = m_AntialiasedLineEnable;
\r
63 Direct3D11::FillMode RasterizerStateDescription::FillMode::get()
\r
68 void RasterizerStateDescription::FillMode::set( Direct3D11::FillMode value )
\r
70 m_FillMode = value;
\r
73 Direct3D11::CullMode RasterizerStateDescription::CullMode::get()
\r
78 void RasterizerStateDescription::CullMode::set( Direct3D11::CullMode value )
\r
80 m_CullMode = value;
\r
83 bool RasterizerStateDescription::IsFrontCounterclockwise::get()
\r
85 return m_FrontCounterClockwise;
\r
88 void RasterizerStateDescription::IsFrontCounterclockwise::set( bool value )
\r
90 m_FrontCounterClockwise = value;
\r
93 int RasterizerStateDescription::DepthBias::get()
\r
98 void RasterizerStateDescription::DepthBias::set( int value )
\r
100 m_DepthBias = value;
\r
103 float RasterizerStateDescription::DepthBiasClamp::get()
\r
105 return m_DepthBiasClamp;
\r
108 void RasterizerStateDescription::DepthBiasClamp::set( float value )
\r
110 m_DepthBiasClamp = value;
\r
113 float RasterizerStateDescription::SlopeScaledDepthBias::get()
\r
115 return m_SlopeScaledDepthBias;
\r
118 void RasterizerStateDescription::SlopeScaledDepthBias::set( float value )
\r
120 m_SlopeScaledDepthBias = value;
\r
123 bool RasterizerStateDescription::IsDepthClipEnabled::get()
\r
125 return m_DepthClipEnable;
\r
128 void RasterizerStateDescription::IsDepthClipEnabled::set( bool value )
\r
130 m_DepthClipEnable = value;
\r
133 bool RasterizerStateDescription::IsScissorEnabled::get()
\r
135 return m_ScissorEnable;
\r
138 void RasterizerStateDescription::IsScissorEnabled::set( bool value )
\r
140 m_ScissorEnable = value;
\r
143 bool RasterizerStateDescription::IsMultisampleEnabled::get()
\r
145 return m_MultisampleEnable;
\r
148 void RasterizerStateDescription::IsMultisampleEnabled::set( bool value )
\r
150 m_MultisampleEnable = value;
\r
153 bool RasterizerStateDescription::IsAntialiasedLineEnabled::get()
\r
155 return m_AntialiasedLineEnable;
\r
158 void RasterizerStateDescription::IsAntialiasedLineEnabled::set( bool value )
\r
160 m_AntialiasedLineEnable = value;
\r
163 bool RasterizerStateDescription::operator == ( RasterizerStateDescription left, RasterizerStateDescription right )
\r
165 return RasterizerStateDescription::Equals( left, right );
\r
168 bool RasterizerStateDescription::operator != ( RasterizerStateDescription left, RasterizerStateDescription right )
\r
170 return !RasterizerStateDescription::Equals( left, right );
\r
173 int RasterizerStateDescription::GetHashCode()
\r
175 return m_FillMode.GetHashCode() + m_CullMode.GetHashCode() + m_FrontCounterClockwise.GetHashCode()
\r
176 + m_DepthBias.GetHashCode() + m_DepthBiasClamp.GetHashCode() + m_SlopeScaledDepthBias.GetHashCode()
\r
177 + m_DepthClipEnable.GetHashCode() + m_ScissorEnable.GetHashCode() + m_MultisampleEnable.GetHashCode()
\r
178 + m_AntialiasedLineEnable.GetHashCode();
\r
181 bool RasterizerStateDescription::Equals( Object^ value )
\r
183 if( value == nullptr )
\r
186 if( value->GetType() != GetType() )
\r
189 return Equals( safe_cast<RasterizerStateDescription>( value ) );
\r
192 bool RasterizerStateDescription::Equals( RasterizerStateDescription value )
\r
194 return ( m_FillMode == value.m_FillMode && m_CullMode == value.m_CullMode && m_FrontCounterClockwise == value.m_FrontCounterClockwise
\r
195 && m_DepthBias == value.m_DepthBias && m_DepthBiasClamp == value.m_DepthBiasClamp && m_SlopeScaledDepthBias == value.m_SlopeScaledDepthBias
\r
196 && m_DepthClipEnable == value.m_DepthClipEnable && m_ScissorEnable == value.m_ScissorEnable && m_MultisampleEnable == value.m_MultisampleEnable
\r
197 && m_AntialiasedLineEnable == value.m_AntialiasedLineEnable );
\r
200 bool RasterizerStateDescription::Equals( RasterizerStateDescription% value1, RasterizerStateDescription% value2 )
\r
202 return ( value1.m_FillMode == value2.m_FillMode && value1.m_CullMode == value2.m_CullMode && value1.m_FrontCounterClockwise == value2.m_FrontCounterClockwise
\r
203 && value1.m_DepthBias == value2.m_DepthBias && value1.m_DepthBiasClamp == value2.m_DepthBiasClamp && value1.m_SlopeScaledDepthBias == value2.m_SlopeScaledDepthBias
\r
204 && value1.m_DepthClipEnable == value2.m_DepthClipEnable && value1.m_ScissorEnable == value2.m_ScissorEnable && value1.m_MultisampleEnable == value2.m_MultisampleEnable
\r
205 && value1.m_AntialiasedLineEnable == value2.m_AntialiasedLineEnable );
\r