ddraw: Remove useless light callbacks.
This commit is contained in:
parent
8394f00661
commit
06a44abc19
|
@ -4397,11 +4397,6 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
object->ddraw = ddraw_from_d3d3(iface);
|
object->ddraw = ddraw_from_d3d3(iface);
|
||||||
|
|
||||||
/* Update functions */
|
|
||||||
object->activate = light_update;
|
|
||||||
object->desactivate = light_activate;
|
|
||||||
object->update = light_desactivate;
|
|
||||||
|
|
||||||
TRACE("Created light %p.\n", object);
|
TRACE("Created light %p.\n", object);
|
||||||
*light = (IDirect3DLight *)object;
|
*light = (IDirect3DLight *)object;
|
||||||
|
|
||||||
|
|
|
@ -525,20 +525,14 @@ struct IDirect3DLightImpl
|
||||||
|
|
||||||
/* Chained list used for adding / removing from viewports */
|
/* Chained list used for adding / removing from viewports */
|
||||||
IDirect3DLightImpl *next;
|
IDirect3DLightImpl *next;
|
||||||
|
|
||||||
/* Activation function */
|
|
||||||
void (*activate)(IDirect3DLightImpl*);
|
|
||||||
void (*desactivate)(IDirect3DLightImpl*);
|
|
||||||
void (*update)(IDirect3DLightImpl*);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Vtable */
|
/* Vtable */
|
||||||
extern const IDirect3DLightVtbl IDirect3DLight_Vtbl DECLSPEC_HIDDEN;
|
extern const IDirect3DLightVtbl IDirect3DLight_Vtbl DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
void light_update(IDirect3DLightImpl *This) DECLSPEC_HIDDEN;
|
void light_activate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN;
|
||||||
void light_activate(IDirect3DLightImpl *This) DECLSPEC_HIDDEN;
|
void light_deactivate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN;
|
||||||
void light_desactivate(IDirect3DLightImpl *This) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* IDirect3DMaterial implementation structure - Wraps to D3D7
|
* IDirect3DMaterial implementation structure - Wraps to D3D7
|
||||||
|
|
|
@ -43,6 +43,71 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* light_update
|
||||||
|
*
|
||||||
|
* Updates the Direct3DDevice7 lighting parameters
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void light_update(IDirect3DLightImpl *light)
|
||||||
|
{
|
||||||
|
IDirect3DDeviceImpl *device;
|
||||||
|
|
||||||
|
TRACE("light %p.\n", light);
|
||||||
|
|
||||||
|
if (!light->active_viewport || !light->active_viewport->active_device) return;
|
||||||
|
device = light->active_viewport->active_device;
|
||||||
|
|
||||||
|
IDirect3DDevice7_SetLight((IDirect3DDevice7 *)device, light->dwLightIndex, &light->light7);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* light_activate
|
||||||
|
*
|
||||||
|
* Uses the Direct3DDevice7::LightEnable method to active the light
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
void light_activate(IDirect3DLightImpl *light)
|
||||||
|
{
|
||||||
|
IDirect3DDeviceImpl *device;
|
||||||
|
|
||||||
|
TRACE("light %p.\n", light);
|
||||||
|
|
||||||
|
if (!light->active_viewport || !light->active_viewport->active_device) return;
|
||||||
|
device = light->active_viewport->active_device;
|
||||||
|
|
||||||
|
light_update(light);
|
||||||
|
if (!(light->light.dwFlags & D3DLIGHT_ACTIVE))
|
||||||
|
{
|
||||||
|
IDirect3DDevice7_LightEnable((IDirect3DDevice7 *)device, light->dwLightIndex, TRUE);
|
||||||
|
light->light.dwFlags |= D3DLIGHT_ACTIVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* light_deactivate
|
||||||
|
*
|
||||||
|
* Uses the Direct3DDevice7::LightEnable method to deactivate the light
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
void light_deactivate(IDirect3DLightImpl *light)
|
||||||
|
{
|
||||||
|
IDirect3DDeviceImpl *device;
|
||||||
|
|
||||||
|
TRACE("light %p.\n", light);
|
||||||
|
|
||||||
|
if (!light->active_viewport || !light->active_viewport->active_device) return;
|
||||||
|
device = light->active_viewport->active_device;
|
||||||
|
|
||||||
|
/* If was not active, activate it */
|
||||||
|
if (light->light.dwFlags & D3DLIGHT_ACTIVE)
|
||||||
|
{
|
||||||
|
IDirect3DDevice7_LightEnable((IDirect3DDevice7 *)device, light->dwLightIndex, FALSE);
|
||||||
|
light->light.dwFlags &= ~D3DLIGHT_ACTIVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IUnknown Methods.
|
* IUnknown Methods.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
@ -203,9 +268,8 @@ IDirect3DLightImpl_SetLight(IDirect3DLight *iface,
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
memcpy(&This->light, lpLight, lpLight->dwSize);
|
memcpy(&This->light, lpLight, lpLight->dwSize);
|
||||||
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) != 0) {
|
if (This->light.dwFlags & D3DLIGHT_ACTIVE)
|
||||||
This->update(This);
|
light_update(This);
|
||||||
}
|
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
@ -240,73 +304,6 @@ IDirect3DLightImpl_GetLight(IDirect3DLight *iface,
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* light_update
|
|
||||||
*
|
|
||||||
* Updates the Direct3DDevice7 lighting parameters
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
void light_update(IDirect3DLightImpl* This)
|
|
||||||
{
|
|
||||||
IDirect3DDeviceImpl* device;
|
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
|
|
||||||
if (!This->active_viewport || !This->active_viewport->active_device)
|
|
||||||
return;
|
|
||||||
device = This->active_viewport->active_device;
|
|
||||||
|
|
||||||
IDirect3DDevice7_SetLight((IDirect3DDevice7 *)device, This->dwLightIndex, &(This->light7));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* light_activate
|
|
||||||
*
|
|
||||||
* Uses the Direct3DDevice7::LightEnable method to active the light
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
void light_activate(IDirect3DLightImpl* This)
|
|
||||||
{
|
|
||||||
IDirect3DDeviceImpl* device;
|
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
|
|
||||||
if (!This->active_viewport || !This->active_viewport->active_device)
|
|
||||||
return;
|
|
||||||
device = This->active_viewport->active_device;
|
|
||||||
|
|
||||||
light_update(This);
|
|
||||||
/* If was not active, activate it */
|
|
||||||
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) == 0) {
|
|
||||||
IDirect3DDevice7_LightEnable((IDirect3DDevice7 *)device, This->dwLightIndex, TRUE);
|
|
||||||
This->light.dwFlags |= D3DLIGHT_ACTIVE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
*
|
|
||||||
* light_desactivate
|
|
||||||
*
|
|
||||||
* Uses the Direct3DDevice7::LightEnable method to deactivate the light
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
void light_desactivate(IDirect3DLightImpl* This)
|
|
||||||
{
|
|
||||||
IDirect3DDeviceImpl* device;
|
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
|
|
||||||
if (!This->active_viewport || !This->active_viewport->active_device)
|
|
||||||
return;
|
|
||||||
device = This->active_viewport->active_device;
|
|
||||||
|
|
||||||
/* If was not active, activate it */
|
|
||||||
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) != 0) {
|
|
||||||
IDirect3DDevice7_LightEnable((IDirect3DDevice7 *)device, This->dwLightIndex, FALSE);
|
|
||||||
This->light.dwFlags &= ~D3DLIGHT_ACTIVE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const IDirect3DLightVtbl IDirect3DLight_Vtbl =
|
const IDirect3DLightVtbl IDirect3DLight_Vtbl =
|
||||||
{
|
{
|
||||||
/*** IUnknown Methods ***/
|
/*** IUnknown Methods ***/
|
||||||
|
|
|
@ -62,8 +62,9 @@ void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) {
|
||||||
/* Activate all the lights associated with this context */
|
/* Activate all the lights associated with this context */
|
||||||
light = This->lights;
|
light = This->lights;
|
||||||
|
|
||||||
while (light != NULL) {
|
while (light)
|
||||||
light->activate(light);
|
{
|
||||||
|
light_activate(light);
|
||||||
light = light->next;
|
light = light->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -762,9 +763,8 @@ IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
|
||||||
lpDirect3DLightImpl->active_viewport = This;
|
lpDirect3DLightImpl->active_viewport = This;
|
||||||
|
|
||||||
/* If active, activate the light */
|
/* If active, activate the light */
|
||||||
if (This->active_device != NULL) {
|
if (This->active_device)
|
||||||
lpDirect3DLightImpl->activate(lpDirect3DLightImpl);
|
light_activate(lpDirect3DLightImpl);
|
||||||
}
|
|
||||||
|
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
|
@ -796,8 +796,9 @@ IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *iface,
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
cur_light = This->lights;
|
cur_light = This->lights;
|
||||||
while (cur_light != NULL) {
|
while (cur_light != NULL) {
|
||||||
if (cur_light == lpDirect3DLightImpl) {
|
if (cur_light == lpDirect3DLightImpl)
|
||||||
lpDirect3DLightImpl->desactivate(lpDirect3DLightImpl);
|
{
|
||||||
|
light_deactivate(lpDirect3DLightImpl);
|
||||||
if (prev_light == NULL) This->lights = cur_light->next;
|
if (prev_light == NULL) This->lights = cur_light->next;
|
||||||
else prev_light->next = cur_light->next;
|
else prev_light->next = cur_light->next;
|
||||||
/* Detach the light to the viewport */
|
/* Detach the light to the viewport */
|
||||||
|
|
Loading…
Reference in New Issue