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 "d3drm_private.h"
28 IDirect3DRMFace IDirect3DRMFace_iface
;
29 IDirect3DRMFace2 IDirect3DRMFace2_iface
;
33 static inline struct d3drm_face
*impl_from_IDirect3DRMFace(IDirect3DRMFace
*iface
)
35 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace_iface
);
38 static inline struct d3drm_face
*impl_from_IDirect3DRMFace2(IDirect3DRMFace2
*iface
)
40 return CONTAINING_RECORD(iface
, struct d3drm_face
, IDirect3DRMFace2_iface
);
43 static HRESULT WINAPI
d3drm_face1_QueryInterface(IDirect3DRMFace
*iface
, REFIID riid
, void **out
)
45 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
47 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
50 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace
)
51 || IsEqualGUID(riid
, &IID_IUnknown
))
53 *out
= &face
->IDirect3DRMFace_iface
;
55 else if(IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
57 *out
= &face
->IDirect3DRMFace2_iface
;
62 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
66 IUnknown_AddRef((IUnknown
*)*out
);
70 static ULONG WINAPI
d3drm_face1_AddRef(IDirect3DRMFace
*iface
)
72 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
73 ULONG refcount
= InterlockedIncrement(&face
->ref
);
75 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
80 static ULONG WINAPI
d3drm_face1_Release(IDirect3DRMFace
*iface
)
82 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
83 ULONG refcount
= InterlockedDecrement(&face
->ref
);
85 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
88 HeapFree(GetProcessHeap(), 0, face
);
93 static HRESULT WINAPI
d3drm_face1_Clone(IDirect3DRMFace
*iface
,
94 IUnknown
*outer
, REFIID iid
, void **out
)
96 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
101 static HRESULT WINAPI
d3drm_face1_AddDestroyCallback(IDirect3DRMFace
*iface
,
102 D3DRMOBJECTCALLBACK cb
, void *ctx
)
104 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
109 static HRESULT WINAPI
d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace
*iface
,
110 D3DRMOBJECTCALLBACK cb
, void *ctx
)
112 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
117 static HRESULT WINAPI
d3drm_face1_SetAppData(IDirect3DRMFace
*iface
, DWORD data
)
119 FIXME("iface %p, data %#x stub!\n", iface
, data
);
124 static DWORD WINAPI
d3drm_face1_GetAppData(IDirect3DRMFace
*iface
)
126 FIXME("iface %p stub!\n", iface
);
131 static HRESULT WINAPI
d3drm_face1_SetName(IDirect3DRMFace
*iface
, const char *name
)
133 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
138 static HRESULT WINAPI
d3drm_face1_GetName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
140 FIXME("iface %p, size %p, name %p stub!\n", iface
, size
, name
);
145 static HRESULT WINAPI
d3drm_face1_GetClassName(IDirect3DRMFace
*iface
, DWORD
*size
, char *name
)
147 struct d3drm_face
*face
= impl_from_IDirect3DRMFace(iface
);
149 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
151 return IDirect3DRMFace2_GetClassName(&face
->IDirect3DRMFace2_iface
, size
, name
);
154 static HRESULT WINAPI
d3drm_face1_AddVertex(IDirect3DRMFace
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
156 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
161 static HRESULT WINAPI
d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace
*iface
,
162 DWORD vertex
, DWORD normal
)
164 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
169 static HRESULT WINAPI
d3drm_face1_SetColorRGB(IDirect3DRMFace
*iface
,
170 D3DVALUE r
, D3DVALUE g
, D3DVALUE b
)
172 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface
, r
, g
, b
);
177 static HRESULT WINAPI
d3drm_face1_SetColor(IDirect3DRMFace
*iface
, D3DCOLOR color
)
179 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
184 static HRESULT WINAPI
d3drm_face1_SetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
*texture
)
186 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
191 static HRESULT WINAPI
d3drm_face1_SetTextureCoordinates(IDirect3DRMFace
*iface
,
192 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
194 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
199 static HRESULT WINAPI
d3drm_face1_SetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
*material
)
201 FIXME("iface %p, material %p stub!\n", iface
, material
);
206 static HRESULT WINAPI
d3drm_face1_SetTextureTopology(IDirect3DRMFace
*iface
, BOOL wrap_u
, BOOL wrap_v
)
208 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
213 static HRESULT WINAPI
d3drm_face1_GetVertex(IDirect3DRMFace
*iface
,
214 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
216 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
221 static HRESULT WINAPI
d3drm_face1_GetVertices(IDirect3DRMFace
*iface
,
222 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
224 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
225 iface
, vertex_count
, coords
, normals
);
230 static HRESULT WINAPI
d3drm_face1_GetTextureCoordinates(IDirect3DRMFace
*iface
,
231 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
233 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
238 static HRESULT WINAPI
d3drm_face1_GetTextureTopology(IDirect3DRMFace
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
240 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
245 static HRESULT WINAPI
d3drm_face1_GetNormal(IDirect3DRMFace
*iface
, D3DVECTOR
*normal
)
247 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
252 static HRESULT WINAPI
d3drm_face1_GetTexture(IDirect3DRMFace
*iface
, IDirect3DRMTexture
**texture
)
254 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
259 static HRESULT WINAPI
d3drm_face1_GetMaterial(IDirect3DRMFace
*iface
, IDirect3DRMMaterial
**material
)
261 FIXME("iface %p, material %p stub!\n", iface
, material
);
266 static int WINAPI
d3drm_face1_GetVertexCount(IDirect3DRMFace
*iface
)
268 FIXME("iface %p stub!\n", iface
);
273 static int WINAPI
d3drm_face1_GetVertexIndex(IDirect3DRMFace
*iface
, DWORD which
)
275 FIXME("iface %p, which %u stub!\n", iface
, which
);
280 static int WINAPI
d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace
*iface
, DWORD which
)
282 FIXME("iface %p, which %u stub!\n", iface
, which
);
287 static D3DCOLOR WINAPI
d3drm_face1_GetColor(IDirect3DRMFace
*iface
)
289 FIXME("iface %p stub!\n", iface
);
294 static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl
=
296 d3drm_face1_QueryInterface
,
300 d3drm_face1_AddDestroyCallback
,
301 d3drm_face1_DeleteDestroyCallback
,
302 d3drm_face1_SetAppData
,
303 d3drm_face1_GetAppData
,
306 d3drm_face1_GetClassName
,
307 d3drm_face1_AddVertex
,
308 d3drm_face1_AddVertexAndNormalIndexed
,
309 d3drm_face1_SetColorRGB
,
310 d3drm_face1_SetColor
,
311 d3drm_face1_SetTexture
,
312 d3drm_face1_SetTextureCoordinates
,
313 d3drm_face1_SetMaterial
,
314 d3drm_face1_SetTextureTopology
,
315 d3drm_face1_GetVertex
,
316 d3drm_face1_GetVertices
,
317 d3drm_face1_GetTextureCoordinates
,
318 d3drm_face1_GetTextureTopology
,
319 d3drm_face1_GetNormal
,
320 d3drm_face1_GetTexture
,
321 d3drm_face1_GetMaterial
,
322 d3drm_face1_GetVertexCount
,
323 d3drm_face1_GetVertexIndex
,
324 d3drm_face1_GetTextureCoordinateIndex
,
325 d3drm_face1_GetColor
,
328 static HRESULT WINAPI
d3drm_face2_QueryInterface(IDirect3DRMFace2
*iface
, REFIID riid
, void **out
)
330 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
332 return d3drm_face1_QueryInterface(&face
->IDirect3DRMFace_iface
, riid
, out
);
335 static ULONG WINAPI
d3drm_face2_AddRef(IDirect3DRMFace2
*iface
)
337 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
339 return d3drm_face1_AddRef(&face
->IDirect3DRMFace_iface
);
342 static ULONG WINAPI
d3drm_face2_Release(IDirect3DRMFace2
*iface
)
344 struct d3drm_face
*face
= impl_from_IDirect3DRMFace2(iface
);
346 return d3drm_face1_Release(&face
->IDirect3DRMFace_iface
);
349 static HRESULT WINAPI
d3drm_face2_Clone(IDirect3DRMFace2
*iface
,
350 IUnknown
*outer
, REFIID iid
, void **out
)
352 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
357 static HRESULT WINAPI
d3drm_face2_AddDestroyCallback(IDirect3DRMFace2
*iface
,
358 D3DRMOBJECTCALLBACK cb
, void *ctx
)
360 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
365 static HRESULT WINAPI
d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2
*iface
,
366 D3DRMOBJECTCALLBACK cb
, void *ctx
)
368 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
373 static HRESULT WINAPI
d3drm_face2_SetAppData(IDirect3DRMFace2
*iface
, DWORD data
)
375 FIXME("iface %p, data %#x stub!\n", iface
, data
);
380 static DWORD WINAPI
d3drm_face2_GetAppData(IDirect3DRMFace2
*iface
)
382 FIXME("iface %p stub!\n", iface
);
387 static HRESULT WINAPI
d3drm_face2_SetName(IDirect3DRMFace2
*iface
, const char *name
)
389 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
394 static HRESULT WINAPI
d3drm_face2_GetName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
396 FIXME("iface %p, size %p, name %p stub!\n", iface
, size
, name
);
401 static HRESULT WINAPI
d3drm_face2_GetClassName(IDirect3DRMFace2
*iface
, DWORD
*size
, char *name
)
403 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
405 if (!size
|| *size
< strlen("Face") || !name
)
408 strcpy(name
, "Face");
409 *size
= sizeof("Face");
414 static HRESULT WINAPI
d3drm_face2_AddVertex(IDirect3DRMFace2
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
)
416 FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface
, x
, y
, z
);
421 static HRESULT WINAPI
d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2
*iface
,
422 DWORD vertex
, DWORD normal
)
424 FIXME("iface %p, vertex %u, normal %u stub!\n", iface
, vertex
, normal
);
429 static HRESULT WINAPI
d3drm_face2_SetColorRGB(IDirect3DRMFace2
*iface
, D3DVALUE r
, D3DVALUE g
, D3DVALUE b
)
431 FIXME("iface %p, r %.8e, g %.8e, b %.8e stub!\n", iface
, r
, g
, b
);
436 static HRESULT WINAPI
d3drm_face2_SetColor(IDirect3DRMFace2
*iface
, D3DCOLOR color
)
438 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
443 static HRESULT WINAPI
d3drm_face2_SetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
*texture
)
445 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
450 static HRESULT WINAPI
d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2
*iface
,
451 DWORD vertex
, D3DVALUE u
, D3DVALUE v
)
453 FIXME("iface %p, vertex %u, u %.8e, v %.8e stub!\n", iface
, vertex
, u
, v
);
458 static HRESULT WINAPI
d3drm_face2_SetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
*material
)
460 FIXME("iface %p, material %p stub!\n", iface
, material
);
465 static HRESULT WINAPI
d3drm_face2_SetTextureTopology(IDirect3DRMFace2
*iface
, BOOL wrap_u
, BOOL wrap_v
)
467 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface
, wrap_u
, wrap_v
);
472 static HRESULT WINAPI
d3drm_face2_GetVertex(IDirect3DRMFace2
*iface
,
473 DWORD index
, D3DVECTOR
*vertex
, D3DVECTOR
*normal
)
475 FIXME("iface %p, index %u, vertex %p, normal %p stub!\n", iface
, index
, vertex
, normal
);
480 static HRESULT WINAPI
d3drm_face2_GetVertices(IDirect3DRMFace2
*iface
,
481 DWORD
*vertex_count
, D3DVECTOR
*coords
, D3DVECTOR
*normals
)
483 FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
484 iface
, vertex_count
, coords
, normals
);
489 static HRESULT WINAPI
d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2
*iface
,
490 DWORD vertex
, D3DVALUE
*u
, D3DVALUE
*v
)
492 FIXME("iface %p, vertex %u, u %p, v %p stub!\n", iface
, vertex
, u
, v
);
497 static HRESULT WINAPI
d3drm_face2_GetTextureTopology(IDirect3DRMFace2
*iface
, BOOL
*wrap_u
, BOOL
*wrap_v
)
499 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface
, wrap_u
, wrap_v
);
504 static HRESULT WINAPI
d3drm_face2_GetNormal(IDirect3DRMFace2
*iface
, D3DVECTOR
*normal
)
506 FIXME("iface %p, normal %p stub!\n", iface
, normal
);
511 static HRESULT WINAPI
d3drm_face2_GetTexture(IDirect3DRMFace2
*iface
, IDirect3DRMTexture3
**texture
)
513 FIXME("iface %p, texture %p stub!\n", iface
, texture
);
518 static HRESULT WINAPI
d3drm_face2_GetMaterial(IDirect3DRMFace2
*iface
, IDirect3DRMMaterial2
**material
)
520 FIXME("iface %p, material %p stub!\n", iface
, material
);
525 static int WINAPI
d3drm_face2_GetVertexCount(IDirect3DRMFace2
*iface
)
527 FIXME("iface %p stub!\n", iface
);
532 static int WINAPI
d3drm_face2_GetVertexIndex(IDirect3DRMFace2
*iface
, DWORD which
)
534 FIXME("iface %p, which %u stub!\n", iface
, which
);
539 static int WINAPI
d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2
*iface
, DWORD which
)
541 FIXME("iface %p, which %u stub!\n", iface
, which
);
546 static D3DCOLOR WINAPI
d3drm_face2_GetColor(IDirect3DRMFace2
*iface
)
548 FIXME("iface %p stub!\n", iface
);
553 static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl
=
555 d3drm_face2_QueryInterface
,
559 d3drm_face2_AddDestroyCallback
,
560 d3drm_face2_DeleteDestroyCallback
,
561 d3drm_face2_SetAppData
,
562 d3drm_face2_GetAppData
,
565 d3drm_face2_GetClassName
,
566 d3drm_face2_AddVertex
,
567 d3drm_face2_AddVertexAndNormalIndexed
,
568 d3drm_face2_SetColorRGB
,
569 d3drm_face2_SetColor
,
570 d3drm_face2_SetTexture
,
571 d3drm_face2_SetTextureCoordinates
,
572 d3drm_face2_SetMaterial
,
573 d3drm_face2_SetTextureTopology
,
574 d3drm_face2_GetVertex
,
575 d3drm_face2_GetVertices
,
576 d3drm_face2_GetTextureCoordinates
,
577 d3drm_face2_GetTextureTopology
,
578 d3drm_face2_GetNormal
,
579 d3drm_face2_GetTexture
,
580 d3drm_face2_GetMaterial
,
581 d3drm_face2_GetVertexCount
,
582 d3drm_face2_GetVertexIndex
,
583 d3drm_face2_GetTextureCoordinateIndex
,
584 d3drm_face2_GetColor
,
587 HRESULT
Direct3DRMFace_create(REFIID riid
, IUnknown
**out
)
589 struct d3drm_face
*object
;
591 TRACE("riid %s, out %p.\n", debugstr_guid(riid
), out
);
593 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
594 return E_OUTOFMEMORY
;
596 object
->IDirect3DRMFace_iface
.lpVtbl
= &d3drm_face1_vtbl
;
597 object
->IDirect3DRMFace2_iface
.lpVtbl
= &d3drm_face2_vtbl
;
600 if (IsEqualGUID(riid
, &IID_IDirect3DRMFace2
))
601 *out
= (IUnknown
*)&object
->IDirect3DRMFace2_iface
;
603 *out
= (IUnknown
*)&object
->IDirect3DRMFace_iface
;