fix flickering light

This commit is contained in:
David Rose 2009-01-08 23:42:44 +00:00
parent 3e620c2df6
commit f86e9a8cd6

View File

@ -2609,7 +2609,6 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) {
ZeroMemory(&fdata, sizeof(D3DLIGHT8));
fdata.Type = D3DLIGHT_DIRECTIONAL;
fdata.Diffuse = get_light_color(light_obj);
fdata.Ambient = black ;
fdata.Specular = *(D3DCOLORVALUE *)(light_obj->get_specular_color().get_data());
@ -2623,6 +2622,11 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) {
fdata.Attenuation2 = 0.0f; // quadratic
}
// We have to reset the Diffuse color at each call, because it might
// have changed independently of the light object itself (due to
// color_scale_via_lighting being in effect).
fdata.Diffuse = get_light_color(light_obj);
HRESULT hr = _d3d_device->SetLight(light_id, &fdata);
if (FAILED(hr)) {
wdxdisplay8_cat.warning()