krnl386.exe16: Emulate 'mov Eb, Gb' instruction on x86 processor architecture.
[wine.git] / dlls / d3drm / face.c
blobe9e7e9a65b401362237c3b2fc90ffd775b451d86
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 "wine/debug.h"
23 #define COBJMACROS
25 #include "winbase.h"
26 #include "wingdi.h"
28 #include "d3drm_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
32 struct d3drm_face
34 IDirect3DRMFace IDirect3DRMFace_iface;
35 IDirect3DRMFace2 IDirect3DRMFace2_iface;
36 LONG ref;
39 static inline struct d3drm_face *impl_from_IDirect3DRMFace(IDirect3DRMFace *iface)
41 return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace_iface);
44 static inline struct d3drm_face *impl_from_IDirect3DRMFace2(IDirect3DRMFace2 *iface)
46 return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace2_iface);
49 static HRESULT WINAPI d3drm_face1_QueryInterface(IDirect3DRMFace *iface, REFIID riid, void **out)
51 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
53 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
56 if (IsEqualGUID(riid, &IID_IDirect3DRMFace)
57 || IsEqualGUID(riid, &IID_IUnknown))
59 *out = &face->IDirect3DRMFace_iface;
61 else if(IsEqualGUID(riid, &IID_IDirect3DRMFace2))
63 *out = &face->IDirect3DRMFace2_iface;
65 else
67 *out = NULL;
68 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
69 return E_NOINTERFACE;
72 IUnknown_AddRef((IUnknown *)*out);
73 return S_OK;
76 static ULONG WINAPI d3drm_face1_AddRef(IDirect3DRMFace *iface)
78 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
79 ULONG refcount = InterlockedIncrement(&face->ref);
81 TRACE("%p increasing refcount to %u.\n", iface, refcount);
83 return refcount;
86 static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface)
88 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
89 ULONG refcount = InterlockedDecrement(&face->ref);
91 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
93 if (!refcount)
94 HeapFree(GetProcessHeap(), 0, face);
96 return refcount;
99 static HRESULT WINAPI d3drm_face1_Clone(IDirect3DRMFace *iface,
100 IUnknown *outer, REFIID iid, void **out)
102 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
104 return E_NOTIMPL;
107 static HRESULT WINAPI d3drm_face1_AddDestroyCallback(IDirect3DRMFace *iface,
108 D3DRMOBJECTCALLBACK cb, void *ctx)
110 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
112 return E_NOTIMPL;
115 static HRESULT WINAPI d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace *iface,
116 D3DRMOBJECTCALLBACK cb, void *ctx)
118 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
120 return E_NOTIMPL;
123 static HRESULT WINAPI d3drm_face1_SetAppData(IDirect3DRMFace *iface, DWORD data)
125 FIXME("iface %p, data %#x stub!\n", iface, data);
127 return E_NOTIMPL;
130 static DWORD WINAPI d3drm_face1_GetAppData(IDirect3DRMFace *iface)
132 FIXME("iface %p stub!\n", iface);
134 return 0;
137 static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name)
139 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
141 return E_NOTIMPL;
144 static HRESULT WINAPI d3drm_face1_GetName(IDirect3DRMFace *iface, DWORD *size, char *name)
146 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
148 return E_NOTIMPL;
151 static HRESULT WINAPI d3drm_face1_GetClassName(IDirect3DRMFace *iface, DWORD *size, char *name)
153 struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
155 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
157 return IDirect3DRMFace2_GetClassName(&face->IDirect3DRMFace2_iface, size, name);
160 static HRESULT WINAPI d3drm_face1_AddVertex(IDirect3DRMFace *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
162 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
164 return E_NOTIMPL;
167 static HRESULT WINAPI d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace *iface,
168 DWORD vertex, DWORD normal)
170 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
172 return E_NOTIMPL;
175 static HRESULT WINAPI d3drm_face1_SetColorRGB(IDirect3DRMFace *iface,
176 D3DVALUE r, D3DVALUE g, D3DVALUE b)
178 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface, r, g, b);
180 return E_NOTIMPL;
183 static HRESULT WINAPI d3drm_face1_SetColor(IDirect3DRMFace *iface, D3DCOLOR color)
185 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
187 return E_NOTIMPL;
190 static HRESULT WINAPI d3drm_face1_SetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture *texture)
192 FIXME("iface %p, texture %p stub!\n", iface, texture);
194 return E_NOTIMPL;
197 static HRESULT WINAPI d3drm_face1_SetTextureCoordinates(IDirect3DRMFace *iface,
198 DWORD vertex, D3DVALUE u, D3DVALUE v)
200 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
202 return E_NOTIMPL;
205 static HRESULT WINAPI d3drm_face1_SetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial *material)
207 FIXME("iface %p, material %p stub!\n", iface, material);
209 return E_NOTIMPL;
212 static HRESULT WINAPI d3drm_face1_SetTextureTopology(IDirect3DRMFace *iface, BOOL wrap_u, BOOL wrap_v)
214 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
216 return E_NOTIMPL;
219 static HRESULT WINAPI d3drm_face1_GetVertex(IDirect3DRMFace *iface,
220 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
222 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
224 return E_NOTIMPL;
227 static HRESULT WINAPI d3drm_face1_GetVertices(IDirect3DRMFace *iface,
228 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
230 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
231 iface, vertex_count, coords, normals);
233 return E_NOTIMPL;
236 static HRESULT WINAPI d3drm_face1_GetTextureCoordinates(IDirect3DRMFace *iface,
237 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
239 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
241 return E_NOTIMPL;
244 static HRESULT WINAPI d3drm_face1_GetTextureTopology(IDirect3DRMFace *iface, BOOL *wrap_u, BOOL *wrap_v)
246 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
248 return E_NOTIMPL;
251 static HRESULT WINAPI d3drm_face1_GetNormal(IDirect3DRMFace *iface, D3DVECTOR *normal)
253 FIXME("iface %p, normal %p stub!\n", iface, normal);
255 return E_NOTIMPL;
258 static HRESULT WINAPI d3drm_face1_GetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture **texture)
260 FIXME("iface %p, texture %p stub!\n", iface, texture);
262 return E_NOTIMPL;
265 static HRESULT WINAPI d3drm_face1_GetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial **material)
267 FIXME("iface %p, material %p stub!\n", iface, material);
269 return E_NOTIMPL;
272 static int WINAPI d3drm_face1_GetVertexCount(IDirect3DRMFace *iface)
274 FIXME("iface %p stub!\n", iface);
276 return 0;
279 static int WINAPI d3drm_face1_GetVertexIndex(IDirect3DRMFace *iface, DWORD which)
281 FIXME("iface %p, which %u stub!\n", iface, which);
283 return 0;
286 static int WINAPI d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace *iface, DWORD which)
288 FIXME("iface %p, which %u stub!\n", iface, which);
290 return 0;
293 static D3DCOLOR WINAPI d3drm_face1_GetColor(IDirect3DRMFace *iface)
295 FIXME("iface %p stub!\n", iface);
297 return 0;
300 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl =
302 d3drm_face1_QueryInterface,
303 d3drm_face1_AddRef,
304 d3drm_face1_Release,
305 d3drm_face1_Clone,
306 d3drm_face1_AddDestroyCallback,
307 d3drm_face1_DeleteDestroyCallback,
308 d3drm_face1_SetAppData,
309 d3drm_face1_GetAppData,
310 d3drm_face1_SetName,
311 d3drm_face1_GetName,
312 d3drm_face1_GetClassName,
313 d3drm_face1_AddVertex,
314 d3drm_face1_AddVertexAndNormalIndexed,
315 d3drm_face1_SetColorRGB,
316 d3drm_face1_SetColor,
317 d3drm_face1_SetTexture,
318 d3drm_face1_SetTextureCoordinates,
319 d3drm_face1_SetMaterial,
320 d3drm_face1_SetTextureTopology,
321 d3drm_face1_GetVertex,
322 d3drm_face1_GetVertices,
323 d3drm_face1_GetTextureCoordinates,
324 d3drm_face1_GetTextureTopology,
325 d3drm_face1_GetNormal,
326 d3drm_face1_GetTexture,
327 d3drm_face1_GetMaterial,
328 d3drm_face1_GetVertexCount,
329 d3drm_face1_GetVertexIndex,
330 d3drm_face1_GetTextureCoordinateIndex,
331 d3drm_face1_GetColor,
334 static HRESULT WINAPI d3drm_face2_QueryInterface(IDirect3DRMFace2 *iface, REFIID riid, void **out)
336 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
338 return d3drm_face1_QueryInterface(&face->IDirect3DRMFace_iface, riid, out);
341 static ULONG WINAPI d3drm_face2_AddRef(IDirect3DRMFace2 *iface)
343 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
345 return d3drm_face1_AddRef(&face->IDirect3DRMFace_iface);
348 static ULONG WINAPI d3drm_face2_Release(IDirect3DRMFace2 *iface)
350 struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
352 return d3drm_face1_Release(&face->IDirect3DRMFace_iface);
355 static HRESULT WINAPI d3drm_face2_Clone(IDirect3DRMFace2 *iface,
356 IUnknown *outer, REFIID iid, void **out)
358 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
360 return E_NOTIMPL;
363 static HRESULT WINAPI d3drm_face2_AddDestroyCallback(IDirect3DRMFace2 *iface,
364 D3DRMOBJECTCALLBACK cb, void *ctx)
366 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
368 return E_NOTIMPL;
371 static HRESULT WINAPI d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2 *iface,
372 D3DRMOBJECTCALLBACK cb, void *ctx)
374 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
376 return E_NOTIMPL;
379 static HRESULT WINAPI d3drm_face2_SetAppData(IDirect3DRMFace2 *iface, DWORD data)
381 FIXME("iface %p, data %#x stub!\n", iface, data);
383 return E_NOTIMPL;
386 static DWORD WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface)
388 FIXME("iface %p stub!\n", iface);
390 return 0;
393 static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
395 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
397 return E_NOTIMPL;
400 static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
402 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
404 return E_NOTIMPL;
407 static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
409 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
411 if (!size || *size < strlen("Face") || !name)
412 return E_INVALIDARG;
414 strcpy(name, "Face");
415 *size = sizeof("Face");
417 return D3DRM_OK;
420 static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
422 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
424 return E_NOTIMPL;
427 static HRESULT WINAPI d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2 *iface,
428 DWORD vertex, DWORD normal)
430 FIXME("iface %p, vertex %u, normal %u stub!\n", iface, vertex, normal);
432 return E_NOTIMPL;
435 static HRESULT WINAPI d3drm_face2_SetColorRGB(IDirect3DRMFace2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
437 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface, r, g, b);
439 return E_NOTIMPL;
442 static HRESULT WINAPI d3drm_face2_SetColor(IDirect3DRMFace2 *iface, D3DCOLOR color)
444 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
446 return E_NOTIMPL;
449 static HRESULT WINAPI d3drm_face2_SetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 *texture)
451 FIXME("iface %p, texture %p stub!\n", iface, texture);
453 return E_NOTIMPL;
456 static HRESULT WINAPI d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2 *iface,
457 DWORD vertex, D3DVALUE u, D3DVALUE v)
459 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
461 return E_NOTIMPL;
464 static HRESULT WINAPI d3drm_face2_SetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 *material)
466 FIXME("iface %p, material %p stub!\n", iface, material);
468 return E_NOTIMPL;
471 static HRESULT WINAPI d3drm_face2_SetTextureTopology(IDirect3DRMFace2 *iface, BOOL wrap_u, BOOL wrap_v)
473 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
475 return E_NOTIMPL;
478 static HRESULT WINAPI d3drm_face2_GetVertex(IDirect3DRMFace2 *iface,
479 DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
481 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
483 return E_NOTIMPL;
486 static HRESULT WINAPI d3drm_face2_GetVertices(IDirect3DRMFace2 *iface,
487 DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
489 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
490 iface, vertex_count, coords, normals);
492 return E_NOTIMPL;
495 static HRESULT WINAPI d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2 *iface,
496 DWORD vertex, D3DVALUE *u, D3DVALUE *v)
498 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface, vertex, u, v);
500 return E_NOTIMPL;
503 static HRESULT WINAPI d3drm_face2_GetTextureTopology(IDirect3DRMFace2 *iface, BOOL *wrap_u, BOOL *wrap_v)
505 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
507 return E_NOTIMPL;
510 static HRESULT WINAPI d3drm_face2_GetNormal(IDirect3DRMFace2 *iface, D3DVECTOR *normal)
512 FIXME("iface %p, normal %p stub!\n", iface, normal);
514 return E_NOTIMPL;
517 static HRESULT WINAPI d3drm_face2_GetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 **texture)
519 FIXME("iface %p, texture %p stub!\n", iface, texture);
521 return E_NOTIMPL;
524 static HRESULT WINAPI d3drm_face2_GetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 **material)
526 FIXME("iface %p, material %p stub!\n", iface, material);
528 return E_NOTIMPL;
531 static int WINAPI d3drm_face2_GetVertexCount(IDirect3DRMFace2 *iface)
533 FIXME("iface %p stub!\n", iface);
535 return 0;
538 static int WINAPI d3drm_face2_GetVertexIndex(IDirect3DRMFace2 *iface, DWORD which)
540 FIXME("iface %p, which %u stub!\n", iface, which);
542 return 0;
545 static int WINAPI d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2 *iface, DWORD which)
547 FIXME("iface %p, which %u stub!\n", iface, which);
549 return 0;
552 static D3DCOLOR WINAPI d3drm_face2_GetColor(IDirect3DRMFace2 *iface)
554 FIXME("iface %p stub!\n", iface);
556 return 0;
559 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl =
561 d3drm_face2_QueryInterface,
562 d3drm_face2_AddRef,
563 d3drm_face2_Release,
564 d3drm_face2_Clone,
565 d3drm_face2_AddDestroyCallback,
566 d3drm_face2_DeleteDestroyCallback,
567 d3drm_face2_SetAppData,
568 d3drm_face2_GetAppData,
569 d3drm_face2_SetName,
570 d3drm_face2_GetName,
571 d3drm_face2_GetClassName,
572 d3drm_face2_AddVertex,
573 d3drm_face2_AddVertexAndNormalIndexed,
574 d3drm_face2_SetColorRGB,
575 d3drm_face2_SetColor,
576 d3drm_face2_SetTexture,
577 d3drm_face2_SetTextureCoordinates,
578 d3drm_face2_SetMaterial,
579 d3drm_face2_SetTextureTopology,
580 d3drm_face2_GetVertex,
581 d3drm_face2_GetVertices,
582 d3drm_face2_GetTextureCoordinates,
583 d3drm_face2_GetTextureTopology,
584 d3drm_face2_GetNormal,
585 d3drm_face2_GetTexture,
586 d3drm_face2_GetMaterial,
587 d3drm_face2_GetVertexCount,
588 d3drm_face2_GetVertexIndex,
589 d3drm_face2_GetTextureCoordinateIndex,
590 d3drm_face2_GetColor,
593 HRESULT Direct3DRMFace_create(REFIID riid, IUnknown **out)
595 struct d3drm_face *object;
597 TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
599 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
600 return E_OUTOFMEMORY;
602 object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
603 object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl;
604 object->ref = 1;
606 if (IsEqualGUID(riid, &IID_IDirect3DRMFace2))
607 *out = (IUnknown*)&object->IDirect3DRMFace2_iface;
608 else
609 *out = (IUnknown*)&object->IDirect3DRMFace_iface;
611 return S_OK;