OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d10 / RasterizerWrapper.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/direct3d10/RasterizerWrapper.cpp b/SlimDXc_Jun2010(VC++2008)/source/direct3d10/RasterizerWrapper.cpp
deleted file mode 100644 (file)
index d17a33c..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-#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 <d3d10.h>\r
-#include <d3dx10.h>\r
-\r
-#include "../InternalHelpers.h"\r
-#include "../stack_array.h"\r
-\r
-#include "RasterizerWrapper.h"\r
-#include "RasterizerState.h"\r
-\r
-using namespace System;\r
-using namespace msclr::interop;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Direct3D10\r
-{ \r
-       RasterizerWrapper::RasterizerWrapper( ID3D10Device* device )\r
-       {\r
-               if( device == 0 )\r
-                       throw gcnew ArgumentNullException( "device" );\r
-               m_Device = device;\r
-       }\r
-       \r
-       void RasterizerWrapper::State::set( RasterizerState^ value )\r
-       {\r
-               if( value == nullptr )\r
-                       m_Device->RSSetState( 0 );\r
-               else\r
-                       m_Device->RSSetState( value->InternalPointer );\r
-       }\r
-       \r
-       RasterizerState^ RasterizerWrapper::State::get()\r
-       {\r
-               ID3D10RasterizerState* state = 0;\r
-               m_Device->RSGetState( &state );\r
-               return RasterizerState::FromPointer( state );\r
-       }\r
-       \r
-       void RasterizerWrapper::SetViewports( Viewport viewport )\r
-       {\r
-               D3D10_VIEWPORT nativeVP = { viewport.X, viewport.Y, viewport.Width, viewport.Height, viewport.MinZ, viewport.MaxZ };\r
-               m_Device->RSSetViewports( 1, &nativeVP );\r
-       }\r
-\r
-       void RasterizerWrapper::SetViewports( ... array<Viewport>^ viewports )\r
-       {\r
-               if( viewports == nullptr ) \r
-               {\r
-                       m_Device->RSSetViewports( 0, 0 );\r
-               }\r
-               else\r
-               {\r
-                       D3D10_VIEWPORT nativeVPs[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];\r
-                       for( int i = 0; i < viewports->Length; ++i )\r
-                       {\r
-                               nativeVPs[ i ].TopLeftX = viewports[ i ].X;\r
-                               nativeVPs[ i ].TopLeftY = viewports[ i ].Y;\r
-                               nativeVPs[ i ].Width = viewports[ i ].Width;\r
-                               nativeVPs[ i ].Height = viewports[ i ].Height;\r
-                               nativeVPs[ i ].MinDepth = viewports[ i ].MinZ;\r
-                               nativeVPs[ i ].MaxDepth = viewports[ i ].MaxZ;\r
-                       }\r
-                       \r
-                       m_Device->RSSetViewports( viewports->Length, nativeVPs );\r
-               }\r
-       }\r
-\r
-       void RasterizerWrapper::GetViewports( array<Viewport>^ viewports )\r
-       {\r
-               UINT count = viewports->Length;\r
-               stack_array<D3D10_VIEWPORT> nativeVPs = stackalloc( D3D10_VIEWPORT, viewports->Length );\r
-               m_Device->RSGetViewports( &count, &nativeVPs[0] );\r
-\r
-               for( UINT i = 0; i < count; i++ )\r
-                       viewports[i] = Viewport( nativeVPs[i].TopLeftX, nativeVPs[i].TopLeftY, nativeVPs[i].Width, nativeVPs[i].Height, nativeVPs[i].MinDepth, nativeVPs[i].MaxDepth );\r
-       }\r
-       \r
-       array<Viewport>^ RasterizerWrapper::GetViewports()\r
-       {\r
-               UINT count = 0;\r
-               m_Device->RSGetViewports( &count, 0 );\r
-               \r
-               stack_array<D3D10_VIEWPORT> nativeVPs = stackalloc( D3D10_VIEWPORT, count );\r
-               m_Device->RSGetViewports( &count, &nativeVPs[0] );\r
-               \r
-               array<Viewport>^ viewports = gcnew array<Viewport>( count );\r
-               for( UINT i = 0; i < count; i++ )\r
-                       viewports[i] = Viewport( nativeVPs[i].TopLeftX, nativeVPs[i].TopLeftY, nativeVPs[i].Width, nativeVPs[i].Height, nativeVPs[i].MinDepth, nativeVPs[i].MaxDepth );\r
-               return viewports;\r
-       }\r
-\r
-       void RasterizerWrapper::SetScissorRectangles( System::Drawing::Rectangle scissorRectangle )\r
-       {\r
-               D3D10_RECT rect = { scissorRectangle.Left, scissorRectangle.Top, scissorRectangle.Right, scissorRectangle.Bottom };\r
-               m_Device->RSSetScissorRects( 1, &rect );\r
-       }\r
-\r
-       void RasterizerWrapper::SetScissorRectangles( ... array<System::Drawing::Rectangle>^ scissorRectangles )\r
-       {\r
-               if( scissorRectangles == nullptr ) \r
-               {\r
-                       m_Device->RSSetScissorRects( 0, 0 );\r
-               }\r
-               else\r
-               {\r
-                       D3D10_RECT rects[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];\r
-                       for( int i = 0; i < scissorRectangles->Length; ++i )\r
-                       {\r
-                               rects[i].left = scissorRectangles[i].Left;\r
-                               rects[i].right = scissorRectangles[i].Right;\r
-                               rects[i].top = scissorRectangles[i].Top;\r
-                               rects[i].bottom = scissorRectangles[i].Bottom;\r
-                       }\r
-\r
-                       m_Device->RSSetScissorRects( scissorRectangles->Length, rects );\r
-               }\r
-       }\r
-\r
-       void RasterizerWrapper::GetScissorRectangles( array<System::Drawing::Rectangle>^ scissorRectangles )\r
-       {\r
-               UINT count = scissorRectangles->Length;\r
-               stack_array<D3D10_RECT> rects = stackalloc( D3D10_RECT, scissorRectangles->Length );\r
-               m_Device->RSGetScissorRects( &count, &rects[0] );\r
-\r
-               for( UINT i = 0; i < count; i++ )\r
-                       scissorRectangles[i] = marshal_as<System::Drawing::Rectangle>( rects[i] );\r
-       }\r
-       \r
-       array<System::Drawing::Rectangle>^ RasterizerWrapper::GetScissorRectangles()\r
-       {\r
-               UINT count = 0;\r
-               m_Device->RSGetScissorRects( &count, 0 );\r
-               \r
-               stack_array<D3D10_RECT> rects = stackalloc( D3D10_RECT, count );\r
-               m_Device->RSGetScissorRects( &count, &rects[0] );\r
-               \r
-               array<System::Drawing::Rectangle>^ scissorRectangles = gcnew array<System::Drawing::Rectangle>( count );\r
-               for( UINT i = 0; i < count; i++ )\r
-                       scissorRectangles[i] = System::Drawing::Rectangle( rects[i].left, rects[i].top, rects[i].right - rects[i].left, rects[i].bottom - rects[i].top );\r
-               return scissorRectangles;\r
-       }\r
-}\r
-}\r