dpvoice: Add DirectPlay Voice test.
[wine/multimedia.git] / dlls / d3drm / face.c
blob8cba39b777c41ca698b7e3dc498a9b321a16bb82
1 /*
2 * Implementation of IDirect3DRMFace Interface
4 * Copyright 2013 André Hentschel
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/debug.h"
26 #define COBJMACROS
28 #include "winbase.h"
29 #include "wingdi.h"
31 #include "d3drm_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
35 struct d3drm_face
37 IDirect3DRMFace IDirect3DRMFace_iface;
38 IDirect3DRMFace2 IDirect3DRMFace2_iface;
39 LONG ref;
42 static inline struct d3drm_face *impl_from_IDirect3DRMFace(IDirect3DRMFace *iface)
44 return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace_iface);
47 static inline struct d3drm_face *impl_from_IDirect3DRMFace2(IDirect3DRMFace2 *iface)
49 return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace2_iface);
52 static HRESULT WINAPI d3drm_face1_QueryInterface(IDirect3DRMFace *iface, REFIID riid, void **out)
54 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
56 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
59 if (IsEqualGUID(riid, &IID_IDirect3DRMFace)
60 || IsEqualGUID(riid, &IID_IUnknown))
62 *out = &face->IDirect3DRMFace_iface;
64 else if(IsEqualGUID(riid, &IID_IDirect3DRMFace2))
66 *out = &face->IDirect3DRMFace2_iface;
68 else
70 *out = NULL;
71 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
72 return E_NOINTERFACE;
75 IUnknown_AddRef((IUnknown *)*out);
76 return S_OK;
79 static ULONG WINAPI d3drm_face1_AddRef(IDirect3DRMFace *iface)
81 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
82 ULONG refcount = InterlockedIncrement(&face->ref);
84 TRACE("%p increasing refcount to %u.\n", iface, refcount);
86 return refcount;
89 static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface)
91 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
92 ULONG refcount = InterlockedDecrement(&face->ref);
94 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
96 if (!refcount)
97 HeapFree(GetProcessHeap(), 0, face);
99 return refcount;
102 static HRESULT WINAPI d3drm_face1_Clone(IDirect3DRMFace *iface,
103 IUnknown *outer, REFIID iid, void **out)
105 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
107 return E_NOTIMPL;
110 static HRESULT WINAPI d3drm_face1_AddDestroyCallback(IDirect3DRMFace *iface,
111 D3DRMOBJECTCALLBACK cb, void *ctx)
113 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
115 return E_NOTIMPL;
118 static HRESULT WINAPI d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace *iface,
119 D3DRMOBJECTCALLBACK cb, void *ctx)
121 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
123 return E_NOTIMPL;
126 static HRESULT WINAPI d3drm_face1_SetAppData(IDirect3DRMFace *iface, DWORD data)
128 FIXME("iface %p, data %#x stub!\n", iface, data);
130 return E_NOTIMPL;
133 static DWORD WINAPI d3drm_face1_GetAppData(IDirect3DRMFace *iface)
135 FIXME("iface %p stub!\n", iface);
137 return 0;
140 static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name)
142 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
144 return E_NOTIMPL;
147 static HRESULT WINAPI d3drm_face1_GetName(IDirect3DRMFace *iface, DWORD *size, char *name)
149 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
151 return E_NOTIMPL;
154 static HRESULT WINAPI d3drm_face1_GetClassName(IDirect3DRMFace *iface, DWORD *size, char *name)
156 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
158 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
160 return IDirect3DRMFace2_GetClassName(&face->IDirect3DRMFace2_iface, size, name);
163 static HRESULT WINAPI d3drm_face1_AddVertex(IDirect3DRMFace *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
165 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
167 return E_NOTIMPL;
170 static HRESULT WINAPI d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace *iface,
171 DWORD vertex, DWORD normal)
173 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
175 return E_NOTIMPL;
178 static HRESULT WINAPI d3drm_face1_SetColorRGB(IDirect3DRMFace *iface,
179 D3DVALUE r, D3DVALUE g, D3DVALUE b)
181 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface, r, g, b);
183 return E_NOTIMPL;
186 static HRESULT WINAPI d3drm_face1_SetColor(IDirect3DRMFace *iface, D3DCOLOR color)
188 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
190 return E_NOTIMPL;
193 static HRESULT WINAPI d3drm_face1_SetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture *texture)
195 FIXME("iface %p, texture %p stub!\n", iface, texture);
197 return E_NOTIMPL;
200 static HRESULT WINAPI d3drm_face1_SetTextureCoordinates(IDirect3DRMFace *iface,
201 DWORD vertex, D3DVALUE u, D3DVALUE v)
203 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
205 return E_NOTIMPL;
208 static HRESULT WINAPI d3drm_face1_SetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial *material)
210 FIXME("iface %p, material %p stub!\n", iface, material);
212 return E_NOTIMPL;
215 static HRESULT WINAPI d3drm_face1_SetTextureTopology(IDirect3DRMFace *iface, BOOL wrap_u, BOOL wrap_v)
217 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
219 return E_NOTIMPL;
222 static HRESULT WINAPI d3drm_face1_GetVertex(IDirect3DRMFace *iface,
223 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
225 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
227 return E_NOTIMPL;
230 static HRESULT WINAPI d3drm_face1_GetVertices(IDirect3DRMFace *iface,
231 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
233 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
234 iface, vertex_count, coords, normals);
236 return E_NOTIMPL;
239 static HRESULT WINAPI d3drm_face1_GetTextureCoordinates(IDirect3DRMFace *iface,
240 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
242 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
244 return E_NOTIMPL;
247 static HRESULT WINAPI d3drm_face1_GetTextureTopology(IDirect3DRMFace *iface, BOOL *wrap_u, BOOL *wrap_v)
249 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
251 return E_NOTIMPL;
254 static HRESULT WINAPI d3drm_face1_GetNormal(IDirect3DRMFace *iface, D3DVECTOR *normal)
256 FIXME("iface %p, normal %p stub!\n", iface, normal);
258 return E_NOTIMPL;
261 static HRESULT WINAPI d3drm_face1_GetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture **texture)
263 FIXME("iface %p, texture %p stub!\n", iface, texture);
265 return E_NOTIMPL;
268 static HRESULT WINAPI d3drm_face1_GetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial **material)
270 FIXME("iface %p, material %p stub!\n", iface, material);
272 return E_NOTIMPL;
275 static int WINAPI d3drm_face1_GetVertexCount(IDirect3DRMFace *iface)
277 FIXME("iface %p stub!\n", iface);
279 return 0;
282 static int WINAPI d3drm_face1_GetVertexIndex(IDirect3DRMFace *iface, DWORD which)
284 FIXME("iface %p, which %u stub!\n", iface, which);
286 return 0;
289 static int WINAPI d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace *iface, DWORD which)
291 FIXME("iface %p, which %u stub!\n", iface, which);
293 return 0;
296 static D3DCOLOR WINAPI d3drm_face1_GetColor(IDirect3DRMFace *iface)
298 FIXME("iface %p stub!\n", iface);
300 return 0;
303 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl =
305 d3drm_face1_QueryInterface,
306 d3drm_face1_AddRef,
307 d3drm_face1_Release,
308 d3drm_face1_Clone,
309 d3drm_face1_AddDestroyCallback,
310 d3drm_face1_DeleteDestroyCallback,
311 d3drm_face1_SetAppData,
312 d3drm_face1_GetAppData,
313 d3drm_face1_SetName,
314 d3drm_face1_GetName,
315 d3drm_face1_GetClassName,
316 d3drm_face1_AddVertex,
317 d3drm_face1_AddVertexAndNormalIndexed,
318 d3drm_face1_SetColorRGB,
319 d3drm_face1_SetColor,
320 d3drm_face1_SetTexture,
321 d3drm_face1_SetTextureCoordinates,
322 d3drm_face1_SetMaterial,
323 d3drm_face1_SetTextureTopology,
324 d3drm_face1_GetVertex,
325 d3drm_face1_GetVertices,
326 d3drm_face1_GetTextureCoordinates,
327 d3drm_face1_GetTextureTopology,
328 d3drm_face1_GetNormal,
329 d3drm_face1_GetTexture,
330 d3drm_face1_GetMaterial,
331 d3drm_face1_GetVertexCount,
332 d3drm_face1_GetVertexIndex,
333 d3drm_face1_GetTextureCoordinateIndex,
334 d3drm_face1_GetColor,
337 static HRESULT WINAPI d3drm_face2_QueryInterface(IDirect3DRMFace2 *iface, REFIID riid, void **out)
339 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
341 return d3drm_face1_QueryInterface(&face->IDirect3DRMFace_iface, riid, out);
344 static ULONG WINAPI d3drm_face2_AddRef(IDirect3DRMFace2 *iface)
346 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
348 return d3drm_face1_AddRef(&face->IDirect3DRMFace_iface);
351 static ULONG WINAPI d3drm_face2_Release(IDirect3DRMFace2 *iface)
353 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
355 return d3drm_face1_Release(&face->IDirect3DRMFace_iface);
358 static HRESULT WINAPI d3drm_face2_Clone(IDirect3DRMFace2 *iface,
359 IUnknown *outer, REFIID iid, void **out)
361 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
363 return E_NOTIMPL;
366 static HRESULT WINAPI d3drm_face2_AddDestroyCallback(IDirect3DRMFace2 *iface,
367 D3DRMOBJECTCALLBACK cb, void *ctx)
369 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
371 return E_NOTIMPL;
374 static HRESULT WINAPI d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2 *iface,
375 D3DRMOBJECTCALLBACK cb, void *ctx)
377 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
379 return E_NOTIMPL;
382 static HRESULT WINAPI d3drm_face2_SetAppData(IDirect3DRMFace2 *iface, DWORD data)
384 FIXME("iface %p, data %#x stub!\n", iface, data);
386 return E_NOTIMPL;
389 static DWORD WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface)
391 FIXME("iface %p stub!\n", iface);
393 return 0;
396 static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
398 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
400 return E_NOTIMPL;
403 static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
405 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
407 return E_NOTIMPL;
410 static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
412 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
414 if (!size || *size < strlen("Face") || !name)
415 return E_INVALIDARG;
417 strcpy(name, "Face");
418 *size = sizeof("Face");
420 return D3DRM_OK;
423 static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
425 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
427 return E_NOTIMPL;
430 static HRESULT WINAPI d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2 *iface,
431 DWORD vertex, DWORD normal)
433 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
435 return E_NOTIMPL;
438 static HRESULT WINAPI d3drm_face2_SetColorRGB(IDirect3DRMFace2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
440 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface, r, g, b);
442 return E_NOTIMPL;
445 static HRESULT WINAPI d3drm_face2_SetColor(IDirect3DRMFace2 *iface, D3DCOLOR color)
447 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
449 return E_NOTIMPL;
452 static HRESULT WINAPI d3drm_face2_SetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 *texture)
454 FIXME("iface %p, texture %p stub!\n", iface, texture);
456 return E_NOTIMPL;
459 static HRESULT WINAPI d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2 *iface,
460 DWORD vertex, D3DVALUE u, D3DVALUE v)
462 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
464 return E_NOTIMPL;
467 static HRESULT WINAPI d3drm_face2_SetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 *material)
469 FIXME("iface %p, material %p stub!\n", iface, material);
471 return E_NOTIMPL;
474 static HRESULT WINAPI d3drm_face2_SetTextureTopology(IDirect3DRMFace2 *iface, BOOL wrap_u, BOOL wrap_v)
476 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
478 return E_NOTIMPL;
481 static HRESULT WINAPI d3drm_face2_GetVertex(IDirect3DRMFace2 *iface,
482 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
484 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
486 return E_NOTIMPL;
489 static HRESULT WINAPI d3drm_face2_GetVertices(IDirect3DRMFace2 *iface,
490 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
492 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
493 iface, vertex_count, coords, normals);
495 return E_NOTIMPL;
498 static HRESULT WINAPI d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2 *iface,
499 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
501 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
503 return E_NOTIMPL;
506 static HRESULT WINAPI d3drm_face2_GetTextureTopology(IDirect3DRMFace2 *iface, BOOL *wrap_u, BOOL *wrap_v)
508 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
510 return E_NOTIMPL;
513 static HRESULT WINAPI d3drm_face2_GetNormal(IDirect3DRMFace2 *iface, D3DVECTOR *normal)
515 FIXME("iface %p, normal %p stub!\n", iface, normal);
517 return E_NOTIMPL;
520 static HRESULT WINAPI d3drm_face2_GetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 **texture)
522 FIXME("iface %p, texture %p stub!\n", iface, texture);
524 return E_NOTIMPL;
527 static HRESULT WINAPI d3drm_face2_GetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 **material)
529 FIXME("iface %p, material %p stub!\n", iface, material);
531 return E_NOTIMPL;
534 static int WINAPI d3drm_face2_GetVertexCount(IDirect3DRMFace2 *iface)
536 FIXME("iface %p stub!\n", iface);
538 return 0;
541 static int WINAPI d3drm_face2_GetVertexIndex(IDirect3DRMFace2 *iface, DWORD which)
543 FIXME("iface %p, which %u stub!\n", iface, which);
545 return 0;
548 static int WINAPI d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2 *iface, DWORD which)
550 FIXME("iface %p, which %u stub!\n", iface, which);
552 return 0;
555 static D3DCOLOR WINAPI d3drm_face2_GetColor(IDirect3DRMFace2 *iface)
557 FIXME("iface %p stub!\n", iface);
559 return 0;
562 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl =
564 d3drm_face2_QueryInterface,
565 d3drm_face2_AddRef,
566 d3drm_face2_Release,
567 d3drm_face2_Clone,
568 d3drm_face2_AddDestroyCallback,
569 d3drm_face2_DeleteDestroyCallback,
570 d3drm_face2_SetAppData,
571 d3drm_face2_GetAppData,
572 d3drm_face2_SetName,
573 d3drm_face2_GetName,
574 d3drm_face2_GetClassName,
575 d3drm_face2_AddVertex,
576 d3drm_face2_AddVertexAndNormalIndexed,
577 d3drm_face2_SetColorRGB,
578 d3drm_face2_SetColor,
579 d3drm_face2_SetTexture,
580 d3drm_face2_SetTextureCoordinates,
581 d3drm_face2_SetMaterial,
582 d3drm_face2_SetTextureTopology,
583 d3drm_face2_GetVertex,
584 d3drm_face2_GetVertices,
585 d3drm_face2_GetTextureCoordinates,
586 d3drm_face2_GetTextureTopology,
587 d3drm_face2_GetNormal,
588 d3drm_face2_GetTexture,
589 d3drm_face2_GetMaterial,
590 d3drm_face2_GetVertexCount,
591 d3drm_face2_GetVertexIndex,
592 d3drm_face2_GetTextureCoordinateIndex,
593 d3drm_face2_GetColor,
596 HRESULT Direct3DRMFace_create(REFIID riid, IUnknown **out)
598 struct d3drm_face *object;
600 TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
602 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
603 return E_OUTOFMEMORY;
605 object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
606 object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl;
607 object->ref = 1;
609 if (IsEqualGUID(riid, &IID_IDirect3DRMFace2))
610 *out = (IUnknown*)&object->IDirect3DRMFace2_iface;
611 else
612 *out = (IUnknown*)&object->IDirect3DRMFace_iface;
614 return S_OK;