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
;
87 static HRESULT
d3drm_create_face_object(void **object
, IDirect3DRM
*d3drm
)
89 struct d3drm_face
*face
;
92 if (FAILED(hr
= d3drm_face_create(&face
)))
95 *object
= &face
->IDirect3DRMFace_iface
;
100 static HRESULT
d3drm_create_mesh_builder_object(void **object
, IDirect3DRM
*d3drm
)
102 struct d3drm_mesh_builder
*mesh_builder
;
105 if (FAILED(hr
= d3drm_mesh_builder_create(&mesh_builder
, d3drm
)))
108 *object
= &mesh_builder
->IDirect3DRMMeshBuilder2_iface
;
113 static HRESULT
d3drm_create_frame_object(void **object
, IDirect3DRM
*d3drm
)
115 struct d3drm_frame
*frame
;
118 if (FAILED(hr
= d3drm_frame_create(&frame
, NULL
, d3drm
)))
121 *object
= &frame
->IDirect3DRMFrame_iface
;
126 static HRESULT
d3drm_create_light_object(void **object
, IDirect3DRM
*d3drm
)
128 struct d3drm_light
*light
;
131 if (FAILED(hr
= d3drm_light_create(&light
, d3drm
)))
134 *object
= &light
->IDirect3DRMLight_iface
;
139 static HRESULT
d3drm_create_material_object(void **object
, IDirect3DRM
*d3drm
)
141 struct d3drm_material
*material
;
144 if (FAILED(hr
= d3drm_material_create(&material
, d3drm
)))
147 *object
= &material
->IDirect3DRMMaterial2_iface
;
152 static HRESULT
d3drm_create_mesh_object(void **object
, IDirect3DRM
*d3drm
)
154 struct d3drm_mesh
*mesh
;
157 if (FAILED(hr
= d3drm_mesh_create(&mesh
, d3drm
)))
160 *object
= &mesh
->IDirect3DRMMesh_iface
;
165 static HRESULT
d3drm_create_animation_object(void **object
, IDirect3DRM
*d3drm
)
167 struct d3drm_animation
*animation
;
170 if (FAILED(hr
= d3drm_animation_create(&animation
, d3drm
)))
173 *object
= &animation
->IDirect3DRMAnimation_iface
;
178 static HRESULT
d3drm_create_wrap_object(void **object
, IDirect3DRM
*d3drm
)
180 struct d3drm_wrap
*wrap
;
183 if (FAILED(hr
= d3drm_wrap_create(&wrap
, d3drm
)))
186 *object
= &wrap
->IDirect3DRMWrap_iface
;
193 IDirect3DRM IDirect3DRM_iface
;
194 IDirect3DRM2 IDirect3DRM2_iface
;
195 IDirect3DRM3 IDirect3DRM3_iface
;
196 LONG ref1
, ref2
, ref3
, iface_count
;
199 static inline struct d3drm
*impl_from_IDirect3DRM(IDirect3DRM
*iface
)
201 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM_iface
);
204 static inline struct d3drm
*impl_from_IDirect3DRM2(IDirect3DRM2
*iface
)
206 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM2_iface
);
209 static inline struct d3drm
*impl_from_IDirect3DRM3(IDirect3DRM3
*iface
)
211 return CONTAINING_RECORD(iface
, struct d3drm
, IDirect3DRM3_iface
);
214 static void d3drm_destroy(struct d3drm
*d3drm
)
217 TRACE("d3drm object %p is being destroyed.\n", d3drm
);
220 static HRESULT WINAPI
d3drm1_QueryInterface(IDirect3DRM
*iface
, REFIID riid
, void **out
)
222 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
224 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
226 if (IsEqualGUID(riid
, &IID_IDirect3DRM
)
227 || IsEqualGUID(riid
, &IID_IUnknown
))
229 *out
= &d3drm
->IDirect3DRM_iface
;
231 else if (IsEqualGUID(riid
, &IID_IDirect3DRM2
))
233 *out
= &d3drm
->IDirect3DRM2_iface
;
235 else if (IsEqualGUID(riid
, &IID_IDirect3DRM3
))
237 *out
= &d3drm
->IDirect3DRM3_iface
;
242 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid
));
243 return CLASS_E_CLASSNOTAVAILABLE
;
246 IUnknown_AddRef((IUnknown
*)*out
);
250 static ULONG WINAPI
d3drm1_AddRef(IDirect3DRM
*iface
)
252 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
253 ULONG refcount
= InterlockedIncrement(&d3drm
->ref1
);
255 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
258 InterlockedIncrement(&d3drm
->iface_count
);
263 static ULONG WINAPI
d3drm1_Release(IDirect3DRM
*iface
)
265 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
266 ULONG refcount
= InterlockedDecrement(&d3drm
->ref1
);
268 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
270 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
271 d3drm_destroy(d3drm
);
276 static HRESULT WINAPI
d3drm1_CreateObject(IDirect3DRM
*iface
,
277 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
279 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
281 TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
282 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
284 return IDirect3DRM3_CreateObject(&d3drm
->IDirect3DRM3_iface
, clsid
, outer
, iid
, out
);
287 static HRESULT WINAPI
d3drm1_CreateFrame(IDirect3DRM
*iface
,
288 IDirect3DRMFrame
*parent_frame
, IDirect3DRMFrame
**frame
)
290 struct d3drm_frame
*object
;
293 TRACE("iface %p, parent_frame %p, frame %p.\n", iface
, parent_frame
, frame
);
295 if (FAILED(hr
= d3drm_frame_create(&object
, (IUnknown
*)parent_frame
, iface
)))
298 *frame
= &object
->IDirect3DRMFrame_iface
;
303 static HRESULT WINAPI
d3drm1_CreateMesh(IDirect3DRM
*iface
, IDirect3DRMMesh
**mesh
)
305 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
307 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
309 return IDirect3DRM3_CreateMesh(&d3drm
->IDirect3DRM3_iface
, mesh
);
312 static HRESULT WINAPI
d3drm1_CreateMeshBuilder(IDirect3DRM
*iface
, IDirect3DRMMeshBuilder
**mesh_builder
)
314 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
316 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
318 return IDirect3DRM2_CreateMeshBuilder(&d3drm
->IDirect3DRM2_iface
, (IDirect3DRMMeshBuilder2
**)mesh_builder
);
321 static HRESULT WINAPI
d3drm1_CreateFace(IDirect3DRM
*iface
, IDirect3DRMFace
**face
)
323 struct d3drm_face
*object
;
326 TRACE("iface %p, face %p.\n", iface
, face
);
328 if (FAILED(hr
= d3drm_face_create(&object
)))
331 *face
= &object
->IDirect3DRMFace_iface
;
336 static HRESULT WINAPI
d3drm1_CreateAnimation(IDirect3DRM
*iface
, IDirect3DRMAnimation
**animation
)
338 struct d3drm_animation
*object
;
341 TRACE("iface %p, animation %p.\n", iface
, animation
);
344 return D3DRMERR_BADVALUE
;
346 if (FAILED(hr
= d3drm_animation_create(&object
, iface
)))
349 *animation
= &object
->IDirect3DRMAnimation_iface
;
354 static HRESULT WINAPI
d3drm1_CreateAnimationSet(IDirect3DRM
*iface
, IDirect3DRMAnimationSet
**set
)
356 FIXME("iface %p, set %p stub!\n", iface
, set
);
361 static HRESULT WINAPI
d3drm1_CreateTexture(IDirect3DRM
*iface
,
362 D3DRMIMAGE
*image
, IDirect3DRMTexture
**texture
)
364 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
365 IDirect3DRMTexture3
*texture3
;
368 TRACE("iface %p, image %p, texture %p.\n", iface
, image
, texture
);
371 return D3DRMERR_BADVALUE
;
373 if (FAILED(hr
= IDirect3DRM3_CreateTexture(&d3drm
->IDirect3DRM3_iface
, image
, &texture3
)))
379 hr
= IDirect3DRMTexture3_QueryInterface(texture3
, &IID_IDirect3DRMTexture
, (void **)texture
);
380 IDirect3DRMTexture3_Release(texture3
);
385 static HRESULT WINAPI
d3drm1_CreateLight(IDirect3DRM
*iface
,
386 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
388 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
390 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface
, type
, color
, light
);
392 return IDirect3DRM3_CreateLight(&d3drm
->IDirect3DRM3_iface
, type
, color
, light
);
395 static HRESULT WINAPI
d3drm1_CreateLightRGB(IDirect3DRM
*iface
, D3DRMLIGHTTYPE type
,
396 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
398 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
400 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
401 iface
, type
, red
, green
, blue
, light
);
403 return IDirect3DRM3_CreateLightRGB(&d3drm
->IDirect3DRM3_iface
, type
, red
, green
, blue
, light
);
406 static HRESULT WINAPI
d3drm1_CreateMaterial(IDirect3DRM
*iface
,
407 D3DVALUE power
, IDirect3DRMMaterial
**material
)
409 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
411 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
413 return IDirect3DRM3_CreateMaterial(&d3drm
->IDirect3DRM3_iface
, power
, (IDirect3DRMMaterial2
**)material
);
416 static HRESULT WINAPI
d3drm1_CreateDevice(IDirect3DRM
*iface
,
417 DWORD width
, DWORD height
, IDirect3DRMDevice
**device
)
419 struct d3drm_device
*object
;
422 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
424 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
427 *device
= &object
->IDirect3DRMDevice_iface
;
432 static HRESULT WINAPI
d3drm1_CreateDeviceFromSurface(IDirect3DRM
*iface
, GUID
*guid
,
433 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, IDirect3DRMDevice
**device
)
435 struct d3drm_device
*object
;
438 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
439 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, device
);
442 return D3DRMERR_BADVALUE
;
445 if (!backbuffer
|| !ddraw
)
446 return D3DRMERR_BADDEVICE
;
448 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
451 if (SUCCEEDED(hr
= d3drm_device_init(object
, 1, ddraw
, backbuffer
, TRUE
)))
452 *device
= &object
->IDirect3DRMDevice_iface
;
454 d3drm_device_destroy(object
);
459 static HRESULT WINAPI
d3drm1_CreateDeviceFromD3D(IDirect3DRM
*iface
,
460 IDirect3D
*d3d
, IDirect3DDevice
*d3d_device
, IDirect3DRMDevice
**device
)
462 struct d3drm_device
*object
;
464 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
465 iface
, d3d
, d3d_device
, device
);
468 return D3DRMERR_BADVALUE
;
471 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
474 if (FAILED(hr
= IDirect3DRMDevice_InitFromD3D(&object
->IDirect3DRMDevice_iface
, d3d
, d3d_device
)))
476 d3drm_device_destroy(object
);
479 *device
= &object
->IDirect3DRMDevice_iface
;
484 static HRESULT WINAPI
d3drm1_CreateDeviceFromClipper(IDirect3DRM
*iface
,
485 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
486 IDirect3DRMDevice
**device
)
488 struct d3drm_device
*object
;
490 IDirectDrawSurface
*render_target
;
493 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
494 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
497 return D3DRMERR_BADVALUE
;
500 if (!clipper
|| !width
|| !height
)
501 return D3DRMERR_BADVALUE
;
503 hr
= DirectDrawCreate(NULL
, &ddraw
, NULL
);
507 if (FAILED(hr
= d3drm_device_create(&object
, iface
)))
509 IDirectDraw_Release(ddraw
);
513 hr
= d3drm_device_create_surfaces_from_clipper(object
, ddraw
, clipper
, width
, height
, &render_target
);
516 IDirectDraw_Release(ddraw
);
517 d3drm_device_destroy(object
);
521 hr
= d3drm_device_init(object
, 1, ddraw
, render_target
, TRUE
);
522 IDirectDraw_Release(ddraw
);
523 IDirectDrawSurface_Release(render_target
);
525 d3drm_device_destroy(object
);
527 *device
= &object
->IDirect3DRMDevice_iface
;
532 static HRESULT WINAPI
d3drm1_CreateTextureFromSurface(IDirect3DRM
*iface
,
533 IDirectDrawSurface
*surface
, IDirect3DRMTexture
**texture
)
535 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
536 IDirect3DRMTexture3
*texture3
;
539 TRACE("iface %p, surface %p, texture %p.\n", iface
, surface
, texture
);
542 return D3DRMERR_BADVALUE
;
544 if (FAILED(hr
= IDirect3DRM3_CreateTextureFromSurface(&d3drm
->IDirect3DRM3_iface
, surface
, &texture3
)))
550 hr
= IDirect3DRMTexture3_QueryInterface(texture3
, &IID_IDirect3DRMTexture
, (void **)texture
);
551 IDirect3DRMTexture3_Release(texture3
);
556 static HRESULT WINAPI
d3drm1_CreateShadow(IDirect3DRM
*iface
, IDirect3DRMVisual
*visual
,
557 IDirect3DRMLight
*light
, D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
,
558 IDirect3DRMVisual
**shadow
)
560 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
561 iface
, visual
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
566 static HRESULT WINAPI
d3drm1_CreateViewport(IDirect3DRM
*iface
, IDirect3DRMDevice
*device
,
567 IDirect3DRMFrame
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport
**viewport
)
569 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
570 IDirect3DRMDevice3
*device3
;
571 IDirect3DRMFrame3
*camera3
;
572 IDirect3DRMViewport2
*viewport2
;
575 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
576 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
578 if (!device
|| !camera
)
579 return D3DRMERR_BADOBJECT
;
581 return D3DRMERR_BADVALUE
;
583 if (FAILED(hr
= IDirect3DRMDevice_QueryInterface(device
, &IID_IDirect3DRMDevice3
, (void **)&device3
)))
586 if (FAILED(hr
= IDirect3DRMFrame_QueryInterface(camera
, &IID_IDirect3DRMFrame3
, (void **)&camera3
)))
588 IDirect3DRMDevice3_Release(device3
);
592 hr
= IDirect3DRM3_CreateViewport(&d3drm
->IDirect3DRM3_iface
, device3
, camera3
, x
, y
, width
, height
, &viewport2
);
593 IDirect3DRMDevice3_Release(device3
);
594 IDirect3DRMFrame3_Release(camera3
);
598 hr
= IDirect3DRMViewport2_QueryInterface(viewport2
, &IID_IDirect3DRMViewport
, (void **)viewport
);
599 IDirect3DRMViewport2_Release(viewport2
);
604 static HRESULT WINAPI
d3drm1_CreateWrap(IDirect3DRM
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame
*frame
,
605 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
606 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
607 IDirect3DRMWrap
**wrap
)
609 struct d3drm_wrap
*object
;
612 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
613 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p, semi-stub.\n",
614 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
617 return D3DRMERR_BADVALUE
;
619 if (FAILED(hr
= d3drm_wrap_create(&object
, iface
)))
622 *wrap
= &object
->IDirect3DRMWrap_iface
;
627 static HRESULT WINAPI
d3drm1_CreateUserVisual(IDirect3DRM
*iface
,
628 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
630 FIXME("iface %p, cb %p, ctx %p visual %p stub!\n", iface
, cb
, ctx
, visual
);
635 static HRESULT WINAPI
d3drm1_LoadTexture(IDirect3DRM
*iface
,
636 const char *filename
, IDirect3DRMTexture
**texture
)
638 struct d3drm_texture
*object
;
641 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
643 if (FAILED(hr
= d3drm_texture_create(&object
, iface
)))
646 *texture
= &object
->IDirect3DRMTexture_iface
;
651 static HRESULT WINAPI
d3drm1_LoadTextureFromResource(IDirect3DRM
*iface
,
652 HRSRC resource
, IDirect3DRMTexture
**texture
)
654 struct d3drm_texture
*object
;
657 FIXME("iface %p, resource %p, texture %p stub!\n", iface
, resource
, texture
);
659 if (FAILED(hr
= d3drm_texture_create(&object
, iface
)))
662 *texture
= &object
->IDirect3DRMTexture_iface
;
667 static HRESULT WINAPI
d3drm1_SetSearchPath(IDirect3DRM
*iface
, const char *path
)
669 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
674 static HRESULT WINAPI
d3drm1_AddSearchPath(IDirect3DRM
*iface
, const char *path
)
676 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
681 static HRESULT WINAPI
d3drm1_GetSearchPath(IDirect3DRM
*iface
, DWORD
*size
, char *path
)
683 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
688 static HRESULT WINAPI
d3drm1_SetDefaultTextureColors(IDirect3DRM
*iface
, DWORD color_count
)
690 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
695 static HRESULT WINAPI
d3drm1_SetDefaultTextureShades(IDirect3DRM
*iface
, DWORD shade_count
)
697 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
702 static HRESULT WINAPI
d3drm1_GetDevices(IDirect3DRM
*iface
, IDirect3DRMDeviceArray
**array
)
704 FIXME("iface %p, array %p stub!\n", iface
, array
);
709 static HRESULT WINAPI
d3drm1_GetNamedObject(IDirect3DRM
*iface
,
710 const char *name
, IDirect3DRMObject
**object
)
712 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
717 static HRESULT WINAPI
d3drm1_EnumerateObjects(IDirect3DRM
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
719 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
724 static HRESULT WINAPI
d3drm1_Load(IDirect3DRM
*iface
, void *source
, void *object_id
, IID
**iids
,
725 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
726 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame
*parent_frame
)
728 struct d3drm
*d3drm
= impl_from_IDirect3DRM(iface
);
729 IDirect3DRMFrame3
*parent_frame3
= NULL
;
730 HRESULT hr
= D3DRM_OK
;
732 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
733 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
734 iface
, source
, object_id
, iids
, iid_count
, flags
,
735 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
738 hr
= IDirect3DRMFrame_QueryInterface(parent_frame
, &IID_IDirect3DRMFrame3
, (void **)&parent_frame3
);
740 hr
= IDirect3DRM3_Load(&d3drm
->IDirect3DRM3_iface
, source
, object_id
, iids
, iid_count
,
741 flags
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame3
);
743 IDirect3DRMFrame3_Release(parent_frame3
);
748 static HRESULT WINAPI
d3drm1_Tick(IDirect3DRM
*iface
, D3DVALUE tick
)
750 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
755 static const struct IDirect3DRMVtbl d3drm1_vtbl
=
757 d3drm1_QueryInterface
,
763 d3drm1_CreateMeshBuilder
,
765 d3drm1_CreateAnimation
,
766 d3drm1_CreateAnimationSet
,
767 d3drm1_CreateTexture
,
769 d3drm1_CreateLightRGB
,
770 d3drm1_CreateMaterial
,
772 d3drm1_CreateDeviceFromSurface
,
773 d3drm1_CreateDeviceFromD3D
,
774 d3drm1_CreateDeviceFromClipper
,
775 d3drm1_CreateTextureFromSurface
,
777 d3drm1_CreateViewport
,
779 d3drm1_CreateUserVisual
,
781 d3drm1_LoadTextureFromResource
,
782 d3drm1_SetSearchPath
,
783 d3drm1_AddSearchPath
,
784 d3drm1_GetSearchPath
,
785 d3drm1_SetDefaultTextureColors
,
786 d3drm1_SetDefaultTextureShades
,
788 d3drm1_GetNamedObject
,
789 d3drm1_EnumerateObjects
,
794 static HRESULT WINAPI
d3drm2_QueryInterface(IDirect3DRM2
*iface
, REFIID riid
, void **out
)
796 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
798 return d3drm1_QueryInterface(&d3drm
->IDirect3DRM_iface
, riid
, out
);
801 static ULONG WINAPI
d3drm2_AddRef(IDirect3DRM2
*iface
)
803 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
804 ULONG refcount
= InterlockedIncrement(&d3drm
->ref2
);
806 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
809 InterlockedIncrement(&d3drm
->iface_count
);
814 static ULONG WINAPI
d3drm2_Release(IDirect3DRM2
*iface
)
816 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
817 ULONG refcount
= InterlockedDecrement(&d3drm
->ref2
);
819 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
821 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
822 d3drm_destroy(d3drm
);
827 static HRESULT WINAPI
d3drm2_CreateObject(IDirect3DRM2
*iface
,
828 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
830 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
832 TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
833 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
835 return IDirect3DRM3_CreateObject(&d3drm
->IDirect3DRM3_iface
, clsid
, outer
, iid
, out
);
838 static HRESULT WINAPI
d3drm2_CreateFrame(IDirect3DRM2
*iface
,
839 IDirect3DRMFrame
*parent_frame
, IDirect3DRMFrame2
**frame
)
841 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
842 struct d3drm_frame
*object
;
845 TRACE("iface %p, parent_frame %p, frame %p.\n", iface
, parent_frame
, frame
);
847 if (FAILED(hr
= d3drm_frame_create(&object
, (IUnknown
*)parent_frame
, &d3drm
->IDirect3DRM_iface
)))
850 *frame
= &object
->IDirect3DRMFrame2_iface
;
855 static HRESULT WINAPI
d3drm2_CreateMesh(IDirect3DRM2
*iface
, IDirect3DRMMesh
**mesh
)
857 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
859 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
861 return IDirect3DRM3_CreateMesh(&d3drm
->IDirect3DRM3_iface
, mesh
);
864 static HRESULT WINAPI
d3drm2_CreateMeshBuilder(IDirect3DRM2
*iface
, IDirect3DRMMeshBuilder2
**mesh_builder
)
866 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
867 struct d3drm_mesh_builder
*object
;
870 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
872 if (FAILED(hr
= d3drm_mesh_builder_create(&object
, &d3drm
->IDirect3DRM_iface
)))
875 *mesh_builder
= &object
->IDirect3DRMMeshBuilder2_iface
;
880 static HRESULT WINAPI
d3drm2_CreateFace(IDirect3DRM2
*iface
, IDirect3DRMFace
**face
)
882 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
884 TRACE("iface %p, face %p.\n", iface
, face
);
886 return IDirect3DRM_CreateFace(&d3drm
->IDirect3DRM_iface
, face
);
889 static HRESULT WINAPI
d3drm2_CreateAnimation(IDirect3DRM2
*iface
, IDirect3DRMAnimation
**animation
)
891 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
893 TRACE("iface %p, animation %p.\n", iface
, animation
);
895 return IDirect3DRM_CreateAnimation(&d3drm
->IDirect3DRM_iface
, animation
);
898 static HRESULT WINAPI
d3drm2_CreateAnimationSet(IDirect3DRM2
*iface
, IDirect3DRMAnimationSet
**set
)
900 FIXME("iface %p, set %p stub!\n", iface
, set
);
905 static HRESULT WINAPI
d3drm2_CreateTexture(IDirect3DRM2
*iface
,
906 D3DRMIMAGE
*image
, IDirect3DRMTexture2
**texture
)
908 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
909 IDirect3DRMTexture3
*texture3
;
912 TRACE("iface %p, image %p, texture %p.\n", iface
, image
, texture
);
915 return D3DRMERR_BADVALUE
;
917 if (FAILED(hr
= IDirect3DRM3_CreateTexture(&d3drm
->IDirect3DRM3_iface
, image
, &texture3
)))
923 hr
= IDirect3DRMTexture3_QueryInterface(texture3
, &IID_IDirect3DRMTexture2
, (void **)texture
);
924 IDirect3DRMTexture3_Release(texture3
);
929 static HRESULT WINAPI
d3drm2_CreateLight(IDirect3DRM2
*iface
,
930 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
932 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
934 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface
, type
, color
, light
);
936 return IDirect3DRM3_CreateLight(&d3drm
->IDirect3DRM3_iface
, type
, color
, light
);
939 static HRESULT WINAPI
d3drm2_CreateLightRGB(IDirect3DRM2
*iface
, D3DRMLIGHTTYPE type
,
940 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
942 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
944 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
945 iface
, type
, red
, green
, blue
, light
);
947 return IDirect3DRM3_CreateLightRGB(&d3drm
->IDirect3DRM3_iface
, type
, red
, green
, blue
, light
);
950 static HRESULT WINAPI
d3drm2_CreateMaterial(IDirect3DRM2
*iface
,
951 D3DVALUE power
, IDirect3DRMMaterial
**material
)
953 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
955 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
957 return IDirect3DRM3_CreateMaterial(&d3drm
->IDirect3DRM3_iface
, power
, (IDirect3DRMMaterial2
**)material
);
960 static HRESULT WINAPI
d3drm2_CreateDevice(IDirect3DRM2
*iface
,
961 DWORD width
, DWORD height
, IDirect3DRMDevice2
**device
)
963 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
964 struct d3drm_device
*object
;
967 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
969 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
972 *device
= &object
->IDirect3DRMDevice2_iface
;
977 static HRESULT WINAPI
d3drm2_CreateDeviceFromSurface(IDirect3DRM2
*iface
, GUID
*guid
,
978 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, IDirect3DRMDevice2
**device
)
980 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
981 IDirect3DRMDevice3
*device3
;
983 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
984 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, device
);
987 return D3DRMERR_BADVALUE
;
989 hr
= IDirect3DRM3_CreateDeviceFromSurface(&d3drm
->IDirect3DRM3_iface
, guid
, ddraw
, backbuffer
, 0, &device3
);
993 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void**)device
);
994 IDirect3DRMDevice3_Release(device3
);
999 static HRESULT WINAPI
d3drm2_CreateDeviceFromD3D(IDirect3DRM2
*iface
,
1000 IDirect3D2
*d3d
, IDirect3DDevice2
*d3d_device
, IDirect3DRMDevice2
**device
)
1002 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1003 IDirect3DRMDevice3
*device3
;
1006 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
1007 iface
, d3d
, d3d_device
, device
);
1010 return D3DRMERR_BADVALUE
;
1013 hr
= IDirect3DRM3_CreateDeviceFromD3D(&d3drm
->IDirect3DRM3_iface
, d3d
, d3d_device
, &device3
);
1017 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void **)device
);
1018 IDirect3DRMDevice3_Release(device3
);
1023 static HRESULT WINAPI
d3drm2_CreateDeviceFromClipper(IDirect3DRM2
*iface
,
1024 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
1025 IDirect3DRMDevice2
**device
)
1027 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1028 IDirect3DRMDevice3
*device3
;
1031 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
1032 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
1035 return D3DRMERR_BADVALUE
;
1037 hr
= IDirect3DRM3_CreateDeviceFromClipper(&d3drm
->IDirect3DRM3_iface
, clipper
, guid
, width
, height
, &device3
);
1041 hr
= IDirect3DRMDevice3_QueryInterface(device3
, &IID_IDirect3DRMDevice2
, (void**)device
);
1042 IDirect3DRMDevice3_Release(device3
);
1047 static HRESULT WINAPI
d3drm2_CreateTextureFromSurface(IDirect3DRM2
*iface
,
1048 IDirectDrawSurface
*surface
, IDirect3DRMTexture2
**texture
)
1050 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1051 IDirect3DRMTexture3
*texture3
;
1054 TRACE("iface %p, surface %p, texture %p.\n", iface
, surface
, texture
);
1057 return D3DRMERR_BADVALUE
;
1059 if (FAILED(hr
= IDirect3DRM3_CreateTextureFromSurface(&d3drm
->IDirect3DRM3_iface
, surface
, &texture3
)))
1065 hr
= IDirect3DRMTexture3_QueryInterface(texture3
, &IID_IDirect3DRMTexture
, (void **)texture
);
1066 IDirect3DRMTexture3_Release(texture3
);
1071 static HRESULT WINAPI
d3drm2_CreateShadow(IDirect3DRM2
*iface
, IDirect3DRMVisual
*visual
,
1072 IDirect3DRMLight
*light
, D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
,
1073 IDirect3DRMVisual
**shadow
)
1075 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
1076 iface
, visual
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
1081 static HRESULT WINAPI
d3drm2_CreateViewport(IDirect3DRM2
*iface
, IDirect3DRMDevice
*device
,
1082 IDirect3DRMFrame
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport
**viewport
)
1084 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1085 IDirect3DRMDevice3
*device3
;
1086 IDirect3DRMFrame3
*camera3
;
1087 IDirect3DRMViewport2
*viewport2
;
1090 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
1091 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
1093 if (!device
|| !camera
)
1094 return D3DRMERR_BADOBJECT
;
1096 return D3DRMERR_BADVALUE
;
1098 if (FAILED(hr
= IDirect3DRMDevice_QueryInterface(device
, &IID_IDirect3DRMDevice3
, (void **)&device3
)))
1101 if (FAILED(hr
= IDirect3DRMFrame_QueryInterface(camera
, &IID_IDirect3DRMFrame3
, (void **)&camera3
)))
1103 IDirect3DRMDevice3_Release(device3
);
1107 hr
= IDirect3DRM3_CreateViewport(&d3drm
->IDirect3DRM3_iface
, device3
, camera3
, x
, y
, width
, height
, &viewport2
);
1108 IDirect3DRMDevice3_Release(device3
);
1109 IDirect3DRMFrame3_Release(camera3
);
1113 hr
= IDirect3DRMViewport2_QueryInterface(viewport2
, &IID_IDirect3DRMViewport
, (void **)viewport
);
1114 IDirect3DRMViewport2_Release(viewport2
);
1119 static HRESULT WINAPI
d3drm2_CreateWrap(IDirect3DRM2
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame
*frame
,
1120 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
1121 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
1122 IDirect3DRMWrap
**wrap
)
1124 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1126 TRACE("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
1127 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p.\n",
1128 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
1130 return IDirect3DRM_CreateWrap(&d3drm
->IDirect3DRM_iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
,
1131 ou
, ov
, su
, sv
, wrap
);
1134 static HRESULT WINAPI
d3drm2_CreateUserVisual(IDirect3DRM2
*iface
,
1135 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
1137 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface
, cb
, ctx
, visual
);
1142 static HRESULT WINAPI
d3drm2_LoadTexture(IDirect3DRM2
*iface
,
1143 const char *filename
, IDirect3DRMTexture2
**texture
)
1145 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1146 struct d3drm_texture
*object
;
1149 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
1151 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1154 *texture
= &object
->IDirect3DRMTexture2_iface
;
1159 static HRESULT WINAPI
d3drm2_LoadTextureFromResource(IDirect3DRM2
*iface
, HMODULE module
,
1160 const char *resource_name
, const char *resource_type
, IDirect3DRMTexture2
**texture
)
1162 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1163 struct d3drm_texture
*object
;
1166 FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n",
1167 iface
, debugstr_a(resource_name
), debugstr_a(resource_type
), texture
);
1169 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1172 *texture
= &object
->IDirect3DRMTexture2_iface
;
1177 static HRESULT WINAPI
d3drm2_SetSearchPath(IDirect3DRM2
*iface
, const char *path
)
1179 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1184 static HRESULT WINAPI
d3drm2_AddSearchPath(IDirect3DRM2
*iface
, const char *path
)
1186 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1191 static HRESULT WINAPI
d3drm2_GetSearchPath(IDirect3DRM2
*iface
, DWORD
*size
, char *path
)
1193 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
1198 static HRESULT WINAPI
d3drm2_SetDefaultTextureColors(IDirect3DRM2
*iface
, DWORD color_count
)
1200 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
1205 static HRESULT WINAPI
d3drm2_SetDefaultTextureShades(IDirect3DRM2
*iface
, DWORD shade_count
)
1207 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
1212 static HRESULT WINAPI
d3drm2_GetDevices(IDirect3DRM2
*iface
, IDirect3DRMDeviceArray
**array
)
1214 FIXME("iface %p, array %p stub!\n", iface
, array
);
1219 static HRESULT WINAPI
d3drm2_GetNamedObject(IDirect3DRM2
*iface
,
1220 const char *name
, IDirect3DRMObject
**object
)
1222 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
1227 static HRESULT WINAPI
d3drm2_EnumerateObjects(IDirect3DRM2
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
1229 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
1234 static HRESULT WINAPI
d3drm2_Load(IDirect3DRM2
*iface
, void *source
, void *object_id
, IID
**iids
,
1235 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
1236 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame
*parent_frame
)
1238 struct d3drm
*d3drm
= impl_from_IDirect3DRM2(iface
);
1239 IDirect3DRMFrame3
*parent_frame3
= NULL
;
1240 HRESULT hr
= D3DRM_OK
;
1242 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
1243 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
1244 iface
, source
, object_id
, iids
, iid_count
, flags
,
1245 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
1248 hr
= IDirect3DRMFrame_QueryInterface(parent_frame
, &IID_IDirect3DRMFrame3
, (void **)&parent_frame3
);
1250 hr
= IDirect3DRM3_Load(&d3drm
->IDirect3DRM3_iface
, source
, object_id
, iids
, iid_count
,
1251 flags
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame3
);
1253 IDirect3DRMFrame3_Release(parent_frame3
);
1258 static HRESULT WINAPI
d3drm2_Tick(IDirect3DRM2
*iface
, D3DVALUE tick
)
1260 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
1265 static HRESULT WINAPI
d3drm2_CreateProgressiveMesh(IDirect3DRM2
*iface
, IDirect3DRMProgressiveMesh
**mesh
)
1267 FIXME("iface %p, mesh %p stub!\n", iface
, mesh
);
1272 static const struct IDirect3DRM2Vtbl d3drm2_vtbl
=
1274 d3drm2_QueryInterface
,
1277 d3drm2_CreateObject
,
1280 d3drm2_CreateMeshBuilder
,
1282 d3drm2_CreateAnimation
,
1283 d3drm2_CreateAnimationSet
,
1284 d3drm2_CreateTexture
,
1286 d3drm2_CreateLightRGB
,
1287 d3drm2_CreateMaterial
,
1288 d3drm2_CreateDevice
,
1289 d3drm2_CreateDeviceFromSurface
,
1290 d3drm2_CreateDeviceFromD3D
,
1291 d3drm2_CreateDeviceFromClipper
,
1292 d3drm2_CreateTextureFromSurface
,
1293 d3drm2_CreateShadow
,
1294 d3drm2_CreateViewport
,
1296 d3drm2_CreateUserVisual
,
1298 d3drm2_LoadTextureFromResource
,
1299 d3drm2_SetSearchPath
,
1300 d3drm2_AddSearchPath
,
1301 d3drm2_GetSearchPath
,
1302 d3drm2_SetDefaultTextureColors
,
1303 d3drm2_SetDefaultTextureShades
,
1305 d3drm2_GetNamedObject
,
1306 d3drm2_EnumerateObjects
,
1309 d3drm2_CreateProgressiveMesh
,
1312 static HRESULT WINAPI
d3drm3_QueryInterface(IDirect3DRM3
*iface
, REFIID riid
, void **out
)
1314 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1316 return d3drm1_QueryInterface(&d3drm
->IDirect3DRM_iface
, riid
, out
);
1319 static ULONG WINAPI
d3drm3_AddRef(IDirect3DRM3
*iface
)
1321 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1322 ULONG refcount
= InterlockedIncrement(&d3drm
->ref3
);
1324 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
1327 InterlockedIncrement(&d3drm
->iface_count
);
1332 static ULONG WINAPI
d3drm3_Release(IDirect3DRM3
*iface
)
1334 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1335 ULONG refcount
= InterlockedDecrement(&d3drm
->ref3
);
1337 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
1339 if (!refcount
&& !InterlockedDecrement(&d3drm
->iface_count
))
1340 d3drm_destroy(d3drm
);
1345 static HRESULT WINAPI
d3drm3_CreateObject(IDirect3DRM3
*iface
,
1346 REFCLSID clsid
, IUnknown
*outer
, REFIID iid
, void **out
)
1348 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1356 HRESULT (*create_object
)(void **object
, IDirect3DRM
*d3drm
);
1360 {&CLSID_CDirect3DRMTexture
, d3drm_create_texture_object
},
1361 {&CLSID_CDirect3DRMDevice
, d3drm_create_device_object
},
1362 {&CLSID_CDirect3DRMViewport
, d3drm_create_viewport_object
},
1363 {&CLSID_CDirect3DRMFace
, d3drm_create_face_object
},
1364 {&CLSID_CDirect3DRMMeshBuilder
, d3drm_create_mesh_builder_object
},
1365 {&CLSID_CDirect3DRMFrame
, d3drm_create_frame_object
},
1366 {&CLSID_CDirect3DRMLight
, d3drm_create_light_object
},
1367 {&CLSID_CDirect3DRMMaterial
, d3drm_create_material_object
},
1368 {&CLSID_CDirect3DRMMesh
, d3drm_create_mesh_object
},
1369 {&CLSID_CDirect3DRMAnimation
, d3drm_create_animation_object
},
1370 {&CLSID_CDirect3DRMWrap
, d3drm_create_wrap_object
},
1373 TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
1374 iface
, debugstr_guid(clsid
), outer
, debugstr_guid(iid
), out
);
1377 return D3DRMERR_BADVALUE
;
1382 return D3DRMERR_BADVALUE
;
1387 FIXME("COM aggregation for outer IUnknown (%p) not implemented. Returning E_NOTIMPL.\n", outer
);
1392 for (i
= 0; i
< ARRAY_SIZE(object_table
); ++i
)
1394 if (IsEqualGUID(clsid
, object_table
[i
].clsid
))
1396 if (FAILED(hr
= object_table
[i
].create_object((void **)&object
, &d3drm
->IDirect3DRM_iface
)))
1404 if (i
== ARRAY_SIZE(object_table
))
1406 FIXME("%s not implemented. Returning CLASSFACTORY_E_FIRST.\n", debugstr_guid(clsid
));
1408 return CLASSFACTORY_E_FIRST
;
1411 if (FAILED(hr
= IUnknown_QueryInterface(object
, iid
, out
)))
1413 IUnknown_Release(object
);
1418 static HRESULT WINAPI
d3drm3_CreateFrame(IDirect3DRM3
*iface
,
1419 IDirect3DRMFrame3
*parent
, IDirect3DRMFrame3
**frame
)
1421 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1422 struct d3drm_frame
*object
;
1425 TRACE("iface %p, parent %p, frame %p.\n", iface
, parent
, frame
);
1427 if (FAILED(hr
= d3drm_frame_create(&object
, (IUnknown
*)parent
, &d3drm
->IDirect3DRM_iface
)))
1430 *frame
= &object
->IDirect3DRMFrame3_iface
;
1435 static HRESULT WINAPI
d3drm3_CreateMesh(IDirect3DRM3
*iface
, IDirect3DRMMesh
**mesh
)
1437 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1438 struct d3drm_mesh
*object
;
1441 TRACE("iface %p, mesh %p.\n", iface
, mesh
);
1443 if (FAILED(hr
= d3drm_mesh_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1446 *mesh
= &object
->IDirect3DRMMesh_iface
;
1451 static HRESULT WINAPI
d3drm3_CreateMeshBuilder(IDirect3DRM3
*iface
, IDirect3DRMMeshBuilder3
**mesh_builder
)
1453 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1454 struct d3drm_mesh_builder
*object
;
1457 TRACE("iface %p, mesh_builder %p.\n", iface
, mesh_builder
);
1459 if (FAILED(hr
= d3drm_mesh_builder_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1462 *mesh_builder
= &object
->IDirect3DRMMeshBuilder3_iface
;
1467 static HRESULT WINAPI
d3drm3_CreateFace(IDirect3DRM3
*iface
, IDirect3DRMFace2
**face
)
1469 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1470 IDirect3DRMFace
*face1
;
1473 TRACE("iface %p, face %p.\n", iface
, face
);
1475 if (FAILED(hr
= IDirect3DRM_CreateFace(&d3drm
->IDirect3DRM_iface
, &face1
)))
1478 hr
= IDirect3DRMFace_QueryInterface(face1
, &IID_IDirect3DRMFace2
, (void **)face
);
1479 IDirect3DRMFace_Release(face1
);
1484 static HRESULT WINAPI
d3drm3_CreateAnimation(IDirect3DRM3
*iface
, IDirect3DRMAnimation2
**animation
)
1486 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1487 struct d3drm_animation
*object
;
1490 TRACE("iface %p, animation %p.\n", iface
, animation
);
1492 if (FAILED(hr
= d3drm_animation_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1495 *animation
= &object
->IDirect3DRMAnimation2_iface
;
1500 static HRESULT WINAPI
d3drm3_CreateAnimationSet(IDirect3DRM3
*iface
, IDirect3DRMAnimationSet2
**set
)
1502 FIXME("iface %p, set %p stub!\n", iface
, set
);
1507 static HRESULT WINAPI
d3drm3_CreateTexture(IDirect3DRM3
*iface
,
1508 D3DRMIMAGE
*image
, IDirect3DRMTexture3
**texture
)
1510 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1511 struct d3drm_texture
*object
;
1514 TRACE("iface %p, image %p, texture %p.\n", iface
, image
, texture
);
1517 return D3DRMERR_BADVALUE
;
1519 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1522 *texture
= &object
->IDirect3DRMTexture3_iface
;
1524 if (FAILED(IDirect3DRMTexture3_InitFromImage(*texture
, image
)))
1526 IDirect3DRMTexture3_Release(*texture
);
1528 return D3DRMERR_BADVALUE
;
1534 static HRESULT WINAPI
d3drm3_CreateLight(IDirect3DRM3
*iface
,
1535 D3DRMLIGHTTYPE type
, D3DCOLOR color
, IDirect3DRMLight
**light
)
1537 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1538 struct d3drm_light
*object
;
1541 FIXME("iface %p, type %#x, color 0x%08x, light %p partial stub!\n", iface
, type
, color
, light
);
1543 if (SUCCEEDED(hr
= d3drm_light_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1545 IDirect3DRMLight_SetType(&object
->IDirect3DRMLight_iface
, type
);
1546 IDirect3DRMLight_SetColor(&object
->IDirect3DRMLight_iface
, color
);
1549 *light
= &object
->IDirect3DRMLight_iface
;
1554 static HRESULT WINAPI
d3drm3_CreateLightRGB(IDirect3DRM3
*iface
, D3DRMLIGHTTYPE type
,
1555 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
, IDirect3DRMLight
**light
)
1557 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1558 struct d3drm_light
*object
;
1561 FIXME("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p partial stub!\n",
1562 iface
, type
, red
, green
, blue
, light
);
1564 if (SUCCEEDED(hr
= d3drm_light_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1566 IDirect3DRMLight_SetType(&object
->IDirect3DRMLight_iface
, type
);
1567 IDirect3DRMLight_SetColorRGB(&object
->IDirect3DRMLight_iface
, red
, green
, blue
);
1570 *light
= &object
->IDirect3DRMLight_iface
;
1575 static HRESULT WINAPI
d3drm3_CreateMaterial(IDirect3DRM3
*iface
,
1576 D3DVALUE power
, IDirect3DRMMaterial2
**material
)
1578 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1579 struct d3drm_material
*object
;
1582 TRACE("iface %p, power %.8e, material %p.\n", iface
, power
, material
);
1584 if (SUCCEEDED(hr
= d3drm_material_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1585 IDirect3DRMMaterial2_SetPower(&object
->IDirect3DRMMaterial2_iface
, power
);
1587 *material
= &object
->IDirect3DRMMaterial2_iface
;
1592 static HRESULT WINAPI
d3drm3_CreateDevice(IDirect3DRM3
*iface
,
1593 DWORD width
, DWORD height
, IDirect3DRMDevice3
**device
)
1595 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1596 struct d3drm_device
*object
;
1599 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface
, width
, height
, device
);
1601 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1604 *device
= &object
->IDirect3DRMDevice3_iface
;
1609 static HRESULT WINAPI
d3drm3_CreateDeviceFromSurface(IDirect3DRM3
*iface
, GUID
*guid
,
1610 IDirectDraw
*ddraw
, IDirectDrawSurface
*backbuffer
, DWORD flags
, IDirect3DRMDevice3
**device
)
1612 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1613 struct d3drm_device
*object
;
1617 TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, flags %#x, device %p.\n",
1618 iface
, debugstr_guid(guid
), ddraw
, backbuffer
, flags
, device
);
1621 return D3DRMERR_BADVALUE
;
1624 if (!backbuffer
|| !ddraw
)
1625 return D3DRMERR_BADDEVICE
;
1627 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1630 use_z_surface
= !(flags
& D3DRMDEVICE_NOZBUFFER
);
1632 if (SUCCEEDED(hr
= d3drm_device_init(object
, 3, ddraw
, backbuffer
, use_z_surface
)))
1633 *device
= &object
->IDirect3DRMDevice3_iface
;
1635 d3drm_device_destroy(object
);
1640 static HRESULT WINAPI
d3drm3_CreateDeviceFromD3D(IDirect3DRM3
*iface
,
1641 IDirect3D2
*d3d
, IDirect3DDevice2
*d3d_device
, IDirect3DRMDevice3
**device
)
1643 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1644 struct d3drm_device
*object
;
1647 TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
1648 iface
, d3d
, d3d_device
, device
);
1651 return D3DRMERR_BADVALUE
;
1654 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1657 if (FAILED(hr
= IDirect3DRMDevice3_InitFromD3D2(&object
->IDirect3DRMDevice3_iface
, d3d
, d3d_device
)))
1659 d3drm_device_destroy(object
);
1662 *device
= &object
->IDirect3DRMDevice3_iface
;
1667 static HRESULT WINAPI
d3drm3_CreateDeviceFromClipper(IDirect3DRM3
*iface
,
1668 IDirectDrawClipper
*clipper
, GUID
*guid
, int width
, int height
,
1669 IDirect3DRMDevice3
**device
)
1671 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1672 struct d3drm_device
*object
;
1674 IDirectDrawSurface
*render_target
;
1677 TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
1678 iface
, clipper
, debugstr_guid(guid
), width
, height
, device
);
1681 return D3DRMERR_BADVALUE
;
1684 if (!clipper
|| !width
|| !height
)
1685 return D3DRMERR_BADVALUE
;
1687 hr
= DirectDrawCreate(NULL
, &ddraw
, NULL
);
1691 if (FAILED(hr
= d3drm_device_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1693 IDirectDraw_Release(ddraw
);
1697 hr
= d3drm_device_create_surfaces_from_clipper(object
, ddraw
, clipper
, width
, height
, &render_target
);
1700 IDirectDraw_Release(ddraw
);
1701 d3drm_device_destroy(object
);
1705 hr
= d3drm_device_init(object
, 3, ddraw
, render_target
, TRUE
);
1706 IDirectDraw_Release(ddraw
);
1707 IDirectDrawSurface_Release(render_target
);
1709 d3drm_device_destroy(object
);
1711 *device
= &object
->IDirect3DRMDevice3_iface
;
1716 static HRESULT WINAPI
d3drm3_CreateShadow(IDirect3DRM3
*iface
, IUnknown
*object
, IDirect3DRMLight
*light
,
1717 D3DVALUE px
, D3DVALUE py
, D3DVALUE pz
, D3DVALUE nx
, D3DVALUE ny
, D3DVALUE nz
, IDirect3DRMShadow2
**shadow
)
1719 FIXME("iface %p, object %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
1720 iface
, object
, light
, px
, py
, pz
, nx
, ny
, nz
, shadow
);
1725 static HRESULT WINAPI
d3drm3_CreateTextureFromSurface(IDirect3DRM3
*iface
,
1726 IDirectDrawSurface
*surface
, IDirect3DRMTexture3
**texture
)
1728 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1729 struct d3drm_texture
*object
;
1732 TRACE("iface %p, surface %p, texture %p.\n", iface
, surface
, texture
);
1735 return D3DRMERR_BADVALUE
;
1737 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1740 *texture
= &object
->IDirect3DRMTexture3_iface
;
1742 if (FAILED(IDirect3DRMTexture3_InitFromSurface(*texture
, surface
)))
1744 IDirect3DRMTexture3_Release(*texture
);
1746 return D3DRMERR_BADVALUE
;
1752 static HRESULT WINAPI
d3drm3_CreateViewport(IDirect3DRM3
*iface
, IDirect3DRMDevice3
*device
,
1753 IDirect3DRMFrame3
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
, IDirect3DRMViewport2
**viewport
)
1755 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1756 struct d3drm_viewport
*object
;
1759 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
1760 iface
, device
, camera
, x
, y
, width
, height
, viewport
);
1762 if (!device
|| !camera
)
1763 return D3DRMERR_BADOBJECT
;
1765 return D3DRMERR_BADVALUE
;
1767 if (FAILED(hr
= d3drm_viewport_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1770 *viewport
= &object
->IDirect3DRMViewport2_iface
;
1772 if (FAILED(hr
= IDirect3DRMViewport2_Init(*viewport
, device
, camera
, x
, y
, width
, height
)))
1774 IDirect3DRMViewport2_Release(*viewport
);
1776 return D3DRMERR_BADVALUE
;
1782 static HRESULT WINAPI
d3drm3_CreateWrap(IDirect3DRM3
*iface
, D3DRMWRAPTYPE type
, IDirect3DRMFrame3
*frame
,
1783 D3DVALUE ox
, D3DVALUE oy
, D3DVALUE oz
, D3DVALUE dx
, D3DVALUE dy
, D3DVALUE dz
,
1784 D3DVALUE ux
, D3DVALUE uy
, D3DVALUE uz
, D3DVALUE ou
, D3DVALUE ov
, D3DVALUE su
, D3DVALUE sv
,
1785 IDirect3DRMWrap
**wrap
)
1787 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1788 struct d3drm_wrap
*object
;
1791 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
1792 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p, semi-stub.\n",
1793 iface
, type
, frame
, ox
, oy
, oz
, dx
, dy
, dz
, ux
, uy
, uz
, ou
, ov
, su
, sv
, wrap
);
1796 return D3DRMERR_BADVALUE
;
1798 if (FAILED(hr
= d3drm_wrap_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1801 *wrap
= &object
->IDirect3DRMWrap_iface
;
1806 static HRESULT WINAPI
d3drm3_CreateUserVisual(IDirect3DRM3
*iface
,
1807 D3DRMUSERVISUALCALLBACK cb
, void *ctx
, IDirect3DRMUserVisual
**visual
)
1809 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface
, cb
, ctx
, visual
);
1814 static HRESULT WINAPI
d3drm3_LoadTexture(IDirect3DRM3
*iface
,
1815 const char *filename
, IDirect3DRMTexture3
**texture
)
1817 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1818 struct d3drm_texture
*object
;
1821 FIXME("iface %p, filename %s, texture %p stub!\n", iface
, debugstr_a(filename
), texture
);
1823 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1826 *texture
= &object
->IDirect3DRMTexture3_iface
;
1831 static HRESULT WINAPI
d3drm3_LoadTextureFromResource(IDirect3DRM3
*iface
, HMODULE module
,
1832 const char *resource_name
, const char *resource_type
, IDirect3DRMTexture3
**texture
)
1834 struct d3drm
*d3drm
= impl_from_IDirect3DRM3(iface
);
1835 struct d3drm_texture
*object
;
1838 FIXME("iface %p, module %p, resource_name %s, resource_type %s, texture %p stub!\n",
1839 iface
, module
, debugstr_a(resource_name
), debugstr_a(resource_type
), texture
);
1841 if (FAILED(hr
= d3drm_texture_create(&object
, &d3drm
->IDirect3DRM_iface
)))
1844 *texture
= &object
->IDirect3DRMTexture3_iface
;
1849 static HRESULT WINAPI
d3drm3_SetSearchPath(IDirect3DRM3
*iface
, const char *path
)
1851 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1856 static HRESULT WINAPI
d3drm3_AddSearchPath(IDirect3DRM3
*iface
, const char *path
)
1858 FIXME("iface %p, path %s stub!\n", iface
, debugstr_a(path
));
1863 static HRESULT WINAPI
d3drm3_GetSearchPath(IDirect3DRM3
*iface
, DWORD
*size
, char *path
)
1865 FIXME("iface %p, size %p, path %p stub!\n", iface
, size
, path
);
1870 static HRESULT WINAPI
d3drm3_SetDefaultTextureColors(IDirect3DRM3
*iface
, DWORD color_count
)
1872 FIXME("iface %p, color_count %u stub!\n", iface
, color_count
);
1877 static HRESULT WINAPI
d3drm3_SetDefaultTextureShades(IDirect3DRM3
*iface
, DWORD shade_count
)
1879 FIXME("iface %p, shade_count %u stub!\n", iface
, shade_count
);
1884 static HRESULT WINAPI
d3drm3_GetDevices(IDirect3DRM3
*iface
, IDirect3DRMDeviceArray
**array
)
1886 FIXME("iface %p, array %p stub!\n", iface
, array
);
1891 static HRESULT WINAPI
d3drm3_GetNamedObject(IDirect3DRM3
*iface
,
1892 const char *name
, IDirect3DRMObject
**object
)
1894 FIXME("iface %p, name %s, object %p stub!\n", iface
, debugstr_a(name
), object
);
1899 static HRESULT WINAPI
d3drm3_EnumerateObjects(IDirect3DRM3
*iface
, D3DRMOBJECTCALLBACK cb
, void *ctx
)
1901 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
1906 static HRESULT
load_data(IDirect3DRM3
*iface
, IDirectXFileData
*data_object
, IID
**GUIDs
, DWORD nb_GUIDs
, D3DRMLOADCALLBACK LoadProc
,
1907 void *ArgLP
, D3DRMLOADTEXTURECALLBACK LoadTextureProc
, void *ArgLTP
, IDirect3DRMFrame3
*parent_frame
)
1909 HRESULT ret
= D3DRMERR_BADOBJECT
;
1913 BOOL requested
= FALSE
;
1915 hr
= IDirectXFileData_GetType(data_object
, &guid
);
1916 if (hr
!= DXFILE_OK
)
1919 TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid
));
1921 /* Load object only if it is top level and requested or if it is part of another object */
1923 if (IsEqualGUID(guid
, &TID_D3DRMMesh
))
1925 TRACE("Found TID_D3DRMMesh\n");
1927 for (i
= 0; i
< nb_GUIDs
; i
++)
1928 if (IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder
) ||
1929 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder2
) ||
1930 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMMeshBuilder3
))
1936 if (requested
|| parent_frame
)
1938 IDirect3DRMMeshBuilder3
*meshbuilder
;
1940 TRACE("Load mesh data\n");
1942 hr
= IDirect3DRM3_CreateMeshBuilder(iface
, &meshbuilder
);
1945 hr
= load_mesh_data(meshbuilder
, data_object
, LoadTextureProc
, ArgLTP
);
1948 /* Only top level objects are notified */
1951 IDirect3DRMObject
*object
;
1953 hr
= IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder
, GUIDs
[i
], (void**)&object
);
1956 LoadProc(object
, GUIDs
[i
], ArgLP
);
1957 IDirect3DRMObject_Release(object
);
1962 IDirect3DRMFrame3_AddVisual(parent_frame
, (IUnknown
*)meshbuilder
);
1965 IDirect3DRMMeshBuilder3_Release(meshbuilder
);
1969 ERR("Cannot process mesh\n");
1972 else if (IsEqualGUID(guid
, &TID_D3DRMFrame
))
1974 TRACE("Found TID_D3DRMFrame\n");
1976 for (i
= 0; i
< nb_GUIDs
; i
++)
1977 if (IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame
) ||
1978 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame2
) ||
1979 IsEqualGUID(GUIDs
[i
], &IID_IDirect3DRMFrame3
))
1985 if (requested
|| parent_frame
)
1987 IDirect3DRMFrame3
*frame
;
1989 TRACE("Load frame data\n");
1991 hr
= IDirect3DRM3_CreateFrame(iface
, parent_frame
, &frame
);
1994 IDirectXFileObject
*child
;
1996 while (SUCCEEDED(hr
= IDirectXFileData_GetNextObject(data_object
, &child
)))
1998 IDirectXFileData
*data
;
1999 IDirectXFileDataReference
*reference
;
2000 IDirectXFileBinary
*binary
;
2002 if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
2003 &IID_IDirectXFileBinary
, (void **)&binary
)))
2005 FIXME("Binary Object not supported yet\n");
2006 IDirectXFileBinary_Release(binary
);
2008 else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
2009 &IID_IDirectXFileData
, (void **)&data
)))
2011 TRACE("Found Data Object\n");
2012 hr
= load_data(iface
, data
, GUIDs
, nb_GUIDs
, LoadProc
, ArgLP
, LoadTextureProc
, ArgLTP
, frame
);
2013 IDirectXFileData_Release(data
);
2015 else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child
,
2016 &IID_IDirectXFileDataReference
, (void **)&reference
)))
2018 TRACE("Found Data Object Reference\n");
2019 IDirectXFileDataReference_Resolve(reference
, &data
);
2020 hr
= load_data(iface
, data
, GUIDs
, nb_GUIDs
, LoadProc
, ArgLP
, LoadTextureProc
, ArgLTP
, frame
);
2021 IDirectXFileData_Release(data
);
2022 IDirectXFileDataReference_Release(reference
);
2024 IDirectXFileObject_Release(child
);
2027 if (hr
!= DXFILEERR_NOMOREOBJECTS
)
2029 IDirect3DRMFrame3_Release(frame
);
2034 /* Only top level objects are notified */
2037 IDirect3DRMObject
*object
;
2039 hr
= IDirect3DRMFrame3_QueryInterface(frame
, GUIDs
[i
], (void**)&object
);
2042 LoadProc(object
, GUIDs
[i
], ArgLP
);
2043 IDirect3DRMObject_Release(object
);
2046 IDirect3DRMFrame3_Release(frame
);
2050 ERR("Cannot process frame\n");
2053 else if (IsEqualGUID(guid
, &TID_D3DRMMaterial
))
2055 TRACE("Found TID_D3DRMMaterial\n");
2057 /* Cannot be requested so nothing to do */
2059 else if (IsEqualGUID(guid
, &TID_D3DRMFrameTransformMatrix
))
2061 TRACE("Found TID_D3DRMFrameTransformMatrix\n");
2063 /* Cannot be requested */
2066 D3DRMMATRIX4D
*matrix
;
2069 TRACE("Load Frame Transform Matrix data\n");
2071 hr
= IDirectXFileData_GetData(data_object
, NULL
, &size
, (void**)&matrix
);
2072 if ((hr
!= DXFILE_OK
) || (size
!= sizeof(matrix
)))
2075 hr
= IDirect3DRMFrame3_AddTransform(parent_frame
, D3DRMCOMBINE_REPLACE
, *matrix
);
2082 FIXME("Found unknown TID %s\n", debugstr_guid(guid
));
2092 static HRESULT WINAPI
d3drm3_Load(IDirect3DRM3
*iface
, void *source
, void *object_id
, IID
**iids
,
2093 DWORD iid_count
, D3DRMLOADOPTIONS flags
, D3DRMLOADCALLBACK load_cb
, void *load_ctx
,
2094 D3DRMLOADTEXTURECALLBACK load_tex_cb
, void *load_tex_ctx
, IDirect3DRMFrame3
*parent_frame
)
2096 DXFILELOADOPTIONS load_options
;
2097 IDirectXFile
*file
= NULL
;
2098 IDirectXFileEnumObject
*enum_object
= NULL
;
2099 IDirectXFileData
*data
= NULL
;
2103 struct d3drm_file_header
*header
;
2104 HRESULT ret
= D3DRMERR_BADOBJECT
;
2107 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
2108 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
2109 iface
, source
, object_id
, iids
, iid_count
, flags
,
2110 load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
2112 TRACE("Looking for GUIDs:\n");
2113 for (i
= 0; i
< iid_count
; ++i
)
2114 TRACE("- %s (%s)\n", debugstr_guid(iids
[i
]), get_IID_string(iids
[i
]));
2116 if (flags
== D3DRMLOAD_FROMMEMORY
)
2118 load_options
= DXFILELOAD_FROMMEMORY
;
2120 else if (flags
== D3DRMLOAD_FROMFILE
)
2122 load_options
= DXFILELOAD_FROMFILE
;
2123 TRACE("Loading from file %s\n", debugstr_a(source
));
2127 FIXME("Load options %#x not supported yet.\n", flags
);
2131 hr
= DirectXFileCreate(&file
);
2132 if (hr
!= DXFILE_OK
)
2135 hr
= IDirectXFile_RegisterTemplates(file
, templates
, strlen(templates
));
2136 if (hr
!= DXFILE_OK
)
2139 hr
= IDirectXFile_CreateEnumObject(file
, source
, load_options
, &enum_object
);
2140 if (hr
!= DXFILE_OK
)
2143 hr
= IDirectXFileEnumObject_GetNextDataObject(enum_object
, &data
);
2144 if (hr
!= DXFILE_OK
)
2147 hr
= IDirectXFileData_GetType(data
, &pGuid
);
2148 if (hr
!= DXFILE_OK
)
2151 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid
));
2153 if (!IsEqualGUID(pGuid
, &TID_DXFILEHeader
))
2155 ret
= D3DRMERR_BADFILE
;
2159 hr
= IDirectXFileData_GetData(data
, NULL
, &size
, (void **)&header
);
2160 if ((hr
!= DXFILE_OK
) || (size
!= sizeof(*header
)))
2163 TRACE("Version is %u.%u, flags %#x.\n", header
->major
, header
->minor
, header
->flags
);
2165 /* Version must be 1.0.x */
2166 if ((header
->major
!= 1) || (header
->minor
!= 0))
2168 ret
= D3DRMERR_BADFILE
;
2172 IDirectXFileData_Release(data
);
2177 hr
= IDirectXFileEnumObject_GetNextDataObject(enum_object
, &data
);
2178 if (hr
== DXFILEERR_NOMOREOBJECTS
)
2180 TRACE("No more object\n");
2183 else if (hr
!= DXFILE_OK
)
2185 ret
= D3DRMERR_BADFILE
;
2189 ret
= load_data(iface
, data
, iids
, iid_count
, load_cb
, load_ctx
, load_tex_cb
, load_tex_ctx
, parent_frame
);
2190 if (ret
!= D3DRM_OK
)
2193 IDirectXFileData_Release(data
);
2201 IDirectXFileData_Release(data
);
2203 IDirectXFileEnumObject_Release(enum_object
);
2205 IDirectXFile_Release(file
);
2210 static HRESULT WINAPI
d3drm3_Tick(IDirect3DRM3
*iface
, D3DVALUE tick
)
2212 FIXME("iface %p, tick %.8e stub!\n", iface
, tick
);
2217 static HRESULT WINAPI
d3drm3_CreateProgressiveMesh(IDirect3DRM3
*iface
, IDirect3DRMProgressiveMesh
**mesh
)
2219 FIXME("iface %p, mesh %p stub!\n", iface
, mesh
);
2224 static HRESULT WINAPI
d3drm3_RegisterClient(IDirect3DRM3
*iface
, REFGUID guid
, DWORD
*id
)
2226 FIXME("iface %p, guid %s, id %p stub!\n", iface
, debugstr_guid(guid
), id
);
2231 static HRESULT WINAPI
d3drm3_UnregisterClient(IDirect3DRM3
*iface
, REFGUID guid
)
2233 FIXME("iface %p, guid %s stub!\n", iface
, debugstr_guid(guid
));
2238 static HRESULT WINAPI
d3drm3_CreateClippedVisual(IDirect3DRM3
*iface
,
2239 IDirect3DRMVisual
*visual
, IDirect3DRMClippedVisual
**clipped_visual
)
2241 FIXME("iface %p, visual %p, clipped_visual %p stub!\n", iface
, visual
, clipped_visual
);
2246 static HRESULT WINAPI
d3drm3_SetOptions(IDirect3DRM3
*iface
, DWORD flags
)
2248 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
2253 static HRESULT WINAPI
d3drm3_GetOptions(IDirect3DRM3
*iface
, DWORD
*flags
)
2255 FIXME("iface %p, flags %p stub!\n", iface
, flags
);
2260 static const struct IDirect3DRM3Vtbl d3drm3_vtbl
=
2262 d3drm3_QueryInterface
,
2265 d3drm3_CreateObject
,
2268 d3drm3_CreateMeshBuilder
,
2270 d3drm3_CreateAnimation
,
2271 d3drm3_CreateAnimationSet
,
2272 d3drm3_CreateTexture
,
2274 d3drm3_CreateLightRGB
,
2275 d3drm3_CreateMaterial
,
2276 d3drm3_CreateDevice
,
2277 d3drm3_CreateDeviceFromSurface
,
2278 d3drm3_CreateDeviceFromD3D
,
2279 d3drm3_CreateDeviceFromClipper
,
2280 d3drm3_CreateTextureFromSurface
,
2281 d3drm3_CreateShadow
,
2282 d3drm3_CreateViewport
,
2284 d3drm3_CreateUserVisual
,
2286 d3drm3_LoadTextureFromResource
,
2287 d3drm3_SetSearchPath
,
2288 d3drm3_AddSearchPath
,
2289 d3drm3_GetSearchPath
,
2290 d3drm3_SetDefaultTextureColors
,
2291 d3drm3_SetDefaultTextureShades
,
2293 d3drm3_GetNamedObject
,
2294 d3drm3_EnumerateObjects
,
2297 d3drm3_CreateProgressiveMesh
,
2298 d3drm3_RegisterClient
,
2299 d3drm3_UnregisterClient
,
2300 d3drm3_CreateClippedVisual
,
2305 HRESULT WINAPI
Direct3DRMCreate(IDirect3DRM
**d3drm
)
2307 struct d3drm
*object
;
2309 TRACE("d3drm %p.\n", d3drm
);
2311 if (!(object
= heap_alloc_zero(sizeof(*object
))))
2312 return E_OUTOFMEMORY
;
2314 object
->IDirect3DRM_iface
.lpVtbl
= &d3drm1_vtbl
;
2315 object
->IDirect3DRM2_iface
.lpVtbl
= &d3drm2_vtbl
;
2316 object
->IDirect3DRM3_iface
.lpVtbl
= &d3drm3_vtbl
;
2318 object
->iface_count
= 1;
2320 *d3drm
= &object
->IDirect3DRM_iface
;
2325 HRESULT WINAPI
DllCanUnloadNow(void)
2330 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, void **ppv
)
2332 TRACE("(%s, %s, %p): stub\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
2335 return E_INVALIDARG
;
2337 return CLASS_E_CLASSNOTAVAILABLE
;