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"
31 #include "d3drm_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
41 IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface
;
42 IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface
;
53 } IDirect3DRMMeshBuilderImpl
;
61 static char templates
[] = {
65 "<3D82AB43-62DA-11CF-AB39-0020AF71E433>"
72 "<3D82AB5E-62DA-11CF-AB39-0020AF71E433>"
79 "<F6F23F44-7686-11CF-8F52-0040333594A3>"
85 "<F6F23F45-7686-11CF-8F52-0040333594A3>"
86 "array FLOAT matrix[16];"
90 "<35FF44E0-6C7C-11CF-8F52-0040333594A3>"
98 "<D3E16E81-7835-11CF-8F52-0040333594A3>"
103 "template IndexedColor"
105 "<1630B820-7842-11CF-8F52-0040333594A3>"
107 "ColorRGBA indexColor;"
111 "<537DA6A0-CA37-11D0-941C-0080C80CFA7B>"
116 "<4885AE63-78E8-11CF-8F52-0040333594A3>"
120 "template MaterialWrap"
122 "<4885AE60-78E8-11CF-8F52-0040333594A3>"
126 "template TextureFilename"
128 "<A42790E1-7810-11CF-8F52-0040333594A3>"
133 "<3D82AB4D-62DA-11CF-AB39-0020AF71E433>"
134 "ColorRGBA faceColor;"
136 "ColorRGB specularColor;"
137 "ColorRGB emissiveColor;"
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>"
162 "DWORD nFaceIndexes;"
163 "array DWORD faceIndexes[nFaceIndexes];"
166 "template MeshNormals"
168 "<F6F23F43-7686-11CF-8F52-0040333594A3>"
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];"
182 "<3D82AB44-62DA-11CF-AB39-0020AF71E433>"
184 "array Vector vertices[nVertices];"
186 "array MeshFace faces[nFaces];"
189 "template FrameTransformMatrix"
191 "<F6F23F41-7686-11CF-8F52-0040333594A3>"
192 "Matrix4x4 frameMatrix;"
196 "<3D82AB46-62DA-11CF-AB39-0020AF71E433>"
201 "<10DD46A9-775B-11CF-8F52-0040333594A3>"
203 "array FLOAT values[nValues];"
205 "template TimedFloatKeys"
207 "<F406B180-7B3B-11CF-8F52-0040333594A3>"
211 "template AnimationKey"
213 "<10DD46A8-775B-11CF-8F52-0040333594A3>"
216 "array TimedFloatKeys keys[nKeys];"
218 "template AnimationOptions"
220 "<E2BF56C0-840F-11CF-8F52-0040333594A3>"
222 "DWORD positionquality;"
226 "<3D82AB4F-62DA-11CF-AB39-0020AF71E433>"
229 "template AnimationSet"
231 "<3D82AB50-62DA-11CF-AB39-0020AF71E433>"
234 "template InlineData"
236 "<3A23EEA0-94B1-11D0-AB39-0020AF71E433>"
241 "<3A23EEA1-94B1-11D0-AB39-0020AF71E433>"
243 "array STRING urls[nUrls];"
245 "template ProgressiveMesh"
247 "<8A63C360-997D-11D0-941C-0080C80CFA7B>"
252 "<A42790E0-7810-11CF-8F52-0040333594A3>"
256 "array UCHAR data4[8];"
258 "template StringProperty"
260 "<7F0F21E0-BFE1-11D1-82C0-00A0C9697271>"
264 "template PropertyBag"
266 "<7F0F21E1-BFE1-11D1-82C0-00A0C9697271>"
269 "template ExternalVisual"
271 "<98116AA0-BDBA-11D1-82C0-00A0C9697271>"
272 "Guid guidExternalVisual;"
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
);
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
;
314 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
315 return E_NOINTERFACE
;
318 IDirect3DRMMeshBuilder_AddRef(iface
);
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
);
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
);
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
);
351 /*** IDirect3DRMObject methods ***/
352 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_Clone(IDirect3DRMMeshBuilder2
* iface
,
353 LPUNKNOWN pUnkOuter
, REFIID riid
,
356 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
358 FIXME("(%p)->(%p,%s,%p): stub\n", This
, pUnkOuter
, debugstr_guid(riid
), ppvObj
);
363 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_AddDestroyCallback(IDirect3DRMMeshBuilder2
* iface
,
364 D3DRMOBJECTCALLBACK cb
,
367 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
369 FIXME("(%p)->(%p,%p): stub\n", This
, cb
, argument
);
374 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_DeleteDestroyCallback(IDirect3DRMMeshBuilder2
* iface
,
375 D3DRMOBJECTCALLBACK cb
,
378 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
380 FIXME("(%p)->(%p,%p): stub\n", This
, cb
, argument
);
385 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetAppData(IDirect3DRMMeshBuilder2
* iface
,
388 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
390 FIXME("(%p)->(%u): stub\n", This
, data
);
395 static DWORD WINAPI
IDirect3DRMMeshBuilder2Impl_GetAppData(IDirect3DRMMeshBuilder2
* iface
)
397 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
399 FIXME("(%p)->(): stub\n", This
);
404 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetName(IDirect3DRMMeshBuilder2
* iface
,
407 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
409 FIXME("(%p)->(%s): stub\n", This
, pName
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
492 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_GetBox(IDirect3DRMMeshBuilder2
* iface
,
495 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
497 FIXME("(%p)->(%p): stub\n", This
, pBox
);
502 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_GenerateNormals(IDirect3DRMMeshBuilder2
* iface
)
504 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
506 FIXME("(%p)->(): stub\n", This
);
511 static D3DRMCOLORSOURCE WINAPI
IDirect3DRMMeshBuilder2Impl_GetColorSource(IDirect3DRMMeshBuilder2
* iface
)
513 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
515 FIXME("(%p)->(): stub\n", This
);
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
);
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
);
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
);
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
);
560 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_AddFaces(IDirect3DRMMeshBuilder2
* iface
,
561 DWORD vcount
, D3DVECTOR
*vertices
,
562 DWORD ncount
, D3DVECTOR
*normals
,
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
);
573 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_ReserveSpace(IDirect3DRMMeshBuilder2
* iface
,
578 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
580 FIXME("(%p)->(%d,%d,%d): stub\n", This
, vertex_Count
, normal_count
, face_count
);
585 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetColorRGB(IDirect3DRMMeshBuilder2
* iface
,
586 D3DVALUE red
, D3DVALUE green
,
589 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
591 FIXME("(%p)->(%f,%f,%f): stub\n", This
, red
, green
, blue
);
596 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetColor(IDirect3DRMMeshBuilder2
* iface
,
599 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
601 FIXME("(%p)->(%x): stub\n", This
, color
);
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
);
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
);
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
);
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
);
646 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetPerspective(IDirect3DRMMeshBuilder2
* iface
,
649 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
651 FIXME("(%p)->(%d): stub\n", This
, enable
);
656 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetVertex(IDirect3DRMMeshBuilder2
* iface
,
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
);
667 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetNormal(IDirect3DRMMeshBuilder2
* iface
,
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
);
678 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_SetTextureCoordinates(IDirect3DRMMeshBuilder2
* iface
,
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
,
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
);
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
);
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
);
721 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_GetVertices(IDirect3DRMMeshBuilder2
* iface
,
722 DWORD
*vcount
, D3DVECTOR
*vertices
,
723 DWORD
*ncount
, D3DVECTOR
*normals
,
724 DWORD
*face_data_size
,
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
);
732 *vcount
= This
->nb_vertices
;
733 if (vertices
&& This
->nb_vertices
)
734 memcpy(vertices
, This
->pVertices
, This
->nb_vertices
* sizeof(D3DVECTOR
));
736 *ncount
= This
->nb_normals
;
737 if (normals
&& This
->nb_normals
)
738 memcpy(normals
, This
->pNormals
, This
->nb_normals
* sizeof(D3DVECTOR
));
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
));
747 static HRESULT WINAPI
IDirect3DRMMeshBuilder2Impl_GetTextureCoordinates(IDirect3DRMMeshBuilder2
* iface
,
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
,
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
);
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
);
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
);
789 static D3DRMRENDERQUALITY WINAPI
IDirect3DRMMeshBuilder2Impl_GetQuality(IDirect3DRMMeshBuilder2
* iface
)
791 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
793 FIXME("(%p)->(): stub\n", This
);
798 static BOOL WINAPI
IDirect3DRMMeshBuilder2Impl_GetPerspective(IDirect3DRMMeshBuilder2
* iface
)
800 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
802 FIXME("(%p)->(): stub\n", This
);
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
,
828 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder2(iface
);
830 FIXME("(%p)->(%d): stub\n", This
, index
);
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
);
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
);
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
);
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
,
950 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
952 FIXME("(%p)->(%p,%s,%p): stub\n", This
, pUnkOuter
, debugstr_guid(riid
), ppvObj
);
957 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_AddDestroyCallback(IDirect3DRMMeshBuilder3
* iface
,
958 D3DRMOBJECTCALLBACK cb
,
961 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
963 FIXME("(%p)->(%p,%p): stub\n", This
, cb
, argument
);
968 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_DeleteDestroyCallback(IDirect3DRMMeshBuilder3
* iface
,
969 D3DRMOBJECTCALLBACK cb
,
972 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
974 FIXME("(%p)->(%p,%p): stub\n", This
, cb
, argument
);
979 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetAppData(IDirect3DRMMeshBuilder3
* iface
,
982 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
984 FIXME("(%p)->(%u): stub\n", This
, data
);
989 static DWORD WINAPI
IDirect3DRMMeshBuilder3Impl_GetAppData(IDirect3DRMMeshBuilder3
* iface
)
991 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
993 FIXME("(%p)->(): stub\n", This
);
998 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetName(IDirect3DRMMeshBuilder3
* iface
,
1001 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1003 FIXME("(%p)->(%s): stub\n", This
, pName
);
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
);
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
);
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
;
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;
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
;
1074 FIXME("Load options %d not supported yet\n", loadflags
);
1078 hr
= DirectXFileCreate(&pDXFile
);
1079 if (hr
!= DXFILE_OK
)
1082 hr
= IDirectXFile_RegisterTemplates(pDXFile
, templates
, strlen(templates
));
1083 if (hr
!= DXFILE_OK
)
1086 hr
= IDirectXFile_CreateEnumObject(pDXFile
, filename
, load_options
, &pEnumObject
);
1087 if (hr
!= DXFILE_OK
)
1090 hr
= IDirectXFileEnumObject_GetNextDataObject(pEnumObject
, &pData
);
1091 if (hr
!= DXFILE_OK
)
1094 hr
= IDirectXFileData_GetType(pData
, &pGuid
);
1095 if (hr
!= DXFILE_OK
)
1098 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid
));
1100 if (!IsEqualGUID(pGuid
, &TID_DXFILEHeader
))
1102 ret
= D3DRMERR_BADFILE
;
1106 hr
= IDirectXFileData_GetData(pData
, NULL
, &size
, (void**)&pHeader
);
1107 if ((hr
!= DXFILE_OK
) || (size
!= sizeof(Header
)))
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
;
1119 IDirectXFileData_Release(pData
);
1122 hr
= IDirectXFileEnumObject_GetNextDataObject(pEnumObject
, &pData
);
1123 if (hr
!= DXFILE_OK
)
1125 ret
= D3DRMERR_NOTFOUND
;
1129 hr
= IDirectXFileData_GetType(pData
, &pGuid
);
1130 if (hr
!= DXFILE_OK
)
1133 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid
));
1135 if (!IsEqualGUID(pGuid
, &TID_D3DRMMesh
))
1137 ret
= D3DRMERR_NOTFOUND
;
1141 hr
= IDirectXFileData_GetData(pData
, NULL
, &size
, (void**)&ptr
);
1142 if (hr
!= DXFILE_OK
)
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
;
1164 hr
= IDirectXFileData_GetNextObject(pData
, &pObject
);
1165 if (hr
== DXFILEERR_NOMOREOBJECTS
)
1167 TRACE("No more object\n");
1170 if (hr
!= DXFILE_OK
)
1173 hr
= IDirectXFileObject_QueryInterface(pObject
, &IID_IDirectXFileData
, (void**)&pData2
);
1174 IDirectXFileObject_Release(pObject
);
1175 if (hr
!= DXFILE_OK
)
1178 hr
= IDirectXFileData_GetType(pData2
, &pGuid
);
1179 if (hr
!= DXFILE_OK
)
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
)
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
)
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");
1227 FIXME("Unknown GUID %s, ignoring...\n", debugstr_guid(pGuid
));
1230 IDirectXFileData_Release(pData2
);
1234 for (i
= 0; i
< This
->nb_faces
; i
++)
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
++);
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
;
1291 HeapFree(GetProcessHeap(), 0, faces_normal_idx_data
);
1292 HeapFree(GetProcessHeap(), 0, faces_vertex_idx_data
);
1294 IDirectXFileData_Release(pData2
);
1296 IDirectXFileData_Release(pData
);
1298 IDirectXFileEnumObject_Release(pEnumObject
);
1300 IDirectXFile_Release(pDXFile
);
1302 if (ret
!= D3DRM_OK
)
1304 /* Clean mesh data */
1305 This
->nb_vertices
= 0;
1306 This
->nb_normals
= 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
;
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
);
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
);
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
);
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
);
1364 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_GetBox(IDirect3DRMMeshBuilder3
* iface
,
1367 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1369 FIXME("(%p)->(%p): stub\n", This
, box
);
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
);
1384 static D3DRMCOLORSOURCE WINAPI
IDirect3DRMMeshBuilder3Impl_GetColorSource(IDirect3DRMMeshBuilder3
* iface
)
1386 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1388 FIXME("(%p)->(): stub\n", This
);
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
);
1403 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_AddMeshBuilder(IDirect3DRMMeshBuilder3
* iface
,
1404 LPDIRECT3DRMMESHBUILDER3 MeshBuilder
,
1407 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1409 FIXME("(%p)->(%p,%u): stub\n", This
, MeshBuilder
, flags
);
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
);
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
);
1434 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_AddFaces(IDirect3DRMMeshBuilder3
* iface
,
1435 DWORD vcount
, D3DVECTOR
* vertices
,
1436 DWORD ncount
, D3DVECTOR
* normals
,
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
);
1448 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_ReserveSpace(IDirect3DRMMeshBuilder3
* iface
,
1453 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1455 FIXME("(%p)->(%d,%d,%d): stub\n", This
, vertex_Count
, normal_count
, face_count
);
1460 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetColorRGB(IDirect3DRMMeshBuilder3
* iface
,
1461 D3DVALUE red
, D3DVALUE green
,
1464 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1466 FIXME("(%p)->(%f,%f,%f): stub\n", This
, red
, green
, blue
);
1471 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetColor(IDirect3DRMMeshBuilder3
* iface
,
1474 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1476 FIXME("(%p)->(%x): stub\n", This
, color
);
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
);
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
);
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
);
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
);
1521 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetPerspective(IDirect3DRMMeshBuilder3
* iface
,
1524 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1526 FIXME("(%p)->(%d): stub\n", This
, enable
);
1531 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetVertex(IDirect3DRMMeshBuilder3
* iface
,
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
);
1542 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetNormal(IDirect3DRMMeshBuilder3
* iface
,
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
);
1553 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetTextureCoordinates(IDirect3DRMMeshBuilder3
* iface
,
1554 DWORD index
, D3DVALUE u
,
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
;
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
);
1580 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetVertexColorRGB(IDirect3DRMMeshBuilder3
* iface
,
1582 D3DVALUE red
, D3DVALUE green
,
1585 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1587 FIXME("(%p)->(%d,%f,%f,%f): stub\n", This
, index
, red
, green
, blue
);
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
);
1602 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_GetGeometry(IDirect3DRMMeshBuilder3
* iface
,
1603 DWORD
* vcount
, D3DVECTOR
* vertices
,
1604 DWORD
* ncount
, D3DVECTOR
* normals
,
1605 DWORD
* face_data_size
,
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
);
1616 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_GetTextureCoordinates(IDirect3DRMMeshBuilder3
* iface
,
1617 DWORD index
, D3DVALUE
* u
,
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
;
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
);
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
);
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
);
1664 static D3DRMRENDERQUALITY WINAPI
IDirect3DRMMeshBuilder3Impl_GetQuality(IDirect3DRMMeshBuilder3
* iface
)
1666 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1668 FIXME("(%p)->(): stub\n", This
);
1673 static BOOL WINAPI
IDirect3DRMMeshBuilder3Impl_GetPerspective(IDirect3DRMMeshBuilder3
* iface
)
1675 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1677 FIXME("(%p)->(): stub\n", This
);
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
,
1703 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1705 FIXME("(%p)->(%d): stub\n", This
, index
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
1789 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_Optimize(IDirect3DRMMeshBuilder3
* iface
,
1792 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1794 FIXME("(%p)->(%u): stub\n", This
, flags
);
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
);
1810 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_CreateSubMesh(IDirect3DRMMeshBuilder3
* iface
,
1813 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1815 FIXME("(%p)->(%p): stub\n", This
, unkwn
);
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
);
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
);
1840 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_DeleteSubMesh(IDirect3DRMMeshBuilder3
* iface
,
1843 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1845 FIXME("(%p)->(%p): stub\n", This
, unkwn
);
1850 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_Enable(IDirect3DRMMeshBuilder3
* iface
,
1853 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1855 FIXME("(%p)->(%u): stub\n", This
, index
);
1860 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_GetEnable(IDirect3DRMMeshBuilder3
* iface
,
1863 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1865 FIXME("(%p)->(%p): stub\n", This
, indices
);
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
);
1881 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetVertices(IDirect3DRMMeshBuilder3
* iface
,
1882 DWORD IndexFirst
, DWORD count
,
1885 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1887 FIXME("(%p)->(%u,%u,%p): stub\n", This
, IndexFirst
, count
, vector
);
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
);
1903 if (vertices
&& This
->nb_vertices
)
1904 memcpy(vertices
, This
->pVertices
+ IndexFirst
, count
* sizeof(D3DVECTOR
));
1909 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_SetNormals(IDirect3DRMMeshBuilder3
* iface
,
1910 DWORD IndexFirst
, DWORD count
,
1913 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1915 FIXME("(%p)->(%u,%u,%p): stub\n", This
, IndexFirst
, count
, vector
);
1920 static HRESULT WINAPI
IDirect3DRMMeshBuilder3Impl_GetNormals(IDirect3DRMMeshBuilder3
* iface
,
1921 DWORD IndexFirst
, LPDWORD count
,
1924 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1926 FIXME("(%p)->(%u,%p,%p): stub\n", This
, IndexFirst
, count
, vector
);
1931 static int WINAPI
IDirect3DRMMeshBuilder3Impl_GetNormalCount(IDirect3DRMMeshBuilder3
* iface
)
1933 IDirect3DRMMeshBuilderImpl
*This
= impl_from_IDirect3DRMMeshBuilder3(iface
);
1935 FIXME("(%p)->(): stub\n", This
);
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
));
2026 ERR("Out of memory\n");
2027 return E_OUTOFMEMORY
;
2030 object
->IDirect3DRMMeshBuilder2_iface
.lpVtbl
= &Direct3DRMMeshBuilder2_Vtbl
;
2031 object
->IDirect3DRMMeshBuilder3_iface
.lpVtbl
= &Direct3DRMMeshBuilder3_Vtbl
;
2034 if (IsEqualGUID(riid
, &IID_IDirect3DRMMeshBuilder3
))
2035 *ppObj
= (IUnknown
*)&object
->IDirect3DRMMeshBuilder3_iface
;
2037 *ppObj
= (IUnknown
*)&object
->IDirect3DRMMeshBuilder2_iface
;