ntdll: Fix frame address check in RtlCaptureStackBackTrace to match what RtlUnwind...
[wine.git] / dlls / d3drm / meshbuilder.c
blobea2ffffa7030ef490be8e8d6bbb790f5a1817740
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"
31 #include "rmxfguid.h"
33 #include "d3drm_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
37 typedef struct {
38 D3DVALUE u;
39 D3DVALUE v;
40 } Coords2d;
42 typedef struct {
43 IDirect3DRMMeshBuilder IDirect3DRMMeshBuilder_iface;
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 char templates[] = {
65 "xof 0302txt 0064"
66 "template Header"
67 "{"
68 "<3D82AB43-62DA-11CF-AB39-0020AF71E433>"
69 "WORD major;"
70 "WORD minor;"
71 "DWORD flags;"
72 "}"
73 "template Vector"
74 "{"
75 "<3D82AB5E-62DA-11CF-AB39-0020AF71E433>"
76 "FLOAT x;"
77 "FLOAT y;"
78 "FLOAT z;"
79 "}"
80 "template Coords2d"
81 "{"
82 "<F6F23F44-7686-11CF-8F52-0040333594A3>"
83 "FLOAT u;"
84 "FLOAT v;"
85 "}"
86 "template Matrix4x4"
87 "{"
88 "<F6F23F45-7686-11CF-8F52-0040333594A3>"
89 "array FLOAT matrix[16];"
90 "}"
91 "template ColorRGBA"
92 "{"
93 "<35FF44E0-6C7C-11CF-8F52-0040333594A3>"
94 "FLOAT red;"
95 "FLOAT green;"
96 "FLOAT blue;"
97 "FLOAT alpha;"
98 "}"
99 "template ColorRGB"
101 "<D3E16E81-7835-11CF-8F52-0040333594A3>"
102 "FLOAT red;"
103 "FLOAT green;"
104 "FLOAT blue;"
106 "template IndexedColor"
108 "<1630B820-7842-11CF-8F52-0040333594A3>"
109 "DWORD index;"
110 "ColorRGBA indexColor;"
112 "template Boolean"
114 "<537DA6A0-CA37-11D0-941C-0080C80CFA7B>"
115 "DWORD truefalse;"
117 "template Boolean2d"
119 "<4885AE63-78E8-11CF-8F52-0040333594A3>"
120 "Boolean u;"
121 "Boolean v;"
123 "template MaterialWrap"
125 "<4885AE60-78E8-11CF-8F52-0040333594A3>"
126 "Boolean u;"
127 "Boolean v;"
129 "template TextureFilename"
131 "<A42790E1-7810-11CF-8F52-0040333594A3>"
132 "STRING filename;"
134 "template Material"
136 "<3D82AB4D-62DA-11CF-AB39-0020AF71E433>"
137 "ColorRGBA faceColor;"
138 "FLOAT power;"
139 "ColorRGB specularColor;"
140 "ColorRGB emissiveColor;"
141 "[...]"
143 "template MeshFace"
145 "<3D82AB5F-62DA-11CF-AB39-0020AF71E433>"
146 "DWORD nFaceVertexIndices;"
147 "array DWORD faceVertexIndices[nFaceVertexIndices];"
149 "template MeshFaceWraps"
151 "<ED1EC5C0-C0A8-11D0-941C-0080C80CFA7B>"
152 "DWORD nFaceWrapValues;"
153 "array Boolean2d faceWrapValues[nFaceWrapValues];"
155 "template MeshTextureCoords"
157 "<F6F23F40-7686-11CF-8F52-0040333594A3>"
158 "DWORD nTextureCoords;"
159 "array Coords2d textureCoords[nTextureCoords];"
161 "template MeshMaterialList"
163 "<F6F23F42-7686-11CF-8F52-0040333594A3>"
164 "DWORD nMaterials;"
165 "DWORD nFaceIndexes;"
166 "array DWORD faceIndexes[nFaceIndexes];"
167 "[Material]"
169 "template MeshNormals"
171 "<F6F23F43-7686-11CF-8F52-0040333594A3>"
172 "DWORD nNormals;"
173 "array Vector normals[nNormals];"
174 "DWORD nFaceNormals;"
175 "array MeshFace faceNormals[nFaceNormals];"
177 "template MeshVertexColors"
179 "<1630B821-7842-11CF-8F52-0040333594A3>"
180 "DWORD nVertexColors;"
181 "array IndexedColor vertexColors[nVertexColors];"
183 "template Mesh"
185 "<3D82AB44-62DA-11CF-AB39-0020AF71E433>"
186 "DWORD nVertices;"
187 "array Vector vertices[nVertices];"
188 "DWORD nFaces;"
189 "array MeshFace faces[nFaces];"
190 "[...]"
192 "template FrameTransformMatrix"
194 "<F6F23F41-7686-11CF-8F52-0040333594A3>"
195 "Matrix4x4 frameMatrix;"
197 "template Frame"
199 "<3D82AB46-62DA-11CF-AB39-0020AF71E433>"
200 "[...]"
202 "template FloatKeys"
204 "<10DD46A9-775B-11CF-8F52-0040333594A3>"
205 "DWORD nValues;"
206 "array FLOAT values[nValues];"
208 "template TimedFloatKeys"
210 "<F406B180-7B3B-11CF-8F52-0040333594A3>"
211 "DWORD time;"
212 "FloatKeys tfkeys;"
214 "template AnimationKey"
216 "<10DD46A8-775B-11CF-8F52-0040333594A3>"
217 "DWORD keyType;"
218 "DWORD nKeys;"
219 "array TimedFloatKeys keys[nKeys];"
221 "template AnimationOptions"
223 "<E2BF56C0-840F-11CF-8F52-0040333594A3>"
224 "DWORD openclosed;"
225 "DWORD positionquality;"
227 "template Animation"
229 "<3D82AB4F-62DA-11CF-AB39-0020AF71E433>"
230 "[...]"
232 "template AnimationSet"
234 "<3D82AB50-62DA-11CF-AB39-0020AF71E433>"
235 "[Animation]"
237 "template InlineData"
239 "<3A23EEA0-94B1-11D0-AB39-0020AF71E433>"
240 "[BINARY]"
242 "template Url"
244 "<3A23EEA1-94B1-11D0-AB39-0020AF71E433>"
245 "DWORD nUrls;"
246 "array STRING urls[nUrls];"
248 "template ProgressiveMesh"
250 "<8A63C360-997D-11D0-941C-0080C80CFA7B>"
251 "[Url,InlineData]"
253 "template Guid"
255 "<A42790E0-7810-11CF-8F52-0040333594A3>"
256 "DWORD data1;"
257 "WORD data2;"
258 "WORD data3;"
259 "array UCHAR data4[8];"
261 "template StringProperty"
263 "<7F0F21E0-BFE1-11D1-82C0-00A0C9697271>"
264 "STRING key;"
265 "STRING value;"
267 "template PropertyBag"
269 "<7F0F21E1-BFE1-11D1-82C0-00A0C9697271>"
270 "[StringProperty]"
272 "template ExternalVisual"
274 "<98116AA0-BDBA-11D1-82C0-00A0C9697271>"
275 "Guid guidExternalVisual;"
276 "[...]"
278 "template RightHanded"
280 "<7F5D5EA0-D53A-11D1-82C0-00A0C9697271>"
281 "DWORD bRightHanded;"
285 static inline IDirect3DRMMeshBuilderImpl *impl_from_IDirect3DRMMeshBuilder(IDirect3DRMMeshBuilder *iface)
287 return CONTAINING_RECORD(iface, IDirect3DRMMeshBuilderImpl, IDirect3DRMMeshBuilder_iface);
290 HRESULT Direct3DRMMeshBuilder_create(LPDIRECT3DRMMESHBUILDER* ppMeshBuilder)
292 IDirect3DRMMeshBuilderImpl* object;
294 TRACE("(%p)\n", ppMeshBuilder);
296 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMMeshBuilderImpl));
297 if (!object)
299 ERR("Out of memory\n");
300 return E_OUTOFMEMORY;
303 object->IDirect3DRMMeshBuilder_iface.lpVtbl = &Direct3DRMMeshBuilder_Vtbl;
304 object->ref = 1;
306 *ppMeshBuilder = (IDirect3DRMMeshBuilder*)object;
308 return S_OK;
311 /*** IUnknown methods ***/
312 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_QueryInterface(IDirect3DRMMeshBuilder* iface, REFIID riid, void** ppvObject)
314 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
316 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObject);
318 if (IsEqualGUID(riid, &IID_IUnknown) ||
319 IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder))
321 IClassFactory_AddRef(iface);
322 *ppvObject = This;
323 return S_OK;
326 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
327 return E_NOINTERFACE;
330 static ULONG WINAPI IDirect3DRMMeshBuilderImpl_AddRef(IDirect3DRMMeshBuilder* iface)
332 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
334 TRACE("(%p)\n", This);
336 return InterlockedIncrement(&This->ref);
339 static ULONG WINAPI IDirect3DRMMeshBuilderImpl_Release(IDirect3DRMMeshBuilder* iface)
341 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
342 ULONG ref = InterlockedDecrement(&This->ref);
344 TRACE("(%p)\n", This);
346 if (!ref)
348 HeapFree(GetProcessHeap(), 0, This->pVertices);
349 HeapFree(GetProcessHeap(), 0, This->pNormals);
350 HeapFree(GetProcessHeap(), 0, This->pFaceData);
351 HeapFree(GetProcessHeap(), 0, This);
354 return ref;
357 /*** IDirect3DRMObject methods ***/
358 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Clone(IDirect3DRMMeshBuilder* iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
360 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
362 FIXME("(%p)->(%p,%s,%p): stub\n", This, pUnkOuter, debugstr_guid(riid), ppvObj);
364 return E_NOTIMPL;
367 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddDestroyCallback(IDirect3DRMMeshBuilder* iface, D3DRMOBJECTCALLBACK cb, LPVOID argument)
369 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
371 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
373 return E_NOTIMPL;
376 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_DeleteDestroyCallback(IDirect3DRMMeshBuilder* iface, D3DRMOBJECTCALLBACK cb, LPVOID argument)
378 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
380 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
382 return E_NOTIMPL;
385 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetAppData(IDirect3DRMMeshBuilder* iface, DWORD data)
387 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
389 FIXME("(%p)->(%u): stub\n", This, data);
391 return E_NOTIMPL;
394 static DWORD WINAPI IDirect3DRMMeshBuilderImpl_GetAppData(IDirect3DRMMeshBuilder* iface)
396 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
398 FIXME("(%p)->(): stub\n", This);
400 return 0;
403 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetName(IDirect3DRMMeshBuilder* iface, LPCSTR pName)
405 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
407 FIXME("(%p)->(%s): stub\n", This, pName);
409 return E_NOTIMPL;
412 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetName(IDirect3DRMMeshBuilder* iface, LPDWORD lpdwSize, LPSTR lpName)
414 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
416 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
418 return E_NOTIMPL;
421 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetClassName(IDirect3DRMMeshBuilder* iface, LPDWORD lpdwSize, LPSTR lpName)
423 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
425 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
427 return E_NOTIMPL;
430 /*** IDirect3DRMMeshBuilder methods ***/
431 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Load(IDirect3DRMMeshBuilder* iface, LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK cb, LPVOID pArg)
433 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
434 DXFILELOADOPTIONS load_options;
435 LPDIRECTXFILE pDXFile = NULL;
436 LPDIRECTXFILEENUMOBJECT pEnumObject = NULL;
437 LPDIRECTXFILEDATA pData = NULL;
438 LPDIRECTXFILEOBJECT pObject = NULL;
439 LPDIRECTXFILEDATA pData2 = NULL;
440 const GUID* pGuid;
441 DWORD size;
442 Header* pHeader;
443 LPBYTE ptr;
444 HRESULT hr;
445 HRESULT ret = D3DRMERR_BADOBJECT;
447 FIXME("(%p)->(%p,%p,%x,%p,%p): partial stub\n", This, filename, name, loadflags, cb, pArg);
449 /* First free allocated buffers of previous mesh data */
450 HeapFree(GetProcessHeap(), 0, This->pVertices);
451 This->pVertices = NULL;
452 HeapFree(GetProcessHeap(), 0, This->pNormals);
453 This->pNormals = NULL;
454 HeapFree(GetProcessHeap(), 0, This->pFaceData);
455 This->pFaceData = NULL;
456 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
457 This->pCoords2d = NULL;
459 if (loadflags == D3DRMLOAD_FROMMEMORY)
461 load_options = DXFILELOAD_FROMMEMORY;
463 else
465 FIXME("Load options %d not supported yet\n", loadflags);
466 return E_NOTIMPL;
469 hr = DirectXFileCreate(&pDXFile);
470 if (hr != DXFILE_OK)
471 goto end;
473 hr = IDirectXFile_RegisterTemplates(pDXFile, templates, strlen(templates));
474 if (hr != DXFILE_OK)
475 goto end;
477 hr = IDirectXFile_CreateEnumObject(pDXFile, filename, load_options, &pEnumObject);
478 if (hr != DXFILE_OK)
479 goto end;
481 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
482 if (hr != DXFILE_OK)
483 goto end;
485 hr = IDirectXFileData_GetType(pData, &pGuid);
486 if (hr != DXFILE_OK)
487 goto end;
489 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
491 if (!IsEqualGUID(pGuid, &TID_DXFILEHeader))
493 ret = D3DRMERR_BADFILE;
494 goto end;
497 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&pHeader);
498 if ((hr != DXFILE_OK) || (size != sizeof(Header)))
499 goto end;
501 TRACE("Version is %d %d %d\n", pHeader->major, pHeader->minor, pHeader->flags);
503 /* Version must be 1.0.x */
504 if ((pHeader->major != 1) || (pHeader->minor != 0))
506 ret = D3DRMERR_BADFILE;
507 goto end;
510 IDirectXFileData_Release(pData);
511 pData = NULL;
513 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
514 if (hr != DXFILE_OK)
516 ret = D3DRMERR_NOTFOUND;
517 goto end;
520 hr = IDirectXFileData_GetType(pData, &pGuid);
521 if (hr != DXFILE_OK)
522 goto end;
524 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
526 if (!IsEqualGUID(pGuid, &TID_D3DRMMesh))
528 ret = D3DRMERR_NOTFOUND;
529 goto end;
532 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
533 if (hr != DXFILE_OK)
534 goto end;
536 This->nb_vertices = *(DWORD*)ptr;
537 This->nb_faces = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR));
538 This->face_data_size = size - sizeof(DWORD) - This->nb_vertices * sizeof(D3DVECTOR) - sizeof(DWORD);
540 TRACE("Mesh: nb_vertices = %d, nb_faces = %d, face_data_size = %d\n", This->nb_vertices, This->nb_faces, This->face_data_size);
542 This->pVertices = HeapAlloc(GetProcessHeap(), 0, This->nb_vertices * sizeof(D3DVECTOR));
543 memcpy(This->pVertices, ptr + sizeof(DWORD), This->nb_vertices * sizeof(D3DVECTOR));
545 This->pFaceData = HeapAlloc(GetProcessHeap(), 0, This->face_data_size);
546 memcpy(This->pFaceData, ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD), This->face_data_size);
548 while (1)
550 hr = IDirectXFileData_GetNextObject(pData, &pObject);
551 if (hr == DXFILEERR_NOMOREOBJECTS)
553 FIXME("no more object\n");
554 break;
556 if (hr != DXFILE_OK)
557 goto end;
559 hr = IDirectXFileObject_QueryInterface(pObject, &IID_IDirectXFileData, (void**)&pData2);
560 IDirectXFileObject_Release(pObject);
561 if (hr != DXFILE_OK)
562 goto end;
564 hr = IDirectXFileData_GetType(pData2, &pGuid);
565 if (hr != DXFILE_OK)
567 IDirectXFileData_Release(pData2);
568 goto end;
571 FIXME("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
573 if (!IsEqualGUID(pGuid, &TID_D3DRMMeshNormals))
575 DWORD tmp;
577 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
578 if (hr != DXFILE_OK)
579 goto end;
581 This->nb_normals = *(DWORD*)ptr;
582 tmp = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_normals * sizeof(D3DVECTOR));
584 FIXME("MeshNormals: nb_normals = %d, nb_faces_normals = %d\n", This->nb_normals, tmp);
586 This->pNormals = HeapAlloc(GetProcessHeap(), 0, This->nb_normals * sizeof(D3DVECTOR));
587 memcpy(This->pNormals, ptr + sizeof(DWORD), This->nb_normals * sizeof(D3DVECTOR));
589 else if(!IsEqualGUID(pGuid, &TID_D3DRMMeshTextureCoords))
591 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
592 if (hr != DXFILE_OK)
593 goto end;
595 This->nb_coords2d = *(DWORD*)ptr;
597 FIXME("MeshTextureCoords: nb_coords2d = %d\n", This->nb_coords2d);
599 This->pCoords2d = HeapAlloc(GetProcessHeap(), 0, This->nb_coords2d * sizeof(Coords2d));
600 memcpy(This->pCoords2d, ptr + sizeof(DWORD), This->nb_coords2d * sizeof(Coords2d));
603 else if(!IsEqualGUID(pGuid, &TID_D3DRMMeshMaterialList))
605 FIXME("MeshMaterialList not supported yet, ignoring...\n");
607 else
609 FIXME("Unknown GUID %s, ignoring...\n", debugstr_guid(pGuid));
612 IDirectXFileData_Release(pData2);
615 ret = D3DRM_OK;
617 end:
618 if (pData)
619 IDirectXFileData_Release(pData);
620 if (pEnumObject)
621 IDirectXFileEnumObject_Release(pEnumObject);
622 if (pDXFile)
623 IDirectXFile_Release(pDXFile);
625 if (ret != D3DRM_OK)
627 /* Clean mesh data */
628 This->nb_vertices = 0;
629 This->nb_normals = 0;
630 This->nb_faces = 0;
631 This->face_data_size = 0;
632 This->nb_coords2d = 0;
633 HeapFree(GetProcessHeap(), 0, This->pVertices);
634 This->pVertices = NULL;
635 HeapFree(GetProcessHeap(), 0, This->pNormals);
636 This->pNormals = NULL;
637 HeapFree(GetProcessHeap(), 0, This->pFaceData);
638 This->pFaceData = NULL;
639 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
640 This->pCoords2d = NULL;
643 return ret;
646 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Save(IDirect3DRMMeshBuilder* iface, const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS save)
648 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
650 FIXME("(%p)->(%s,%d,%d): stub\n", This, filename, format, save);
652 return E_NOTIMPL;
655 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Scale(IDirect3DRMMeshBuilder* iface, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
657 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
659 FIXME("(%p)->(%f,%f,%f): stub\n", This, sx, sy, sz);
661 return E_NOTIMPL;
664 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Translate(IDirect3DRMMeshBuilder* iface, D3DVALUE tx, D3DVALUE ty, D3DVALUE tz)
666 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
668 FIXME("(%p)->(%f,%f,%f): stub\n", This, tx, ty, tz);
670 return E_NOTIMPL;
673 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColorSource(IDirect3DRMMeshBuilder* iface, D3DRMCOLORSOURCE color)
675 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
677 FIXME("(%p)->(%x): stub\n", This, color);
679 return E_NOTIMPL;
682 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetBox(IDirect3DRMMeshBuilder* iface, D3DRMBOX *pBox)
684 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
686 FIXME("(%p)->(%p): stub\n", This, pBox);
688 return E_NOTIMPL;
691 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GenerateNormals(IDirect3DRMMeshBuilder* iface)
693 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
695 FIXME("(%p)->(): stub\n", This);
697 return E_NOTIMPL;
700 static D3DRMCOLORSOURCE WINAPI IDirect3DRMMeshBuilderImpl_GetColorSource(IDirect3DRMMeshBuilder* iface)
702 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
704 FIXME("(%p)->(): stub\n", This);
706 return E_NOTIMPL;
709 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddMesh(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESH pMesh)
711 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
713 FIXME("(%p)->(%p): stub\n", This, pMesh);
715 return E_NOTIMPL;
718 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddMeshBuilder(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESHBUILDER pMeshBuilder)
720 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
722 FIXME("(%p)->(%p): stub\n", This, pMeshBuilder);
724 return E_NOTIMPL;
727 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFrame(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFRAME pFrame)
729 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
731 FIXME("(%p)->(%p): stub\n", This, pFrame);
733 return E_NOTIMPL;
736 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFace(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACE pFace)
738 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
740 FIXME("(%p)->(%p): stub\n", This, pFace);
742 return E_NOTIMPL;
745 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFaces(IDirect3DRMMeshBuilder* iface, DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, DWORD *data, LPDIRECT3DRMFACEARRAY* pFaceArray)
747 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
749 FIXME("(%p)->(%d,%p,%d,%p,%p,%p): stub\n", This, vcount, vertices, ncount, normals, data, pFaceArray);
751 return E_NOTIMPL;
754 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_ReserveSpace(IDirect3DRMMeshBuilder* iface, DWORD vertex_Count, DWORD normal_count, DWORD face_count)
756 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
758 FIXME("(%p)->(%d,%d,%d): stub\n", This, vertex_Count, normal_count, face_count);
760 return E_NOTIMPL;
763 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColorRGB(IDirect3DRMMeshBuilder* iface, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
765 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
767 FIXME("(%p)->(%f,%f,%f): stub\n", This, red, green, blue);
769 return E_NOTIMPL;
772 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColor(IDirect3DRMMeshBuilder* iface, D3DCOLOR color)
774 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
776 FIXME("(%p)->(%x): stub\n", This, color);
778 return E_NOTIMPL;
781 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTexture(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMTEXTURE pTexture)
783 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
785 FIXME("(%p)->(%p): stub\n", This, pTexture);
787 return E_NOTIMPL;
790 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetMaterial(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMATERIAL pMaterial)
792 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
794 FIXME("(%p)->(%p): stub\n", This, pMaterial);
796 return E_NOTIMPL;
799 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTextureTopology(IDirect3DRMMeshBuilder* iface, BOOL wrap_u, BOOL wrap_v)
801 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
803 FIXME("(%p)->(%d,%d): stub\n", This, wrap_u, wrap_v);
805 return E_NOTIMPL;
808 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetQuality(IDirect3DRMMeshBuilder* iface, D3DRMRENDERQUALITY quality)
810 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
812 FIXME("(%p)->(%d): stub\n", This, quality);
814 return E_NOTIMPL;
817 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetPerspective(IDirect3DRMMeshBuilder* iface, BOOL enable)
819 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
821 FIXME("(%p)->(%d): stub\n", This, enable);
823 return E_NOTIMPL;
826 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertex(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z)
828 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
830 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
832 return E_NOTIMPL;
835 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetNormal(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z)
837 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
839 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
841 return E_NOTIMPL;
844 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTextureCoordinates(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE u, D3DVALUE v)
846 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
848 FIXME("(%p)->(%f,%f): stub\n", This, u, v);
850 return E_NOTIMPL;
853 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertexColor(IDirect3DRMMeshBuilder* iface, DWORD index, D3DCOLOR color)
855 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
857 FIXME("(%p)->(%d,%x): stub\n", This, index, color);
859 return E_NOTIMPL;
862 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertexColorRGB(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
864 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
866 FIXME("(%p)->(%d,%f,%f,%f): stub\n", This, index, red, green, blue);
868 return E_NOTIMPL;
871 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetFaces(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACEARRAY* pFaceArray)
873 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
875 FIXME("(%p)->(%p): stub\n", This, pFaceArray);
877 return E_NOTIMPL;
880 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetVertices(IDirect3DRMMeshBuilder* iface, DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data)
882 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
884 TRACE("(%p)->(%p,%p,%p,%p,%p,%p)\n", This, vcount, vertices, ncount, normals, face_data_size, face_data);
886 if (vcount)
887 *vcount = This->nb_vertices;
888 if (vertices && This->nb_vertices)
889 memcpy(vertices, This->pVertices, This->nb_vertices * sizeof(D3DVECTOR));
890 if (ncount)
891 *ncount = This->nb_normals;
892 if (normals && This->nb_normals)
893 memcpy(normals, This->pNormals, This->nb_normals * sizeof(D3DVECTOR));
894 if (face_data_size)
895 *face_data_size = This->face_data_size;
896 if (face_data && This->face_data_size)
897 memcpy(face_data, This->pFaceData, This->face_data_size);
899 return D3DRM_OK;
902 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetTextureCoordinates(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE *u, D3DVALUE *v)
904 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
906 FIXME("(%p)->(%d,%p,%p): stub\n", This, index, u, v);
908 if (index >= This->nb_coords2d)
909 return D3DRMERR_NOTFOUND;
911 *u = This->pCoords2d[index].u;
912 *v = This->pCoords2d[index].v;
914 return D3DRM_OK;
917 static int WINAPI IDirect3DRMMeshBuilderImpl_AddVertex(IDirect3DRMMeshBuilder* iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
919 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
921 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
923 return 0;
926 static int WINAPI IDirect3DRMMeshBuilderImpl_AddNormal(IDirect3DRMMeshBuilder* iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
928 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
930 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
932 return 0;
935 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_CreateFace(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACE* ppFace)
937 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
939 FIXME("(%p)->(%p): stub\n", This, ppFace);
941 return E_NOTIMPL;
944 static D3DRMRENDERQUALITY WINAPI IDirect3DRMMeshBuilderImpl_GetQuality(IDirect3DRMMeshBuilder* iface)
946 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
948 FIXME("(%p)->(): stub\n", This);
950 return 0;
953 static BOOL WINAPI IDirect3DRMMeshBuilderImpl_GetPerspective(IDirect3DRMMeshBuilder* iface)
955 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
957 FIXME("(%p)->(): stub\n", This);
959 return FALSE;
962 static int WINAPI IDirect3DRMMeshBuilderImpl_GetFaceCount(IDirect3DRMMeshBuilder* iface)
964 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
966 TRACE("(%p)->()\n", This);
968 return This->nb_faces;
971 static int WINAPI IDirect3DRMMeshBuilderImpl_GetVertexCount(IDirect3DRMMeshBuilder* iface)
973 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
975 TRACE("(%p)->()\n", This);
977 return This->nb_vertices;
980 static D3DCOLOR WINAPI IDirect3DRMMeshBuilderImpl_GetVertexColor(IDirect3DRMMeshBuilder* iface, DWORD index)
982 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
984 FIXME("(%p)->(%d): stub\n", This, index);
986 return 0;
989 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_CreateMesh(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESH* ppMesh)
991 IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder(iface);
993 FIXME("(%p)->(%p): stub\n", This, ppMesh);
995 return E_NOTIMPL;
998 static const struct IDirect3DRMMeshBuilderVtbl Direct3DRMMeshBuilder_Vtbl =
1000 /*** IUnknown methods ***/
1001 IDirect3DRMMeshBuilderImpl_QueryInterface,
1002 IDirect3DRMMeshBuilderImpl_AddRef,
1003 IDirect3DRMMeshBuilderImpl_Release,
1004 /*** IDirect3DRMObject methods ***/
1005 IDirect3DRMMeshBuilderImpl_Clone,
1006 IDirect3DRMMeshBuilderImpl_AddDestroyCallback,
1007 IDirect3DRMMeshBuilderImpl_DeleteDestroyCallback,
1008 IDirect3DRMMeshBuilderImpl_SetAppData,
1009 IDirect3DRMMeshBuilderImpl_GetAppData,
1010 IDirect3DRMMeshBuilderImpl_SetName,
1011 IDirect3DRMMeshBuilderImpl_GetName,
1012 IDirect3DRMMeshBuilderImpl_GetClassName,
1013 /*** IDirect3DRMMeshBuilder methods ***/
1014 IDirect3DRMMeshBuilderImpl_Load,
1015 IDirect3DRMMeshBuilderImpl_Save,
1016 IDirect3DRMMeshBuilderImpl_Scale,
1017 IDirect3DRMMeshBuilderImpl_Translate,
1018 IDirect3DRMMeshBuilderImpl_SetColorSource,
1019 IDirect3DRMMeshBuilderImpl_GetBox,
1020 IDirect3DRMMeshBuilderImpl_GenerateNormals,
1021 IDirect3DRMMeshBuilderImpl_GetColorSource,
1022 IDirect3DRMMeshBuilderImpl_AddMesh,
1023 IDirect3DRMMeshBuilderImpl_AddMeshBuilder,
1024 IDirect3DRMMeshBuilderImpl_AddFrame,
1025 IDirect3DRMMeshBuilderImpl_AddFace,
1026 IDirect3DRMMeshBuilderImpl_AddFaces,
1027 IDirect3DRMMeshBuilderImpl_ReserveSpace,
1028 IDirect3DRMMeshBuilderImpl_SetColorRGB,
1029 IDirect3DRMMeshBuilderImpl_SetColor,
1030 IDirect3DRMMeshBuilderImpl_SetTexture,
1031 IDirect3DRMMeshBuilderImpl_SetMaterial,
1032 IDirect3DRMMeshBuilderImpl_SetTextureTopology,
1033 IDirect3DRMMeshBuilderImpl_SetQuality,
1034 IDirect3DRMMeshBuilderImpl_SetPerspective,
1035 IDirect3DRMMeshBuilderImpl_SetVertex,
1036 IDirect3DRMMeshBuilderImpl_SetNormal,
1037 IDirect3DRMMeshBuilderImpl_SetTextureCoordinates,
1038 IDirect3DRMMeshBuilderImpl_SetVertexColor,
1039 IDirect3DRMMeshBuilderImpl_SetVertexColorRGB,
1040 IDirect3DRMMeshBuilderImpl_GetFaces,
1041 IDirect3DRMMeshBuilderImpl_GetVertices,
1042 IDirect3DRMMeshBuilderImpl_GetTextureCoordinates,
1043 IDirect3DRMMeshBuilderImpl_AddVertex,
1044 IDirect3DRMMeshBuilderImpl_AddNormal,
1045 IDirect3DRMMeshBuilderImpl_CreateFace,
1046 IDirect3DRMMeshBuilderImpl_GetQuality,
1047 IDirect3DRMMeshBuilderImpl_GetPerspective,
1048 IDirect3DRMMeshBuilderImpl_GetFaceCount,
1049 IDirect3DRMMeshBuilderImpl_GetVertexCount,
1050 IDirect3DRMMeshBuilderImpl_GetVertexColor,
1051 IDirect3DRMMeshBuilderImpl_CreateMesh