Release 1.6-rc2.
[wine/testsucceed.git] / dlls / d3drm / d3drm.c
blobbd7155d911b7b5431048b091b0ce67ab04b24f23
1 /*
2 * Implementation of IDirect3DRM Interface
4 * Copyright 2010, 2012 Christian Costa
5 * Copyright 2011 André Hentschel
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
24 #define COBJMACROS
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "dxfile.h"
29 #include "rmxfguid.h"
31 #include "d3drm_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
35 static const char* get_IID_string(const GUID* guid)
37 if (IsEqualGUID(guid, &IID_IDirect3DRMFrame))
38 return "IID_IDirect3DRMFrame";
39 else if (IsEqualGUID(guid, &IID_IDirect3DRMFrame2))
40 return "IID_IDirect3DRMFrame2";
41 else if (IsEqualGUID(guid, &IID_IDirect3DRMFrame3))
42 return "IID_IDirect3DRMFrame3";
43 else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder))
44 return "IID_IDirect3DRMMeshBuilder";
45 else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder2))
46 return "IID_IDirect3DRMMeshBuilder2";
47 else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder3))
48 return "IID_IDirect3DRMMeshBuilder3";
50 return "?";
53 typedef struct {
54 IDirect3DRM IDirect3DRM_iface;
55 IDirect3DRM2 IDirect3DRM2_iface;
56 IDirect3DRM3 IDirect3DRM3_iface;
57 LONG ref;
58 } IDirect3DRMImpl;
60 static inline IDirect3DRMImpl *impl_from_IDirect3DRM(IDirect3DRM *iface)
62 return CONTAINING_RECORD(iface, IDirect3DRMImpl, IDirect3DRM_iface);
65 static inline IDirect3DRMImpl *impl_from_IDirect3DRM2(IDirect3DRM2 *iface)
67 return CONTAINING_RECORD(iface, IDirect3DRMImpl, IDirect3DRM2_iface);
70 static inline IDirect3DRMImpl *impl_from_IDirect3DRM3(IDirect3DRM3 *iface)
72 return CONTAINING_RECORD(iface, IDirect3DRMImpl, IDirect3DRM3_iface);
75 /*** IUnknown methods ***/
76 static HRESULT WINAPI IDirect3DRMImpl_QueryInterface(IDirect3DRM* iface, REFIID riid, void** ppvObject)
78 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
80 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
82 *ppvObject = NULL;
84 if(IsEqualGUID(riid, &IID_IUnknown) ||
85 IsEqualGUID(riid, &IID_IDirect3DRM))
87 *ppvObject = &This->IDirect3DRM_iface;
89 else if(IsEqualGUID(riid, &IID_IDirect3DRM2))
91 *ppvObject = &This->IDirect3DRM2_iface;
93 else if(IsEqualGUID(riid, &IID_IDirect3DRM3))
95 *ppvObject = &This->IDirect3DRM3_iface;
97 else
99 FIXME("interface %s not implemented\n", debugstr_guid(riid));
100 return E_NOINTERFACE;
103 IDirect3DRM_AddRef(iface);
104 return S_OK;
107 static ULONG WINAPI IDirect3DRMImpl_AddRef(IDirect3DRM* iface)
109 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
110 ULONG ref = InterlockedIncrement(&This->ref);
112 TRACE("(%p/%p)->(): new ref = %d\n", iface, This, ref);
114 return ref;
117 static ULONG WINAPI IDirect3DRMImpl_Release(IDirect3DRM* iface)
119 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
120 ULONG ref = InterlockedDecrement(&This->ref);
122 TRACE("(%p/%p)->(): new ref = %d\n", iface, This, ref);
124 if (!ref)
125 HeapFree(GetProcessHeap(), 0, This);
127 return ref;
130 /*** IDirect3DRM methods ***/
131 static HRESULT WINAPI IDirect3DRMImpl_CreateObject(IDirect3DRM* iface, REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
133 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
135 FIXME("(%p/%p)->(%s,%p,%s,%p): stub\n", iface, This, debugstr_guid(rclsid), pUnkOuter, debugstr_guid(riid), ppvObj);
137 return E_NOTIMPL;
140 static HRESULT WINAPI IDirect3DRMImpl_CreateFrame(IDirect3DRM *iface,
141 IDirect3DRMFrame *parent_frame, IDirect3DRMFrame **frame)
143 TRACE("iface %p, parent_frame %p, frame %p.\n", iface, parent_frame, frame);
145 return Direct3DRMFrame_create(&IID_IDirect3DRMFrame, (IUnknown *)parent_frame, (IUnknown **)frame);
148 static HRESULT WINAPI IDirect3DRMImpl_CreateMesh(IDirect3DRM *iface, IDirect3DRMMesh **mesh)
150 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
152 TRACE("iface %p, mesh %p.\n", iface, mesh);
154 return IDirect3DRM3_CreateMesh(&d3drm->IDirect3DRM3_iface, mesh);
157 static HRESULT WINAPI IDirect3DRMImpl_CreateMeshBuilder(IDirect3DRM *iface, IDirect3DRMMeshBuilder **mesh_builder)
159 TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder);
161 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder, (IUnknown **)mesh_builder);
164 static HRESULT WINAPI IDirect3DRMImpl_CreateFace(IDirect3DRM* iface, IDirect3DRMFace **face)
166 TRACE("iface %p, face %p.\n", iface, face);
168 return Direct3DRMFace_create(&IID_IDirect3DRMFace, (IUnknown **)face);
171 static HRESULT WINAPI IDirect3DRMImpl_CreateAnimation(IDirect3DRM *iface, IDirect3DRMAnimation **animation)
173 FIXME("iface %p, animation %p stub!\n", iface, animation);
175 return E_NOTIMPL;
178 static HRESULT WINAPI IDirect3DRMImpl_CreateAnimationSet(IDirect3DRM *iface, IDirect3DRMAnimationSet **set)
180 FIXME("iface %p, set %p stub!\n", iface, set);
182 return E_NOTIMPL;
185 static HRESULT WINAPI IDirect3DRMImpl_CreateTexture(IDirect3DRM *iface,
186 D3DRMIMAGE *image, IDirect3DRMTexture **texture)
188 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
190 FIXME("(%p/%p)->(%p,%p): partial stub\n", iface, This, image, texture);
192 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
195 static HRESULT WINAPI IDirect3DRMImpl_CreateLight(IDirect3DRM *iface,
196 D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
198 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
200 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface, type, color, light);
202 return IDirect3DRM3_CreateLight(&d3drm->IDirect3DRM3_iface, type, color, light);
205 static HRESULT WINAPI IDirect3DRMImpl_CreateLightRGB(IDirect3DRM *iface, D3DRMLIGHTTYPE type,
206 D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
208 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
210 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
211 iface, type, red, green, blue, light);
213 return IDirect3DRM3_CreateLightRGB(&d3drm->IDirect3DRM3_iface, type, red, green, blue, light);
216 static HRESULT WINAPI IDirect3DRMImpl_CreateMaterial(IDirect3DRM *iface,
217 D3DVALUE power, IDirect3DRMMaterial **material)
219 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
221 TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
223 return IDirect3DRM3_CreateMaterial(&d3drm->IDirect3DRM3_iface, power, (IDirect3DRMMaterial2 **)material);
226 static HRESULT WINAPI IDirect3DRMImpl_CreateDevice(IDirect3DRM *iface,
227 DWORD width, DWORD height, IDirect3DRMDevice **device)
229 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device);
231 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown **)device);
234 static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromSurface(IDirect3DRM *iface, GUID *pGUID,
235 IDirectDraw *pDD, IDirectDrawSurface *pDDSBack, IDirect3DRMDevice **ppDevice)
237 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
239 FIXME("(%p/%p)->(%s,%p,%p,%p): partial stub\n", iface, This, debugstr_guid(pGUID), pDD,
240 pDDSBack, ppDevice);
242 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown**)ppDevice);
245 static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromD3D(IDirect3DRM *iface,
246 IDirect3D *pD3D, IDirect3DDevice *pD3DDev, IDirect3DRMDevice **ppDevice)
248 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
250 FIXME("(%p/%p)->(%p,%p,%p): partial stub\n", iface, This, pD3D, pD3DDev, ppDevice);
252 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown**)ppDevice);
255 static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromClipper(IDirect3DRM *iface,
256 IDirectDrawClipper *pDDClipper, GUID *pGUID, int width, int height,
257 IDirect3DRMDevice **ppDevice)
259 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
261 FIXME("(%p/%p)->(%p,%s,%d,%d,%p): partial stub\n", iface, This, pDDClipper,
262 debugstr_guid(pGUID), width, height, ppDevice);
264 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown**)ppDevice);
267 static HRESULT WINAPI IDirect3DRMImpl_CreateTextureFromSurface(IDirect3DRM *iface,
268 IDirectDrawSurface *pDDS, IDirect3DRMTexture **ppTexture)
270 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
272 FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, pDDS, ppTexture);
274 return E_NOTIMPL;
277 static HRESULT WINAPI IDirect3DRMImpl_CreateShadow(IDirect3DRM *iface, IDirect3DRMVisual *visual,
278 IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
279 IDirect3DRMVisual **shadow)
281 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
282 iface, visual, light, px, py, pz, nx, ny, nz, shadow);
284 return E_NOTIMPL;
287 static HRESULT WINAPI IDirect3DRMImpl_CreateViewport(IDirect3DRM *iface, IDirect3DRMDevice *device,
288 IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
290 FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
291 iface, device, camera, x, y, width, height, viewport);
293 return Direct3DRMViewport_create(&IID_IDirect3DRMViewport, (IUnknown **)viewport);
296 static HRESULT WINAPI IDirect3DRMImpl_CreateWrap(IDirect3DRM *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
297 D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
298 D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv,
299 IDirect3DRMWrap **wrap)
301 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
302 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
303 iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap);
305 return E_NOTIMPL;
308 static HRESULT WINAPI IDirect3DRMImpl_CreateUserVisual(IDirect3DRM *iface,
309 D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual)
311 FIXME("iface %p, cb %p, ctx %p visual %p stub!\n", iface, cb, ctx, visual);
313 return E_NOTIMPL;
316 static HRESULT WINAPI IDirect3DRMImpl_LoadTexture(IDirect3DRM *iface,
317 const char *filename, IDirect3DRMTexture **texture)
319 FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
321 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
324 static HRESULT WINAPI IDirect3DRMImpl_LoadTextureFromResource(IDirect3DRM *iface,
325 HRSRC resource, IDirect3DRMTexture **texture)
327 FIXME("iface %p, resource %p, texture %p stub!\n", iface, resource, texture);
329 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
332 static HRESULT WINAPI IDirect3DRMImpl_SetSearchPath(IDirect3DRM* iface, LPCSTR path)
334 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
336 FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
338 return E_NOTIMPL;
341 static HRESULT WINAPI IDirect3DRMImpl_AddSearchPath(IDirect3DRM* iface, LPCSTR path)
343 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
345 FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
347 return E_NOTIMPL;
350 static HRESULT WINAPI IDirect3DRMImpl_GetSearchPath(IDirect3DRM* iface, DWORD *size_return, LPSTR path_return)
352 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
354 FIXME("(%p/%p)->(%p,%s): stub\n", iface, This, size_return, path_return);
356 return E_NOTIMPL;
359 static HRESULT WINAPI IDirect3DRMImpl_SetDefaultTextureColors(IDirect3DRM* iface, DWORD nb_colors)
361 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
363 FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_colors);
365 return E_NOTIMPL;
368 static HRESULT WINAPI IDirect3DRMImpl_SetDefaultTextureShades(IDirect3DRM* iface, DWORD nb_shades)
370 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
372 FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_shades);
374 return E_NOTIMPL;
377 static HRESULT WINAPI IDirect3DRMImpl_GetDevices(IDirect3DRM *iface, IDirect3DRMDeviceArray **array)
379 FIXME("iface %p, array %p stub!\n", iface, array);
381 return E_NOTIMPL;
384 static HRESULT WINAPI IDirect3DRMImpl_GetNamedObject(IDirect3DRM *iface,
385 const char *name, IDirect3DRMObject **object)
387 FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
389 return E_NOTIMPL;
392 static HRESULT WINAPI IDirect3DRMImpl_EnumerateObjects(IDirect3DRM* iface, D3DRMOBJECTCALLBACK cb, LPVOID pArg)
394 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
396 FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, pArg);
398 return E_NOTIMPL;
401 static HRESULT WINAPI IDirect3DRMImpl_Load(IDirect3DRM *iface, void *source, void *object_id, IID **iids,
402 DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx,
403 D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame *parent_frame)
405 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
406 IDirect3DRMFrame3 *parent_frame3 = NULL;
407 HRESULT hr = D3DRM_OK;
409 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
410 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
411 iface, source, object_id, iids, iid_count, flags,
412 load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
414 if (parent_frame)
415 hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&parent_frame3);
416 if (SUCCEEDED(hr))
417 hr = IDirect3DRM3_Load(&d3drm->IDirect3DRM3_iface, source, object_id, iids, iid_count,
418 flags, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame3);
419 if (parent_frame3)
420 IDirect3DRMFrame3_Release(parent_frame3);
422 return hr;
425 static HRESULT WINAPI IDirect3DRMImpl_Tick(IDirect3DRM* iface, D3DVALUE tick)
427 IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
429 FIXME("(%p/%p)->(%f): stub\n", iface, This, tick);
431 return E_NOTIMPL;
434 static const struct IDirect3DRMVtbl Direct3DRM_Vtbl =
436 IDirect3DRMImpl_QueryInterface,
437 IDirect3DRMImpl_AddRef,
438 IDirect3DRMImpl_Release,
439 IDirect3DRMImpl_CreateObject,
440 IDirect3DRMImpl_CreateFrame,
441 IDirect3DRMImpl_CreateMesh,
442 IDirect3DRMImpl_CreateMeshBuilder,
443 IDirect3DRMImpl_CreateFace,
444 IDirect3DRMImpl_CreateAnimation,
445 IDirect3DRMImpl_CreateAnimationSet,
446 IDirect3DRMImpl_CreateTexture,
447 IDirect3DRMImpl_CreateLight,
448 IDirect3DRMImpl_CreateLightRGB,
449 IDirect3DRMImpl_CreateMaterial,
450 IDirect3DRMImpl_CreateDevice,
451 IDirect3DRMImpl_CreateDeviceFromSurface,
452 IDirect3DRMImpl_CreateDeviceFromD3D,
453 IDirect3DRMImpl_CreateDeviceFromClipper,
454 IDirect3DRMImpl_CreateTextureFromSurface,
455 IDirect3DRMImpl_CreateShadow,
456 IDirect3DRMImpl_CreateViewport,
457 IDirect3DRMImpl_CreateWrap,
458 IDirect3DRMImpl_CreateUserVisual,
459 IDirect3DRMImpl_LoadTexture,
460 IDirect3DRMImpl_LoadTextureFromResource,
461 IDirect3DRMImpl_SetSearchPath,
462 IDirect3DRMImpl_AddSearchPath,
463 IDirect3DRMImpl_GetSearchPath,
464 IDirect3DRMImpl_SetDefaultTextureColors,
465 IDirect3DRMImpl_SetDefaultTextureShades,
466 IDirect3DRMImpl_GetDevices,
467 IDirect3DRMImpl_GetNamedObject,
468 IDirect3DRMImpl_EnumerateObjects,
469 IDirect3DRMImpl_Load,
470 IDirect3DRMImpl_Tick
474 /*** IUnknown methods ***/
475 static HRESULT WINAPI IDirect3DRM2Impl_QueryInterface(IDirect3DRM2* iface, REFIID riid,
476 void** ppvObject)
478 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
479 return IDirect3DRM_QueryInterface(&This->IDirect3DRM_iface, riid, ppvObject);
482 static ULONG WINAPI IDirect3DRM2Impl_AddRef(IDirect3DRM2* iface)
484 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
485 return IDirect3DRM_AddRef(&This->IDirect3DRM_iface);
488 static ULONG WINAPI IDirect3DRM2Impl_Release(IDirect3DRM2* iface)
490 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
491 return IDirect3DRM_Release(&This->IDirect3DRM_iface);
494 /*** IDirect3DRM2 methods ***/
495 static HRESULT WINAPI IDirect3DRM2Impl_CreateObject(IDirect3DRM2* iface, REFCLSID rclsid,
496 LPUNKNOWN pUnkOuter, REFIID riid,
497 LPVOID *ppvObj)
499 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
501 FIXME("(%p/%p)->(%s,%p,%s,%p): stub\n", iface, This, debugstr_guid(rclsid), pUnkOuter,
502 debugstr_guid(riid), ppvObj);
504 return E_NOTIMPL;
507 static HRESULT WINAPI IDirect3DRM2Impl_CreateFrame(IDirect3DRM2 *iface,
508 IDirect3DRMFrame *parent_frame, IDirect3DRMFrame2 **frame)
510 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
512 TRACE("(%p/%p)->(%p,%p)\n", iface, This, parent_frame, frame);
514 return Direct3DRMFrame_create(&IID_IDirect3DRMFrame2, (IUnknown*)parent_frame, (IUnknown**)frame);
517 static HRESULT WINAPI IDirect3DRM2Impl_CreateMesh(IDirect3DRM2 *iface, IDirect3DRMMesh **mesh)
519 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
521 TRACE("iface %p, mesh %p.\n", iface, mesh);
523 return IDirect3DRM3_CreateMesh(&d3drm->IDirect3DRM3_iface, mesh);
526 static HRESULT WINAPI IDirect3DRM2Impl_CreateMeshBuilder(IDirect3DRM2 *iface, IDirect3DRMMeshBuilder2 **mesh_builder)
528 TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder);
530 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder2, (IUnknown **)mesh_builder);
533 static HRESULT WINAPI IDirect3DRM2Impl_CreateFace(IDirect3DRM2 *iface, IDirect3DRMFace **face)
535 TRACE("iface %p, face %p.\n", iface, face);
537 return Direct3DRMFace_create(&IID_IDirect3DRMFace, (IUnknown **)face);
540 static HRESULT WINAPI IDirect3DRM2Impl_CreateAnimation(IDirect3DRM2 *iface, IDirect3DRMAnimation **animation)
542 FIXME("iface %p, animation %p stub!\n", iface, animation);
544 return E_NOTIMPL;
547 static HRESULT WINAPI IDirect3DRM2Impl_CreateAnimationSet(IDirect3DRM2 *iface, IDirect3DRMAnimationSet **set)
549 FIXME("iface %p, set %p stub!\n", iface, set);
551 return E_NOTIMPL;
554 static HRESULT WINAPI IDirect3DRM2Impl_CreateTexture(IDirect3DRM2 *iface,
555 D3DRMIMAGE *image, IDirect3DRMTexture2 **texture)
557 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
559 FIXME("(%p/%p)->(%p,%p): partial stub\n", iface, This, image, texture);
561 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
564 static HRESULT WINAPI IDirect3DRM2Impl_CreateLight(IDirect3DRM2 *iface,
565 D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
567 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
569 TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface, type, color, light);
571 return IDirect3DRM3_CreateLight(&d3drm->IDirect3DRM3_iface, type, color, light);
574 static HRESULT WINAPI IDirect3DRM2Impl_CreateLightRGB(IDirect3DRM2 *iface, D3DRMLIGHTTYPE type,
575 D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
577 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
579 TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
580 iface, type, red, green, blue, light);
582 return IDirect3DRM3_CreateLightRGB(&d3drm->IDirect3DRM3_iface, type, red, green, blue, light);
585 static HRESULT WINAPI IDirect3DRM2Impl_CreateMaterial(IDirect3DRM2 *iface,
586 D3DVALUE power, IDirect3DRMMaterial **material)
588 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
590 TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
592 return IDirect3DRM3_CreateMaterial(&d3drm->IDirect3DRM3_iface, power, (IDirect3DRMMaterial2 **)material);
595 static HRESULT WINAPI IDirect3DRM2Impl_CreateDevice(IDirect3DRM2 *iface,
596 DWORD width, DWORD height, IDirect3DRMDevice2 **device)
598 FIXME("iface %p, width %u, height %u, device %p.\n", iface, width, height, device);
600 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown **)device);
603 static HRESULT WINAPI IDirect3DRM2Impl_CreateDeviceFromSurface(IDirect3DRM2 *iface, GUID *pGUID,
604 IDirectDraw *pDD, IDirectDrawSurface *pDDSBack, IDirect3DRMDevice2 **ppDevice)
606 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
608 FIXME("(%p/%p)->(%s,%p,%p,%p): partial stub\n", iface, This, debugstr_guid(pGUID),
609 pDD, pDDSBack, ppDevice);
611 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown**)ppDevice);
614 static HRESULT WINAPI IDirect3DRM2Impl_CreateDeviceFromD3D(IDirect3DRM2 *iface,
615 IDirect3D2 *pD3D, IDirect3DDevice2 *pD3DDev, IDirect3DRMDevice2 **ppDevice)
617 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
619 FIXME("(%p/%p)->(%p,%p,%p): partial stub\n", iface, This, pD3D, pD3DDev, ppDevice);
621 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown**)ppDevice);
624 static HRESULT WINAPI IDirect3DRM2Impl_CreateDeviceFromClipper(IDirect3DRM2 *iface,
625 IDirectDrawClipper *pDDClipper, GUID *pGUID, int width, int height,
626 IDirect3DRMDevice2 **ppDevice)
628 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
630 FIXME("(%p/%p)->(%p,%s,%d,%d,%p): partial stub\n", iface, This, pDDClipper,
631 debugstr_guid(pGUID), width, height, ppDevice);
633 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown**)ppDevice);
636 static HRESULT WINAPI IDirect3DRM2Impl_CreateTextureFromSurface(IDirect3DRM2 *iface,
637 IDirectDrawSurface *pDDS, IDirect3DRMTexture2 **ppTexture)
639 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
641 FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, pDDS, ppTexture);
643 return E_NOTIMPL;
646 static HRESULT WINAPI IDirect3DRM2Impl_CreateShadow(IDirect3DRM2 *iface, IDirect3DRMVisual *visual,
647 IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
648 IDirect3DRMVisual **shadow)
650 FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
651 iface, visual, light, px, py, pz, nx, ny, nz, shadow);
653 return E_NOTIMPL;
656 static HRESULT WINAPI IDirect3DRM2Impl_CreateViewport(IDirect3DRM2 *iface, IDirect3DRMDevice *device,
657 IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
659 FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
660 iface, device, camera, x, y, width, height, viewport);
662 return Direct3DRMViewport_create(&IID_IDirect3DRMViewport, (IUnknown **)viewport);
665 static HRESULT WINAPI IDirect3DRM2Impl_CreateWrap(IDirect3DRM2 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
666 D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
667 D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv,
668 IDirect3DRMWrap **wrap)
670 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
671 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
672 iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap);
674 return E_NOTIMPL;
677 static HRESULT WINAPI IDirect3DRM2Impl_CreateUserVisual(IDirect3DRM2 *iface,
678 D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual)
680 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface, cb, ctx, visual);
682 return E_NOTIMPL;
685 static HRESULT WINAPI IDirect3DRM2Impl_LoadTexture(IDirect3DRM2 *iface,
686 const char *filename, IDirect3DRMTexture2 **texture)
688 FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
690 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
693 static HRESULT WINAPI IDirect3DRM2Impl_LoadTextureFromResource(IDirect3DRM2 *iface, HMODULE module,
694 const char *resource_name, const char *resource_type, IDirect3DRMTexture2 **texture)
696 FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n",
697 iface, debugstr_a(resource_name), debugstr_a(resource_type), texture);
699 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
702 static HRESULT WINAPI IDirect3DRM2Impl_SetSearchPath(IDirect3DRM2* iface, LPCSTR path)
704 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
706 FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
708 return E_NOTIMPL;
711 static HRESULT WINAPI IDirect3DRM2Impl_AddSearchPath(IDirect3DRM2* iface, LPCSTR path)
713 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
715 FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
717 return E_NOTIMPL;
720 static HRESULT WINAPI IDirect3DRM2Impl_GetSearchPath(IDirect3DRM2* iface, DWORD *size_return,
721 LPSTR path_return)
723 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
725 FIXME("(%p/%p)->(%p,%s): stub\n", iface, This, size_return, path_return);
727 return E_NOTIMPL;
730 static HRESULT WINAPI IDirect3DRM2Impl_SetDefaultTextureColors(IDirect3DRM2* iface, DWORD nb_colors)
732 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
734 FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_colors);
736 return E_NOTIMPL;
739 static HRESULT WINAPI IDirect3DRM2Impl_SetDefaultTextureShades(IDirect3DRM2* iface, DWORD nb_shades)
741 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
743 FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_shades);
745 return E_NOTIMPL;
748 static HRESULT WINAPI IDirect3DRM2Impl_GetDevices(IDirect3DRM2 *iface, IDirect3DRMDeviceArray **array)
750 FIXME("iface %p, array %p stub!\n", iface, array);
752 return E_NOTIMPL;
755 static HRESULT WINAPI IDirect3DRM2Impl_GetNamedObject(IDirect3DRM2 *iface,
756 const char *name, IDirect3DRMObject **object)
758 FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
760 return E_NOTIMPL;
763 static HRESULT WINAPI IDirect3DRM2Impl_EnumerateObjects(IDirect3DRM2* iface, D3DRMOBJECTCALLBACK cb,
764 LPVOID pArg)
766 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
768 FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, pArg);
770 return E_NOTIMPL;
773 static HRESULT WINAPI IDirect3DRM2Impl_Load(IDirect3DRM2 *iface, void *source, void *object_id, IID **iids,
774 DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx,
775 D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame *parent_frame)
777 IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
778 IDirect3DRMFrame3 *parent_frame3 = NULL;
779 HRESULT hr = D3DRM_OK;
781 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
782 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
783 iface, source, object_id, iids, iid_count, flags,
784 load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
786 if (parent_frame)
787 hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&parent_frame3);
788 if (SUCCEEDED(hr))
789 hr = IDirect3DRM3_Load(&d3drm->IDirect3DRM3_iface, source, object_id, iids, iid_count,
790 flags, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame3);
791 if (parent_frame3)
792 IDirect3DRMFrame3_Release(parent_frame3);
794 return hr;
797 static HRESULT WINAPI IDirect3DRM2Impl_Tick(IDirect3DRM2* iface, D3DVALUE tick)
799 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
801 FIXME("(%p/%p)->(%f): stub\n", iface, This, tick);
803 return E_NOTIMPL;
806 static HRESULT WINAPI IDirect3DRM2Impl_CreateProgressiveMesh(IDirect3DRM2* iface,
807 LPDIRECT3DRMPROGRESSIVEMESH * ppMesh)
809 IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
811 FIXME("(%p/%p)->(%p): stub\n", iface, This, ppMesh);
813 return E_NOTIMPL;
816 static const struct IDirect3DRM2Vtbl Direct3DRM2_Vtbl =
818 IDirect3DRM2Impl_QueryInterface,
819 IDirect3DRM2Impl_AddRef,
820 IDirect3DRM2Impl_Release,
821 IDirect3DRM2Impl_CreateObject,
822 IDirect3DRM2Impl_CreateFrame,
823 IDirect3DRM2Impl_CreateMesh,
824 IDirect3DRM2Impl_CreateMeshBuilder,
825 IDirect3DRM2Impl_CreateFace,
826 IDirect3DRM2Impl_CreateAnimation,
827 IDirect3DRM2Impl_CreateAnimationSet,
828 IDirect3DRM2Impl_CreateTexture,
829 IDirect3DRM2Impl_CreateLight,
830 IDirect3DRM2Impl_CreateLightRGB,
831 IDirect3DRM2Impl_CreateMaterial,
832 IDirect3DRM2Impl_CreateDevice,
833 IDirect3DRM2Impl_CreateDeviceFromSurface,
834 IDirect3DRM2Impl_CreateDeviceFromD3D,
835 IDirect3DRM2Impl_CreateDeviceFromClipper,
836 IDirect3DRM2Impl_CreateTextureFromSurface,
837 IDirect3DRM2Impl_CreateShadow,
838 IDirect3DRM2Impl_CreateViewport,
839 IDirect3DRM2Impl_CreateWrap,
840 IDirect3DRM2Impl_CreateUserVisual,
841 IDirect3DRM2Impl_LoadTexture,
842 IDirect3DRM2Impl_LoadTextureFromResource,
843 IDirect3DRM2Impl_SetSearchPath,
844 IDirect3DRM2Impl_AddSearchPath,
845 IDirect3DRM2Impl_GetSearchPath,
846 IDirect3DRM2Impl_SetDefaultTextureColors,
847 IDirect3DRM2Impl_SetDefaultTextureShades,
848 IDirect3DRM2Impl_GetDevices,
849 IDirect3DRM2Impl_GetNamedObject,
850 IDirect3DRM2Impl_EnumerateObjects,
851 IDirect3DRM2Impl_Load,
852 IDirect3DRM2Impl_Tick,
853 IDirect3DRM2Impl_CreateProgressiveMesh
857 /*** IUnknown methods ***/
858 static HRESULT WINAPI IDirect3DRM3Impl_QueryInterface(IDirect3DRM3* iface, REFIID riid,
859 void** ppvObject)
861 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
862 return IDirect3DRM_QueryInterface(&This->IDirect3DRM_iface, riid, ppvObject);
865 static ULONG WINAPI IDirect3DRM3Impl_AddRef(IDirect3DRM3* iface)
867 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
868 return IDirect3DRM_AddRef(&This->IDirect3DRM_iface);
871 static ULONG WINAPI IDirect3DRM3Impl_Release(IDirect3DRM3* iface)
873 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
874 return IDirect3DRM_Release(&This->IDirect3DRM_iface);
877 /*** IDirect3DRM3 methods ***/
878 static HRESULT WINAPI IDirect3DRM3Impl_CreateObject(IDirect3DRM3* iface, REFCLSID rclsid,
879 LPUNKNOWN unkwn, REFIID riid, LPVOID* object)
881 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
883 FIXME("(%p/%p)->(%s,%p,%s,%p): stub\n", iface, This, debugstr_guid(rclsid), unkwn,
884 debugstr_guid(riid), object);
886 return E_NOTIMPL;
889 static HRESULT WINAPI IDirect3DRM3Impl_CreateFrame(IDirect3DRM3 *iface,
890 IDirect3DRMFrame3 *parent, IDirect3DRMFrame3 **frame)
892 TRACE("iface %p, parent %p, frame %p.\n", iface, parent, frame);
894 return Direct3DRMFrame_create(&IID_IDirect3DRMFrame3, (IUnknown *)parent, (IUnknown **)frame);
897 static HRESULT WINAPI IDirect3DRM3Impl_CreateMesh(IDirect3DRM3 *iface, IDirect3DRMMesh **mesh)
899 TRACE("iface %p, mesh %p.\n", iface, mesh);
901 return Direct3DRMMesh_create(mesh);
904 static HRESULT WINAPI IDirect3DRM3Impl_CreateMeshBuilder(IDirect3DRM3 *iface, IDirect3DRMMeshBuilder3 **mesh_builder)
906 TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder);
908 return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder3, (IUnknown **)mesh_builder);
911 static HRESULT WINAPI IDirect3DRM3Impl_CreateFace(IDirect3DRM3 *iface, IDirect3DRMFace2 **face)
913 TRACE("iface %p, face %p.\n", iface, face);
915 return Direct3DRMFace_create(&IID_IDirect3DRMFace2, (IUnknown **)face);
918 static HRESULT WINAPI IDirect3DRM3Impl_CreateAnimation(IDirect3DRM3 *iface, IDirect3DRMAnimation2 **animation)
920 FIXME("iface %p, animation %p stub!\n", iface, animation);
922 return E_NOTIMPL;
925 static HRESULT WINAPI IDirect3DRM3Impl_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRMAnimationSet2 **set)
927 FIXME("iface %p, set %p stub!\n", iface, set);
929 return E_NOTIMPL;
932 static HRESULT WINAPI IDirect3DRM3Impl_CreateTexture(IDirect3DRM3 *iface,
933 D3DRMIMAGE *image, IDirect3DRMTexture3 **texture)
935 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
937 FIXME("(%p/%p)->(%p,%p): partial stub\n", iface, This, image, texture);
939 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
942 static HRESULT WINAPI IDirect3DRM3Impl_CreateLight(IDirect3DRM3 *iface,
943 D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
945 HRESULT hr;
947 FIXME("iface %p, type %#x, color 0x%08x, light %p partial stub!\n", iface, type, color, light);
949 if (SUCCEEDED(hr = Direct3DRMLight_create((IUnknown **)light)))
951 IDirect3DRMLight_SetType(*light, type);
952 IDirect3DRMLight_SetColor(*light, color);
955 return hr;
958 static HRESULT WINAPI IDirect3DRM3Impl_CreateLightRGB(IDirect3DRM3 *iface, D3DRMLIGHTTYPE type,
959 D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
961 HRESULT hr;
963 FIXME("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p partial stub!\n",
964 iface, type, red, green, blue, light);
966 if (SUCCEEDED(hr = Direct3DRMLight_create((IUnknown **)light)))
968 IDirect3DRMLight_SetType(*light, type);
969 IDirect3DRMLight_SetColorRGB(*light, red, green, blue);
972 return hr;
975 static HRESULT WINAPI IDirect3DRM3Impl_CreateMaterial(IDirect3DRM3 *iface,
976 D3DVALUE power, IDirect3DRMMaterial2 **material)
978 HRESULT hr;
980 TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
982 if (SUCCEEDED(hr = Direct3DRMMaterial_create(material)))
983 IDirect3DRMMaterial2_SetPower(*material, power);
985 return hr;
988 static HRESULT WINAPI IDirect3DRM3Impl_CreateDevice(IDirect3DRM3 *iface,
989 DWORD width, DWORD height, IDirect3DRMDevice3 **device)
991 FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device);
993 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown **)device);
996 static HRESULT WINAPI IDirect3DRM3Impl_CreateDeviceFromSurface(IDirect3DRM3 *iface, GUID *pGUID,
997 IDirectDraw *dd, IDirectDrawSurface *back, IDirect3DRMDevice3 **device)
999 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1001 FIXME("(%p/%p)->(%s,%p,%p,%p): partial stub\n", iface, This, debugstr_guid(pGUID), dd, back, device);
1003 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown**)device);
1006 static HRESULT WINAPI IDirect3DRM3Impl_CreateDeviceFromD3D(IDirect3DRM3 *iface,
1007 IDirect3D2 *d3d, IDirect3DDevice2 *d3ddev, IDirect3DRMDevice3 **device)
1009 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1011 FIXME("(%p/%p)->(%p,%p,%p): partial stub\n", iface, This, d3d, d3ddev, device);
1013 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown**)device);
1016 static HRESULT WINAPI IDirect3DRM3Impl_CreateDeviceFromClipper(IDirect3DRM3 *iface,
1017 IDirectDrawClipper *clipper, GUID *guid, int width, int height,
1018 IDirect3DRMDevice3 **device)
1020 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1022 FIXME("(%p/%p)->(%p,%s,%d,%d,%p): partial stub\n", iface, This, clipper, debugstr_guid(guid),
1023 width, height, device);
1025 return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown**)device);
1028 static HRESULT WINAPI IDirect3DRM3Impl_CreateShadow(IDirect3DRM3 *iface, IUnknown *object, IDirect3DRMLight *light,
1029 D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, IDirect3DRMShadow2 **shadow)
1031 FIXME("iface %p, object %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
1032 iface, object, light, px, py, pz, nx, ny, nz, shadow);
1034 return E_NOTIMPL;
1037 static HRESULT WINAPI IDirect3DRM3Impl_CreateTextureFromSurface(IDirect3DRM3 *iface,
1038 IDirectDrawSurface *surface, IDirect3DRMTexture3 **texture)
1040 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1042 FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, surface, texture);
1044 return E_NOTIMPL;
1047 static HRESULT WINAPI IDirect3DRM3Impl_CreateViewport(IDirect3DRM3 *iface, IDirect3DRMDevice3 *device,
1048 IDirect3DRMFrame3 *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport2 **viewport)
1050 FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
1051 iface, device, camera, x, y, width, height, viewport);
1053 return Direct3DRMViewport_create(&IID_IDirect3DRMViewport2, (IUnknown **)viewport);
1056 static HRESULT WINAPI IDirect3DRM3Impl_CreateWrap(IDirect3DRM3 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame3 *frame,
1057 D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
1058 D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv,
1059 IDirect3DRMWrap **wrap)
1061 FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
1062 "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
1063 iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap);
1065 return E_NOTIMPL;
1068 static HRESULT WINAPI IDirect3DRM3Impl_CreateUserVisual(IDirect3DRM3 *iface,
1069 D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual)
1071 FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface, cb, ctx, visual);
1073 return E_NOTIMPL;
1076 static HRESULT WINAPI IDirect3DRM3Impl_LoadTexture(IDirect3DRM3 *iface,
1077 const char *filename, IDirect3DRMTexture3 **texture)
1079 FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
1081 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
1084 static HRESULT WINAPI IDirect3DRM3Impl_LoadTextureFromResource(IDirect3DRM3 *iface, HMODULE module,
1085 const char *resource_name, const char *resource_type, IDirect3DRMTexture3 **texture)
1087 FIXME("iface %p, module %p, resource_name %s, resource_type %s, texture %p stub!\n",
1088 iface, module, debugstr_a(resource_name), debugstr_a(resource_type), texture);
1090 return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
1093 static HRESULT WINAPI IDirect3DRM3Impl_SetSearchPath(IDirect3DRM3* iface, LPCSTR path)
1095 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1097 FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
1099 return E_NOTIMPL;
1102 static HRESULT WINAPI IDirect3DRM3Impl_AddSearchPath(IDirect3DRM3* iface, LPCSTR path)
1104 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1106 FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
1108 return E_NOTIMPL;
1111 static HRESULT WINAPI IDirect3DRM3Impl_GetSearchPath(IDirect3DRM3* iface, DWORD* size_return,
1112 LPSTR path_return)
1114 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1116 FIXME("(%p/%p)->(%p,%s): stub\n", iface, This, size_return, path_return);
1118 return E_NOTIMPL;
1121 static HRESULT WINAPI IDirect3DRM3Impl_SetDefaultTextureColors(IDirect3DRM3* iface, DWORD nb_colors)
1123 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1125 FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_colors);
1127 return E_NOTIMPL;
1130 static HRESULT WINAPI IDirect3DRM3Impl_SetDefaultTextureShades(IDirect3DRM3* iface, DWORD nb_shades)
1132 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1134 FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_shades);
1136 return E_NOTIMPL;
1139 static HRESULT WINAPI IDirect3DRM3Impl_GetDevices(IDirect3DRM3 *iface, IDirect3DRMDeviceArray **array)
1141 FIXME("iface %p, array %p stub!\n", iface, array);
1143 return E_NOTIMPL;
1146 static HRESULT WINAPI IDirect3DRM3Impl_GetNamedObject(IDirect3DRM3 *iface,
1147 const char *name, IDirect3DRMObject **object)
1149 FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
1151 return E_NOTIMPL;
1154 static HRESULT WINAPI IDirect3DRM3Impl_EnumerateObjects(IDirect3DRM3* iface, D3DRMOBJECTCALLBACK cb,
1155 LPVOID arg)
1157 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1159 FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);
1161 return E_NOTIMPL;
1164 static HRESULT load_data(IDirect3DRM3 *iface, IDirectXFileData *data_object, IID **GUIDs, DWORD nb_GUIDs, D3DRMLOADCALLBACK LoadProc,
1165 void *ArgLP, D3DRMLOADTEXTURECALLBACK LoadTextureProc, void *ArgLTP, IDirect3DRMFrame3 *parent_frame)
1167 HRESULT ret = D3DRMERR_BADOBJECT;
1168 HRESULT hr;
1169 const GUID* guid;
1170 DWORD i;
1171 BOOL requested = FALSE;
1173 hr = IDirectXFileData_GetType(data_object, &guid);
1174 if (hr != DXFILE_OK)
1175 goto end;
1177 TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid));
1179 /* Load object only if it is top level and requested or if it is part of another object */
1181 if (IsEqualGUID(guid, &TID_D3DRMMesh))
1183 TRACE("Found TID_D3DRMMesh\n");
1185 for (i = 0; i < nb_GUIDs; i++)
1186 if (IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder) ||
1187 IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder2) ||
1188 IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder3))
1190 requested = TRUE;
1191 break;
1194 if (requested || parent_frame)
1196 IDirect3DRMMeshBuilder3 *meshbuilder;
1198 TRACE("Load mesh data\n");
1200 hr = IDirect3DRM3_CreateMeshBuilder(iface, &meshbuilder);
1201 if (SUCCEEDED(hr))
1203 hr = load_mesh_data(meshbuilder, data_object, LoadTextureProc, ArgLTP);
1204 if (SUCCEEDED(hr))
1206 /* Only top level objects are notified */
1207 if (!parent_frame)
1209 IDirect3DRMObject *object;
1211 hr = IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder, GUIDs[i], (void**)&object);
1212 if (SUCCEEDED(hr))
1214 LoadProc(object, GUIDs[i], ArgLP);
1215 IDirect3DRMObject_Release(object);
1218 else
1220 IDirect3DRMFrame3_AddVisual(parent_frame, (IUnknown*)meshbuilder);
1223 IDirect3DRMMeshBuilder3_Release(meshbuilder);
1226 if (FAILED(hr))
1227 ERR("Cannot process mesh\n");
1230 else if (IsEqualGUID(guid, &TID_D3DRMFrame))
1232 TRACE("Found TID_D3DRMFrame\n");
1234 for (i = 0; i < nb_GUIDs; i++)
1235 if (IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame) ||
1236 IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame2) ||
1237 IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame3))
1239 requested = TRUE;
1240 break;
1243 if (requested || parent_frame)
1245 IDirect3DRMFrame3 *frame;
1247 TRACE("Load frame data\n");
1249 hr = IDirect3DRM3_CreateFrame(iface, parent_frame, &frame);
1250 if (SUCCEEDED(hr))
1252 IDirectXFileObject *child;
1254 while (SUCCEEDED(hr = IDirectXFileData_GetNextObject(data_object, &child)))
1256 IDirectXFileData *data;
1257 IDirectXFileDataReference *reference;
1258 IDirectXFileBinary *binary;
1260 hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileBinary, (void **)&binary);
1261 if (SUCCEEDED(hr))
1263 FIXME("Binary Object not supported yet\n");
1264 IDirectXFileBinary_Release(binary);
1265 continue;
1268 hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileData, (void **)&data);
1269 if (SUCCEEDED(hr))
1271 TRACE("Found Data Object\n");
1272 hr = load_data(iface, data, GUIDs, nb_GUIDs, LoadProc, ArgLP, LoadTextureProc, ArgLTP, frame);
1273 IDirectXFileData_Release(data);
1274 continue;
1276 hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileDataReference, (void **)&reference);
1277 if (SUCCEEDED(hr))
1279 TRACE("Found Data Object Reference\n");
1280 IDirectXFileDataReference_Resolve(reference, &data);
1281 hr = load_data(iface, data, GUIDs, nb_GUIDs, LoadProc, ArgLP, LoadTextureProc, ArgLTP, frame);
1282 IDirectXFileData_Release(data);
1283 IDirectXFileDataReference_Release(reference);
1284 continue;
1288 if (hr != DXFILEERR_NOMOREOBJECTS)
1290 IDirect3DRMFrame3_Release(frame);
1291 goto end;
1293 hr = S_OK;
1295 /* Only top level objects are notified */
1296 if (!parent_frame)
1298 IDirect3DRMObject *object;
1300 hr = IDirect3DRMFrame3_QueryInterface(frame, GUIDs[i], (void**)&object);
1301 if (SUCCEEDED(hr))
1303 LoadProc(object, GUIDs[i], ArgLP);
1304 IDirect3DRMObject_Release(object);
1307 IDirect3DRMFrame3_Release(frame);
1310 if (FAILED(hr))
1311 ERR("Cannot process frame\n");
1314 else if (IsEqualGUID(guid, &TID_D3DRMMaterial))
1316 TRACE("Found TID_D3DRMMaterial\n");
1318 /* Cannot be requested so nothing to do */
1320 else if (IsEqualGUID(guid, &TID_D3DRMFrameTransformMatrix))
1322 TRACE("Found TID_D3DRMFrameTransformMatrix\n");
1324 /* Cannot be requested */
1325 if (parent_frame)
1327 D3DRMMATRIX4D matrix;
1328 DWORD size;
1330 TRACE("Load Frame Transform Matrix data\n");
1332 size = sizeof(matrix);
1333 hr = IDirectXFileData_GetData(data_object, NULL, &size, (void**)matrix);
1334 if ((hr != DXFILE_OK) || (size != sizeof(matrix)))
1335 goto end;
1337 hr = IDirect3DRMFrame3_AddTransform(parent_frame, D3DRMCOMBINE_REPLACE, matrix);
1338 if (FAILED(hr))
1339 goto end;
1342 else
1344 FIXME("Found unknown TID %s\n", debugstr_guid(guid));
1347 ret = D3DRM_OK;
1349 end:
1351 return ret;
1354 static HRESULT WINAPI IDirect3DRM3Impl_Load(IDirect3DRM3 *iface, void *source, void *object_id, IID **iids,
1355 DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx,
1356 D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame3 *parent_frame)
1358 DXFILELOADOPTIONS load_options;
1359 LPDIRECTXFILE pDXFile = NULL;
1360 LPDIRECTXFILEENUMOBJECT pEnumObject = NULL;
1361 LPDIRECTXFILEDATA pData = NULL;
1362 HRESULT hr;
1363 const GUID* pGuid;
1364 DWORD size;
1365 Header* pHeader;
1366 HRESULT ret = D3DRMERR_BADOBJECT;
1367 DWORD i;
1369 TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
1370 "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
1371 iface, source, object_id, iids, iid_count, flags,
1372 load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
1374 TRACE("Looking for GUIDs:\n");
1375 for (i = 0; i < iid_count; ++i)
1376 TRACE("- %s (%s)\n", debugstr_guid(iids[i]), get_IID_string(iids[i]));
1378 if (flags == D3DRMLOAD_FROMMEMORY)
1380 load_options = DXFILELOAD_FROMMEMORY;
1382 else if (flags == D3DRMLOAD_FROMFILE)
1384 load_options = DXFILELOAD_FROMFILE;
1385 TRACE("Loading from file %s\n", debugstr_a(source));
1387 else
1389 FIXME("Load options %#x not supported yet.\n", flags);
1390 return E_NOTIMPL;
1393 hr = DirectXFileCreate(&pDXFile);
1394 if (hr != DXFILE_OK)
1395 goto end;
1397 hr = IDirectXFile_RegisterTemplates(pDXFile, templates, strlen(templates));
1398 if (hr != DXFILE_OK)
1399 goto end;
1401 hr = IDirectXFile_CreateEnumObject(pDXFile, source, load_options, &pEnumObject);
1402 if (hr != DXFILE_OK)
1403 goto end;
1405 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
1406 if (hr != DXFILE_OK)
1407 goto end;
1409 hr = IDirectXFileData_GetType(pData, &pGuid);
1410 if (hr != DXFILE_OK)
1411 goto end;
1413 TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
1415 if (!IsEqualGUID(pGuid, &TID_DXFILEHeader))
1417 ret = D3DRMERR_BADFILE;
1418 goto end;
1421 hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&pHeader);
1422 if ((hr != DXFILE_OK) || (size != sizeof(Header)))
1423 goto end;
1425 TRACE("Version is %d %d %d\n", pHeader->major, pHeader->minor, pHeader->flags);
1427 /* Version must be 1.0.x */
1428 if ((pHeader->major != 1) || (pHeader->minor != 0))
1430 ret = D3DRMERR_BADFILE;
1431 goto end;
1434 IDirectXFileData_Release(pData);
1435 pData = NULL;
1437 while (1)
1439 hr = IDirectXFileEnumObject_GetNextDataObject(pEnumObject, &pData);
1440 if (hr == DXFILEERR_NOMOREOBJECTS)
1442 TRACE("No more object\n");
1443 break;
1445 else if (hr != DXFILE_OK)
1447 ret = D3DRMERR_BADFILE;
1448 goto end;
1451 ret = load_data(iface, pData, iids, iid_count, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
1452 if (ret != D3DRM_OK)
1453 goto end;
1455 IDirectXFileData_Release(pData);
1456 pData = NULL;
1459 ret = D3DRM_OK;
1461 end:
1462 if (pData)
1463 IDirectXFileData_Release(pData);
1464 if (pEnumObject)
1465 IDirectXFileEnumObject_Release(pEnumObject);
1466 if (pDXFile)
1467 IDirectXFile_Release(pDXFile);
1469 return ret;
1472 static HRESULT WINAPI IDirect3DRM3Impl_Tick(IDirect3DRM3* iface, D3DVALUE tick)
1474 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1476 FIXME("(%p/%p)->(%f): stub\n", iface, This, tick);
1478 return E_NOTIMPL;
1481 static HRESULT WINAPI IDirect3DRM3Impl_CreateProgressiveMesh(IDirect3DRM3* iface,
1482 LPDIRECT3DRMPROGRESSIVEMESH Mesh)
1484 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1486 FIXME("(%p/%p)->(%p): stub\n", iface, This, Mesh);
1488 return E_NOTIMPL;
1491 static HRESULT WINAPI IDirect3DRM3Impl_RegisterClient(IDirect3DRM3* iface, REFGUID rguid,
1492 LPDWORD id)
1494 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1496 FIXME("(%p/%p)->(%s, %p): stub\n", iface, This, debugstr_guid(rguid), id);
1498 return E_NOTIMPL;
1501 static HRESULT WINAPI IDirect3DRM3Impl_UnregisterClient(IDirect3DRM3* iface, REFGUID rguid)
1503 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1505 FIXME("(%p/%p)->(%s): stub\n", iface, This, debugstr_guid(rguid));
1507 return E_NOTIMPL;
1510 static HRESULT WINAPI IDirect3DRM3Impl_CreateClippedVisual(IDirect3DRM3 *iface,
1511 IDirect3DRMVisual *visual, IDirect3DRMClippedVisual **clipped_visual)
1513 FIXME("iface %p, visual %p, clipped_visual %p stub!\n", iface, visual, clipped_visual);
1515 return E_NOTIMPL;
1518 static HRESULT WINAPI IDirect3DRM3Impl_SetOptions(IDirect3DRM3* iface, DWORD opt)
1520 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1522 FIXME("(%p/%p)->(%d): stub\n", iface, This, opt);
1524 return E_NOTIMPL;
1527 static HRESULT WINAPI IDirect3DRM3Impl_GetOptions(IDirect3DRM3* iface, LPDWORD opt)
1529 IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
1531 FIXME("(%p/%p)->(%p): stub\n", iface, This, opt);
1533 return E_NOTIMPL;
1536 static const struct IDirect3DRM3Vtbl Direct3DRM3_Vtbl =
1538 IDirect3DRM3Impl_QueryInterface,
1539 IDirect3DRM3Impl_AddRef,
1540 IDirect3DRM3Impl_Release,
1541 IDirect3DRM3Impl_CreateObject,
1542 IDirect3DRM3Impl_CreateFrame,
1543 IDirect3DRM3Impl_CreateMesh,
1544 IDirect3DRM3Impl_CreateMeshBuilder,
1545 IDirect3DRM3Impl_CreateFace,
1546 IDirect3DRM3Impl_CreateAnimation,
1547 IDirect3DRM3Impl_CreateAnimationSet,
1548 IDirect3DRM3Impl_CreateTexture,
1549 IDirect3DRM3Impl_CreateLight,
1550 IDirect3DRM3Impl_CreateLightRGB,
1551 IDirect3DRM3Impl_CreateMaterial,
1552 IDirect3DRM3Impl_CreateDevice,
1553 IDirect3DRM3Impl_CreateDeviceFromSurface,
1554 IDirect3DRM3Impl_CreateDeviceFromD3D,
1555 IDirect3DRM3Impl_CreateDeviceFromClipper,
1556 IDirect3DRM3Impl_CreateTextureFromSurface,
1557 IDirect3DRM3Impl_CreateShadow,
1558 IDirect3DRM3Impl_CreateViewport,
1559 IDirect3DRM3Impl_CreateWrap,
1560 IDirect3DRM3Impl_CreateUserVisual,
1561 IDirect3DRM3Impl_LoadTexture,
1562 IDirect3DRM3Impl_LoadTextureFromResource,
1563 IDirect3DRM3Impl_SetSearchPath,
1564 IDirect3DRM3Impl_AddSearchPath,
1565 IDirect3DRM3Impl_GetSearchPath,
1566 IDirect3DRM3Impl_SetDefaultTextureColors,
1567 IDirect3DRM3Impl_SetDefaultTextureShades,
1568 IDirect3DRM3Impl_GetDevices,
1569 IDirect3DRM3Impl_GetNamedObject,
1570 IDirect3DRM3Impl_EnumerateObjects,
1571 IDirect3DRM3Impl_Load,
1572 IDirect3DRM3Impl_Tick,
1573 IDirect3DRM3Impl_CreateProgressiveMesh,
1574 IDirect3DRM3Impl_RegisterClient,
1575 IDirect3DRM3Impl_UnregisterClient,
1576 IDirect3DRM3Impl_CreateClippedVisual,
1577 IDirect3DRM3Impl_SetOptions,
1578 IDirect3DRM3Impl_GetOptions
1581 HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm)
1583 IDirect3DRMImpl *object;
1585 TRACE("d3drm %p.\n", d3drm);
1587 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
1588 return E_OUTOFMEMORY;
1590 object->IDirect3DRM_iface.lpVtbl = &Direct3DRM_Vtbl;
1591 object->IDirect3DRM2_iface.lpVtbl = &Direct3DRM2_Vtbl;
1592 object->IDirect3DRM3_iface.lpVtbl = &Direct3DRM3_Vtbl;
1593 object->ref = 1;
1595 *d3drm = &object->IDirect3DRM_iface;
1597 return S_OK;