2 * Implementation of IDirect3DRMLight Interface
4 * Copyright 2012 André Hentschel
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/debug.h"
28 #include "d3drm_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
33 IDirect3DRMLight IDirect3DRMLight_iface
;
38 D3DVALUE cattenuation
;
39 D3DVALUE lattenuation
;
40 D3DVALUE qattenuation
;
43 } IDirect3DRMLightImpl
;
45 static inline IDirect3DRMLightImpl
*impl_from_IDirect3DRMLight(IDirect3DRMLight
*iface
)
47 return CONTAINING_RECORD(iface
, IDirect3DRMLightImpl
, IDirect3DRMLight_iface
);
50 /*** IUnknown methods ***/
51 static HRESULT WINAPI
IDirect3DRMLightImpl_QueryInterface(IDirect3DRMLight
* iface
,
52 REFIID riid
, void** object
)
54 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
56 TRACE("(%p/%p)->(%s, %p)\n", iface
, This
, debugstr_guid(riid
), object
);
60 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
61 IsEqualGUID(riid
, &IID_IDirect3DRMLight
))
63 *object
= &This
->IDirect3DRMLight_iface
;
67 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
71 IDirect3DRMLight_AddRef(iface
);
75 static ULONG WINAPI
IDirect3DRMLightImpl_AddRef(IDirect3DRMLight
* iface
)
77 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
78 ULONG ref
= InterlockedIncrement(&This
->ref
);
80 TRACE("(%p)->(): new ref = %d\n", iface
, ref
);
85 static ULONG WINAPI
IDirect3DRMLightImpl_Release(IDirect3DRMLight
* iface
)
87 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
88 ULONG ref
= InterlockedDecrement(&This
->ref
);
90 TRACE("(%p)->(): new ref = %d\n", iface
, ref
);
93 HeapFree(GetProcessHeap(), 0, This
);
98 /*** IDirect3DRMObject methods ***/
99 static HRESULT WINAPI
IDirect3DRMLightImpl_Clone(IDirect3DRMLight
*iface
,
100 IUnknown
*outer
, REFIID iid
, void **out
)
102 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
107 static HRESULT WINAPI
IDirect3DRMLightImpl_AddDestroyCallback(IDirect3DRMLight
*iface
,
108 D3DRMOBJECTCALLBACK cb
, void *ctx
)
110 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
115 static HRESULT WINAPI
IDirect3DRMLightImpl_DeleteDestroyCallback(IDirect3DRMLight
*iface
,
116 D3DRMOBJECTCALLBACK cb
, void *ctx
)
118 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
123 static HRESULT WINAPI
IDirect3DRMLightImpl_SetAppData(IDirect3DRMLight
* iface
,
126 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
128 FIXME("(%p/%p)->(%u): stub\n", iface
, This
, data
);
133 static DWORD WINAPI
IDirect3DRMLightImpl_GetAppData(IDirect3DRMLight
* iface
)
135 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
137 FIXME("(%p/%p)->(): stub\n", iface
, This
);
142 static HRESULT WINAPI
IDirect3DRMLightImpl_SetName(IDirect3DRMLight
*iface
, const char *name
)
144 FIXME("iface %p, name %s stub!\n", iface
, debugstr_a(name
));
149 static HRESULT WINAPI
IDirect3DRMLightImpl_GetName(IDirect3DRMLight
*iface
, DWORD
*size
, char *name
)
151 FIXME("iface %p, size %p, name %p stub!\n", iface
, size
, name
);
156 static HRESULT WINAPI
IDirect3DRMLightImpl_GetClassName(IDirect3DRMLight
*iface
, DWORD
*size
, char *name
)
158 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
160 if (!size
|| *size
< strlen("Light") || !name
)
163 strcpy(name
, "Light");
164 *size
= sizeof("Light");
169 /*** IDirect3DRMLight methods ***/
170 static HRESULT WINAPI
IDirect3DRMLightImpl_SetType(IDirect3DRMLight
* iface
, D3DRMLIGHTTYPE type
)
172 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
174 TRACE("(%p/%p)->(%u)\n", iface
, This
, type
);
181 static HRESULT WINAPI
IDirect3DRMLightImpl_SetColor(IDirect3DRMLight
* iface
, D3DCOLOR color
)
183 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
185 TRACE("(%p/%p)->(%u)\n", iface
, This
, color
);
192 static HRESULT WINAPI
IDirect3DRMLightImpl_SetColorRGB(IDirect3DRMLight
* iface
,
193 D3DVALUE red
, D3DVALUE green
, D3DVALUE blue
)
195 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
197 TRACE("(%p/%p)->(%f,%f,%f)\n", iface
, This
, red
, green
, blue
);
199 This
->color
= RGBA_MAKE((BYTE
)(red
* 255.0f
), (BYTE
)(green
* 255.0f
), (BYTE
)(blue
* 255.0f
), 0xff);
204 static HRESULT WINAPI
IDirect3DRMLightImpl_SetRange(IDirect3DRMLight
* iface
, D3DVALUE range
)
206 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
208 TRACE("(%p/%p)->(%f)\n", iface
, This
, range
);
215 static HRESULT WINAPI
IDirect3DRMLightImpl_SetUmbra(IDirect3DRMLight
* iface
, D3DVALUE umbra
)
217 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
219 TRACE("(%p/%p)->(%f)\n", iface
, This
, umbra
);
226 static HRESULT WINAPI
IDirect3DRMLightImpl_SetPenumbra(IDirect3DRMLight
* iface
, D3DVALUE penumbra
)
228 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
230 TRACE("(%p/%p)->(%f)\n", iface
, This
, penumbra
);
232 This
->penumbra
= penumbra
;
237 static HRESULT WINAPI
IDirect3DRMLightImpl_SetConstantAttenuation(IDirect3DRMLight
* iface
,
238 D3DVALUE cattenuation
)
240 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
242 TRACE("(%p/%p)->(%f)\n", iface
, This
, cattenuation
);
244 This
->cattenuation
= cattenuation
;
249 static HRESULT WINAPI
IDirect3DRMLightImpl_SetLinearAttenuation(IDirect3DRMLight
* iface
,
250 D3DVALUE lattenuation
)
252 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
254 TRACE("(%p/%p)->(%f)\n", iface
, This
, lattenuation
);
256 This
->lattenuation
= lattenuation
;
261 static HRESULT WINAPI
IDirect3DRMLightImpl_SetQuadraticAttenuation(IDirect3DRMLight
* iface
,
262 D3DVALUE qattenuation
)
264 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
266 TRACE("(%p/%p)->(%f)\n", iface
, This
, qattenuation
);
268 This
->qattenuation
= qattenuation
;
273 static D3DVALUE WINAPI
IDirect3DRMLightImpl_GetRange(IDirect3DRMLight
* iface
)
275 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
277 TRACE("(%p/%p)->()\n", iface
, This
);
282 static D3DVALUE WINAPI
IDirect3DRMLightImpl_GetUmbra(IDirect3DRMLight
* iface
)
284 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
286 TRACE("(%p/%p)->()\n", iface
, This
);
291 static D3DVALUE WINAPI
IDirect3DRMLightImpl_GetPenumbra(IDirect3DRMLight
* iface
)
293 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
295 TRACE("(%p/%p)->()\n", iface
, This
);
297 return This
->penumbra
;
300 static D3DVALUE WINAPI
IDirect3DRMLightImpl_GetConstantAttenuation(IDirect3DRMLight
* iface
)
302 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
304 TRACE("(%p/%p)->()\n", iface
, This
);
306 return This
->cattenuation
;
309 static D3DVALUE WINAPI
IDirect3DRMLightImpl_GetLinearAttenuation(IDirect3DRMLight
* iface
)
311 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
313 TRACE("(%p/%p)->()\n", iface
, This
);
315 return This
->lattenuation
;
318 static D3DVALUE WINAPI
IDirect3DRMLightImpl_GetQuadraticAttenuation(IDirect3DRMLight
* iface
)
320 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
322 TRACE("(%p/%p)->()\n", iface
, This
);
324 return This
->qattenuation
;
327 static D3DCOLOR WINAPI
IDirect3DRMLightImpl_GetColor(IDirect3DRMLight
* iface
)
329 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
331 TRACE("(%p/%p)->()\n", iface
, This
);
336 static D3DRMLIGHTTYPE WINAPI
IDirect3DRMLightImpl_GetType(IDirect3DRMLight
* iface
)
338 IDirect3DRMLightImpl
*This
= impl_from_IDirect3DRMLight(iface
);
340 TRACE("(%p/%p)->()\n", iface
, This
);
345 static HRESULT WINAPI
IDirect3DRMLightImpl_SetEnableFrame(IDirect3DRMLight
*iface
, IDirect3DRMFrame
*frame
)
347 FIXME("iface %p, frame %p stub!\n", iface
, frame
);
352 static HRESULT WINAPI
IDirect3DRMLightImpl_GetEnableFrame(IDirect3DRMLight
*iface
, IDirect3DRMFrame
**frame
)
354 FIXME("iface %p, frame %p stub!\n", iface
, frame
);
359 static const struct IDirect3DRMLightVtbl Direct3DRMLight_Vtbl
=
361 /*** IUnknown methods ***/
362 IDirect3DRMLightImpl_QueryInterface
,
363 IDirect3DRMLightImpl_AddRef
,
364 IDirect3DRMLightImpl_Release
,
365 /*** IDirect3DRMObject methods ***/
366 IDirect3DRMLightImpl_Clone
,
367 IDirect3DRMLightImpl_AddDestroyCallback
,
368 IDirect3DRMLightImpl_DeleteDestroyCallback
,
369 IDirect3DRMLightImpl_SetAppData
,
370 IDirect3DRMLightImpl_GetAppData
,
371 IDirect3DRMLightImpl_SetName
,
372 IDirect3DRMLightImpl_GetName
,
373 IDirect3DRMLightImpl_GetClassName
,
374 /*** IDirect3DRMLight methods ***/
375 IDirect3DRMLightImpl_SetType
,
376 IDirect3DRMLightImpl_SetColor
,
377 IDirect3DRMLightImpl_SetColorRGB
,
378 IDirect3DRMLightImpl_SetRange
,
379 IDirect3DRMLightImpl_SetUmbra
,
380 IDirect3DRMLightImpl_SetPenumbra
,
381 IDirect3DRMLightImpl_SetConstantAttenuation
,
382 IDirect3DRMLightImpl_SetLinearAttenuation
,
383 IDirect3DRMLightImpl_SetQuadraticAttenuation
,
384 IDirect3DRMLightImpl_GetRange
,
385 IDirect3DRMLightImpl_GetUmbra
,
386 IDirect3DRMLightImpl_GetPenumbra
,
387 IDirect3DRMLightImpl_GetConstantAttenuation
,
388 IDirect3DRMLightImpl_GetLinearAttenuation
,
389 IDirect3DRMLightImpl_GetQuadraticAttenuation
,
390 IDirect3DRMLightImpl_GetColor
,
391 IDirect3DRMLightImpl_GetType
,
392 IDirect3DRMLightImpl_SetEnableFrame
,
393 IDirect3DRMLightImpl_GetEnableFrame
396 HRESULT
Direct3DRMLight_create(IUnknown
** ppObj
)
398 IDirect3DRMLightImpl
* object
;
400 TRACE("(%p)\n", ppObj
);
402 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirect3DRMLightImpl
));
404 return E_OUTOFMEMORY
;
406 object
->IDirect3DRMLight_iface
.lpVtbl
= &Direct3DRMLight_Vtbl
;
409 *ppObj
= (IUnknown
*)&object
->IDirect3DRMLight_iface
;