frame.c 86.7 KB
Newer Older
1 2 3
/*
 * Implementation of IDirect3DRMFrame Interface
 *
4
 * Copyright 2011, 2012 André Hentschel
5
 * Copyright 2012 Christian Costa
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

22
#include <assert.h>
23 24 25 26 27 28 29 30 31 32 33
#include "wine/debug.h"

#define COBJMACROS

#include "winbase.h"
#include "wingdi.h"

#include "d3drm_private.h"

WINE_DEFAULT_DEBUG_CHANNEL(d3drm);

34 35 36 37 38 39 40
static D3DRMMATRIX4D identity = {
    { 1.0f, 0.0f, 0.0f, 0.0f },
    { 0.0f, 1.0f, 0.0f, 0.0f },
    { 0.0f, 0.0f, 1.0f, 0.0f },
    { 0.0f, 0.0f, 0.0f, 1.0f }
};

41 42 43
typedef struct IDirect3DRMFrameImpl IDirect3DRMFrameImpl;

struct IDirect3DRMFrameImpl {
44
    IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
45
    IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
46
    LONG ref;
47
    IDirect3DRMFrameImpl* parent;
48 49 50
    ULONG nb_children;
    ULONG children_capacity;
    IDirect3DRMFrame3** children;
51 52 53
    ULONG nb_visuals;
    ULONG visuals_capacity;
    IDirect3DRMVisual** visuals;
54 55 56
    ULONG nb_lights;
    ULONG lights_capacity;
    IDirect3DRMLight** lights;
57
    D3DRMMATRIX4D transform;
58
};
59

60 61 62 63 64 65 66
typedef struct {
    IDirect3DRMFrameArray IDirect3DRMFrameArray_iface;
    LONG ref;
    ULONG size;
    LPDIRECT3DRMFRAME* frames;
} IDirect3DRMFrameArrayImpl;

67 68 69 70 71 72 73
typedef struct {
    IDirect3DRMVisualArray IDirect3DRMVisualArray_iface;
    LONG ref;
    ULONG size;
    LPDIRECT3DRMVISUAL* visuals;
} IDirect3DRMVisualArrayImpl;

74 75 76 77 78 79 80
typedef struct {
    IDirect3DRMLightArray IDirect3DRMLightArray_iface;
    LONG ref;
    ULONG size;
    LPDIRECT3DRMLIGHT* lights;
} IDirect3DRMLightArrayImpl;

81 82 83 84 85
static inline IDirect3DRMFrameImpl *impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface)
{
    return CONTAINING_RECORD(iface, IDirect3DRMFrameImpl, IDirect3DRMFrame2_iface);
}

86 87 88 89 90
static inline IDirect3DRMFrameImpl *impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
{
    return CONTAINING_RECORD(iface, IDirect3DRMFrameImpl, IDirect3DRMFrame3_iface);
}

91
static inline IDirect3DRMFrameImpl *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface);
92

93 94 95 96 97
static inline IDirect3DRMLightArrayImpl *impl_from_IDirect3DRMLightArray(IDirect3DRMLightArray *iface)
{
    return CONTAINING_RECORD(iface, IDirect3DRMLightArrayImpl, IDirect3DRMLightArray_iface);
}

98
/*** IUnknown methods ***/
99 100
static HRESULT WINAPI IDirect3DRMFrameArrayImpl_QueryInterface(IDirect3DRMFrameArray* iface,
                                                               REFIID riid, void** object)
101
{
102
    IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
103 104 105 106 107

    TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);

    *object = NULL;

108 109
    if (IsEqualGUID(riid, &IID_IUnknown) ||
        IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
110
    {
111
        *object = &This->IDirect3DRMFrameArray_iface;
112
    }
113 114 115 116 117 118
    else
    {
        FIXME("interface %s not implemented\n", debugstr_guid(riid));
        return E_NOINTERFACE;
    }

119
    IDirect3DRMFrameArray_AddRef(iface);
120 121 122
    return S_OK;
}

123
static ULONG WINAPI IDirect3DRMFrameArrayImpl_AddRef(IDirect3DRMFrameArray* iface)
124
{
125
    IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
126
    ULONG ref = InterlockedIncrement(&This->ref);
127

128
    TRACE("(%p)->(): new ref = %u\n", This, ref);
129

130
    return ref;
131 132
}

133
static ULONG WINAPI IDirect3DRMFrameArrayImpl_Release(IDirect3DRMFrameArray* iface)
134
{
135
    IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
136
    ULONG ref = InterlockedDecrement(&This->ref);
137
    ULONG i;
138

139
    TRACE("(%p)->(): new ref = %u\n", This, ref);
140 141

    if (!ref)
142
    {
143 144 145
        for (i = 0; i < This->size; i++)
            IDirect3DRMFrame_Release(This->frames[i]);
        HeapFree(GetProcessHeap(), 0, This->frames);
146
        HeapFree(GetProcessHeap(), 0, This);
147
    }
148 149 150 151

    return ref;
}

152 153
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMFrameArrayImpl_GetSize(IDirect3DRMFrameArray* iface)
154
{
155
    IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
156

157
    TRACE("(%p)->() = %d\n", This,  This->size);
158

159
    return This->size;
160 161
}

162 163
/*** IDirect3DRMFrameArray methods ***/
static HRESULT WINAPI IDirect3DRMFrameArrayImpl_GetElement(IDirect3DRMFrameArray* iface, DWORD index, LPDIRECT3DRMFRAME* frame)
164
{
165
    IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
166

167
    TRACE("(%p)->(%u, %p)\n", This, index, frame);
168

169 170
    if (!frame)
        return D3DRMERR_BADVALUE;
171

172
    *frame = NULL;
173

174 175
    if (index >= This->size)
        return D3DRMERR_BADVALUE;
176

177 178 179 180
    IDirect3DRMFrame_AddRef(This->frames[index]);
    *frame = This->frames[index];

    return D3DRM_OK;
181 182
}

183
static const struct IDirect3DRMFrameArrayVtbl Direct3DRMFrameArray_Vtbl =
184
{
185 186 187 188 189 190 191 192 193
    /*** IUnknown methods ***/
    IDirect3DRMFrameArrayImpl_QueryInterface,
    IDirect3DRMFrameArrayImpl_AddRef,
    IDirect3DRMFrameArrayImpl_Release,
    /*** IDirect3DRMArray methods ***/
    IDirect3DRMFrameArrayImpl_GetSize,
    /*** IDirect3DRMFrameArray methods ***/
    IDirect3DRMFrameArrayImpl_GetElement
};
194

195
static HRESULT Direct3DRMFrameArray_create(IDirect3DRMFrameArray** obj)
196
{
197
    IDirect3DRMFrameArrayImpl* object;
198

199
    TRACE("(%p)\n", obj);
200

201
    *obj = NULL;
202

203 204 205 206 207 208
    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMFrameArrayImpl));
    if (!object)
    {
        ERR("Out of memory\n");
        return E_OUTOFMEMORY;
    }
209

210 211
    object->IDirect3DRMFrameArray_iface.lpVtbl = &Direct3DRMFrameArray_Vtbl;
    object->ref = 1;
212

213 214 215
    *obj = &object->IDirect3DRMFrameArray_iface;

    return S_OK;
216 217
}

218 219 220
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_QueryInterface(IDirect3DRMVisualArray* iface,
                                                                REFIID riid, void** ret_iface)
