ReactOS 0.4.17-dev-934-g091855f
mesh.c
Go to the documentation of this file.
1/*
2 * Copyright 2021 Nikolay Sivov for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 *
18 */
19
20#define COBJMACROS
21#include "d3dx10.h"
22
23#include "wine/debug.h"
24
26
28{
29 ID3DX10Mesh ID3DX10Mesh_iface;
31};
32
33static inline struct d3dx10_mesh *impl_from_ID3DX10Mesh(ID3DX10Mesh *iface)
34{
35 return CONTAINING_RECORD(iface, struct d3dx10_mesh, ID3DX10Mesh_iface);
36}
37
39{
40 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
41
42 if (IsEqualGUID(riid, &IID_ID3DX10Mesh)
44 {
45 IUnknown_AddRef(iface);
46 *out = iface;
47 return S_OK;
48 }
49
50 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
51
52 *out = NULL;
53 return E_NOINTERFACE;
54}
55
56static ULONG STDMETHODCALLTYPE d3dx10_mesh_AddRef(ID3DX10Mesh *iface)
57{
58 struct d3dx10_mesh *mesh = impl_from_ID3DX10Mesh(iface);
60
61 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
62
63 return refcount;
64}
65
67{
68 struct d3dx10_mesh *mesh = impl_from_ID3DX10Mesh(iface);
70
71 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
72
73 if (!refcount)
74 free(mesh);
75
76 return refcount;
77}
78
80{
81 FIXME("iface %p stub!\n", iface);
82
83 return 0;
84}
85
87{
88 FIXME("iface %p stub!\n", iface);
89
90 return 0;
91}
92
94{
95 FIXME("iface %p stub!\n", iface);
96
97 return 0;
98}
99
101{
102 FIXME("iface %p stub!\n", iface);
103
104 return 0;
105}
106
109{
110 FIXME("iface %p, desc %p, count %p stub!\n", iface, desc, count);
111
112 return E_NOTIMPL;
113}
114
116 const void *data)
117{
118 FIXME("iface %p, index %u, data %p stub!\n", iface, index, data);
119
120 return E_NOTIMPL;
121}
122
124 ID3DX10MeshBuffer **buffer)
125{
126 FIXME("iface %p, index %u, buffer %p stub!\n", iface, index, buffer);
127
128 return E_NOTIMPL;
129}
130
131static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetIndexData(ID3DX10Mesh *iface, const void *data,
132 UINT count)
133{
134 FIXME("iface %p, data %p, count %u stub!\n", iface, data, count);
135
136 return E_NOTIMPL;
137}
138
140 ID3DX10MeshBuffer **buffer)
141{
142 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
143
144 return E_NOTIMPL;
145}
146
148 const UINT *data)
149{
150 FIXME("iface %p, data %p stub!\n", iface, data);
151
152 return E_NOTIMPL;
153}
154
156 ID3DX10MeshBuffer **buffer)
157{
158 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
159
160 return E_NOTIMPL;
161}
162
165{
166 FIXME("iface %p, table %p, count %u stub!\n", iface, table, count);
167
168 return E_NOTIMPL;
169}
170
173{
174 FIXME("iface %p, table %p, count %p stub!\n", iface, table, count);
175
176 return E_NOTIMPL;
177}
178
180 float epsilon)
181{
182 FIXME("iface %p, epsilon %.8e stub!\n", iface, epsilon);
183
184 return E_NOTIMPL;
185}
186
188{
189 FIXME("iface %p stub!\n", iface);
190
191 return E_NOTIMPL;
192}
193
195 const UINT *adjacency)
196{
197 FIXME("iface %p, adjacency %p stub!\n", iface, adjacency);
198
199 return E_NOTIMPL;
200}
201
203 ID3DX10MeshBuffer **buffer)
204{
205 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
206
207 return E_NOTIMPL;
208}
209
211 const UINT *pointreps)
212{
213 FIXME("iface %p, pointreps %p stub!\n", iface, pointreps);
214
215 return E_NOTIMPL;
216}
217
219 ID3DX10MeshBuffer **buffer)
220{
221 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
222
223 return E_NOTIMPL;
224}
225
228{
229 FIXME("iface %p, flags %#x stub!\n", iface, flags);
230
231 return E_NOTIMPL;
232}
233
235 const char *pos_semantic, const D3D10_INPUT_ELEMENT_DESC *desc, UINT decl_count,
236 ID3DX10Mesh **cloned_mesh)
237{
238 FIXME("iface %p, flags %#x, pos_semantic %s, desc %p, decl_count %u, cloned_mesh %p stub!\n",
239 iface, flags, debugstr_a(pos_semantic), desc, decl_count, cloned_mesh);
240
241 return E_NOTIMPL;
242}
243
245 UINT *face_remap, ID3D10Blob **vertex_remap)
246{
247 FIXME("iface %p, flags %#x, face_remap %p, vertex_remap %p stub!\n", iface, flags,
248 face_remap, vertex_remap);
249
250 return E_NOTIMPL;
251}
252
254{
255 FIXME("iface %p stub!\n", iface);
256
257 return E_NOTIMPL;
258}
259
260static HRESULT STDMETHODCALLTYPE d3dx10_mesh_Intersect(ID3DX10Mesh *iface, D3DXVECTOR3 *ray_pos,
261 D3DXVECTOR3 *ray_dir, UINT *hit_count, UINT *face_index, float *u, float *v, float *dist,
262 ID3D10Blob **all_hits)
263{
264 FIXME("iface %p, ray_pos %p, ray_dir %p, hit_count %p, u %p, v %p, dist %p, all_hits %p stub!\n",
265 iface, ray_pos, ray_dir, hit_count, u, v, dist, all_hits);
266
267 return E_NOTIMPL;
268}
269
271 D3DXVECTOR3 *ray_pos, D3DXVECTOR3 *ray_dir, UINT *hit_count, float *u, float *v,
272 float *dist, ID3D10Blob **all_hits)
273{
274 FIXME("iface %p, attr_id %u, ray_pos %p, ray_dir %p, hit_count %p, u %p, v %p, dist %p, all_hits %p stub!\n",
275 iface, attr_id, ray_pos, ray_dir, hit_count, u, v, dist, all_hits);
276
277 return E_NOTIMPL;
278}
279
281{
282 FIXME("iface %p stub!\n", iface);
283
284 return E_NOTIMPL;
285}
286
287static HRESULT STDMETHODCALLTYPE d3dx10_mesh_DrawSubset(ID3DX10Mesh *iface, UINT attr_id)
288{
289 FIXME("iface %p, attr_id %u stub!\n", iface, attr_id);
290
291 return E_NOTIMPL;
292}
293
295 UINT instance_count, UINT start_instance)
296{
297 FIXME("iface %p, attr_id %u, instance_count %u, start_instance %u stub!\n", iface, attr_id,
298 instance_count, start_instance);
299
300 return E_NOTIMPL;
301}
302
305{
306 FIXME("iface %p, index %u, buffer %p stub!\n", iface, index, buffer);
307
308 return E_NOTIMPL;
309}
310
313{
314 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
315
316 return E_NOTIMPL;
317}
318
319static const ID3DX10MeshVtbl d3dx10_mesh_vtbl =
320{
354};
355
357 UINT decl_count, const char *position_semantic, UINT vertex_count, UINT face_count,
358 UINT options, ID3DX10Mesh **mesh)
359{
360 struct d3dx10_mesh *object;
361
362 FIXME("device %p, decl %p, decl_count %u, position_semantic %s, vertex_count %u, face_count %u, "
363 "options %#x, mesh %p semi-stub.\n", device, decl, decl_count, debugstr_a(position_semantic), vertex_count,
365
366 *mesh = NULL;
367
368 if (!(object = calloc(1, sizeof(*object))))
369 return E_OUTOFMEMORY;
370
371 object->ID3DX10Mesh_iface.lpVtbl = &d3dx10_mesh_vtbl;
372 object->refcount = 1;
373
374 *mesh = &object->ID3DX10Mesh_iface;
375
376 return S_OK;
377}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
enum _D3DX10_MESH_DISCARD_FLAGS D3DX10_MESH_DISCARD_FLAGS
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetVertexBuffer(ID3DX10Mesh *iface, UINT index, ID3DX10MeshBuffer **buffer)
Definition: mesh.c:123
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_DrawSubset(ID3DX10Mesh *iface, UINT attr_id)
Definition: mesh.c:287
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetPointRepData(ID3DX10Mesh *iface, const UINT *pointreps)
Definition: mesh.c:210
static UINT STDMETHODCALLTYPE d3dx10_mesh_GetVertexBufferCount(ID3DX10Mesh *iface)
Definition: mesh.c:93
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetDeviceIndexBuffer(ID3DX10Mesh *iface, ID3D10Buffer **buffer)
Definition: mesh.c:311
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetPointRepBuffer(ID3DX10Mesh *iface, ID3DX10MeshBuffer **buffer)
Definition: mesh.c:218
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetAdjacencyBuffer(ID3DX10Mesh *iface, ID3DX10MeshBuffer **buffer)
Definition: mesh.c:202
static ULONG STDMETHODCALLTYPE d3dx10_mesh_AddRef(ID3DX10Mesh *iface)
Definition: mesh.c:56
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_DrawSubsetInstanced(ID3DX10Mesh *iface, UINT attr_id, UINT instance_count, UINT start_instance)
Definition: mesh.c:294
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetDeviceVertexBuffer(ID3DX10Mesh *iface, UINT index, ID3D10Buffer **buffer)
Definition: mesh.c:303
static UINT STDMETHODCALLTYPE d3dx10_mesh_GetFlags(ID3DX10Mesh *iface)
Definition: mesh.c:100
static struct d3dx10_mesh * impl_from_ID3DX10Mesh(ID3DX10Mesh *iface)
Definition: mesh.c:33
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_CloneMesh(ID3DX10Mesh *iface, UINT flags, const char *pos_semantic, const D3D10_INPUT_ELEMENT_DESC *desc, UINT decl_count, ID3DX10Mesh **cloned_mesh)
Definition: mesh.c:234
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetVertexData(ID3DX10Mesh *iface, UINT index, const void *data)
Definition: mesh.c:115
static const ID3DX10MeshVtbl d3dx10_mesh_vtbl
Definition: mesh.c:319
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetAttributeTable(ID3DX10Mesh *iface, const D3DX10_ATTRIBUTE_RANGE *table, UINT count)
Definition: mesh.c:163
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_Discard(ID3DX10Mesh *iface, D3DX10_MESH_DISCARD_FLAGS flags)
Definition: mesh.c:226
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetIndexData(ID3DX10Mesh *iface, const void *data, UINT count)
Definition: mesh.c:131
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetAttributeBuffer(ID3DX10Mesh *iface, ID3DX10MeshBuffer **buffer)
Definition: mesh.c:155
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_Intersect(ID3DX10Mesh *iface, D3DXVECTOR3 *ray_pos, D3DXVECTOR3 *ray_dir, UINT *hit_count, UINT *face_index, float *u, float *v, float *dist, ID3D10Blob **all_hits)
Definition: mesh.c:260
static ULONG STDMETHODCALLTYPE d3dx10_mesh_Release(ID3DX10Mesh *iface)
Definition: mesh.c:66
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_IntersectSubset(ID3DX10Mesh *iface, UINT attr_id, D3DXVECTOR3 *ray_pos, D3DXVECTOR3 *ray_dir, UINT *hit_count, float *u, float *v, float *dist, ID3D10Blob **all_hits)
Definition: mesh.c:270
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GenerateGSAdjacency(ID3DX10Mesh *iface)
Definition: mesh.c:187
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetAttributeData(ID3DX10Mesh *iface, const UINT *data)
Definition: mesh.c:147
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetVertexDescription(ID3DX10Mesh *iface, const D3D10_INPUT_ELEMENT_DESC **desc, UINT *count)
Definition: mesh.c:107
HRESULT WINAPI D3DX10CreateMesh(ID3D10Device *device, const D3D10_INPUT_ELEMENT_DESC *decl, UINT decl_count, const char *position_semantic, UINT vertex_count, UINT face_count, UINT options, ID3DX10Mesh **mesh)
Definition: mesh.c:356
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetAttributeTable(ID3DX10Mesh *iface, D3DX10_ATTRIBUTE_RANGE *table, UINT *count)
Definition: mesh.c:171
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_CommitToDevice(ID3DX10Mesh *iface)
Definition: mesh.c:280
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GenerateAttributeBufferFromTable(ID3DX10Mesh *iface)
Definition: mesh.c:253
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GenerateAdjacencyAndPointReps(ID3DX10Mesh *iface, float epsilon)
Definition: mesh.c:179
static UINT STDMETHODCALLTYPE d3dx10_mesh_GetVertexCount(ID3DX10Mesh *iface)
Definition: mesh.c:86
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetIndexBuffer(ID3DX10Mesh *iface, ID3DX10MeshBuffer **buffer)
Definition: mesh.c:139
static UINT STDMETHODCALLTYPE d3dx10_mesh_GetFaceCount(ID3DX10Mesh *iface)
Definition: mesh.c:79
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_QueryInterface(ID3DX10Mesh *iface, REFIID riid, void **out)
Definition: mesh.c:38
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_Optimize(ID3DX10Mesh *iface, UINT flags, UINT *face_remap, ID3D10Blob **vertex_remap)
Definition: mesh.c:244
static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetAdjacencyData(ID3DX10Mesh *iface, const UINT *adjacency)
Definition: mesh.c:194
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
GLuint index
Definition: glext.h:6031
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
int face_count
Definition: d3drm.c:3529
int vertex_count
Definition: d3drm.c:3528
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define calloc
Definition: rosglue.h:14
#define TRACE(s)
Definition: solgame.cpp:4
LONG refcount
Definition: mesh.c:30
ID3DX10Mesh ID3DX10Mesh_iface
Definition: mesh.c:29
Definition: devices.h:37
Definition: mesh.c:189
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479