瀏覽代碼

fix fog-flickering-nametag issue: shaders not resetting fog state

David Rose 16 年之前
父節點
當前提交
b137e55464
共有 2 個文件被更改,包括 12 次插入20 次删除
  1. 6 8
      panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx
  2. 6 12
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx

+ 6 - 8
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -3418,14 +3418,12 @@ set_state_and_transform(const RenderState *target,
     _state_mask.set_bit(stencil_slot);
   }
      
-  if (_current_shader_context == 0) {
-    int fog_slot = FogAttrib::get_class_slot();
-    if (_target_rs->get_attrib(fog_slot) != _state_rs->get_attrib(fog_slot) ||
-        !_state_mask.get_bit(fog_slot)) {
-      //PStatTimer timer(_draw_set_state_fog_pcollector);
-      do_issue_fog();
-      _state_mask.set_bit(fog_slot);
-    }
+  int fog_slot = FogAttrib::get_class_slot();
+  if (_target_rs->get_attrib(fog_slot) != _state_rs->get_attrib(fog_slot) ||
+      !_state_mask.get_bit(fog_slot)) {
+    //PStatTimer timer(_draw_set_state_fog_pcollector);
+    do_issue_fog();
+    _state_mask.set_bit(fog_slot);
   }
 
   int scissor_slot = ScissorAttrib::get_class_slot();

+ 6 - 12
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -7009,19 +7009,13 @@ set_state_and_transform(const RenderState *target,
     _state_mask.set_bit(stencil_slot);
   }
 
-#ifndef OPENGLES_1
-  if (_current_shader_context == 0) {
-#endif
-    int fog_slot = FogAttrib::get_class_slot();
-    if (_target_rs->get_attrib(fog_slot) != _state_rs->get_attrib(fog_slot) ||
-        !_state_mask.get_bit(fog_slot)) {
-      //PStatTimer timer(_draw_set_state_fog_pcollector);
-      do_issue_fog();
-      _state_mask.set_bit(fog_slot);
-    }
-#ifndef OPENGLES_1
+  int fog_slot = FogAttrib::get_class_slot();
+  if (_target_rs->get_attrib(fog_slot) != _state_rs->get_attrib(fog_slot) ||
+      !_state_mask.get_bit(fog_slot)) {
+    //PStatTimer timer(_draw_set_state_fog_pcollector);
+    do_issue_fog();
+    _state_mask.set_bit(fog_slot);
   }
-#endif
 
   int scissor_slot = ScissorAttrib::get_class_slot();
   if (_target_rs->get_attrib(scissor_slot) != _state_rs->get_attrib(scissor_slot) ||