221
{
222
    TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
223

224 225 226 227 228 229 230
    if (IsEqualGUID(riid, &IID_IUnknown) ||
        IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
    {
        *ret_iface = iface;
        IDirect3DRMVisualArray_AddRef(iface);
        return S_OK;
    }
231

232 233 234 235 236
    *ret_iface = NULL;

    WARN("Interface %s not implemented\n", debugstr_guid(riid));

    return E_NOINTERFACE;
237 238
}

239
static ULONG WINAPI IDirect3DRMVisualArrayImpl_AddRef(IDirect3DRMVisualArray* iface)
240
{
241 242
    IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
    ULONG ref = InterlockedIncrement(&This->ref);
243

244
    TRACE("(%p)->(): new ref = %u\n", iface, ref);
245

246
    return ref;
247 248
}

249
static ULONG WINAPI IDirect3DRMVisualArrayImpl_Release(IDirect3DRMVisualArray* iface)
250
{
251 252 253
    IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
    ULONG ref = InterlockedDecrement(&This->ref);
    ULONG i;
254

255
    TRACE("(%p)->(): new ref = %u\n", iface, ref);
256

257 258 259 260 261 262 263
    if (!ref)
    {
        for (i = 0; i < This->size; i++)
            IDirect3DRMVisual_Release(This->visuals[i]);
        HeapFree(GetProcessHeap(), 0, This->visuals);
        HeapFree(GetProcessHeap(), 0, This);
    }
264

265
    return ref;
266 267
}

268 269
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMVisualArrayImpl_GetSize(IDirect3DRMVisualArray* iface)
270
{
271
    IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
272

273
    TRACE("(%p)->() = %d\n", iface,  This->size);
274

275
    return This->size;
276 277
}

278 279
/*** IDirect3DRMVisualArray methods ***/
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_GetElement(IDirect3DRMVisualArray* iface, DWORD index, LPDIRECT3DRMVISUAL* visual)
280
{
281
    IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
282

283
    TRACE("(%p)->(%u, %p)\n", iface, index, visual);
284

285 286
    if (!visual)
        return D3DRMERR_BADVALUE;
287

288
    *visual = NULL;
289

290 291
    if (index >= This->size)
        return D3DRMERR_BADVALUE;
292

293 294 295 296
    IDirect3DRMVisual_AddRef(This->visuals[index]);
    *visual = This->visuals[index];

    return D3DRM_OK;
297 298
}

299
static const struct IDirect3DRMVisualArrayVtbl Direct3DRMVisualArray_Vtbl =
300
{
301 302 303 304 305 306 307 308 309
    /*** IUnknown methods ***/
    IDirect3DRMVisualArrayImpl_QueryInterface,
    IDirect3DRMVisualArrayImpl_AddRef,
    IDirect3DRMVisualArrayImpl_Release,
    /*** IDirect3DRMArray methods ***/
    IDirect3DRMVisualArrayImpl_GetSize,
    /*** IDirect3DRMVisualArray methods ***/
    IDirect3DRMVisualArrayImpl_GetElement
};
310

311
static HRESULT Direct3DRMVisualArray_create(IDirect3DRMVisualArray** ret_iface)
312 313
{
    IDirect3DRMVisualArrayImpl* object;
314

315
    TRACE("(%p)\n", ret_iface);
316

317
    *ret_iface = NULL;
318

319 320 321 322 323 324
    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMVisualArrayImpl));
    if (!object)
    {
        ERR("Out of memory\n");
        return E_OUTOFMEMORY;
    }
325

326 327 328 329 330 331
    object->IDirect3DRMVisualArray_iface.lpVtbl = &Direct3DRMVisualArray_Vtbl;
    object->ref = 1;

    *ret_iface = &object->IDirect3DRMVisualArray_iface;

    return S_OK;
332 333
}

334 335 336
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMLightArrayImpl_QueryInterface(IDirect3DRMLightArray* iface,
                                                               REFIID riid, void** object)
337
{
338
    IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
339

340
    TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
341

342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
    *object = NULL;

    if (IsEqualGUID(riid, &IID_IUnknown) ||
        IsEqualGUID(riid, &IID_IDirect3DRMLightArray))
    {
        *object = &This->IDirect3DRMLightArray_iface;
    }
    else
    {
        FIXME("interface %s not implemented\n", debugstr_guid(riid));
        return E_NOINTERFACE;
    }

    IDirect3DRMLightArray_AddRef(iface);
    return S_OK;
357 358
}

359
static ULONG WINAPI IDirect3DRMLightArrayImpl_AddRef(IDirect3DRMLightArray* iface)
360
{
361 362
    IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
    ULONG ref = InterlockedIncrement(&This->ref);
363

364
    TRACE("(%p)->(): new ref = %u\n", This, ref);
365

366
    return ref;
367 368
}

369
static ULONG WINAPI IDirect3DRMLightArrayImpl_Release(IDirect3DRMLightArray* iface)
370
{
371 372 373
    IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
    ULONG ref = InterlockedDecrement(&This->ref);
    ULONG i;
374

375
    TRACE("(%p)->(): new ref = %u\n", This, ref);
376

377 378 379 380 381 382 383 384 385
    if (!ref)
    {
        for (i = 0; i < This->size; i++)
            IDirect3DRMLight_Release(This->lights[i]);
        HeapFree(GetProcessHeap(), 0, This->lights);
        HeapFree(GetProcessHeap(), 0, This);
    }

    return ref;
386 387
}

388 389
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMLightArrayImpl_GetSize(IDirect3DRMLightArray* iface)
390
{
391
    IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
392

393
    TRACE("(%p)->() = %d\n", This,  This->size);
394

395
    return This->size;
396 397
}

398 399
/*** IDirect3DRMLightArray methods ***/
static HRESULT WINAPI IDirect3DRMLightArrayImpl_GetElement(IDirect3DRMLightArray* iface, DWORD index, LPDIRECT3DRMLIGHT* light)
400
{
401
    IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
402

403
    TRACE("(%p)->(%u, %p)\n", This, index, light);
404

405 406 407 408 409 410 411 412 413 414 415 416
    if (!light)
        return D3DRMERR_BADVALUE;

    *light = NULL;

    if (index >= This->size)
        return D3DRMERR_BADVALUE;

    IDirect3DRMLight_AddRef(This->lights[index]);
    *light = This->lights[index];

    return D3DRM_OK;
417 418
}

419
static const struct IDirect3DRMLightArrayVtbl Direct3DRMLightArray_Vtbl =
420
{
421 422 423 424 425 426 427 428 429
    /*** IUnknown methods ***/
    IDirect3DRMLightArrayImpl_QueryInterface,
    IDirect3DRMLightArrayImpl_AddRef,
    IDirect3DRMLightArrayImpl_Release,
    /*** IDirect3DRMArray methods ***/
    IDirect3DRMLightArrayImpl_GetSize,
    /*** IDirect3DRMLightArray methods ***/
    IDirect3DRMLightArrayImpl_GetElement
};
430

431
static HRESULT Direct3DRMLightArray_create(IDirect3DRMLightArray** obj)
432 433
{
    IDirect3DRMLightArrayImpl* object;
434

435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
    TRACE("(%p)\n", obj);

    *obj = NULL;

    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMLightArrayImpl));
    if (!object)
    {
        ERR("Out of memory\n");
        return E_OUTOFMEMORY;
    }

    object->IDirect3DRMLightArray_iface.lpVtbl = &Direct3DRMLightArray_Vtbl;
    object->ref = 1;

    *obj = &object->IDirect3DRMLightArray_iface;

    return S_OK;
452 453
}

454 455 456
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_QueryInterface(IDirect3DRMFrame2* iface,
                                                           REFIID riid, void** object)
457 458 459
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

460
    TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
461

462
    *object = NULL;
463

464 465 466
    if(IsEqualGUID(riid, &IID_IUnknown) ||
       IsEqualGUID(riid, &IID_IDirect3DRMFrame) ||
       IsEqualGUID(riid, &IID_IDirect3DRMFrame2))
467
    {
468 469 470 471 472
        *object = &This->IDirect3DRMFrame2_iface;
    }
    else if(IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
    {
        *object = &This->IDirect3DRMFrame3_iface;
473 474 475
    }
    else
    {
476 477
        FIXME("interface %s not implemented\n", debugstr_guid(riid));
        return E_NOINTERFACE;
478 479
    }

480 481
    IDirect3DRMFrame2_AddRef(iface);
    return S_OK;
482 483
}

484
static ULONG WINAPI IDirect3DRMFrame2Impl_AddRef(IDirect3DRMFrame2* iface)
485 486
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
487
    ULONG ref = InterlockedIncrement(&This->ref);
488

489
    TRACE("(%p)->(): new ref = %d\n", This, ref);
490

491
    return ref;
492 493
}

494
static ULONG WINAPI IDirect3DRMFrame2Impl_Release(IDirect3DRMFrame2* iface)
495 496
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
497 498
    ULONG ref = InterlockedDecrement(&This->ref);
    ULONG i;
499

500
    TRACE("(%p)->(): new ref = %d\n", This, ref);
501

502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
    if (!ref)
    {
        for (i = 0; i < This->nb_children; i++)
            IDirect3DRMFrame3_Release(This->children[i]);
        HeapFree(GetProcessHeap(), 0, This->children);
        for (i = 0; i < This->nb_visuals; i++)
            IDirect3DRMVisual_Release(This->visuals[i]);
        HeapFree(GetProcessHeap(), 0, This->visuals);
        for (i = 0; i < This->nb_lights; i++)
            IDirect3DRMLight_Release(This->lights[i]);
        HeapFree(GetProcessHeap(), 0, This->lights);
        HeapFree(GetProcessHeap(), 0, This);
    }

    return ref;
517 518
}

