amstream: Implement IAMMultiMediaStreamImpl_AddMediaStream + add tests.
[wine/multimedia.git] / dlls / d3drm / meshbuilder.c
blobb386cbf31242e1d9f8e47445d0c066b86ae3caa1
1 /*
2 * Implementation of IDirect3DRMMeshBuilder2 Interface
4 * Copyright 2010, 2012 Christian Costa
5 * Copyright 2011 André Hentschel
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
24 #define COBJMACROS
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "dxfile.h"
29 #include "rmxfguid.h"
31 #include "d3drm_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
35 typedef struct {
36 D3DVALUE u;
37 D3DVALUE v;
38 } Coords2d;
40 typedef struct {
41 IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface;
42 IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
43 LONG ref;
44 DWORD nb_vertices;
45 D3DVECTOR* pVertices;
46 DWORD nb_normals;
47 D3DVECTOR* pNormals;
48 DWORD nb_faces;
49 DWORD face_data_size;
50 LPVOID pFaceData;
51 DWORD nb_coords2d;
52 Coords2d* pCoords2d;
53 } IDirect3DRMMeshBuilderImpl;
55 typedef struct {
56 WORD major;
57 WORD minor;
58 DWORD flags;
59 } Header;
61 static char templates[] = {
62 "xof 0302txt 0064"
63 "template Header"
64 "{"
65 "<3D82AB43-62DA-11CF-AB39-0020AF71E433>"
66 "WORD major;"
67 "WORD minor;"
68 "DWORD flags;"
69 "}"
70 "template Vector"
71 "{"
72 "<3D82AB5E-62DA-11CF-AB39-0020AF71E433>"
73 "FLOAT x;"
74 "FLOAT y;"
75 "FLOAT z;"
76 "}"
77 "template Coords2d"
78 "{"
79 "<F6F23F44-7686-11CF-8F52-0040333594A3>"
80 "FLOAT u;"
81 "FLOAT v;"
82 "}"
83 "template Matrix4x4"
84 "{"
85 "<F6F23F45-7686-11CF-8F52-0040333594A3>"
86 "array FLOAT matrix[16];"
87 "}"
88 "template ColorRGBA"
89 "{"
90 "<35FF44E0-6C7C-11CF-8F52-0040333594A3>"
91 "FLOAT red;"
92 "FLOAT green;"
93 "FLOAT blue;"
94 "FLOAT alpha;"
95 "}"
96 "template ColorRGB"
97 "{"
98 "<D3E16E81-7835-11CF-8F52-0040333594A3>"
99 "FLOAT red;"
100 "FLOAT green;"
101 "FLOAT blue;"
103 "template IndexedColor"
105 "<1630B820-7842-11CF-8F52-0040333594A3>"
106 "DWORD index;"
107 "ColorRGBA indexColor;"
109 "template Boolean"
111 "<537DA6A0-CA37-11D0-941C-0080C80CFA7B>"
112 "DWORD truefalse;"
114 "template Boolean2d"
116 "<4885AE63-78E8-11CF-8F52-0040333594A3>"
117 "Boolean u;"
118 "Boolean v;"
120 "template MaterialWrap"
122 "<4885AE60-78E8-11CF-8F52-0040333594A3>"
123 "Boolean u;"
124 "Boolean v;"
126 "template TextureFilename"
128 "<A42790E1-7810-11CF-8F52-0040333594A3>"
129 "STRING filename;"
131 "template Material"
133 "<3D82AB4D-62DA-11CF-AB39-0020AF71E433>"
134 "ColorRGBA faceColor;"
135 "FLOAT power;"
136 "ColorRGB specularColor;"
137 "ColorRGB emissiveColor;"
138 "[...]"
140 "template MeshFace"
142 "<3D82AB5F-62DA-11CF-AB39-0020AF71E433>"
143 "DWORD nFaceVertexIndices;"
144 "array DWORD faceVertexIndices[nFaceVertexIndices];"
146 "template MeshFaceWraps"
148 "<ED1EC5C0-C0A8-11D0-941C-0080C80CFA7B>"
149 "DWORD nFaceWrapValues;"
150 "array Boolean2d faceWrapValues[nFaceWrapValues];"
152 "template MeshTextureCoords"
154 "<F6F23F40-7686-11CF-8F52-0040333594A3>"
155 "DWORD nTextureCoords;"
156 "array Coords2d textureCoords[nTextureCoords];"
158 "template MeshMaterialList"
160 "<F6F23F42-7686-11CF-8F52-0040333594A3>"
161 "DWORD nMaterials;"
162 "DWORD nFaceIndexes;"
163 "array DWORD faceIndexes[nFaceIndexes];"
164 "[Material]"
166 "template MeshNormals"
168 "<F6F23F43-7686-11CF-8F52-0040333594A3>"
169 "DWORD nNormals;"
170 "array Vector normals[nNormals];"
171 "DWORD nFaceNormals;"
172 "array MeshFace faceNormals[nFaceNormals];"
174 "template MeshVertexColors"
176 "<1630B821-7842-11CF-8F52-0040333594A3>"
177 "DWORD nVertexColors;"
178 "array IndexedColor vertexColors[nVertexColors];"
180 "template Mesh"
182 "<3D82AB44-62DA-11CF-AB39-0020AF71E433>"
183 "DWORD nVertices;"
184 "array Vector vertices[nVertices];"
185 "DWORD nFaces;"
186 "array MeshFace faces[nFaces];"
187 "[...]"
189 "template FrameTransformMatrix"
191 "<F6F23F41-7686-11CF-8F52-0040333594A3>"
192 "Matrix4x4 frameMatrix;"
194 "template Frame"
196 "<3D82AB46-62DA-11CF-AB39-0020AF71E433>"
197 "[...]"
199 "template FloatKeys"
201 "<10DD46A9-775B-11CF-8F52-0040333594A3>"
202 "DWORD nValues;"
203 "array FLOAT values[nValues];"
205 "template TimedFloatKeys"
207 "<F406B180-7B3B-11CF-8F52-0040333594A3>"
208 "DWORD time;"
209 "FloatKeys tfkeys;"
211 "template AnimationKey"
213 "<10DD46A8-775B-11CF-8F52-0040333594A3>"
214 "DWORD keyType;"
215 "DWORD nKeys;"
216 "array TimedFloatKeys keys[nKeys];"
218 "template AnimationOptions"
220 "<E2BF56C0-840F-11CF-8F52-0040333594A3>"
221 "DWORD openclosed;"
222 "DWORD positionquality;"
224 "template Animation"
226 "<3D82AB4F-62DA-11CF-AB39-0020AF71E433>"
227 "[...]"
229 "template AnimationSet"
231 "<3D82AB50-62DA-11CF-AB39-0020AF71E433>"
232 "[Animation]"
234 "template InlineData"
236 "<3A23EEA0-94B1-11D0-AB39-0020AF71E433>"
237 "[BINARY]"
239 "template Url"
241 "<3A23EEA1-94B1-11D0-AB39-0020AF71E433>"
242 "DWORD nUrls;"
243 "array STRING urls[nUrls];"
245 "template ProgressiveMesh"
247 "<8A63C360-997D-11D0-941C-0080C80CFA7B>"
248 "[Url,InlineData]"
250 "template Guid"
252 "<A42790E0-7810-11CF-8F52-0040333594A3>"
253 "DWORD data1;"
254 "WORD data2;"
255 "WORD data3;"
256 "array UCHAR data4[8];"
258 "template StringProperty"
260 "<7F0F21E0-BFE1-11D1-82C0-00A0C9697271>"
261 "STRING key;"
262 "STRING value;"
264 "template PropertyBag"
266 "<7F0F21E1-BFE1-11D1-82C0-00A0C9697271>"
267 "[StringProperty]"
269 "template ExternalVisual"
271 "<98116AA0-BDBA-11D1-82C0-00A0C9697271>"
272 "Guid guidExternalVisual;"
273 "[...]"
275 "template RightHanded"
277 "<7F5D5EA0-D53A-11D1-82C0-00A0C9697271>"
278 "DWORD bRightHanded;"
282 static inline IDirect3DRMMeshBuilderImpl *impl_from_IDirect3DRMMeshBuilder2(IDirect3DRMMeshBuilder2 *iface)
284 return CONTAINING_RECORD(iface, IDirect3DRMMeshBuilderImpl, IDirect3DRMMeshBuilder2_iface);
287 static inline IDirect3DRMMeshBuilderImpl *impl_from_IDirect3DRMMeshBuilder3(IDirect3DRMMeshBuilder3 *iface)
289 return CONTAINING_RECORD(iface, IDirect3DRMMeshBuilderImpl, IDirect3DRMMeshBuilder3_iface);
292 /*** IUnknown methods ***/
293 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_QueryInterface(IDirect3DRMMeshBuilder2* iface,
294 REFIID riid, void** ppvObject)
296 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
298 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObject);
300 *ppvObject = NULL;
302 if(IsEqualGUID(riid, &IID_IUnknown) ||
303 IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder) ||
304 IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder2))
306 *ppvObject = &This->IDirect3DRMMeshBuilder2_iface;
308 else if(IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder3))
310 *ppvObject = &This->IDirect3DRMMeshBuilder3_iface;
312 else
314 FIXME("interface %s not implemented\n", debugstr_guid(riid));
315 return E_NOINTERFACE;
318 IDirect3DRMMeshBuilder_AddRef(iface);
319 return S_OK;
322 static ULONG WINAPI IDirect3DRMMeshBuilder2Impl_AddRef(IDirect3DRMMeshBuilder2* iface)
324 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
325 ULONG ref = InterlockedIncrement(&This->ref);
327 TRACE("(%p)->(): new ref = %d\n", This, ref);
329 return ref;
332 static ULONG WINAPI IDirect3DRMMeshBuilder2Impl_Release(IDirect3DRMMeshBuilder2* iface)
334 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
335 ULONG ref = InterlockedDecrement(&This->ref);
337 TRACE("(%p)->(): new ref = %d\n", This, ref);
339 if (!ref)
341 HeapFree(GetProcessHeap(), 0, This->pVertices);
342 HeapFree(GetProcessHeap(), 0, This->pNormals);
343 HeapFree(GetProcessHeap(), 0, This->pFaceData);
344 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
345 HeapFree(GetProcessHeap(), 0, This);
348 return ref;
351 /*** IDirect3DRMObject methods ***/
352 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_Clone(IDirect3DRMMeshBuilder2* iface,
353 LPUNKNOWN pUnkOuter, REFIID riid,
354 LPVOID *ppvObj)
356 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
358 FIXME("(%p)->(%p,%s,%p): stub\n", This, pUnkOuter, debugstr_guid(riid), ppvObj);
360 return E_NOTIMPL;
363 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_AddDestroyCallback(IDirect3DRMMeshBuilder2* iface,
364 D3DRMOBJECTCALLBACK cb,
365 LPVOID argument)
367 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
369 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
371 return E_NOTIMPL;
374 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_DeleteDestroyCallback(IDirect3DRMMeshBuilder2* iface,
375 D3DRMOBJECTCALLBACK cb,
376 LPVOID argument)
378 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
380 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
382 return E_NOTIMPL;
385 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetAppData(IDirect3DRMMeshBuilder2* iface,
386 DWORD data)
388 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
390 FIXME("(%p)->(%u): stub\n", This, data);
392 return E_NOTIMPL;
395 static DWORD WINAPI IDirect3DRMMeshBuilder2Impl_GetAppData(IDirect3DRMMeshBuilder2* iface)
397 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
399 FIXME("(%p)->(): stub\n", This);
401 return 0;
404 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetName(IDirect3DRMMeshBuilder2* iface,
405 LPCSTR pName)
407 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
409 FIXME("(%p)->(%s): stub\n", This, pName);
411 return E_NOTIMPL;
414 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetName(IDirect3DRMMeshBuilder2* iface,
415 LPDWORD lpdwSize, LPSTR lpName)
417 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
419 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
421 return E_NOTIMPL;
424 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetClassName(IDirect3DRMMeshBuilder2* iface,
425 LPDWORD lpdwSize, LPSTR lpName)
427 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
429 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
431 return E_NOTIMPL;
434 /*** IDirect3DRMMeshBuilder2 methods ***/
435 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_Load(IDirect3DRMMeshBuilder2* iface,
436 LPVOID filename, LPVOID name,
437 D3DRMLOADOPTIONS loadflags,
438 D3DRMLOADTEXTURECALLBACK cb, LPVOID arg)
440 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
442 TRACE("(%p)->(%p,%p,%x,%p,%p)\n", This, filename, name, loadflags, cb, arg);
444 if (cb)
445 FIXME("Texture callback is not yet supported\n");
447 return IDirect3DRMMeshBuilder3_Load(&This->IDirect3DRMMeshBuilder3_iface, filename, name,
448 loadflags, NULL, arg);
451 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_Save(IDirect3DRMMeshBuilder2* iface,
452 const char *filename, D3DRMXOFFORMAT format,
453 D3DRMSAVEOPTIONS save)
455 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
457 FIXME("(%p)->(%s,%d,%d): stub\n", This, filename, format, save);
459 return E_NOTIMPL;
462 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_Scale(IDirect3DRMMeshBuilder2* iface,
463 D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
465 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
467 FIXME("(%p)->(%f,%f,%f): stub\n", This, sx, sy, sz);
469 return E_NOTIMPL;
472 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_Translate(IDirect3DRMMeshBuilder2* iface,
473 D3DVALUE tx, D3DVALUE ty, D3DVALUE tz)
475 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
477 FIXME("(%p)->(%f,%f,%f): stub\n", This, tx, ty, tz);
479 return E_NOTIMPL;
482 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetColorSource(IDirect3DRMMeshBuilder2* iface,
483 D3DRMCOLORSOURCE color)
485 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
487 FIXME("(%p)->(%x): stub\n", This, color);
489 return E_NOTIMPL;
492 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetBox(IDirect3DRMMeshBuilder2* iface,
493 D3DRMBOX *pBox)
495 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
497 FIXME("(%p)->(%p): stub\n", This, pBox);
499 return E_NOTIMPL;
502 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GenerateNormals(IDirect3DRMMeshBuilder2* iface)
504 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
506 FIXME("(%p)->(): stub\n", This);
508 return E_NOTIMPL;
511 static D3DRMCOLORSOURCE WINAPI IDirect3DRMMeshBuilder2Impl_GetColorSource(IDirect3DRMMeshBuilder2* iface)
513 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
515 FIXME("(%p)->(): stub\n", This);
517 return E_NOTIMPL;
520 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_AddMesh(IDirect3DRMMeshBuilder2* iface,
521 LPDIRECT3DRMMESH pMesh)
523 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
525 FIXME("(%p)->(%p): stub\n", This, pMesh);
527 return E_NOTIMPL;
530 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_AddMeshBuilder(IDirect3DRMMeshBuilder2* iface,
531 LPDIRECT3DRMMESHBUILDER pMeshBuilder)
533 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
535 FIXME("(%p)->(%p): stub\n", This, pMeshBuilder);
537 return E_NOTIMPL;
540 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_AddFrame(IDirect3DRMMeshBuilder2* iface,
541 LPDIRECT3DRMFRAME pFrame)
543 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
545 FIXME("(%p)->(%p): stub\n", This, pFrame);
547 return E_NOTIMPL;
550 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_AddFace(IDirect3DRMMeshBuilder2* iface,
551 LPDIRECT3DRMFACE pFace)
553 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
555 FIXME("(%p)->(%p): stub\n", This, pFace);
557 return E_NOTIMPL;
560 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_AddFaces(IDirect3DRMMeshBuilder2* iface,
561 DWORD vcount, D3DVECTOR *vertices,
562 DWORD ncount, D3DVECTOR *normals,
563 DWORD *data,
564 LPDIRECT3DRMFACEARRAY* pFaceArray)
566 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
568 FIXME("(%p)->(%d,%p,%d,%p,%p,%p): stub\n", This, vcount, vertices, ncount, normals, data, pFaceArray);
570 return E_NOTIMPL;
573 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_ReserveSpace(IDirect3DRMMeshBuilder2* iface,
574 DWORD vertex_Count,
575 DWORD normal_count,
576 DWORD face_count)
578 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
580 FIXME("(%p)->(%d,%d,%d): stub\n", This, vertex_Count, normal_count, face_count);
582 return E_NOTIMPL;
585 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetColorRGB(IDirect3DRMMeshBuilder2* iface,
586 D3DVALUE red, D3DVALUE green,
587 D3DVALUE blue)
589 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
591 FIXME("(%p)->(%f,%f,%f): stub\n", This, red, green, blue);
593 return E_NOTIMPL;
596 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetColor(IDirect3DRMMeshBuilder2* iface,
597 D3DCOLOR color)
599 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
601 FIXME("(%p)->(%x): stub\n", This, color);
603 return E_NOTIMPL;
606 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetTexture(IDirect3DRMMeshBuilder2* iface,
607 LPDIRECT3DRMTEXTURE pTexture)
609 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
611 FIXME("(%p)->(%p): stub\n", This, pTexture);
613 return E_NOTIMPL;
616 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetMaterial(IDirect3DRMMeshBuilder2* iface,
617 LPDIRECT3DRMMATERIAL pMaterial)
619 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
621 FIXME("(%p)->(%p): stub\n", This, pMaterial);
623 return E_NOTIMPL;
626 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetTextureTopology(IDirect3DRMMeshBuilder2* iface,
627 BOOL wrap_u, BOOL wrap_v)
629 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
631 FIXME("(%p)->(%d,%d): stub\n", This, wrap_u, wrap_v);
633 return E_NOTIMPL;
636 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetQuality(IDirect3DRMMeshBuilder2* iface,
637 D3DRMRENDERQUALITY quality)
639 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
641 FIXME("(%p)->(%d): stub\n", This, quality);
643 return E_NOTIMPL;
646 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetPerspective(IDirect3DRMMeshBuilder2* iface,
647 BOOL enable)
649 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
651 FIXME("(%p)->(%d): stub\n", This, enable);
653 return E_NOTIMPL;
656 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetVertex(IDirect3DRMMeshBuilder2* iface,
657 DWORD index,
658 D3DVALUE x, D3DVALUE y, D3DVALUE z)
660 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
662 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
664 return E_NOTIMPL;
667 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetNormal(IDirect3DRMMeshBuilder2* iface,
668 DWORD index,
669 D3DVALUE x, D3DVALUE y, D3DVALUE z)
671 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
673 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
675 return E_NOTIMPL;
678 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetTextureCoordinates(IDirect3DRMMeshBuilder2* iface,
679 DWORD index,
680 D3DVALUE u, D3DVALUE v)
682 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
684 TRACE("(%p)->(%u,%f,%f)\n", This, index, u, v);
686 return IDirect3DRMMeshBuilder3_SetTextureCoordinates(&This->IDirect3DRMMeshBuilder3_iface,
687 index, u, v);
690 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetVertexColor(IDirect3DRMMeshBuilder2* iface,
691 DWORD index, D3DCOLOR color)
693 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
695 FIXME("(%p)->(%d,%x): stub\n", This, index, color);
697 return E_NOTIMPL;
700 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_SetVertexColorRGB(IDirect3DRMMeshBuilder2* iface,
701 DWORD index, D3DVALUE red,
702 D3DVALUE green, D3DVALUE blue)
704 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
706 FIXME("(%p)->(%d,%f,%f,%f): stub\n", This, index, red, green, blue);
708 return E_NOTIMPL;
711 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetFaces(IDirect3DRMMeshBuilder2* iface,
712 LPDIRECT3DRMFACEARRAY* pFaceArray)
714 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
716 FIXME("(%p)->(%p): stub\n", This, pFaceArray);
718 return E_NOTIMPL;
721 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetVertices(IDirect3DRMMeshBuilder2* iface,
722 DWORD *vcount, D3DVECTOR *vertices,
723 DWORD *ncount, D3DVECTOR *normals,
724 DWORD *face_data_size,
725 DWORD *face_data)
727 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
729 TRACE("(%p)->(%p,%p,%p,%p,%p,%p)\n", This, vcount, vertices, ncount, normals, face_data_size, face_data);
731 if (vcount)
732 *vcount = This->nb_vertices;
733 if (vertices && This->nb_vertices)
734 memcpy(vertices, This->pVertices, This->nb_vertices * sizeof(D3DVECTOR));
735 if (ncount)
736 *ncount = This->nb_normals;
737 if (normals && This->nb_normals)
738 memcpy(normals, This->pNormals, This->nb_normals * sizeof(D3DVECTOR));
739 if (face_data_size)
740 *face_data_size = This->face_data_size;
741 if (face_data && This->face_data_size)
742 memcpy(face_data, This->pFaceData, This->face_data_size * sizeof(DWORD));
744 return D3DRM_OK;
747 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetTextureCoordinates(IDirect3DRMMeshBuilder2* iface,
748 DWORD index,
749 D3DVALUE *u, D3DVALUE *v)
751 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
753 TRACE("(%p)->(%u,%p,%p)\n", This, index, u, v);
755 return IDirect3DRMMeshBuilder3_GetTextureCoordinates(&This->IDirect3DRMMeshBuilder3_iface,
756 index, u, v);
759 static int WINAPI IDirect3DRMMeshBuilder2Impl_AddVertex(IDirect3DRMMeshBuilder2* iface,
760 D3DVALUE x, D3DVALUE y, D3DVALUE z)
762 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
764 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
766 return 0;
769 static int WINAPI IDirect3DRMMeshBuilder2Impl_AddNormal(IDirect3DRMMeshBuilder2* iface,
770 D3DVALUE x, D3DVALUE y, D3DVALUE z)
772 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
774 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
776 return 0;
779 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_CreateFace(IDirect3DRMMeshBuilder2* iface,
780 LPDIRECT3DRMFACE* ppFace)
782 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
784 FIXME("(%p)->(%p): stub\n", This, ppFace);
786 return E_NOTIMPL;
789 static D3DRMRENDERQUALITY WINAPI IDirect3DRMMeshBuilder2Impl_GetQuality(IDirect3DRMMeshBuilder2* iface)
791 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
793 FIXME("(%p)->(): stub\n", This);
795 return 0;
798 static BOOL WINAPI IDirect3DRMMeshBuilder2Impl_GetPerspective(IDirect3DRMMeshBuilder2* iface)
800 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
802 FIXME("(%p)->(): stub\n", This);
804 return FALSE;
807 static int WINAPI IDirect3DRMMeshBuilder2Impl_GetFaceCount(IDirect3DRMMeshBuilder2* iface)
809 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
811 TRACE("(%p)->()\n", This);
813 return This->nb_faces;
816 static int WINAPI IDirect3DRMMeshBuilder2Impl_GetVertexCount(IDirect3DRMMeshBuilder2* iface)
818 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
820 TRACE("(%p)->()\n", This);
822 return This->nb_vertices;
825 static D3DCOLOR WINAPI IDirect3DRMMeshBuilder2Impl_GetVertexColor(IDirect3DRMMeshBuilder2* iface,
826 DWORD index)
828 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
830 FIXME("(%p)->(%d): stub\n", This, index);
832 return 0;
835 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_CreateMesh(IDirect3DRMMeshBuilder2* iface,
836 LPDIRECT3DRMMESH* ppMesh)
838 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
840 FIXME("(%p)->(%p): stub\n", This, ppMesh);
842 return E_NOTIMPL;
845 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GenerateNormals2(IDirect3DRMMeshBuilder2* iface,
846 D3DVALUE crease, DWORD dwFlags)
848 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
850 FIXME("(%p)->(%f,%u): stub\n", This, crease, dwFlags);
852 return E_NOTIMPL;
855 static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetFace(IDirect3DRMMeshBuilder2* iface,
856 DWORD index, LPDIRECT3DRMFACE* ppFace)
858 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
860 FIXME("(%p)->(%u,%p): stub\n", This, index, ppFace);
862 return E_NOTIMPL;
865 static const struct IDirect3DRMMeshBuilder2Vtbl Direct3DRMMeshBuilder2_Vtbl =
867 /*** IUnknown methods ***/
868 IDirect3DRMMeshBuilder2Impl_QueryInterface,
869 IDirect3DRMMeshBuilder2Impl_AddRef,
870 IDirect3DRMMeshBuilder2Impl_Release,
871 /*** IDirect3DRMObject methods ***/
872 IDirect3DRMMeshBuilder2Impl_Clone,
873 IDirect3DRMMeshBuilder2Impl_AddDestroyCallback,
874 IDirect3DRMMeshBuilder2Impl_DeleteDestroyCallback,
875 IDirect3DRMMeshBuilder2Impl_SetAppData,
876 IDirect3DRMMeshBuilder2Impl_GetAppData,
877 IDirect3DRMMeshBuilder2Impl_SetName,
878 IDirect3DRMMeshBuilder2Impl_GetName,
879 IDirect3DRMMeshBuilder2Impl_GetClassName,
880 /*** IDirect3DRMMeshBuilder methods ***/
881 IDirect3DRMMeshBuilder2Impl_Load,
882 IDirect3DRMMeshBuilder2Impl_Save,
883 IDirect3DRMMeshBuilder2Impl_Scale,
884 IDirect3DRMMeshBuilder2Impl_Translate,
885 IDirect3DRMMeshBuilder2Impl_SetColorSource,
886 IDirect3DRMMeshBuilder2Impl_GetBox,
887 IDirect3DRMMeshBuilder2Impl_GenerateNormals,
888 IDirect3DRMMeshBuilder2Impl_GetColorSource,
889 IDirect3DRMMeshBuilder2Impl_AddMesh,
890 IDirect3DRMMeshBuilder2Impl_AddMeshBuilder,
891 IDirect3DRMMeshBuilder2Impl_AddFrame,
892 IDirect3DRMMeshBuilder2Impl_AddFace,
893 IDirect3DRMMeshBuilder2Impl_AddFaces,
894 IDirect3DRMMeshBuilder2Impl_ReserveSpace,
895 IDirect3DRMMeshBuilder2Impl_SetColorRGB,
896 IDirect3DRMMeshBuilder2Impl_SetColor,
897 IDirect3DRMMeshBuilder2Impl_SetTexture,
898 IDirect3DRMMeshBuilder2Impl_SetMaterial,
899 IDirect3DRMMeshBuilder2Impl_SetTextureTopology,
900 IDirect3DRMMeshBuilder2Impl_SetQuality,
901 IDirect3DRMMeshBuilder2Impl_SetPerspective,
902 IDirect3DRMMeshBuilder2Impl_SetVertex,
903 IDirect3DRMMeshBuilder2Impl_SetNormal,
904 IDirect3DRMMeshBuilder2Impl_SetTextureCoordinates,
905 IDirect3DRMMeshBuilder2Impl_SetVertexColor,
906 IDirect3DRMMeshBuilder2Impl_SetVertexColorRGB,
907 IDirect3DRMMeshBuilder2Impl_GetFaces,
908 IDirect3DRMMeshBuilder2Impl_GetVertices,
909 IDirect3DRMMeshBuilder2Impl_GetTextureCoordinates,
910 IDirect3DRMMeshBuilder2Impl_AddVertex,
911 IDirect3DRMMeshBuilder2Impl_AddNormal,
912 IDirect3DRMMeshBuilder2Impl_CreateFace,
913 IDirect3DRMMeshBuilder2Impl_GetQuality,
914 IDirect3DRMMeshBuilder2Impl_GetPerspective,
915 IDirect3DRMMeshBuilder2Impl_GetFaceCount,
916 IDirect3DRMMeshBuilder2Impl_GetVertexCount,
917 IDirect3DRMMeshBuilder2Impl_GetVertexColor,
918 IDirect3DRMMeshBuilder2Impl_CreateMesh,
919 /*** IDirect3DRMMeshBuilder2 methods ***/
920 IDirect3DRMMeshBuilder2Impl_GenerateNormals2,
921 IDirect3DRMMeshBuilder2Impl_GetFace
925 /*** IUnknown methods ***/
926 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_QueryInterface(IDirect3DRMMeshBuilder3* iface,
927 REFIID riid, void** ppvObject)
929 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
930 return IDirect3DRMMeshBuilder2_QueryInterface(&This->IDirect3DRMMeshBuilder2_iface, riid, ppvObject);
933 static ULONG WINAPI IDirect3DRMMeshBuilder3Impl_AddRef(IDirect3DRMMeshBuilder3* iface)
935 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
936 return IDirect3DRMMeshBuilder2_AddRef(&This->IDirect3DRMMeshBuilder2_iface);
939 static ULONG WINAPI IDirect3DRMMeshBuilder3Impl_Release(IDirect3DRMMeshBuilder3* iface)
941 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
942 return IDirect3DRMMeshBuilder2_Release(&This->IDirect3DRMMeshBuilder2_iface);
945 /*** IDirect3DRMObject methods ***/
946 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Clone(IDirect3DRMMeshBuilder3* iface,
947 LPUNKNOWN pUnkOuter, REFIID riid,
948 LPVOID *ppvObj)
950 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
952 FIXME("(%p)->(%p,%s,%p): stub\n", This, pUnkOuter, debugstr_guid(riid), ppvObj);
954 return E_NOTIMPL;
957 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddDestroyCallback(IDirect3DRMMeshBuilder3* iface,
958 D3DRMOBJECTCALLBACK cb,
959 LPVOID argument)
961 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
963 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
965 return E_NOTIMPL;
968 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_DeleteDestroyCallback(IDirect3DRMMeshBuilder3* iface,
969 D3DRMOBJECTCALLBACK cb,
970 LPVOID argument)
972 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
974 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
976 return E_NOTIMPL;
979 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetAppData(IDirect3DRMMeshBuilder3* iface,
980 DWORD data)
982 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
984 FIXME("(%p)->(%u): stub\n", This, data);
986 return E_NOTIMPL;
989 static DWORD WINAPI IDirect3DRMMeshBuilder3Impl_GetAppData(IDirect3DRMMeshBuilder3* iface)
991 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
993 FIXME("(%p)->(): stub\n", This);
995 return 0;
998 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetName(IDirect3DRMMeshBuilder3* iface,
999 LPCSTR pName)
1001 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1003 FIXME("(%p)->(%s): stub\n", This, pName);
1005 return E_NOTIMPL;
1008 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetName(IDirect3DRMMeshBuilder3* iface,
1009 LPDWORD lpdwSize, LPSTR lpName)
1011 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1013 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
1015 return E_NOTIMPL;
1018 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetClassName(IDirect3DRMMeshBuilder3* iface,
1019 LPDWORD lpdwSize, LPSTR lpName)
1021 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1023 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
1025 return E_NOTIMPL;
1028 /*** IDirect3DRMMeshBuilder3 methods ***/
1029 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Load(IDirect3DRMMeshBuilder3* iface,
1030 LPVOID filename, LPVOID name,
1031 D3DRMLOADOPTIONS loadflags,
1032 D3DRMLOADTEXTURE3CALLBACK cb, LPVOID arg)
1034 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1035 DXFILELOADOPTIONS load_options;
1036 LPDIRECTXFILE pDXFile = NULL;
1037 LPDIRECTXFILEENUMOBJECT pEnumObject = NULL;
1038 LPDIRECTXFILEDATA pData = NULL;
1039 LPDIRECTXFILEOBJECT pObject = NULL;
1040 LPDIRECTXFILEDATA pData2 = NULL;
1041 const GUID* pGuid;
1042 DWORD size;
1043 Header* pHeader;
1044 LPBYTE ptr;
1045 HRESULT hr;
1046 HRESULT ret = D3DRMERR_BADOBJECT;
1047 DWORD* faces_vertex_idx_data = NULL;
1048 DWORD* faces_vertex_idx_ptr;
1049 DWORD faces_vertex_idx_size;
1050 DWORD* faces_normal_idx_data = NULL;
1051 DWORD* faces_normal_idx_ptr = NULL;
1052 DWORD* faces_data_ptr;
1053 DWORD faces_data_size = 0;
1054 DWORD i;
1056 TRACE("(%p)->(%p,%p,%x,%p,%p)\n", This, filename, name, loadflags, cb, arg);
1058 /* First free allocated buffers of previous mesh data */
1059 HeapFree(GetProcessHeap(), 0, This->pVertices);
1060 This->pVertices = NULL;
1061 HeapFree(GetProcessHeap(), 0, This->pNormals);
1062 This->pNormals = NULL;
1063 HeapFree(GetProcessHeap(), 0, This->pFaceData);
1064 This->pFaceData = NULL;
1065 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
1066 This->pCoords2d = NULL;
1068 if (loadflags == D3DRMLOAD_FROMMEMORY)
1070 load_options = DXFILELOAD_FROMMEMORY;
1072 else
1074 FIXME("Load options %d not supported yet\n", loadflags);
1075 return E_NOTIMPL;
1078 hr = DirectXFileCreate(&pDXFile);
1079 if (hr != DXFILE_OK)
1080 goto end;
1082 hr = IDirectXFile_RegisterTemplates(pDXFile, templates, strlen(templates));
1083 if (hr != DXFILE_OK)
1084 goto end;
1086 hr = IDirectXFile_CreateEnumObject(pDXFile, filename, load_options, &pEnumObject);
1087 if (hr != DXFILE_OK)
1088 goto end;
1090 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
1091 if (hr != DXFILE_OK)
1092 goto end;
1094 hr = IDirectXFileData_GetType(pData, &pGuid);
1095 if (hr != DXFILE_OK)
1096 goto end;
1098 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
1100 if (!IsEqualGUID(pGuid, &TID_DXFILEHeader))
1102 ret = D3DRMERR_BADFILE;
1103 goto end;
1106 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&pHeader);
1107 if ((hr != DXFILE_OK) || (size != sizeof(Header)))
1108 goto end;
1110 TRACE("Version is %d %d %d\n", pHeader->major, pHeader->minor, pHeader->flags);
1112 /* Version must be 1.0.x */
1113 if ((pHeader->major != 1) || (pHeader->minor != 0))
1115 ret = D3DRMERR_BADFILE;
1116 goto end;
1119 IDirectXFileData_Release(pData);
1120 pData = NULL;
1122 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
1123 if (hr != DXFILE_OK)
1125 ret = D3DRMERR_NOTFOUND;
1126 goto end;
1129 hr = IDirectXFileData_GetType(pData, &pGuid);
1130 if (hr != DXFILE_OK)
1131 goto end;
1133 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
1135 if (!IsEqualGUID(pGuid, &TID_D3DRMMesh))
1137 ret = D3DRMERR_NOTFOUND;
1138 goto end;
1141 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
1142 if (hr != DXFILE_OK)
1143 goto end;
1145 This->nb_vertices = *(DWORD*)ptr;
1146 This->nb_faces = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR));
1147 faces_vertex_idx_size = size - sizeof(DWORD) - This->nb_vertices * sizeof(D3DVECTOR) - sizeof(DWORD);
1148 faces_vertex_idx_ptr = (DWORD*)(ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD));
1150 TRACE("Mesh: nb_vertices = %d, nb_faces = %d, faces_vertex_idx_size = %d\n", This->nb_vertices, This->nb_faces, faces_vertex_idx_size);
1152 This->pVertices = HeapAlloc(GetProcessHeap(), 0, This->nb_vertices * sizeof(D3DVECTOR));
1153 memcpy(This->pVertices, ptr + sizeof(DWORD), This->nb_vertices * sizeof(D3DVECTOR));
1155 faces_vertex_idx_ptr = faces_vertex_idx_data = HeapAlloc(GetProcessHeap(), 0, faces_vertex_idx_size);
1156 memcpy(faces_vertex_idx_data, ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD), faces_vertex_idx_size);
1158 /* Each vertex index will have its normal index counterpart so just allocate twice the size */
1159 This->pFaceData = HeapAlloc(GetProcessHeap(), 0, faces_vertex_idx_size*2);
1160 faces_data_ptr = (DWORD*)This->pFaceData;
1162 while (1)
1164 hr = IDirectXFileData_GetNextObject(pData, &pObject);
1165 if (hr == DXFILEERR_NOMOREOBJECTS)
1167 TRACE("No more object\n");
1168 break;
1170 if (hr != DXFILE_OK)
1171 goto end;
1173 hr = IDirectXFileObject_QueryInterface(pObject, &IID_IDirectXFileData, (void**)&pData2);
1174 IDirectXFileObject_Release(pObject);
1175 if (hr != DXFILE_OK)
1176 goto end;
1178 hr = IDirectXFileData_GetType(pData2, &pGuid);
1179 if (hr != DXFILE_OK)
1180 goto end;
1182 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
1184 if (IsEqualGUID(pGuid, &TID_D3DRMMeshNormals))
1186 DWORD nb_faces_normals;
1187 DWORD faces_normal_idx_size;
1189 hr = IDirectXFileData_GetData(pData2, NULL, &size, (void**)&ptr);
1190 if (hr != DXFILE_OK)
1191 goto end;
1193 This->nb_normals = *(DWORD*)ptr;
1194 nb_faces_normals = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_normals * sizeof(D3DVECTOR));
1196 TRACE("MeshNormals: nb_normals = %d, nb_faces_normals = %d\n", This->nb_normals, nb_faces_normals);
1197 if (nb_faces_normals != This->nb_faces)
1198 WARN("nb_face_normals (%d) != nb_faces (%d)\n", nb_faces_normals, This->nb_normals);
1200 This->pNormals = HeapAlloc(GetProcessHeap(), 0, This->nb_normals * sizeof(D3DVECTOR));
1201 memcpy(This->pNormals, ptr + sizeof(DWORD), This->nb_normals * sizeof(D3DVECTOR));
1203 faces_normal_idx_size = size - (2*sizeof(DWORD) + This->nb_normals * sizeof(D3DVECTOR));
1204 faces_normal_idx_ptr = faces_normal_idx_data = HeapAlloc(GetProcessHeap(), 0, faces_normal_idx_size);
1205 memcpy(faces_normal_idx_data, ptr + sizeof(DWORD) + This->nb_normals * sizeof(D3DVECTOR) + sizeof(DWORD), faces_normal_idx_size);
1207 else if (IsEqualGUID(pGuid, &TID_D3DRMMeshTextureCoords))
1209 hr = IDirectXFileData_GetData(pData2, NULL, &size, (void**)&ptr);
1210 if (hr != DXFILE_OK)
1211 goto end;
1213 This->nb_coords2d = *(DWORD*)ptr;
1215 TRACE("MeshTextureCoords: nb_coords2d = %d\n", This->nb_coords2d);
1217 This->pCoords2d = HeapAlloc(GetProcessHeap(), 0, This->nb_coords2d * sizeof(Coords2d));
1218 memcpy(This->pCoords2d, ptr + sizeof(DWORD), This->nb_coords2d * sizeof(Coords2d));
1221 else if (IsEqualGUID(pGuid, &TID_D3DRMMeshMaterialList))
1223 FIXME("MeshMaterialList not supported yet, ignoring...\n");
1225 else
1227 FIXME("Unknown GUID %s, ignoring...\n", debugstr_guid(pGuid));
1230 IDirectXFileData_Release(pData2);
1231 pData2 = NULL;
1234 for (i = 0; i < This->nb_faces; i++)
1236 DWORD j;
1237 DWORD nb_face_indexes;
1239 if (faces_vertex_idx_size < sizeof(DWORD))
1240 WARN("Not enough data to read number of indices of face %d\n", i);
1242 nb_face_indexes = *(faces_data_ptr + faces_data_size++) = *(faces_vertex_idx_ptr++);
1243 faces_vertex_idx_size--;
1244 if (faces_normal_idx_data && (*(faces_normal_idx_ptr++) != nb_face_indexes))
1245 WARN("Faces indices number mismatch\n");
1247 if (faces_vertex_idx_size < (nb_face_indexes * sizeof(DWORD)))
1248 WARN("Not enough data to read all indices of face %d\n", i);
1250 for (j = 0; j < nb_face_indexes; j++)
1252 /* Copy vertex index */
1253 *(faces_data_ptr + faces_data_size++) = *(faces_vertex_idx_ptr++);
1254 /* Copy normal index */
1255 if (faces_normal_idx_data)
1257 /* Read from x file */
1258 *(faces_data_ptr + faces_data_size++) = *(faces_normal_idx_ptr++);
1260 else
1262 FIXME("No normal available, generate a fake normal index\n");
1263 /* Must be generated, put 0 for now */
1264 *(faces_data_ptr + faces_data_size++) = 0;
1267 faces_vertex_idx_size -= nb_face_indexes;
1270 /* Last DWORD must be 0 */
1271 *(faces_data_ptr + faces_data_size++) = 0;
1273 /* Set size (in number of DWORD) of all faces data */
1274 This->face_data_size = faces_data_size;
1276 /* If there is no texture coordinates, generate default texture coordinates (0.0f, 0.0f) for each vertex */
1277 if (!This->pCoords2d)
1279 This->nb_coords2d = This->nb_vertices;
1280 This->pCoords2d = HeapAlloc(GetProcessHeap(), 0, This->nb_coords2d * sizeof(Coords2d));
1281 for (i = 0; i < This->nb_coords2d; i++)
1283 This->pCoords2d[i].u = 0.0f;
1284 This->pCoords2d[i].v = 0.0f;
1288 ret = D3DRM_OK;
1290 end:
1291 HeapFree(GetProcessHeap(), 0, faces_normal_idx_data);
1292 HeapFree(GetProcessHeap(), 0, faces_vertex_idx_data);
1293 if (pData2)
1294 IDirectXFileData_Release(pData2);
1295 if (pData)
1296 IDirectXFileData_Release(pData);
1297 if (pEnumObject)
1298 IDirectXFileEnumObject_Release(pEnumObject);
1299 if (pDXFile)
1300 IDirectXFile_Release(pDXFile);
1302 if (ret != D3DRM_OK)
1304 /* Clean mesh data */
1305 This->nb_vertices = 0;
1306 This->nb_normals = 0;
1307 This->nb_faces = 0;
1308 This->face_data_size = 0;
1309 This->nb_coords2d = 0;
1310 HeapFree(GetProcessHeap(), 0, This->pVertices);
1311 This->pVertices = NULL;
1312 HeapFree(GetProcessHeap(), 0, This->pNormals);
1313 This->pNormals = NULL;
1314 HeapFree(GetProcessHeap(), 0, This->pFaceData);
1315 This->pFaceData = NULL;
1316 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
1317 This->pCoords2d = NULL;
1320 return ret;
1323 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Save(IDirect3DRMMeshBuilder3* iface,
1324 const char* filename, D3DRMXOFFORMAT format,
1325 D3DRMSAVEOPTIONS save)
1327 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1329 FIXME("(%p)->(%s,%d,%d): stub\n", This, filename, format, save);
1331 return E_NOTIMPL;
1334 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Scale(IDirect3DRMMeshBuilder3* iface,
1335 D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
1337 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1339 FIXME("(%p)->(%f,%f,%f): stub\n", This, sx, sy, sz);
1341 return E_NOTIMPL;
1344 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Translate(IDirect3DRMMeshBuilder3* iface,
1345 D3DVALUE tx, D3DVALUE ty, D3DVALUE tz)
1347 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1349 FIXME("(%p)->(%f,%f,%f): stub\n", This, tx, ty, tz);
1351 return E_NOTIMPL;
1354 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetColorSource(IDirect3DRMMeshBuilder3* iface,
1355 D3DRMCOLORSOURCE color)
1357 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1359 FIXME("(%p)->(%x): stub\n", This, color);
1361 return E_NOTIMPL;
1364 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetBox(IDirect3DRMMeshBuilder3* iface,
1365 D3DRMBOX* box)
1367 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1369 FIXME("(%p)->(%p): stub\n", This, box);
1371 return E_NOTIMPL;
1374 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GenerateNormals(IDirect3DRMMeshBuilder3* iface,
1375 D3DVALUE crease, DWORD flags)
1377 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1379 FIXME("(%p)->(%f,%u): stub\n", This, crease, flags);
1381 return E_NOTIMPL;
1384 static D3DRMCOLORSOURCE WINAPI IDirect3DRMMeshBuilder3Impl_GetColorSource(IDirect3DRMMeshBuilder3* iface)
1386 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1388 FIXME("(%p)->(): stub\n", This);
1390 return E_NOTIMPL;
1393 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddMesh(IDirect3DRMMeshBuilder3* iface,
1394 LPDIRECT3DRMMESH Mesh)
1396 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1398 FIXME("(%p)->(%p): stub\n", This, Mesh);
1400 return E_NOTIMPL;
1403 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddMeshBuilder(IDirect3DRMMeshBuilder3* iface,
1404 LPDIRECT3DRMMESHBUILDER3 MeshBuilder,
1405 DWORD flags)
1407 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1409 FIXME("(%p)->(%p,%u): stub\n", This, MeshBuilder, flags);
1411 return E_NOTIMPL;
1414 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddFrame(IDirect3DRMMeshBuilder3* iface,
1415 LPDIRECT3DRMFRAME3 Frame)
1417 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1419 FIXME("(%p)->(%p): stub\n", This, Frame);
1421 return E_NOTIMPL;
1424 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddFace(IDirect3DRMMeshBuilder3* iface,
1425 LPDIRECT3DRMFACE2 Face)
1427 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1429 FIXME("(%p)->(%p): stub\n", This, Face);
1431 return E_NOTIMPL;
1434 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddFaces(IDirect3DRMMeshBuilder3* iface,
1435 DWORD vcount, D3DVECTOR* vertices,
1436 DWORD ncount, D3DVECTOR* normals,
1437 DWORD* data,
1438 LPDIRECT3DRMFACEARRAY* FaceArray)
1440 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1442 FIXME("(%p)->(%d,%p,%d,%p,%p,%p): stub\n", This, vcount, vertices, ncount,
1443 normals, data, FaceArray);
1445 return E_NOTIMPL;
1448 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_ReserveSpace(IDirect3DRMMeshBuilder3* iface,
1449 DWORD vertex_Count,
1450 DWORD normal_count,
1451 DWORD face_count)
1453 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1455 FIXME("(%p)->(%d,%d,%d): stub\n", This, vertex_Count, normal_count, face_count);
1457 return E_NOTIMPL;
1460 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetColorRGB(IDirect3DRMMeshBuilder3* iface,
1461 D3DVALUE red, D3DVALUE green,
1462 D3DVALUE blue)
1464 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1466 FIXME("(%p)->(%f,%f,%f): stub\n", This, red, green, blue);
1468 return E_NOTIMPL;
1471 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetColor(IDirect3DRMMeshBuilder3* iface,
1472 D3DCOLOR color)
1474 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1476 FIXME("(%p)->(%x): stub\n", This, color);
1478 return E_NOTIMPL;
1481 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetTexture(IDirect3DRMMeshBuilder3* iface,
1482 LPDIRECT3DRMTEXTURE3 texture)
1484 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1486 FIXME("(%p)->(%p): stub\n", This, texture);
1488 return E_NOTIMPL;
1491 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetMaterial(IDirect3DRMMeshBuilder3* iface,
1492 LPDIRECT3DRMMATERIAL2 material)
1494 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1496 FIXME("(%p)->(%p): stub\n", This, material);
1498 return E_NOTIMPL;
1501 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetTextureTopology(IDirect3DRMMeshBuilder3* iface,
1502 BOOL wrap_u, BOOL wrap_v)
1504 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1506 FIXME("(%p)->(%d,%d): stub\n", This, wrap_u, wrap_v);
1508 return E_NOTIMPL;
1511 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetQuality(IDirect3DRMMeshBuilder3* iface,
1512 D3DRMRENDERQUALITY quality)
1514 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1516 FIXME("(%p)->(%d): stub\n", This, quality);
1518 return E_NOTIMPL;
1521 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetPerspective(IDirect3DRMMeshBuilder3* iface,
1522 BOOL enable)
1524 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1526 FIXME("(%p)->(%d): stub\n", This, enable);
1528 return E_NOTIMPL;
1531 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetVertex(IDirect3DRMMeshBuilder3* iface,
1532 DWORD index,
1533 D3DVALUE x, D3DVALUE y, D3DVALUE z)
1535 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1537 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
1539 return E_NOTIMPL;
1542 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetNormal(IDirect3DRMMeshBuilder3* iface,
1543 DWORD index,
1544 D3DVALUE x, D3DVALUE y, D3DVALUE z)
1546 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1548 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
1550 return E_NOTIMPL;
1553 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetTextureCoordinates(IDirect3DRMMeshBuilder3* iface,
1554 DWORD index, D3DVALUE u,
1555 D3DVALUE v)
1557 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1559 TRACE("(%p)->(%u,%f,%f)\n", This, index, u, v);
1561 if (index >= This->nb_coords2d)
1562 return D3DRMERR_BADVALUE;
1564 This->pCoords2d[index].u = u;
1565 This->pCoords2d[index].v = v;
1567 return D3DRM_OK;
1570 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetVertexColor(IDirect3DRMMeshBuilder3* iface,
1571 DWORD index, D3DCOLOR color)
1573 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1575 FIXME("(%p)->(%d,%x): stub\n", This, index, color);
1577 return E_NOTIMPL;
1580 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetVertexColorRGB(IDirect3DRMMeshBuilder3* iface,
1581 DWORD index,
1582 D3DVALUE red, D3DVALUE green,
1583 D3DVALUE blue)
1585 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1587 FIXME("(%p)->(%d,%f,%f,%f): stub\n", This, index, red, green, blue);
1589 return E_NOTIMPL;
1592 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetFaces(IDirect3DRMMeshBuilder3* iface,
1593 LPDIRECT3DRMFACEARRAY* FaceArray)
1595 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1597 FIXME("(%p)->(%p): stub\n", This, FaceArray);
1599 return E_NOTIMPL;
1602 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetGeometry(IDirect3DRMMeshBuilder3* iface,
1603 DWORD* vcount, D3DVECTOR* vertices,
1604 DWORD* ncount, D3DVECTOR* normals,
1605 DWORD* face_data_size,
1606 DWORD* face_data)
1608 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1610 FIXME("(%p)->(%p,%p,%p,%p,%p,%p): stub\n", This, vcount, vertices, ncount, normals,
1611 face_data_size, face_data);
1613 return E_NOTIMPL;
1616 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetTextureCoordinates(IDirect3DRMMeshBuilder3* iface,
1617 DWORD index, D3DVALUE* u,
1618 D3DVALUE* v)
1620 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1622 TRACE("(%p)->(%d,%p,%p)\n", This, index, u, v);
1624 if (index >= This->nb_coords2d)
1625 return D3DRMERR_BADVALUE;
1627 *u = This->pCoords2d[index].u;
1628 *v = This->pCoords2d[index].v;
1630 return D3DRM_OK;
1634 static int WINAPI IDirect3DRMMeshBuilder3Impl_AddVertex(IDirect3DRMMeshBuilder3* iface,
1635 D3DVALUE x, D3DVALUE y, D3DVALUE z)
1637 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1639 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
1641 return 0;
1644 static int WINAPI IDirect3DRMMeshBuilder3Impl_AddNormal(IDirect3DRMMeshBuilder3* iface,
1645 D3DVALUE x, D3DVALUE y, D3DVALUE z)
1647 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1649 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
1651 return 0;
1654 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_CreateFace(IDirect3DRMMeshBuilder3* iface,
1655 LPDIRECT3DRMFACE2* Face)
1657 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1659 FIXME("(%p)->(%p): stub\n", This, Face);
1661 return E_NOTIMPL;
1664 static D3DRMRENDERQUALITY WINAPI IDirect3DRMMeshBuilder3Impl_GetQuality(IDirect3DRMMeshBuilder3* iface)
1666 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1668 FIXME("(%p)->(): stub\n", This);
1670 return 0;
1673 static BOOL WINAPI IDirect3DRMMeshBuilder3Impl_GetPerspective(IDirect3DRMMeshBuilder3* iface)
1675 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1677 FIXME("(%p)->(): stub\n", This);
1679 return FALSE;
1682 static int WINAPI IDirect3DRMMeshBuilder3Impl_GetFaceCount(IDirect3DRMMeshBuilder3* iface)
1684 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1686 TRACE("(%p)->()\n", This);
1688 return This->nb_faces;
1691 static int WINAPI IDirect3DRMMeshBuilder3Impl_GetVertexCount(IDirect3DRMMeshBuilder3* iface)
1693 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1695 TRACE("(%p)->()\n", This);
1697 return This->nb_vertices;
1700 static D3DCOLOR WINAPI IDirect3DRMMeshBuilder3Impl_GetVertexColor(IDirect3DRMMeshBuilder3* iface,
1701 DWORD index)
1703 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1705 FIXME("(%p)->(%d): stub\n", This, index);
1707 return 0;
1710 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_CreateMesh(IDirect3DRMMeshBuilder3* iface,
1711 LPDIRECT3DRMMESH* Mesh)
1713 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1715 FIXME("(%p)->(%p): stub\n", This, Mesh);
1717 return E_NOTIMPL;
1720 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetFace(IDirect3DRMMeshBuilder3* iface,
1721 DWORD index, LPDIRECT3DRMFACE2* Face)
1723 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1725 FIXME("(%p)->(%u,%p): stub\n", This, index, Face);
1727 return E_NOTIMPL;
1730 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetVertex(IDirect3DRMMeshBuilder3* iface,
1731 DWORD index, LPD3DVECTOR vector)
1733 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1735 FIXME("(%p)->(%u,%p): stub\n", This, index, vector);
1737 return E_NOTIMPL;
1740 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetNormal(IDirect3DRMMeshBuilder3* iface,
1741 DWORD index, LPD3DVECTOR vector)
1743 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1745 FIXME("(%p)->(%u,%p): stub\n", This, index, vector);
1747 return E_NOTIMPL;
1750 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_DeleteVertices(IDirect3DRMMeshBuilder3* iface,
1751 DWORD IndexFirst, DWORD count)
1753 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1755 FIXME("(%p)->(%u,%u): stub\n", This, IndexFirst, count);
1757 return E_NOTIMPL;
1760 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_DeleteNormals(IDirect3DRMMeshBuilder3* iface,
1761 DWORD IndexFirst, DWORD count)
1763 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1765 FIXME("(%p)->(%u,%u): stub\n", This, IndexFirst, count);
1767 return E_NOTIMPL;
1770 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_DeleteFace(IDirect3DRMMeshBuilder3* iface,
1771 LPDIRECT3DRMFACE2 Face)
1773 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1775 FIXME("(%p)->(%p): stub\n", This, Face);
1777 return E_NOTIMPL;
1780 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Empty(IDirect3DRMMeshBuilder3* iface, DWORD flags)
1782 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1784 FIXME("(%p)->(%u): stub\n", This, flags);
1786 return E_NOTIMPL;
1789 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Optimize(IDirect3DRMMeshBuilder3* iface,
1790 DWORD flags)
1792 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1794 FIXME("(%p)->(%u): stub\n", This, flags);
1796 return E_NOTIMPL;
1799 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddFacesIndexed(IDirect3DRMMeshBuilder3* iface,
1800 DWORD flags, DWORD* indices,
1801 DWORD* IndexFirst, DWORD* count)
1803 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1805 FIXME("(%p)->(%u,%p,%p,%p): stub\n", This, flags, indices, IndexFirst, count);
1807 return E_NOTIMPL;
1810 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_CreateSubMesh(IDirect3DRMMeshBuilder3* iface,
1811 LPUNKNOWN *unkwn)
1813 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1815 FIXME("(%p)->(%p): stub\n", This, unkwn);
1817 return E_NOTIMPL;
1820 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetParentMesh(IDirect3DRMMeshBuilder3* iface,
1821 DWORD flags, LPUNKNOWN *unkwn)
1823 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1825 FIXME("(%p)->(%u,%p): stub\n", This, flags, unkwn);
1827 return E_NOTIMPL;
1830 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetSubMeshes(IDirect3DRMMeshBuilder3* iface,
1831 LPDWORD count, LPUNKNOWN *unkwn)
1833 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1835 FIXME("(%p)->(%p,%p): stub\n", This, count, unkwn);
1837 return E_NOTIMPL;
1840 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_DeleteSubMesh(IDirect3DRMMeshBuilder3* iface,
1841 LPUNKNOWN unkwn)
1843 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1845 FIXME("(%p)->(%p): stub\n", This, unkwn);
1847 return E_NOTIMPL;
1850 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Enable(IDirect3DRMMeshBuilder3* iface,
1851 DWORD index)
1853 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1855 FIXME("(%p)->(%u): stub\n", This, index);
1857 return E_NOTIMPL;
1860 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetEnable(IDirect3DRMMeshBuilder3* iface,
1861 DWORD* indices)
1863 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1865 FIXME("(%p)->(%p): stub\n", This, indices);
1867 return E_NOTIMPL;
1870 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_AddTriangles(IDirect3DRMMeshBuilder3* iface,
1871 DWORD flags, DWORD format,
1872 DWORD VertexCount, LPVOID data)
1874 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1876 FIXME("(%p)->(%u,%u,%u,%p): stub\n", This, flags, format, VertexCount, data);
1878 return E_NOTIMPL;
1881 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetVertices(IDirect3DRMMeshBuilder3* iface,
1882 DWORD IndexFirst, DWORD count,
1883 LPD3DVECTOR vector)
1885 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1887 FIXME("(%p)->(%u,%u,%p): stub\n", This, IndexFirst, count, vector);
1889 return E_NOTIMPL;
1892 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetVertices(IDirect3DRMMeshBuilder3* iface,
1893 DWORD IndexFirst, LPDWORD vcount,
1894 LPD3DVECTOR vertices)
1896 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1897 DWORD count = This->nb_vertices - IndexFirst;
1899 TRACE("(%p)->(%u,%p,%p)\n", This, IndexFirst, vcount, vertices);
1901 if (vcount)
1902 *vcount = count;
1903 if (vertices && This->nb_vertices)
1904 memcpy(vertices, This->pVertices + IndexFirst, count * sizeof(D3DVECTOR));
1906 return D3DRM_OK;
1909 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetNormals(IDirect3DRMMeshBuilder3* iface,
1910 DWORD IndexFirst, DWORD count,
1911 LPD3DVECTOR vector)
1913 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1915 FIXME("(%p)->(%u,%u,%p): stub\n", This, IndexFirst, count, vector);
1917 return E_NOTIMPL;
1920 static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetNormals(IDirect3DRMMeshBuilder3* iface,
1921 DWORD IndexFirst, LPDWORD count,
1922 LPD3DVECTOR vector)
1924 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1926 FIXME("(%p)->(%u,%p,%p): stub\n", This, IndexFirst, count, vector);
1928 return E_NOTIMPL;
1931 static int WINAPI IDirect3DRMMeshBuilder3Impl_GetNormalCount(IDirect3DRMMeshBuilder3* iface)
1933 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
1935 FIXME("(%p)->(): stub\n", This);
1937 return E_NOTIMPL;
1940 static const struct IDirect3DRMMeshBuilder3Vtbl Direct3DRMMeshBuilder3_Vtbl =
1942 /*** IUnknown methods ***/
1943 IDirect3DRMMeshBuilder3Impl_QueryInterface,
1944 IDirect3DRMMeshBuilder3Impl_AddRef,
1945 IDirect3DRMMeshBuilder3Impl_Release,
1946 /*** IDirect3DRMObject methods ***/
1947 IDirect3DRMMeshBuilder3Impl_Clone,
1948 IDirect3DRMMeshBuilder3Impl_AddDestroyCallback,
1949 IDirect3DRMMeshBuilder3Impl_DeleteDestroyCallback,
1950 IDirect3DRMMeshBuilder3Impl_SetAppData,
1951 IDirect3DRMMeshBuilder3Impl_GetAppData,
1952 IDirect3DRMMeshBuilder3Impl_SetName,
1953 IDirect3DRMMeshBuilder3Impl_GetName,
1954 IDirect3DRMMeshBuilder3Impl_GetClassName,
1955 /*** IDirect3DRMMeshBuilder3 methods ***/
1956 IDirect3DRMMeshBuilder3Impl_Load,
1957 IDirect3DRMMeshBuilder3Impl_Save,
1958 IDirect3DRMMeshBuilder3Impl_Scale,
1959 IDirect3DRMMeshBuilder3Impl_Translate,
1960 IDirect3DRMMeshBuilder3Impl_SetColorSource,
1961 IDirect3DRMMeshBuilder3Impl_GetBox,
1962 IDirect3DRMMeshBuilder3Impl_GenerateNormals,
1963 IDirect3DRMMeshBuilder3Impl_GetColorSource,
1964 IDirect3DRMMeshBuilder3Impl_AddMesh,
1965 IDirect3DRMMeshBuilder3Impl_AddMeshBuilder,
1966 IDirect3DRMMeshBuilder3Impl_AddFrame,
1967 IDirect3DRMMeshBuilder3Impl_AddFace,
1968 IDirect3DRMMeshBuilder3Impl_AddFaces,
1969 IDirect3DRMMeshBuilder3Impl_ReserveSpace,
1970 IDirect3DRMMeshBuilder3Impl_SetColorRGB,
1971 IDirect3DRMMeshBuilder3Impl_SetColor,
1972 IDirect3DRMMeshBuilder3Impl_SetTexture,
1973 IDirect3DRMMeshBuilder3Impl_SetMaterial,
1974 IDirect3DRMMeshBuilder3Impl_SetTextureTopology,
1975 IDirect3DRMMeshBuilder3Impl_SetQuality,
1976 IDirect3DRMMeshBuilder3Impl_SetPerspective,
1977 IDirect3DRMMeshBuilder3Impl_SetVertex,
1978 IDirect3DRMMeshBuilder3Impl_SetNormal,
1979 IDirect3DRMMeshBuilder3Impl_SetTextureCoordinates,
1980 IDirect3DRMMeshBuilder3Impl_SetVertexColor,
1981 IDirect3DRMMeshBuilder3Impl_SetVertexColorRGB,
1982 IDirect3DRMMeshBuilder3Impl_GetFaces,
1983 IDirect3DRMMeshBuilder3Impl_GetGeometry,
1984 IDirect3DRMMeshBuilder3Impl_GetTextureCoordinates,
1985 IDirect3DRMMeshBuilder3Impl_AddVertex,
1986 IDirect3DRMMeshBuilder3Impl_AddNormal,
1987 IDirect3DRMMeshBuilder3Impl_CreateFace,
1988 IDirect3DRMMeshBuilder3Impl_GetQuality,
1989 IDirect3DRMMeshBuilder3Impl_GetPerspective,
1990 IDirect3DRMMeshBuilder3Impl_GetFaceCount,
1991 IDirect3DRMMeshBuilder3Impl_GetVertexCount,
1992 IDirect3DRMMeshBuilder3Impl_GetVertexColor,
1993 IDirect3DRMMeshBuilder3Impl_CreateMesh,
1994 IDirect3DRMMeshBuilder3Impl_GetFace,
1995 IDirect3DRMMeshBuilder3Impl_GetVertex,
1996 IDirect3DRMMeshBuilder3Impl_GetNormal,
1997 IDirect3DRMMeshBuilder3Impl_DeleteVertices,
1998 IDirect3DRMMeshBuilder3Impl_DeleteNormals,
1999 IDirect3DRMMeshBuilder3Impl_DeleteFace,
2000 IDirect3DRMMeshBuilder3Impl_Empty,
2001 IDirect3DRMMeshBuilder3Impl_Optimize,
2002 IDirect3DRMMeshBuilder3Impl_AddFacesIndexed,
2003 IDirect3DRMMeshBuilder3Impl_CreateSubMesh,
2004 IDirect3DRMMeshBuilder3Impl_GetParentMesh,
2005 IDirect3DRMMeshBuilder3Impl_GetSubMeshes,
2006 IDirect3DRMMeshBuilder3Impl_DeleteSubMesh,
2007 IDirect3DRMMeshBuilder3Impl_Enable,
2008 IDirect3DRMMeshBuilder3Impl_GetEnable,
2009 IDirect3DRMMeshBuilder3Impl_AddTriangles,
2010 IDirect3DRMMeshBuilder3Impl_SetVertices,
2011 IDirect3DRMMeshBuilder3Impl_GetVertices,
2012 IDirect3DRMMeshBuilder3Impl_SetNormals,
2013 IDirect3DRMMeshBuilder3Impl_GetNormals,
2014 IDirect3DRMMeshBuilder3Impl_GetNormalCount
2017 HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown** ppObj)
2019 IDirect3DRMMeshBuilderImpl* object;
2021 TRACE("(%p)\n", ppObj);
2023 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMMeshBuilderImpl));
2024 if (!object)
2026 ERR("Out of memory\n");
2027 return E_OUTOFMEMORY;
2030 object->IDirect3DRMMeshBuilder2_iface.lpVtbl = &Direct3DRMMeshBuilder2_Vtbl;
2031 object->IDirect3DRMMeshBuilder3_iface.lpVtbl = &Direct3DRMMeshBuilder3_Vtbl;
2032 object->ref = 1;
2034 if (IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder3))
2035 *ppObj = (IUnknown*)&object->IDirect3DRMMeshBuilder3_iface;
2036 else
2037 *ppObj = (IUnknown*)&object->IDirect3DRMMeshBuilder2_iface;
2039 return S_OK;