소스 검색

fix flickering light

David Rose 17 년 전
부모
커밋
3e620c2df6
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

+ 5 - 1
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -3468,7 +3468,6 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) {
     ZeroMemory(&fdata, sizeof(D3DLIGHT9));
     
     fdata.Type =  D3DLIGHT_DIRECTIONAL;
-    fdata.Diffuse  = get_light_color(light_obj);
     fdata.Ambient  =  black ;
     fdata.Specular = *(D3DCOLORVALUE *)(light_obj->get_specular_color().get_data());
     
@@ -3482,6 +3481,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)) {
     wdxdisplay9_cat.warning()