519 520 521 522
/*** IDirect3DRMObject methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_Clone(IDirect3DRMFrame2* iface,
                                                  LPUNKNOWN unkwn, REFIID riid,
                                                  LPVOID* object)
523 524 525
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

526
    FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
527 528 529 530

    return E_NOTIMPL;
}

531 532 533
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddDestroyCallback(IDirect3DRMFrame2* iface,
                                                               D3DRMOBJECTCALLBACK cb,
                                                               LPVOID argument)
534 535 536
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

537
    FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
538

539
    return E_NOTIMPL;
540 541
}

542 543 544
static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteDestroyCallback(IDirect3DRMFrame2* iface,
                                                                  D3DRMOBJECTCALLBACK cb,
                                                                  LPVOID argument)
545 546 547
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

548
    FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
549 550 551 552

    return E_NOTIMPL;
}

553 554
static HRESULT WINAPI IDirect3DRMFrame2Impl_SetAppData(IDirect3DRMFrame2* iface,
                                                       DWORD data)
555 556 557
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

558
    FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
559

560 561
    return E_NOTIMPL;
}
562

563 564 565 566 567 568 569
static DWORD WINAPI IDirect3DRMFrame2Impl_GetAppData(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
570 571
}

572
static HRESULT WINAPI IDirect3DRMFrame2Impl_SetName(IDirect3DRMFrame2* iface, LPCSTR name)
573 574 575
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

576
    FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
577 578 579 580

    return E_NOTIMPL;
}

581 582
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetName(IDirect3DRMFrame2* iface,
                                                    LPDWORD size, LPSTR name)
583 584 585
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

586
    FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
587 588 589 590

    return E_NOTIMPL;
}

591 592
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetClassName(IDirect3DRMFrame2* iface,
                                                         LPDWORD size, LPSTR name)
593 594 595
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

596
    TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
597

598
    return IDirect3DRMFrame3_GetClassName(&This->IDirect3DRMFrame3_iface, size, name);
599
}
600

601 602 603 604 605
/*** IDirect3DRMFrame methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddChild(IDirect3DRMFrame2* iface,
                                                     LPDIRECT3DRMFRAME child)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
606 607
    IDirect3DRMFrame3 *frame;
    HRESULT hr;
608

609 610
    TRACE("(%p/%p)->(%p)\n", iface, This, child);

611 612 613 614
    if (!child)
        return D3DRMERR_BADOBJECT;
    hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void**)&frame);
    if (hr != S_OK)
615
        return D3DRMERR_BADOBJECT;
616
    IDirect3DRMFrame_Release(child);
617

618
    return IDirect3DRMFrame3_AddChild(&This->IDirect3DRMFrame3_iface, frame);
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_AddLight(IDirect3DRMFrame2* iface,
                                                       LPDIRECT3DRMLIGHT light)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    TRACE("(%p/%p)->(%p)\n", iface, This, light);

    return IDirect3DRMFrame3_AddLight(&This->IDirect3DRMFrame3_iface, light);
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_AddMoveCallback(IDirect3DRMFrame2* iface,
                                                            D3DRMFRAMEMOVECALLBACK cb, VOID *arg)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTransform(IDirect3DRMFrame2* iface,
                                                         D3DRMCOMBINETYPE type,
                                                         D3DRMMATRIX4D matrix)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    TRACE("(%p/%p)->(%u,%p)\n", iface, This, type, matrix);

    return IDirect3DRMFrame3_AddTransform(&This->IDirect3DRMFrame3_iface, type, matrix);
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTranslation(IDirect3DRMFrame2* iface,
                                                           D3DRMCOMBINETYPE type,
                                                           D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, x, y, z);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_AddScale(IDirect3DRMFrame2* iface,
                                                     D3DRMCOMBINETYPE type,
                                                     D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, sx, sy, sz);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_AddRotation(IDirect3DRMFrame2* iface,
                                                        D3DRMCOMBINETYPE type,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z,
                                                        D3DVALUE theta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u,%f,%f,%f,%f): stub\n", iface, This, type, x, y, z, theta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_AddVisual(IDirect3DRMFrame2* iface,
                                                      LPDIRECT3DRMVISUAL vis)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    TRACE("(%p/%p)->(%p)\n", iface, This, vis);

    return IDirect3DRMFrame3_AddVisual(&This->IDirect3DRMFrame3_iface, (LPUNKNOWN)vis);
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetChildren(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAMEARRAY *children)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    TRACE("(%p/%p)->(%p)\n", iface, This, children);

    return IDirect3DRMFrame3_GetChildren(&This->IDirect3DRMFrame3_iface, children);
}

static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetColor(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetLights(IDirect3DRMFrame2* iface,
                                                      LPDIRECT3DRMLIGHTARRAY *lights)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    TRACE("(%p/%p)->(%p)\n", iface, This, lights);

    return IDirect3DRMFrame3_GetLights(&This->IDirect3DRMFrame3_iface, lights);
}

static D3DRMMATERIALMODE WINAPI IDirect3DRMFrame2Impl_GetMaterialMode(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMMATERIAL_FROMPARENT;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetParent(IDirect3DRMFrame2* iface,
                                                      LPDIRECT3DRMFRAME * frame)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    TRACE("(%p/%p)->(%p)\n", iface, This, frame);

    if (!frame)
        return D3DRMERR_BADVALUE;

    if (This->parent)
    {
        *frame = (LPDIRECT3DRMFRAME)&This->parent->IDirect3DRMFrame2_iface;
        IDirect3DRMFrame_AddRef(*frame);
    }
    else
    {
        *frame = NULL;
    }

    return D3DRM_OK;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetPosition(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAME reference,
                                                        LPD3DVECTOR return_position)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, return_position);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetRotation(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAME reference,
                                                        LPD3DVECTOR axis, LPD3DVALUE return_theta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, axis, return_theta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetScene(IDirect3DRMFrame2* iface,
                                                     LPDIRECT3DRMFRAME * frame)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);

    return E_NOTIMPL;
}

static D3DRMSORTMODE WINAPI IDirect3DRMFrame2Impl_GetSortMode(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMSORT_FROMPARENT;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTexture(IDirect3DRMFrame2* iface,
                                                       LPDIRECT3DRMTEXTURE * tex)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, tex);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTransform(IDirect3DRMFrame2* iface,
                                                         D3DRMMATRIX4D return_matrix)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    TRACE("(%p/%p)->(%p)\n", iface, This, return_matrix);

    memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));

    return D3DRM_OK;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVelocity(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAME reference,
                                                        LPD3DVECTOR return_velocity,
                                                        BOOL with_rotation)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p,%d): stub\n", iface, This, reference, return_velocity, with_rotation);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetOrientation(IDirect3DRMFrame2* iface,
                                                           LPDIRECT3DRMFRAME reference,
                                                           LPD3DVECTOR dir, LPD3DVECTOR up)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, dir, up);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVisuals(IDirect3DRMFrame2* iface,
                                                       LPDIRECT3DRMVISUALARRAY *visuals)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
    IDirect3DRMVisualArrayImpl* obj;
    HRESULT hr;

    TRACE("(%p/%p)->(%p)\n", iface, This, visuals);

    if (!visuals)
        return D3DRMERR_BADVALUE;

    hr = Direct3DRMVisualArray_create(visuals);

    if (hr != D3DRM_OK)
        return hr;
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876

    obj = (IDirect3DRMVisualArrayImpl*)*visuals;

    obj->size = This->nb_visuals;
    if (This->nb_visuals)
    {
        ULONG i;
        obj->visuals = HeapAlloc(GetProcessHeap(), 0, This->nb_visuals * sizeof(LPDIRECT3DRMVISUAL));
        if (!obj->visuals)
            return E_OUTOFMEMORY;
        for (i = 0; i < This->nb_visuals; i++)
        {
            obj->visuals[i] = This->visuals[i];
            IDirect3DRMVisual_AddRef(This->visuals[i]);
        }
    }

    return D3DRM_OK;
877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTextureTopology(IDirect3DRMFrame2* iface,
                                                               BOOL *wrap_u, BOOL *wrap_v)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, wrap_u, wrap_v);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_InverseTransform(IDirect3DRMFrame2* iface,
                                                             D3DVECTOR *d, D3DVECTOR *s)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_Load(IDirect3DRMFrame2* iface, LPVOID filename,
                                                 LPVOID name, D3DRMLOADOPTIONS loadflags,
                                                 D3DRMLOADTEXTURECALLBACK cb, LPVOID lpArg)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p,%u,%p,%p): stub\n", iface, This, filename, name, loadflags, cb, lpArg);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_LookAt(IDirect3DRMFrame2* iface,
                                                   LPDIRECT3DRMFRAME target,
                                                   LPDIRECT3DRMFRAME reference,
                                                   D3DRMFRAMECONSTRAINT constraint)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, target, reference, constraint);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_Move(IDirect3DRMFrame2* iface, D3DVALUE delta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%f): stub\n", iface, This, delta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteChild(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAME frame)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
935 936
    IDirect3DRMFrame3 *child;
    HRESULT hr;
937

938
    TRACE("(%p/%p)->(%p)\n", iface, This, frame);
939

940
    if (!frame)
941
        return D3DRMERR_BADOBJECT;
942 943 944 945
    hr = IDirect3DRMFrame_QueryInterface(frame, &IID_IDirect3DRMFrame3, (void**)&child);
    if (hr != S_OK)
        return D3DRMERR_BADOBJECT;
    IDirect3DRMFrame_Release(frame);
946

947
    return IDirect3DRMFrame3_DeleteChild(&This->IDirect3DRMFrame3_iface, child);
948 949 950
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteLight(IDirect3DRMFrame2* iface,
951
                                                          LPDIRECT3DRMLIGHT light)
952 953 954
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

955
    TRACE("(%p/%p)->(%p)\n", iface, This, light);
956

957
    return IDirect3DRMFrame3_DeleteLight(&This->IDirect3DRMFrame3_iface, light);
958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteMoveCallback(IDirect3DRMFrame2* iface,
                                                               D3DRMFRAMEMOVECALLBACK cb, VOID *arg)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteVisual(IDirect3DRMFrame2* iface,
                                                         LPDIRECT3DRMVISUAL vis)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

975
    TRACE("(%p/%p)->(%p)\n", iface, This, vis);
976

977
    return IDirect3DRMFrame3_DeleteVisual(&This->IDirect3DRMFrame3_iface, (LPUNKNOWN)vis);
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406
}

static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetSceneBackground(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetSceneBackgroundDepth(IDirect3DRMFrame2* iface,
                                                                    LPDIRECTDRAWSURFACE * surface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);

    return E_NOTIMPL;
}

static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetSceneFogColor(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
}

static BOOL WINAPI IDirect3DRMFrame2Impl_GetSceneFogEnable(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return FALSE;
}

static D3DRMFOGMODE WINAPI IDirect3DRMFrame2Impl_GetSceneFogMode(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMFOG_LINEAR;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetSceneFogParams(IDirect3DRMFrame2* iface,
                                                              D3DVALUE *return_start,
                                                              D3DVALUE *return_end,
                                                              D3DVALUE *return_density)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, return_start, return_end, return_density);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackground(IDirect3DRMFrame2* iface,
                                                               D3DCOLOR color)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundRGB(IDirect3DRMFrame2* iface,
                                                                  D3DVALUE red, D3DVALUE green,
                                                                  D3DVALUE blue)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundDepth(IDirect3DRMFrame2* iface,
                                                                    LPDIRECTDRAWSURFACE surface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundImage(IDirect3DRMFrame2* iface,
                                                                    LPDIRECT3DRMTEXTURE texture)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogEnable(IDirect3DRMFrame2* iface, BOOL enable)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%d): stub\n", iface, This, enable);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogColor(IDirect3DRMFrame2* iface,
                                                             D3DCOLOR color)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogMode(IDirect3DRMFrame2* iface,
                                                            D3DRMFOGMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogParams(IDirect3DRMFrame2* iface,
                                                              D3DVALUE start, D3DVALUE end,
                                                              D3DVALUE density)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, start, end, density);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetColor(IDirect3DRMFrame2* iface, D3DCOLOR color)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetColorRGB(IDirect3DRMFrame2* iface, D3DVALUE red,
                                                        D3DVALUE green, D3DVALUE blue)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);

    return E_NOTIMPL;
}

static D3DRMZBUFFERMODE WINAPI IDirect3DRMFrame2Impl_GetZbufferMode(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMZBUFFER_FROMPARENT;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetMaterialMode(IDirect3DRMFrame2* iface,
                                                            D3DRMMATERIALMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetOrientation(IDirect3DRMFrame2* iface,
                                                           LPDIRECT3DRMFRAME reference,
                                                           D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
                                                           D3DVALUE ux, D3DVALUE uy, D3DVALUE uz )
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f,%f,%f,%f): stub\n", iface, This, reference,
          dx, dy, dz, ux, uy, uz);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetPosition(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAME reference,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f): stub\n", iface, This, reference, x, y, z);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetRotation(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAME reference,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z,
                                                        D3DVALUE theta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f,%f): stub\n", iface, This, reference, x, y, z, theta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSortMode(IDirect3DRMFrame2* iface,
                                                        D3DRMSORTMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetTexture(IDirect3DRMFrame2* iface,
                                                       LPDIRECT3DRMTEXTURE texture)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetTextureTopology(IDirect3DRMFrame2* iface,
                                                               BOOL wrap_u, BOOL wrap_v)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%d,%d): stub\n", iface, This, wrap_u, wrap_v);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetVelocity(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMFRAME reference,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z,
                                                        BOOL with_rotation)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f,%d): stub\n", iface, This, reference, x, y, z, with_rotation);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_SetZbufferMode(IDirect3DRMFrame2* iface,
                                                           D3DRMZBUFFERMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_Transform(IDirect3DRMFrame2* iface, D3DVECTOR *d,
                                                      D3DVECTOR *s)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);

    return E_NOTIMPL;
}

/*** IDirect3DRMFrame2 methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddMoveCallback2(IDirect3DRMFrame2* iface,
                                                             D3DRMFRAMEMOVECALLBACK cb, VOID *arg,
                                                             DWORD flags)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, cb, arg, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetBox(IDirect3DRMFrame2* iface, LPD3DRMBOX box)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, box);

    return E_NOTIMPL;
}

static BOOL WINAPI IDirect3DRMFrame2Impl_GetBoxEnable(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetAxes(IDirect3DRMFrame2* iface,
                                                    LPD3DVECTOR dir, LPD3DVECTOR up)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, dir, up);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetMaterial(IDirect3DRMFrame2* iface,
                                                        LPDIRECT3DRMMATERIAL *material)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, material);

    return E_NOTIMPL;
}

static BOOL WINAPI IDirect3DRMFrame2Impl_GetInheritAxes(IDirect3DRMFrame2* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame2Impl_GetHierarchyBox(IDirect3DRMFrame2* iface,
                                                            LPD3DRMBOX box)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, box);

    return E_NOTIMPL;
}

static const struct IDirect3DRMFrame2Vtbl Direct3DRMFrame2_Vtbl =
{
    /*** IUnknown methods ***/
    IDirect3DRMFrame2Impl_QueryInterface,
    IDirect3DRMFrame2Impl_AddRef,
    IDirect3DRMFrame2Impl_Release,
    /*** IDirect3DRMObject methods ***/
    IDirect3DRMFrame2Impl_Clone,
    IDirect3DRMFrame2Impl_AddDestroyCallback,
    IDirect3DRMFrame2Impl_DeleteDestroyCallback,
    IDirect3DRMFrame2Impl_SetAppData,
    IDirect3DRMFrame2Impl_GetAppData,
    IDirect3DRMFrame2Impl_SetName,
    IDirect3DRMFrame2Impl_GetName,
    IDirect3DRMFrame2Impl_GetClassName,
    /*** IDirect3DRMFrame methods ***/
    IDirect3DRMFrame2Impl_AddChild,
    IDirect3DRMFrame2Impl_AddLight,
    IDirect3DRMFrame2Impl_AddMoveCallback,
    IDirect3DRMFrame2Impl_AddTransform,
    IDirect3DRMFrame2Impl_AddTranslation,
    IDirect3DRMFrame2Impl_AddScale,
    IDirect3DRMFrame2Impl_AddRotation,
    IDirect3DRMFrame2Impl_AddVisual,
    IDirect3DRMFrame2Impl_GetChildren,
    IDirect3DRMFrame2Impl_GetColor,
    IDirect3DRMFrame2Impl_GetLights,
    IDirect3DRMFrame2Impl_GetMaterialMode,
    IDirect3DRMFrame2Impl_GetParent,
    IDirect3DRMFrame2Impl_GetPosition,
    IDirect3DRMFrame2Impl_GetRotation,
    IDirect3DRMFrame2Impl_GetScene,
    IDirect3DRMFrame2Impl_GetSortMode,
    IDirect3DRMFrame2Impl_GetTexture,
    IDirect3DRMFrame2Impl_GetTransform,
    IDirect3DRMFrame2Impl_GetVelocity,
    IDirect3DRMFrame2Impl_GetOrientation,
    IDirect3DRMFrame2Impl_GetVisuals,
    IDirect3DRMFrame2Impl_GetTextureTopology,
    IDirect3DRMFrame2Impl_InverseTransform,
    IDirect3DRMFrame2Impl_Load,
    IDirect3DRMFrame2Impl_LookAt,
    IDirect3DRMFrame2Impl_Move,
    IDirect3DRMFrame2Impl_DeleteChild,
    IDirect3DRMFrame2Impl_DeleteLight,
    IDirect3DRMFrame2Impl_DeleteMoveCallback,
    IDirect3DRMFrame2Impl_DeleteVisual,
    IDirect3DRMFrame2Impl_GetSceneBackground,
    IDirect3DRMFrame2Impl_GetSceneBackgroundDepth,
    IDirect3DRMFrame2Impl_GetSceneFogColor,
    IDirect3DRMFrame2Impl_GetSceneFogEnable,
    IDirect3DRMFrame2Impl_GetSceneFogMode,
    IDirect3DRMFrame2Impl_GetSceneFogParams,
    IDirect3DRMFrame2Impl_SetSceneBackground,
    IDirect3DRMFrame2Impl_SetSceneBackgroundRGB,
    IDirect3DRMFrame2Impl_SetSceneBackgroundDepth,
    IDirect3DRMFrame2Impl_SetSceneBackgroundImage,
    IDirect3DRMFrame2Impl_SetSceneFogEnable,
    IDirect3DRMFrame2Impl_SetSceneFogColor,
    IDirect3DRMFrame2Impl_SetSceneFogMode,
    IDirect3DRMFrame2Impl_SetSceneFogParams,
    IDirect3DRMFrame2Impl_SetColor,
    IDirect3DRMFrame2Impl_SetColorRGB,
    IDirect3DRMFrame2Impl_GetZbufferMode,
    IDirect3DRMFrame2Impl_SetMaterialMode,
    IDirect3DRMFrame2Impl_SetOrientation,
    IDirect3DRMFrame2Impl_SetPosition,
    IDirect3DRMFrame2Impl_SetRotation,
    IDirect3DRMFrame2Impl_SetSortMode,
    IDirect3DRMFrame2Impl_SetTexture,
    IDirect3DRMFrame2Impl_SetTextureTopology,
    IDirect3DRMFrame2Impl_SetVelocity,
    IDirect3DRMFrame2Impl_SetZbufferMode,
    IDirect3DRMFrame2Impl_Transform,
    /*** IDirect3DRMFrame2 methods ***/
    IDirect3DRMFrame2Impl_AddMoveCallback2,
    IDirect3DRMFrame2Impl_GetBox,
    IDirect3DRMFrame2Impl_GetBoxEnable,
    IDirect3DRMFrame2Impl_GetAxes,
    IDirect3DRMFrame2Impl_GetMaterial,
    IDirect3DRMFrame2Impl_GetInheritAxes,
    IDirect3DRMFrame2Impl_GetHierarchyBox
};
1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418

