wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / d3drm / face.c
blob1799ad98cf46dcc1f56c6ca94f2a0dab16bee698
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 "d3drm_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
25 static inline struct d3drm_face *impl_from_IDirect3DRMFace(IDirect3DRMFace *iface)
27 return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace_iface);
30 static inline struct d3drm_face *impl_from_IDirect3DRMFace2(IDirect3DRMFace2 *iface)
32 return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace2_iface);
35 static HRESULT WINAPI d3drm_face1_QueryInterface(IDirect3DRMFace *iface, REFIID riid, void **out)
37 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
39 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
41 if (IsEqualGUID(riid, &IID_IDirect3DRMFace)
42 || IsEqualGUID(riid, &IID_IDirect3DRMObject)
43 || IsEqualGUID(riid, &IID_IUnknown))
45 *out = &face->IDirect3DRMFace_iface;
47 else if(IsEqualGUID(riid, &IID_IDirect3DRMFace2))
49 *out = &face->IDirect3DRMFace2_iface;
51 else
53 *out = NULL;
54 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
55 return E_NOINTERFACE;
58 IUnknown_AddRef((IUnknown *)*out);
59 return S_OK;
62 static ULONG WINAPI d3drm_face1_AddRef(IDirect3DRMFace *iface)
64 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
65 ULONG refcount = InterlockedIncrement(&face->ref);
67 TRACE("%p increasing refcount to %u.\n", iface, refcount);
69 return refcount;
72 static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface)
74 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
75 ULONG refcount = InterlockedDecrement(&face->ref);
77 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
79 if (!refcount)
81 d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj);
82 heap_free(face);
85 return refcount;
88 static HRESULT WINAPI d3drm_face1_Clone(IDirect3DRMFace *iface,
89 IUnknown *outer, REFIID iid, void **out)
91 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
93 return E_NOTIMPL;
96 static HRESULT WINAPI d3drm_face1_AddDestroyCallback(IDirect3DRMFace *iface,
97 D3DRMOBJECTCALLBACK cb, void *ctx)
99 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
101 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
103 return IDirect3DRMFace2_AddDestroyCallback(&face->IDirect3DRMFace2_iface, cb, ctx);
106 static HRESULT WINAPI d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace *iface,
107 D3DRMOBJECTCALLBACK cb, void *ctx)
109 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
111 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
113 return IDirect3DRMFace2_DeleteDestroyCallback(&face->IDirect3DRMFace2_iface, cb, ctx);
116 static HRESULT WINAPI d3drm_face2_SetAppData(IDirect3DRMFace2 *iface, DWORD data)
118 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
120 TRACE("iface %p, data %#x.\n", iface, data);
122 face->obj.appdata = data;
124 return D3DRM_OK;
127 static HRESULT WINAPI d3drm_face1_SetAppData(IDirect3DRMFace *iface, DWORD data)
129 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
131 TRACE("iface %p, data %#x.\n", iface, data);
133 return d3drm_face2_SetAppData(&face->IDirect3DRMFace2_iface, data);
136 static DWORD WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface)
138 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
140 TRACE("iface %p.\n", iface);
142 return face->obj.appdata;
145 static DWORD WINAPI d3drm_face1_GetAppData(IDirect3DRMFace *iface)
147 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
149 TRACE("iface %p.\n", iface);
151 return d3drm_face2_GetAppData(&face->IDirect3DRMFace2_iface);
154 static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
156 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
158 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
160 return d3drm_object_set_name(&face->obj, name);
163 static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name)
165 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
167 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
169 return d3drm_face2_SetName(&face->IDirect3DRMFace2_iface, name);
172 static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
174 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
176 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
178 return d3drm_object_get_name(&face->obj, size, name);
181 static HRESULT WINAPI d3drm_face1_GetName(IDirect3DRMFace *iface, DWORD *size, char *name)
183 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
185 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
187 return d3drm_face2_GetName(&face->IDirect3DRMFace2_iface, size, name);
190 static HRESULT WINAPI d3drm_face1_GetClassName(IDirect3DRMFace *iface, DWORD *size, char *name)
192 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
194 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
196 return IDirect3DRMFace2_GetClassName(&face->IDirect3DRMFace2_iface, size, name);
199 static HRESULT WINAPI d3drm_face1_AddVertex(IDirect3DRMFace *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
201 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
203 return E_NOTIMPL;
206 static HRESULT WINAPI d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace *iface,
207 DWORD vertex, DWORD normal)
209 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
211 return E_NOTIMPL;
214 static HRESULT WINAPI d3drm_face2_SetColorRGB(IDirect3DRMFace2 *iface, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
216 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
218 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
220 d3drm_set_color(&face->color, red, green, blue, 1.0f);
222 return D3DRM_OK;
225 static HRESULT WINAPI d3drm_face1_SetColorRGB(IDirect3DRMFace *iface,
226 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
228 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
230 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
232 return d3drm_face2_SetColorRGB(&face->IDirect3DRMFace2_iface, red, green, blue);
235 static HRESULT WINAPI d3drm_face2_SetColor(IDirect3DRMFace2 *iface, D3DCOLOR color)
237 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
239 TRACE("iface %p, color 0x%08x.\n", iface, color);
241 face->color = color;
243 return D3DRM_OK;
246 static HRESULT WINAPI d3drm_face1_SetColor(IDirect3DRMFace *iface, D3DCOLOR color)
248 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
250 TRACE("iface %p, color 0x%08x.\n", iface, color);
252 return d3drm_face2_SetColor(&face->IDirect3DRMFace2_iface, color);
255 static HRESULT WINAPI d3drm_face1_SetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture *texture)
257 FIXME("iface %p, texture %p stub!\n", iface, texture);
259 return E_NOTIMPL;
262 static HRESULT WINAPI d3drm_face1_SetTextureCoordinates(IDirect3DRMFace *iface,
263 DWORD vertex, D3DVALUE u, D3DVALUE v)
265 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
267 return E_NOTIMPL;
270 static HRESULT WINAPI d3drm_face1_SetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial *material)
272 FIXME("iface %p, material %p stub!\n", iface, material);
274 return E_NOTIMPL;
277 static HRESULT WINAPI d3drm_face1_SetTextureTopology(IDirect3DRMFace *iface, BOOL wrap_u, BOOL wrap_v)
279 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
281 return E_NOTIMPL;
284 static HRESULT WINAPI d3drm_face1_GetVertex(IDirect3DRMFace *iface,
285 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
287 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
289 return E_NOTIMPL;
292 static HRESULT WINAPI d3drm_face1_GetVertices(IDirect3DRMFace *iface,
293 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
295 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
296 iface, vertex_count, coords, normals);
298 return E_NOTIMPL;
301 static HRESULT WINAPI d3drm_face1_GetTextureCoordinates(IDirect3DRMFace *iface,
302 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
304 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
306 return E_NOTIMPL;
309 static HRESULT WINAPI d3drm_face1_GetTextureTopology(IDirect3DRMFace *iface, BOOL *wrap_u, BOOL *wrap_v)
311 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
313 return E_NOTIMPL;
316 static HRESULT WINAPI d3drm_face1_GetNormal(IDirect3DRMFace *iface, D3DVECTOR *normal)
318 FIXME("iface %p, normal %p stub!\n", iface, normal);
320 return E_NOTIMPL;
323 static HRESULT WINAPI d3drm_face1_GetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture **texture)
325 FIXME("iface %p, texture %p stub!\n", iface, texture);
327 return E_NOTIMPL;
330 static HRESULT WINAPI d3drm_face1_GetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial **material)
332 FIXME("iface %p, material %p stub!\n", iface, material);
334 return E_NOTIMPL;
337 static int WINAPI d3drm_face1_GetVertexCount(IDirect3DRMFace *iface)
339 FIXME("iface %p stub!\n", iface);
341 return 0;
344 static int WINAPI d3drm_face1_GetVertexIndex(IDirect3DRMFace *iface, DWORD which)
346 FIXME("iface %p, which %u stub!\n", iface, which);
348 return 0;
351 static int WINAPI d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace *iface, DWORD which)
353 FIXME("iface %p, which %u stub!\n", iface, which);
355 return 0;
358 static D3DCOLOR WINAPI d3drm_face2_GetColor(IDirect3DRMFace2 *iface)
360 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
362 TRACE("iface %p.\n", iface);
364 return face->color;
367 static D3DCOLOR WINAPI d3drm_face1_GetColor(IDirect3DRMFace *iface)
369 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
371 TRACE("iface %p.\n", iface);
373 return d3drm_face2_GetColor(&face->IDirect3DRMFace2_iface);
376 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl =
378 d3drm_face1_QueryInterface,
379 d3drm_face1_AddRef,
380 d3drm_face1_Release,
381 d3drm_face1_Clone,
382 d3drm_face1_AddDestroyCallback,
383 d3drm_face1_DeleteDestroyCallback,
384 d3drm_face1_SetAppData,
385 d3drm_face1_GetAppData,
386 d3drm_face1_SetName,
387 d3drm_face1_GetName,
388 d3drm_face1_GetClassName,
389 d3drm_face1_AddVertex,
390 d3drm_face1_AddVertexAndNormalIndexed,
391 d3drm_face1_SetColorRGB,
392 d3drm_face1_SetColor,
393 d3drm_face1_SetTexture,
394 d3drm_face1_SetTextureCoordinates,
395 d3drm_face1_SetMaterial,
396 d3drm_face1_SetTextureTopology,
397 d3drm_face1_GetVertex,
398 d3drm_face1_GetVertices,
399 d3drm_face1_GetTextureCoordinates,
400 d3drm_face1_GetTextureTopology,
401 d3drm_face1_GetNormal,
402 d3drm_face1_GetTexture,
403 d3drm_face1_GetMaterial,
404 d3drm_face1_GetVertexCount,
405 d3drm_face1_GetVertexIndex,
406 d3drm_face1_GetTextureCoordinateIndex,
407 d3drm_face1_GetColor,
410 static HRESULT WINAPI d3drm_face2_QueryInterface(IDirect3DRMFace2 *iface, REFIID riid, void **out)
412 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
414 return d3drm_face1_QueryInterface(&face->IDirect3DRMFace_iface, riid, out);
417 static ULONG WINAPI d3drm_face2_AddRef(IDirect3DRMFace2 *iface)
419 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
421 return d3drm_face1_AddRef(&face->IDirect3DRMFace_iface);
424 static ULONG WINAPI d3drm_face2_Release(IDirect3DRMFace2 *iface)
426 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
428 return d3drm_face1_Release(&face->IDirect3DRMFace_iface);
431 static HRESULT WINAPI d3drm_face2_Clone(IDirect3DRMFace2 *iface,
432 IUnknown *outer, REFIID iid, void **out)
434 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
436 return E_NOTIMPL;
439 static HRESULT WINAPI d3drm_face2_AddDestroyCallback(IDirect3DRMFace2 *iface,
440 D3DRMOBJECTCALLBACK cb, void *ctx)
442 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
444 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
446 return d3drm_object_add_destroy_callback(&face->obj, cb, ctx);
449 static HRESULT WINAPI d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2 *iface,
450 D3DRMOBJECTCALLBACK cb, void *ctx)
452 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
454 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
456 return d3drm_object_delete_destroy_callback(&face->obj, cb, ctx);
459 static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
461 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
463 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
465 return d3drm_object_get_class_name(&face->obj, size, name);
468 static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
470 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
472 return E_NOTIMPL;
475 static HRESULT WINAPI d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2 *iface,
476 DWORD vertex, DWORD normal)
478 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
480 return E_NOTIMPL;
483 static HRESULT WINAPI d3drm_face2_SetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 *texture)
485 FIXME("iface %p, texture %p stub!\n", iface, texture);
487 return E_NOTIMPL;
490 static HRESULT WINAPI d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2 *iface,
491 DWORD vertex, D3DVALUE u, D3DVALUE v)
493 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
495 return E_NOTIMPL;
498 static HRESULT WINAPI d3drm_face2_SetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 *material)
500 FIXME("iface %p, material %p stub!\n", iface, material);
502 return E_NOTIMPL;
505 static HRESULT WINAPI d3drm_face2_SetTextureTopology(IDirect3DRMFace2 *iface, BOOL wrap_u, BOOL wrap_v)
507 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
509 return E_NOTIMPL;
512 static HRESULT WINAPI d3drm_face2_GetVertex(IDirect3DRMFace2 *iface,
513 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
515 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
517 return E_NOTIMPL;
520 static HRESULT WINAPI d3drm_face2_GetVertices(IDirect3DRMFace2 *iface,
521 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
523 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
524 iface, vertex_count, coords, normals);
526 return E_NOTIMPL;
529 static HRESULT WINAPI d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2 *iface,
530 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
532 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
534 return E_NOTIMPL;
537 static HRESULT WINAPI d3drm_face2_GetTextureTopology(IDirect3DRMFace2 *iface, BOOL *wrap_u, BOOL *wrap_v)
539 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
541 return E_NOTIMPL;
544 static HRESULT WINAPI d3drm_face2_GetNormal(IDirect3DRMFace2 *iface, D3DVECTOR *normal)
546 FIXME("iface %p, normal %p stub!\n", iface, normal);
548 return E_NOTIMPL;
551 static HRESULT WINAPI d3drm_face2_GetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 **texture)
553 FIXME("iface %p, texture %p stub!\n", iface, texture);
555 return E_NOTIMPL;
558 static HRESULT WINAPI d3drm_face2_GetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 **material)
560 FIXME("iface %p, material %p stub!\n", iface, material);
562 return E_NOTIMPL;
565 static int WINAPI d3drm_face2_GetVertexCount(IDirect3DRMFace2 *iface)
567 FIXME("iface %p stub!\n", iface);
569 return 0;
572 static int WINAPI d3drm_face2_GetVertexIndex(IDirect3DRMFace2 *iface, DWORD which)
574 FIXME("iface %p, which %u stub!\n", iface, which);
576 return 0;
579 static int WINAPI d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2 *iface, DWORD which)
581 FIXME("iface %p, which %u stub!\n", iface, which);
583 return 0;
586 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl =
588 d3drm_face2_QueryInterface,
589 d3drm_face2_AddRef,
590 d3drm_face2_Release,
591 d3drm_face2_Clone,
592 d3drm_face2_AddDestroyCallback,
593 d3drm_face2_DeleteDestroyCallback,
594 d3drm_face2_SetAppData,
595 d3drm_face2_GetAppData,
596 d3drm_face2_SetName,
597 d3drm_face2_GetName,
598 d3drm_face2_GetClassName,
599 d3drm_face2_AddVertex,
600 d3drm_face2_AddVertexAndNormalIndexed,
601 d3drm_face2_SetColorRGB,
602 d3drm_face2_SetColor,
603 d3drm_face2_SetTexture,
604 d3drm_face2_SetTextureCoordinates,
605 d3drm_face2_SetMaterial,
606 d3drm_face2_SetTextureTopology,
607 d3drm_face2_GetVertex,
608 d3drm_face2_GetVertices,
609 d3drm_face2_GetTextureCoordinates,
610 d3drm_face2_GetTextureTopology,
611 d3drm_face2_GetNormal,
612 d3drm_face2_GetTexture,
613 d3drm_face2_GetMaterial,
614 d3drm_face2_GetVertexCount,
615 d3drm_face2_GetVertexIndex,
616 d3drm_face2_GetTextureCoordinateIndex,
617 d3drm_face2_GetColor,
620 HRESULT d3drm_face_create(struct d3drm_face **face)
622 static const char classname[] = "Face";
623 struct d3drm_face *object;
625 TRACE("face %p.\n", face);
627 if (!(object = heap_alloc_zero(sizeof(*object))))
628 return E_OUTOFMEMORY;
630 object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
631 object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl;
632 object->ref = 1;
634 d3drm_object_init(&object->obj, classname);
636 *face = object;
638 return S_OK;