+++ /dev/null
-#include "stdafx.h"\r
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-\r
-#include <d3d11.h>\r
-\r
-#include "DepthStencilOperationDescription11.h"\r
-#include "DepthStencilStateDescription11.h"\r
-\r
-using namespace System;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Direct3D11\r
-{ \r
- DepthStencilStateDescription::DepthStencilStateDescription( const D3D11_DEPTH_STENCIL_DESC& native )\r
- {\r
- m_DepthEnable = native.DepthEnable ? true : false;\r
- m_DepthWriteMask = static_cast<Direct3D11::DepthWriteMask>( native.DepthWriteMask );\r
- m_DepthFunc = static_cast<Comparison>( native.DepthFunc );\r
- m_StencilEnable = native.StencilEnable ? true : false;\r
- m_StencilReadMask = native.StencilReadMask;\r
- m_StencilWriteMask = native.StencilWriteMask;\r
- m_FrontFace = DepthStencilOperationDescription( native.FrontFace );\r
- m_BackFace = DepthStencilOperationDescription( native.BackFace );\r
- }\r
- \r
- D3D11_DEPTH_STENCIL_DESC DepthStencilStateDescription::CreateNativeVersion()\r
- {\r
- D3D11_DEPTH_STENCIL_DESC native;\r
- native.DepthEnable = m_DepthEnable;\r
- native.DepthWriteMask = static_cast<D3D11_DEPTH_WRITE_MASK>( m_DepthWriteMask );\r
- native.DepthFunc = static_cast<D3D11_COMPARISON_FUNC>( m_DepthFunc );\r
- native.StencilEnable = m_StencilEnable;\r
- native.StencilReadMask = m_StencilReadMask;\r
- native.StencilWriteMask = m_StencilWriteMask;\r
- native.FrontFace = m_FrontFace.CreateNativeVersion();\r
- native.BackFace = m_BackFace.CreateNativeVersion();\r
- \r
- return native;\r
- }\r
- \r
- bool DepthStencilStateDescription::IsDepthEnabled::get()\r
- {\r
- return m_DepthEnable;\r
- }\r
- \r
- void DepthStencilStateDescription::IsDepthEnabled::set( bool value )\r
- {\r
- m_DepthEnable = value;\r
- }\r
- \r
- Direct3D11::DepthWriteMask DepthStencilStateDescription::DepthWriteMask::get()\r
- {\r
- return m_DepthWriteMask;\r
- }\r
- \r
- void DepthStencilStateDescription::DepthWriteMask::set( Direct3D11::DepthWriteMask value )\r
- {\r
- m_DepthWriteMask = value;\r
- }\r
- \r
- Comparison DepthStencilStateDescription::DepthComparison::get()\r
- {\r
- return m_DepthFunc;\r
- }\r
- \r
- void DepthStencilStateDescription::DepthComparison::set( Comparison value )\r
- {\r
- m_DepthFunc = value;\r
- }\r
- \r
- bool DepthStencilStateDescription::IsStencilEnabled::get()\r
- {\r
- return m_StencilEnable;\r
- }\r
- \r
- void DepthStencilStateDescription::IsStencilEnabled::set( bool value )\r
- {\r
- m_StencilEnable = value;\r
- }\r
- \r
- Byte DepthStencilStateDescription::StencilReadMask::get()\r
- {\r
- return m_StencilReadMask;\r
- }\r
- \r
- void DepthStencilStateDescription::StencilReadMask::set( Byte value )\r
- {\r
- m_StencilReadMask = value;\r
- }\r
- \r
- Byte DepthStencilStateDescription::StencilWriteMask::get()\r
- {\r
- return m_StencilWriteMask;\r
- }\r
- \r
- void DepthStencilStateDescription::StencilWriteMask::set( Byte value )\r
- {\r
- m_StencilWriteMask = value;\r
- }\r
- \r
- DepthStencilOperationDescription DepthStencilStateDescription::FrontFace::get()\r
- {\r
- return m_FrontFace;\r
- }\r
- \r
- void DepthStencilStateDescription::FrontFace::set( DepthStencilOperationDescription value )\r
- {\r
- m_FrontFace = value;\r
- }\r
- \r
- DepthStencilOperationDescription DepthStencilStateDescription::BackFace::get()\r
- {\r
- return m_BackFace;\r
- }\r
- \r
- void DepthStencilStateDescription::BackFace::set( DepthStencilOperationDescription value )\r
- {\r
- m_BackFace = value;\r
- }\r
-\r
- bool DepthStencilStateDescription::operator == ( DepthStencilStateDescription left, DepthStencilStateDescription right )\r
- {\r
- return DepthStencilStateDescription::Equals( left, right );\r
- }\r
-\r
- bool DepthStencilStateDescription::operator != ( DepthStencilStateDescription left, DepthStencilStateDescription right )\r
- {\r
- return !DepthStencilStateDescription::Equals( left, right );\r
- }\r
-\r
- int DepthStencilStateDescription::GetHashCode()\r
- {\r
- return m_DepthEnable.GetHashCode() + m_DepthWriteMask.GetHashCode() + m_DepthFunc.GetHashCode()\r
- + m_StencilEnable.GetHashCode() + m_StencilReadMask.GetHashCode() + m_StencilWriteMask.GetHashCode()\r
- + m_FrontFace.GetHashCode() + m_BackFace.GetHashCode();\r
- }\r
-\r
- bool DepthStencilStateDescription::Equals( Object^ value )\r
- {\r
- if( value == nullptr )\r
- return false;\r
-\r
- if( value->GetType() != GetType() )\r
- return false;\r
-\r
- return Equals( safe_cast<DepthStencilStateDescription>( value ) );\r
- }\r
-\r
- bool DepthStencilStateDescription::Equals( DepthStencilStateDescription value )\r
- {\r
- return ( m_DepthEnable == value.m_DepthEnable && m_DepthWriteMask == value.m_DepthWriteMask && m_DepthFunc == value.m_DepthFunc\r
- && m_StencilEnable == value.m_StencilEnable && m_StencilReadMask == value.m_StencilReadMask && m_StencilWriteMask == value.m_StencilWriteMask\r
- && m_FrontFace == value.m_FrontFace && m_BackFace == value.m_BackFace );\r
- }\r
-\r
- bool DepthStencilStateDescription::Equals( DepthStencilStateDescription% value1, DepthStencilStateDescription% value2 )\r
- {\r
- return ( value1.m_DepthEnable == value2.m_DepthEnable && value1.m_DepthWriteMask == value2.m_DepthWriteMask && value1.m_DepthFunc == value2.m_DepthFunc\r
- && value1.m_StencilEnable == value2.m_StencilEnable && value1.m_StencilReadMask == value2.m_StencilReadMask && value1.m_StencilWriteMask == value2.m_StencilWriteMask\r
- && value1.m_FrontFace == value2.m_FrontFace && value1.m_BackFace == value2.m_BackFace );\r
- }\r
-}\r
-}\r