/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMFrame3Impl_QueryInterface(IDirect3DRMFrame3* iface,
                                                           REFIID riid, void** object)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
    return IDirect3DRMFrame_QueryInterface(&This->IDirect3DRMFrame2_iface, riid, object);
}

static ULONG WINAPI IDirect3DRMFrame3Impl_AddRef(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1419
    return IDirect3DRMFrame2_AddRef(&This->IDirect3DRMFrame2_iface);
1420 1421 1422 1423 1424
}

static ULONG WINAPI IDirect3DRMFrame3Impl_Release(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1425
    return IDirect3DRMFrame2_Release(&This->IDirect3DRMFrame2_iface);
1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504
}

/*** IDirect3DRMObject methods ***/
static HRESULT WINAPI IDirect3DRMFrame3Impl_Clone(IDirect3DRMFrame3* iface,
                                                  LPUNKNOWN unkwn, REFIID riid,
                                                  LPVOID* object)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddDestroyCallback(IDirect3DRMFrame3* iface,
                                                               D3DRMOBJECTCALLBACK cb,
                                                               LPVOID argument)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteDestroyCallback(IDirect3DRMFrame3* iface,
                                                                  D3DRMOBJECTCALLBACK cb,
                                                                  LPVOID argument)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetAppData(IDirect3DRMFrame3* iface,
                                                       DWORD data)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, data);

    return E_NOTIMPL;
}

