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 LPUNKNOWN unkwn, REFIID riid,
103 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
105 FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
110 static HRESULT WINAPI IDirect3DRMLightImpl_AddDestroyCallback(IDirect3DRMLight* iface,
111 D3DRMOBJECTCALLBACK cb,
114 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
116 FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
121 static HRESULT WINAPI IDirect3DRMLightImpl_DeleteDestroyCallback(IDirect3DRMLight* iface,
122 D3DRMOBJECTCALLBACK cb,
125 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
127 FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
132 static HRESULT WINAPI IDirect3DRMLightImpl_SetAppData(IDirect3DRMLight* iface,
135 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
137 FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
142 static DWORD WINAPI IDirect3DRMLightImpl_GetAppData(IDirect3DRMLight* iface)
144 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
146 FIXME("(%p/%p)->(): stub\n", iface, This);
151 static HRESULT WINAPI IDirect3DRMLightImpl_SetName(IDirect3DRMLight* iface, LPCSTR name)
153 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
155 FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
160 static HRESULT WINAPI IDirect3DRMLightImpl_GetName(IDirect3DRMLight* iface,
161 LPDWORD size, LPSTR name)
163 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
165 FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
170 static HRESULT WINAPI IDirect3DRMLightImpl_GetClassName(IDirect3DRMLight* iface,
171 LPDWORD size, LPSTR name)
173 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
175 TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
177 if (!size || *size < strlen("Light") || !name)
180 strcpy(name, "Light");
181 *size = sizeof("Light");
186 /*** IDirect3DRMLight methods ***/
187 static HRESULT WINAPI IDirect3DRMLightImpl_SetType(IDirect3DRMLight* iface, D3DRMLIGHTTYPE type)
189 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
191 TRACE("(%p/%p)->(%u)\n", iface, This, type);
198 static HRESULT WINAPI IDirect3DRMLightImpl_SetColor(IDirect3DRMLight* iface, D3DCOLOR color)
200 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
202 TRACE("(%p/%p)->(%u)\n", iface, This, color);
209 static HRESULT WINAPI IDirect3DRMLightImpl_SetColorRGB(IDirect3DRMLight* iface,
210 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
212 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
214 TRACE("(%p/%p)->(%f,%f,%f)\n", iface, This, red, green, blue);
216 This->color = D3DCOLOR_ARGB(0xff, (BYTE)(red * 255.0f),
217 (BYTE)(green * 255.0f),
218 (BYTE)(blue * 255.0f));
223 static HRESULT WINAPI IDirect3DRMLightImpl_SetRange(IDirect3DRMLight* iface, D3DVALUE range)
225 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
227 TRACE("(%p/%p)->(%f)\n", iface, This, range);
234 static HRESULT WINAPI IDirect3DRMLightImpl_SetUmbra(IDirect3DRMLight* iface, D3DVALUE umbra)
236 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
238 TRACE("(%p/%p)->(%f)\n", iface, This, umbra);
245 static HRESULT WINAPI IDirect3DRMLightImpl_SetPenumbra(IDirect3DRMLight* iface, D3DVALUE penumbra)
247 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
249 TRACE("(%p/%p)->(%f)\n", iface, This, penumbra);
251 This->penumbra = penumbra;
256 static HRESULT WINAPI IDirect3DRMLightImpl_SetConstantAttenuation(IDirect3DRMLight* iface,
257 D3DVALUE cattenuation)
259 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
261 TRACE("(%p/%p)->(%f)\n", iface, This, cattenuation);
263 This->cattenuation = cattenuation;
268 static HRESULT WINAPI IDirect3DRMLightImpl_SetLinearAttenuation(IDirect3DRMLight* iface,
269 D3DVALUE lattenuation)
271 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
273 TRACE("(%p/%p)->(%f)\n", iface, This, lattenuation);
275 This->lattenuation = lattenuation;
280 static HRESULT WINAPI IDirect3DRMLightImpl_SetQuadraticAttenuation(IDirect3DRMLight* iface,
281 D3DVALUE qattenuation)
283 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
285 TRACE("(%p/%p)->(%f)\n", iface, This, qattenuation);
287 This->qattenuation = qattenuation;
292 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetRange(IDirect3DRMLight* iface)
294 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
296 TRACE("(%p/%p)->()\n", iface, This);
301 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetUmbra(IDirect3DRMLight* iface)
303 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
305 TRACE("(%p/%p)->()\n", iface, This);
310 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetPenumbra(IDirect3DRMLight* iface)
312 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
314 TRACE("(%p/%p)->()\n", iface, This);
316 return This->penumbra;
319 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetConstantAttenuation(IDirect3DRMLight* iface)
321 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
323 TRACE("(%p/%p)->()\n", iface, This);
325 return This->cattenuation;
328 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetLinearAttenuation(IDirect3DRMLight* iface)
330 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
332 TRACE("(%p/%p)->()\n", iface, This);
334 return This->lattenuation;
337 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetQuadraticAttenuation(IDirect3DRMLight* iface)
339 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
341 TRACE("(%p/%p)->()\n", iface, This);
343 return This->qattenuation;
346 static D3DCOLOR WINAPI IDirect3DRMLightImpl_GetColor(IDirect3DRMLight* iface)
348 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
350 TRACE("(%p/%p)->()\n", iface, This);
355 static D3DRMLIGHTTYPE WINAPI IDirect3DRMLightImpl_GetType(IDirect3DRMLight* iface)
357 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
359 TRACE("(%p/%p)->()\n", iface, This);
364 static HRESULT WINAPI IDirect3DRMLightImpl_SetEnableFrame(IDirect3DRMLight* iface,
365 LPDIRECT3DRMFRAME frame)
367 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
369 FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
374 static HRESULT WINAPI IDirect3DRMLightImpl_GetEnableFrame(IDirect3DRMLight* iface,
375 LPDIRECT3DRMFRAME* frame)
377 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
379 FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
384 static const struct IDirect3DRMLightVtbl Direct3DRMLight_Vtbl =
386 /*** IUnknown methods ***/
387 IDirect3DRMLightImpl_QueryInterface,
388 IDirect3DRMLightImpl_AddRef,
389 IDirect3DRMLightImpl_Release,
390 /*** IDirect3DRMObject methods ***/
391 IDirect3DRMLightImpl_Clone,
392 IDirect3DRMLightImpl_AddDestroyCallback,
393 IDirect3DRMLightImpl_DeleteDestroyCallback,
394 IDirect3DRMLightImpl_SetAppData,
395 IDirect3DRMLightImpl_GetAppData,
396 IDirect3DRMLightImpl_SetName,
397 IDirect3DRMLightImpl_GetName,
398 IDirect3DRMLightImpl_GetClassName,
399 /*** IDirect3DRMLight methods ***/
400 IDirect3DRMLightImpl_SetType,
401 IDirect3DRMLightImpl_SetColor,
402 IDirect3DRMLightImpl_SetColorRGB,
403 IDirect3DRMLightImpl_SetRange,
404 IDirect3DRMLightImpl_SetUmbra,
405 IDirect3DRMLightImpl_SetPenumbra,
406 IDirect3DRMLightImpl_SetConstantAttenuation,
407 IDirect3DRMLightImpl_SetLinearAttenuation,
408 IDirect3DRMLightImpl_SetQuadraticAttenuation,
409 IDirect3DRMLightImpl_GetRange,
410 IDirect3DRMLightImpl_GetUmbra,
411 IDirect3DRMLightImpl_GetPenumbra,
412 IDirect3DRMLightImpl_GetConstantAttenuation,
413 IDirect3DRMLightImpl_GetLinearAttenuation,
414 IDirect3DRMLightImpl_GetQuadraticAttenuation,
415 IDirect3DRMLightImpl_GetColor,
416 IDirect3DRMLightImpl_GetType,
417 IDirect3DRMLightImpl_SetEnableFrame,
418 IDirect3DRMLightImpl_GetEnableFrame
421 HRESULT Direct3DRMLight_create(IUnknown** ppObj)
423 IDirect3DRMLightImpl* object;
425 TRACE("(%p)\n", ppObj);
427 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMLightImpl));
429 return E_OUTOFMEMORY;
431 object->IDirect3DRMLight_iface.lpVtbl = &Direct3DRMLight_Vtbl;
434 *ppObj = (IUnknown*)&object->IDirect3DRMLight_iface;