OSDN Git Service

フォーラム[#56172] SlimDX(改)のフォルダ内容が不完全だったので再UP。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d9 / Mesh.h
1 /*\r
2 * Copyright (c) 2007-2010 SlimDX Group\r
3\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
10\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
13\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
20 * THE SOFTWARE.\r
21 */\r
22 #pragma once\r
23 \r
24 #include "../math/Matrix.h"\r
25 #include "../math/Ray.h"\r
26 \r
27 #include "XFile.h"\r
28 #include "BaseMesh.h"\r
29 \r
30 #include "EffectDefault.h"\r
31 #include "EffectInstance.h"\r
32 #include "ExtendedMaterial.h"\r
33 #include "GlyphMetricsFloat.h"\r
34 #include "AttributeWeights.h"\r
35 #include "WeldEpsilons.h"\r
36 \r
37 namespace SlimDX\r
38 {\r
39         namespace Direct3D9\r
40         {\r
41                 ref class SkinInfo;\r
42 \r
43                 /// <summary>\r
44                 /// Provides an interface to manipulate mesh objects.\r
45                 /// </summary>\r
46                 /// <unmanaged>ID3DXMesh</unmanaged>\r
47                 public ref class Mesh : public BaseMesh\r
48                 {\r
49                         COMOBJECT(ID3DXMesh, Mesh);\r
50 \r
51                 private:\r
52                         array<int>^ adjacency;\r
53                         array<ExtendedMaterial>^ materials;\r
54                         array<EffectInstance>^ effects;\r
55                         SkinInfo^ skinInfo;\r
56 \r
57                         static Mesh^ FromMemory_Internal( SlimDX::Direct3D9::Device^ device, const void* memory, DWORD size, MeshFlags flags );\r
58 \r
59                 internal:\r
60                         void SetAdjacency( DWORD *adjacency );\r
61 \r
62                 public:\r
63                         Mesh( SlimDX::Direct3D9::Device^ device, int faceCount, int vertexCount, MeshFlags options, array<VertexElement>^ vertexDeclaration );\r
64                         Mesh( SlimDX::Direct3D9::Device^ device, int faceCount, int vertexCount, MeshFlags options, SlimDX::Direct3D9::VertexFormat fvf );\r
65                         virtual ~Mesh() { }\r
66 \r
67                         static Mesh^ FromMemory( SlimDX::Direct3D9::Device^ device, array<System::Byte>^ memory, MeshFlags flags );\r
68                         static Mesh^ FromStream( SlimDX::Direct3D9::Device^ device, System::IO::Stream^ stream, MeshFlags flags );\r
69                         static Mesh^ FromFile( SlimDX::Direct3D9::Device^ device, System::String^ fileName, MeshFlags flags );\r
70                         static Mesh^ FromXFile( SlimDX::Direct3D9::Device^ device, XFileData^ xfile, MeshFlags flags );\r
71 \r
72                         static Result ToXFile( Mesh^ mesh, System::String^ fileName, XFileFormat format, System::Runtime::InteropServices::CharSet charSet );\r
73                         static Result ToXFile( Mesh^ mesh, System::String^ fileName, XFileFormat format );\r
74 \r
75                         static Mesh^ CreateBox( SlimDX::Direct3D9::Device^ device, float width, float height, float depth );\r
76                         static Mesh^ CreateCylinder( SlimDX::Direct3D9::Device^ device, float radius1, float radius2, float length, int slices, int stacks );\r
77                         static Mesh^ CreateSphere( SlimDX::Direct3D9::Device^ device, float radius, int slices, int stacks );\r
78                         static Mesh^ CreateTeapot( SlimDX::Direct3D9::Device^ device );\r
79                         static Mesh^ CreateTorus( SlimDX::Direct3D9::Device^ device, float innerRadius, float outerRadius, int sides, int rings );\r
80 \r
81                         static Mesh^ CreateText( SlimDX::Direct3D9::Device^ device, System::Drawing::Font^ font, System::String^ text, float deviation, float extrusion, [Out] array<GlyphMetricsFloat>^% glyphMetrics );\r
82                         static Mesh^ CreateText( SlimDX::Direct3D9::Device^ device, System::Drawing::Font^ font, System::String^ text, float deviation, float extrusion );\r
83 \r
84                         static Mesh^ Concatenate( SlimDX::Direct3D9::Device^ device, array<Mesh^>^ meshes, MeshFlags options, array<Matrix>^ geometryTransforms, array<Matrix>^ textureTransforms, array<VertexElement>^ vertexDeclaration );\r
85                         static Mesh^ Concatenate( SlimDX::Direct3D9::Device^ device, array<Mesh^>^ meshes, MeshFlags options, array<Matrix>^ geometryTransforms, array<Matrix>^ textureTransforms );\r
86                         static Mesh^ Concatenate( SlimDX::Direct3D9::Device^ device, array<Mesh^>^ meshes, MeshFlags options );\r
87 \r
88                         static Mesh^ Simplify( Mesh^ mesh, array<AttributeWeights>^ attributeWeights, array<float>^ vertexWeights, int minimumValue, MeshSimplification options );\r
89                         static Mesh^ Simplify( Mesh^ mesh, array<AttributeWeights>^ attributeWeights, int minimumValue, MeshSimplification options );\r
90                         static Mesh^ Simplify( Mesh^ mesh, int minimumValue, MeshSimplification options );\r
91 \r
92                         static Mesh^ TessellateNPatches( Mesh^ mesh, float segmentCount, bool quadraticInterpolation );\r
93 \r
94                         void GenerateAdjacency( float epsilon ) new;\r
95 \r
96                         System::String^ Validate();\r
97 \r
98                         DataStream^ LockAttributeBuffer( LockFlags flags );\r
99                         Result UnlockAttributeBuffer();\r
100                         Result SetAttributeTable( array<AttributeRange>^ table );\r
101 \r
102                         Result OptimizeInPlace( MeshOptimizeFlags flags, [Out] array<int>^% faceRemap, [Out] array<int>^% vertexRemap );\r
103                         Result OptimizeInPlace( MeshOptimizeFlags flags );\r
104 \r
105                         Mesh^ Optimize( MeshOptimizeFlags flags, [Out] array<int>^% faceRemap, [Out] array<int>^% vertexRemap );\r
106                         Mesh^ Optimize( MeshOptimizeFlags flags );\r
107 \r
108                         Mesh^ Clean( CleanType type, [Out] System::String^% errorsAndWarnings );\r
109                         Mesh^ Clean( CleanType type );\r
110                         \r
111                         Result ComputeNormals();\r
112                         Result ComputeTangent( int textureStage, int tangentIndex, int binormalIndex, bool wrap );\r
113                         Result ComputeTangentFrame( TangentOptions options );\r
114 \r
115                         Mesh^ ComputeTangentFrame( int textureInSemantic, int textureInIndex, int partialOutSemanticU, \r
116                                 int partialOutIndexU, int partialOutSemanticV, int partialOutIndexV, int normalOutSemantic,\r
117                                 int normalOutIndex, TangentOptions options, float partialEdgeThreshold,\r
118                                 float singularPointThreshold, float normalEdgeThreshold, [Out] array<int>^% vertexMapping );\r
119 \r
120                         Mesh^ ComputeTangentFrame( int textureInSemantic, int textureInIndex, int partialOutSemanticU, \r
121                                 int partialOutIndexU, int partialOutSemanticV, int partialOutIndexV, int normalOutSemantic,\r
122                                 int normalOutIndex, TangentOptions options, float partialEdgeThreshold,\r
123                                 float singularPointThreshold, float normalEdgeThreshold );\r
124 \r
125                         Result TessellateRectanglePatch( SlimDX::Direct3D9::VertexBuffer^ vertexBuffer, array<float>^ segmentCounts, \r
126                                 array<VertexElement>^ vertexDeclaration, RectanglePatchInfo rectanglePatchInfo );\r
127 \r
128                         Result TessellateTrianglePatch( SlimDX::Direct3D9::VertexBuffer^ vertexBuffer, array<float>^ segmentCounts,\r
129                                 array<VertexElement>^ vertexDeclaration, TrianglePatchInfo trianglePatchInfo );\r
130 \r
131                         array<ExtendedMaterial>^ GetMaterials() { return materials; }\r
132                         void SetMaterials( array<ExtendedMaterial>^ value ) { materials = value; }\r
133 \r
134                         array<EffectInstance>^ GetEffects() { return effects; }\r
135                         void SetEffects( array<EffectInstance>^ value ) { effects = value; }\r
136 \r
137                         void SetAdjacency( array<int>^ adjacency ) { this->adjacency = adjacency; }\r
138                         array<int>^ GetAdjacency() { return adjacency; }\r
139 \r
140                         Result WeldVertices( WeldFlags flags, WeldEpsilons epsilons, [Out] array<int>^% faceRemap, [Out] array<int>^% vertexRemap );\r
141                         Result WeldVertices( WeldFlags flags, [Out] array<int>^% faceRemap, [Out] array<int>^% vertexRemap );\r
142                         Result WeldVertices( WeldFlags flags, WeldEpsilons epsilons );\r
143                         Result WeldVertices( WeldFlags flags );\r
144 \r
145                         property SkinInfo^ SkinInfo\r
146                         { \r
147                                 SlimDX::Direct3D9::SkinInfo^ get() { return skinInfo; }\r
148                                 void set( SlimDX::Direct3D9::SkinInfo^ value ) { skinInfo = value; }\r
149                         }\r
150                 };\r
151         }\r
152 }\r