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
);
28 static inline struct d3drm_face
*impl_from_IDirect3DRMFace(IDirect3DRMFace
*iface
)
30 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace_iface
);
33 static inline struct d3drm_face
*impl_from_IDirect3DRMFace2(IDirect3DRMFace2
*iface
)
35 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace2_iface
);
38 static HRESULT WINAPI
d3drm_face1_QueryInterface(IDirect3DRMFace
*iface
, REFIID riid
, void **out
)
40 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
42 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
44 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace
)
45 || IsEqualGUID(riid
, &IID_IDirect3DRMObject
)
46 || IsEqualGUID(riid
, &IID_IUnknown
))
48 *out
= &face
->IDirect3DRMFace_iface
;
50 else if(IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
52 *out
= &face
->IDirect3DRMFace2_iface
;
57 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
61 IUnknown_AddRef((IUnknown
*)*out
);
65 static ULONG WINAPI
d3drm_face1_AddRef(IDirect3DRMFace
*iface
)
67 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
68 ULONG refcount
= InterlockedIncrement(&face
->ref
);
70 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
75 static ULONG WINAPI
d3drm_face1_Release(IDirect3DRMFace
*iface
)
77 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
78 ULONG refcount
= InterlockedDecrement(&face
->ref
);
80 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
84 d3drm_object_cleanup((IDirect3DRMObject
*)iface
, &face
->obj
);
85 HeapFree(GetProcessHeap(), 0, face
);
91 static HRESULT WINAPI
d3drm_face1_Clone(IDirect3DRMFace
*iface
,
92 IUnknown
*outer
, REFIID iid
, void **out
)
94 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
99 static HRESULT WINAPI
d3drm_face1_AddDestroyCallback(IDirect3DRMFace
*iface
,
100 D3DRMOBJECTCALLBACK cb
, void *ctx
)
102 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
104 TRACE("iface %p, cb %p, ctx %p.\n", iface
, cb
, ctx
);
106 return IDirect3DRMFace2_AddDestroyCallback(&face
->IDirect3DRMFace2_iface
, cb
, ctx
);
109 static HRESULT WINAPI
d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace
*iface
,
110 D3DRMOBJECTCALLBACK cb
, void *ctx
)
112 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
114 TRACE("iface %p, cb %p, ctx %p.\n", iface
, cb
, ctx
);
116 return IDirect3DRMFace2_DeleteDestroyCallback(&face
->IDirect3DRMFace2_iface
, cb
, ctx
);
119 static HRESULT WINAPI
d3drm_face2_SetAppData(IDirect3DRMFace2
*iface
, DWORD data
)
121 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
123 TRACE("iface %p, data %#x.\n", iface
, data
);
125 face
->obj
.appdata
= data
;
130 static HRESULT WINAPI
d3drm_face1_SetAppData(IDirect3DRMFace
*iface
, DWORD data
)
132 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
134 TRACE("iface %p, data %#x.\n", iface
, data
);
136 return d3drm_face2_SetAppData(&face
->IDirect3DRMFace2_iface
, data
);
139 static DWORD WINAPI
d3drm_face2_GetAppData(IDirect3DRMFace2
*iface
)
141 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
143 TRACE("iface %p.\n", iface
);
145 return face
->obj
.appdata
;
148 static DWORD WINAPI
d3drm_face1_GetAppData(IDirect3DRMFace
*iface
)
150 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
152 TRACE("iface %p.\n", iface
);
154 return d3drm_face2_GetAppData(&face
->IDirect3DRMFace2_iface
);
157 static HRESULT WINAPI
d3drm_face2_SetName(IDirect3DRMFace2
*iface
, const char *name
)
159 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
161 TRACE("iface %p, name %s.\n", iface
, debugstr_a(name
));
163 return d3drm_object_set_name(&face
->obj
, name
);
166 static HRESULT WINAPI
d3drm_face1_SetName(IDirect3DRMFace
*iface
, const char *name
)
168 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
170 TRACE("iface %p, name %s.\n", iface
, debugstr_a(name
));
172 return d3drm_face2_SetName(&face
->IDirect3DRMFace2_iface
, name
);
175 static HRESULT WINAPI
d3drm_face2_GetName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
177 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
179 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
181 return d3drm_object_get_name(&face
->obj
, size
, name
);
184 static HRESULT WINAPI
d3drm_face1_GetName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
186 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
188 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
190 return d3drm_face2_GetName(&face
->IDirect3DRMFace2_iface
, size
, name
);
193 static HRESULT WINAPI
d3drm_face1_GetClassName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
195 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
197 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
199 return IDirect3DRMFace2_GetClassName(&face
->IDirect3DRMFace2_iface
, size
, name
);
202 static HRESULT WINAPI
d3drm_face1_AddVertex(IDirect3DRMFace
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
204 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
209 static HRESULT WINAPI
d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace
*iface
,
210 DWORD vertex
, DWORD normal
)
212 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
217 static HRESULT WINAPI
d3drm_face2_SetColorRGB(IDirect3DRMFace2
*iface
, D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
)
219 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
221 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface
, red
, green
, blue
);
223 d3drm_set_color(&face
->color
, red
, green
, blue
, 1.0f
);
228 static HRESULT WINAPI
d3drm_face1_SetColorRGB(IDirect3DRMFace
*iface
,
229 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
)
231 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
233 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface
, red
, green
, blue
);
235 return d3drm_face2_SetColorRGB(&face
->IDirect3DRMFace2_iface
, red
, green
, blue
);
238 static HRESULT WINAPI
d3drm_face2_SetColor(IDirect3DRMFace2
*iface
, D3DCOLOR color
)
240 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
242 TRACE("iface %p, color 0x%08x.\n", iface
, color
);
249 static HRESULT WINAPI
d3drm_face1_SetColor(IDirect3DRMFace
*iface
, D3DCOLOR color
)
251 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
253 TRACE("iface %p, color 0x%08x.\n", iface
, color
);
255 return d3drm_face2_SetColor(&face
->IDirect3DRMFace2_iface
, color
);
258 static HRESULT WINAPI
d3drm_face1_SetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
*texture
)
260 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
265 static HRESULT WINAPI
d3drm_face1_SetTextureCoordinates(IDirect3DRMFace
*iface
,
266 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
268 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
273 static HRESULT WINAPI
d3drm_face1_SetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
*material
)
275 FIXME("iface %p, material %p stub!\n", iface
, material
);
280 static HRESULT WINAPI
d3drm_face1_SetTextureTopology(IDirect3DRMFace
*iface
, BOOL wrap_u
, BOOL wrap_v
)
282 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
287 static HRESULT WINAPI
d3drm_face1_GetVertex(IDirect3DRMFace
*iface
,
288 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
290 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
295 static HRESULT WINAPI
d3drm_face1_GetVertices(IDirect3DRMFace
*iface
,
296 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
298 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
299 iface
, vertex_count
, coords
, normals
);
304 static HRESULT WINAPI
d3drm_face1_GetTextureCoordinates(IDirect3DRMFace
*iface
,
305 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
307 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
312 static HRESULT WINAPI
d3drm_face1_GetTextureTopology(IDirect3DRMFace
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
314 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
319 static HRESULT WINAPI
d3drm_face1_GetNormal(IDirect3DRMFace
*iface
, D3DVECTOR
*normal
)
321 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
326 static HRESULT WINAPI
d3drm_face1_GetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
**texture
)
328 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
333 static HRESULT WINAPI
d3drm_face1_GetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
**material
)
335 FIXME("iface %p, material %p stub!\n", iface
, material
);
340 static int WINAPI
d3drm_face1_GetVertexCount(IDirect3DRMFace
*iface
)
342 FIXME("iface %p stub!\n", iface
);
347 static int WINAPI
d3drm_face1_GetVertexIndex(IDirect3DRMFace
*iface
, DWORD which
)
349 FIXME("iface %p, which %u stub!\n", iface
, which
);
354 static int WINAPI
d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace
*iface
, DWORD which
)
356 FIXME("iface %p, which %u stub!\n", iface
, which
);
361 static D3DCOLOR WINAPI
d3drm_face2_GetColor(IDirect3DRMFace2
*iface
)
363 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
365 TRACE("iface %p.\n", iface
);
370 static D3DCOLOR WINAPI
d3drm_face1_GetColor(IDirect3DRMFace
*iface
)
372 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
374 TRACE("iface %p.\n", iface
);
376 return d3drm_face2_GetColor(&face
->IDirect3DRMFace2_iface
);
379 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl
=
381 d3drm_face1_QueryInterface
,
385 d3drm_face1_AddDestroyCallback
,
386 d3drm_face1_DeleteDestroyCallback
,
387 d3drm_face1_SetAppData
,
388 d3drm_face1_GetAppData
,
391 d3drm_face1_GetClassName
,
392 d3drm_face1_AddVertex
,
393 d3drm_face1_AddVertexAndNormalIndexed
,
394 d3drm_face1_SetColorRGB
,
395 d3drm_face1_SetColor
,
396 d3drm_face1_SetTexture
,
397 d3drm_face1_SetTextureCoordinates
,
398 d3drm_face1_SetMaterial
,
399 d3drm_face1_SetTextureTopology
,
400 d3drm_face1_GetVertex
,
401 d3drm_face1_GetVertices
,
402 d3drm_face1_GetTextureCoordinates
,
403 d3drm_face1_GetTextureTopology
,
404 d3drm_face1_GetNormal
,
405 d3drm_face1_GetTexture
,
406 d3drm_face1_GetMaterial
,
407 d3drm_face1_GetVertexCount
,
408 d3drm_face1_GetVertexIndex
,
409 d3drm_face1_GetTextureCoordinateIndex
,
410 d3drm_face1_GetColor
,
413 static HRESULT WINAPI
d3drm_face2_QueryInterface(IDirect3DRMFace2
*iface
, REFIID riid
, void **out
)
415 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
417 return d3drm_face1_QueryInterface(&face
->IDirect3DRMFace_iface
, riid
, out
);
420 static ULONG WINAPI
d3drm_face2_AddRef(IDirect3DRMFace2
*iface
)
422 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
424 return d3drm_face1_AddRef(&face
->IDirect3DRMFace_iface
);
427 static ULONG WINAPI
d3drm_face2_Release(IDirect3DRMFace2
*iface
)
429 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
431 return d3drm_face1_Release(&face
->IDirect3DRMFace_iface
);
434 static HRESULT WINAPI
d3drm_face2_Clone(IDirect3DRMFace2
*iface
,
435 IUnknown
*outer
, REFIID iid
, void **out
)
437 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
442 static HRESULT WINAPI
d3drm_face2_AddDestroyCallback(IDirect3DRMFace2
*iface
,
443 D3DRMOBJECTCALLBACK cb
, void *ctx
)
445 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
447 TRACE("iface %p, cb %p, ctx %p.\n", iface
, cb
, ctx
);
449 return d3drm_object_add_destroy_callback(&face
->obj
, cb
, ctx
);
452 static HRESULT WINAPI
d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2
*iface
,
453 D3DRMOBJECTCALLBACK cb
, void *ctx
)
455 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
457 TRACE("iface %p, cb %p, ctx %p.\n", iface
, cb
, ctx
);
459 return d3drm_object_delete_destroy_callback(&face
->obj
, cb
, ctx
);
462 static HRESULT WINAPI
d3drm_face2_GetClassName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
464 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
466 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
468 return d3drm_object_get_class_name(&face
->obj
, size
, name
);
471 static HRESULT WINAPI
d3drm_face2_AddVertex(IDirect3DRMFace2
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
473 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
478 static HRESULT WINAPI
d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2
*iface
,
479 DWORD vertex
, DWORD normal
)
481 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
486 static HRESULT WINAPI
d3drm_face2_SetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
*texture
)
488 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
493 static HRESULT WINAPI
d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2
*iface
,
494 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
496 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
501 static HRESULT WINAPI
d3drm_face2_SetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
*material
)
503 FIXME("iface %p, material %p stub!\n", iface
, material
);
508 static HRESULT WINAPI
d3drm_face2_SetTextureTopology(IDirect3DRMFace2
*iface
, BOOL wrap_u
, BOOL wrap_v
)
510 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
515 static HRESULT WINAPI
d3drm_face2_GetVertex(IDirect3DRMFace2
*iface
,
516 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
518 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
523 static HRESULT WINAPI
d3drm_face2_GetVertices(IDirect3DRMFace2
*iface
,
524 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
526 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
527 iface
, vertex_count
, coords
, normals
);
532 static HRESULT WINAPI
d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2
*iface
,
533 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
535 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
540 static HRESULT WINAPI
d3drm_face2_GetTextureTopology(IDirect3DRMFace2
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
542 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
547 static HRESULT WINAPI
d3drm_face2_GetNormal(IDirect3DRMFace2
*iface
, D3DVECTOR
*normal
)
549 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
554 static HRESULT WINAPI
d3drm_face2_GetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
**texture
)
556 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
561 static HRESULT WINAPI
d3drm_face2_GetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
**material
)
563 FIXME("iface %p, material %p stub!\n", iface
, material
);
568 static int WINAPI
d3drm_face2_GetVertexCount(IDirect3DRMFace2
*iface
)
570 FIXME("iface %p stub!\n", iface
);
575 static int WINAPI
d3drm_face2_GetVertexIndex(IDirect3DRMFace2
*iface
, DWORD which
)
577 FIXME("iface %p, which %u stub!\n", iface
, which
);
582 static int WINAPI
d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2
*iface
, DWORD which
)
584 FIXME("iface %p, which %u stub!\n", iface
, which
);
589 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl
=
591 d3drm_face2_QueryInterface
,
595 d3drm_face2_AddDestroyCallback
,
596 d3drm_face2_DeleteDestroyCallback
,
597 d3drm_face2_SetAppData
,
598 d3drm_face2_GetAppData
,
601 d3drm_face2_GetClassName
,
602 d3drm_face2_AddVertex
,
603 d3drm_face2_AddVertexAndNormalIndexed
,
604 d3drm_face2_SetColorRGB
,
605 d3drm_face2_SetColor
,
606 d3drm_face2_SetTexture
,
607 d3drm_face2_SetTextureCoordinates
,
608 d3drm_face2_SetMaterial
,
609 d3drm_face2_SetTextureTopology
,
610 d3drm_face2_GetVertex
,
611 d3drm_face2_GetVertices
,
612 d3drm_face2_GetTextureCoordinates
,
613 d3drm_face2_GetTextureTopology
,
614 d3drm_face2_GetNormal
,
615 d3drm_face2_GetTexture
,
616 d3drm_face2_GetMaterial
,
617 d3drm_face2_GetVertexCount
,
618 d3drm_face2_GetVertexIndex
,
619 d3drm_face2_GetTextureCoordinateIndex
,
620 d3drm_face2_GetColor
,
623 HRESULT
d3drm_face_create(struct d3drm_face
**face
)
625 static const char classname
[] = "Face";
626 struct d3drm_face
*object
;
628 TRACE("face %p.\n", face
);
630 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
631 return E_OUTOFMEMORY
;
633 object
->IDirect3DRMFace_iface
.lpVtbl
= &d3drm_face1_vtbl
;
634 object
->IDirect3DRMFace2_iface
.lpVtbl
= &d3drm_face2_vtbl
;
637 d3drm_object_init(&object
->obj
, classname
);