OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d9 / ExtendedMaterial.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/direct3d9/ExtendedMaterial.cpp b/SlimDXc_Jun2010(VC++2008)/source/direct3d9/ExtendedMaterial.cpp
deleted file mode 100644 (file)
index 45004d6..0000000
+++ /dev/null
@@ -1,144 +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
-#include <d3d9.h>\r
-#include <d3dx9.h>\r
-\r
-#include "../Utilities.h"\r
-\r
-#include "ExtendedMaterial.h"\r
-\r
-using namespace System;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Direct3D9\r
-{\r
-       // Utility function to convert from D3D color to SlimDX color. Can't put it in Color4 because\r
-       // that thing is shared between D3D 9 and D3D 10.\r
-       Color4 ConvertColor( const D3DCOLORVALUE& color )\r
-       {\r
-               Color4 cv;\r
-               cv.Red = color.r;\r
-               cv.Green = color.g;\r
-               cv.Blue = color.b;\r
-               cv.Alpha = color.a;\r
-\r
-               return cv;\r
-       }\r
-\r
-       D3DCOLORVALUE ConvertColor( Color4 color )\r
-       {\r
-               D3DCOLORVALUE cv;\r
-               cv.r = color.Red;\r
-               cv.g = color.Green;\r
-               cv.b = color.Blue;\r
-               cv.a = color.Alpha;\r
-\r
-               return cv;\r
-       }\r
-\r
-       D3DXMATERIAL ExtendedMaterial::ToUnmanaged( ExtendedMaterial material )\r
-       {\r
-               D3DXMATERIAL result;\r
-               result.pTextureFilename = Utilities::AllocateNativeString( material.TextureFileName );\r
-               result.MatD3D.Ambient = ConvertColor( material.MaterialD3D.Ambient );\r
-               result.MatD3D.Diffuse = ConvertColor( material.MaterialD3D.Diffuse );\r
-               result.MatD3D.Specular = ConvertColor( material.MaterialD3D.Specular );\r
-               result.MatD3D.Emissive = ConvertColor( material.MaterialD3D.Emissive );\r
-               result.MatD3D.Power = material.MaterialD3D.Power;\r
-\r
-               return result;\r
-       }\r
-\r
-       ExtendedMaterial ExtendedMaterial::FromUnmanaged( const D3DXMATERIAL &material )\r
-       {\r
-               ExtendedMaterial result;\r
-               Material mat;\r
-               mat.Diffuse = ConvertColor( material.MatD3D.Diffuse );\r
-               mat.Ambient = ConvertColor( material.MatD3D.Ambient );\r
-               mat.Specular = ConvertColor( material.MatD3D.Specular );\r
-               mat.Emissive = ConvertColor( material.MatD3D.Emissive );\r
-               mat.Power = material.MatD3D.Power;\r
-               result.MaterialD3D = mat;\r
-               result.TextureFileName = gcnew String( material.pTextureFilename );\r
-\r
-               return result;\r
-       }\r
-\r
-       array<ExtendedMaterial>^ ExtendedMaterial::FromBuffer( ID3DXBuffer* buffer, unsigned int count )\r
-       {\r
-               const D3DXMATERIAL* source  = reinterpret_cast<const D3DXMATERIAL*>( buffer->GetBufferPointer() );\r
-\r
-               array<ExtendedMaterial>^ destination = gcnew array<ExtendedMaterial>( count );\r
-               for( unsigned int i = 0; i < count; ++i )\r
-               {\r
-                       Material m;\r
-                       m.Diffuse = ConvertColor( source[i].MatD3D.Diffuse );\r
-                       m.Ambient = ConvertColor( source[i].MatD3D.Ambient );\r
-                       m.Specular = ConvertColor( source[i].MatD3D.Specular );\r
-                       m.Emissive = ConvertColor( source[i].MatD3D.Emissive );\r
-                       m.Power = source[i].MatD3D.Power;\r
-                       destination[i].MaterialD3D = m;\r
-                       destination[i].TextureFileName = gcnew String( source[i].pTextureFilename );\r
-               }\r
-\r
-               return destination;\r
-       }\r
-\r
-       bool ExtendedMaterial::operator == ( ExtendedMaterial left, ExtendedMaterial right )\r
-       {\r
-               return ExtendedMaterial::Equals( left, right );\r
-       }\r
-\r
-       bool ExtendedMaterial::operator != ( ExtendedMaterial left, ExtendedMaterial right )\r
-       {\r
-               return !ExtendedMaterial::Equals( left, right );\r
-       }\r
-\r
-       int ExtendedMaterial::GetHashCode()\r
-       {\r
-               return MaterialD3D.GetHashCode() + TextureFileName->GetHashCode();\r
-       }\r
-\r
-       bool ExtendedMaterial::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<ExtendedMaterial>( value ) );\r
-       }\r
-\r
-       bool ExtendedMaterial::Equals( ExtendedMaterial value )\r
-       {\r
-               return ( MaterialD3D == value.MaterialD3D && TextureFileName == value.TextureFileName );\r
-       }\r
-\r
-       bool ExtendedMaterial::Equals( ExtendedMaterial% value1, ExtendedMaterial% value2 )\r
-       {\r
-               return ( value1.MaterialD3D == value2.MaterialD3D && value1.TextureFileName == value2.TextureFileName );\r
-       }\r
-}\r
-}
\ No newline at end of file