2 * Implementation of IDirect3DRM Interface
4 * Copyright 2010, 2012 Christian Costa
5 * Copyright 2011 André Hentschel
6 * Copyright 2016 Aaryaman Vasishta
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/port.h"
26 #include "d3drm_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
30 static const char* get_IID_string(const GUID
* guid
)
32 if (IsEqualGUID(guid
, &IID_IDirect3DRMFrame
))
33 return "IID_IDirect3DRMFrame";
34 else if (IsEqualGUID(guid
, &IID_IDirect3DRMFrame2
))
35 return "IID_IDirect3DRMFrame2";
36 else if (IsEqualGUID(guid
, &IID_IDirect3DRMFrame3
))
37 return "IID_IDirect3DRMFrame3";
38 else if (IsEqualGUID(guid
, &IID_IDirect3DRMMeshBuilder
))
39 return "IID_IDirect3DRMMeshBuilder";
40 else if (IsEqualGUID(guid
, &IID_IDirect3DRMMeshBuilder2
))
41 return "IID_IDirect3DRMMeshBuilder2";
42 else if (IsEqualGUID(guid
, &IID_IDirect3DRMMeshBuilder3
))
43 return "IID_IDirect3DRMMeshBuilder3";
48 static HRESULT
d3drm_create_texture_object(void **object
, IDirect3DRM
*d3drm
)
50 struct d3drm_texture
*texture
;
53 if (FAILED(hr
= d3drm_texture_create(&texture
, d3drm
)))
56 *object
= &texture
->IDirect3DRMTexture_iface
;
61 static HRESULT
d3drm_create_device_object(void **object
, IDirect3DRM
*d3drm
)
63 struct d3drm_device
*device
;
66 if (FAILED(hr
= d3drm_device_create(&device
, d3drm
)))
69 *object
= &device
->IDirect3DRMDevice_iface
;
74 static HRESULT
d3drm_create_viewport_object(void **object
, IDirect3DRM
*d3drm
)
76 struct d3drm_viewport
*viewport
;
79 if (FAILED(hr
= d3drm_viewport_create(&viewport
, d3drm
)))
82 *object
= &viewport
->IDirect3DRMViewport_iface
;
89 IDirect3DRM IDirect3DRM_iface
;
90 IDirect3DRM2 IDirect3DRM2_iface
;
91 IDirect3DRM3 IDirect3DRM3_iface
;
92 LONG ref1
, ref2
, ref3
, iface_count
;
95 static inline struct d3drm
*impl_from_IDirect3DRM(IDirect3DRM
*iface
)
97 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM_iface
);
100 static inline struct d3drm
*impl_from_IDirect3DRM2(IDirect3DRM2
*iface
)
102 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM2_iface
);
105 static inline struct d3drm
*impl_from_IDirect3DRM3(IDirect3DRM3
*iface
)
107 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM3_iface
);
110 static void d3drm_destroy(struct d3drm
*d3drm
)
112 HeapFree(GetProcessHeap(), 0, d3drm
);
113 TRACE("d3drm object %p is being destroyed.\n", d3drm
);
116 static HRESULT WINAPI
d3drm1_QueryInterface(IDirect3DRM
*iface
, REFIID riid
, void **out
)
118 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
120 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
122 if (IsEqualGUID(riid
, &IID_IDirect3DRM
)
123 || IsEqualGUID(riid
, &IID_IUnknown
))
125 *out
= &d3drm
->IDirect3DRM_iface
;
127 else if (IsEqualGUID(riid
, &IID_IDirect3DRM2
))
129 *out
= &d3drm
->IDirect3DRM2_iface
;
131 else if (IsEqualGUID(riid
, &IID_IDirect3DRM3
))
133 *out
= &d3drm
->IDirect3DRM3_iface
;
138 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid
));
139 return CLASS_E_CLASSNOTAVAILABLE
;
142 IUnknown_AddRef((IUnknown
*)*out
);
146 static ULONG WINAPI
d3drm1_AddRef(IDirect3DRM
*iface
)
148 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
149 ULONG refcount
= InterlockedIncrement(&d3drm
->ref1
);
151 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
154 InterlockedIncrement(&d3drm
->iface_count
);
159 static ULONG WINAPI
d3drm1_Release(IDirect3DRM
*iface
)
161 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
162 ULONG refcount
= InterlockedDecrement(&d3drm
->ref1
);
164 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
166 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
167 d3drm_destroy(d3drm
);
172 static HRESULT WINAPI
d3drm1_CreateObject(IDirect3DRM
*iface
,
173 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
175 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
177 TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
178 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
180 return IDirect3DRM3_CreateObject(&d3drm
->IDirect3DRM3_iface
, clsid
, outer
, iid
, out
);
183 static HRESULT WINAPI
d3drm1_CreateFrame(IDirect3DRM
*iface
,
184 IDirect3DRMFrame
*parent_frame
, IDirect3DRMFrame
**frame
)
186 struct d3drm_frame
*object
;
189 TRACE("iface %p, parent_frame %p, frame %p.\n", iface
, parent_frame
, frame
);
191 if (FAILED(hr
= d3drm_frame_create(&object
, (IUnknown
*)parent_frame
, iface
)))
194 *frame
= &object
->IDirect3DRMFrame_iface
;
199 static HRESULT WINAPI
d3drm1_CreateMesh(IDirect3DRM
*iface
, IDirect3DRMMesh
**mesh
)
201 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
203 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
205 return IDirect3DRM3_CreateMesh(&d3drm
->IDirect3DRM3_iface
, mesh
);
208 static HRESULT WINAPI
d3drm1_CreateMeshBuilder(IDirect3DRM
*iface
, IDirect3DRMMeshBuilder
**mesh_builder
)
210 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
212 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder
, (IUnknown
**)mesh_builder
);
215 static HRESULT WINAPI
d3drm1_CreateFace(IDirect3DRM
*iface
, IDirect3DRMFace
**face
)
217 TRACE("iface %p, face %p.\n", iface
, face
);
219 return Direct3DRMFace_create(&IID_IDirect3DRMFace
, (IUnknown
**)face
);
222 static HRESULT WINAPI
d3drm1_CreateAnimation(IDirect3DRM
*iface
, IDirect3DRMAnimation
**animation
)
224 FIXME("iface %p, animation %p stub!\n", iface
, animation
);
229 static HRESULT WINAPI
d3drm1_CreateAnimationSet(IDirect3DRM
*iface
, IDirect3DRMAnimationSet
**set
)
231 FIXME("iface %p, set %p stub!\n", iface
, set
);
236 static HRESULT WINAPI
d3drm1_CreateTexture(IDirect3DRM
*iface
,
237 D3DRMIMAGE
*image
, IDirect3DRMTexture
**texture
)
239 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
240 IDirect3DRMTexture3
*texture3
;
243 TRACE("iface %p, image %p, texture %p.\n", iface
, image
, texture
);
246 return D3DRMERR_BADVALUE
;
248 if (FAILED(hr
= IDirect3DRM3_CreateTexture(&d3drm
->IDirect3DRM3_iface
, image
, &texture3
)))
254 hr
= IDirect3DRMTexture3_QueryInterface(texture3
, &IID_IDirect3DRMTexture
, (void **)texture
);
255 IDirect3DRMTexture3_Release(texture3
);
260 static HRESULT WINAPI
d3drm1_CreateLight(IDirect3DRM
*iface
,
261 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
263 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
265 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface
, type
, color
, light
);
267 return IDirect3DRM3_CreateLight(&d3drm
->IDirect3DRM3_iface
, type
, color
, light
);
270 static HRESULT WINAPI
d3drm1_CreateLightRGB(IDirect3DRM
*iface
, D3DRMLIGHTTYPE type
,
271 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
273 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
275 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
276 iface
, type
, red
, green
, blue
, light
);
278 return IDirect3DRM3_CreateLightRGB(&d3drm
->IDirect3DRM3_iface
, type
, red
, green
, blue
, light
);
281 static HRESULT WINAPI
d3drm1_CreateMaterial(IDirect3DRM
*iface
,
282 D3DVALUE power
, IDirect3DRMMaterial
**material
)
284 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
286 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
288 return IDirect3DRM3_CreateMaterial(&d3drm
->IDirect3DRM3_iface
, power
, (IDirect3DRMMaterial2
**)material
);
291 static HRESULT WINAPI
d3drm1_CreateDevice(IDirect3DRM
*iface
,
292 DWORD width
, DWORD height
, IDirect3DRMDevice
**device
)
294 struct d3drm_device
*object
;
297 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
299 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
302 *device
= &object
->IDirect3DRMDevice_iface
;
307 static HRESULT WINAPI
d3drm1_CreateDeviceFromSurface(IDirect3DRM
*iface
, GUID
*guid
,
308 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, IDirect3DRMDevice
**device
)
310 struct d3drm_device
*object
;
313 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
314 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, device
);
317 return D3DRMERR_BADVALUE
;
320 if (!backbuffer
|| !ddraw
)
321 return D3DRMERR_BADDEVICE
;
323 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
326 if (SUCCEEDED(hr
= d3drm_device_init(object
, 1, ddraw
, backbuffer
, TRUE
)))
327 *device
= &object
->IDirect3DRMDevice_iface
;
329 d3drm_device_destroy(object
);
334 static HRESULT WINAPI
d3drm1_CreateDeviceFromD3D(IDirect3DRM
*iface
,
335 IDirect3D
*d3d
, IDirect3DDevice
*d3d_device
, IDirect3DRMDevice
**device
)
337 struct d3drm_device
*object
;
339 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
340 iface
, d3d
, d3d_device
, device
);
343 return D3DRMERR_BADVALUE
;
346 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
349 if (FAILED(hr
= IDirect3DRMDevice_InitFromD3D(&object
->IDirect3DRMDevice_iface
, d3d
, d3d_device
)))
351 d3drm_device_destroy(object
);
354 *device
= &object
->IDirect3DRMDevice_iface
;
359 static HRESULT WINAPI
d3drm1_CreateDeviceFromClipper(IDirect3DRM
*iface
,
360 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
361 IDirect3DRMDevice
**device
)
363 struct d3drm_device
*object
;
365 IDirectDrawSurface
*render_target
;
368 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
369 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
372 return D3DRMERR_BADVALUE
;
375 if (!clipper
|| !width
|| !height
)
376 return D3DRMERR_BADVALUE
;
378 hr
= DirectDrawCreate(NULL
, &ddraw
, NULL
);
382 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
384 IDirectDraw_Release(ddraw
);
388 hr
= d3drm_device_create_surfaces_from_clipper(object
, ddraw
, clipper
, width
, height
, &render_target
);
391 IDirectDraw_Release(ddraw
);
392 d3drm_device_destroy(object
);
396 hr
= d3drm_device_init(object
, 1, ddraw
, render_target
, TRUE
);
397 IDirectDraw_Release(ddraw
);
398 IDirectDrawSurface_Release(render_target
);
400 d3drm_device_destroy(object
);
402 *device
= &object
->IDirect3DRMDevice_iface
;
407 static HRESULT WINAPI
d3drm1_CreateTextureFromSurface(IDirect3DRM
*iface
,
408 IDirectDrawSurface
*surface
, IDirect3DRMTexture
**texture
)
410 FIXME("iface %p, surface %p, texture %p stub!\n", iface
, surface
, texture
);
415 static HRESULT WINAPI
d3drm1_CreateShadow(IDirect3DRM
*iface
, IDirect3DRMVisual
*visual
,
416 IDirect3DRMLight
*light
, D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
,
417 IDirect3DRMVisual
**shadow
)
419 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
420 iface
, visual
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
425 static HRESULT WINAPI
d3drm1_CreateViewport(IDirect3DRM
*iface
, IDirect3DRMDevice
*device
,
426 IDirect3DRMFrame
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport
**viewport
)
428 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
429 IDirect3DRMDevice3
*device3
;
430 IDirect3DRMFrame3
*camera3
;
431 IDirect3DRMViewport2
*viewport2
;
434 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
435 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
437 if (!device
|| !camera
)
438 return D3DRMERR_BADOBJECT
;
440 return D3DRMERR_BADVALUE
;
442 if (FAILED(hr
= IDirect3DRMDevice_QueryInterface(device
, &IID_IDirect3DRMDevice3
, (void **)&device3
)))
445 if (FAILED(hr
= IDirect3DRMFrame_QueryInterface(camera
, &IID_IDirect3DRMFrame3
, (void **)&camera3
)))
447 IDirect3DRMDevice3_Release(device3
);
451 hr
= IDirect3DRM3_CreateViewport(&d3drm
->IDirect3DRM3_iface
, device3
, camera3
, x
, y
, width
, height
, &viewport2
);
452 IDirect3DRMDevice3_Release(device3
);
453 IDirect3DRMFrame3_Release(camera3
);
457 hr
= IDirect3DRMViewport2_QueryInterface(viewport2
, &IID_IDirect3DRMViewport
, (void **)viewport
);
458 IDirect3DRMViewport2_Release(viewport2
);
463 static HRESULT WINAPI
d3drm1_CreateWrap(IDirect3DRM
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame
*frame
,
464 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
465 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
466 IDirect3DRMWrap
**wrap
)
468 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
469 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
470 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
475 static HRESULT WINAPI
d3drm1_CreateUserVisual(IDirect3DRM
*iface
,
476 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
478 FIXME("iface %p, cb %p, ctx %p visual %p stub!\n", iface
, cb
, ctx
, visual
);
483 static HRESULT WINAPI
d3drm1_LoadTexture(IDirect3DRM
*iface
,
484 const char *filename
, IDirect3DRMTexture
**texture
)
486 struct d3drm_texture
*object
;
489 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
491 if (FAILED(hr
= d3drm_texture_create(&object
, iface
)))
494 *texture
= &object
->IDirect3DRMTexture_iface
;
499 static HRESULT WINAPI
d3drm1_LoadTextureFromResource(IDirect3DRM
*iface
,
500 HRSRC resource
, IDirect3DRMTexture
**texture
)
502 struct d3drm_texture
*object
;
505 FIXME("iface %p, resource %p, texture %p stub!\n", iface
, resource
, texture
);
507 if (FAILED(hr
= d3drm_texture_create(&object
, iface
)))
510 *texture
= &object
->IDirect3DRMTexture_iface
;
515 static HRESULT WINAPI
d3drm1_SetSearchPath(IDirect3DRM
*iface
, const char *path
)
517 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
522 static HRESULT WINAPI
d3drm1_AddSearchPath(IDirect3DRM
*iface
, const char *path
)
524 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
529 static HRESULT WINAPI
d3drm1_GetSearchPath(IDirect3DRM
*iface
, DWORD
*size
, char *path
)
531 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
536 static HRESULT WINAPI
d3drm1_SetDefaultTextureColors(IDirect3DRM
*iface
, DWORD color_count
)
538 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
543 static HRESULT WINAPI
d3drm1_SetDefaultTextureShades(IDirect3DRM
*iface
, DWORD shade_count
)
545 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
550 static HRESULT WINAPI
d3drm1_GetDevices(IDirect3DRM
*iface
, IDirect3DRMDeviceArray
**array
)
552 FIXME("iface %p, array %p stub!\n", iface
, array
);
557 static HRESULT WINAPI
d3drm1_GetNamedObject(IDirect3DRM
*iface
,
558 const char *name
, IDirect3DRMObject
**object
)
560 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
565 static HRESULT WINAPI
d3drm1_EnumerateObjects(IDirect3DRM
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
567 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
572 static HRESULT WINAPI
d3drm1_Load(IDirect3DRM
*iface
, void *source
, void *object_id
, IID
**iids
,
573 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
574 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame
*parent_frame
)
576 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
577 IDirect3DRMFrame3
*parent_frame3
= NULL
;
578 HRESULT hr
= D3DRM_OK
;
580 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
581 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
582 iface
, source
, object_id
, iids
, iid_count
, flags
,
583 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
586 hr
= IDirect3DRMFrame_QueryInterface(parent_frame
, &IID_IDirect3DRMFrame3
, (void **)&parent_frame3
);
588 hr
= IDirect3DRM3_Load(&d3drm
->IDirect3DRM3_iface
, source
, object_id
, iids
, iid_count
,
589 flags
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame3
);
591 IDirect3DRMFrame3_Release(parent_frame3
);
596 static HRESULT WINAPI
d3drm1_Tick(IDirect3DRM
*iface
, D3DVALUE tick
)
598 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
603 static const struct IDirect3DRMVtbl d3drm1_vtbl
=
605 d3drm1_QueryInterface
,
611 d3drm1_CreateMeshBuilder
,
613 d3drm1_CreateAnimation
,
614 d3drm1_CreateAnimationSet
,
615 d3drm1_CreateTexture
,
617 d3drm1_CreateLightRGB
,
618 d3drm1_CreateMaterial
,
620 d3drm1_CreateDeviceFromSurface
,
621 d3drm1_CreateDeviceFromD3D
,
622 d3drm1_CreateDeviceFromClipper
,
623 d3drm1_CreateTextureFromSurface
,
625 d3drm1_CreateViewport
,
627 d3drm1_CreateUserVisual
,
629 d3drm1_LoadTextureFromResource
,
630 d3drm1_SetSearchPath
,
631 d3drm1_AddSearchPath
,
632 d3drm1_GetSearchPath
,
633 d3drm1_SetDefaultTextureColors
,
634 d3drm1_SetDefaultTextureShades
,
636 d3drm1_GetNamedObject
,
637 d3drm1_EnumerateObjects
,
642 static HRESULT WINAPI
d3drm2_QueryInterface(IDirect3DRM2
*iface
, REFIID riid
, void **out
)
644 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
646 return d3drm1_QueryInterface(&d3drm
->IDirect3DRM_iface
, riid
, out
);
649 static ULONG WINAPI
d3drm2_AddRef(IDirect3DRM2
*iface
)
651 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
652 ULONG refcount
= InterlockedIncrement(&d3drm
->ref2
);
654 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
657 InterlockedIncrement(&d3drm
->iface_count
);
662 static ULONG WINAPI
d3drm2_Release(IDirect3DRM2
*iface
)
664 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
665 ULONG refcount
= InterlockedDecrement(&d3drm
->ref2
);
667 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
669 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
670 d3drm_destroy(d3drm
);
675 static HRESULT WINAPI
d3drm2_CreateObject(IDirect3DRM2
*iface
,
676 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
678 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
680 TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
681 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
683 return IDirect3DRM3_CreateObject(&d3drm
->IDirect3DRM3_iface
, clsid
, outer
, iid
, out
);
686 static HRESULT WINAPI
d3drm2_CreateFrame(IDirect3DRM2
*iface
,
687 IDirect3DRMFrame
*parent_frame
, IDirect3DRMFrame2
**frame
)
689 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
690 struct d3drm_frame
*object
;
693 TRACE("iface %p, parent_frame %p, frame %p.\n", iface
, parent_frame
, frame
);
695 if (FAILED(hr
= d3drm_frame_create(&object
, (IUnknown
*)parent_frame
, &d3drm
->IDirect3DRM_iface
)))
698 *frame
= &object
->IDirect3DRMFrame2_iface
;
703 static HRESULT WINAPI
d3drm2_CreateMesh(IDirect3DRM2
*iface
, IDirect3DRMMesh
**mesh
)
705 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
707 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
709 return IDirect3DRM3_CreateMesh(&d3drm
->IDirect3DRM3_iface
, mesh
);
712 static HRESULT WINAPI
d3drm2_CreateMeshBuilder(IDirect3DRM2
*iface
, IDirect3DRMMeshBuilder2
**mesh_builder
)
714 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
716 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder2
, (IUnknown
**)mesh_builder
);
719 static HRESULT WINAPI
d3drm2_CreateFace(IDirect3DRM2
*iface
, IDirect3DRMFace
**face
)
721 TRACE("iface %p, face %p.\n", iface
, face
);
723 return Direct3DRMFace_create(&IID_IDirect3DRMFace
, (IUnknown
**)face
);
726 static HRESULT WINAPI
d3drm2_CreateAnimation(IDirect3DRM2
*iface
, IDirect3DRMAnimation
**animation
)
728 FIXME("iface %p, animation %p stub!\n", iface
, animation
);
733 static HRESULT WINAPI
d3drm2_CreateAnimationSet(IDirect3DRM2
*iface
, IDirect3DRMAnimationSet
**set
)
735 FIXME("iface %p, set %p stub!\n", iface
, set
);
740 static HRESULT WINAPI
d3drm2_CreateTexture(IDirect3DRM2
*iface
,
741 D3DRMIMAGE
*image
, IDirect3DRMTexture2
**texture
)
743 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
744 IDirect3DRMTexture3
*texture3
;
747 TRACE("iface %p, image %p, texture %p.\n", iface
, image
, texture
);
750 return D3DRMERR_BADVALUE
;
752 if (FAILED(hr
= IDirect3DRM3_CreateTexture(&d3drm
->IDirect3DRM3_iface
, image
, &texture3
)))
758 hr
= IDirect3DRMTexture3_QueryInterface(texture3
, &IID_IDirect3DRMTexture2
, (void **)texture
);
759 IDirect3DRMTexture3_Release(texture3
);
764 static HRESULT WINAPI
d3drm2_CreateLight(IDirect3DRM2
*iface
,
765 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
767 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
769 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface
, type
, color
, light
);
771 return IDirect3DRM3_CreateLight(&d3drm
->IDirect3DRM3_iface
, type
, color
, light
);
774 static HRESULT WINAPI
d3drm2_CreateLightRGB(IDirect3DRM2
*iface
, D3DRMLIGHTTYPE type
,
775 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
777 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
779 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
780 iface
, type
, red
, green
, blue
, light
);
782 return IDirect3DRM3_CreateLightRGB(&d3drm
->IDirect3DRM3_iface
, type
, red
, green
, blue
, light
);
785 static HRESULT WINAPI
d3drm2_CreateMaterial(IDirect3DRM2
*iface
,
786 D3DVALUE power
, IDirect3DRMMaterial
**material
)
788 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
790 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
792 return IDirect3DRM3_CreateMaterial(&d3drm
->IDirect3DRM3_iface
, power
, (IDirect3DRMMaterial2
**)material
);
795 static HRESULT WINAPI
d3drm2_CreateDevice(IDirect3DRM2
*iface
,
796 DWORD width
, DWORD height
, IDirect3DRMDevice2
**device
)
798 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
799 struct d3drm_device
*object
;
802 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
804 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
807 *device
= &object
->IDirect3DRMDevice2_iface
;
812 static HRESULT WINAPI
d3drm2_CreateDeviceFromSurface(IDirect3DRM2
*iface
, GUID
*guid
,
813 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, IDirect3DRMDevice2
**device
)
815 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
816 IDirect3DRMDevice3
*device3
;
818 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
819 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, device
);
822 return D3DRMERR_BADVALUE
;
824 hr
= IDirect3DRM3_CreateDeviceFromSurface(&d3drm
->IDirect3DRM3_iface
, guid
, ddraw
, backbuffer
, 0, &device3
);
828 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void**)device
);
829 IDirect3DRMDevice3_Release(device3
);
834 static HRESULT WINAPI
d3drm2_CreateDeviceFromD3D(IDirect3DRM2
*iface
,
835 IDirect3D2
*d3d
, IDirect3DDevice2
*d3d_device
, IDirect3DRMDevice2
**device
)
837 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
838 IDirect3DRMDevice3
*device3
;
841 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
842 iface
, d3d
, d3d_device
, device
);
845 return D3DRMERR_BADVALUE
;
848 hr
= IDirect3DRM3_CreateDeviceFromD3D(&d3drm
->IDirect3DRM3_iface
, d3d
, d3d_device
, &device3
);
852 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void **)device
);
853 IDirect3DRMDevice3_Release(device3
);
858 static HRESULT WINAPI
d3drm2_CreateDeviceFromClipper(IDirect3DRM2
*iface
,
859 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
860 IDirect3DRMDevice2
**device
)
862 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
863 IDirect3DRMDevice3
*device3
;
866 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
867 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
870 return D3DRMERR_BADVALUE
;
872 hr
= IDirect3DRM3_CreateDeviceFromClipper(&d3drm
->IDirect3DRM3_iface
, clipper
, guid
, width
, height
, &device3
);
876 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void**)device
);
877 IDirect3DRMDevice3_Release(device3
);
882 static HRESULT WINAPI
d3drm2_CreateTextureFromSurface(IDirect3DRM2
*iface
,
883 IDirectDrawSurface
*surface
, IDirect3DRMTexture2
**texture
)
885 FIXME("iface %p, surface %p, texture %p stub!\n", iface
, surface
, texture
);
890 static HRESULT WINAPI
d3drm2_CreateShadow(IDirect3DRM2
*iface
, IDirect3DRMVisual
*visual
,
891 IDirect3DRMLight
*light
, D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
,
892 IDirect3DRMVisual
**shadow
)
894 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
895 iface
, visual
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
900 static HRESULT WINAPI
d3drm2_CreateViewport(IDirect3DRM2
*iface
, IDirect3DRMDevice
*device
,
901 IDirect3DRMFrame
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport
**viewport
)
903 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
904 IDirect3DRMDevice3
*device3
;
905 IDirect3DRMFrame3
*camera3
;
906 IDirect3DRMViewport2
*viewport2
;
909 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
910 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
912 if (!device
|| !camera
)
913 return D3DRMERR_BADOBJECT
;
915 return D3DRMERR_BADVALUE
;
917 if (FAILED(hr
= IDirect3DRMDevice_QueryInterface(device
, &IID_IDirect3DRMDevice3
, (void **)&device3
)))
920 if (FAILED(hr
= IDirect3DRMFrame_QueryInterface(camera
, &IID_IDirect3DRMFrame3
, (void **)&camera3
)))
922 IDirect3DRMDevice3_Release(device3
);
926 hr
= IDirect3DRM3_CreateViewport(&d3drm
->IDirect3DRM3_iface
, device3
, camera3
, x
, y
, width
, height
, &viewport2
);
927 IDirect3DRMDevice3_Release(device3
);
928 IDirect3DRMFrame3_Release(camera3
);
932 hr
= IDirect3DRMViewport2_QueryInterface(viewport2
, &IID_IDirect3DRMViewport
, (void **)viewport
);
933 IDirect3DRMViewport2_Release(viewport2
);
938 static HRESULT WINAPI
d3drm2_CreateWrap(IDirect3DRM2
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame
*frame
,
939 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
940 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
941 IDirect3DRMWrap
**wrap
)
943 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
944 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
945 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
950 static HRESULT WINAPI
d3drm2_CreateUserVisual(IDirect3DRM2
*iface
,
951 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
953 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface
, cb
, ctx
, visual
);
958 static HRESULT WINAPI
d3drm2_LoadTexture(IDirect3DRM2
*iface
,
959 const char *filename
, IDirect3DRMTexture2
**texture
)
961 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
962 struct d3drm_texture
*object
;
965 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
967 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
970 *texture
= &object
->IDirect3DRMTexture2_iface
;
975 static HRESULT WINAPI
d3drm2_LoadTextureFromResource(IDirect3DRM2
*iface
, HMODULE module
,
976 const char *resource_name
, const char *resource_type
, IDirect3DRMTexture2
**texture
)
978 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
979 struct d3drm_texture
*object
;
982 FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n",
983 iface
, debugstr_a(resource_name
), debugstr_a(resource_type
), texture
);
985 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
988 *texture
= &object
->IDirect3DRMTexture2_iface
;
993 static HRESULT WINAPI
d3drm2_SetSearchPath(IDirect3DRM2
*iface
, const char *path
)
995 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1000 static HRESULT WINAPI
d3drm2_AddSearchPath(IDirect3DRM2
*iface
, const char *path
)
1002 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1007 static HRESULT WINAPI
d3drm2_GetSearchPath(IDirect3DRM2
*iface
, DWORD
*size
, char *path
)
1009 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
1014 static HRESULT WINAPI
d3drm2_SetDefaultTextureColors(IDirect3DRM2
*iface
, DWORD color_count
)
1016 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
1021 static HRESULT WINAPI
d3drm2_SetDefaultTextureShades(IDirect3DRM2
*iface
, DWORD shade_count
)
1023 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
1028 static HRESULT WINAPI
d3drm2_GetDevices(IDirect3DRM2
*iface
, IDirect3DRMDeviceArray
**array
)
1030 FIXME("iface %p, array %p stub!\n", iface
, array
);
1035 static HRESULT WINAPI
d3drm2_GetNamedObject(IDirect3DRM2
*iface
,
1036 const char *name
, IDirect3DRMObject
**object
)
1038 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
1043 static HRESULT WINAPI
d3drm2_EnumerateObjects(IDirect3DRM2
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
1045 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
1050 static HRESULT WINAPI
d3drm2_Load(IDirect3DRM2
*iface
, void *source
, void *object_id
, IID
**iids
,
1051 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
1052 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame
*parent_frame
)
1054 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1055 IDirect3DRMFrame3
*parent_frame3
= NULL
;
1056 HRESULT hr
= D3DRM_OK
;
1058 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
1059 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
1060 iface
, source
, object_id
, iids
, iid_count
, flags
,
1061 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
1064 hr
= IDirect3DRMFrame_QueryInterface(parent_frame
, &IID_IDirect3DRMFrame3
, (void **)&parent_frame3
);
1066 hr
= IDirect3DRM3_Load(&d3drm
->IDirect3DRM3_iface
, source
, object_id
, iids
, iid_count
,
1067 flags
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame3
);
1069 IDirect3DRMFrame3_Release(parent_frame3
);
1074 static HRESULT WINAPI
d3drm2_Tick(IDirect3DRM2
*iface
, D3DVALUE tick
)
1076 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
1081 static HRESULT WINAPI
d3drm2_CreateProgressiveMesh(IDirect3DRM2
*iface
, IDirect3DRMProgressiveMesh
**mesh
)
1083 FIXME("iface %p, mesh %p stub!\n", iface
, mesh
);
1088 static const struct IDirect3DRM2Vtbl d3drm2_vtbl
=
1090 d3drm2_QueryInterface
,
1093 d3drm2_CreateObject
,
1096 d3drm2_CreateMeshBuilder
,
1098 d3drm2_CreateAnimation
,
1099 d3drm2_CreateAnimationSet
,
1100 d3drm2_CreateTexture
,
1102 d3drm2_CreateLightRGB
,
1103 d3drm2_CreateMaterial
,
1104 d3drm2_CreateDevice
,
1105 d3drm2_CreateDeviceFromSurface
,
1106 d3drm2_CreateDeviceFromD3D
,
1107 d3drm2_CreateDeviceFromClipper
,
1108 d3drm2_CreateTextureFromSurface
,
1109 d3drm2_CreateShadow
,
1110 d3drm2_CreateViewport
,
1112 d3drm2_CreateUserVisual
,
1114 d3drm2_LoadTextureFromResource
,
1115 d3drm2_SetSearchPath
,
1116 d3drm2_AddSearchPath
,
1117 d3drm2_GetSearchPath
,
1118 d3drm2_SetDefaultTextureColors
,
1119 d3drm2_SetDefaultTextureShades
,
1121 d3drm2_GetNamedObject
,
1122 d3drm2_EnumerateObjects
,
1125 d3drm2_CreateProgressiveMesh
,
1128 static HRESULT WINAPI
d3drm3_QueryInterface(IDirect3DRM3
*iface
, REFIID riid
, void **out
)
1130 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1132 return d3drm1_QueryInterface(&d3drm
->IDirect3DRM_iface
, riid
, out
);
1135 static ULONG WINAPI
d3drm3_AddRef(IDirect3DRM3
*iface
)
1137 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1138 ULONG refcount
= InterlockedIncrement(&d3drm
->ref3
);
1140 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
1143 InterlockedIncrement(&d3drm
->iface_count
);
1148 static ULONG WINAPI
d3drm3_Release(IDirect3DRM3
*iface
)
1150 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1151 ULONG refcount
= InterlockedDecrement(&d3drm
->ref3
);
1153 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
1155 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
1156 d3drm_destroy(d3drm
);
1161 static HRESULT WINAPI
d3drm3_CreateObject(IDirect3DRM3
*iface
,
1162 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
1164 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1172 HRESULT (*create_object
)(void **object
, IDirect3DRM
*d3drm
);
1176 {&CLSID_CDirect3DRMTexture
, d3drm_create_texture_object
},
1177 {&CLSID_CDirect3DRMDevice
, d3drm_create_device_object
},
1178 {&CLSID_CDirect3DRMViewport
, d3drm_create_viewport_object
},
1181 TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
1182 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
1185 return D3DRMERR_BADVALUE
;
1190 return D3DRMERR_BADVALUE
;
1195 FIXME("COM aggregation for outer IUnknown (%p) not implemented. Returning E_NOTIMPL.\n", outer
);
1200 for (i
= 0; i
< ARRAY_SIZE(object_table
); ++i
)
1202 if (IsEqualGUID(clsid
, object_table
[i
].clsid
))
1204 if (FAILED(hr
= object_table
[i
].create_object((void **)&object
, &d3drm
->IDirect3DRM_iface
)))
1212 if (i
== ARRAY_SIZE(object_table
))
1214 FIXME("%s not implemented. Returning CLASSFACTORY_E_FIRST.\n", debugstr_guid(clsid
));
1216 return CLASSFACTORY_E_FIRST
;
1219 if (FAILED(hr
= IUnknown_QueryInterface(object
, iid
, out
)))
1221 IUnknown_Release(object
);
1226 static HRESULT WINAPI
d3drm3_CreateFrame(IDirect3DRM3
*iface
,
1227 IDirect3DRMFrame3
*parent
, IDirect3DRMFrame3
**frame
)
1229 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1230 struct d3drm_frame
*object
;
1233 TRACE("iface %p, parent %p, frame %p.\n", iface
, parent
, frame
);
1235 if (FAILED(hr
= d3drm_frame_create(&object
, (IUnknown
*)parent
, &d3drm
->IDirect3DRM_iface
)))
1238 *frame
= &object
->IDirect3DRMFrame3_iface
;
1243 static HRESULT WINAPI
d3drm3_CreateMesh(IDirect3DRM3
*iface
, IDirect3DRMMesh
**mesh
)
1245 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
1247 return Direct3DRMMesh_create(mesh
);
1250 static HRESULT WINAPI
d3drm3_CreateMeshBuilder(IDirect3DRM3
*iface
, IDirect3DRMMeshBuilder3
**mesh_builder
)
1252 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
1254 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder3
, (IUnknown
**)mesh_builder
);
1257 static HRESULT WINAPI
d3drm3_CreateFace(IDirect3DRM3
*iface
, IDirect3DRMFace2
**face
)
1259 TRACE("iface %p, face %p.\n", iface
, face
);
1261 return Direct3DRMFace_create(&IID_IDirect3DRMFace2
, (IUnknown
**)face
);
1264 static HRESULT WINAPI
d3drm3_CreateAnimation(IDirect3DRM3
*iface
, IDirect3DRMAnimation2
**animation
)
1266 FIXME("iface %p, animation %p stub!\n", iface
, animation
);
1271 static HRESULT WINAPI
d3drm3_CreateAnimationSet(IDirect3DRM3
*iface
, IDirect3DRMAnimationSet2
**set
)
1273 FIXME("iface %p, set %p stub!\n", iface
, set
);
1278 static HRESULT WINAPI
d3drm3_CreateTexture(IDirect3DRM3
*iface
,
1279 D3DRMIMAGE
*image
, IDirect3DRMTexture3
**texture
)
1281 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1282 struct d3drm_texture
*object
;
1285 TRACE("iface %p, image %p, texture %p.\n", iface
, image
, texture
);
1288 return D3DRMERR_BADVALUE
;
1290 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1293 *texture
= &object
->IDirect3DRMTexture3_iface
;
1295 if (FAILED(IDirect3DRMTexture3_InitFromImage(*texture
, image
)))
1297 IDirect3DRMTexture3_Release(*texture
);
1299 return D3DRMERR_BADVALUE
;
1305 static HRESULT WINAPI
d3drm3_CreateLight(IDirect3DRM3
*iface
,
1306 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
1310 FIXME("iface %p, type %#x, color 0x%08x, light %p partial stub!\n", iface
, type
, color
, light
);
1312 if (SUCCEEDED(hr
= Direct3DRMLight_create((IUnknown
**)light
)))
1314 IDirect3DRMLight_SetType(*light
, type
);
1315 IDirect3DRMLight_SetColor(*light
, color
);
1321 static HRESULT WINAPI
d3drm3_CreateLightRGB(IDirect3DRM3
*iface
, D3DRMLIGHTTYPE type
,
1322 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
1326 FIXME("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p partial stub!\n",
1327 iface
, type
, red
, green
, blue
, light
);
1329 if (SUCCEEDED(hr
= Direct3DRMLight_create((IUnknown
**)light
)))
1331 IDirect3DRMLight_SetType(*light
, type
);
1332 IDirect3DRMLight_SetColorRGB(*light
, red
, green
, blue
);
1338 static HRESULT WINAPI
d3drm3_CreateMaterial(IDirect3DRM3
*iface
,
1339 D3DVALUE power
, IDirect3DRMMaterial2
**material
)
1343 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
1345 if (SUCCEEDED(hr
= Direct3DRMMaterial_create(material
)))
1346 IDirect3DRMMaterial2_SetPower(*material
, power
);
1351 static HRESULT WINAPI
d3drm3_CreateDevice(IDirect3DRM3
*iface
,
1352 DWORD width
, DWORD height
, IDirect3DRMDevice3
**device
)
1354 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1355 struct d3drm_device
*object
;
1358 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
1360 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1363 *device
= &object
->IDirect3DRMDevice3_iface
;
1368 static HRESULT WINAPI
d3drm3_CreateDeviceFromSurface(IDirect3DRM3
*iface
, GUID
*guid
,
1369 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, DWORD flags
, IDirect3DRMDevice3
**device
)
1371 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1372 struct d3drm_device
*object
;
1376 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, flags %#x, device %p.\n",
1377 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, flags
, device
);
1380 return D3DRMERR_BADVALUE
;
1383 if (!backbuffer
|| !ddraw
)
1384 return D3DRMERR_BADDEVICE
;
1386 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1389 use_z_surface
= !(flags
& D3DRMDEVICE_NOZBUFFER
);
1391 if (SUCCEEDED(hr
= d3drm_device_init(object
, 3, ddraw
, backbuffer
, use_z_surface
)))
1392 *device
= &object
->IDirect3DRMDevice3_iface
;
1394 d3drm_device_destroy(object
);
1399 static HRESULT WINAPI
d3drm3_CreateDeviceFromD3D(IDirect3DRM3
*iface
,
1400 IDirect3D2
*d3d
, IDirect3DDevice2
*d3d_device
, IDirect3DRMDevice3
**device
)
1402 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1403 struct d3drm_device
*object
;
1406 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
1407 iface
, d3d
, d3d_device
, device
);
1410 return D3DRMERR_BADVALUE
;
1413 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1416 if (FAILED(hr
= IDirect3DRMDevice3_InitFromD3D2(&object
->IDirect3DRMDevice3_iface
, d3d
, d3d_device
)))
1418 d3drm_device_destroy(object
);
1421 *device
= &object
->IDirect3DRMDevice3_iface
;
1426 static HRESULT WINAPI
d3drm3_CreateDeviceFromClipper(IDirect3DRM3
*iface
,
1427 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
1428 IDirect3DRMDevice3
**device
)
1430 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1431 struct d3drm_device
*object
;
1433 IDirectDrawSurface
*render_target
;
1436 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
1437 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
1440 return D3DRMERR_BADVALUE
;
1443 if (!clipper
|| !width
|| !height
)
1444 return D3DRMERR_BADVALUE
;
1446 hr
= DirectDrawCreate(NULL
, &ddraw
, NULL
);
1450 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1452 IDirectDraw_Release(ddraw
);
1456 hr
= d3drm_device_create_surfaces_from_clipper(object
, ddraw
, clipper
, width
, height
, &render_target
);
1459 IDirectDraw_Release(ddraw
);
1460 d3drm_device_destroy(object
);
1464 hr
= d3drm_device_init(object
, 3, ddraw
, render_target
, TRUE
);
1465 IDirectDraw_Release(ddraw
);
1466 IDirectDrawSurface_Release(render_target
);
1468 d3drm_device_destroy(object
);
1470 *device
= &object
->IDirect3DRMDevice3_iface
;
1475 static HRESULT WINAPI
d3drm3_CreateShadow(IDirect3DRM3
*iface
, IUnknown
*object
, IDirect3DRMLight
*light
,
1476 D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
, IDirect3DRMShadow2
**shadow
)
1478 FIXME("iface %p, object %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
1479 iface
, object
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
1484 static HRESULT WINAPI
d3drm3_CreateTextureFromSurface(IDirect3DRM3
*iface
,
1485 IDirectDrawSurface
*surface
, IDirect3DRMTexture3
**texture
)
1487 FIXME("iface %p, surface %p, texture %p stub!\n", iface
, surface
, texture
);
1492 static HRESULT WINAPI
d3drm3_CreateViewport(IDirect3DRM3
*iface
, IDirect3DRMDevice3
*device
,
1493 IDirect3DRMFrame3
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport2
**viewport
)
1495 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1496 struct d3drm_viewport
*object
;
1499 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
1500 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
1502 if (!device
|| !camera
)
1503 return D3DRMERR_BADOBJECT
;
1505 return D3DRMERR_BADVALUE
;
1507 if (FAILED(hr
= d3drm_viewport_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1510 *viewport
= &object
->IDirect3DRMViewport2_iface
;
1512 if (FAILED(hr
= IDirect3DRMViewport2_Init(*viewport
, device
, camera
, x
, y
, width
, height
)))
1514 IDirect3DRMViewport2_Release(*viewport
);
1516 return D3DRMERR_BADVALUE
;
1522 static HRESULT WINAPI
d3drm3_CreateWrap(IDirect3DRM3
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame3
*frame
,
1523 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
1524 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
1525 IDirect3DRMWrap
**wrap
)
1527 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
1528 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
1529 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
1534 static HRESULT WINAPI
d3drm3_CreateUserVisual(IDirect3DRM3
*iface
,
1535 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
1537 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface
, cb
, ctx
, visual
);
1542 static HRESULT WINAPI
d3drm3_LoadTexture(IDirect3DRM3
*iface
,
1543 const char *filename
, IDirect3DRMTexture3
**texture
)
1545 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1546 struct d3drm_texture
*object
;
1549 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
1551 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1554 *texture
= &object
->IDirect3DRMTexture3_iface
;
1559 static HRESULT WINAPI
d3drm3_LoadTextureFromResource(IDirect3DRM3
*iface
, HMODULE module
,
1560 const char *resource_name
, const char *resource_type
, IDirect3DRMTexture3
**texture
)
1562 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1563 struct d3drm_texture
*object
;
1566 FIXME("iface %p, module %p, resource_name %s, resource_type %s, texture %p stub!\n",
1567 iface
, module
, debugstr_a(resource_name
), debugstr_a(resource_type
), texture
);
1569 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1572 *texture
= &object
->IDirect3DRMTexture3_iface
;
1577 static HRESULT WINAPI
d3drm3_SetSearchPath(IDirect3DRM3
*iface
, const char *path
)
1579 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1584 static HRESULT WINAPI
d3drm3_AddSearchPath(IDirect3DRM3
*iface
, const char *path
)
1586 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1591 static HRESULT WINAPI
d3drm3_GetSearchPath(IDirect3DRM3
*iface
, DWORD
*size
, char *path
)
1593 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
1598 static HRESULT WINAPI
d3drm3_SetDefaultTextureColors(IDirect3DRM3
*iface
, DWORD color_count
)
1600 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
1605 static HRESULT WINAPI
d3drm3_SetDefaultTextureShades(IDirect3DRM3
*iface
, DWORD shade_count
)
1607 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
1612 static HRESULT WINAPI
d3drm3_GetDevices(IDirect3DRM3
*iface
, IDirect3DRMDeviceArray
**array
)
1614 FIXME("iface %p, array %p stub!\n", iface
, array
);
1619 static HRESULT WINAPI
d3drm3_GetNamedObject(IDirect3DRM3
*iface
,
1620 const char *name
, IDirect3DRMObject
**object
)
1622 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
1627 static HRESULT WINAPI
d3drm3_EnumerateObjects(IDirect3DRM3
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
1629 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
1634 static HRESULT
load_data(IDirect3DRM3
*iface
, IDirectXFileData
*data_object
, IID
**GUIDs
, DWORD nb_GUIDs
, D3DRMLOADCALLBACK LoadProc
,
1635 void *ArgLP
, D3DRMLOADTEXTURECALLBACK LoadTextureProc
, void *ArgLTP
, IDirect3DRMFrame3
*parent_frame
)
1637 HRESULT ret
= D3DRMERR_BADOBJECT
;
1641 BOOL requested
= FALSE
;
1643 hr
= IDirectXFileData_GetType(data_object
, &guid
);
1644 if (hr
!= DXFILE_OK
)
1647 TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid
));
1649 /* Load object only if it is top level and requested or if it is part of another object */
1651 if (IsEqualGUID(guid
, &TID_D3DRMMesh
))
1653 TRACE("Found TID_D3DRMMesh\n");
1655 for (i
= 0; i
< nb_GUIDs
; i
++)
1656 if (IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder
) ||
1657 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder2
) ||
1658 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder3
))
1664 if (requested
|| parent_frame
)
1666 IDirect3DRMMeshBuilder3
*meshbuilder
;
1668 TRACE("Load mesh data\n");
1670 hr
= IDirect3DRM3_CreateMeshBuilder(iface
, &meshbuilder
);
1673 hr
= load_mesh_data(meshbuilder
, data_object
, LoadTextureProc
, ArgLTP
);
1676 /* Only top level objects are notified */
1679 IDirect3DRMObject
*object
;
1681 hr
= IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder
, GUIDs
[i
], (void**)&object
);
1684 LoadProc(object
, GUIDs
[i
], ArgLP
);
1685 IDirect3DRMObject_Release(object
);
1690 IDirect3DRMFrame3_AddVisual(parent_frame
, (IUnknown
*)meshbuilder
);
1693 IDirect3DRMMeshBuilder3_Release(meshbuilder
);
1697 ERR("Cannot process mesh\n");
1700 else if (IsEqualGUID(guid
, &TID_D3DRMFrame
))
1702 TRACE("Found TID_D3DRMFrame\n");
1704 for (i
= 0; i
< nb_GUIDs
; i
++)
1705 if (IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame
) ||
1706 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame2
) ||
1707 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame3
))
1713 if (requested
|| parent_frame
)
1715 IDirect3DRMFrame3
*frame
;
1717 TRACE("Load frame data\n");
1719 hr
= IDirect3DRM3_CreateFrame(iface
, parent_frame
, &frame
);
1722 IDirectXFileObject
*child
;
1724 while (SUCCEEDED(hr
= IDirectXFileData_GetNextObject(data_object
, &child
)))
1726 IDirectXFileData
*data
;
1727 IDirectXFileDataReference
*reference
;
1728 IDirectXFileBinary
*binary
;
1730 if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
1731 &IID_IDirectXFileBinary
, (void **)&binary
)))
1733 FIXME("Binary Object not supported yet\n");
1734 IDirectXFileBinary_Release(binary
);
1736 else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
1737 &IID_IDirectXFileData
, (void **)&data
)))
1739 TRACE("Found Data Object\n");
1740 hr
= load_data(iface
, data
, GUIDs
, nb_GUIDs
, LoadProc
, ArgLP
, LoadTextureProc
, ArgLTP
, frame
);
1741 IDirectXFileData_Release(data
);
1743 else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
1744 &IID_IDirectXFileDataReference
, (void **)&reference
)))
1746 TRACE("Found Data Object Reference\n");
1747 IDirectXFileDataReference_Resolve(reference
, &data
);
1748 hr
= load_data(iface
, data
, GUIDs
, nb_GUIDs
, LoadProc
, ArgLP
, LoadTextureProc
, ArgLTP
, frame
);
1749 IDirectXFileData_Release(data
);
1750 IDirectXFileDataReference_Release(reference
);
1752 IDirectXFileObject_Release(child
);
1755 if (hr
!= DXFILEERR_NOMOREOBJECTS
)
1757 IDirect3DRMFrame3_Release(frame
);
1762 /* Only top level objects are notified */
1765 IDirect3DRMObject
*object
;
1767 hr
= IDirect3DRMFrame3_QueryInterface(frame
, GUIDs
[i
], (void**)&object
);
1770 LoadProc(object
, GUIDs
[i
], ArgLP
);
1771 IDirect3DRMObject_Release(object
);
1774 IDirect3DRMFrame3_Release(frame
);
1778 ERR("Cannot process frame\n");
1781 else if (IsEqualGUID(guid
, &TID_D3DRMMaterial
))
1783 TRACE("Found TID_D3DRMMaterial\n");
1785 /* Cannot be requested so nothing to do */
1787 else if (IsEqualGUID(guid
, &TID_D3DRMFrameTransformMatrix
))
1789 TRACE("Found TID_D3DRMFrameTransformMatrix\n");
1791 /* Cannot be requested */
1794 D3DRMMATRIX4D
*matrix
;
1797 TRACE("Load Frame Transform Matrix data\n");
1799 hr
= IDirectXFileData_GetData(data_object
, NULL
, &size
, (void**)&matrix
);
1800 if ((hr
!= DXFILE_OK
) || (size
!= sizeof(matrix
)))
1803 hr
= IDirect3DRMFrame3_AddTransform(parent_frame
, D3DRMCOMBINE_REPLACE
, *matrix
);
1810 FIXME("Found unknown TID %s\n", debugstr_guid(guid
));
1820 static HRESULT WINAPI
d3drm3_Load(IDirect3DRM3
*iface
, void *source
, void *object_id
, IID
**iids
,
1821 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
1822 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame3
*parent_frame
)
1824 DXFILELOADOPTIONS load_options
;
1825 IDirectXFile
*file
= NULL
;
1826 IDirectXFileEnumObject
*enum_object
= NULL
;
1827 IDirectXFileData
*data
= NULL
;
1831 struct d3drm_file_header
*header
;
1832 HRESULT ret
= D3DRMERR_BADOBJECT
;
1835 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
1836 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
1837 iface
, source
, object_id
, iids
, iid_count
, flags
,
1838 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
1840 TRACE("Looking for GUIDs:\n");
1841 for (i
= 0; i
< iid_count
; ++i
)
1842 TRACE("- %s (%s)\n", debugstr_guid(iids
[i
]), get_IID_string(iids
[i
]));
1844 if (flags
== D3DRMLOAD_FROMMEMORY
)
1846 load_options
= DXFILELOAD_FROMMEMORY
;
1848 else if (flags
== D3DRMLOAD_FROMFILE
)
1850 load_options
= DXFILELOAD_FROMFILE
;
1851 TRACE("Loading from file %s\n", debugstr_a(source
));
1855 FIXME("Load options %#x not supported yet.\n", flags
);
1859 hr
= DirectXFileCreate(&file
);
1860 if (hr
!= DXFILE_OK
)
1863 hr
= IDirectXFile_RegisterTemplates(file
, templates
, strlen(templates
));
1864 if (hr
!= DXFILE_OK
)
1867 hr
= IDirectXFile_CreateEnumObject(file
, source
, load_options
, &enum_object
);
1868 if (hr
!= DXFILE_OK
)
1871 hr
= IDirectXFileEnumObject_GetNextDataObject(enum_object
, &data
);
1872 if (hr
!= DXFILE_OK
)
1875 hr
= IDirectXFileData_GetType(data
, &pGuid
);
1876 if (hr
!= DXFILE_OK
)
1879 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid
));
1881 if (!IsEqualGUID(pGuid
, &TID_DXFILEHeader
))
1883 ret
= D3DRMERR_BADFILE
;
1887 hr
= IDirectXFileData_GetData(data
, NULL
, &size
, (void **)&header
);
1888 if ((hr
!= DXFILE_OK
) || (size
!= sizeof(*header
)))
1891 TRACE("Version is %u.%u, flags %#x.\n", header
->major
, header
->minor
, header
->flags
);
1893 /* Version must be 1.0.x */
1894 if ((header
->major
!= 1) || (header
->minor
!= 0))
1896 ret
= D3DRMERR_BADFILE
;
1900 IDirectXFileData_Release(data
);
1905 hr
= IDirectXFileEnumObject_GetNextDataObject(enum_object
, &data
);
1906 if (hr
== DXFILEERR_NOMOREOBJECTS
)
1908 TRACE("No more object\n");
1911 else if (hr
!= DXFILE_OK
)
1913 ret
= D3DRMERR_BADFILE
;
1917 ret
= load_data(iface
, data
, iids
, iid_count
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
1918 if (ret
!= D3DRM_OK
)
1921 IDirectXFileData_Release(data
);
1929 IDirectXFileData_Release(data
);
1931 IDirectXFileEnumObject_Release(enum_object
);
1933 IDirectXFile_Release(file
);
1938 static HRESULT WINAPI
d3drm3_Tick(IDirect3DRM3
*iface
, D3DVALUE tick
)
1940 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
1945 static HRESULT WINAPI
d3drm3_CreateProgressiveMesh(IDirect3DRM3
*iface
, IDirect3DRMProgressiveMesh
**mesh
)
1947 FIXME("iface %p, mesh %p stub!\n", iface
, mesh
);
1952 static HRESULT WINAPI
d3drm3_RegisterClient(IDirect3DRM3
*iface
, REFGUID guid
, DWORD
*id
)
1954 FIXME("iface %p, guid %s, id %p stub!\n", iface
, debugstr_guid(guid
), id
);
1959 static HRESULT WINAPI
d3drm3_UnregisterClient(IDirect3DRM3
*iface
, REFGUID guid
)
1961 FIXME("iface %p, guid %s stub!\n", iface
, debugstr_guid(guid
));
1966 static HRESULT WINAPI
d3drm3_CreateClippedVisual(IDirect3DRM3
*iface
,
1967 IDirect3DRMVisual
*visual
, IDirect3DRMClippedVisual
**clipped_visual
)
1969 FIXME("iface %p, visual %p, clipped_visual %p stub!\n", iface
, visual
, clipped_visual
);
1974 static HRESULT WINAPI
d3drm3_SetOptions(IDirect3DRM3
*iface
, DWORD flags
)
1976 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
1981 static HRESULT WINAPI
d3drm3_GetOptions(IDirect3DRM3
*iface
, DWORD
*flags
)
1983 FIXME("iface %p, flags %p stub!\n", iface
, flags
);
1988 static const struct IDirect3DRM3Vtbl d3drm3_vtbl
=
1990 d3drm3_QueryInterface
,
1993 d3drm3_CreateObject
,
1996 d3drm3_CreateMeshBuilder
,
1998 d3drm3_CreateAnimation
,
1999 d3drm3_CreateAnimationSet
,
2000 d3drm3_CreateTexture
,
2002 d3drm3_CreateLightRGB
,
2003 d3drm3_CreateMaterial
,
2004 d3drm3_CreateDevice
,
2005 d3drm3_CreateDeviceFromSurface
,
2006 d3drm3_CreateDeviceFromD3D
,
2007 d3drm3_CreateDeviceFromClipper
,
2008 d3drm3_CreateTextureFromSurface
,
2009 d3drm3_CreateShadow
,
2010 d3drm3_CreateViewport
,
2012 d3drm3_CreateUserVisual
,
2014 d3drm3_LoadTextureFromResource
,
2015 d3drm3_SetSearchPath
,
2016 d3drm3_AddSearchPath
,
2017 d3drm3_GetSearchPath
,
2018 d3drm3_SetDefaultTextureColors
,
2019 d3drm3_SetDefaultTextureShades
,
2021 d3drm3_GetNamedObject
,
2022 d3drm3_EnumerateObjects
,
2025 d3drm3_CreateProgressiveMesh
,
2026 d3drm3_RegisterClient
,
2027 d3drm3_UnregisterClient
,
2028 d3drm3_CreateClippedVisual
,
2033 HRESULT WINAPI
Direct3DRMCreate(IDirect3DRM
**d3drm
)
2035 struct d3drm
*object
;
2037 TRACE("d3drm %p.\n", d3drm
);
2039 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
2040 return E_OUTOFMEMORY
;
2042 object
->IDirect3DRM_iface
.lpVtbl
= &d3drm1_vtbl
;
2043 object
->IDirect3DRM2_iface
.lpVtbl
= &d3drm2_vtbl
;
2044 object
->IDirect3DRM3_iface
.lpVtbl
= &d3drm3_vtbl
;
2046 object
->iface_count
= 1;
2048 *d3drm
= &object
->IDirect3DRM_iface
;
2053 HRESULT WINAPI
DllCanUnloadNow(void)
2058 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, void **ppv
)
2060 TRACE("(%s, %s, %p): stub\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
2063 return E_INVALIDARG
;
2065 return CLASS_E_CLASSNOTAVAILABLE
;