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
24 #include "Viewport11.h"
\r
26 using namespace System;
\r
27 using namespace System::Globalization;
\r
31 namespace Direct3D11
\r
33 Viewport::Viewport( float x, float y, float width, float height )
\r
34 : m_X( x ), m_Y( y ), m_Width( width ), m_Height( height ),
\r
35 m_MinZ( 0.0f ), m_MaxZ( 1.0f )
\r
39 Viewport::Viewport( float x, float y, float width, float height, float minZ, float maxZ )
\r
40 : m_X( x ), m_Y( y ), m_Width( width ), m_Height( height ),
\r
41 m_MinZ( minZ ), m_MaxZ( maxZ )
\r
45 float Viewport::X::get()
\r
50 void Viewport::X::set( float value )
\r
55 float Viewport::Y::get()
\r
60 void Viewport::Y::set( float value )
\r
65 float Viewport::Width::get()
\r
70 void Viewport::Width::set( float value )
\r
75 float Viewport::Height::get()
\r
80 void Viewport::Height::set( float value )
\r
85 float Viewport::MinZ::get()
\r
90 void Viewport::MinZ::set( float value )
\r
95 float Viewport::MaxZ::get()
\r
100 void Viewport::MaxZ::set( float value )
\r
105 bool Viewport::operator == ( Viewport left, Viewport right )
\r
107 return Viewport::Equals( left, right );
\r
110 bool Viewport::operator != ( Viewport left, Viewport right )
\r
112 return !Viewport::Equals( left, right );
\r
115 String^ Viewport::ToString()
\r
117 return String::Format( CultureInfo::CurrentCulture, "X:{0} Y:{1} Width:{2} Height:{3} MinZ:{4} MaxZ:{5}",
\r
118 X, Y, Width, Height, MinZ, MaxZ );
\r
121 int Viewport::GetHashCode()
\r
123 return m_X.GetHashCode() + m_Y.GetHashCode() + m_Width.GetHashCode()
\r
124 + m_Height.GetHashCode() + m_MinZ.GetHashCode() + m_MaxZ.GetHashCode();
\r
127 bool Viewport::Equals( Object^ value )
\r
129 if( value == nullptr )
\r
132 if( value->GetType() != GetType() )
\r
135 return Equals( safe_cast<Viewport>( value ) );
\r
138 bool Viewport::Equals( Viewport value )
\r
140 return ( m_X == value.m_X && m_Y == value.m_Y && m_Width == value.m_Width
\r
141 && m_Height == value.m_Height && m_MinZ == value.m_MinZ && m_MaxZ == value.m_MaxZ );
\r
144 bool Viewport::Equals( Viewport% value1, Viewport% value2 )
\r
146 return ( value1.m_X == value2.m_X && value1.m_Y == value2.m_Y && value1.m_Width == value2.m_Width
\r
147 && value1.m_Height == value2.m_Height && value1.m_MinZ == value2.m_MinZ && value1.m_MaxZ == value2.m_MaxZ );
\r