ntoskrnl.exe: Implement NtBuildNumber.
[wine.git] / dlls / d3drm / light.c
blobe31c02675ae692434cb8768255edf54bf88d7613
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 "config.h"
22 #include "wine/port.h"
24 #include "d3drm_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
28 static inline struct d3drm_light *impl_from_IDirect3DRMLight(IDirect3DRMLight *iface)
30 return CONTAINING_RECORD(iface, struct d3drm_light, IDirect3DRMLight_iface);
33 static HRESULT WINAPI d3drm_light_QueryInterface(IDirect3DRMLight *iface, REFIID riid, void **out)
35 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
37 if (IsEqualGUID(riid, &IID_IDirect3DRMLight)
38 || IsEqualGUID(riid, &IID_IDirect3DRMObject)
39 || IsEqualGUID(riid, &IID_IUnknown))
41 IDirect3DRMLight_AddRef(iface);
42 *out = iface;
43 return S_OK;
46 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
48 *out = NULL;
49 return E_NOINTERFACE;
52 static ULONG WINAPI d3drm_light_AddRef(IDirect3DRMLight *iface)
54 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
55 ULONG refcount = InterlockedIncrement(&light->ref);
57 TRACE("%p increasing refcount to %u.\n", iface, refcount);
59 return refcount;
62 static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface)
64 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
65 ULONG refcount = InterlockedDecrement(&light->ref);
67 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
69 if (!refcount)
71 d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj);
72 IDirect3DRM_Release(light->d3drm);
73 heap_free(light);
76 return refcount;
79 static HRESULT WINAPI d3drm_light_Clone(IDirect3DRMLight *iface,
80 IUnknown *outer, REFIID iid, void **out)
82 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
84 return E_NOTIMPL;
87 static HRESULT WINAPI d3drm_light_AddDestroyCallback(IDirect3DRMLight *iface,
88 D3DRMOBJECTCALLBACK cb, void *ctx)
90 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
92 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
94 return d3drm_object_add_destroy_callback(&light->obj, cb, ctx);
97 static HRESULT WINAPI d3drm_light_DeleteDestroyCallback(IDirect3DRMLight *iface,
98 D3DRMOBJECTCALLBACK cb, void *ctx)
100 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
102 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
104 return d3drm_object_delete_destroy_callback(&light->obj, cb, ctx);
107 static HRESULT WINAPI d3drm_light_SetAppData(IDirect3DRMLight *iface, DWORD data)
109 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
111 TRACE("iface %p, data %#x.\n", iface, data);
113 light->obj.appdata = data;
115 return D3DRM_OK;
118 static DWORD WINAPI d3drm_light_GetAppData(IDirect3DRMLight *iface)
120 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
122 TRACE("iface %p.\n", iface);
124 return light->obj.appdata;
127 static HRESULT WINAPI d3drm_light_SetName(IDirect3DRMLight *iface, const char *name)
129 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
131 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
133 return d3drm_object_set_name(&light->obj, name);
136 static HRESULT WINAPI d3drm_light_GetName(IDirect3DRMLight *iface, DWORD *size, char *name)
138 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
140 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
142 return d3drm_object_get_name(&light->obj, size, name);
145 static HRESULT WINAPI d3drm_light_GetClassName(IDirect3DRMLight *iface, DWORD *size, char *name)
147 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
149 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
151 return d3drm_object_get_class_name(&light->obj, size, name);
154 static HRESULT WINAPI d3drm_light_SetType(IDirect3DRMLight *iface, D3DRMLIGHTTYPE type)
156 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
158 TRACE("iface %p, type %#x.\n", iface, type);
160 light->type = type;
162 return D3DRM_OK;
165 static HRESULT WINAPI d3drm_light_SetColor(IDirect3DRMLight *iface, D3DCOLOR color)
167 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
169 TRACE("iface %p, color 0x%08x.\n", iface, color);
171 light->color = color;
173 return D3DRM_OK;
176 static HRESULT WINAPI d3drm_light_SetColorRGB(IDirect3DRMLight *iface,
177 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
179 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
181 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
183 d3drm_set_color(&light->color, red, green, blue, 1.0f);
185 return D3DRM_OK;
188 static HRESULT WINAPI d3drm_light_SetRange(IDirect3DRMLight *iface, D3DVALUE range)
190 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
192 TRACE("iface %p, range %.8e.\n", iface, range);
194 light->range = range;
196 return D3DRM_OK;
199 static HRESULT WINAPI d3drm_light_SetUmbra(IDirect3DRMLight *iface, D3DVALUE umbra)
201 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
203 TRACE("iface %p, umbra %.8e.\n", iface, umbra);
205 light->umbra = umbra;
207 return D3DRM_OK;
210 static HRESULT WINAPI d3drm_light_SetPenumbra(IDirect3DRMLight *iface, D3DVALUE penumbra)
212 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
214 TRACE("iface %p, penumbra %.8e.\n", iface, penumbra);
216 light->penumbra = penumbra;
218 return D3DRM_OK;
221 static HRESULT WINAPI d3drm_light_SetConstantAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation)
223 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
225 TRACE("iface %p, attenuation %.8e.\n", iface, attenuation);
227 light->cattenuation = attenuation;
229 return D3DRM_OK;
232 static HRESULT WINAPI d3drm_light_SetLinearAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation)
234 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
236 TRACE("iface %p, attenuation %.8e.\n", iface, attenuation);
238 light->lattenuation = attenuation;
240 return D3DRM_OK;
243 static HRESULT WINAPI d3drm_light_SetQuadraticAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation)
245 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
247 TRACE("iface %p, attenuation %.8e.\n", iface, attenuation);
249 light->qattenuation = attenuation;
251 return D3DRM_OK;
254 static D3DVALUE WINAPI d3drm_light_GetRange(IDirect3DRMLight *iface)
256 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
258 TRACE("iface %p.\n", iface);
260 return light->range;
263 static D3DVALUE WINAPI d3drm_light_GetUmbra(IDirect3DRMLight *iface)
265 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
267 TRACE("iface %p.\n", light);
269 return light->umbra;
272 static D3DVALUE WINAPI d3drm_light_GetPenumbra(IDirect3DRMLight *iface)
274 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
276 TRACE("iface %p.\n", iface);
278 return light->penumbra;
281 static D3DVALUE WINAPI d3drm_light_GetConstantAttenuation(IDirect3DRMLight *iface)
283 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
285 TRACE("iface %p.\n", iface);
287 return light->cattenuation;
290 static D3DVALUE WINAPI d3drm_light_GetLinearAttenuation(IDirect3DRMLight *iface)
292 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
294 TRACE("iface %p.\n", iface);
296 return light->lattenuation;
299 static D3DVALUE WINAPI d3drm_light_GetQuadraticAttenuation(IDirect3DRMLight *iface)
301 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
303 TRACE("iface %p.\n", iface);
305 return light->qattenuation;
308 static D3DCOLOR WINAPI d3drm_light_GetColor(IDirect3DRMLight *iface)
310 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
312 TRACE("iface %p.\n", iface);
314 return light->color;
317 static D3DRMLIGHTTYPE WINAPI d3drm_light_GetType(IDirect3DRMLight *iface)
319 struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
321 TRACE("iface %p.\n", iface);
323 return light->type;
326 static HRESULT WINAPI d3drm_light_SetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame *frame)
328 FIXME("iface %p, frame %p stub!\n", iface, frame);
330 return E_NOTIMPL;
333 static HRESULT WINAPI d3drm_light_GetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame **frame)
335 FIXME("iface %p, frame %p stub!\n", iface, frame);
337 return E_NOTIMPL;
340 static const struct IDirect3DRMLightVtbl d3drm_light_vtbl =
342 d3drm_light_QueryInterface,
343 d3drm_light_AddRef,
344 d3drm_light_Release,
345 d3drm_light_Clone,
346 d3drm_light_AddDestroyCallback,
347 d3drm_light_DeleteDestroyCallback,
348 d3drm_light_SetAppData,
349 d3drm_light_GetAppData,
350 d3drm_light_SetName,
351 d3drm_light_GetName,
352 d3drm_light_GetClassName,
353 d3drm_light_SetType,
354 d3drm_light_SetColor,
355 d3drm_light_SetColorRGB,
356 d3drm_light_SetRange,
357 d3drm_light_SetUmbra,
358 d3drm_light_SetPenumbra,
359 d3drm_light_SetConstantAttenuation,
360 d3drm_light_SetLinearAttenuation,
361 d3drm_light_SetQuadraticAttenuation,
362 d3drm_light_GetRange,
363 d3drm_light_GetUmbra,
364 d3drm_light_GetPenumbra,
365 d3drm_light_GetConstantAttenuation,
366 d3drm_light_GetLinearAttenuation,
367 d3drm_light_GetQuadraticAttenuation,
368 d3drm_light_GetColor,
369 d3drm_light_GetType,
370 d3drm_light_SetEnableFrame,
371 d3drm_light_GetEnableFrame,
374 HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm)
376 static const char classname[] = "Light";
377 struct d3drm_light *object;
379 TRACE("light %p.\n", light);
381 if (!(object = heap_alloc_zero(sizeof(*object))))
382 return E_OUTOFMEMORY;
384 object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
385 object->ref = 1;
386 object->d3drm = d3drm;
387 IDirect3DRM_AddRef(object->d3drm);
389 d3drm_object_init(&object->obj, classname);
391 *light = object;
393 return S_OK;