reg/tests: Test import with non-standard registry file headers.
[wine.git] / dlls / d3drm / face.c
blobd47f502bb483e95d9853e35b1881e66281caa630
1 /*
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 "config.h"
22 #include "wine/port.h"
24 #include "d3drm_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
28 struct d3drm_face
30 IDirect3DRMFace IDirect3DRMFace_iface;
31 IDirect3DRMFace2 IDirect3DRMFace2_iface;
32 LONG ref;
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;
61 else
63 *out = NULL;
64 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
65 return E_NOINTERFACE;
68 IUnknown_AddRef((IUnknown *)*out);
69 return S_OK;
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);
79 return 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);
89 if (!refcount)
90 HeapFree(GetProcessHeap(), 0, face);
92 return refcount;
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);
100 return E_NOTIMPL;
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);
108 return E_NOTIMPL;
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);
116 return E_NOTIMPL;
119 static HRESULT WINAPI d3drm_face1_SetAppData(IDirect3DRMFace *iface, DWORD data)
121 FIXME("iface %p, data %#x stub!\n", iface, data);
123 return E_NOTIMPL;
126 static DWORD WINAPI d3drm_face1_GetAppData(IDirect3DRMFace *iface)
128 FIXME("iface %p stub!\n", iface);
130 return 0;
133 static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name)
135 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
137 return E_NOTIMPL;
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);
144 return E_NOTIMPL;
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);
160 return E_NOTIMPL;
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);
168 return E_NOTIMPL;
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);
176 return E_NOTIMPL;
179 static HRESULT WINAPI d3drm_face1_SetColor(IDirect3DRMFace *iface, D3DCOLOR color)
181 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
183 return E_NOTIMPL;
186 static HRESULT WINAPI d3drm_face1_SetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture *texture)
188 FIXME("iface %p, texture %p stub!\n", iface, texture);
190 return E_NOTIMPL;
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);
198 return E_NOTIMPL;
201 static HRESULT WINAPI d3drm_face1_SetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial *material)
203 FIXME("iface %p, material %p stub!\n", iface, material);
205 return E_NOTIMPL;
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);
212 return E_NOTIMPL;
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);
220 return E_NOTIMPL;
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);
229 return E_NOTIMPL;
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);
237 return E_NOTIMPL;
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);
244 return E_NOTIMPL;
247 static HRESULT WINAPI d3drm_face1_GetNormal(IDirect3DRMFace *iface, D3DVECTOR *normal)
249 FIXME("iface %p, normal %p stub!\n", iface, normal);
251 return E_NOTIMPL;
254 static HRESULT WINAPI d3drm_face1_GetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture **texture)
256 FIXME("iface %p, texture %p stub!\n", iface, texture);
258 return E_NOTIMPL;
261 static HRESULT WINAPI d3drm_face1_GetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial **material)
263 FIXME("iface %p, material %p stub!\n", iface, material);
265 return E_NOTIMPL;
268 static int WINAPI d3drm_face1_GetVertexCount(IDirect3DRMFace *iface)
270 FIXME("iface %p stub!\n", iface);
272 return 0;
275 static int WINAPI d3drm_face1_GetVertexIndex(IDirect3DRMFace *iface, DWORD which)
277 FIXME("iface %p, which %u stub!\n", iface, which);
279 return 0;
282 static int WINAPI d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace *iface, DWORD which)
284 FIXME("iface %p, which %u stub!\n", iface, which);
286 return 0;
289 static D3DCOLOR WINAPI d3drm_face1_GetColor(IDirect3DRMFace *iface)
291 FIXME("iface %p stub!\n", iface);
293 return 0;
296 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl =
298 d3drm_face1_QueryInterface,
299 d3drm_face1_AddRef,
300 d3drm_face1_Release,
301 d3drm_face1_Clone,
302 d3drm_face1_AddDestroyCallback,
303 d3drm_face1_DeleteDestroyCallback,
304 d3drm_face1_SetAppData,
305 d3drm_face1_GetAppData,
306 d3drm_face1_SetName,
307 d3drm_face1_GetName,
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);
356 return E_NOTIMPL;
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);
364 return E_NOTIMPL;
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);
372 return E_NOTIMPL;
375 static HRESULT WINAPI d3drm_face2_SetAppData(IDirect3DRMFace2 *iface, DWORD data)
377 FIXME("iface %p, data %#x stub!\n", iface, data);
379 return E_NOTIMPL;
382 static DWORD WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface)
384 FIXME("iface %p stub!\n", iface);
386 return 0;
389 static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
391 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
393 return E_NOTIMPL;
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);
400 return E_NOTIMPL;
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)
408 return E_INVALIDARG;
410 strcpy(name, "Face");
411 *size = sizeof("Face");
413 return D3DRM_OK;
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);
420 return E_NOTIMPL;
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);
428 return E_NOTIMPL;
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);
435 return E_NOTIMPL;
438 static HRESULT WINAPI d3drm_face2_SetColor(IDirect3DRMFace2 *iface, D3DCOLOR color)
440 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
442 return E_NOTIMPL;
445 static HRESULT WINAPI d3drm_face2_SetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 *texture)
447 FIXME("iface %p, texture %p stub!\n", iface, texture);
449 return E_NOTIMPL;
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);
457 return E_NOTIMPL;
460 static HRESULT WINAPI d3drm_face2_SetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 *material)
462 FIXME("iface %p, material %p stub!\n", iface, material);
464 return E_NOTIMPL;
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);
471 return E_NOTIMPL;
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);
479 return E_NOTIMPL;
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);
488 return E_NOTIMPL;
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);
496 return E_NOTIMPL;
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);
503 return E_NOTIMPL;
506 static HRESULT WINAPI d3drm_face2_GetNormal(IDirect3DRMFace2 *iface, D3DVECTOR *normal)
508 FIXME("iface %p, normal %p stub!\n", iface, normal);
510 return E_NOTIMPL;
513 static HRESULT WINAPI d3drm_face2_GetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 **texture)
515 FIXME("iface %p, texture %p stub!\n", iface, texture);
517 return E_NOTIMPL;
520 static HRESULT WINAPI d3drm_face2_GetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 **material)
522 FIXME("iface %p, material %p stub!\n", iface, material);
524 return E_NOTIMPL;
527 static int WINAPI d3drm_face2_GetVertexCount(IDirect3DRMFace2 *iface)
529 FIXME("iface %p stub!\n", iface);
531 return 0;
534 static int WINAPI d3drm_face2_GetVertexIndex(IDirect3DRMFace2 *iface, DWORD which)
536 FIXME("iface %p, which %u stub!\n", iface, which);
538 return 0;
541 static int WINAPI d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2 *iface, DWORD which)
543 FIXME("iface %p, which %u stub!\n", iface, which);
545 return 0;
548 static D3DCOLOR WINAPI d3drm_face2_GetColor(IDirect3DRMFace2 *iface)
550 FIXME("iface %p stub!\n", iface);
552 return 0;
555 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl =
557 d3drm_face2_QueryInterface,
558 d3drm_face2_AddRef,
559 d3drm_face2_Release,
560 d3drm_face2_Clone,
561 d3drm_face2_AddDestroyCallback,
562 d3drm_face2_DeleteDestroyCallback,
563 d3drm_face2_SetAppData,
564 d3drm_face2_GetAppData,
565 d3drm_face2_SetName,
566 d3drm_face2_GetName,
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;
600 object->ref = 1;
602 if (IsEqualGUID(riid, &IID_IDirect3DRMFace2))
603 *out = (IUnknown*)&object->IDirect3DRMFace2_iface;
604 else
605 *out = (IUnknown*)&object->IDirect3DRMFace_iface;
607 return S_OK;