static DWORD WINAPI IDirect3DRMFrame3Impl_GetAppData(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetName(IDirect3DRMFrame3* iface, LPCSTR name)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%s): stub\n", iface, This, name);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetName(IDirect3DRMFrame3* iface,
                                                    LPDWORD size, LPSTR name)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetClassName(IDirect3DRMFrame3* iface,
                                                         LPDWORD size, LPSTR name)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

1505
    TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
1506

1507 1508 1509 1510 1511 1512 1513
    if (!size || *size < strlen("Frame") || !name)
        return E_INVALIDARG;

    strcpy(name, "Frame");
    *size = sizeof("Frame");

    return D3DRM_OK;
1514 1515 1516 1517 1518 1519 1520
}

/*** IDirect3DRMFrame methods ***/
static HRESULT WINAPI IDirect3DRMFrame3Impl_AddChild(IDirect3DRMFrame3* iface,
                                                     LPDIRECT3DRMFRAME3 child)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1521
    IDirect3DRMFrameImpl *child_obj = unsafe_impl_from_IDirect3DRMFrame3(child);
1522

1523
    TRACE("(%p/%p)->(%p)\n", iface, This, child);
1524

1525
    if (!child_obj)
1526 1527
        return D3DRMERR_BADOBJECT;

1528 1529 1530 1531 1532 1533 1534
    if (child_obj->parent)
    {
        IDirect3DRMFrame3* parent = &child_obj->parent->IDirect3DRMFrame3_iface;

        if (parent == iface)
        {
            /* Passed frame is already a child so return success */
1535
            return D3DRM_OK;
1536 1537 1538 1539 1540 1541 1542
        }
        else
        {
            /* Remove parent and continue */
            IDirect3DRMFrame3_DeleteChild(parent, child);
        }
    }
1543 1544 1545 1546

    if ((This->nb_children + 1) > This->children_capacity)
    {
        ULONG new_capacity;
1547
        IDirect3DRMFrame3** children;
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568

        if (!This->children_capacity)
        {
            new_capacity = 16;
            children = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMFrame3*));
        }
        else
        {
            new_capacity = This->children_capacity * 2;
            children = HeapReAlloc(GetProcessHeap(), 0, This->children, new_capacity * sizeof(IDirect3DRMFrame3*));
        }

        if (!children)
            return E_OUTOFMEMORY;

        This->children_capacity = new_capacity;
        This->children = children;
    }

    This->children[This->nb_children++] = child;
    IDirect3DRMFrame3_AddRef(child);
1569
    child_obj->parent = This;
1570 1571

    return D3DRM_OK;
1572 1573 1574
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddLight(IDirect3DRMFrame3* iface,
1575
                                                       LPDIRECT3DRMLIGHT light)
1576 1577
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1578 1579
    ULONG i;
    IDirect3DRMLight** lights;
1580

1581
    TRACE("(%p/%p)->(%p)\n", iface, This, light);
1582

1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616
    if (!light)
        return D3DRMERR_BADOBJECT;

    /* Check if already existing and return gracefully without increasing ref count */
    for (i = 0; i < This->nb_lights; i++)
        if (This->lights[i] == light)
            return D3DRM_OK;

    if ((This->nb_lights + 1) > This->lights_capacity)
    {
        ULONG new_capacity;

        if (!This->lights_capacity)
        {
            new_capacity = 16;
            lights = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMLight*));
        }
        else
        {
            new_capacity = This->lights_capacity * 2;
            lights = HeapReAlloc(GetProcessHeap(), 0, This->lights, new_capacity * sizeof(IDirect3DRMLight*));
        }

        if (!lights)
            return E_OUTOFMEMORY;

        This->lights_capacity = new_capacity;
        This->lights = lights;
    }

    This->lights[This->nb_lights++] = light;
    IDirect3DRMLight_AddRef(light);

    return D3DRM_OK;
1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddMoveCallback(IDirect3DRMFrame3* iface,
                                                            D3DRMFRAME3MOVECALLBACK cb, VOID *arg,
                                                            DWORD flags)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, cb, arg, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddTransform(IDirect3DRMFrame3* iface,
                                                         D3DRMCOMBINETYPE type,
                                                         D3DRMMATRIX4D matrix)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

1636
    TRACE("(%p/%p)->(%u,%p)\n", iface, This, type, matrix);
