2 * Implementation of IDirect3DRM Interface
4 * Copyright 2010, 2012 Christian Costa
5 * Copyright 2011 André Hentschel
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
31 #include "d3drm_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
35 static const char* get_IID_string(const GUID
* guid
)
37 if (IsEqualGUID(guid
, &IID_IDirect3DRMFrame
))
38 return "IID_IDirect3DRMFrame";
39 else if (IsEqualGUID(guid
, &IID_IDirect3DRMFrame2
))
40 return "IID_IDirect3DRMFrame2";
41 else if (IsEqualGUID(guid
, &IID_IDirect3DRMFrame3
))
42 return "IID_IDirect3DRMFrame3";
43 else if (IsEqualGUID(guid
, &IID_IDirect3DRMMeshBuilder
))
44 return "IID_IDirect3DRMMeshBuilder";
45 else if (IsEqualGUID(guid
, &IID_IDirect3DRMMeshBuilder2
))
46 return "IID_IDirect3DRMMeshBuilder2";
47 else if (IsEqualGUID(guid
, &IID_IDirect3DRMMeshBuilder3
))
48 return "IID_IDirect3DRMMeshBuilder3";
55 IDirect3DRM IDirect3DRM_iface
;
56 IDirect3DRM2 IDirect3DRM2_iface
;
57 IDirect3DRM3 IDirect3DRM3_iface
;
58 LONG ref1
, ref2
, ref3
, iface_count
;
61 static inline struct d3drm
*impl_from_IDirect3DRM(IDirect3DRM
*iface
)
63 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM_iface
);
66 static inline struct d3drm
*impl_from_IDirect3DRM2(IDirect3DRM2
*iface
)
68 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM2_iface
);
71 static inline struct d3drm
*impl_from_IDirect3DRM3(IDirect3DRM3
*iface
)
73 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM3_iface
);
76 static void d3drm_destroy(struct d3drm
*d3drm
)
78 HeapFree(GetProcessHeap(), 0, d3drm
);
79 TRACE("d3drm object %p is being destroyed.\n", d3drm
);
82 static HRESULT WINAPI
d3drm1_QueryInterface(IDirect3DRM
*iface
, REFIID riid
, void **out
)
84 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
86 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
88 if (IsEqualGUID(riid
, &IID_IDirect3DRM
)
89 || IsEqualGUID(riid
, &IID_IUnknown
))
91 *out
= &d3drm
->IDirect3DRM_iface
;
93 else if (IsEqualGUID(riid
, &IID_IDirect3DRM2
))
95 *out
= &d3drm
->IDirect3DRM2_iface
;
97 else if (IsEqualGUID(riid
, &IID_IDirect3DRM3
))
99 *out
= &d3drm
->IDirect3DRM3_iface
;
104 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid
));
105 return CLASS_E_CLASSNOTAVAILABLE
;
108 IUnknown_AddRef((IUnknown
*)*out
);
112 static ULONG WINAPI
d3drm1_AddRef(IDirect3DRM
*iface
)
114 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
115 ULONG refcount
= InterlockedIncrement(&d3drm
->ref1
);
117 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
120 InterlockedIncrement(&d3drm
->iface_count
);
125 static ULONG WINAPI
d3drm1_Release(IDirect3DRM
*iface
)
127 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
128 ULONG refcount
= InterlockedDecrement(&d3drm
->ref1
);
130 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
132 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
133 d3drm_destroy(d3drm
);
138 static HRESULT WINAPI
d3drm1_CreateObject(IDirect3DRM
*iface
,
139 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
141 FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
142 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
147 static HRESULT WINAPI
d3drm1_CreateFrame(IDirect3DRM
*iface
,
148 IDirect3DRMFrame
*parent_frame
, IDirect3DRMFrame
**frame
)
150 TRACE("iface %p, parent_frame %p, frame %p.\n", iface
, parent_frame
, frame
);
152 return Direct3DRMFrame_create(&IID_IDirect3DRMFrame
, (IUnknown
*)parent_frame
, (IUnknown
**)frame
);
155 static HRESULT WINAPI
d3drm1_CreateMesh(IDirect3DRM
*iface
, IDirect3DRMMesh
**mesh
)
157 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
159 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
161 return IDirect3DRM3_CreateMesh(&d3drm
->IDirect3DRM3_iface
, mesh
);
164 static HRESULT WINAPI
d3drm1_CreateMeshBuilder(IDirect3DRM
*iface
, IDirect3DRMMeshBuilder
**mesh_builder
)
166 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
168 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder
, (IUnknown
**)mesh_builder
);
171 static HRESULT WINAPI
d3drm1_CreateFace(IDirect3DRM
*iface
, IDirect3DRMFace
**face
)
173 TRACE("iface %p, face %p.\n", iface
, face
);
175 return Direct3DRMFace_create(&IID_IDirect3DRMFace
, (IUnknown
**)face
);
178 static HRESULT WINAPI
d3drm1_CreateAnimation(IDirect3DRM
*iface
, IDirect3DRMAnimation
**animation
)
180 FIXME("iface %p, animation %p stub!\n", iface
, animation
);
185 static HRESULT WINAPI
d3drm1_CreateAnimationSet(IDirect3DRM
*iface
, IDirect3DRMAnimationSet
**set
)
187 FIXME("iface %p, set %p stub!\n", iface
, set
);
192 static HRESULT WINAPI
d3drm1_CreateTexture(IDirect3DRM
*iface
,
193 D3DRMIMAGE
*image
, IDirect3DRMTexture
**texture
)
195 FIXME("iface %p, image %p, texture %p partial stub.\n", iface
, image
, texture
);
197 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture
, (IUnknown
**)texture
);
200 static HRESULT WINAPI
d3drm1_CreateLight(IDirect3DRM
*iface
,
201 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
203 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
205 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface
, type
, color
, light
);
207 return IDirect3DRM3_CreateLight(&d3drm
->IDirect3DRM3_iface
, type
, color
, light
);
210 static HRESULT WINAPI
d3drm1_CreateLightRGB(IDirect3DRM
*iface
, D3DRMLIGHTTYPE type
,
211 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
213 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
215 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
216 iface
, type
, red
, green
, blue
, light
);
218 return IDirect3DRM3_CreateLightRGB(&d3drm
->IDirect3DRM3_iface
, type
, red
, green
, blue
, light
);
221 static HRESULT WINAPI
d3drm1_CreateMaterial(IDirect3DRM
*iface
,
222 D3DVALUE power
, IDirect3DRMMaterial
**material
)
224 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
226 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
228 return IDirect3DRM3_CreateMaterial(&d3drm
->IDirect3DRM3_iface
, power
, (IDirect3DRMMaterial2
**)material
);
231 static HRESULT WINAPI
d3drm1_CreateDevice(IDirect3DRM
*iface
,
232 DWORD width
, DWORD height
, IDirect3DRMDevice
**device
)
234 struct d3drm_device
*object
;
236 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
238 hr
= d3drm_device_create(&object
);
242 *device
= IDirect3DRMDevice_from_impl(object
);
247 static HRESULT WINAPI
d3drm1_CreateDeviceFromSurface(IDirect3DRM
*iface
, GUID
*guid
,
248 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, IDirect3DRMDevice
**device
)
250 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
251 struct d3drm_device
*object
;
254 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
255 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, device
);
258 return D3DRMERR_BADVALUE
;
261 if (!backbuffer
|| !ddraw
)
262 return D3DRMERR_BADDEVICE
;
264 hr
= d3drm_device_create(&object
);
268 hr
= d3drm_device_init(object
, 1, &d3drm
->IDirect3DRM_iface
, ddraw
, backbuffer
, TRUE
);
270 *device
= IDirect3DRMDevice_from_impl(object
);
272 d3drm_device_destroy(object
);
277 static HRESULT WINAPI
d3drm1_CreateDeviceFromD3D(IDirect3DRM
*iface
,
278 IDirect3D
*d3d
, IDirect3DDevice
*d3d_device
, IDirect3DRMDevice
**device
)
280 struct d3drm_device
*object
;
282 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
283 iface
, d3d
, d3d_device
, device
);
286 return D3DRMERR_BADVALUE
;
288 if (!d3d
|| !d3d_device
)
289 return D3DRMERR_BADVALUE
;
291 hr
= d3drm_device_create(&object
);
295 hr
= d3drm_device_set_ddraw_device_d3d(object
, iface
, d3d
, d3d_device
);
298 d3drm_device_destroy(object
);
301 *device
= IDirect3DRMDevice_from_impl(object
);
306 static HRESULT WINAPI
d3drm1_CreateDeviceFromClipper(IDirect3DRM
*iface
,
307 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
308 IDirect3DRMDevice
**device
)
310 struct d3drm_device
*object
;
312 IDirectDrawSurface
*render_target
;
315 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
316 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
319 return D3DRMERR_BADVALUE
;
322 if (!clipper
|| !width
|| !height
)
323 return D3DRMERR_BADVALUE
;
325 hr
= DirectDrawCreate(NULL
, &ddraw
, NULL
);
329 hr
= d3drm_device_create(&object
);
332 IDirectDraw_Release(ddraw
);
336 hr
= d3drm_device_create_surfaces_from_clipper(object
, ddraw
, clipper
, width
, height
, &render_target
);
339 IDirectDraw_Release(ddraw
);
340 d3drm_device_destroy(object
);
344 hr
= d3drm_device_init(object
, 1, iface
, ddraw
, render_target
, TRUE
);
345 IDirectDraw_Release(ddraw
);
346 IDirectDrawSurface_Release(render_target
);
348 d3drm_device_destroy(object
);
350 *device
= IDirect3DRMDevice_from_impl(object
);
355 static HRESULT WINAPI
d3drm1_CreateTextureFromSurface(IDirect3DRM
*iface
,
356 IDirectDrawSurface
*surface
, IDirect3DRMTexture
**texture
)
358 FIXME("iface %p, surface %p, texture %p stub!\n", iface
, surface
, texture
);
363 static HRESULT WINAPI
d3drm1_CreateShadow(IDirect3DRM
*iface
, IDirect3DRMVisual
*visual
,
364 IDirect3DRMLight
*light
, D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
,
365 IDirect3DRMVisual
**shadow
)
367 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
368 iface
, visual
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
373 static HRESULT WINAPI
d3drm1_CreateViewport(IDirect3DRM
*iface
, IDirect3DRMDevice
*device
,
374 IDirect3DRMFrame
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport
**viewport
)
376 FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
377 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
379 return Direct3DRMViewport_create(&IID_IDirect3DRMViewport
, (IUnknown
**)viewport
);
382 static HRESULT WINAPI
d3drm1_CreateWrap(IDirect3DRM
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame
*frame
,
383 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
384 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
385 IDirect3DRMWrap
**wrap
)
387 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
388 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
389 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
394 static HRESULT WINAPI
d3drm1_CreateUserVisual(IDirect3DRM
*iface
,
395 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
397 FIXME("iface %p, cb %p, ctx %p visual %p stub!\n", iface
, cb
, ctx
, visual
);
402 static HRESULT WINAPI
d3drm1_LoadTexture(IDirect3DRM
*iface
,
403 const char *filename
, IDirect3DRMTexture
**texture
)
405 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
407 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture
, (IUnknown
**)texture
);
410 static HRESULT WINAPI
d3drm1_LoadTextureFromResource(IDirect3DRM
*iface
,
411 HRSRC resource
, IDirect3DRMTexture
**texture
)
413 FIXME("iface %p, resource %p, texture %p stub!\n", iface
, resource
, texture
);
415 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture
, (IUnknown
**)texture
);
418 static HRESULT WINAPI
d3drm1_SetSearchPath(IDirect3DRM
*iface
, const char *path
)
420 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
425 static HRESULT WINAPI
d3drm1_AddSearchPath(IDirect3DRM
*iface
, const char *path
)
427 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
432 static HRESULT WINAPI
d3drm1_GetSearchPath(IDirect3DRM
*iface
, DWORD
*size
, char *path
)
434 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
439 static HRESULT WINAPI
d3drm1_SetDefaultTextureColors(IDirect3DRM
*iface
, DWORD color_count
)
441 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
446 static HRESULT WINAPI
d3drm1_SetDefaultTextureShades(IDirect3DRM
*iface
, DWORD shade_count
)
448 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
453 static HRESULT WINAPI
d3drm1_GetDevices(IDirect3DRM
*iface
, IDirect3DRMDeviceArray
**array
)
455 FIXME("iface %p, array %p stub!\n", iface
, array
);
460 static HRESULT WINAPI
d3drm1_GetNamedObject(IDirect3DRM
*iface
,
461 const char *name
, IDirect3DRMObject
**object
)
463 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
468 static HRESULT WINAPI
d3drm1_EnumerateObjects(IDirect3DRM
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
470 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
475 static HRESULT WINAPI
d3drm1_Load(IDirect3DRM
*iface
, void *source
, void *object_id
, IID
**iids
,
476 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
477 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame
*parent_frame
)
479 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
480 IDirect3DRMFrame3
*parent_frame3
= NULL
;
481 HRESULT hr
= D3DRM_OK
;
483 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
484 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
485 iface
, source
, object_id
, iids
, iid_count
, flags
,
486 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
489 hr
= IDirect3DRMFrame_QueryInterface(parent_frame
, &IID_IDirect3DRMFrame3
, (void **)&parent_frame3
);
491 hr
= IDirect3DRM3_Load(&d3drm
->IDirect3DRM3_iface
, source
, object_id
, iids
, iid_count
,
492 flags
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame3
);
494 IDirect3DRMFrame3_Release(parent_frame3
);
499 static HRESULT WINAPI
d3drm1_Tick(IDirect3DRM
*iface
, D3DVALUE tick
)
501 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
506 static const struct IDirect3DRMVtbl d3drm1_vtbl
=
508 d3drm1_QueryInterface
,
514 d3drm1_CreateMeshBuilder
,
516 d3drm1_CreateAnimation
,
517 d3drm1_CreateAnimationSet
,
518 d3drm1_CreateTexture
,
520 d3drm1_CreateLightRGB
,
521 d3drm1_CreateMaterial
,
523 d3drm1_CreateDeviceFromSurface
,
524 d3drm1_CreateDeviceFromD3D
,
525 d3drm1_CreateDeviceFromClipper
,
526 d3drm1_CreateTextureFromSurface
,
528 d3drm1_CreateViewport
,
530 d3drm1_CreateUserVisual
,
532 d3drm1_LoadTextureFromResource
,
533 d3drm1_SetSearchPath
,
534 d3drm1_AddSearchPath
,
535 d3drm1_GetSearchPath
,
536 d3drm1_SetDefaultTextureColors
,
537 d3drm1_SetDefaultTextureShades
,
539 d3drm1_GetNamedObject
,
540 d3drm1_EnumerateObjects
,
545 static HRESULT WINAPI
d3drm2_QueryInterface(IDirect3DRM2
*iface
, REFIID riid
, void **out
)
547 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
549 return d3drm1_QueryInterface(&d3drm
->IDirect3DRM_iface
, riid
, out
);
552 static ULONG WINAPI
d3drm2_AddRef(IDirect3DRM2
*iface
)
554 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
555 ULONG refcount
= InterlockedIncrement(&d3drm
->ref2
);
557 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
560 InterlockedIncrement(&d3drm
->iface_count
);
565 static ULONG WINAPI
d3drm2_Release(IDirect3DRM2
*iface
)
567 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
568 ULONG refcount
= InterlockedDecrement(&d3drm
->ref2
);
570 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
572 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
573 d3drm_destroy(d3drm
);
578 static HRESULT WINAPI
d3drm2_CreateObject(IDirect3DRM2
*iface
,
579 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
581 FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
582 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
587 static HRESULT WINAPI
d3drm2_CreateFrame(IDirect3DRM2
*iface
,
588 IDirect3DRMFrame
*parent_frame
, IDirect3DRMFrame2
**frame
)
590 TRACE("iface %p, parent_frame %p, frame %p.\n", iface
, parent_frame
, frame
);
592 return Direct3DRMFrame_create(&IID_IDirect3DRMFrame2
, (IUnknown
*)parent_frame
, (IUnknown
**)frame
);
595 static HRESULT WINAPI
d3drm2_CreateMesh(IDirect3DRM2
*iface
, IDirect3DRMMesh
**mesh
)
597 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
599 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
601 return IDirect3DRM3_CreateMesh(&d3drm
->IDirect3DRM3_iface
, mesh
);
604 static HRESULT WINAPI
d3drm2_CreateMeshBuilder(IDirect3DRM2
*iface
, IDirect3DRMMeshBuilder2
**mesh_builder
)
606 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
608 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder2
, (IUnknown
**)mesh_builder
);
611 static HRESULT WINAPI
d3drm2_CreateFace(IDirect3DRM2
*iface
, IDirect3DRMFace
**face
)
613 TRACE("iface %p, face %p.\n", iface
, face
);
615 return Direct3DRMFace_create(&IID_IDirect3DRMFace
, (IUnknown
**)face
);
618 static HRESULT WINAPI
d3drm2_CreateAnimation(IDirect3DRM2
*iface
, IDirect3DRMAnimation
**animation
)
620 FIXME("iface %p, animation %p stub!\n", iface
, animation
);
625 static HRESULT WINAPI
d3drm2_CreateAnimationSet(IDirect3DRM2
*iface
, IDirect3DRMAnimationSet
**set
)
627 FIXME("iface %p, set %p stub!\n", iface
, set
);
632 static HRESULT WINAPI
d3drm2_CreateTexture(IDirect3DRM2
*iface
,
633 D3DRMIMAGE
*image
, IDirect3DRMTexture2
**texture
)
635 FIXME("iface %p, image %p, texture %p partial stub.\n", iface
, image
, texture
);
637 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2
, (IUnknown
**)texture
);
640 static HRESULT WINAPI
d3drm2_CreateLight(IDirect3DRM2
*iface
,
641 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
643 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
645 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface
, type
, color
, light
);
647 return IDirect3DRM3_CreateLight(&d3drm
->IDirect3DRM3_iface
, type
, color
, light
);
650 static HRESULT WINAPI
d3drm2_CreateLightRGB(IDirect3DRM2
*iface
, D3DRMLIGHTTYPE type
,
651 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
653 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
655 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
656 iface
, type
, red
, green
, blue
, light
);
658 return IDirect3DRM3_CreateLightRGB(&d3drm
->IDirect3DRM3_iface
, type
, red
, green
, blue
, light
);
661 static HRESULT WINAPI
d3drm2_CreateMaterial(IDirect3DRM2
*iface
,
662 D3DVALUE power
, IDirect3DRMMaterial
**material
)
664 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
666 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
668 return IDirect3DRM3_CreateMaterial(&d3drm
->IDirect3DRM3_iface
, power
, (IDirect3DRMMaterial2
**)material
);
671 static HRESULT WINAPI
d3drm2_CreateDevice(IDirect3DRM2
*iface
,
672 DWORD width
, DWORD height
, IDirect3DRMDevice2
**device
)
674 struct d3drm_device
*object
;
676 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
678 hr
= d3drm_device_create(&object
);
682 *device
= IDirect3DRMDevice2_from_impl(object
);
687 static HRESULT WINAPI
d3drm2_CreateDeviceFromSurface(IDirect3DRM2
*iface
, GUID
*guid
,
688 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, IDirect3DRMDevice2
**device
)
690 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
691 IDirect3DRMDevice3
*device3
;
693 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
694 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, device
);
697 return D3DRMERR_BADVALUE
;
699 hr
= IDirect3DRM3_CreateDeviceFromSurface(&d3drm
->IDirect3DRM3_iface
, guid
, ddraw
, backbuffer
, 0, &device3
);
703 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void**)device
);
704 IDirect3DRMDevice3_Release(device3
);
709 static HRESULT WINAPI
d3drm2_CreateDeviceFromD3D(IDirect3DRM2
*iface
,
710 IDirect3D2
*d3d
, IDirect3DDevice2
*d3d_device
, IDirect3DRMDevice2
**device
)
712 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
714 IDirect3DDevice
*d3d_device1
;
715 IDirect3DRMDevice
*device1
;
717 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
718 iface
, d3d
, d3d_device
, device
);
721 return D3DRMERR_BADVALUE
;
723 if (!d3d
|| !d3d_device
)
724 return D3DRMERR_BADVALUE
;
726 hr
= IDirect3D2_QueryInterface(d3d
, &IID_IDirect3D
, (void **)&d3d1
);
730 hr
= IDirect3DDevice2_QueryInterface(d3d_device
, &IID_IDirect3DDevice
, (void **)&d3d_device1
);
733 IDirect3D_Release(d3d1
);
737 hr
= IDirect3DRM_CreateDeviceFromD3D(&d3drm
->IDirect3DRM_iface
, d3d1
, d3d_device1
, &device1
);
738 IDirect3D_Release(d3d1
);
739 IDirect3DDevice_Release(d3d_device1
);
743 hr
= IDirect3DRMDevice_QueryInterface(device1
, &IID_IDirect3DRMDevice2
, (void **)device
);
744 IDirect3DRMDevice_Release(device1
);
749 static HRESULT WINAPI
d3drm2_CreateDeviceFromClipper(IDirect3DRM2
*iface
,
750 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
751 IDirect3DRMDevice2
**device
)
753 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
754 IDirect3DRMDevice3
*device3
;
757 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
758 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
761 return D3DRMERR_BADVALUE
;
763 hr
= IDirect3DRM3_CreateDeviceFromClipper(&d3drm
->IDirect3DRM3_iface
, clipper
, guid
, width
, height
, &device3
);
767 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void**)device
);
768 IDirect3DRMDevice3_Release(device3
);
773 static HRESULT WINAPI
d3drm2_CreateTextureFromSurface(IDirect3DRM2
*iface
,
774 IDirectDrawSurface
*surface
, IDirect3DRMTexture2
**texture
)
776 FIXME("iface %p, surface %p, texture %p stub!\n", iface
, surface
, texture
);
781 static HRESULT WINAPI
d3drm2_CreateShadow(IDirect3DRM2
*iface
, IDirect3DRMVisual
*visual
,
782 IDirect3DRMLight
*light
, D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
,
783 IDirect3DRMVisual
**shadow
)
785 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
786 iface
, visual
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
791 static HRESULT WINAPI
d3drm2_CreateViewport(IDirect3DRM2
*iface
, IDirect3DRMDevice
*device
,
792 IDirect3DRMFrame
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport
**viewport
)
794 FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
795 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
797 return Direct3DRMViewport_create(&IID_IDirect3DRMViewport
, (IUnknown
**)viewport
);
800 static HRESULT WINAPI
d3drm2_CreateWrap(IDirect3DRM2
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame
*frame
,
801 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
802 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
803 IDirect3DRMWrap
**wrap
)
805 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
806 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
807 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
812 static HRESULT WINAPI
d3drm2_CreateUserVisual(IDirect3DRM2
*iface
,
813 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
815 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface
, cb
, ctx
, visual
);
820 static HRESULT WINAPI
d3drm2_LoadTexture(IDirect3DRM2
*iface
,
821 const char *filename
, IDirect3DRMTexture2
**texture
)
823 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
825 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2
, (IUnknown
**)texture
);
828 static HRESULT WINAPI
d3drm2_LoadTextureFromResource(IDirect3DRM2
*iface
, HMODULE module
,
829 const char *resource_name
, const char *resource_type
, IDirect3DRMTexture2
**texture
)
831 FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n",
832 iface
, debugstr_a(resource_name
), debugstr_a(resource_type
), texture
);
834 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2
, (IUnknown
**)texture
);
837 static HRESULT WINAPI
d3drm2_SetSearchPath(IDirect3DRM2
*iface
, const char *path
)
839 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
844 static HRESULT WINAPI
d3drm2_AddSearchPath(IDirect3DRM2
*iface
, const char *path
)
846 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
851 static HRESULT WINAPI
d3drm2_GetSearchPath(IDirect3DRM2
*iface
, DWORD
*size
, char *path
)
853 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
858 static HRESULT WINAPI
d3drm2_SetDefaultTextureColors(IDirect3DRM2
*iface
, DWORD color_count
)
860 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
865 static HRESULT WINAPI
d3drm2_SetDefaultTextureShades(IDirect3DRM2
*iface
, DWORD shade_count
)
867 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
872 static HRESULT WINAPI
d3drm2_GetDevices(IDirect3DRM2
*iface
, IDirect3DRMDeviceArray
**array
)
874 FIXME("iface %p, array %p stub!\n", iface
, array
);
879 static HRESULT WINAPI
d3drm2_GetNamedObject(IDirect3DRM2
*iface
,
880 const char *name
, IDirect3DRMObject
**object
)
882 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
887 static HRESULT WINAPI
d3drm2_EnumerateObjects(IDirect3DRM2
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
889 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
894 static HRESULT WINAPI
d3drm2_Load(IDirect3DRM2
*iface
, void *source
, void *object_id
, IID
**iids
,
895 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
896 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame
*parent_frame
)
898 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
899 IDirect3DRMFrame3
*parent_frame3
= NULL
;
900 HRESULT hr
= D3DRM_OK
;
902 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
903 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
904 iface
, source
, object_id
, iids
, iid_count
, flags
,
905 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
908 hr
= IDirect3DRMFrame_QueryInterface(parent_frame
, &IID_IDirect3DRMFrame3
, (void **)&parent_frame3
);
910 hr
= IDirect3DRM3_Load(&d3drm
->IDirect3DRM3_iface
, source
, object_id
, iids
, iid_count
,
911 flags
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame3
);
913 IDirect3DRMFrame3_Release(parent_frame3
);
918 static HRESULT WINAPI
d3drm2_Tick(IDirect3DRM2
*iface
, D3DVALUE tick
)
920 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
925 static HRESULT WINAPI
d3drm2_CreateProgressiveMesh(IDirect3DRM2
*iface
, IDirect3DRMProgressiveMesh
**mesh
)
927 FIXME("iface %p, mesh %p stub!\n", iface
, mesh
);
932 static const struct IDirect3DRM2Vtbl d3drm2_vtbl
=
934 d3drm2_QueryInterface
,
940 d3drm2_CreateMeshBuilder
,
942 d3drm2_CreateAnimation
,
943 d3drm2_CreateAnimationSet
,
944 d3drm2_CreateTexture
,
946 d3drm2_CreateLightRGB
,
947 d3drm2_CreateMaterial
,
949 d3drm2_CreateDeviceFromSurface
,
950 d3drm2_CreateDeviceFromD3D
,
951 d3drm2_CreateDeviceFromClipper
,
952 d3drm2_CreateTextureFromSurface
,
954 d3drm2_CreateViewport
,
956 d3drm2_CreateUserVisual
,
958 d3drm2_LoadTextureFromResource
,
959 d3drm2_SetSearchPath
,
960 d3drm2_AddSearchPath
,
961 d3drm2_GetSearchPath
,
962 d3drm2_SetDefaultTextureColors
,
963 d3drm2_SetDefaultTextureShades
,
965 d3drm2_GetNamedObject
,
966 d3drm2_EnumerateObjects
,
969 d3drm2_CreateProgressiveMesh
,
972 static HRESULT WINAPI
d3drm3_QueryInterface(IDirect3DRM3
*iface
, REFIID riid
, void **out
)
974 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
976 return d3drm1_QueryInterface(&d3drm
->IDirect3DRM_iface
, riid
, out
);
979 static ULONG WINAPI
d3drm3_AddRef(IDirect3DRM3
*iface
)
981 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
982 ULONG refcount
= InterlockedIncrement(&d3drm
->ref3
);
984 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
987 InterlockedIncrement(&d3drm
->iface_count
);
992 static ULONG WINAPI
d3drm3_Release(IDirect3DRM3
*iface
)
994 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
995 ULONG refcount
= InterlockedDecrement(&d3drm
->ref3
);
997 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
999 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
1000 d3drm_destroy(d3drm
);
1005 static HRESULT WINAPI
d3drm3_CreateObject(IDirect3DRM3
*iface
,
1006 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
1008 FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
1009 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
1014 static HRESULT WINAPI
d3drm3_CreateFrame(IDirect3DRM3
*iface
,
1015 IDirect3DRMFrame3
*parent
, IDirect3DRMFrame3
**frame
)
1017 TRACE("iface %p, parent %p, frame %p.\n", iface
, parent
, frame
);
1019 return Direct3DRMFrame_create(&IID_IDirect3DRMFrame3
, (IUnknown
*)parent
, (IUnknown
**)frame
);
1022 static HRESULT WINAPI
d3drm3_CreateMesh(IDirect3DRM3
*iface
, IDirect3DRMMesh
**mesh
)
1024 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
1026 return Direct3DRMMesh_create(mesh
);
1029 static HRESULT WINAPI
d3drm3_CreateMeshBuilder(IDirect3DRM3
*iface
, IDirect3DRMMeshBuilder3
**mesh_builder
)
1031 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
1033 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder3
, (IUnknown
**)mesh_builder
);
1036 static HRESULT WINAPI
d3drm3_CreateFace(IDirect3DRM3
*iface
, IDirect3DRMFace2
**face
)
1038 TRACE("iface %p, face %p.\n", iface
, face
);
1040 return Direct3DRMFace_create(&IID_IDirect3DRMFace2
, (IUnknown
**)face
);
1043 static HRESULT WINAPI
d3drm3_CreateAnimation(IDirect3DRM3
*iface
, IDirect3DRMAnimation2
**animation
)
1045 FIXME("iface %p, animation %p stub!\n", iface
, animation
);
1050 static HRESULT WINAPI
d3drm3_CreateAnimationSet(IDirect3DRM3
*iface
, IDirect3DRMAnimationSet2
**set
)
1052 FIXME("iface %p, set %p stub!\n", iface
, set
);
1057 static HRESULT WINAPI
d3drm3_CreateTexture(IDirect3DRM3
*iface
,
1058 D3DRMIMAGE
*image
, IDirect3DRMTexture3
**texture
)
1060 FIXME("iface %p, image %p, texture %p partial stub.\n", iface
, image
, texture
);
1062 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3
, (IUnknown
**)texture
);
1065 static HRESULT WINAPI
d3drm3_CreateLight(IDirect3DRM3
*iface
,
1066 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
1070 FIXME("iface %p, type %#x, color 0x%08x, light %p partial stub!\n", iface
, type
, color
, light
);
1072 if (SUCCEEDED(hr
= Direct3DRMLight_create((IUnknown
**)light
)))
1074 IDirect3DRMLight_SetType(*light
, type
);
1075 IDirect3DRMLight_SetColor(*light
, color
);
1081 static HRESULT WINAPI
d3drm3_CreateLightRGB(IDirect3DRM3
*iface
, D3DRMLIGHTTYPE type
,
1082 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
1086 FIXME("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p partial stub!\n",
1087 iface
, type
, red
, green
, blue
, light
);
1089 if (SUCCEEDED(hr
= Direct3DRMLight_create((IUnknown
**)light
)))
1091 IDirect3DRMLight_SetType(*light
, type
);
1092 IDirect3DRMLight_SetColorRGB(*light
, red
, green
, blue
);
1098 static HRESULT WINAPI
d3drm3_CreateMaterial(IDirect3DRM3
*iface
,
1099 D3DVALUE power
, IDirect3DRMMaterial2
**material
)
1103 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
1105 if (SUCCEEDED(hr
= Direct3DRMMaterial_create(material
)))
1106 IDirect3DRMMaterial2_SetPower(*material
, power
);
1111 static HRESULT WINAPI
d3drm3_CreateDevice(IDirect3DRM3
*iface
,
1112 DWORD width
, DWORD height
, IDirect3DRMDevice3
**device
)
1114 struct d3drm_device
*object
;
1116 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
1118 hr
= d3drm_device_create(&object
);
1122 *device
= IDirect3DRMDevice3_from_impl(object
);
1127 static HRESULT WINAPI
d3drm3_CreateDeviceFromSurface(IDirect3DRM3
*iface
, GUID
*guid
,
1128 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, DWORD flags
, IDirect3DRMDevice3
**device
)
1130 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1131 struct d3drm_device
*object
;
1135 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, flags %#x, device %p.\n",
1136 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, flags
, device
);
1139 return D3DRMERR_BADVALUE
;
1142 if (!backbuffer
|| !ddraw
)
1143 return D3DRMERR_BADDEVICE
;
1145 hr
= d3drm_device_create(&object
);
1149 use_z_surface
= !(flags
& D3DRMDEVICE_NOZBUFFER
);
1151 hr
= d3drm_device_init(object
, 3, &d3drm
->IDirect3DRM_iface
, ddraw
, backbuffer
, use_z_surface
);
1153 *device
= IDirect3DRMDevice3_from_impl(object
);
1155 d3drm_device_destroy(object
);
1160 static HRESULT WINAPI
d3drm3_CreateDeviceFromD3D(IDirect3DRM3
*iface
,
1161 IDirect3D2
*d3d
, IDirect3DDevice2
*d3d_device
, IDirect3DRMDevice3
**device
)
1163 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1165 IDirect3DDevice
*d3d_device1
;
1166 IDirect3DRMDevice
*device1
;
1168 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
1169 iface
, d3d
, d3d_device
, device
);
1172 return D3DRMERR_BADVALUE
;
1174 if (!d3d
|| !d3d_device
)
1175 return D3DRMERR_BADVALUE
;
1177 hr
= IDirect3D2_QueryInterface(d3d
, &IID_IDirect3D
, (void **)&d3d1
);
1180 hr
= IDirect3DDevice2_QueryInterface(d3d_device
, &IID_IDirect3DDevice
, (void **)&d3d_device1
);
1183 IDirect3D_Release(d3d1
);
1187 hr
= IDirect3DRM_CreateDeviceFromD3D(&d3drm
->IDirect3DRM_iface
, d3d1
, d3d_device1
, &device1
);
1188 IDirect3D_Release(d3d1
);
1189 IDirect3DDevice_Release(d3d_device1
);
1193 hr
= IDirect3DRMDevice_QueryInterface(device1
, &IID_IDirect3DRMDevice3
, (void **)device
);
1194 IDirect3DRMDevice_Release(device1
);
1199 static HRESULT WINAPI
d3drm3_CreateDeviceFromClipper(IDirect3DRM3
*iface
,
1200 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
1201 IDirect3DRMDevice3
**device
)
1203 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1204 struct d3drm_device
*object
;
1206 IDirectDrawSurface
*render_target
;
1209 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
1210 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
1213 return D3DRMERR_BADVALUE
;
1216 if (!clipper
|| !width
|| !height
)
1217 return D3DRMERR_BADVALUE
;
1219 hr
= DirectDrawCreate(NULL
, &ddraw
, NULL
);
1223 hr
= d3drm_device_create(&object
);
1226 IDirectDraw_Release(ddraw
);
1230 hr
= d3drm_device_create_surfaces_from_clipper(object
, ddraw
, clipper
, width
, height
, &render_target
);
1233 IDirectDraw_Release(ddraw
);
1234 d3drm_device_destroy(object
);
1238 hr
= d3drm_device_init(object
, 3, &d3drm
->IDirect3DRM_iface
, ddraw
, render_target
, TRUE
);
1239 IDirectDraw_Release(ddraw
);
1240 IDirectDrawSurface_Release(render_target
);
1242 d3drm_device_destroy(object
);
1244 *device
= IDirect3DRMDevice3_from_impl(object
);
1249 static HRESULT WINAPI
d3drm3_CreateShadow(IDirect3DRM3
*iface
, IUnknown
*object
, IDirect3DRMLight
*light
,
1250 D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
, IDirect3DRMShadow2
**shadow
)
1252 FIXME("iface %p, object %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
1253 iface
, object
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
1258 static HRESULT WINAPI
d3drm3_CreateTextureFromSurface(IDirect3DRM3
*iface
,
1259 IDirectDrawSurface
*surface
, IDirect3DRMTexture3
**texture
)
1261 FIXME("iface %p, surface %p, texture %p stub!\n", iface
, surface
, texture
);
1266 static HRESULT WINAPI
d3drm3_CreateViewport(IDirect3DRM3
*iface
, IDirect3DRMDevice3
*device
,
1267 IDirect3DRMFrame3
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport2
**viewport
)
1269 FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
1270 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
1272 return Direct3DRMViewport_create(&IID_IDirect3DRMViewport2
, (IUnknown
**)viewport
);
1275 static HRESULT WINAPI
d3drm3_CreateWrap(IDirect3DRM3
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame3
*frame
,
1276 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
1277 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
1278 IDirect3DRMWrap
**wrap
)
1280 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
1281 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
1282 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
1287 static HRESULT WINAPI
d3drm3_CreateUserVisual(IDirect3DRM3
*iface
,
1288 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
1290 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface
, cb
, ctx
, visual
);
1295 static HRESULT WINAPI
d3drm3_LoadTexture(IDirect3DRM3
*iface
,
1296 const char *filename
, IDirect3DRMTexture3
**texture
)
1298 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
1300 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3
, (IUnknown
**)texture
);
1303 static HRESULT WINAPI
d3drm3_LoadTextureFromResource(IDirect3DRM3
*iface
, HMODULE module
,
1304 const char *resource_name
, const char *resource_type
, IDirect3DRMTexture3
**texture
)
1306 FIXME("iface %p, module %p, resource_name %s, resource_type %s, texture %p stub!\n",
1307 iface
, module
, debugstr_a(resource_name
), debugstr_a(resource_type
), texture
);
1309 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3
, (IUnknown
**)texture
);
1312 static HRESULT WINAPI
d3drm3_SetSearchPath(IDirect3DRM3
*iface
, const char *path
)
1314 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1319 static HRESULT WINAPI
d3drm3_AddSearchPath(IDirect3DRM3
*iface
, const char *path
)
1321 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1326 static HRESULT WINAPI
d3drm3_GetSearchPath(IDirect3DRM3
*iface
, DWORD
*size
, char *path
)
1328 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
1333 static HRESULT WINAPI
d3drm3_SetDefaultTextureColors(IDirect3DRM3
*iface
, DWORD color_count
)
1335 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
1340 static HRESULT WINAPI
d3drm3_SetDefaultTextureShades(IDirect3DRM3
*iface
, DWORD shade_count
)
1342 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
1347 static HRESULT WINAPI
d3drm3_GetDevices(IDirect3DRM3
*iface
, IDirect3DRMDeviceArray
**array
)
1349 FIXME("iface %p, array %p stub!\n", iface
, array
);
1354 static HRESULT WINAPI
d3drm3_GetNamedObject(IDirect3DRM3
*iface
,
1355 const char *name
, IDirect3DRMObject
**object
)
1357 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
1362 static HRESULT WINAPI
d3drm3_EnumerateObjects(IDirect3DRM3
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
1364 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
1369 static HRESULT
load_data(IDirect3DRM3
*iface
, IDirectXFileData
*data_object
, IID
**GUIDs
, DWORD nb_GUIDs
, D3DRMLOADCALLBACK LoadProc
,
1370 void *ArgLP
, D3DRMLOADTEXTURECALLBACK LoadTextureProc
, void *ArgLTP
, IDirect3DRMFrame3
*parent_frame
)
1372 HRESULT ret
= D3DRMERR_BADOBJECT
;
1376 BOOL requested
= FALSE
;
1378 hr
= IDirectXFileData_GetType(data_object
, &guid
);
1379 if (hr
!= DXFILE_OK
)
1382 TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid
));
1384 /* Load object only if it is top level and requested or if it is part of another object */
1386 if (IsEqualGUID(guid
, &TID_D3DRMMesh
))
1388 TRACE("Found TID_D3DRMMesh\n");
1390 for (i
= 0; i
< nb_GUIDs
; i
++)
1391 if (IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder
) ||
1392 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder2
) ||
1393 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder3
))
1399 if (requested
|| parent_frame
)
1401 IDirect3DRMMeshBuilder3
*meshbuilder
;
1403 TRACE("Load mesh data\n");
1405 hr
= IDirect3DRM3_CreateMeshBuilder(iface
, &meshbuilder
);
1408 hr
= load_mesh_data(meshbuilder
, data_object
, LoadTextureProc
, ArgLTP
);
1411 /* Only top level objects are notified */
1414 IDirect3DRMObject
*object
;
1416 hr
= IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder
, GUIDs
[i
], (void**)&object
);
1419 LoadProc(object
, GUIDs
[i
], ArgLP
);
1420 IDirect3DRMObject_Release(object
);
1425 IDirect3DRMFrame3_AddVisual(parent_frame
, (IUnknown
*)meshbuilder
);
1428 IDirect3DRMMeshBuilder3_Release(meshbuilder
);
1432 ERR("Cannot process mesh\n");
1435 else if (IsEqualGUID(guid
, &TID_D3DRMFrame
))
1437 TRACE("Found TID_D3DRMFrame\n");
1439 for (i
= 0; i
< nb_GUIDs
; i
++)
1440 if (IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame
) ||
1441 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame2
) ||
1442 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame3
))
1448 if (requested
|| parent_frame
)
1450 IDirect3DRMFrame3
*frame
;
1452 TRACE("Load frame data\n");
1454 hr
= IDirect3DRM3_CreateFrame(iface
, parent_frame
, &frame
);
1457 IDirectXFileObject
*child
;
1459 while (SUCCEEDED(hr
= IDirectXFileData_GetNextObject(data_object
, &child
)))
1461 IDirectXFileData
*data
;
1462 IDirectXFileDataReference
*reference
;
1463 IDirectXFileBinary
*binary
;
1465 if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
1466 &IID_IDirectXFileBinary
, (void **)&binary
)))
1468 FIXME("Binary Object not supported yet\n");
1469 IDirectXFileBinary_Release(binary
);
1471 else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
1472 &IID_IDirectXFileData
, (void **)&data
)))
1474 TRACE("Found Data Object\n");
1475 hr
= load_data(iface
, data
, GUIDs
, nb_GUIDs
, LoadProc
, ArgLP
, LoadTextureProc
, ArgLTP
, frame
);
1476 IDirectXFileData_Release(data
);
1478 else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
1479 &IID_IDirectXFileDataReference
, (void **)&reference
)))
1481 TRACE("Found Data Object Reference\n");
1482 IDirectXFileDataReference_Resolve(reference
, &data
);
1483 hr
= load_data(iface
, data
, GUIDs
, nb_GUIDs
, LoadProc
, ArgLP
, LoadTextureProc
, ArgLTP
, frame
);
1484 IDirectXFileData_Release(data
);
1485 IDirectXFileDataReference_Release(reference
);
1487 IDirectXFileObject_Release(child
);
1490 if (hr
!= DXFILEERR_NOMOREOBJECTS
)
1492 IDirect3DRMFrame3_Release(frame
);
1497 /* Only top level objects are notified */
1500 IDirect3DRMObject
*object
;
1502 hr
= IDirect3DRMFrame3_QueryInterface(frame
, GUIDs
[i
], (void**)&object
);
1505 LoadProc(object
, GUIDs
[i
], ArgLP
);
1506 IDirect3DRMObject_Release(object
);
1509 IDirect3DRMFrame3_Release(frame
);
1513 ERR("Cannot process frame\n");
1516 else if (IsEqualGUID(guid
, &TID_D3DRMMaterial
))
1518 TRACE("Found TID_D3DRMMaterial\n");
1520 /* Cannot be requested so nothing to do */
1522 else if (IsEqualGUID(guid
, &TID_D3DRMFrameTransformMatrix
))
1524 TRACE("Found TID_D3DRMFrameTransformMatrix\n");
1526 /* Cannot be requested */
1529 D3DRMMATRIX4D
*matrix
;
1532 TRACE("Load Frame Transform Matrix data\n");
1534 hr
= IDirectXFileData_GetData(data_object
, NULL
, &size
, (void**)&matrix
);
1535 if ((hr
!= DXFILE_OK
) || (size
!= sizeof(matrix
)))
1538 hr
= IDirect3DRMFrame3_AddTransform(parent_frame
, D3DRMCOMBINE_REPLACE
, *matrix
);
1545 FIXME("Found unknown TID %s\n", debugstr_guid(guid
));
1555 static HRESULT WINAPI
d3drm3_Load(IDirect3DRM3
*iface
, void *source
, void *object_id
, IID
**iids
,
1556 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
1557 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame3
*parent_frame
)
1559 DXFILELOADOPTIONS load_options
;
1560 IDirectXFile
*file
= NULL
;
1561 IDirectXFileEnumObject
*enum_object
= NULL
;
1562 IDirectXFileData
*data
= NULL
;
1566 struct d3drm_file_header
*header
;
1567 HRESULT ret
= D3DRMERR_BADOBJECT
;
1570 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
1571 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
1572 iface
, source
, object_id
, iids
, iid_count
, flags
,
1573 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
1575 TRACE("Looking for GUIDs:\n");
1576 for (i
= 0; i
< iid_count
; ++i
)
1577 TRACE("- %s (%s)\n", debugstr_guid(iids
[i
]), get_IID_string(iids
[i
]));
1579 if (flags
== D3DRMLOAD_FROMMEMORY
)
1581 load_options
= DXFILELOAD_FROMMEMORY
;
1583 else if (flags
== D3DRMLOAD_FROMFILE
)
1585 load_options
= DXFILELOAD_FROMFILE
;
1586 TRACE("Loading from file %s\n", debugstr_a(source
));
1590 FIXME("Load options %#x not supported yet.\n", flags
);
1594 hr
= DirectXFileCreate(&file
);
1595 if (hr
!= DXFILE_OK
)
1598 hr
= IDirectXFile_RegisterTemplates(file
, templates
, strlen(templates
));
1599 if (hr
!= DXFILE_OK
)
1602 hr
= IDirectXFile_CreateEnumObject(file
, source
, load_options
, &enum_object
);
1603 if (hr
!= DXFILE_OK
)
1606 hr
= IDirectXFileEnumObject_GetNextDataObject(enum_object
, &data
);
1607 if (hr
!= DXFILE_OK
)
1610 hr
= IDirectXFileData_GetType(data
, &pGuid
);
1611 if (hr
!= DXFILE_OK
)
1614 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid
));
1616 if (!IsEqualGUID(pGuid
, &TID_DXFILEHeader
))
1618 ret
= D3DRMERR_BADFILE
;
1622 hr
= IDirectXFileData_GetData(data
, NULL
, &size
, (void **)&header
);
1623 if ((hr
!= DXFILE_OK
) || (size
!= sizeof(*header
)))
1626 TRACE("Version is %u.%u, flags %#x.\n", header
->major
, header
->minor
, header
->flags
);
1628 /* Version must be 1.0.x */
1629 if ((header
->major
!= 1) || (header
->minor
!= 0))
1631 ret
= D3DRMERR_BADFILE
;
1635 IDirectXFileData_Release(data
);
1640 hr
= IDirectXFileEnumObject_GetNextDataObject(enum_object
, &data
);
1641 if (hr
== DXFILEERR_NOMOREOBJECTS
)
1643 TRACE("No more object\n");
1646 else if (hr
!= DXFILE_OK
)
1648 ret
= D3DRMERR_BADFILE
;
1652 ret
= load_data(iface
, data
, iids
, iid_count
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
1653 if (ret
!= D3DRM_OK
)
1656 IDirectXFileData_Release(data
);
1664 IDirectXFileData_Release(data
);
1666 IDirectXFileEnumObject_Release(enum_object
);
1668 IDirectXFile_Release(file
);
1673 static HRESULT WINAPI
d3drm3_Tick(IDirect3DRM3
*iface
, D3DVALUE tick
)
1675 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
1680 static HRESULT WINAPI
d3drm3_CreateProgressiveMesh(IDirect3DRM3
*iface
, IDirect3DRMProgressiveMesh
**mesh
)
1682 FIXME("iface %p, mesh %p stub!\n", iface
, mesh
);
1687 static HRESULT WINAPI
d3drm3_RegisterClient(IDirect3DRM3
*iface
, REFGUID guid
, DWORD
*id
)
1689 FIXME("iface %p, guid %s, id %p stub!\n", iface
, debugstr_guid(guid
), id
);
1694 static HRESULT WINAPI
d3drm3_UnregisterClient(IDirect3DRM3
*iface
, REFGUID guid
)
1696 FIXME("iface %p, guid %s stub!\n", iface
, debugstr_guid(guid
));
1701 static HRESULT WINAPI
d3drm3_CreateClippedVisual(IDirect3DRM3
*iface
,
1702 IDirect3DRMVisual
*visual
, IDirect3DRMClippedVisual
**clipped_visual
)
1704 FIXME("iface %p, visual %p, clipped_visual %p stub!\n", iface
, visual
, clipped_visual
);
1709 static HRESULT WINAPI
d3drm3_SetOptions(IDirect3DRM3
*iface
, DWORD flags
)
1711 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
1716 static HRESULT WINAPI
d3drm3_GetOptions(IDirect3DRM3
*iface
, DWORD
*flags
)
1718 FIXME("iface %p, flags %p stub!\n", iface
, flags
);
1723 static const struct IDirect3DRM3Vtbl d3drm3_vtbl
=
1725 d3drm3_QueryInterface
,
1728 d3drm3_CreateObject
,
1731 d3drm3_CreateMeshBuilder
,
1733 d3drm3_CreateAnimation
,
1734 d3drm3_CreateAnimationSet
,
1735 d3drm3_CreateTexture
,
1737 d3drm3_CreateLightRGB
,
1738 d3drm3_CreateMaterial
,
1739 d3drm3_CreateDevice
,
1740 d3drm3_CreateDeviceFromSurface
,
1741 d3drm3_CreateDeviceFromD3D
,
1742 d3drm3_CreateDeviceFromClipper
,
1743 d3drm3_CreateTextureFromSurface
,
1744 d3drm3_CreateShadow
,
1745 d3drm3_CreateViewport
,
1747 d3drm3_CreateUserVisual
,
1749 d3drm3_LoadTextureFromResource
,
1750 d3drm3_SetSearchPath
,
1751 d3drm3_AddSearchPath
,
1752 d3drm3_GetSearchPath
,
1753 d3drm3_SetDefaultTextureColors
,
1754 d3drm3_SetDefaultTextureShades
,
1756 d3drm3_GetNamedObject
,
1757 d3drm3_EnumerateObjects
,
1760 d3drm3_CreateProgressiveMesh
,
1761 d3drm3_RegisterClient
,
1762 d3drm3_UnregisterClient
,
1763 d3drm3_CreateClippedVisual
,
1768 HRESULT WINAPI
Direct3DRMCreate(IDirect3DRM
**d3drm
)
1770 struct d3drm
*object
;
1772 TRACE("d3drm %p.\n", d3drm
);
1774 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1775 return E_OUTOFMEMORY
;
1777 object
->IDirect3DRM_iface
.lpVtbl
= &d3drm1_vtbl
;
1778 object
->IDirect3DRM2_iface
.lpVtbl
= &d3drm2_vtbl
;
1779 object
->IDirect3DRM3_iface
.lpVtbl
= &d3drm3_vtbl
;
1781 object
->iface_count
= 1;
1783 *d3drm
= &object
->IDirect3DRM_iface
;
1788 HRESULT WINAPI
DllCanUnloadNow(void)
1793 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, void **ppv
)
1795 TRACE("(%s, %s, %p): stub\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
1798 return E_INVALIDARG
;
1800 return CLASS_E_CLASSNOTAVAILABLE
;