configure: Changes from running autconf after previous patch.
[wine/hacks.git] / dlls / d3drm / meshbuilder.c
blobbd5af1b6efd08d6039b6b6f51ba5e19f92344f79
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 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 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 HRESULT Direct3DRMMeshBuilder_create(LPDIRECT3DRMMESHBUILDER* ppMeshBuilder)
287 IDirect3DRMMeshBuilderImpl* object;
289 TRACE("(%p)\n", ppMeshBuilder);
291 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMMeshBuilderImpl));
292 if (!object)
294 ERR("Out of memory\n");
295 return E_OUTOFMEMORY;
298 object->lpVtbl = &Direct3DRMMeshBuilder_Vtbl;
299 object->ref = 1;
301 *ppMeshBuilder = (IDirect3DRMMeshBuilder*)object;
303 return S_OK;
306 /*** IUnknown methods ***/
307 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_QueryInterface(IDirect3DRMMeshBuilder* iface, REFIID riid, void** ppvObject)
309 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
311 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObject);
313 if (IsEqualGUID(riid, &IID_IUnknown) ||
314 IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder))
316 IClassFactory_AddRef(iface);
317 *ppvObject = This;
318 return S_OK;
321 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
322 return E_NOINTERFACE;
325 static ULONG WINAPI IDirect3DRMMeshBuilderImpl_AddRef(IDirect3DRMMeshBuilder* iface)
327 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
329 TRACE("(%p)\n", This);
331 return InterlockedIncrement(&This->ref);
334 static ULONG WINAPI IDirect3DRMMeshBuilderImpl_Release(IDirect3DRMMeshBuilder* iface)
336 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
337 ULONG ref = InterlockedDecrement(&This->ref);
339 TRACE("(%p)\n", This);
341 if (!ref)
343 HeapFree(GetProcessHeap(), 0, This->pVertices);
344 HeapFree(GetProcessHeap(), 0, This->pNormals);
345 HeapFree(GetProcessHeap(), 0, This->pFaceData);
346 HeapFree(GetProcessHeap(), 0, This);
349 return ref;
352 /*** IDirect3DRMObject methods ***/
353 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Clone(IDirect3DRMMeshBuilder* iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
355 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
357 FIXME("(%p)->(%p,%s,%p): stub\n", This, pUnkOuter, debugstr_guid(riid), ppvObj);
359 return E_NOTIMPL;
362 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddDestroyCallback(IDirect3DRMMeshBuilder* iface, D3DRMOBJECTCALLBACK cb, LPVOID argument)
364 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
366 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
368 return E_NOTIMPL;
371 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_DeleteDestroyCallback(IDirect3DRMMeshBuilder* iface, D3DRMOBJECTCALLBACK cb, LPVOID argument)
373 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
375 FIXME("(%p)->(%p,%p): stub\n", This, cb, argument);
377 return E_NOTIMPL;
380 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetAppData(IDirect3DRMMeshBuilder* iface, DWORD data)
382 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
384 FIXME("(%p)->(%u): stub\n", This, data);
386 return E_NOTIMPL;
389 static DWORD WINAPI IDirect3DRMMeshBuilderImpl_GetAppData(IDirect3DRMMeshBuilder* iface)
391 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
393 FIXME("(%p)->(): stub\n", This);
395 return 0;
398 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetName(IDirect3DRMMeshBuilder* iface, LPCSTR pName)
400 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
402 FIXME("(%p)->(%s): stub\n", This, pName);
404 return E_NOTIMPL;
407 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetName(IDirect3DRMMeshBuilder* iface, LPDWORD lpdwSize, LPSTR lpName)
409 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
411 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
413 return E_NOTIMPL;
416 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetClassName(IDirect3DRMMeshBuilder* iface, LPDWORD lpdwSize, LPSTR lpName)
418 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
420 FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName);
422 return E_NOTIMPL;
425 /*** IDirect3DRMMeshBuilder methods ***/
426 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Load(IDirect3DRMMeshBuilder* iface, LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK cb, LPVOID pArg)
428 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
429 DXFILELOADOPTIONS load_options;
430 LPDIRECTXFILE pDXFile = NULL;
431 LPDIRECTXFILEENUMOBJECT pEnumObject = NULL;
432 LPDIRECTXFILEDATA pData = NULL;
433 LPDIRECTXFILEOBJECT pObject = NULL;
434 LPDIRECTXFILEDATA pData2 = NULL;
435 const GUID* pGuid;
436 DWORD size;
437 Header* pHeader;
438 LPBYTE ptr;
439 HRESULT hr;
440 HRESULT ret = D3DRMERR_BADOBJECT;
442 FIXME("(%p)->(%p,%p,%x,%p,%p): partial stub\n", This, filename, name, loadflags, cb, pArg);
444 /* First free allocated buffers of previous mesh data */
445 HeapFree(GetProcessHeap(), 0, This->pVertices);
446 This->pVertices = NULL;
447 HeapFree(GetProcessHeap(), 0, This->pNormals);
448 This->pNormals = NULL;
449 HeapFree(GetProcessHeap(), 0, This->pFaceData);
450 This->pFaceData = NULL;
451 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
452 This->pCoords2d = NULL;
454 if (loadflags == D3DRMLOAD_FROMMEMORY)
456 load_options = DXFILELOAD_FROMMEMORY;
458 else
460 FIXME("Load options %d not supported yet\n", loadflags);
461 return E_NOTIMPL;
464 hr = DirectXFileCreate(&pDXFile);
465 if (hr != DXFILE_OK)
466 goto end;
468 hr = IDirectXFile_RegisterTemplates(pDXFile, templates, strlen(templates));
469 if (hr != DXFILE_OK)
470 goto end;
472 hr = IDirectXFile_CreateEnumObject(pDXFile, filename, load_options, &pEnumObject);
473 if (hr != DXFILE_OK)
474 goto end;
476 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
477 if (hr != DXFILE_OK)
478 goto end;
480 hr = IDirectXFileData_GetType(pData, &pGuid);
481 if (hr != DXFILE_OK)
482 goto end;
484 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
486 if (!IsEqualGUID(pGuid, &TID_DXFILEHeader))
488 ret = D3DRMERR_BADFILE;
489 goto end;
492 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&pHeader);
493 if ((hr != DXFILE_OK) || (size != sizeof(Header)))
494 goto end;
496 TRACE("Version is %d %d %d\n", pHeader->major, pHeader->minor, pHeader->flags);
498 /* Version must be 1.0.x */
499 if ((pHeader->major != 1) || (pHeader->minor != 0))
501 ret = D3DRMERR_BADFILE;
502 goto end;
505 IDirectXFileData_Release(pData);
506 pData = NULL;
508 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
509 if (hr != DXFILE_OK)
511 ret = D3DRMERR_NOTFOUND;
512 goto end;
515 hr = IDirectXFileData_GetType(pData, &pGuid);
516 if (hr != DXFILE_OK)
517 goto end;
519 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
521 if (!IsEqualGUID(pGuid, &TID_D3DRMMesh))
523 ret = D3DRMERR_NOTFOUND;
524 goto end;
527 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
528 if (hr != DXFILE_OK)
529 goto end;
531 This->nb_vertices = *(DWORD*)ptr;
532 This->nb_faces = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR));
533 This->face_data_size = size - sizeof(DWORD) - This->nb_vertices * sizeof(D3DVECTOR) - sizeof(DWORD);
535 TRACE("Mesh: nb_vertices = %d, nb_faces = %d, face_data_size = %d\n", This->nb_vertices, This->nb_faces, This->face_data_size);
537 This->pVertices = HeapAlloc(GetProcessHeap(), 0, This->nb_vertices * sizeof(D3DVECTOR));
538 memcpy(This->pVertices, ptr + sizeof(DWORD), This->nb_vertices * sizeof(D3DVECTOR));
540 This->pFaceData = HeapAlloc(GetProcessHeap(), 0, This->face_data_size);
541 memcpy(This->pFaceData, ptr + sizeof(DWORD) + This->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD), This->face_data_size);
543 while (1)
545 hr = IDirectXFileData_GetNextObject(pData, &pObject);
546 if (hr == DXFILEERR_NOMOREOBJECTS)
548 FIXME("no more object\n");
549 break;
551 if (hr != DXFILE_OK)
552 goto end;
554 hr = IDirectXFileObject_QueryInterface(pObject, &IID_IDirectXFileData, (void**)&pData2);
555 IDirectXFileObject_Release(pObject);
556 if (hr != DXFILE_OK)
557 goto end;
559 hr = IDirectXFileData_GetType(pData2, &pGuid);
560 if (hr != DXFILE_OK)
562 IDirectXFileData_Release(pData2);
563 goto end;
566 FIXME("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
568 if (!IsEqualGUID(pGuid, &TID_D3DRMMeshNormals))
570 DWORD tmp;
572 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
573 if (hr != DXFILE_OK)
574 goto end;
576 This->nb_normals = *(DWORD*)ptr;
577 tmp = *(DWORD*)(ptr + sizeof(DWORD) + This->nb_normals * sizeof(D3DVECTOR));
579 FIXME("MeshNormals: nb_normals = %d, nb_faces_normals = %d\n", This->nb_normals, tmp);
581 This->pNormals = HeapAlloc(GetProcessHeap(), 0, This->nb_normals * sizeof(D3DVECTOR));
582 memcpy(This->pNormals, ptr + sizeof(DWORD), This->nb_normals * sizeof(D3DVECTOR));
584 else if(!IsEqualGUID(pGuid, &TID_D3DRMMeshTextureCoords))
586 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr);
587 if (hr != DXFILE_OK)
588 goto end;
590 This->nb_coords2d = *(DWORD*)ptr;
592 FIXME("MeshTextureCoords: nb_coords2d = %d\n", This->nb_coords2d);
594 This->pCoords2d = HeapAlloc(GetProcessHeap(), 0, This->nb_coords2d * sizeof(Coords2d));
595 memcpy(This->pCoords2d, ptr + sizeof(DWORD), This->nb_coords2d * sizeof(Coords2d));
598 else if(!IsEqualGUID(pGuid, &TID_D3DRMMeshMaterialList))
600 FIXME("MeshMaterialList not supported yet, ignoring...\n");
602 else
604 FIXME("Unknown GUID %s, ignoring...\n", debugstr_guid(pGuid));
607 IDirectXFileData_Release(pData2);
610 ret = D3DRM_OK;
612 end:
613 if (pData)
614 IDirectXFileData_Release(pData);
615 if (pEnumObject)
616 IDirectXFileEnumObject_Release(pEnumObject);
617 if (pDXFile)
618 IDirectXFile_Release(pDXFile);
620 if (ret != D3DRM_OK)
622 /* Clean mesh data */
623 This->nb_vertices = 0;
624 This->nb_normals = 0;
625 This->nb_faces = 0;
626 This->face_data_size = 0;
627 This->nb_coords2d = 0;
628 HeapFree(GetProcessHeap(), 0, This->pVertices);
629 This->pVertices = NULL;
630 HeapFree(GetProcessHeap(), 0, This->pNormals);
631 This->pNormals = NULL;
632 HeapFree(GetProcessHeap(), 0, This->pFaceData);
633 This->pFaceData = NULL;
634 HeapFree(GetProcessHeap(), 0, This->pCoords2d);
635 This->pCoords2d = NULL;
638 return ret;
641 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Save(IDirect3DRMMeshBuilder* iface, const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS save)
643 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
645 FIXME("(%p)->(%s,%d,%d): stub\n", This, filename, format, save);
647 return E_NOTIMPL;
650 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Scale(IDirect3DRMMeshBuilder* iface, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
652 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
654 FIXME("(%p)->(%f,%f,%f): stub\n", This, sx, sy, sz);
656 return E_NOTIMPL;
659 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Translate(IDirect3DRMMeshBuilder* iface, D3DVALUE tx, D3DVALUE ty, D3DVALUE tz)
661 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
663 FIXME("(%p)->(%f,%f,%f): stub\n", This, tx, ty, tz);
665 return E_NOTIMPL;
668 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColorSource(IDirect3DRMMeshBuilder* iface, D3DRMCOLORSOURCE color)
670 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
672 FIXME("(%p)->(%x): stub\n", This, color);
674 return E_NOTIMPL;
677 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetBox(IDirect3DRMMeshBuilder* iface, D3DRMBOX *pBox)
679 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
681 FIXME("(%p)->(%p): stub\n", This, pBox);
683 return E_NOTIMPL;
686 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GenerateNormals(IDirect3DRMMeshBuilder* iface)
688 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
690 FIXME("(%p)->(): stub\n", This);
692 return E_NOTIMPL;
695 static D3DRMCOLORSOURCE WINAPI IDirect3DRMMeshBuilderImpl_GetColorSource(IDirect3DRMMeshBuilder* iface)
697 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
699 FIXME("(%p)->(): stub\n", This);
701 return E_NOTIMPL;
704 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddMesh(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESH pMesh)
706 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
708 FIXME("(%p)->(%p): stub\n", This, pMesh);
710 return E_NOTIMPL;
713 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddMeshBuilder(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESHBUILDER pMeshBuilder)
715 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
717 FIXME("(%p)->(%p): stub\n", This, pMeshBuilder);
719 return E_NOTIMPL;
722 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFrame(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFRAME pFrame)
724 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
726 FIXME("(%p)->(%p): stub\n", This, pFrame);
728 return E_NOTIMPL;
731 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFace(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACE pFace)
733 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
735 FIXME("(%p)->(%p): stub\n", This, pFace);
737 return E_NOTIMPL;
740 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_AddFaces(IDirect3DRMMeshBuilder* iface, DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, DWORD *data, LPDIRECT3DRMFACEARRAY* pFaceArray)
742 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
744 FIXME("(%p)->(%d,%p,%d,%p,%p,%p): stub\n", This, vcount, vertices, ncount, normals, data, pFaceArray);
746 return E_NOTIMPL;
749 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_ReserveSpace(IDirect3DRMMeshBuilder* iface, DWORD vertex_Count, DWORD normal_count, DWORD face_count)
751 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
753 FIXME("(%p)->(%d,%d,%d): stub\n", This, vertex_Count, normal_count, face_count);
755 return E_NOTIMPL;
758 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColorRGB(IDirect3DRMMeshBuilder* iface, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
760 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
762 FIXME("(%p)->(%f,%f,%f): stub\n", This, red, green, blue);
764 return E_NOTIMPL;
767 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetColor(IDirect3DRMMeshBuilder* iface, D3DCOLOR color)
769 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
771 FIXME("(%p)->(%x): stub\n", This, color);
773 return E_NOTIMPL;
776 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTexture(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMTEXTURE pTexture)
778 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
780 FIXME("(%p)->(%p): stub\n", This, pTexture);
782 return E_NOTIMPL;
785 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetMaterial(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMATERIAL pMaterial)
787 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
789 FIXME("(%p)->(%p): stub\n", This, pMaterial);
791 return E_NOTIMPL;
794 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTextureTopology(IDirect3DRMMeshBuilder* iface, BOOL wrap_u, BOOL wrap_v)
796 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
798 FIXME("(%p)->(%d,%d): stub\n", This, wrap_u, wrap_v);
800 return E_NOTIMPL;
803 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetQuality(IDirect3DRMMeshBuilder* iface, D3DRMRENDERQUALITY quality)
805 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
807 FIXME("(%p)->(%d): stub\n", This, quality);
809 return E_NOTIMPL;
812 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetPerspective(IDirect3DRMMeshBuilder* iface, BOOL enable)
814 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
816 FIXME("(%p)->(%d): stub\n", This, enable);
818 return E_NOTIMPL;
821 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertex(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z)
823 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
825 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
827 return E_NOTIMPL;
830 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetNormal(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z)
832 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
834 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
836 return E_NOTIMPL;
839 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetTextureCoordinates(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE u, D3DVALUE v)
841 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
843 FIXME("(%p)->(%f,%f): stub\n", This, u, v);
845 return E_NOTIMPL;
848 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertexColor(IDirect3DRMMeshBuilder* iface, DWORD index, D3DCOLOR color)
850 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
852 FIXME("(%p)->(%d,%x): stub\n", This, index, color);
854 return E_NOTIMPL;
857 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_SetVertexColorRGB(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
859 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
861 FIXME("(%p)->(%d,%f,%f,%f): stub\n", This, index, red, green, blue);
863 return E_NOTIMPL;
866 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetFaces(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACEARRAY* pFaceArray)
868 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
870 FIXME("(%p)->(%p): stub\n", This, pFaceArray);
872 return E_NOTIMPL;
875 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetVertices(IDirect3DRMMeshBuilder* iface, DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data)
877 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
879 TRACE("(%p)->(%p,%p,%p,%p,%p,%p)\n", This, vcount, vertices, ncount, normals, face_data_size, face_data);
881 if (vcount)
882 *vcount = This->nb_vertices;
883 if (vertices && This->nb_vertices)
884 memcpy(vertices, This->pVertices, This->nb_vertices * sizeof(D3DVECTOR));
885 if (ncount)
886 *ncount = This->nb_normals;
887 if (normals && This->nb_normals)
888 memcpy(normals, This->pNormals, This->nb_normals * sizeof(D3DVECTOR));
889 if (face_data_size)
890 *face_data_size = This->face_data_size;
891 if (face_data && This->face_data_size)
892 memcpy(face_data, This->pFaceData, This->face_data_size);
894 return D3DRM_OK;
897 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_GetTextureCoordinates(IDirect3DRMMeshBuilder* iface, DWORD index, D3DVALUE *u, D3DVALUE *v)
899 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
901 FIXME("(%p)->(%d,%p,%p): stub\n", This, index, u, v);
903 if (index >= This->nb_coords2d)
904 return D3DRMERR_NOTFOUND;
906 *u = This->pCoords2d[index].u;
907 *v = This->pCoords2d[index].v;
909 return D3DRM_OK;
912 static int WINAPI IDirect3DRMMeshBuilderImpl_AddVertex(IDirect3DRMMeshBuilder* iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
914 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
916 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
918 return 0;
921 static int WINAPI IDirect3DRMMeshBuilderImpl_AddNormal(IDirect3DRMMeshBuilder* iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
923 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
925 FIXME("(%p)->(%f,%f,%f): stub\n", This, x, y, z);
927 return 0;
930 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_CreateFace(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMFACE* ppFace)
932 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
934 FIXME("(%p)->(%p): stub\n", This, ppFace);
936 return E_NOTIMPL;
939 static D3DRMRENDERQUALITY WINAPI IDirect3DRMMeshBuilderImpl_GetQuality(IDirect3DRMMeshBuilder* iface)
941 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
943 FIXME("(%p)->(): stub\n", This);
945 return 0;
948 static BOOL WINAPI IDirect3DRMMeshBuilderImpl_GetPerspective(IDirect3DRMMeshBuilder* iface)
950 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
952 FIXME("(%p)->(): stub\n", This);
954 return FALSE;
957 static int WINAPI IDirect3DRMMeshBuilderImpl_GetFaceCount(IDirect3DRMMeshBuilder* iface)
959 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
961 TRACE("(%p)->()\n", This);
963 return This->nb_faces;
966 static int WINAPI IDirect3DRMMeshBuilderImpl_GetVertexCount(IDirect3DRMMeshBuilder* iface)
968 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
970 TRACE("(%p)->()\n", This);
972 return This->nb_vertices;
975 static D3DCOLOR WINAPI IDirect3DRMMeshBuilderImpl_GetVertexColor(IDirect3DRMMeshBuilder* iface, DWORD index)
977 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
979 FIXME("(%p)->(%d): stub\n", This, index);
981 return 0;
984 static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_CreateMesh(IDirect3DRMMeshBuilder* iface, LPDIRECT3DRMMESH* ppMesh)
986 IDirect3DRMMeshBuilderImpl *This = (IDirect3DRMMeshBuilderImpl *)iface;
988 FIXME("(%p)->(%p): stub\n", This, ppMesh);
990 return E_NOTIMPL;
993 static const struct IDirect3DRMMeshBuilderVtbl Direct3DRMMeshBuilder_Vtbl =
995 /*** IUnknown methods ***/
996 IDirect3DRMMeshBuilderImpl_QueryInterface,
997 IDirect3DRMMeshBuilderImpl_AddRef,
998 IDirect3DRMMeshBuilderImpl_Release,
999 /*** IDirect3DRMObject methods ***/
1000 IDirect3DRMMeshBuilderImpl_Clone,
1001 IDirect3DRMMeshBuilderImpl_AddDestroyCallback,
1002 IDirect3DRMMeshBuilderImpl_DeleteDestroyCallback,
1003 IDirect3DRMMeshBuilderImpl_SetAppData,
1004 IDirect3DRMMeshBuilderImpl_GetAppData,
1005 IDirect3DRMMeshBuilderImpl_SetName,
1006 IDirect3DRMMeshBuilderImpl_GetName,
1007 IDirect3DRMMeshBuilderImpl_GetClassName,
1008 /*** IDirect3DRMMeshBuilder methods ***/
1009 IDirect3DRMMeshBuilderImpl_Load,
1010 IDirect3DRMMeshBuilderImpl_Save,
1011 IDirect3DRMMeshBuilderImpl_Scale,
1012 IDirect3DRMMeshBuilderImpl_Translate,
1013 IDirect3DRMMeshBuilderImpl_SetColorSource,
1014 IDirect3DRMMeshBuilderImpl_GetBox,
1015 IDirect3DRMMeshBuilderImpl_GenerateNormals,
1016 IDirect3DRMMeshBuilderImpl_GetColorSource,
1017 IDirect3DRMMeshBuilderImpl_AddMesh,
1018 IDirect3DRMMeshBuilderImpl_AddMeshBuilder,
1019 IDirect3DRMMeshBuilderImpl_AddFrame,
1020 IDirect3DRMMeshBuilderImpl_AddFace,
1021 IDirect3DRMMeshBuilderImpl_AddFaces,
1022 IDirect3DRMMeshBuilderImpl_ReserveSpace,
1023 IDirect3DRMMeshBuilderImpl_SetColorRGB,
1024 IDirect3DRMMeshBuilderImpl_SetColor,
1025 IDirect3DRMMeshBuilderImpl_SetTexture,
1026 IDirect3DRMMeshBuilderImpl_SetMaterial,
1027 IDirect3DRMMeshBuilderImpl_SetTextureTopology,
1028 IDirect3DRMMeshBuilderImpl_SetQuality,
1029 IDirect3DRMMeshBuilderImpl_SetPerspective,
1030 IDirect3DRMMeshBuilderImpl_SetVertex,
1031 IDirect3DRMMeshBuilderImpl_SetNormal,
1032 IDirect3DRMMeshBuilderImpl_SetTextureCoordinates,
1033 IDirect3DRMMeshBuilderImpl_SetVertexColor,
1034 IDirect3DRMMeshBuilderImpl_SetVertexColorRGB,
1035 IDirect3DRMMeshBuilderImpl_GetFaces,
1036 IDirect3DRMMeshBuilderImpl_GetVertices,
1037 IDirect3DRMMeshBuilderImpl_GetTextureCoordinates,
1038 IDirect3DRMMeshBuilderImpl_AddVertex,
1039 IDirect3DRMMeshBuilderImpl_AddNormal,
1040 IDirect3DRMMeshBuilderImpl_CreateFace,
1041 IDirect3DRMMeshBuilderImpl_GetQuality,
1042 IDirect3DRMMeshBuilderImpl_GetPerspective,
1043 IDirect3DRMMeshBuilderImpl_GetFaceCount,
1044 IDirect3DRMMeshBuilderImpl_GetVertexCount,
1045 IDirect3DRMMeshBuilderImpl_GetVertexColor,
1046 IDirect3DRMMeshBuilderImpl_CreateMesh