OSDN Git Service

#32713 初コミット。SVNrev567時点での、ファイルはbranch/140707(ReBuild XGVersion)から移行したもの。
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d10 / Viewport10.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 "Viewport10.h"
25
26 using namespace System;
27 using namespace System::Globalization;
28
29 namespace SlimDX
30 {
31 namespace Direct3D10
32 {
33         Viewport::Viewport( int x, int y, int width, int height )
34         : m_X( x ), m_Y( y ), m_Width( width ), m_Height( height ),
35           m_MinZ( 0.0f ), m_MaxZ( 1.0f )
36         {
37         }
38         
39         Viewport::Viewport( int x, int y, int width, int height, float minZ, float maxZ )
40         : m_X( x ), m_Y( y ), m_Width( width ), m_Height( height ),
41           m_MinZ( minZ ), m_MaxZ( maxZ )
42         {
43         }
44
45         int Viewport::X::get()
46         {
47                 return m_X;
48         }
49         
50         void Viewport::X::set( int value )
51         {
52                 m_X = value;
53         }
54         
55         int Viewport::Y::get()
56         {
57                 return m_Y;
58         }
59         
60         void Viewport::Y::set( int value )
61         {
62                 m_Y = value;
63         }
64         
65         int Viewport::Width::get()
66         {
67                 return m_Width;
68         }
69         
70         void Viewport::Width::set( int value )
71         {
72                 m_Width = value;
73         }
74         
75         int Viewport::Height::get()
76         {
77                 return m_Height;
78         }
79         
80         void Viewport::Height::set( int value )
81         {
82                 m_Height = value;
83         }
84         
85         float Viewport::MinZ::get()
86         {
87                 return m_MinZ;
88         }
89         
90         void Viewport::MinZ::set( float value )
91         {
92                 m_MinZ = value;
93         }
94         
95         float Viewport::MaxZ::get()
96         {
97                 return m_MaxZ;
98         }
99         
100         void Viewport::MaxZ::set( float value )
101         {
102                 m_MaxZ = value;
103         }
104
105         bool Viewport::operator == ( Viewport left, Viewport right )
106         {
107                 return Viewport::Equals( left, right );
108         }
109
110         bool Viewport::operator != ( Viewport left, Viewport right )
111         {
112                 return !Viewport::Equals( left, right );
113         }
114
115         String^ Viewport::ToString()
116         {
117                 return String::Format( CultureInfo::CurrentCulture, "X:{0} Y:{1} Width:{2} Height:{3} MinZ:{4} MaxZ:{5}",
118                         X, Y, Width, Height, MinZ, MaxZ );
119         }
120
121         int Viewport::GetHashCode()
122         {
123                 return m_X.GetHashCode() + m_Y.GetHashCode() + m_Width.GetHashCode()
124                          + m_Height.GetHashCode() + m_MinZ.GetHashCode() + m_MaxZ.GetHashCode();
125         }
126
127         bool Viewport::Equals( Object^ value )
128         {
129                 if( value == nullptr )
130                         return false;
131
132                 if( value->GetType() != GetType() )
133                         return false;
134
135                 return Equals( safe_cast<Viewport>( value ) );
136         }
137
138         bool Viewport::Equals( Viewport value )
139         {
140                 return ( m_X == value.m_X && m_Y == value.m_Y && m_Width == value.m_Width
141                          && m_Height == value.m_Height && m_MinZ == value.m_MinZ && m_MaxZ == value.m_MaxZ );
142         }
143
144         bool Viewport::Equals( Viewport% value1, Viewport% value2 )
145         {
146                 return ( value1.m_X == value2.m_X && value1.m_Y == value2.m_Y && value1.m_Width == value2.m_Width
147                          && value1.m_Height == value2.m_Height && value1.m_MinZ == value2.m_MinZ && value1.m_MaxZ == value2.m_MaxZ );
148         }
149 }
150 }