mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
fix flickering light
This commit is contained in:
parent
3e620c2df6
commit
f86e9a8cd6
@ -2609,7 +2609,6 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) {
|
|||||||
ZeroMemory(&fdata, sizeof(D3DLIGHT8));
|
ZeroMemory(&fdata, sizeof(D3DLIGHT8));
|
||||||
|
|
||||||
fdata.Type = D3DLIGHT_DIRECTIONAL;
|
fdata.Type = D3DLIGHT_DIRECTIONAL;
|
||||||
fdata.Diffuse = get_light_color(light_obj);
|
|
||||||
fdata.Ambient = black ;
|
fdata.Ambient = black ;
|
||||||
fdata.Specular = *(D3DCOLORVALUE *)(light_obj->get_specular_color().get_data());
|
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
|
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);
|
HRESULT hr = _d3d_device->SetLight(light_id, &fdata);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
wdxdisplay8_cat.warning()
|
wdxdisplay8_cat.warning()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user