wmic: Convert integer property values to BSTR.
[wine/wine-gecko.git] / dlls / d3drm / light.c
blob7283b3b0200b0ca199770fdd85491e5b11d0f9e5
1 /*
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"
23 #define COBJMACROS
25 #include "winbase.h"
26 #include "wingdi.h"
28 #include "d3drm_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
32 typedef struct {
33 IDirect3DRMLight IDirect3DRMLight_iface;
34 LONG ref;
35 D3DRMLIGHTTYPE type;
36 D3DCOLOR color;
37 D3DVALUE range;
38 D3DVALUE cattenuation;
39 D3DVALUE lattenuation;
40 D3DVALUE qattenuation;
41 D3DVALUE umbra;
42 D3DVALUE penumbra;
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);
58 *object = NULL;
60 if(IsEqualGUID(riid, &IID_IUnknown) ||
61 IsEqualGUID(riid, &IID_IDirect3DRMLight))
63 *object = &This->IDirect3DRMLight_iface;
65 else
67 FIXME("interface %s not implemented\n", debugstr_guid(riid));
68 return E_NOINTERFACE;
71 IDirect3DRMLight_AddRef(iface);
72 return S_OK;
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);
82 return 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);
92 if (!ref)
93 HeapFree(GetProcessHeap(), 0, This);
95 return ref;
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);
104 return E_NOTIMPL;
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);
112 return E_NOTIMPL;
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);
120 return E_NOTIMPL;
123 static HRESULT WINAPI IDirect3DRMLightImpl_SetAppData(IDirect3DRMLight* iface,
124 DWORD data)
126 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
128 FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
130 return E_NOTIMPL;
133 static DWORD WINAPI IDirect3DRMLightImpl_GetAppData(IDirect3DRMLight* iface)
135 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
137 FIXME("(%p/%p)->(): stub\n", iface, This);
139 return 0;
142 static HRESULT WINAPI IDirect3DRMLightImpl_SetName(IDirect3DRMLight *iface, const char *name)
144 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
146 return E_NOTIMPL;
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);
153 return E_NOTIMPL;
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)
161 return E_INVALIDARG;
163 strcpy(name, "Light");
164 *size = sizeof("Light");
166 return D3DRM_OK;
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);
176 This->type = type;
178 return D3DRM_OK;
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);
187 This->color = color;
189 return D3DRM_OK;
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);
201 return D3DRM_OK;
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);
210 This->range = range;
212 return D3DRM_OK;
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);
221 This->umbra = umbra;
223 return D3DRM_OK;
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;
234 return D3DRM_OK;
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;
246 return D3DRM_OK;
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;
258 return D3DRM_OK;
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;
270 return D3DRM_OK;
273 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetRange(IDirect3DRMLight* iface)
275 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
277 TRACE("(%p/%p)->()\n", iface, This);
279 return This->range;
282 static D3DVALUE WINAPI IDirect3DRMLightImpl_GetUmbra(IDirect3DRMLight* iface)
284 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
286 TRACE("(%p/%p)->()\n", iface, This);
288 return This->umbra;
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);
333 return This->color;
336 static D3DRMLIGHTTYPE WINAPI IDirect3DRMLightImpl_GetType(IDirect3DRMLight* iface)
338 IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
340 TRACE("(%p/%p)->()\n", iface, This);
342 return This->type;
345 static HRESULT WINAPI IDirect3DRMLightImpl_SetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame *frame)
347 FIXME("iface %p, frame %p stub!\n", iface, frame);
349 return E_NOTIMPL;
352 static HRESULT WINAPI IDirect3DRMLightImpl_GetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame **frame)
354 FIXME("iface %p, frame %p stub!\n", iface, frame);
356 return E_NOTIMPL;
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));
403 if (!object)
404 return E_OUTOFMEMORY;
406 object->IDirect3DRMLight_iface.lpVtbl = &Direct3DRMLight_Vtbl;
407 object->ref = 1;
409 *ppObj = (IUnknown*)&object->IDirect3DRMLight_iface;
411 return S_OK;