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"
31 #include "d3drm_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
37 IDirect3DRMFace IDirect3DRMFace_iface
;
38 IDirect3DRMFace2 IDirect3DRMFace2_iface
;
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
;
71 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
75 IUnknown_AddRef((IUnknown
*)*out
);
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
);
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
);
97 HeapFree(GetProcessHeap(), 0, face
);
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
);
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
);
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
);
126 static HRESULT WINAPI
d3drm_face1_SetAppData(IDirect3DRMFace
*iface
, DWORD data
)
128 FIXME("iface %p, data %#x stub!\n", iface
, data
);
133 static DWORD WINAPI
d3drm_face1_GetAppData(IDirect3DRMFace
*iface
)
135 FIXME("iface %p stub!\n", iface
);
140 static HRESULT WINAPI
d3drm_face1_SetName(IDirect3DRMFace
*iface
, const char *name
)
142 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
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
);
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
);
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
);
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
);
186 static HRESULT WINAPI
d3drm_face1_SetColor(IDirect3DRMFace
*iface
, D3DCOLOR color
)
188 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
193 static HRESULT WINAPI
d3drm_face1_SetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
*texture
)
195 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
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
);
208 static HRESULT WINAPI
d3drm_face1_SetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
*material
)
210 FIXME("iface %p, material %p stub!\n", iface
, material
);
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
);
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
);
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
);
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
);
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
);
254 static HRESULT WINAPI
d3drm_face1_GetNormal(IDirect3DRMFace
*iface
, D3DVECTOR
*normal
)
256 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
261 static HRESULT WINAPI
d3drm_face1_GetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
**texture
)
263 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
268 static HRESULT WINAPI
d3drm_face1_GetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
**material
)
270 FIXME("iface %p, material %p stub!\n", iface
, material
);
275 static int WINAPI
d3drm_face1_GetVertexCount(IDirect3DRMFace
*iface
)
277 FIXME("iface %p stub!\n", iface
);
282 static int WINAPI
d3drm_face1_GetVertexIndex(IDirect3DRMFace
*iface
, DWORD which
)
284 FIXME("iface %p, which %u stub!\n", iface
, which
);
289 static int WINAPI
d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace
*iface
, DWORD which
)
291 FIXME("iface %p, which %u stub!\n", iface
, which
);
296 static D3DCOLOR WINAPI
d3drm_face1_GetColor(IDirect3DRMFace
*iface
)
298 FIXME("iface %p stub!\n", iface
);
303 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl
=
305 d3drm_face1_QueryInterface
,
309 d3drm_face1_AddDestroyCallback
,
310 d3drm_face1_DeleteDestroyCallback
,
311 d3drm_face1_SetAppData
,
312 d3drm_face1_GetAppData
,
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
);
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
);
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
);
382 static HRESULT WINAPI
d3drm_face2_SetAppData(IDirect3DRMFace2
*iface
, DWORD data
)
384 FIXME("iface %p, data %#x stub!\n", iface
, data
);
389 static DWORD WINAPI
d3drm_face2_GetAppData(IDirect3DRMFace2
*iface
)
391 FIXME("iface %p stub!\n", iface
);
396 static HRESULT WINAPI
d3drm_face2_SetName(IDirect3DRMFace2
*iface
, const char *name
)
398 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
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
);
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
)
417 strcpy(name
, "Face");
418 *size
= sizeof("Face");
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
);
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
);
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
);
445 static HRESULT WINAPI
d3drm_face2_SetColor(IDirect3DRMFace2
*iface
, D3DCOLOR color
)
447 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
452 static HRESULT WINAPI
d3drm_face2_SetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
*texture
)
454 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
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
);
467 static HRESULT WINAPI
d3drm_face2_SetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
*material
)
469 FIXME("iface %p, material %p stub!\n", iface
, material
);
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
);
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
);
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
);
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
);
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
);
513 static HRESULT WINAPI
d3drm_face2_GetNormal(IDirect3DRMFace2
*iface
, D3DVECTOR
*normal
)
515 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
520 static HRESULT WINAPI
d3drm_face2_GetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
**texture
)
522 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
527 static HRESULT WINAPI
d3drm_face2_GetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
**material
)
529 FIXME("iface %p, material %p stub!\n", iface
, material
);
534 static int WINAPI
d3drm_face2_GetVertexCount(IDirect3DRMFace2
*iface
)
536 FIXME("iface %p stub!\n", iface
);
541 static int WINAPI
d3drm_face2_GetVertexIndex(IDirect3DRMFace2
*iface
, DWORD which
)
543 FIXME("iface %p, which %u stub!\n", iface
, which
);
548 static int WINAPI
d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2
*iface
, DWORD which
)
550 FIXME("iface %p, which %u stub!\n", iface
, which
);
555 static D3DCOLOR WINAPI
d3drm_face2_GetColor(IDirect3DRMFace2
*iface
)
557 FIXME("iface %p stub!\n", iface
);
562 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl
=
564 d3drm_face2_QueryInterface
,
568 d3drm_face2_AddDestroyCallback
,
569 d3drm_face2_DeleteDestroyCallback
,
570 d3drm_face2_SetAppData
,
571 d3drm_face2_GetAppData
,
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
;
609 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
610 *out
= (IUnknown
*)&object
->IDirect3DRMFace2_iface
;
612 *out
= (IUnknown
*)&object
->IDirect3DRMFace_iface
;