1 |
bearsoft |
1.1 |
//////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Copyright (C) 1998 Microsoft Corporation. All Rights Reserved.
|
4 |
|
|
//
|
5 |
|
|
// File: d3dx8mesh.h
|
6 |
|
|
// Content: D3DX mesh types and functions
|
7 |
|
|
//
|
8 |
|
|
//////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
|
|
#include "d3dx8.h"
|
11 |
|
|
|
12 |
|
|
#ifndef __D3DX8MESH_H__
|
13 |
|
|
#define __D3DX8MESH_H__
|
14 |
|
|
|
15 |
|
|
#include "dxfile.h" // defines LPDIRECTXFILEDATA
|
16 |
|
|
|
17 |
|
|
// {A69BA991-1F7D-11d3-B929-00C04F68DC23}
|
18 |
|
|
DEFINE_GUID(IID_ID3DXBaseMesh,
|
19 |
|
|
0xa69ba991, 0x1f7d, 0x11d3, 0xb9, 0x29, 0x0, 0xc0, 0x4f, 0x68, 0xdc, 0x23);
|
20 |
|
|
|
21 |
|
|
// {9D84AC46-6B90-49a9-A721-085C7A3E3DAE}
|
22 |
|
|
DEFINE_GUID(IID_ID3DXMesh,
|
23 |
|
|
0x9d84ac46, 0x6b90, 0x49a9, 0xa7, 0x21, 0x8, 0x5c, 0x7a, 0x3e, 0x3d, 0xae);
|
24 |
|
|
|
25 |
|
|
// {15981AA8-1A05-48e3-BBE7-FF5D49654E3F}
|
26 |
|
|
DEFINE_GUID(IID_ID3DXPMesh,
|
27 |
|
|
0x15981aa8, 0x1a05, 0x48e3, 0xbb, 0xe7, 0xff, 0x5d, 0x49, 0x65, 0x4e, 0x3f);
|
28 |
|
|
|
29 |
|
|
// {BC3BBDE2-1F7D-11d3-B929-00C04F68DC23}
|
30 |
|
|
DEFINE_GUID(IID_ID3DXSPMesh,
|
31 |
|
|
0xbc3bbde2, 0x1f7d, 0x11d3, 0xb9, 0x29, 0x0, 0xc0, 0x4f, 0x68, 0xdc, 0x23);
|
32 |
|
|
|
33 |
|
|
// {82A53844-F322-409e-A2E9-992E1104069D}
|
34 |
|
|
DEFINE_GUID(IID_ID3DXSkinMesh,
|
35 |
|
|
0x82a53844, 0xf322, 0x409e, 0xa2, 0xe9, 0x99, 0x2e, 0x11, 0x4, 0x6, 0x9d);
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
enum _D3DXMESH {
|
39 |
|
|
D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. 32BIT meshes currently not supported on ID3DXSkinMesh object
|
40 |
|
|
D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB.
|
41 |
|
|
D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB.
|
42 |
|
|
D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB.
|
43 |
|
|
D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB.
|
44 |
|
|
D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER
|
45 |
|
|
D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB.
|
46 |
|
|
D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB.
|
47 |
|
|
D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB.
|
48 |
|
|
D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER
|
49 |
|
|
D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB.
|
50 |
|
|
D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB.
|
51 |
|
|
D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB.
|
52 |
|
|
|
53 |
|
|
D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer
|
54 |
|
|
|
55 |
|
|
D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinMesh::ConvertToBlendedMesh
|
56 |
|
|
|
57 |
|
|
// Helper options
|
58 |
|
|
D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM
|
59 |
|
|
D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED
|
60 |
|
|
D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY
|
61 |
|
|
D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC
|
62 |
|
|
|
63 |
|
|
};
|
64 |
|
|
|
65 |
|
|
// option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh
|
66 |
|
|
enum _D3DXMESHSIMP
|
67 |
|
|
{
|
68 |
|
|
D3DXMESHSIMP_VERTEX = 0x1,
|
69 |
|
|
D3DXMESHSIMP_FACE = 0x2,
|
70 |
|
|
|
71 |
|
|
};
|
72 |
|
|
|
73 |
|
|
enum _MAX_FVF_DECL_SIZE
|
74 |
|
|
{
|
75 |
|
|
MAX_FVF_DECL_SIZE = 20
|
76 |
|
|
};
|
77 |
|
|
|
78 |
|
|
typedef struct ID3DXBaseMesh *LPD3DXBASEMESH;
|
79 |
|
|
typedef struct ID3DXMesh *LPD3DXMESH;
|
80 |
|
|
typedef struct ID3DXPMesh *LPD3DXPMESH;
|
81 |
|
|
typedef struct ID3DXSPMesh *LPD3DXSPMESH;
|
82 |
|
|
typedef struct ID3DXSkinMesh *LPD3DXSKINMESH;
|
83 |
|
|
|
84 |
|
|
typedef struct _D3DXATTRIBUTERANGE
|
85 |
|
|
{
|
86 |
|
|
DWORD AttribId;
|
87 |
|
|
DWORD FaceStart;
|
88 |
|
|
DWORD FaceCount;
|
89 |
|
|
DWORD VertexStart;
|
90 |
|
|
DWORD VertexCount;
|
91 |
|
|
} D3DXATTRIBUTERANGE;
|
92 |
|
|
|
93 |
|
|
typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE;
|
94 |
|
|
|
95 |
|
|
#ifdef __cplusplus
|
96 |
|
|
extern "C" {
|
97 |
|
|
#endif //__cplusplus
|
98 |
|
|
struct D3DXMATERIAL
|
99 |
|
|
{
|
100 |
|
|
D3DMATERIAL8 MatD3D;
|
101 |
|
|
LPSTR pTextureFilename;
|
102 |
|
|
};
|
103 |
|
|
typedef struct D3DXMATERIAL *LPD3DXMATERIAL;
|
104 |
|
|
#ifdef __cplusplus
|
105 |
|
|
}
|
106 |
|
|
#endif //__cplusplus
|
107 |
|
|
|
108 |
|
|
typedef struct _D3DXATTRIBUTEWEIGHTS
|
109 |
|
|
{
|
110 |
|
|
FLOAT Position;
|
111 |
|
|
FLOAT Boundary;
|
112 |
|
|
FLOAT Normal;
|
113 |
|
|
FLOAT Diffuse;
|
114 |
|
|
FLOAT Specular;
|
115 |
|
|
FLOAT Tex[8];
|
116 |
|
|
} D3DXATTRIBUTEWEIGHTS;
|
117 |
|
|
|
118 |
|
|
typedef D3DXATTRIBUTEWEIGHTS* LPD3DXATTRIBUTEWEIGHTS;
|
119 |
|
|
|
120 |
|
|
DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown)
|
121 |
|
|
{
|
122 |
|
|
// IUnknown
|
123 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
124 |
|
|
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
125 |
|
|
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
126 |
|
|
|
127 |
|
|
// ID3DXBaseMesh
|
128 |
|
|
STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
|
129 |
|
|
STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
|
130 |
|
|
STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
|
131 |
|
|
STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
|
132 |
|
|
STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE;
|
133 |
|
|
STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
|
134 |
|
|
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
135 |
|
|
STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
|
136 |
|
|
DWORD FVF, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
|
137 |
|
|
STDMETHOD(CloneMesh)(THIS_ DWORD Options,
|
138 |
|
|
CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
|
139 |
|
|
STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE;
|
140 |
|
|
STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE;
|
141 |
|
|
STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE;
|
142 |
|
|
STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
|
143 |
|
|
STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE;
|
144 |
|
|
STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
|
145 |
|
|
STDMETHOD(GetAttributeTable)(
|
146 |
|
|
THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
|
147 |
|
|
};
|
148 |
|
|
|
149 |
|
|
DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh)
|
150 |
|
|
{
|
151 |
|
|
// IUnknown
|
152 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
153 |
|
|
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
154 |
|
|
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
155 |
|
|
|
156 |
|
|
// ID3DXBaseMesh
|
157 |
|
|
STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
|
158 |
|
|
STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
|
159 |
|
|
STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
|
160 |
|
|
STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
|
161 |
|
|
STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE;
|
162 |
|
|
STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
|
163 |
|
|
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
164 |
|
|
STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
|
165 |
|
|
DWORD FVF, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
|
166 |
|
|
STDMETHOD(CloneMesh)(THIS_ DWORD Options,
|
167 |
|
|
CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
|
168 |
|
|
STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE;
|
169 |
|
|
STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE;
|
170 |
|
|
STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE;
|
171 |
|
|
STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
|
172 |
|
|
STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE;
|
173 |
|
|
STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
|
174 |
|
|
STDMETHOD(GetAttributeTable)(
|
175 |
|
|
THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
|
176 |
|
|
|
177 |
|
|
// ID3DXMesh
|
178 |
|
|
STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE;
|
179 |
|
|
STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
|
180 |
|
|
STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
|
181 |
|
|
STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
|
182 |
|
|
STDMETHOD(GenerateAdjacency)(THIS_ FLOAT fEpsilon, DWORD* pAdjacency) PURE;
|
183 |
|
|
STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
|
184 |
|
|
DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
|
185 |
|
|
LPD3DXMESH* ppOptMesh) PURE;
|
186 |
|
|
STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
|
187 |
|
|
DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE;
|
188 |
|
|
};
|
189 |
|
|
|
190 |
|
|
DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh)
|
191 |
|
|
{
|
192 |
|
|
// IUnknown
|
193 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
194 |
|
|
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
195 |
|
|
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
196 |
|
|
|
197 |
|
|
// ID3DXBaseMesh
|
198 |
|
|
STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
|
199 |
|
|
STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
|
200 |
|
|
STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
|
201 |
|
|
STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
|
202 |
|
|
STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE;
|
203 |
|
|
STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
|
204 |
|
|
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
205 |
|
|
STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
|
206 |
|
|
DWORD FVF, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
|
207 |
|
|
STDMETHOD(CloneMesh)(THIS_ DWORD Options,
|
208 |
|
|
CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
|
209 |
|
|
STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE;
|
210 |
|
|
STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE;
|
211 |
|
|
STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE;
|
212 |
|
|
STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
|
213 |
|
|
STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE;
|
214 |
|
|
STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
|
215 |
|
|
STDMETHOD(GetAttributeTable)(
|
216 |
|
|
THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
|
217 |
|
|
|
218 |
|
|
// ID3DXPMesh
|
219 |
|
|
STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
|
220 |
|
|
DWORD FVF, LPDIRECT3DDEVICE8 pD3D, LPD3DXPMESH* ppCloneMesh) PURE;
|
221 |
|
|
STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
|
222 |
|
|
CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3D, LPD3DXPMESH* ppCloneMesh) PURE;
|
223 |
|
|
STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE;
|
224 |
|
|
STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE;
|
225 |
|
|
STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
|
226 |
|
|
STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE;
|
227 |
|
|
STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
|
228 |
|
|
STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE;
|
229 |
|
|
STDMETHOD(Save)(THIS_ IStream *pStream, LPD3DXMATERIAL pMaterials, DWORD NumMaterials) PURE;
|
230 |
|
|
|
231 |
|
|
STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut,
|
232 |
|
|
DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
|
233 |
|
|
LPD3DXMESH* ppOptMesh) PURE;
|
234 |
|
|
STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE;
|
235 |
|
|
};
|
236 |
|
|
|
237 |
|
|
DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown)
|
238 |
|
|
{
|
239 |
|
|
// IUnknown
|
240 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
241 |
|
|
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
242 |
|
|
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
243 |
|
|
|
244 |
|
|
// ID3DXSPMesh
|
245 |
|
|
STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
|
246 |
|
|
STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
|
247 |
|
|
STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
|
248 |
|
|
STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE;
|
249 |
|
|
STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
|
250 |
|
|
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
251 |
|
|
STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
|
252 |
|
|
DWORD FVF, LPDIRECT3DDEVICE8 pD3D, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
|
253 |
|
|
STDMETHOD(CloneMesh)(THIS_ DWORD Options,
|
254 |
|
|
CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
|
255 |
|
|
STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
|
256 |
|
|
DWORD FVF, LPDIRECT3DDEVICE8 pD3D, DWORD *pVertexRemapOut, LPD3DXPMESH* ppCloneMesh) PURE;
|
257 |
|
|
STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
|
258 |
|
|
CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3D, DWORD *pVertexRemapOut, LPD3DXPMESH* ppCloneMesh) PURE;
|
259 |
|
|
STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE;
|
260 |
|
|
STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE;
|
261 |
|
|
STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
|
262 |
|
|
STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
|
263 |
|
|
};
|
264 |
|
|
|
265 |
|
|
#define UNUSED16 (0xffff)
|
266 |
|
|
#define UNUSED32 (0xffffffff)
|
267 |
|
|
|
268 |
|
|
// ID3DXMesh::Optimize options
|
269 |
|
|
enum _D3DXMESHOPT {
|
270 |
|
|
D3DXMESHOPT_COMPACT = 0x001,
|
271 |
|
|
D3DXMESHOPT_ATTRSORT = 0x002,
|
272 |
|
|
D3DXMESHOPT_VERTEXCACHE = 0x004,
|
273 |
|
|
D3DXMESHOPT_STRIPREORDER = 0x008,
|
274 |
|
|
D3DXMESHOPT_IGNOREVERTS = 0x010, // optimize faces only, don't touch vertices
|
275 |
|
|
D3DXMESHOPT_SHAREVB = 0x020,
|
276 |
|
|
};
|
277 |
|
|
|
278 |
|
|
// Subset of the mesh that has the same attribute and bone combination.
|
279 |
|
|
// This subset can be rendered in a single draw call
|
280 |
|
|
typedef struct _D3DXBONECOMBINATION
|
281 |
|
|
{
|
282 |
|
|
DWORD AttribId;
|
283 |
|
|
DWORD FaceStart;
|
284 |
|
|
DWORD FaceCount;
|
285 |
|
|
DWORD VertexStart;
|
286 |
|
|
DWORD VertexCount;
|
287 |
|
|
DWORD* BoneId;
|
288 |
|
|
} D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION;
|
289 |
|
|
|
290 |
|
|
DECLARE_INTERFACE_(ID3DXSkinMesh, IUnknown)
|
291 |
|
|
{
|
292 |
|
|
// IUnknown
|
293 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
294 |
|
|
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
295 |
|
|
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
296 |
|
|
|
297 |
|
|
// ID3DXMesh
|
298 |
|
|
STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
|
299 |
|
|
STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
|
300 |
|
|
STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
|
301 |
|
|
STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE;
|
302 |
|
|
STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
|
303 |
|
|
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
304 |
|
|
STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE;
|
305 |
|
|
STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE;
|
306 |
|
|
STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, BYTE** ppData) PURE;
|
307 |
|
|
STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
|
308 |
|
|
STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, BYTE** ppData) PURE;
|
309 |
|
|
STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
|
310 |
|
|
STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE;
|
311 |
|
|
STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
|
312 |
|
|
// ID3DXSkinMesh
|
313 |
|
|
STDMETHOD_(DWORD, GetNumBones)(THIS) PURE;
|
314 |
|
|
STDMETHOD(GetOriginalMesh)(THIS_ LPD3DXMESH* ppMesh) PURE;
|
315 |
|
|
STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE;
|
316 |
|
|
STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE;
|
317 |
|
|
STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE;
|
318 |
|
|
STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE;
|
319 |
|
|
STDMETHOD(GetMaxFaceInfluences)(THIS_ DWORD* maxFaceInfluences) PURE;
|
320 |
|
|
STDMETHOD(ConvertToBlendedMesh)(THIS_ DWORD options, CONST LPDWORD pAdjacencyIn, LPDWORD pAdjacencyOut,
|
321 |
|
|
DWORD* pNumBoneCombinations, LPD3DXBUFFER* ppBoneCombinationTable, LPD3DXMESH* ppMesh) PURE;
|
322 |
|
|
STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_ DWORD options,
|
323 |
|
|
CONST LPDWORD pAdjacencyIn,
|
324 |
|
|
DWORD paletteSize,
|
325 |
|
|
LPDWORD pAdjacencyOut,
|
326 |
|
|
DWORD* pNumBoneCombinations,
|
327 |
|
|
LPD3DXBUFFER* ppBoneCombinationTable,
|
328 |
|
|
LPD3DXMESH* ppMesh) PURE;
|
329 |
|
|
STDMETHOD(GenerateSkinnedMesh)(THIS_ DWORD options, FLOAT minWeight, CONST LPDWORD pAdjacencyIn, LPDWORD pAdjacencyOut, LPD3DXMESH* ppMesh) PURE;
|
330 |
|
|
STDMETHOD(UpdateSkinnedMesh)(THIS_ CONST D3DXMATRIX* pBoneTransforms, LPD3DXMESH pMesh) PURE;
|
331 |
|
|
};
|
332 |
|
|
|
333 |
|
|
#ifdef __cplusplus
|
334 |
|
|
extern "C" {
|
335 |
|
|
#endif //__cplusplus
|
336 |
|
|
|
337 |
|
|
HRESULT WINAPI
|
338 |
|
|
D3DXCreateMesh(
|
339 |
|
|
DWORD NumFaces,
|
340 |
|
|
DWORD NumVertices,
|
341 |
|
|
DWORD Options,
|
342 |
|
|
CONST DWORD *pDeclaration,
|
343 |
|
|
LPDIRECT3DDEVICE8 pD3D,
|
344 |
|
|
LPD3DXMESH* ppMesh);
|
345 |
|
|
|
346 |
|
|
HRESULT WINAPI
|
347 |
|
|
D3DXCreateMeshFVF(
|
348 |
|
|
DWORD NumFaces,
|
349 |
|
|
DWORD NumVertices,
|
350 |
|
|
DWORD Options,
|
351 |
|
|
DWORD FVF,
|
352 |
|
|
LPDIRECT3DDEVICE8 pD3D,
|
353 |
|
|
LPD3DXMESH* ppMesh);
|
354 |
|
|
|
355 |
|
|
HRESULT WINAPI
|
356 |
|
|
D3DXCreateSPMesh(
|
357 |
|
|
LPD3DXMESH pMesh,
|
358 |
|
|
CONST DWORD* pAdjacency,
|
359 |
|
|
CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights,
|
360 |
|
|
CONST FLOAT *pVertexWeights,
|
361 |
|
|
LPD3DXSPMESH* ppSMesh);
|
362 |
|
|
|
363 |
|
|
// clean a mesh up for simplification, try to make manifold
|
364 |
|
|
HRESULT WINAPI
|
365 |
|
|
D3DXCleanMesh(
|
366 |
|
|
LPD3DXMESH pMeshIn,
|
367 |
|
|
CONST DWORD* pAdjacency,
|
368 |
|
|
LPD3DXMESH* ppMeshOut);
|
369 |
|
|
|
370 |
|
|
HRESULT WINAPI
|
371 |
|
|
D3DXValidMesh(
|
372 |
|
|
LPD3DXMESH pMeshIn,
|
373 |
|
|
CONST DWORD* pAdjacency);
|
374 |
|
|
|
375 |
|
|
HRESULT WINAPI
|
376 |
|
|
D3DXGeneratePMesh(
|
377 |
|
|
LPD3DXMESH pMesh,
|
378 |
|
|
CONST DWORD* pAdjacency,
|
379 |
|
|
CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights,
|
380 |
|
|
CONST FLOAT *pVertexWeights,
|
381 |
|
|
DWORD MinValue,
|
382 |
|
|
DWORD Options,
|
383 |
|
|
LPD3DXPMESH* ppPMesh);
|
384 |
|
|
|
385 |
|
|
HRESULT WINAPI
|
386 |
|
|
D3DXSimplifyMesh(
|
387 |
|
|
LPD3DXMESH pMesh,
|
388 |
|
|
CONST DWORD* pAdjacency,
|
389 |
|
|
CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights,
|
390 |
|
|
CONST FLOAT *pVertexWeights,
|
391 |
|
|
DWORD MinValue,
|
392 |
|
|
DWORD Options,
|
393 |
|
|
LPD3DXMESH* ppMesh);
|
394 |
|
|
|
395 |
|
|
HRESULT WINAPI
|
396 |
|
|
D3DXComputeBoundingSphere(
|
397 |
|
|
PVOID pPointsFVF,
|
398 |
|
|
DWORD NumVertices,
|
399 |
|
|
DWORD FVF,
|
400 |
|
|
D3DXVECTOR3 *pCenter,
|
401 |
|
|
FLOAT *pRadius);
|
402 |
|
|
|
403 |
|
|
HRESULT WINAPI
|
404 |
|
|
D3DXComputeBoundingBox(
|
405 |
|
|
PVOID pPointsFVF,
|
406 |
|
|
DWORD NumVertices,
|
407 |
|
|
DWORD FVF,
|
408 |
|
|
D3DXVECTOR3 *pMin,
|
409 |
|
|
D3DXVECTOR3 *pMax);
|
410 |
|
|
|
411 |
|
|
HRESULT WINAPI
|
412 |
|
|
D3DXComputeNormals(
|
413 |
|
|
LPD3DXBASEMESH pMesh);
|
414 |
|
|
|
415 |
|
|
HRESULT WINAPI
|
416 |
|
|
D3DXCreateBuffer(
|
417 |
|
|
DWORD NumBytes,
|
418 |
|
|
LPD3DXBUFFER *ppBuffer);
|
419 |
|
|
|
420 |
|
|
|
421 |
|
|
HRESULT WINAPI
|
422 |
|
|
D3DXLoadMeshFromX(
|
423 |
|
|
LPSTR pFilename,
|
424 |
|
|
DWORD Options,
|
425 |
|
|
LPDIRECT3DDEVICE8 pD3D,
|
426 |
|
|
LPD3DXBUFFER *ppAdjacency,
|
427 |
|
|
LPD3DXBUFFER *ppMaterials,
|
428 |
|
|
PDWORD pNumMaterials,
|
429 |
|
|
LPD3DXMESH *ppMesh);
|
430 |
|
|
|
431 |
|
|
HRESULT WINAPI
|
432 |
|
|
D3DXSaveMeshToX(
|
433 |
|
|
LPSTR pFilename,
|
434 |
|
|
LPD3DXMESH pMesh,
|
435 |
|
|
CONST DWORD* pAdjacency,
|
436 |
|
|
CONST LPD3DXMATERIAL pMaterials,
|
437 |
|
|
DWORD NumMaterials,
|
438 |
|
|
DWORD Format
|
439 |
|
|
);
|
440 |
|
|
|
441 |
|
|
HRESULT WINAPI
|
442 |
|
|
D3DXCreatePMeshFromStream(
|
443 |
|
|
IStream *pStream,
|
444 |
|
|
DWORD Options,
|
445 |
|
|
LPDIRECT3DDEVICE8 pD3DDevice,
|
446 |
|
|
LPD3DXBUFFER *ppMaterials,
|
447 |
|
|
DWORD* pNumMaterials,
|
448 |
|
|
LPD3DXPMESH *ppPMesh);
|
449 |
|
|
|
450 |
|
|
HRESULT WINAPI
|
451 |
|
|
D3DXCreateSkinMesh(
|
452 |
|
|
DWORD numFaces,
|
453 |
|
|
DWORD numVertices,
|
454 |
|
|
DWORD numBones,
|
455 |
|
|
DWORD options,
|
456 |
|
|
CONST DWORD *pDeclaration,
|
457 |
|
|
LPDIRECT3DDEVICE8 pD3D,
|
458 |
|
|
LPD3DXSKINMESH* ppSkinMesh);
|
459 |
|
|
|
460 |
|
|
HRESULT WINAPI
|
461 |
|
|
D3DXCreateSkinMeshFVF(
|
462 |
|
|
DWORD numFaces,
|
463 |
|
|
DWORD numVertices,
|
464 |
|
|
DWORD numBones,
|
465 |
|
|
DWORD options,
|
466 |
|
|
DWORD fvf,
|
467 |
|
|
LPDIRECT3DDEVICE8 pD3D,
|
468 |
|
|
LPD3DXSKINMESH* ppSkinMesh);
|
469 |
|
|
|
470 |
|
|
HRESULT WINAPI
|
471 |
|
|
D3DXCreateSkinMeshFromMesh(
|
472 |
|
|
LPD3DXMESH pMesh,
|
473 |
|
|
DWORD numBones,
|
474 |
|
|
LPD3DXSKINMESH* ppSkinMesh);
|
475 |
|
|
|
476 |
|
|
HRESULT WINAPI
|
477 |
|
|
D3DXLoadMeshFromXof(
|
478 |
|
|
LPDIRECTXFILEDATA pXofObjMesh,
|
479 |
|
|
DWORD Options,
|
480 |
|
|
LPDIRECT3DDEVICE8 pD3DDevice,
|
481 |
|
|
LPD3DXBUFFER *ppAdjacency,
|
482 |
|
|
LPD3DXBUFFER *ppMaterials,
|
483 |
|
|
PDWORD pNumMaterials,
|
484 |
|
|
LPD3DXMESH *ppMesh);
|
485 |
|
|
|
486 |
|
|
HRESULT WINAPI
|
487 |
|
|
D3DXLoadSkinMeshFromXof(
|
488 |
|
|
LPDIRECTXFILEDATA pxofobjMesh,
|
489 |
|
|
DWORD options,
|
490 |
|
|
LPDIRECT3DDEVICE8 pD3D,
|
491 |
|
|
LPD3DXBUFFER* ppAdjacency,
|
492 |
|
|
LPD3DXBUFFER* ppMaterials,
|
493 |
|
|
PDWORD pMatOut,
|
494 |
|
|
LPD3DXBUFFER* ppBoneNames,
|
495 |
|
|
LPD3DXBUFFER* ppBoneTransforms,
|
496 |
|
|
LPD3DXSKINMESH* ppMesh);
|
497 |
|
|
|
498 |
|
|
HRESULT WINAPI
|
499 |
|
|
D3DXTesselateMesh(
|
500 |
|
|
LPD3DXMESH pMeshIn,
|
501 |
|
|
CONST DWORD* pAdjacency,
|
502 |
|
|
FLOAT NumSegs,
|
503 |
|
|
BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic
|
504 |
|
|
LPD3DXMESH *ppMeshOut);
|
505 |
|
|
|
506 |
|
|
HRESULT WINAPI
|
507 |
|
|
D3DXDeclaratorFromFVF(
|
508 |
|
|
DWORD FVF,
|
509 |
|
|
DWORD Declaration[MAX_FVF_DECL_SIZE]);
|
510 |
|
|
|
511 |
|
|
HRESULT WINAPI
|
512 |
|
|
D3DXFVFFromDeclarator(
|
513 |
|
|
CONST DWORD *pDeclarator,
|
514 |
|
|
DWORD *pFVF);
|
515 |
|
|
|
516 |
|
|
HRESULT WINAPI
|
517 |
|
|
D3DXWeldVertices(
|
518 |
|
|
CONST LPD3DXMESH pMesh,
|
519 |
|
|
float fEpsilon,
|
520 |
|
|
CONST DWORD *rgdwAdjacencyIn,
|
521 |
|
|
DWORD *rgdwAdjacencyOut,
|
522 |
|
|
DWORD* pFaceRemap,
|
523 |
|
|
LPD3DXBUFFER *ppbufVertexRemap);
|
524 |
|
|
|
525 |
|
|
HRESULT WINAPI
|
526 |
|
|
D3DXIntersect(
|
527 |
|
|
LPD3DXBASEMESH pMesh,
|
528 |
|
|
CONST D3DXVECTOR3 *pRayPos,
|
529 |
|
|
CONST D3DXVECTOR3 *pRayDir,
|
530 |
|
|
BOOL *pHit,
|
531 |
|
|
DWORD *pFaceIndex,
|
532 |
|
|
FLOAT *pU,
|
533 |
|
|
FLOAT *pV,
|
534 |
|
|
FLOAT *pDist);
|
535 |
|
|
|
536 |
|
|
BOOL WINAPI
|
537 |
|
|
D3DXSphereBoundProbe(
|
538 |
|
|
CONST D3DXVECTOR3 *pvCenter,
|
539 |
|
|
FLOAT fRadius,
|
540 |
|
|
D3DXVECTOR3 *pvRayPosition,
|
541 |
|
|
D3DXVECTOR3 *pvRayDirection);
|
542 |
|
|
|
543 |
|
|
BOOL WINAPI
|
544 |
|
|
D3DXBoxBoundProbe(
|
545 |
|
|
CONST D3DXVECTOR3 *pvMin,
|
546 |
|
|
CONST D3DXVECTOR3 *pvMax,
|
547 |
|
|
D3DXVECTOR3 *pvRayPosition,
|
548 |
|
|
D3DXVECTOR3 *pvRayDirection);
|
549 |
|
|
|
550 |
|
|
enum _D3DXERR {
|
551 |
|
|
D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900),
|
552 |
|
|
D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901),
|
553 |
|
|
D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902),
|
554 |
|
|
D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903),
|
555 |
|
|
D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904),
|
556 |
|
|
D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905),
|
557 |
|
|
};
|
558 |
|
|
|
559 |
|
|
#ifdef __cplusplus
|
560 |
|
|
}
|
561 |
|
|
#endif //__cplusplus
|
562 |
|
|
|
563 |
|
|
#endif //__D3DX8MESH_H__
|
564 |
|
|
|
565 |
|
|
|