d3drm: Implement object name property.
[wine.git] / dlls / d3drm / face.c
blob40313440ac9a1e0ece670bf49dffb0d4023852e6
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 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;
54 else
56 *out = NULL;
57 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
58 return E_NOINTERFACE;
61 IUnknown_AddRef((IUnknown *)*out);
62 return S_OK;
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);
72 return 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);
82 if (!refcount)
84 d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj);
85 HeapFree(GetProcessHeap(), 0, face);
88 return refcount;
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);
96 return E_NOTIMPL;
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_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_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
135 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
137 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
139 return d3drm_object_set_name(&face->obj, name);
142 static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name)
144 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
146 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
148 return d3drm_face2_SetName(&face->IDirect3DRMFace2_iface, name);
151 static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
153 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
155 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
157 return d3drm_object_get_name(&face->obj, size, name);
160 static HRESULT WINAPI d3drm_face1_GetName(IDirect3DRMFace *iface, DWORD *size, char *name)
162 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
164 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
166 return d3drm_face2_GetName(&face->IDirect3DRMFace2_iface, size, name);
169 static HRESULT WINAPI d3drm_face1_GetClassName(IDirect3DRMFace *iface, DWORD *size, char *name)
171 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
173 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
175 return IDirect3DRMFace2_GetClassName(&face->IDirect3DRMFace2_iface, size, name);
178 static HRESULT WINAPI d3drm_face1_AddVertex(IDirect3DRMFace *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
180 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
182 return E_NOTIMPL;
185 static HRESULT WINAPI d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace *iface,
186 DWORD vertex, DWORD normal)
188 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
190 return E_NOTIMPL;
193 static HRESULT WINAPI d3drm_face1_SetColorRGB(IDirect3DRMFace *iface,
194 D3DVALUE r, D3DVALUE g, D3DVALUE b)
196 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface, r, g, b);
198 return E_NOTIMPL;
201 static HRESULT WINAPI d3drm_face1_SetColor(IDirect3DRMFace *iface, D3DCOLOR color)
203 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
205 return E_NOTIMPL;
208 static HRESULT WINAPI d3drm_face1_SetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture *texture)
210 FIXME("iface %p, texture %p stub!\n", iface, texture);
212 return E_NOTIMPL;
215 static HRESULT WINAPI d3drm_face1_SetTextureCoordinates(IDirect3DRMFace *iface,
216 DWORD vertex, D3DVALUE u, D3DVALUE v)
218 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
220 return E_NOTIMPL;
223 static HRESULT WINAPI d3drm_face1_SetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial *material)
225 FIXME("iface %p, material %p stub!\n", iface, material);
227 return E_NOTIMPL;
230 static HRESULT WINAPI d3drm_face1_SetTextureTopology(IDirect3DRMFace *iface, BOOL wrap_u, BOOL wrap_v)
232 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
234 return E_NOTIMPL;
237 static HRESULT WINAPI d3drm_face1_GetVertex(IDirect3DRMFace *iface,
238 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
240 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
242 return E_NOTIMPL;
245 static HRESULT WINAPI d3drm_face1_GetVertices(IDirect3DRMFace *iface,
246 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
248 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
249 iface, vertex_count, coords, normals);
251 return E_NOTIMPL;
254 static HRESULT WINAPI d3drm_face1_GetTextureCoordinates(IDirect3DRMFace *iface,
255 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
257 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
259 return E_NOTIMPL;
262 static HRESULT WINAPI d3drm_face1_GetTextureTopology(IDirect3DRMFace *iface, BOOL *wrap_u, BOOL *wrap_v)
264 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
266 return E_NOTIMPL;
269 static HRESULT WINAPI d3drm_face1_GetNormal(IDirect3DRMFace *iface, D3DVECTOR *normal)
271 FIXME("iface %p, normal %p stub!\n", iface, normal);
273 return E_NOTIMPL;
276 static HRESULT WINAPI d3drm_face1_GetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture **texture)
278 FIXME("iface %p, texture %p stub!\n", iface, texture);
280 return E_NOTIMPL;
283 static HRESULT WINAPI d3drm_face1_GetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial **material)
285 FIXME("iface %p, material %p stub!\n", iface, material);
287 return E_NOTIMPL;
290 static int WINAPI d3drm_face1_GetVertexCount(IDirect3DRMFace *iface)
292 FIXME("iface %p stub!\n", iface);
294 return 0;
297 static int WINAPI d3drm_face1_GetVertexIndex(IDirect3DRMFace *iface, DWORD which)
299 FIXME("iface %p, which %u stub!\n", iface, which);
301 return 0;
304 static int WINAPI d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace *iface, DWORD which)
306 FIXME("iface %p, which %u stub!\n", iface, which);
308 return 0;
311 static D3DCOLOR WINAPI d3drm_face1_GetColor(IDirect3DRMFace *iface)
313 FIXME("iface %p stub!\n", iface);
315 return 0;
318 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl =
320 d3drm_face1_QueryInterface,
321 d3drm_face1_AddRef,
322 d3drm_face1_Release,
323 d3drm_face1_Clone,
324 d3drm_face1_AddDestroyCallback,
325 d3drm_face1_DeleteDestroyCallback,
326 d3drm_face1_SetAppData,
327 d3drm_face1_GetAppData,
328 d3drm_face1_SetName,
329 d3drm_face1_GetName,
330 d3drm_face1_GetClassName,
331 d3drm_face1_AddVertex,
332 d3drm_face1_AddVertexAndNormalIndexed,
333 d3drm_face1_SetColorRGB,
334 d3drm_face1_SetColor,
335 d3drm_face1_SetTexture,
336 d3drm_face1_SetTextureCoordinates,
337 d3drm_face1_SetMaterial,
338 d3drm_face1_SetTextureTopology,
339 d3drm_face1_GetVertex,
340 d3drm_face1_GetVertices,
341 d3drm_face1_GetTextureCoordinates,
342 d3drm_face1_GetTextureTopology,
343 d3drm_face1_GetNormal,
344 d3drm_face1_GetTexture,
345 d3drm_face1_GetMaterial,
346 d3drm_face1_GetVertexCount,
347 d3drm_face1_GetVertexIndex,
348 d3drm_face1_GetTextureCoordinateIndex,
349 d3drm_face1_GetColor,
352 static HRESULT WINAPI d3drm_face2_QueryInterface(IDirect3DRMFace2 *iface, REFIID riid, void **out)
354 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
356 return d3drm_face1_QueryInterface(&face->IDirect3DRMFace_iface, riid, out);
359 static ULONG WINAPI d3drm_face2_AddRef(IDirect3DRMFace2 *iface)
361 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
363 return d3drm_face1_AddRef(&face->IDirect3DRMFace_iface);
366 static ULONG WINAPI d3drm_face2_Release(IDirect3DRMFace2 *iface)
368 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
370 return d3drm_face1_Release(&face->IDirect3DRMFace_iface);
373 static HRESULT WINAPI d3drm_face2_Clone(IDirect3DRMFace2 *iface,
374 IUnknown *outer, REFIID iid, void **out)
376 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
378 return E_NOTIMPL;
381 static HRESULT WINAPI d3drm_face2_AddDestroyCallback(IDirect3DRMFace2 *iface,
382 D3DRMOBJECTCALLBACK cb, void *ctx)
384 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
386 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
388 return d3drm_object_add_destroy_callback(&face->obj, cb, ctx);
391 static HRESULT WINAPI d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2 *iface,
392 D3DRMOBJECTCALLBACK cb, void *ctx)
394 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
396 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
398 return d3drm_object_delete_destroy_callback(&face->obj, cb, ctx);
401 static HRESULT WINAPI d3drm_face2_SetAppData(IDirect3DRMFace2 *iface, DWORD data)
403 FIXME("iface %p, data %#x stub!\n", iface, data);
405 return E_NOTIMPL;
408 static DWORD WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface)
410 FIXME("iface %p stub!\n", iface);
412 return 0;
415 static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
417 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
419 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
421 return d3drm_object_get_class_name(&face->obj, size, name);
424 static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
426 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
428 return E_NOTIMPL;
431 static HRESULT WINAPI d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2 *iface,
432 DWORD vertex, DWORD normal)
434 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
436 return E_NOTIMPL;
439 static HRESULT WINAPI d3drm_face2_SetColorRGB(IDirect3DRMFace2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
441 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface, r, g, b);
443 return E_NOTIMPL;
446 static HRESULT WINAPI d3drm_face2_SetColor(IDirect3DRMFace2 *iface, D3DCOLOR color)
448 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
450 return E_NOTIMPL;
453 static HRESULT WINAPI d3drm_face2_SetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 *texture)
455 FIXME("iface %p, texture %p stub!\n", iface, texture);
457 return E_NOTIMPL;
460 static HRESULT WINAPI d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2 *iface,
461 DWORD vertex, D3DVALUE u, D3DVALUE v)
463 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
465 return E_NOTIMPL;
468 static HRESULT WINAPI d3drm_face2_SetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 *material)
470 FIXME("iface %p, material %p stub!\n", iface, material);
472 return E_NOTIMPL;
475 static HRESULT WINAPI d3drm_face2_SetTextureTopology(IDirect3DRMFace2 *iface, BOOL wrap_u, BOOL wrap_v)
477 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
479 return E_NOTIMPL;
482 static HRESULT WINAPI d3drm_face2_GetVertex(IDirect3DRMFace2 *iface,
483 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
485 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
487 return E_NOTIMPL;
490 static HRESULT WINAPI d3drm_face2_GetVertices(IDirect3DRMFace2 *iface,
491 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
493 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
494 iface, vertex_count, coords, normals);
496 return E_NOTIMPL;
499 static HRESULT WINAPI d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2 *iface,
500 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
502 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
504 return E_NOTIMPL;
507 static HRESULT WINAPI d3drm_face2_GetTextureTopology(IDirect3DRMFace2 *iface, BOOL *wrap_u, BOOL *wrap_v)
509 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
511 return E_NOTIMPL;
514 static HRESULT WINAPI d3drm_face2_GetNormal(IDirect3DRMFace2 *iface, D3DVECTOR *normal)
516 FIXME("iface %p, normal %p stub!\n", iface, normal);
518 return E_NOTIMPL;
521 static HRESULT WINAPI d3drm_face2_GetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 **texture)
523 FIXME("iface %p, texture %p stub!\n", iface, texture);
525 return E_NOTIMPL;
528 static HRESULT WINAPI d3drm_face2_GetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 **material)
530 FIXME("iface %p, material %p stub!\n", iface, material);
532 return E_NOTIMPL;
535 static int WINAPI d3drm_face2_GetVertexCount(IDirect3DRMFace2 *iface)
537 FIXME("iface %p stub!\n", iface);
539 return 0;
542 static int WINAPI d3drm_face2_GetVertexIndex(IDirect3DRMFace2 *iface, DWORD which)
544 FIXME("iface %p, which %u stub!\n", iface, which);
546 return 0;
549 static int WINAPI d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2 *iface, DWORD which)
551 FIXME("iface %p, which %u stub!\n", iface, which);
553 return 0;
556 static D3DCOLOR WINAPI d3drm_face2_GetColor(IDirect3DRMFace2 *iface)
558 FIXME("iface %p stub!\n", iface);
560 return 0;
563 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl =
565 d3drm_face2_QueryInterface,
566 d3drm_face2_AddRef,
567 d3drm_face2_Release,
568 d3drm_face2_Clone,
569 d3drm_face2_AddDestroyCallback,
570 d3drm_face2_DeleteDestroyCallback,
571 d3drm_face2_SetAppData,
572 d3drm_face2_GetAppData,
573 d3drm_face2_SetName,
574 d3drm_face2_GetName,
575 d3drm_face2_GetClassName,
576 d3drm_face2_AddVertex,
577 d3drm_face2_AddVertexAndNormalIndexed,
578 d3drm_face2_SetColorRGB,
579 d3drm_face2_SetColor,
580 d3drm_face2_SetTexture,
581 d3drm_face2_SetTextureCoordinates,
582 d3drm_face2_SetMaterial,
583 d3drm_face2_SetTextureTopology,
584 d3drm_face2_GetVertex,
585 d3drm_face2_GetVertices,
586 d3drm_face2_GetTextureCoordinates,
587 d3drm_face2_GetTextureTopology,
588 d3drm_face2_GetNormal,
589 d3drm_face2_GetTexture,
590 d3drm_face2_GetMaterial,
591 d3drm_face2_GetVertexCount,
592 d3drm_face2_GetVertexIndex,
593 d3drm_face2_GetTextureCoordinateIndex,
594 d3drm_face2_GetColor,
597 HRESULT d3drm_face_create(struct d3drm_face **face)
599 static const char classname[] = "Face";
600 struct d3drm_face *object;
602 TRACE("face %p.\n", face);
604 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
605 return E_OUTOFMEMORY;
607 object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
608 object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl;
609 object->ref = 1;
611 d3drm_object_init(&object->obj, classname);
613 *face = object;
615 return S_OK;