1637

1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657
    switch (type)
    {
        case D3DRMCOMBINE_REPLACE:
            memcpy(&This->transform[0][0], &matrix[0][0], sizeof(D3DRMMATRIX4D));
            break;

        case D3DRMCOMBINE_BEFORE:
            FIXME("D3DRMCOMBINE_BEFORE not supported yed\n");
            break;

        case D3DRMCOMBINE_AFTER:
            FIXME("D3DRMCOMBINE_AFTER not supported yed\n");
            break;

        default:
            WARN("Unknown Combine Type %u\n", type);
            return D3DRMERR_BADVALUE;
    }

    return S_OK;
1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddTranslation(IDirect3DRMFrame3* iface,
                                                           D3DRMCOMBINETYPE type,
                                                           D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, x, y, z);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddScale(IDirect3DRMFrame3* iface,
                                                     D3DRMCOMBINETYPE type,
                                                     D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, sx, sy, sz);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddRotation(IDirect3DRMFrame3* iface,
                                                        D3DRMCOMBINETYPE type,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z,
                                                        D3DVALUE theta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u,%f,%f,%f,%f): stub\n", iface, This, type, x, y, z, theta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_AddVisual(IDirect3DRMFrame3* iface, LPUNKNOWN vis)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1697 1698
    ULONG i;
    IDirect3DRMVisual** visuals;
1699

1700
    TRACE("(%p/%p)->(%p)\n", iface, This, vis);
1701

1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735
    if (!vis)
        return D3DRMERR_BADOBJECT;

    /* Check if already existing and return gracefully without increasing ref count */
    for (i = 0; i < This->nb_visuals; i++)
        if (This->visuals[i] == (IDirect3DRMVisual*)vis)
            return D3DRM_OK;

    if ((This->nb_visuals + 1) > This->visuals_capacity)
    {
        ULONG new_capacity;

        if (!This->visuals_capacity)
        {
            new_capacity = 16;
            visuals = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMVisual*));
        }
        else
        {
            new_capacity = This->visuals_capacity * 2;
            visuals = HeapReAlloc(GetProcessHeap(), 0, This->visuals, new_capacity * sizeof(IDirect3DRMVisual*));
        }

        if (!visuals)
            return E_OUTOFMEMORY;

        This->visuals_capacity = new_capacity;
        This->visuals = visuals;
    }

    This->visuals[This->nb_visuals++] = (IDirect3DRMVisual*)vis;
    IDirect3DRMVisual_AddRef(vis);

    return D3DRM_OK;
1736 1737 1738 1739 1740 1741
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetChildren(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAMEARRAY *children)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1742 1743
    IDirect3DRMFrameArrayImpl* obj;
    HRESULT hr;
1744

1745
    TRACE("(%p/%p)->(%p)\n", iface, This, children);
1746

1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768
    if (!children)
        return D3DRMERR_BADVALUE;

    hr = Direct3DRMFrameArray_create(children);

    if (hr != D3DRM_OK)
        return hr;

    obj = (IDirect3DRMFrameArrayImpl*)*children;

    obj->size = This->nb_children;
    if (This->nb_children)
    {
        ULONG i;
        obj->frames = HeapAlloc(GetProcessHeap(), 0, This->nb_children * sizeof(LPDIRECT3DRMFRAME));
        if (!obj->frames)
            return E_OUTOFMEMORY;
        for (i = 0; i < This->nb_children; i++)
            IDirect3DRMFrame3_QueryInterface(This->children[i], &IID_IDirect3DRMFrame, (void**)&obj->frames[i]);
    }

    return D3DRM_OK;
1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783
}

static D3DCOLOR WINAPI IDirect3DRMFrame3Impl_GetColor(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetLights(IDirect3DRMFrame3* iface,
                                                      LPDIRECT3DRMLIGHTARRAY *lights)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1784 1785
    IDirect3DRMLightArrayImpl* obj;
    HRESULT hr;
1786

1787
    TRACE("(%p/%p)->(%p)\n", iface, This, lights);
1788

1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810
    if (!lights)
        return D3DRMERR_BADVALUE;

    hr = Direct3DRMLightArray_create(lights);

    if (hr != D3DRM_OK)
        return hr;

    obj = (IDirect3DRMLightArrayImpl*)*lights;

    obj->size = This->nb_lights;
    if (This->nb_lights)
    {
        ULONG i;
        obj->lights = HeapAlloc(GetProcessHeap(), 0, This->nb_lights * sizeof(LPDIRECT3DRMLIGHT));
        if (!obj->lights)
            return E_OUTOFMEMORY;
        for (i = 0; i < This->nb_lights; i++)
            IDirect3DRMLight_QueryInterface(This->lights[i], &IID_IDirect3DRMLight, (void**)&obj->lights[i]);
    }

    return D3DRM_OK;
1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826
}

static D3DRMMATERIALMODE WINAPI IDirect3DRMFrame3Impl_GetMaterialMode(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMMATERIAL_FROMPARENT;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetParent(IDirect3DRMFrame3* iface,
                                                      LPDIRECT3DRMFRAME3 * frame)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

1827
    TRACE("(%p/%p)->(%p)\n", iface, This, frame);
1828

1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842
    if (!frame)
        return D3DRMERR_BADVALUE;

    if (This->parent)
    {
        *frame = &This->parent->IDirect3DRMFrame3_iface;
        IDirect3DRMFrame_AddRef(*frame);
    }
    else
    {
        *frame = NULL;
    }

    return D3DRM_OK;
1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetPosition(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAME3 reference,
                                                        LPD3DVECTOR return_position)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, return_position);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetRotation(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAME3 reference,
                                                        LPD3DVECTOR axis, LPD3DVALUE return_theta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, axis, return_theta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetScene(IDirect3DRMFrame3* iface,
                                                     LPDIRECT3DRMFRAME3 * frame)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);

    return E_NOTIMPL;
}

static D3DRMSORTMODE WINAPI IDirect3DRMFrame3Impl_GetSortMode(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMSORT_FROMPARENT;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTexture(IDirect3DRMFrame3* iface,
                                                       LPDIRECT3DRMTEXTURE3 * tex)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, tex);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTransform(IDirect3DRMFrame3* iface,
                                                         LPDIRECT3DRMFRAME3 reference,
                                                         D3DRMMATRIX4D return_matrix)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

1902
    TRACE("(%p/%p)->(%p,%p)\n", iface, This, reference, return_matrix);
1903

1904 1905 1906 1907 1908 1909
    if (reference)
        FIXME("Specifying a frame as the root of the scene different from the current root frame is not supported yet\n");

    memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));

    return D3DRM_OK;
1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetVelocity(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAME3 reference,
                                                        LPD3DVECTOR return_velocity,
                                                        BOOL with_rotation)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%d): stub\n", iface, This, reference, return_velocity, with_rotation);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetOrientation(IDirect3DRMFrame3* iface,
                                                           LPDIRECT3DRMFRAME3 reference,
                                                           LPD3DVECTOR dir, LPD3DVECTOR up)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, dir, up);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetVisuals(IDirect3DRMFrame3* iface, LPDWORD num,
                                                       LPUNKNOWN *visuals)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, num, visuals);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_InverseTransform(IDirect3DRMFrame3* iface,
                                                             D3DVECTOR *d, D3DVECTOR *s)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_Load(IDirect3DRMFrame3* iface, LPVOID filename,
                                                 LPVOID name, D3DRMLOADOPTIONS loadflags,
                                                 D3DRMLOADTEXTURE3CALLBACK cb, LPVOID lpArg)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%u,%p,%p): stub\n", iface, This, filename, name, loadflags, cb, lpArg);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_LookAt(IDirect3DRMFrame3* iface,
                                                   LPDIRECT3DRMFRAME3 target,
                                                   LPDIRECT3DRMFRAME3 reference,
                                                   D3DRMFRAMECONSTRAINT constraint)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, target, reference, constraint);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_Move(IDirect3DRMFrame3* iface, D3DVALUE delta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%f): stub\n", iface, This, delta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteChild(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAME3 frame)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1991
    IDirect3DRMFrameImpl *frame_obj = unsafe_impl_from_IDirect3DRMFrame3(frame);
1992
    ULONG i;
1993

1994
    TRACE("(%p/%p)->(%p)\n", iface, This, frame);
1995

1996
    if (!frame_obj)
1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008
        return D3DRMERR_BADOBJECT;

    /* Check if child exists */
    for (i = 0; i < This->nb_children; i++)
        if (This->children[i] == frame)
            break;

    if (i == This->nb_children)
        return D3DRMERR_BADVALUE;

    memmove(This->children + i, This->children + i + 1, sizeof(IDirect3DRMFrame3*) * (This->nb_children - 1 - i));
    IDirect3DRMFrame3_Release(frame);
