OSDN Git Service

DTXMania089リリースに際してのtag付け。
[dtxmania/dtxmania.git] / 110401(DTXMania089) / SlimDXc_Jun2010(VC++2008) / source / direct3d11 / RasterizerStateDescription11.cpp
1 #include "stdafx.h"\r
2 /*\r
3 * Copyright (c) 2007-2010 SlimDX Group\r
4\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
11\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
14\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
21 * THE SOFTWARE.\r
22 */\r
23 \r
24 #include <d3d11.h>\r
25 \r
26 #include "RasterizerStateDescription11.h"\r
27 \r
28 namespace SlimDX\r
29 {\r
30 namespace Direct3D11\r
31\r
32         RasterizerStateDescription::RasterizerStateDescription( const D3D11_RASTERIZER_DESC& native )\r
33         {\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
44         }\r
45         \r
46         D3D11_RASTERIZER_DESC RasterizerStateDescription::CreateNativeVersion()\r
47         {\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
59                 \r
60                 return native;\r
61         }\r
62         \r
63         Direct3D11::FillMode RasterizerStateDescription::FillMode::get()\r
64         {\r
65                 return m_FillMode;\r
66         }\r
67         \r
68         void RasterizerStateDescription::FillMode::set( Direct3D11::FillMode value )\r
69         {\r
70                 m_FillMode = value;     \r
71         }\r
72         \r
73         Direct3D11::CullMode RasterizerStateDescription::CullMode::get()\r
74         {\r
75                 return m_CullMode;\r
76         }\r
77         \r
78         void RasterizerStateDescription::CullMode::set( Direct3D11::CullMode value )\r
79         {\r
80                 m_CullMode = value;     \r
81         }\r
82         \r
83         bool RasterizerStateDescription::IsFrontCounterclockwise::get()\r
84         {\r
85                 return m_FrontCounterClockwise;\r
86         }\r
87         \r
88         void RasterizerStateDescription::IsFrontCounterclockwise::set( bool value )\r
89         {\r
90                 m_FrontCounterClockwise = value;        \r
91         }\r
92         \r
93         int RasterizerStateDescription::DepthBias::get()\r
94         {\r
95                 return m_DepthBias;\r
96         }\r
97         \r
98         void RasterizerStateDescription::DepthBias::set( int value )\r
99         {\r
100                 m_DepthBias = value;    \r
101         }\r
102         \r
103         float RasterizerStateDescription::DepthBiasClamp::get()\r
104         {\r
105                 return m_DepthBiasClamp;\r
106         }\r
107         \r
108         void RasterizerStateDescription::DepthBiasClamp::set( float value )\r
109         {\r
110                 m_DepthBiasClamp = value;       \r
111         }\r
112         \r
113         float RasterizerStateDescription::SlopeScaledDepthBias::get()\r
114         {\r
115                 return m_SlopeScaledDepthBias;\r
116         }\r
117         \r
118         void RasterizerStateDescription::SlopeScaledDepthBias::set( float value )\r
119         {\r
120                 m_SlopeScaledDepthBias = value; \r
121         }\r
122         \r
123         bool RasterizerStateDescription::IsDepthClipEnabled::get()\r
124         {\r
125                 return m_DepthClipEnable;\r
126         }\r
127         \r
128         void RasterizerStateDescription::IsDepthClipEnabled::set( bool value )\r
129         {\r
130                 m_DepthClipEnable = value;      \r
131         }\r
132         \r
133         bool RasterizerStateDescription::IsScissorEnabled::get()\r
134         {\r
135                 return m_ScissorEnable;\r
136         }\r
137         \r
138         void RasterizerStateDescription::IsScissorEnabled::set( bool value )\r
139         {\r
140                 m_ScissorEnable = value;        \r
141         }\r
142         \r
143         bool RasterizerStateDescription::IsMultisampleEnabled::get()\r
144         {\r
145                 return m_MultisampleEnable;\r
146         }\r
147         \r
148         void RasterizerStateDescription::IsMultisampleEnabled::set( bool value )\r
149         {\r
150                 m_MultisampleEnable = value;    \r
151         }\r
152         \r
153         bool RasterizerStateDescription::IsAntialiasedLineEnabled::get()\r
154         {\r
155                 return m_AntialiasedLineEnable;\r
156         }\r
157         \r
158         void RasterizerStateDescription::IsAntialiasedLineEnabled::set( bool value )\r
159         {\r
160                 m_AntialiasedLineEnable = value;        \r
161         }\r
162 \r
163         bool RasterizerStateDescription::operator == ( RasterizerStateDescription left, RasterizerStateDescription right )\r
164         {\r
165                 return RasterizerStateDescription::Equals( left, right );\r
166         }\r
167 \r
168         bool RasterizerStateDescription::operator != ( RasterizerStateDescription left, RasterizerStateDescription right )\r
169         {\r
170                 return !RasterizerStateDescription::Equals( left, right );\r
171         }\r
172 \r
173         int RasterizerStateDescription::GetHashCode()\r
174         {\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
179         }\r
180 \r
181         bool RasterizerStateDescription::Equals( Object^ value )\r
182         {\r
183                 if( value == nullptr )\r
184                         return false;\r
185 \r
186                 if( value->GetType() != GetType() )\r
187                         return false;\r
188 \r
189                 return Equals( safe_cast<RasterizerStateDescription>( value ) );\r
190         }\r
191 \r
192         bool RasterizerStateDescription::Equals( RasterizerStateDescription value )\r
193         {\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
198         }\r
199 \r
200         bool RasterizerStateDescription::Equals( RasterizerStateDescription% value1, RasterizerStateDescription% value2 )\r
201         {\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
206         }\r
207 }\r
208 }\r