OSDN Git Service

作業部屋#50802 画面キャプチャができなくなっていた問題を暫定対応(F12キー固定で対応中)
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d10 / DepthStencilStateDescription.cpp
1 #include "stdafx.h"
2 /*
3 * Copyright (c) 2007-2010 SlimDX Group
4
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24 #include <d3d10.h>
25
26 #include "DepthStencilOperationDescription.h"
27 #include "DepthStencilStateDescription.h"
28
29 using namespace System;
30
31 namespace SlimDX
32 {
33 namespace Direct3D10
34
35         DepthStencilStateDescription::DepthStencilStateDescription( const D3D10_DEPTH_STENCIL_DESC& native )
36         {
37                 m_DepthEnable = native.DepthEnable ? true : false;
38                 m_DepthWriteMask = static_cast<Direct3D10::DepthWriteMask>( native.DepthWriteMask );
39                 m_DepthFunc = static_cast<Comparison>( native.DepthFunc );
40                 m_StencilEnable = native.StencilEnable ? true : false;
41                 m_StencilReadMask = native.StencilReadMask;
42                 m_StencilWriteMask = native.StencilWriteMask;
43                 m_FrontFace = DepthStencilOperationDescription( native.FrontFace );
44                 m_BackFace = DepthStencilOperationDescription( native.BackFace );
45         }
46         
47         D3D10_DEPTH_STENCIL_DESC DepthStencilStateDescription::CreateNativeVersion()
48         {
49                 D3D10_DEPTH_STENCIL_DESC native;
50                 native.DepthEnable = m_DepthEnable;
51                 native.DepthWriteMask = static_cast<D3D10_DEPTH_WRITE_MASK>( m_DepthWriteMask );
52                 native.DepthFunc = static_cast<D3D10_COMPARISON_FUNC>( m_DepthFunc );
53                 native.StencilEnable = m_StencilEnable;
54                 native.StencilReadMask = m_StencilReadMask;
55                 native.StencilWriteMask = m_StencilWriteMask;
56                 native.FrontFace = m_FrontFace.CreateNativeVersion();
57                 native.BackFace = m_BackFace.CreateNativeVersion();
58                 
59                 return native;
60         }
61         
62         bool DepthStencilStateDescription::IsDepthEnabled::get()
63         {
64                 return m_DepthEnable;
65         }
66         
67         void DepthStencilStateDescription::IsDepthEnabled::set( bool value )
68         {
69                 m_DepthEnable = value;
70         }
71         
72         Direct3D10::DepthWriteMask DepthStencilStateDescription::DepthWriteMask::get()
73         {
74                 return m_DepthWriteMask;
75         }
76         
77         void DepthStencilStateDescription::DepthWriteMask::set( Direct3D10::DepthWriteMask value )
78         {
79                 m_DepthWriteMask = value;
80         }
81         
82         Comparison DepthStencilStateDescription::DepthComparison::get()
83         {
84                 return m_DepthFunc;
85         }
86         
87         void DepthStencilStateDescription::DepthComparison::set( Comparison value )
88         {
89                 m_DepthFunc = value;
90         }
91         
92         bool DepthStencilStateDescription::IsStencilEnabled::get()
93         {
94                 return m_StencilEnable;
95         }
96         
97         void DepthStencilStateDescription::IsStencilEnabled::set( bool value )
98         {
99                 m_StencilEnable = value;
100         }
101         
102         Byte DepthStencilStateDescription::StencilReadMask::get()
103         {
104                 return m_StencilReadMask;
105         }
106         
107         void DepthStencilStateDescription::StencilReadMask::set( Byte value )
108         {
109                 m_StencilReadMask = value;
110         }
111         
112         Byte DepthStencilStateDescription::StencilWriteMask::get()
113         {
114                 return m_StencilWriteMask;
115         }
116         
117         void DepthStencilStateDescription::StencilWriteMask::set( Byte value )
118         {
119                 m_StencilWriteMask = value;
120         }
121         
122         DepthStencilOperationDescription DepthStencilStateDescription::FrontFace::get()
123         {
124                 return m_FrontFace;
125         }
126         
127         void DepthStencilStateDescription::FrontFace::set( DepthStencilOperationDescription value )
128         {
129                 m_FrontFace = value;
130         }
131         
132         DepthStencilOperationDescription DepthStencilStateDescription::BackFace::get()
133         {
134                 return m_BackFace;
135         }
136         
137         void DepthStencilStateDescription::BackFace::set( DepthStencilOperationDescription value )
138         {
139                 m_BackFace = value;
140         }
141
142         bool DepthStencilStateDescription::operator == ( DepthStencilStateDescription left, DepthStencilStateDescription right )
143         {
144                 return DepthStencilStateDescription::Equals( left, right );
145         }
146
147         bool DepthStencilStateDescription::operator != ( DepthStencilStateDescription left, DepthStencilStateDescription right )
148         {
149                 return !DepthStencilStateDescription::Equals( left, right );
150         }
151
152         int DepthStencilStateDescription::GetHashCode()
153         {
154                 return m_DepthEnable.GetHashCode() + m_DepthWriteMask.GetHashCode() + m_DepthFunc.GetHashCode()
155                          + m_StencilEnable.GetHashCode() + m_StencilReadMask.GetHashCode() + m_StencilWriteMask.GetHashCode()
156                          + m_FrontFace.GetHashCode() + m_BackFace.GetHashCode();
157         }
158
159         bool DepthStencilStateDescription::Equals( Object^ value )
160         {
161                 if( value == nullptr )
162                         return false;
163
164                 if( value->GetType() != GetType() )
165                         return false;
166
167                 return Equals( safe_cast<DepthStencilStateDescription>( value ) );
168         }
169
170         bool DepthStencilStateDescription::Equals( DepthStencilStateDescription value )
171         {
172                 return ( m_DepthEnable == value.m_DepthEnable && m_DepthWriteMask == value.m_DepthWriteMask && m_DepthFunc == value.m_DepthFunc
173                          && m_StencilEnable == value.m_StencilEnable && m_StencilReadMask == value.m_StencilReadMask && m_StencilWriteMask == value.m_StencilWriteMask
174                          && m_FrontFace == value.m_FrontFace && m_BackFace == value.m_BackFace );
175         }
176
177         bool DepthStencilStateDescription::Equals( DepthStencilStateDescription% value1, DepthStencilStateDescription% value2 )
178         {
179                 return ( value1.m_DepthEnable == value2.m_DepthEnable && value1.m_DepthWriteMask == value2.m_DepthWriteMask && value1.m_DepthFunc == value2.m_DepthFunc
180                          && value1.m_StencilEnable == value2.m_StencilEnable && value1.m_StencilReadMask == value2.m_StencilReadMask && value1.m_StencilWriteMask == value2.m_StencilWriteMask
181                          && value1.m_FrontFace == value2.m_FrontFace && value1.m_BackFace == value2.m_BackFace );
182         }
183 }
184 }