2009
    frame_obj->parent = NULL;
2010 2011 2012
    This->nb_children--;

    return D3DRM_OK;
2013 2014 2015
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteLight(IDirect3DRMFrame3* iface,
2016
                                                          LPDIRECT3DRMLIGHT light)
2017 2018
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2019 2020 2021
    ULONG i;

    TRACE("(%p/%p)->(%p)\n", iface, This, light);
2022

2023 2024
    if (!light)
        return D3DRMERR_BADOBJECT;
2025

2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038
    /* Check if visual exists */
    for (i = 0; i < This->nb_lights; i++)
        if (This->lights[i] == light)
            break;

    if (i == This->nb_lights)
        return D3DRMERR_BADVALUE;

    memmove(This->lights + i, This->lights + i + 1, sizeof(IDirect3DRMLight*) * (This->nb_lights - 1 - i));
    IDirect3DRMLight_Release(light);
    This->nb_lights--;

    return D3DRM_OK;
2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteMoveCallback(IDirect3DRMFrame3* iface,
                                                               D3DRMFRAME3MOVECALLBACK cb,
                                                               VOID *arg)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteVisual(IDirect3DRMFrame3* iface, LPUNKNOWN vis)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2055 2056 2057
    ULONG i;

    TRACE("(%p/%p)->(%p)\n", iface, This, vis);
2058

2059 2060
    if (!vis)
        return D3DRMERR_BADOBJECT;
2061

2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074
    /* Check if visual exists */
    for (i = 0; i < This->nb_visuals; i++)
        if (This->visuals[i] == (IDirect3DRMVisual*)vis)
            break;

    if (i == This->nb_visuals)
        return D3DRMERR_BADVALUE;

    memmove(This->visuals + i, This->visuals + i + 1, sizeof(IDirect3DRMVisual*) * (This->nb_visuals - 1 - i));
    IDirect3DRMVisual_Release(vis);
    This->nb_visuals--;

    return D3DRM_OK;
2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660
}

static D3DCOLOR WINAPI IDirect3DRMFrame3Impl_GetSceneBackground(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetSceneBackgroundDepth(IDirect3DRMFrame3* iface,
                                                                    LPDIRECTDRAWSURFACE * surface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);

    return E_NOTIMPL;
}

static D3DCOLOR WINAPI IDirect3DRMFrame3Impl_GetSceneFogColor(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return 0;
}

static BOOL WINAPI IDirect3DRMFrame3Impl_GetSceneFogEnable(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return FALSE;
}

static D3DRMFOGMODE WINAPI IDirect3DRMFrame3Impl_GetSceneFogMode(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMFOG_LINEAR;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetSceneFogParams(IDirect3DRMFrame3* iface,
                                                              D3DVALUE *return_start,
                                                              D3DVALUE *return_end,
                                                              D3DVALUE *return_density)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, return_start, return_end, return_density);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackground(IDirect3DRMFrame3* iface,
                                                               D3DCOLOR color)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundRGB(IDirect3DRMFrame3* iface,
                                                                  D3DVALUE red, D3DVALUE green,
                                                                  D3DVALUE blue)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundDepth(IDirect3DRMFrame3* iface,
                                                                    LPDIRECTDRAWSURFACE surface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundImage(IDirect3DRMFrame3* iface,
                                                                    LPDIRECT3DRMTEXTURE3 texture)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogEnable(IDirect3DRMFrame3* iface, BOOL enable)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%d): stub\n", iface, This, enable);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogColor(IDirect3DRMFrame3* iface,
                                                             D3DCOLOR color)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogMode(IDirect3DRMFrame3* iface,
                                                            D3DRMFOGMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogParams(IDirect3DRMFrame3* iface,
                                                              D3DVALUE start, D3DVALUE end,
                                                              D3DVALUE density)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, start, end, density);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetColor(IDirect3DRMFrame3* iface, D3DCOLOR color)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetColorRGB(IDirect3DRMFrame3* iface, D3DVALUE red,
                                                        D3DVALUE green, D3DVALUE blue)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);

    return E_NOTIMPL;
}

static D3DRMZBUFFERMODE WINAPI IDirect3DRMFrame3Impl_GetZbufferMode(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return D3DRMZBUFFER_FROMPARENT;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterialMode(IDirect3DRMFrame3* iface,
                                                            D3DRMMATERIALMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetOrientation(IDirect3DRMFrame3* iface,
                                                           LPDIRECT3DRMFRAME3 reference,
                                                           D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
                                                           D3DVALUE ux, D3DVALUE uy, D3DVALUE uz )
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f,%f,%f,%f): stub\n", iface, This, reference,
          dx, dy, dz, ux, uy, uz);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetPosition(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAME3 reference,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f): stub\n", iface, This, reference, x, y, z);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetRotation(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAME3 reference,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z,
                                                        D3DVALUE theta)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f,%f): stub\n", iface, This, reference, x, y, z, theta);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSortMode(IDirect3DRMFrame3* iface,
                                                        D3DRMSORTMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetTexture(IDirect3DRMFrame3* iface,
                                                       LPDIRECT3DRMTEXTURE3 texture)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetVelocity(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMFRAME3 reference,
                                                        D3DVALUE x, D3DVALUE y, D3DVALUE z,
                                                        BOOL with_rotation)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%f,%f,%f,%d): stub\n", iface, This, reference, x, y, z, with_rotation);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetZbufferMode(IDirect3DRMFrame3* iface,
                                                           D3DRMZBUFFERMODE mode)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_Transform(IDirect3DRMFrame3* iface, D3DVECTOR *d,
                                                      D3DVECTOR *s)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetBox(IDirect3DRMFrame3* iface, LPD3DRMBOX box)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, box);

    return E_NOTIMPL;
}

static BOOL WINAPI IDirect3DRMFrame3Impl_GetBoxEnable(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetAxes(IDirect3DRMFrame3* iface,
                                                    LPD3DVECTOR dir, LPD3DVECTOR up)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, dir, up);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetMaterial(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMMATERIAL2 *material)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, material);

    return E_NOTIMPL;
}

static BOOL WINAPI IDirect3DRMFrame3Impl_GetInheritAxes(IDirect3DRMFrame3* iface)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(): stub\n", iface, This);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetHierarchyBox(IDirect3DRMFrame3* iface,
                                                            LPD3DRMBOX box)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, box);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetBox(IDirect3DRMFrame3* iface, LPD3DRMBOX box)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, box);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetBoxEnable(IDirect3DRMFrame3* iface, BOOL enable)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, enable);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetAxes(IDirect3DRMFrame3* iface,
                                                    D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
                                                    D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%f,%f,%f,%f,%f,%f): stub\n", iface, This, dx, dy, dz, ux, uy, uz);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetInheritAxes(IDirect3DRMFrame3* iface,
                                                           BOOL inherit_from_parent)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, inherit_from_parent);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterial(IDirect3DRMFrame3* iface,
                                                        LPDIRECT3DRMMATERIAL2 material)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, material);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetQuaternion(IDirect3DRMFrame3* iface,
                                                          LPDIRECT3DRMFRAME3 reference,
                                                          D3DRMQUATERNION *q)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, q);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_RayPick(IDirect3DRMFrame3* iface,
                                                    LPDIRECT3DRMFRAME3 reference, LPD3DRMRAY ray,
                                                    DWORD flags,
                                                    LPDIRECT3DRMPICKED2ARRAY *return_visuals)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%p,%u,%p): stub\n", iface, This, reference, ray, flags, return_visuals);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_Save(IDirect3DRMFrame3* iface, LPCSTR filename,
                                                 D3DRMXOFFORMAT d3dFormat,
                                                 D3DRMSAVEOPTIONS d3dSaveFlags)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%u,%u): stub\n", iface, This, filename, d3dFormat, d3dSaveFlags);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_TransformVectors(IDirect3DRMFrame3* iface,
                                                             LPDIRECT3DRMFRAME3 reference,
                                                             DWORD num, LPD3DVECTOR dst,
                                                             LPD3DVECTOR src)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%u,%p,%p): stub\n", iface, This, reference, num, dst, src);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_InverseTransformVectors(IDirect3DRMFrame3* iface,
                                                                    LPDIRECT3DRMFRAME3 reference,
                                                                    DWORD num, LPD3DVECTOR dst,
                                                                    LPD3DVECTOR src)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p,%u,%p,%p): stub\n", iface, This, reference, num, dst, src);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetTraversalOptions(IDirect3DRMFrame3* iface,
                                                                DWORD flags)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTraversalOptions(IDirect3DRMFrame3* iface,
                                                                LPDWORD flags)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogMethod(IDirect3DRMFrame3* iface,
                                                              DWORD flags)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%u): stub\n", iface, This, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetSceneFogMethod(IDirect3DRMFrame3* iface,
                                                              LPDWORD flags)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterialOverride(IDirect3DRMFrame3* iface,
                                                                LPD3DRMMATERIALOVERRIDE override)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, override);

    return E_NOTIMPL;
}

