comctl32/tests: Remove variable hwndheader which is not really used from test_items.
[wine.git] / dlls / d3drm / meshbuilder.c
bloba2013f40e7b93edfd21b8279bebacef3106a9c74
1 /*
2 * Implementation of IDirect3DRMMeshBuilder Interface
4 * Copyright 2010 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/debug.h"
26 #define COBJMACROS
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "dxfile.h"
32 #include "d3drm_private.h"
33 #include "d3drm.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
37 typedef struct {
38 D3DVALUE u;
39 D3DVALUE v;
40 } Coords2d;
42 typedef struct {
43 const IDirect3DRMMeshBuilderVtbl *lpVtbl;
44 LONG ref;
45 DWORD nb_vertices;
46 D3DVECTOR* pVertices;
47 DWORD nb_normals;
48 D3DVECTOR* pNormals;
49 DWORD nb_faces;
50 DWORD face_data_size;
51 LPVOID pFaceData;
52 DWORD nb_coords2d;
53 Coords2d* pCoords2d;
54 } IDirect3DRMMeshBuilderImpl;
56 typedef struct {
57 WORD major;
58 WORD minor;
59 DWORD flags;
60 } Header;
62 static const struct IDirect3DRMMeshBuilderVtbl Direct3DRMMeshBuilder_Vtbl;
64 static const GUID GUID_Header = { 0x3D82AB43, 0x62DA, 0x11CF, { 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33 } };
65 static const GUID GUID_Mesh = { 0x3D82AB44, 0x62DA, 0x11CF, { 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33 } };
66 static const GUID GUID_MeshTextureCoords = { 0xF6F23F40, 0x7686, 0x11CF, { 0x8F, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xA3 } };
67 static const GUID GUID_MeshMaterialList = { 0xF6F23F42, 0x7686, 0x11CF, { 0x8F, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xA3 } };
68 static const GUID GUID_MeshNormals = { 0xF6F23F43, 0x7686, 0x11CF, { 0x8F, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xA3 } };
70 static char templates[] = {
71 "xof 0302txt 0064"
72 "template Header"
73 "{"
74 "<3D82AB43-62DA-11CF-AB39-0020AF71E433>"
75 "WORD major;"
76 "WORD minor;"
77 "DWORD flags;"
78 "}"
79 "template Vector"
80 "{"
81 "<3D82AB5E-62DA-11CF-AB39-0020AF71E433>"
82 "FLOAT x;"
83 "FLOAT y;"
84 "FLOAT z;"
85 "}"
86 "template Coords2d"
87 "{"
88 "<F6F23F44-7686-11CF-8F52-0040333594A3>"
89 "FLOAT u;"
90 "FLOAT v;"
91 "}"
92 "template Matrix4x4"
93 "{"
94 "<F6F23F45-7686-11CF-8F52-0040333594A3>"
95 "array FLOAT matrix[16];"
96 "}"
97 "template ColorRGBA"
98 "{"
99 "<35FF44E0-6C7C-11CF-8F52-0040333594A3>"
100 "FLOAT red;"
101 "FLOAT green;"
102 "FLOAT blue;"
103 "FLOAT alpha;"
105 "template ColorRGB"
107 "<D3E16E81-7835-11CF-8F52-0040333594A3>"
108 "FLOAT red;"
109 "FLOAT green;"
110 "FLOAT blue;"
112 "template IndexedColor"
114 "<1630B820-7842-11CF-8F52-0040333594A3>"
115 "DWORD index;"
116 "ColorRGBA indexColor;"
118 "template Boolean"
120 "<537DA6A0-CA37-11D0-941C-0080C80CFA7B>"
121 "DWORD truefalse;"
123 "template Boolean2d"
125 "<4885AE63-78E8-11CF-8F52-0040333594A3>"
126 "Boolean u;"
127 "Boolean v;"
129 "template MaterialWrap"
131 "<4885AE60-78E8-11CF-8F52-0040333594A3>"
132 "Boolean u;"
133 "Boolean v;"
135 "template TextureFilename"
137 "<A42790E1-7810-11CF-8F52-0040333594A3>"
138 "STRING filename;"
140 "template Material"
142 "<3D82AB4D-62DA-11CF-AB39-0020AF71E433>"
143 "ColorRGBA faceColor;"
144 "FLOAT power;"
145 "ColorRGB specularColor;"
146 "ColorRGB emissiveColor;"
147 "[...]"
149 "template MeshFace"
151 "<3D82AB5F-62DA-11CF-AB39-0020AF71E433>"
152 "DWORD nFaceVertexIndices;"
153 "array DWORD faceVertexIndices[nFaceVertexIndices];"
155 "template MeshFaceWraps"
157 "<ED1EC5C0-C0A8-11D0-941C-0080C80CFA7B>"
158 "DWORD nFaceWrapValues;"
159 "array Boolean2d faceWrapValues[nFaceWrapValues];"
161 "template MeshTextureCoords"
163 "<F6F23F40-7686-11CF-8F52-0040333594A3>"
164 "DWORD nTextureCoords;"
165 "array Coords2d textureCoords[nTextureCoords];"
167 "template MeshMaterialList"
169 "<F6F23F42-7686-11CF-8F52-0040333594A3>"
170 "DWORD nMaterials;"
171 "DWORD nFaceIndexes;"
172 "array DWORD faceIndexes[nFaceIndexes];"
173 "[Material]"
175 "template MeshNormals"
177 "<F6F23F43-7686-11CF-8F52-0040333594A3>"
178 "DWORD nNormals;"
179 "array Vector normals[nNormals];"
180 "DWORD nFaceNormals;"
181 "array MeshFace faceNormals[nFaceNormals];"
183 "template MeshVertexColors"
185 "<1630B821-7842-11CF-8F52-0040333594A3>"
186 "DWORD nVertexColors;"
187 "array IndexedColor vertexColors[nVertexColors];"
189 "template Mesh"
191 "<3D82AB44-62DA-11CF-AB39-0020AF71E433>"
192 "DWORD nVertices;"
193 "array Vector vertices[nVertices];"
194 "DWORD nFaces;"
195 "array MeshFace faces[nFaces];"
196 "[...]"
198 "template FrameTransformMatrix"
200 "<F6F23F41-7686-11CF-8F52-0040333594A3>"
201 "Matrix4x4 frameMatrix;"
203 "template Frame"
205 "<3D82AB46-62DA-11CF-AB39-0020AF71E433>"
206 "[...]"
208 "template FloatKeys"
210 "<10DD46A9-775B-11CF-8F52-0040333594A3>"
211 "DWORD nValues;"
212 "array FLOAT values[nValues];"
214 "template TimedFloatKeys"
216 "<F406B180-7B3B-11CF-8F52-0040333594A3>"
217 "DWORD time;"
218 "FloatKeys tfkeys;"
220 "template AnimationKey"
222 "<10DD46A8-775B-11CF-8F52-0040333594A3>"
223 "DWORD keyType;"
224 "DWORD nKeys;"
225 "array TimedFloatKeys keys[nKeys];"
227 "template AnimationOptions"
229 "<E2BF56C0-840F-11CF-8F52-0040333594A3>"
230 "DWORD openclosed;"
231 "DWORD positionquality;"
233 "template Animation"
235 "<3D82AB4F-62DA-11CF-AB39-0020AF71E433>"
236 "[...]"
238 "template AnimationSet"
240 "<3D82AB50-62DA-11CF-AB39-0020AF71E433>"
241 "[Animation]"
243 "template InlineData"
245 "<3A23EEA0-94B1-11D0-AB39-0020AF71E433>"
246 "[BINARY]"
248 "template Url"
250 "<3A23EEA1-94B1-11D0-AB39-0020AF71E433>"
251 "DWORD nUrls;"
252 "array STRING urls[nUrls];"
254 "template ProgressiveMesh"
256 "<8A63C360-997D-11D0-941C-0080C80CFA7B>"
257 "[Url,InlineData]"
259 "template Guid"
261 "<A42790E0-7810-11CF-8F52-0040333594A3>"
262 "DWORD data1;"
263 "WORD data2;"
264 "WORD data3;"
265 "array UCHAR data4[8];"
267 "template StringProperty"
269 "<7F0F21E0-BFE1-11D1-82C0-00A0C9697271>"
270 "STRING key;"
271 "STRING value;"
273 "template PropertyBag"
275 "<7F0F21E1-BFE1-11D1-82C0-00A0C9697271>"
276 "[StringProperty]"
278 "template ExternalVisual"
280 "<98116AA0-BDBA-11D1-82C0-00A0C9697271>"
281 "Guid guidExternalVisual;"
282 "[...]"
284 "template RightHanded"
286 "<7F5D5EA0-D53A-11D1-82C0-00A0C9697271>"
287 "DWORD bRightHanded;"
291 HRESULT Direct3DRMMeshBuilder_create(LPDIRECT3DRMMESHBUILDER* ppMeshBuilder)
293 IDirect3DRMMeshBuilderImpl* object;
295 TRACE("(%p)\n", ppMeshBuilder);
297 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMMeshBuilderImpl));
298 if (!object)
300 ERR("Out of memory\n");
301 return E_OUTOFMEMORY;
304 object->lpVtbl = &Direct3DRMMeshBuilder_Vtbl;
305 object->ref = 1;
307 *ppMeshBuilder = (IDirect3DRMMeshBuilder*)object;
309 return S_OK;
312 /*** IUnknown methods ***/
313 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_QueryInterface(IDirect3DRMMeshBuilder* iface, REFIID riid, void** ppvObject)
315 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
317 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObject);
319 if (IsEqualGUID(riid, &IID_IUnknown) ||
320 IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder))
322 IClassFactory_AddRef(iface);
323 *ppvObject = This;
324 return S_OK;
327 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
328 return E_NOINTERFACE;
331 static ULONG WINAPI IDirect3DRMMeshBuilderImpl_AddRef(IDirect3DRMMeshBuilder* iface)
333 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
335 TRACE("(%p)\n", This);
337 return InterlockedIncrement(&This->ref);
340 static ULONG WINAPI IDirect3DRMMeshBuilderImpl_Release(IDirect3DRMMeshBuilder* iface)
342 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
343 ULONG ref = InterlockedDecrement(&This->ref);
345 TRACE("(%p)\n", This);
347 if (!ref)
349 HeapFree(GetProcessHeap(), 0, This->pVertices);
350 HeapFree(GetProcessHeap(), 0, This->pNormals);
351 HeapFree(GetProcessHeap(), 0, This->pFaceData);
352 HeapFree(GetProcessHeap(), 0, This);
355 return ref;
358 /*** IDirect3DRMObject methods ***/
359 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Clone(IDirect3DRMMeshBuilder* iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
361 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
363 FIXME("(%p)->(%p,%s,%p): stub\n", This, pUnkOuter, debugstr_guid(riid), ppvObj);
365 return E_NOTIMPL;
368 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddDestroyCallback(IDirect3DRMMeshBuilder* iface, D3DRMOBJECTCALLBACK cb, LPVOID argument)
370 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
372 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
374 return E_NOTIMPL;
377 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_DeleteDestroyCallback(IDirect3DRMMeshBuilder* iface, D3DRMOBJECTCALLBACK cb, LPVOID argument)
379 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
381 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
383 return E_NOTIMPL;
386 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetAppData(IDirect3DRMMeshBuilder* iface, DWORD data)
388 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
390 FIXME("(%p)->(%u): stub\n", This, data);
392 return E_NOTIMPL;
395 static DWORD WINAPI IDirect3DRMMeshBuilderImpl_GetAppData(IDirect3DRMMeshBuilder* iface)
397 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
399 FIXME("(%p)->(): stub\n", This);
401 return 0;
404 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetName(IDirect3DRMMeshBuilder* iface, LPCSTR pName)
406 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
408 FIXME("(%p)->(%s): stub\n", This, pName);
410 return E_NOTIMPL;
413 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetName(IDirect3DRMMeshBuilder* iface, LPDWORD lpdwSize, LPSTR lpName)
415 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
417 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
419 return E_NOTIMPL;
422 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetClassName(IDirect3DRMMeshBuilder* iface, LPDWORD lpdwSize, LPSTR lpName)
424 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
426 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
428 return E_NOTIMPL;
431 /*** IDirect3DRMMeshBuilder methods ***/
432 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Load(IDirect3DRMMeshBuilder* iface, LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK cb, LPVOID pArg)
434 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
435 DXFILELOADOPTIONS load_options;
436 LPDIRECTXFILE pDXFile = NULL;
437 LPDIRECTXFILEENUMOBJECT pEnumObject = NULL;
438 LPDIRECTXFILEDATA pData = NULL;
439 LPDIRECTXFILEOBJECT pObject = NULL;
440 LPDIRECTXFILEDATA pData2 = NULL;
441 const GUID* pGuid;
442 DWORD size;
443 Header* pHeader;
444 LPBYTE ptr;
445 HRESULT hr;
446 HRESULT ret = D3DRMERR_BADOBJECT;
448 FIXME("(%p)->(%p,%p,%x,%p,%p): partial stub\n", This, filename, name, loadflags, cb, pArg);
450 /* First free allocated buffers of previous mesh data */
451 HeapFree(GetProcessHeap(), 0, This->pVertices);
452 This->pVertices = NULL;
453 HeapFree(GetProcessHeap(), 0, This->pNormals);
454 This->pNormals = NULL;
455 HeapFree(GetProcessHeap(), 0, This->pFaceData);
456 This->pFaceData = NULL;
457 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
458 This->pCoords2d = NULL;
460 if (loadflags == D3DRMLOAD_FROMMEMORY)
462 load_options = DXFILELOAD_FROMMEMORY;
464 else
466 FIXME("Load options %d not supported yet\n", loadflags);
467 return E_NOTIMPL;
470 hr = DirectXFileCreate(&pDXFile);
471 if (hr != DXFILE_OK)
472 goto end;
474 hr = IDirectXFile_RegisterTemplates(pDXFile, templates, strlen(templates));
475 if (hr != DXFILE_OK)
476 goto end;
478 hr = IDirectXFile_CreateEnumObject(pDXFile, filename, load_options, &pEnumObject);
479 if (hr != DXFILE_OK)
480 goto end;
482 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
483 if (hr != DXFILE_OK)
484 goto end;
486 hr = IDirectXFileData_GetType(pData, &pGuid);
487 if (hr != DXFILE_OK)
488 goto end;
490 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
492 if (!IsEqualGUID(pGuid, &GUID_Header))
494 ret = D3DRMERR_BADFILE;
495 goto end;
498 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&pHeader);
499 if ((hr != DXFILE_OK) || (size != sizeof(Header)))
500 goto end;
502 TRACE("Version is %d %d %d\n", pHeader->major, pHeader->minor, pHeader->flags);
504 /* Version must be 1.0.x */
505 if ((pHeader->major != 1) || (pHeader->minor != 0))
507 ret = D3DRMERR_BADFILE;
508 goto end;
511 IDirectXFileData_Release(pData);
512 pData = NULL;
514 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
515 if (hr != DXFILE_OK)
517 ret = D3DRMERR_NOTFOUND;
518 goto end;
521 hr = IDirectXFileData_GetType(pData, &pGuid);
522 if (hr != DXFILE_OK)
523 goto end;
525 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
527 if (!IsEqualGUID(pGuid, &GUID_Mesh))
529 ret = D3DRMERR_NOTFOUND;
530 goto end;
533 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
534 if (hr != DXFILE_OK)
535 goto end;
537 This->nb_vertices = *(DWORD*)ptr;
538 This->nb_faces = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR));
539 This->face_data_size = size - sizeof(DWORD) - This->nb_vertices * sizeof(D3DVECTOR) - sizeof(DWORD);
541 TRACE("Mesh: nb_vertices = %d, nb_faces = %d, face_data_size = %d\n", This->nb_vertices, This->nb_faces, This->face_data_size);
543 This->pVertices = HeapAlloc(GetProcessHeap(), 0, This->nb_vertices * sizeof(D3DVECTOR));
544 memcpy(This->pVertices, ptr + sizeof(DWORD), This->nb_vertices * sizeof(D3DVECTOR));
546 This->pFaceData = HeapAlloc(GetProcessHeap(), 0, This->face_data_size);
547 memcpy(This->pFaceData, ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD), This->face_data_size);
549 while (1)
551 hr = IDirectXFileData_GetNextObject(pData, &pObject);
552 if (hr == DXFILEERR_NOMOREOBJECTS)
554 FIXME("no more object\n");
555 break;
557 if (hr != DXFILE_OK)
558 goto end;
560 hr = IDirectXFileObject_QueryInterface(pObject, &IID_IDirectXFileData, (void**)&pData2);
561 IDirectXFileObject_Release(pObject);
562 if (hr != DXFILE_OK)
563 goto end;
565 hr = IDirectXFileData_GetType(pData2, &pGuid);
566 if (hr != DXFILE_OK)
568 IDirectXFileData_Release(pData2);
569 goto end;
572 FIXME("toto: Found object type whose GUID = %s\n", debugstr_guid(pGuid));
574 if (!IsEqualGUID(pGuid, &GUID_MeshNormals))
576 DWORD tmp;
578 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
579 if (hr != DXFILE_OK)
580 goto end;
582 This->nb_normals = *(DWORD*)ptr;
583 tmp = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_normals * sizeof(D3DVECTOR));
585 FIXME("MeshNormals: nb_normals = %d, nb_faces_normals = %d\n", This->nb_normals, tmp);
587 This->pNormals = HeapAlloc(GetProcessHeap(), 0, This->nb_normals * sizeof(D3DVECTOR));
588 memcpy(This->pNormals, ptr + sizeof(DWORD), This->nb_normals * sizeof(D3DVECTOR));
590 else if(!IsEqualGUID(pGuid, &GUID_MeshTextureCoords))
592 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
593 if (hr != DXFILE_OK)
594 goto end;
596 This->nb_coords2d = *(DWORD*)ptr;
598 FIXME("MeshTextureCoords: nb_coords2d = %d\n", This->nb_coords2d);
600 This->pCoords2d = HeapAlloc(GetProcessHeap(), 0, This->nb_coords2d * sizeof(Coords2d));
601 memcpy(This->pCoords2d, ptr + sizeof(DWORD), This->nb_coords2d * sizeof(Coords2d));
604 else if(!IsEqualGUID(pGuid, &GUID_MeshMaterialList))
606 FIXME("MeshMaterialList not supported yet, ignoring...\n");
608 else
610 FIXME("Unknown GUID %s, ignoring...\n", debugstr_guid(pGuid));
613 IDirectXFileData_Release(pData2);
616 ret = D3DRM_OK;
618 end:
619 if (pData)
620 IDirectXFileData_Release(pData);
621 if (pEnumObject)
622 IDirectXFileEnumObject_Release(pEnumObject);
623 if (pDXFile)
624 IDirectXFile_Release(pDXFile);
626 if (ret != D3DRM_OK)
628 /* Clean mesh data */
629 This->nb_vertices = 0;
630 This->nb_normals = 0;
631 This->nb_faces = 0;
632 This->face_data_size = 0;
633 This->nb_coords2d = 0;
634 HeapFree(GetProcessHeap(), 0, This->pVertices);
635 This->pVertices = NULL;
636 HeapFree(GetProcessHeap(), 0, This->pNormals);
637 This->pNormals = NULL;
638 HeapFree(GetProcessHeap(), 0, This->pFaceData);
639 This->pFaceData = NULL;
640 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
641 This->pCoords2d = NULL;
644 return ret;
647 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Save(IDirect3DRMMeshBuilder* iface, const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS save)
649 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
651 FIXME("(%p)->(%s,%d,%d): stub\n", This, filename, format, save);
653 return E_NOTIMPL;
656 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Scale(IDirect3DRMMeshBuilder* iface, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
658 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
660 FIXME("(%p)->(%f,%f,%f): stub\n", This, sx, sy, sz);
662 return E_NOTIMPL;
665 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Translate(IDirect3DRMMeshBuilder* iface, D3DVALUE tx, D3DVALUE ty, D3DVALUE tz)
667 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
669 FIXME("(%p)->(%f,%f,%f): stub\n", This, tx, ty, tz);
671 return E_NOTIMPL;
674 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColorSource(IDirect3DRMMeshBuilder* iface, D3DRMCOLORSOURCE color)
676 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
678 FIXME("(%p)->(%x): stub\n", This, color);
680 return E_NOTIMPL;
683 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetBox(IDirect3DRMMeshBuilder* iface, D3DRMBOX *pBox)
685 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
687 FIXME("(%p)->(%p): stub\n", This, pBox);
689 return E_NOTIMPL;
692 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GenerateNormals(IDirect3DRMMeshBuilder* iface)
694 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
696 FIXME("(%p)->(): stub\n", This);
698 return E_NOTIMPL;
701 static D3DRMCOLORSOURCE WINAPI IDirect3DRMMeshBuilderImpl_GetColorSource(IDirect3DRMMeshBuilder* iface)
703 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
705 FIXME("(%p)->(): stub\n", This);
707 return E_NOTIMPL;
710 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddMesh(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESH pMesh)
712 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
714 FIXME("(%p)->(%p): stub\n", This, pMesh);
716 return E_NOTIMPL;
719 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddMeshBuilder(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESHBUILDER pMeshBuilder)
721 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
723 FIXME("(%p)->(%p): stub\n", This, pMeshBuilder);
725 return E_NOTIMPL;
728 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFrame(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFRAME pFrame)
730 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
732 FIXME("(%p)->(%p): stub\n", This, pFrame);
734 return E_NOTIMPL;
737 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFace(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACE pFace)
739 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
741 FIXME("(%p)->(%p): stub\n", This, pFace);
743 return E_NOTIMPL;
746 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFaces(IDirect3DRMMeshBuilder* iface, DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, DWORD *data, LPDIRECT3DRMFACEARRAY* pFaceArray)
748 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
750 FIXME("(%p)->(%d,%p,%d,%p,%p,%p): stub\n", This, vcount, vertices, ncount, normals, data, pFaceArray);
752 return E_NOTIMPL;
755 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_ReserveSpace(IDirect3DRMMeshBuilder* iface, DWORD vertex_Count, DWORD normal_count, DWORD face_count)
757 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
759 FIXME("(%p)->(%d,%d,%d): stub\n", This, vertex_Count, normal_count, face_count);
761 return E_NOTIMPL;
764 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColorRGB(IDirect3DRMMeshBuilder* iface, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
766 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
768 FIXME("(%p)->(%f,%f,%f): stub\n", This, red, green, blue);
770 return E_NOTIMPL;
773 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColor(IDirect3DRMMeshBuilder* iface, D3DCOLOR color)
775 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
777 FIXME("(%p)->(%x): stub\n", This, color);
779 return E_NOTIMPL;
782 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTexture(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMTEXTURE pTexture)
784 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
786 FIXME("(%p)->(%p): stub\n", This, pTexture);
788 return E_NOTIMPL;
791 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetMaterial(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMATERIAL pMaterial)
793 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
795 FIXME("(%p)->(%p): stub\n", This, pMaterial);
797 return E_NOTIMPL;
800 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTextureTopology(IDirect3DRMMeshBuilder* iface, BOOL wrap_u, BOOL wrap_v)
802 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
804 FIXME("(%p)->(%d,%d): stub\n", This, wrap_u, wrap_v);
806 return E_NOTIMPL;
809 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetQuality(IDirect3DRMMeshBuilder* iface, D3DRMRENDERQUALITY quality)
811 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
813 FIXME("(%p)->(%d): stub\n", This, quality);
815 return E_NOTIMPL;
818 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetPerspective(IDirect3DRMMeshBuilder* iface, BOOL enable)
820 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
822 FIXME("(%p)->(%d): stub\n", This, enable);
824 return E_NOTIMPL;
827 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertex(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z)
829 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
831 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
833 return E_NOTIMPL;
836 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetNormal(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z)
838 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
840 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
842 return E_NOTIMPL;
845 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTextureCoordinates(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE u, D3DVALUE v)
847 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
849 FIXME("(%p)->(%f,%f): stub\n", This, u, v);
851 return E_NOTIMPL;
854 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertexColor(IDirect3DRMMeshBuilder* iface, DWORD index, D3DCOLOR color)
856 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
858 FIXME("(%p)->(%d,%x): stub\n", This, index, color);
860 return E_NOTIMPL;
863 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertexColorRGB(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
865 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
867 FIXME("(%p)->(%d,%f,%f,%f): stub\n", This, index, red, green, blue);
869 return E_NOTIMPL;
872 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetFaces(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACEARRAY* pFaceArray)
874 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
876 FIXME("(%p)->(%p): stub\n", This, pFaceArray);
878 return E_NOTIMPL;
881 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetVertices(IDirect3DRMMeshBuilder* iface, DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data)
883 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
885 TRACE("(%p)->(%p,%p,%p,%p,%p,%p)\n", This, vcount, vertices, ncount, normals, face_data_size, face_data);
887 if (vcount)
888 *vcount = This->nb_vertices;
889 if (vertices && This->nb_vertices)
890 memcpy(vertices, This->pVertices, This->nb_vertices * sizeof(D3DVECTOR));
891 if (ncount)
892 *ncount = This->nb_normals;
893 if (normals && This->nb_normals)
894 memcpy(normals, This->pNormals, This->nb_normals * sizeof(D3DVECTOR));
895 if (face_data_size)
896 *face_data_size = This->face_data_size;
897 if (face_data && This->face_data_size)
898 memcpy(face_data, This->pFaceData, This->face_data_size);
900 return D3DRM_OK;
903 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetTextureCoordinates(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE *u, D3DVALUE *v)
905 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
907 FIXME("(%p)->(%d,%p,%p): stub\n", This, index, u, v);
909 if (index >= This->nb_coords2d)
910 return D3DRMERR_NOTFOUND;
912 *u = This->pCoords2d[index].u;
913 *v = This->pCoords2d[index].v;
915 return D3DRM_OK;
918 static int WINAPI IDirect3DRMMeshBuilderImpl_AddVertex(IDirect3DRMMeshBuilder* iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
920 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
922 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
924 return 0;
927 static int WINAPI IDirect3DRMMeshBuilderImpl_AddNormal(IDirect3DRMMeshBuilder* iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
929 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
931 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
933 return 0;
936 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_CreateFace(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACE* ppFace)
938 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
940 FIXME("(%p)->(%p): stub\n", This, ppFace);
942 return E_NOTIMPL;
945 static D3DRMRENDERQUALITY WINAPI IDirect3DRMMeshBuilderImpl_GetQuality(IDirect3DRMMeshBuilder* iface)
947 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
949 FIXME("(%p)->(): stub\n", This);
951 return 0;
954 static BOOL WINAPI IDirect3DRMMeshBuilderImpl_GetPerspective(IDirect3DRMMeshBuilder* iface)
956 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
958 FIXME("(%p)->(): stub\n", This);
960 return FALSE;
963 static int WINAPI IDirect3DRMMeshBuilderImpl_GetFaceCount(IDirect3DRMMeshBuilder* iface)
965 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
967 TRACE("(%p)->()\n", This);
969 return This->nb_faces;
972 static int WINAPI IDirect3DRMMeshBuilderImpl_GetVertexCount(IDirect3DRMMeshBuilder* iface)
974 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
976 TRACE("(%p)->()\n", This);
978 return This->nb_vertices;
981 static D3DCOLOR WINAPI IDirect3DRMMeshBuilderImpl_GetVertexColor(IDirect3DRMMeshBuilder* iface, DWORD index)
983 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
985 FIXME("(%p)->(%d): stub\n", This, index);
987 return 0;
990 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_CreateMesh(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESH* ppMesh)
992 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
994 FIXME("(%p)->(%p): stub\n", This, ppMesh);
996 return E_NOTIMPL;
999 static const struct IDirect3DRMMeshBuilderVtbl Direct3DRMMeshBuilder_Vtbl =
1001 /*** IUnknown methods ***/
1002 IDirect3DRMMeshBuilderImpl_QueryInterface,
1003 IDirect3DRMMeshBuilderImpl_AddRef,
1004 IDirect3DRMMeshBuilderImpl_Release,
1005 /*** IDirect3DRMObject methods ***/
1006 IDirect3DRMMeshBuilderImpl_Clone,
1007 IDirect3DRMMeshBuilderImpl_AddDestroyCallback,
1008 IDirect3DRMMeshBuilderImpl_DeleteDestroyCallback,
1009 IDirect3DRMMeshBuilderImpl_SetAppData,
1010 IDirect3DRMMeshBuilderImpl_GetAppData,
1011 IDirect3DRMMeshBuilderImpl_SetName,
1012 IDirect3DRMMeshBuilderImpl_GetName,
1013 IDirect3DRMMeshBuilderImpl_GetClassName,
1014 /*** IDirect3DRMMeshBuilder methods ***/
1015 IDirect3DRMMeshBuilderImpl_Load,
1016 IDirect3DRMMeshBuilderImpl_Save,
1017 IDirect3DRMMeshBuilderImpl_Scale,
1018 IDirect3DRMMeshBuilderImpl_Translate,
1019 IDirect3DRMMeshBuilderImpl_SetColorSource,
1020 IDirect3DRMMeshBuilderImpl_GetBox,
1021 IDirect3DRMMeshBuilderImpl_GenerateNormals,
1022 IDirect3DRMMeshBuilderImpl_GetColorSource,
1023 IDirect3DRMMeshBuilderImpl_AddMesh,
1024 IDirect3DRMMeshBuilderImpl_AddMeshBuilder,
1025 IDirect3DRMMeshBuilderImpl_AddFrame,
1026 IDirect3DRMMeshBuilderImpl_AddFace,
1027 IDirect3DRMMeshBuilderImpl_AddFaces,
1028 IDirect3DRMMeshBuilderImpl_ReserveSpace,
1029 IDirect3DRMMeshBuilderImpl_SetColorRGB,
1030 IDirect3DRMMeshBuilderImpl_SetColor,
1031 IDirect3DRMMeshBuilderImpl_SetTexture,
1032 IDirect3DRMMeshBuilderImpl_SetMaterial,
1033 IDirect3DRMMeshBuilderImpl_SetTextureTopology,
1034 IDirect3DRMMeshBuilderImpl_SetQuality,
1035 IDirect3DRMMeshBuilderImpl_SetPerspective,
1036 IDirect3DRMMeshBuilderImpl_SetVertex,
1037 IDirect3DRMMeshBuilderImpl_SetNormal,
1038 IDirect3DRMMeshBuilderImpl_SetTextureCoordinates,
1039 IDirect3DRMMeshBuilderImpl_SetVertexColor,
1040 IDirect3DRMMeshBuilderImpl_SetVertexColorRGB,
1041 IDirect3DRMMeshBuilderImpl_GetFaces,
1042 IDirect3DRMMeshBuilderImpl_GetVertices,
1043 IDirect3DRMMeshBuilderImpl_GetTextureCoordinates,
1044 IDirect3DRMMeshBuilderImpl_AddVertex,
1045 IDirect3DRMMeshBuilderImpl_AddNormal,
1046 IDirect3DRMMeshBuilderImpl_CreateFace,
1047 IDirect3DRMMeshBuilderImpl_GetQuality,
1048 IDirect3DRMMeshBuilderImpl_GetPerspective,
1049 IDirect3DRMMeshBuilderImpl_GetFaceCount,
1050 IDirect3DRMMeshBuilderImpl_GetVertexCount,
1051 IDirect3DRMMeshBuilderImpl_GetVertexColor,
1052 IDirect3DRMMeshBuilderImpl_CreateMesh