2 * Copyright (C) 2009 David Adam
3 * Copyright (C) 2010 Tony Wasserka
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_D3DX9MESH_H
23 #define __WINE_D3DX9MESH_H
25 DEFINE_GUID(IID_ID3DXBaseMesh, 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30);
26 DEFINE_GUID(IID_ID3DXMesh, 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95);
28 enum _MAX_FVF_DECL_SIZE
30 MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1
35 D3DXMESH_32BIT = 0x001,
36 D3DXMESH_DONOTCLIP = 0x002,
37 D3DXMESH_POINTS = 0x004,
38 D3DXMESH_RTPATCHES = 0x008,
39 D3DXMESH_NPATCHES = 0x4000,
40 D3DXMESH_VB_SYSTEMMEM = 0x010,
41 D3DXMESH_VB_MANAGED = 0x020,
42 D3DXMESH_VB_WRITEONLY = 0x040,
43 D3DXMESH_VB_DYNAMIC = 0x080,
44 D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000,
45 D3DXMESH_IB_SYSTEMMEM = 0x100,
46 D3DXMESH_IB_MANAGED = 0x200,
47 D3DXMESH_IB_WRITEONLY = 0x400,
48 D3DXMESH_IB_DYNAMIC = 0x800,
49 D3DXMESH_IB_SOFTWAREPROCESSING = 0x10000,
50 D3DXMESH_VB_SHARE = 0x1000,
51 D3DXMESH_USEHWONLY = 0x2000,
52 D3DXMESH_SYSTEMMEM = 0x110,
53 D3DXMESH_MANAGED = 0x220,
54 D3DXMESH_WRITEONLY = 0x440,
55 D3DXMESH_DYNAMIC = 0x880,
56 D3DXMESH_SOFTWAREPROCESSING = 0x18000
59 typedef struct ID3DXBaseMesh* LPD3DXBASEMESH;
60 typedef struct ID3DXMesh* LPD3DXMESH;
62 typedef struct _D3DXATTRIBUTERANGE {
70 typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE;
73 #define INTERFACE ID3DXBaseMesh
75 DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown)
77 /*** IUnknown methods ***/
78 STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE;
79 STDMETHOD_(ULONG, AddRef)(THIS) PURE;
80 STDMETHOD_(ULONG, Release)(THIS) PURE;
81 /*** ID3DXBaseMesh ***/
82 STDMETHOD(DrawSubset)(THIS_ DWORD attrib_id) PURE;
83 STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
84 STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
85 STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
86 STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE;
87 STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
88 STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
89 STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* device) PURE;
90 STDMETHOD(CloneMeshFVF)(THIS_ DWORD options, DWORD fvf, LPDIRECT3DDEVICE9 device, LPD3DXMESH* clone_mesh) PURE;
91 STDMETHOD(CloneMesh)(THIS_ DWORD options, CONST D3DVERTEXELEMENT9* declaration, LPDIRECT3DDEVICE9 device,
92 LPD3DXMESH* clone_mesh) PURE;
93 STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* vertex_buffer) PURE;
94 STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* index_buffer) PURE;
95 STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE;
96 STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
97 STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE;
98 STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
99 STDMETHOD(GetAttributeTable)(THIS_ D3DXATTRIBUTERANGE* attrib_table, DWORD* attrib_table_size) PURE;
100 STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* point_reps, DWORD* adjacency) PURE;
101 STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* adjacency, DWORD* point_reps) PURE;
102 STDMETHOD(GenerateAdjacency)(THIS_ FLOAT epsilon, DWORD* adjacency) PURE;
103 STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE;
108 #define INTERFACE ID3DXMesh
110 DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh)
112 /*** IUnknown methods ***/
113 STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE;
114 STDMETHOD_(ULONG, AddRef)(THIS) PURE;
115 STDMETHOD_(ULONG, Release)(THIS) PURE;
116 /*** ID3DXBaseMesh ***/
117 STDMETHOD(DrawSubset)(THIS_ DWORD attrib_id) PURE;
118 STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
119 STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
120 STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
121 STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE;
122 STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
123 STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
124 STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* device) PURE;
125 STDMETHOD(CloneMeshFVF)(THIS_ DWORD options, DWORD fvf, LPDIRECT3DDEVICE9 device, LPD3DXMESH* clone_mesh) PURE;
126 STDMETHOD(CloneMesh)(THIS_ DWORD options, CONST D3DVERTEXELEMENT9* declaration, LPDIRECT3DDEVICE9 device,
127 LPD3DXMESH* clone_mesh) PURE;
128 STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* vertex_buffer) PURE;
129 STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* index_buffer) PURE;
130 STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE;
131 STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
132 STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE;
133 STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
134 STDMETHOD(GetAttributeTable)(THIS_ D3DXATTRIBUTERANGE* attrib_table, DWORD* attrib_table_size) PURE;
135 STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* point_reps, DWORD* adjacency) PURE;
136 STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* adjacency, DWORD* point_reps) PURE;
137 STDMETHOD(GenerateAdjacency)(THIS_ FLOAT epsilon, DWORD* adjacency) PURE;
138 STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE;
140 STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** data) PURE;
141 STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
142 STDMETHOD(Optimize)(THIS_ DWORD flags, CONST DWORD* adjacency_in, DWORD* adjacency_out,
143 DWORD* face_remap, LPD3DXBUFFER* vertex_remap, LPD3DXMESH* opt_mesh) PURE;
144 STDMETHOD(OptimizeInplace)(THIS_ DWORD flags, CONST DWORD* adjacency_in, DWORD* adjacency_out,
145 DWORD* face_remap, LPD3DXBUFFER* vertex_remap) PURE;
146 STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE* attrib_table, DWORD attrib_table_size) PURE;
153 HRESULT WINAPI D3DXCreateMesh(DWORD, DWORD, DWORD, CONST D3DVERTEXELEMENT9 *, LPDIRECT3DDEVICE9, LPD3DXMESH *);
154 HRESULT WINAPI D3DXCreateMeshFVF(DWORD, DWORD, DWORD, DWORD, LPDIRECT3DDEVICE9, LPD3DXMESH *);
155 HRESULT WINAPI D3DXCreateBuffer(DWORD, LPD3DXBUFFER*);
156 UINT WINAPI D3DXGetDeclLength(const D3DVERTEXELEMENT9 *decl);
157 UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_idx);
158 UINT WINAPI D3DXGetFVFVertexSize(DWORD);
159 BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *);
160 BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *,FLOAT,CONST D3DXVECTOR3 *,CONST D3DXVECTOR3 *);
161 HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, D3DXVECTOR3 *);
162 HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, FLOAT *);
163 HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD, D3DVERTEXELEMENT9[MAX_FVF_DECL_SIZE]);
164 HRESULT WINAPI D3DXFVFFromDeclarator(const D3DVERTEXELEMENT9 *decl, DWORD *fvf);
165 BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3*, FLOAT *, FLOAT *, FLOAT *);
171 #endif /* __WINE_D3DX9MESH_H */