static HRESULT WINAPI IDirect3DRMFrame3Impl_GetMaterialOverride(IDirect3DRMFrame3* iface,
                                                                LPD3DRMMATERIALOVERRIDE override)
{
    IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);

    FIXME("(%p/%p)->(%p): stub\n", iface, This, override);

    return E_NOTIMPL;
}

static const struct IDirect3DRMFrame3Vtbl Direct3DRMFrame3_Vtbl =
{
    /*** IUnknown methods ***/
    IDirect3DRMFrame3Impl_QueryInterface,
    IDirect3DRMFrame3Impl_AddRef,
    IDirect3DRMFrame3Impl_Release,
    /*** IDirect3DRMObject methods ***/
    IDirect3DRMFrame3Impl_Clone,
    IDirect3DRMFrame3Impl_AddDestroyCallback,
    IDirect3DRMFrame3Impl_DeleteDestroyCallback,
    IDirect3DRMFrame3Impl_SetAppData,
    IDirect3DRMFrame3Impl_GetAppData,
    IDirect3DRMFrame3Impl_SetName,
    IDirect3DRMFrame3Impl_GetName,
    IDirect3DRMFrame3Impl_GetClassName,
    /*** IDirect3DRMFrame3 methods ***/
    IDirect3DRMFrame3Impl_AddChild,
    IDirect3DRMFrame3Impl_AddLight,
    IDirect3DRMFrame3Impl_AddMoveCallback,
    IDirect3DRMFrame3Impl_AddTransform,
    IDirect3DRMFrame3Impl_AddTranslation,
    IDirect3DRMFrame3Impl_AddScale,
    IDirect3DRMFrame3Impl_AddRotation,
    IDirect3DRMFrame3Impl_AddVisual,
    IDirect3DRMFrame3Impl_GetChildren,
    IDirect3DRMFrame3Impl_GetColor,
    IDirect3DRMFrame3Impl_GetLights,
    IDirect3DRMFrame3Impl_GetMaterialMode,
    IDirect3DRMFrame3Impl_GetParent,
    IDirect3DRMFrame3Impl_GetPosition,
    IDirect3DRMFrame3Impl_GetRotation,
    IDirect3DRMFrame3Impl_GetScene,
    IDirect3DRMFrame3Impl_GetSortMode,
    IDirect3DRMFrame3Impl_GetTexture,
    IDirect3DRMFrame3Impl_GetTransform,
    IDirect3DRMFrame3Impl_GetVelocity,
    IDirect3DRMFrame3Impl_GetOrientation,
    IDirect3DRMFrame3Impl_GetVisuals,
    IDirect3DRMFrame3Impl_InverseTransform,
    IDirect3DRMFrame3Impl_Load,
    IDirect3DRMFrame3Impl_LookAt,
    IDirect3DRMFrame3Impl_Move,
    IDirect3DRMFrame3Impl_DeleteChild,
    IDirect3DRMFrame3Impl_DeleteLight,
    IDirect3DRMFrame3Impl_DeleteMoveCallback,
    IDirect3DRMFrame3Impl_DeleteVisual,
    IDirect3DRMFrame3Impl_GetSceneBackground,
    IDirect3DRMFrame3Impl_GetSceneBackgroundDepth,
    IDirect3DRMFrame3Impl_GetSceneFogColor,
    IDirect3DRMFrame3Impl_GetSceneFogEnable,
    IDirect3DRMFrame3Impl_GetSceneFogMode,
    IDirect3DRMFrame3Impl_GetSceneFogParams,
    IDirect3DRMFrame3Impl_SetSceneBackground,
    IDirect3DRMFrame3Impl_SetSceneBackgroundRGB,
    IDirect3DRMFrame3Impl_SetSceneBackgroundDepth,
    IDirect3DRMFrame3Impl_SetSceneBackgroundImage,
    IDirect3DRMFrame3Impl_SetSceneFogEnable,
    IDirect3DRMFrame3Impl_SetSceneFogColor,
    IDirect3DRMFrame3Impl_SetSceneFogMode,
    IDirect3DRMFrame3Impl_SetSceneFogParams,
    IDirect3DRMFrame3Impl_SetColor,
    IDirect3DRMFrame3Impl_SetColorRGB,
    IDirect3DRMFrame3Impl_GetZbufferMode,
    IDirect3DRMFrame3Impl_SetMaterialMode,
    IDirect3DRMFrame3Impl_SetOrientation,
    IDirect3DRMFrame3Impl_SetPosition,
    IDirect3DRMFrame3Impl_SetRotation,
    IDirect3DRMFrame3Impl_SetSortMode,
    IDirect3DRMFrame3Impl_SetTexture,
    IDirect3DRMFrame3Impl_SetVelocity,
    IDirect3DRMFrame3Impl_SetZbufferMode,
    IDirect3DRMFrame3Impl_Transform,
    IDirect3DRMFrame3Impl_GetBox,
    IDirect3DRMFrame3Impl_GetBoxEnable,
    IDirect3DRMFrame3Impl_GetAxes,
    IDirect3DRMFrame3Impl_GetMaterial,
    IDirect3DRMFrame3Impl_GetInheritAxes,
    IDirect3DRMFrame3Impl_GetHierarchyBox,
    IDirect3DRMFrame3Impl_SetBox,
    IDirect3DRMFrame3Impl_SetBoxEnable,
    IDirect3DRMFrame3Impl_SetAxes,
    IDirect3DRMFrame3Impl_SetInheritAxes,
    IDirect3DRMFrame3Impl_SetMaterial,
    IDirect3DRMFrame3Impl_SetQuaternion,
    IDirect3DRMFrame3Impl_RayPick,
    IDirect3DRMFrame3Impl_Save,
    IDirect3DRMFrame3Impl_TransformVectors,
    IDirect3DRMFrame3Impl_InverseTransformVectors,
    IDirect3DRMFrame3Impl_SetTraversalOptions,
    IDirect3DRMFrame3Impl_GetTraversalOptions,
    IDirect3DRMFrame3Impl_SetSceneFogMethod,
    IDirect3DRMFrame3Impl_GetSceneFogMethod,
    IDirect3DRMFrame3Impl_SetMaterialOverride,
    IDirect3DRMFrame3Impl_GetMaterialOverride
};
2661

2662 2663 2664 2665 2666 2667 2668 2669 2670
static inline IDirect3DRMFrameImpl *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
{
    if (!iface)
        return NULL;
    assert(iface->lpVtbl == &Direct3DRMFrame3_Vtbl);

    return impl_from_IDirect3DRMFrame3(iface);
}

2671
HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown* parent, IUnknown** ret_iface)
2672 2673
{
    IDirect3DRMFrameImpl* object;
2674
    HRESULT hr;
2675

2676
    TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), parent, ret_iface);
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688

    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMFrameImpl));
    if (!object)
    {
        ERR("Out of memory\n");
        return E_OUTOFMEMORY;
    }

    object->IDirect3DRMFrame2_iface.lpVtbl = &Direct3DRMFrame2_Vtbl;
    object->IDirect3DRMFrame3_iface.lpVtbl = &Direct3DRMFrame3_Vtbl;
    object->ref = 1;

2689 2690
    memcpy(&object->transform[0][0], &identity[0][0], sizeof(D3DRMMATRIX4D));

2691
    if (parent)
2692
    {
2693 2694 2695 2696 2697 2698 2699
        IDirect3DRMFrame3 *p;

        hr = IDirect3DRMFrame_QueryInterface(parent, &IID_IDirect3DRMFrame3, (void**)&p);
        if (hr != S_OK)
            return hr;
        IDirect3DRMFrame_Release(parent);
        IDirect3DRMFrame3_AddChild(p, &object->IDirect3DRMFrame3_iface);
2700
    }
2701

2702 2703
    hr = IDirect3DRMFrame3_QueryInterface(&object->IDirect3DRMFrame3_iface, riid, (void**)ret_iface);
    IDirect3DRMFrame3_Release(&object->IDirect3DRMFrame3_iface);
2704 2705
    return S_OK;
}