2 * Copyright (c) 2007-2010 SlimDX Group
\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
5 * of this software and associated documentation files (the "Software"), to deal
\r
6 * in the Software without restriction, including without limitation the rights
\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
8 * copies of the Software, and to permit persons to whom the Software is
\r
9 * furnished to do so, subject to the following conditions:
\r
11 * The above copyright notice and this permission notice shall be included in
\r
12 * all copies or substantial portions of the Software.
\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 #include "../math/Vector3.h"
\r
26 using System::Runtime::InteropServices::OutAttribute;
\r
32 value class VertexElement;
\r
33 enum class VertexFormat;
\r
37 /// Contains miscellaneous constants and methods for use with D3DX.
\r
39 /// <unmanaged>None</unmanaged>
\r
40 public ref class D3DX sealed
\r
47 /// The value used to signify that the default value for a parameter should be used.
\r
49 /// <unmanaged>D3DX_DEFAULT</unmanaged>
\r
50 literal int Default = D3DX_DEFAULT;
\r
53 /// The default value for non power-of-two textures.
\r
55 /// <unmanaged>D3DX_DEFAULT_NONPOW2</unmanaged>
\r
56 literal int DefaultNonPowerOf2 = D3DX_DEFAULT_NONPOW2;
\r
59 /// Indicates that the method should load from file.
\r
61 /// <unmanaged>D3DX_FROM_FILE</unmanaged>
\r
62 literal int FromFile = D3DX_FROM_FILE;
\r
65 /// Indicates that the method should format from file.
\r
67 /// <unmanaged>D3DFMT_FROM_FILE</unmanaged>
\r
68 literal int FormatFromFile = D3DFMT_FROM_FILE;
\r
73 /// <unmanaged>D3DXGetDeclVertexSize</unmanaged>
\r
74 static int GetDeclarationVertexSize( array<VertexElement>^ elements, int stream );
\r
76 /// <unmanaged>D3DXGetFVFVertexSize</unmanaged>
\r
77 static int GetFVFVertexSize( VertexFormat fvf );
\r
80 /// Retrieves a declarator from a Flexible Vertex Format (FVF) code.
\r
82 /// <unmanaged>D3DXDeclaratorFromFVF</unmanaged>
\r
83 static array<VertexElement>^ DeclaratorFromFVF( VertexFormat fvf );
\r
86 /// Retrieves a Flexible Vertex Format (FVF) code from a declarator.
\r
88 /// <unmanaged>D3DXFVFFromDeclarator</unmanaged>
\r
89 static VertexFormat FVFFromDeclarator( array<VertexElement>^ declarator );
\r
92 /// Generates an output vertex declaration from the input declaration.
\r
93 /// The output declaration is intended for use by the mesh tessellation functions.
\r
95 /// <unmanaged>D3DXGenerateOutputDecl</unmanaged>
\r
96 static array<VertexElement>^ GenerateOutputDeclaration( array<VertexElement>^ declaration );
\r
98 /// <summary>Returns the number of elements in the vertex declaration.</summary>
\r
99 /// <unmanaged>D3DXGetDeclLength</unmanaged>
\r
100 static int GetDeclarationLength( array<VertexElement>^ declaration );
\r
102 /// <summary>Gets the size of the rectangle patch.</summary>
\r
103 /// <unmanaged>D3DXRectPatchSize</unmanaged>
\r
104 static Result GetRectanglePatchSize( float segmentCount, [Out] int% triangleCount, [Out] int% vertexCount );
\r
106 /// <summary>Gets the size of the triangle patch.</summary>
\r
107 /// <unmanaged>D3DXTriPatchSize</unmanaged>
\r
108 static Result GetTrianglePatchSize( float segmentCount, [Out] int% triangleCount, [Out] int% vertexCount );
\r
110 /// <summary>Generates a FOURCC Format code from the provided bytes.</summary>
\r
111 /// <unmanaged>MAKEFOURCC</unmanaged>
\r
112 static Format MakeFourCC( System::Byte c1, System::Byte c2, System::Byte c3, System::Byte c4 );
\r
114 /// <summary>Turns on or off all D3DX debug output.</summary>
\r
115 /// <unmanaged>D3DXDebugMute</unmanaged>
\r
116 static bool DebugMute( bool mute );
\r
118 /// <summary>Generates an optimized face remapping for a triangle list.</summary>
\r
119 /// <unmanaged>D3DXOptimizeFaces</unmanaged>
\r
120 static array<int>^ OptimizeFaces( array<int>^ indices, int faceCount, int vertexCount );
\r
122 /// <summary>Generates an optimized face remapping for a triangle list.</summary>
\r
123 /// <unmanaged>D3DXOptimizeFaces</unmanaged>
\r
124 static array<int>^ OptimizeFaces( array<System::Int16>^ indices, int faceCount, int vertexCount );
\r
126 /// <summary>Generates an optimized vertex remapping for a triangle list. </summary>
\r
127 /// <unmanaged>D3DXOptimizeFaces</unmanaged>
\r
128 static array<int>^ OptimizeVertices( array<int>^ indices, int faceCount, int vertexCount );
\r
130 /// <summary>Generates an optimized vertex remapping for a triangle list. </summary>
\r
131 /// <unmanaged>D3DXOptimizeFaces</unmanaged>
\r
132 static array<int>^ OptimizeVertices( array<System::Int16>^ indices, int faceCount, int vertexCount );
\r
135 /// Verifies that the compiled version of D3DX matches the runtime version of D3DX.
\r
137 /// <returns><c>true</c> if the versions match; otherwise, <c>false</c>.</returns>
\r
138 /// <unmanaged>D3DXCheckVersion</unmanaged>
\r
139 static bool CheckVersion();
\r
141 /// <unmanaged>D3DXFresnelTerm</unmanaged>
\r
142 static float FresnelTerm( float cosTheta, float refractionIndex );
\r
144 static array<Vector3>^ GetVectors( DataStream^ stream, int vertexCount, VertexFormat format );
\r
146 static array<Vector3>^ GetVectors( DataStream^ stream, int vertexCount, int stride );
\r