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
22 #include "wine/port.h"
24 #include "d3drm_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
30 IDirect3DRMFace IDirect3DRMFace_iface
;
31 IDirect3DRMFace2 IDirect3DRMFace2_iface
;
35 static inline struct d3drm_face
*impl_from_IDirect3DRMFace(IDirect3DRMFace
*iface
)
37 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace_iface
);
40 static inline struct d3drm_face
*impl_from_IDirect3DRMFace2(IDirect3DRMFace2
*iface
)
42 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace2_iface
);
45 static HRESULT WINAPI
d3drm_face1_QueryInterface(IDirect3DRMFace
*iface
, REFIID riid
, void **out
)
47 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
49 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
52 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace
)
53 || IsEqualGUID(riid
, &IID_IUnknown
))
55 *out
= &face
->IDirect3DRMFace_iface
;
57 else if(IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
59 *out
= &face
->IDirect3DRMFace2_iface
;
64 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
68 IUnknown_AddRef((IUnknown
*)*out
);
72 static ULONG WINAPI
d3drm_face1_AddRef(IDirect3DRMFace
*iface
)
74 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
75 ULONG refcount
= InterlockedIncrement(&face
->ref
);
77 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
82 static ULONG WINAPI
d3drm_face1_Release(IDirect3DRMFace
*iface
)
84 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
85 ULONG refcount
= InterlockedDecrement(&face
->ref
);
87 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
90 HeapFree(GetProcessHeap(), 0, face
);
95 static HRESULT WINAPI
d3drm_face1_Clone(IDirect3DRMFace
*iface
,
96 IUnknown
*outer
, REFIID iid
, void **out
)
98 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
103 static HRESULT WINAPI
d3drm_face1_AddDestroyCallback(IDirect3DRMFace
*iface
,
104 D3DRMOBJECTCALLBACK cb
, void *ctx
)
106 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
111 static HRESULT WINAPI
d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace
*iface
,
112 D3DRMOBJECTCALLBACK cb
, void *ctx
)
114 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
119 static HRESULT WINAPI
d3drm_face1_SetAppData(IDirect3DRMFace
*iface
, DWORD data
)
121 FIXME("iface %p, data %#x stub!\n", iface
, data
);
126 static DWORD WINAPI
d3drm_face1_GetAppData(IDirect3DRMFace
*iface
)
128 FIXME("iface %p stub!\n", iface
);
133 static HRESULT WINAPI
d3drm_face1_SetName(IDirect3DRMFace
*iface
, const char *name
)
135 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
140 static HRESULT WINAPI
d3drm_face1_GetName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
142 FIXME("iface %p, size %p, name %p stub!\n", iface
, size
, name
);
147 static HRESULT WINAPI
d3drm_face1_GetClassName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
149 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
151 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
153 return IDirect3DRMFace2_GetClassName(&face
->IDirect3DRMFace2_iface
, size
, name
);
156 static HRESULT WINAPI
d3drm_face1_AddVertex(IDirect3DRMFace
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
158 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
163 static HRESULT WINAPI
d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace
*iface
,
164 DWORD vertex
, DWORD normal
)
166 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
171 static HRESULT WINAPI
d3drm_face1_SetColorRGB(IDirect3DRMFace
*iface
,
172 D3DVALUE r
, D3DVALUE g
, D3DVALUE b
)
174 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface
, r
, g
, b
);
179 static HRESULT WINAPI
d3drm_face1_SetColor(IDirect3DRMFace
*iface
, D3DCOLOR color
)
181 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
186 static HRESULT WINAPI
d3drm_face1_SetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
*texture
)
188 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
193 static HRESULT WINAPI
d3drm_face1_SetTextureCoordinates(IDirect3DRMFace
*iface
,
194 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
196 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
201 static HRESULT WINAPI
d3drm_face1_SetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
*material
)
203 FIXME("iface %p, material %p stub!\n", iface
, material
);
208 static HRESULT WINAPI
d3drm_face1_SetTextureTopology(IDirect3DRMFace
*iface
, BOOL wrap_u
, BOOL wrap_v
)
210 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
215 static HRESULT WINAPI
d3drm_face1_GetVertex(IDirect3DRMFace
*iface
,
216 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
218 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
223 static HRESULT WINAPI
d3drm_face1_GetVertices(IDirect3DRMFace
*iface
,
224 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
226 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
227 iface
, vertex_count
, coords
, normals
);
232 static HRESULT WINAPI
d3drm_face1_GetTextureCoordinates(IDirect3DRMFace
*iface
,
233 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
235 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
240 static HRESULT WINAPI
d3drm_face1_GetTextureTopology(IDirect3DRMFace
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
242 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
247 static HRESULT WINAPI
d3drm_face1_GetNormal(IDirect3DRMFace
*iface
, D3DVECTOR
*normal
)
249 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
254 static HRESULT WINAPI
d3drm_face1_GetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
**texture
)
256 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
261 static HRESULT WINAPI
d3drm_face1_GetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
**material
)
263 FIXME("iface %p, material %p stub!\n", iface
, material
);
268 static int WINAPI
d3drm_face1_GetVertexCount(IDirect3DRMFace
*iface
)
270 FIXME("iface %p stub!\n", iface
);
275 static int WINAPI
d3drm_face1_GetVertexIndex(IDirect3DRMFace
*iface
, DWORD which
)
277 FIXME("iface %p, which %u stub!\n", iface
, which
);
282 static int WINAPI
d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace
*iface
, DWORD which
)
284 FIXME("iface %p, which %u stub!\n", iface
, which
);
289 static D3DCOLOR WINAPI
d3drm_face1_GetColor(IDirect3DRMFace
*iface
)
291 FIXME("iface %p stub!\n", iface
);
296 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl
=
298 d3drm_face1_QueryInterface
,
302 d3drm_face1_AddDestroyCallback
,
303 d3drm_face1_DeleteDestroyCallback
,
304 d3drm_face1_SetAppData
,
305 d3drm_face1_GetAppData
,
308 d3drm_face1_GetClassName
,
309 d3drm_face1_AddVertex
,
310 d3drm_face1_AddVertexAndNormalIndexed
,
311 d3drm_face1_SetColorRGB
,
312 d3drm_face1_SetColor
,
313 d3drm_face1_SetTexture
,
314 d3drm_face1_SetTextureCoordinates
,
315 d3drm_face1_SetMaterial
,
316 d3drm_face1_SetTextureTopology
,
317 d3drm_face1_GetVertex
,
318 d3drm_face1_GetVertices
,
319 d3drm_face1_GetTextureCoordinates
,
320 d3drm_face1_GetTextureTopology
,
321 d3drm_face1_GetNormal
,
322 d3drm_face1_GetTexture
,
323 d3drm_face1_GetMaterial
,
324 d3drm_face1_GetVertexCount
,
325 d3drm_face1_GetVertexIndex
,
326 d3drm_face1_GetTextureCoordinateIndex
,
327 d3drm_face1_GetColor
,
330 static HRESULT WINAPI
d3drm_face2_QueryInterface(IDirect3DRMFace2
*iface
, REFIID riid
, void **out
)
332 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
334 return d3drm_face1_QueryInterface(&face
->IDirect3DRMFace_iface
, riid
, out
);
337 static ULONG WINAPI
d3drm_face2_AddRef(IDirect3DRMFace2
*iface
)
339 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
341 return d3drm_face1_AddRef(&face
->IDirect3DRMFace_iface
);
344 static ULONG WINAPI
d3drm_face2_Release(IDirect3DRMFace2
*iface
)
346 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
348 return d3drm_face1_Release(&face
->IDirect3DRMFace_iface
);
351 static HRESULT WINAPI
d3drm_face2_Clone(IDirect3DRMFace2
*iface
,
352 IUnknown
*outer
, REFIID iid
, void **out
)
354 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
359 static HRESULT WINAPI
d3drm_face2_AddDestroyCallback(IDirect3DRMFace2
*iface
,
360 D3DRMOBJECTCALLBACK cb
, void *ctx
)
362 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
367 static HRESULT WINAPI
d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2
*iface
,
368 D3DRMOBJECTCALLBACK cb
, void *ctx
)
370 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
375 static HRESULT WINAPI
d3drm_face2_SetAppData(IDirect3DRMFace2
*iface
, DWORD data
)
377 FIXME("iface %p, data %#x stub!\n", iface
, data
);
382 static DWORD WINAPI
d3drm_face2_GetAppData(IDirect3DRMFace2
*iface
)
384 FIXME("iface %p stub!\n", iface
);
389 static HRESULT WINAPI
d3drm_face2_SetName(IDirect3DRMFace2
*iface
, const char *name
)
391 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
396 static HRESULT WINAPI
d3drm_face2_GetName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
398 FIXME("iface %p, size %p, name %p stub!\n", iface
, size
, name
);
403 static HRESULT WINAPI
d3drm_face2_GetClassName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
405 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
407 if (!size
|| *size
< strlen("Face") || !name
)
410 strcpy(name
, "Face");
411 *size
= sizeof("Face");
416 static HRESULT WINAPI
d3drm_face2_AddVertex(IDirect3DRMFace2
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
418 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
423 static HRESULT WINAPI
d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2
*iface
,
424 DWORD vertex
, DWORD normal
)
426 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
431 static HRESULT WINAPI
d3drm_face2_SetColorRGB(IDirect3DRMFace2
*iface
, D3DVALUE r
, D3DVALUE g
, D3DVALUE b
)
433 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface
, r
, g
, b
);
438 static HRESULT WINAPI
d3drm_face2_SetColor(IDirect3DRMFace2
*iface
, D3DCOLOR color
)
440 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
445 static HRESULT WINAPI
d3drm_face2_SetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
*texture
)
447 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
452 static HRESULT WINAPI
d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2
*iface
,
453 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
455 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
460 static HRESULT WINAPI
d3drm_face2_SetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
*material
)
462 FIXME("iface %p, material %p stub!\n", iface
, material
);
467 static HRESULT WINAPI
d3drm_face2_SetTextureTopology(IDirect3DRMFace2
*iface
, BOOL wrap_u
, BOOL wrap_v
)
469 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
474 static HRESULT WINAPI
d3drm_face2_GetVertex(IDirect3DRMFace2
*iface
,
475 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
477 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
482 static HRESULT WINAPI
d3drm_face2_GetVertices(IDirect3DRMFace2
*iface
,
483 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
485 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
486 iface
, vertex_count
, coords
, normals
);
491 static HRESULT WINAPI
d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2
*iface
,
492 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
494 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
499 static HRESULT WINAPI
d3drm_face2_GetTextureTopology(IDirect3DRMFace2
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
501 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
506 static HRESULT WINAPI
d3drm_face2_GetNormal(IDirect3DRMFace2
*iface
, D3DVECTOR
*normal
)
508 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
513 static HRESULT WINAPI
d3drm_face2_GetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
**texture
)
515 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
520 static HRESULT WINAPI
d3drm_face2_GetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
**material
)
522 FIXME("iface %p, material %p stub!\n", iface
, material
);
527 static int WINAPI
d3drm_face2_GetVertexCount(IDirect3DRMFace2
*iface
)
529 FIXME("iface %p stub!\n", iface
);
534 static int WINAPI
d3drm_face2_GetVertexIndex(IDirect3DRMFace2
*iface
, DWORD which
)
536 FIXME("iface %p, which %u stub!\n", iface
, which
);
541 static int WINAPI
d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2
*iface
, DWORD which
)
543 FIXME("iface %p, which %u stub!\n", iface
, which
);
548 static D3DCOLOR WINAPI
d3drm_face2_GetColor(IDirect3DRMFace2
*iface
)
550 FIXME("iface %p stub!\n", iface
);
555 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl
=
557 d3drm_face2_QueryInterface
,
561 d3drm_face2_AddDestroyCallback
,
562 d3drm_face2_DeleteDestroyCallback
,
563 d3drm_face2_SetAppData
,
564 d3drm_face2_GetAppData
,
567 d3drm_face2_GetClassName
,
568 d3drm_face2_AddVertex
,
569 d3drm_face2_AddVertexAndNormalIndexed
,
570 d3drm_face2_SetColorRGB
,
571 d3drm_face2_SetColor
,
572 d3drm_face2_SetTexture
,
573 d3drm_face2_SetTextureCoordinates
,
574 d3drm_face2_SetMaterial
,
575 d3drm_face2_SetTextureTopology
,
576 d3drm_face2_GetVertex
,
577 d3drm_face2_GetVertices
,
578 d3drm_face2_GetTextureCoordinates
,
579 d3drm_face2_GetTextureTopology
,
580 d3drm_face2_GetNormal
,
581 d3drm_face2_GetTexture
,
582 d3drm_face2_GetMaterial
,
583 d3drm_face2_GetVertexCount
,
584 d3drm_face2_GetVertexIndex
,
585 d3drm_face2_GetTextureCoordinateIndex
,
586 d3drm_face2_GetColor
,
589 HRESULT
Direct3DRMFace_create(REFIID riid
, IUnknown
**out
)
591 struct d3drm_face
*object
;
593 TRACE("riid %s, out %p.\n", debugstr_guid(riid
), out
);
595 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
596 return E_OUTOFMEMORY
;
598 object
->IDirect3DRMFace_iface
.lpVtbl
= &d3drm_face1_vtbl
;
599 object
->IDirect3DRMFace2_iface
.lpVtbl
= &d3drm_face2_vtbl
;
602 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
603 *out
= (IUnknown
*)&object
->IDirect3DRMFace2_iface
;
605 *out
= (IUnknown
*)&object
->IDirect3DRMFace_iface
;