2 * Implementation of IDirect3DRMFace Interface
4 * Copyright 2013 André Hentschel
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/debug.h"
28 #include "d3drm_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
34 IDirect3DRMFace IDirect3DRMFace_iface
;
35 IDirect3DRMFace2 IDirect3DRMFace2_iface
;
39 static inline struct d3drm_face
*impl_from_IDirect3DRMFace(IDirect3DRMFace
*iface
)
41 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace_iface
);
44 static inline struct d3drm_face
*impl_from_IDirect3DRMFace2(IDirect3DRMFace2
*iface
)
46 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace2_iface
);
49 static HRESULT WINAPI
d3drm_face1_QueryInterface(IDirect3DRMFace
*iface
, REFIID riid
, void **out
)
51 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
53 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
56 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace
)
57 || IsEqualGUID(riid
, &IID_IUnknown
))
59 *out
= &face
->IDirect3DRMFace_iface
;
61 else if(IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
63 *out
= &face
->IDirect3DRMFace2_iface
;
68 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
72 IUnknown_AddRef((IUnknown
*)*out
);
76 static ULONG WINAPI
d3drm_face1_AddRef(IDirect3DRMFace
*iface
)
78 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
79 ULONG refcount
= InterlockedIncrement(&face
->ref
);
81 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
86 static ULONG WINAPI
d3drm_face1_Release(IDirect3DRMFace
*iface
)
88 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
89 ULONG refcount
= InterlockedDecrement(&face
->ref
);
91 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
94 HeapFree(GetProcessHeap(), 0, face
);
99 static HRESULT WINAPI
d3drm_face1_Clone(IDirect3DRMFace
*iface
,
100 IUnknown
*outer
, REFIID iid
, void **out
)
102 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
107 static HRESULT WINAPI
d3drm_face1_AddDestroyCallback(IDirect3DRMFace
*iface
,
108 D3DRMOBJECTCALLBACK cb
, void *ctx
)
110 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
115 static HRESULT WINAPI
d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace
*iface
,
116 D3DRMOBJECTCALLBACK cb
, void *ctx
)
118 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
123 static HRESULT WINAPI
d3drm_face1_SetAppData(IDirect3DRMFace
*iface
, DWORD data
)
125 FIXME("iface %p, data %#x stub!\n", iface
, data
);
130 static DWORD WINAPI
d3drm_face1_GetAppData(IDirect3DRMFace
*iface
)
132 FIXME("iface %p stub!\n", iface
);
137 static HRESULT WINAPI
d3drm_face1_SetName(IDirect3DRMFace
*iface
, const char *name
)
139 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
144 static HRESULT WINAPI
d3drm_face1_GetName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
146 FIXME("iface %p, size %p, name %p stub!\n", iface
, size
, name
);
151 static HRESULT WINAPI
d3drm_face1_GetClassName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
153 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
155 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
157 return IDirect3DRMFace2_GetClassName(&face
->IDirect3DRMFace2_iface
, size
, name
);
160 static HRESULT WINAPI
d3drm_face1_AddVertex(IDirect3DRMFace
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
162 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
167 static HRESULT WINAPI
d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace
*iface
,
168 DWORD vertex
, DWORD normal
)
170 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
175 static HRESULT WINAPI
d3drm_face1_SetColorRGB(IDirect3DRMFace
*iface
,
176 D3DVALUE r
, D3DVALUE g
, D3DVALUE b
)
178 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface
, r
, g
, b
);
183 static HRESULT WINAPI
d3drm_face1_SetColor(IDirect3DRMFace
*iface
, D3DCOLOR color
)
185 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
190 static HRESULT WINAPI
d3drm_face1_SetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
*texture
)
192 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
197 static HRESULT WINAPI
d3drm_face1_SetTextureCoordinates(IDirect3DRMFace
*iface
,
198 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
200 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
205 static HRESULT WINAPI
d3drm_face1_SetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
*material
)
207 FIXME("iface %p, material %p stub!\n", iface
, material
);
212 static HRESULT WINAPI
d3drm_face1_SetTextureTopology(IDirect3DRMFace
*iface
, BOOL wrap_u
, BOOL wrap_v
)
214 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
219 static HRESULT WINAPI
d3drm_face1_GetVertex(IDirect3DRMFace
*iface
,
220 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
222 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
227 static HRESULT WINAPI
d3drm_face1_GetVertices(IDirect3DRMFace
*iface
,
228 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
230 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
231 iface
, vertex_count
, coords
, normals
);
236 static HRESULT WINAPI
d3drm_face1_GetTextureCoordinates(IDirect3DRMFace
*iface
,
237 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
239 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
244 static HRESULT WINAPI
d3drm_face1_GetTextureTopology(IDirect3DRMFace
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
246 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
251 static HRESULT WINAPI
d3drm_face1_GetNormal(IDirect3DRMFace
*iface
, D3DVECTOR
*normal
)
253 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
258 static HRESULT WINAPI
d3drm_face1_GetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
**texture
)
260 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
265 static HRESULT WINAPI
d3drm_face1_GetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
**material
)
267 FIXME("iface %p, material %p stub!\n", iface
, material
);
272 static int WINAPI
d3drm_face1_GetVertexCount(IDirect3DRMFace
*iface
)
274 FIXME("iface %p stub!\n", iface
);
279 static int WINAPI
d3drm_face1_GetVertexIndex(IDirect3DRMFace
*iface
, DWORD which
)
281 FIXME("iface %p, which %u stub!\n", iface
, which
);
286 static int WINAPI
d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace
*iface
, DWORD which
)
288 FIXME("iface %p, which %u stub!\n", iface
, which
);
293 static D3DCOLOR WINAPI
d3drm_face1_GetColor(IDirect3DRMFace
*iface
)
295 FIXME("iface %p stub!\n", iface
);
300 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl
=
302 d3drm_face1_QueryInterface
,
306 d3drm_face1_AddDestroyCallback
,
307 d3drm_face1_DeleteDestroyCallback
,
308 d3drm_face1_SetAppData
,
309 d3drm_face1_GetAppData
,
312 d3drm_face1_GetClassName
,
313 d3drm_face1_AddVertex
,
314 d3drm_face1_AddVertexAndNormalIndexed
,
315 d3drm_face1_SetColorRGB
,
316 d3drm_face1_SetColor
,
317 d3drm_face1_SetTexture
,
318 d3drm_face1_SetTextureCoordinates
,
319 d3drm_face1_SetMaterial
,
320 d3drm_face1_SetTextureTopology
,
321 d3drm_face1_GetVertex
,
322 d3drm_face1_GetVertices
,
323 d3drm_face1_GetTextureCoordinates
,
324 d3drm_face1_GetTextureTopology
,
325 d3drm_face1_GetNormal
,
326 d3drm_face1_GetTexture
,
327 d3drm_face1_GetMaterial
,
328 d3drm_face1_GetVertexCount
,
329 d3drm_face1_GetVertexIndex
,
330 d3drm_face1_GetTextureCoordinateIndex
,
331 d3drm_face1_GetColor
,
334 static HRESULT WINAPI
d3drm_face2_QueryInterface(IDirect3DRMFace2
*iface
, REFIID riid
, void **out
)
336 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
338 return d3drm_face1_QueryInterface(&face
->IDirect3DRMFace_iface
, riid
, out
);
341 static ULONG WINAPI
d3drm_face2_AddRef(IDirect3DRMFace2
*iface
)
343 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
345 return d3drm_face1_AddRef(&face
->IDirect3DRMFace_iface
);
348 static ULONG WINAPI
d3drm_face2_Release(IDirect3DRMFace2
*iface
)
350 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
352 return d3drm_face1_Release(&face
->IDirect3DRMFace_iface
);
355 static HRESULT WINAPI
d3drm_face2_Clone(IDirect3DRMFace2
*iface
,
356 IUnknown
*outer
, REFIID iid
, void **out
)
358 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
363 static HRESULT WINAPI
d3drm_face2_AddDestroyCallback(IDirect3DRMFace2
*iface
,
364 D3DRMOBJECTCALLBACK cb
, void *ctx
)
366 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
371 static HRESULT WINAPI
d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2
*iface
,
372 D3DRMOBJECTCALLBACK cb
, void *ctx
)
374 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
379 static HRESULT WINAPI
d3drm_face2_SetAppData(IDirect3DRMFace2
*iface
, DWORD data
)
381 FIXME("iface %p, data %#x stub!\n", iface
, data
);
386 static DWORD WINAPI
d3drm_face2_GetAppData(IDirect3DRMFace2
*iface
)
388 FIXME("iface %p stub!\n", iface
);
393 static HRESULT WINAPI
d3drm_face2_SetName(IDirect3DRMFace2
*iface
, const char *name
)
395 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
400 static HRESULT WINAPI
d3drm_face2_GetName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
402 FIXME("iface %p, size %p, name %p stub!\n", iface
, size
, name
);
407 static HRESULT WINAPI
d3drm_face2_GetClassName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
409 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
411 if (!size
|| *size
< strlen("Face") || !name
)
414 strcpy(name
, "Face");
415 *size
= sizeof("Face");
420 static HRESULT WINAPI
d3drm_face2_AddVertex(IDirect3DRMFace2
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
422 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
427 static HRESULT WINAPI
d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2
*iface
,
428 DWORD vertex
, DWORD normal
)
430 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
435 static HRESULT WINAPI
d3drm_face2_SetColorRGB(IDirect3DRMFace2
*iface
, D3DVALUE r
, D3DVALUE g
, D3DVALUE b
)
437 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface
, r
, g
, b
);
442 static HRESULT WINAPI
d3drm_face2_SetColor(IDirect3DRMFace2
*iface
, D3DCOLOR color
)
444 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
449 static HRESULT WINAPI
d3drm_face2_SetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
*texture
)
451 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
456 static HRESULT WINAPI
d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2
*iface
,
457 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
459 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
464 static HRESULT WINAPI
d3drm_face2_SetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
*material
)
466 FIXME("iface %p, material %p stub!\n", iface
, material
);
471 static HRESULT WINAPI
d3drm_face2_SetTextureTopology(IDirect3DRMFace2
*iface
, BOOL wrap_u
, BOOL wrap_v
)
473 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
478 static HRESULT WINAPI
d3drm_face2_GetVertex(IDirect3DRMFace2
*iface
,
479 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
481 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
486 static HRESULT WINAPI
d3drm_face2_GetVertices(IDirect3DRMFace2
*iface
,
487 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
489 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
490 iface
, vertex_count
, coords
, normals
);
495 static HRESULT WINAPI
d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2
*iface
,
496 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
498 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
503 static HRESULT WINAPI
d3drm_face2_GetTextureTopology(IDirect3DRMFace2
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
505 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
510 static HRESULT WINAPI
d3drm_face2_GetNormal(IDirect3DRMFace2
*iface
, D3DVECTOR
*normal
)
512 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
517 static HRESULT WINAPI
d3drm_face2_GetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
**texture
)
519 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
524 static HRESULT WINAPI
d3drm_face2_GetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
**material
)
526 FIXME("iface %p, material %p stub!\n", iface
, material
);
531 static int WINAPI
d3drm_face2_GetVertexCount(IDirect3DRMFace2
*iface
)
533 FIXME("iface %p stub!\n", iface
);
538 static int WINAPI
d3drm_face2_GetVertexIndex(IDirect3DRMFace2
*iface
, DWORD which
)
540 FIXME("iface %p, which %u stub!\n", iface
, which
);
545 static int WINAPI
d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2
*iface
, DWORD which
)
547 FIXME("iface %p, which %u stub!\n", iface
, which
);
552 static D3DCOLOR WINAPI
d3drm_face2_GetColor(IDirect3DRMFace2
*iface
)
554 FIXME("iface %p stub!\n", iface
);
559 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl
=
561 d3drm_face2_QueryInterface
,
565 d3drm_face2_AddDestroyCallback
,
566 d3drm_face2_DeleteDestroyCallback
,
567 d3drm_face2_SetAppData
,
568 d3drm_face2_GetAppData
,
571 d3drm_face2_GetClassName
,
572 d3drm_face2_AddVertex
,
573 d3drm_face2_AddVertexAndNormalIndexed
,
574 d3drm_face2_SetColorRGB
,
575 d3drm_face2_SetColor
,
576 d3drm_face2_SetTexture
,
577 d3drm_face2_SetTextureCoordinates
,
578 d3drm_face2_SetMaterial
,
579 d3drm_face2_SetTextureTopology
,
580 d3drm_face2_GetVertex
,
581 d3drm_face2_GetVertices
,
582 d3drm_face2_GetTextureCoordinates
,
583 d3drm_face2_GetTextureTopology
,
584 d3drm_face2_GetNormal
,
585 d3drm_face2_GetTexture
,
586 d3drm_face2_GetMaterial
,
587 d3drm_face2_GetVertexCount
,
588 d3drm_face2_GetVertexIndex
,
589 d3drm_face2_GetTextureCoordinateIndex
,
590 d3drm_face2_GetColor
,
593 HRESULT
Direct3DRMFace_create(REFIID riid
, IUnknown
**out
)
595 struct d3drm_face
*object
;
597 TRACE("riid %s, out %p.\n", debugstr_guid(riid
), out
);
599 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
600 return E_OUTOFMEMORY
;
602 object
->IDirect3DRMFace_iface
.lpVtbl
= &d3drm_face1_vtbl
;
603 object
->IDirect3DRMFace2_iface
.lpVtbl
= &d3drm_face2_vtbl
;
606 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
607 *out
= (IUnknown
*)&object
->IDirect3DRMFace2_iface
;
609 *out
= (IUnknown
*)&object
->IDirect3DRMFace_iface
;