Browse Source

pgraph: Fix "Unknown render mode 5" errors

This happened when a M_dual transparent object is given the
M_filled_wireframe render attrib. M_dual would copy the transparent
parts of the object to the transparent back-to-front bin, before
the M_filled_wireframe handler could deal with the M_filled_wireframe
flag.

The solution is just to switch the order - let M_filled_wireframe be
dealt with before the transparency code gets a chance to make a copy.
Sam Edwards 7 years ago
parent
commit
1b1c76b2e8
1 changed files with 23 additions and 23 deletions
  1. 23 23
      panda/src/pgraph/cullResult.cxx

+ 23 - 23
panda/src/pgraph/cullResult.cxx

@@ -128,6 +128,29 @@ add_object(CullableObject *object, const CullTraverser *traverser) {
     object->_state = object->_state->compose(get_rescale_normal_state(mode));
     object->_state = object->_state->compose(get_rescale_normal_state(mode));
   }
   }
 
 
+  // Check for a special wireframe setting.
+  const RenderModeAttrib *rmode;
+  if (object->_state->get_attrib(rmode)) {
+    if (rmode->get_mode() == RenderModeAttrib::M_filled_wireframe) {
+      CullableObject *wireframe_part = new CullableObject(*object);
+      wireframe_part->_state = get_wireframe_overlay_state(rmode);
+
+      if (wireframe_part->munge_geom
+          (_gsg, _gsg->get_geom_munger(wireframe_part->_state, current_thread),
+           traverser, force)) {
+        int wireframe_bin_index = bin_manager->find_bin("fixed");
+        CullBin *bin = get_bin(wireframe_bin_index);
+        nassertv(bin != (CullBin *)NULL);
+        check_flash_bin(wireframe_part->_state, bin_manager, wireframe_bin_index);
+        bin->add_object(wireframe_part, current_thread);
+      } else {
+        delete wireframe_part;
+      }
+
+      object->_state = object->_state->compose(get_wireframe_filled_state());
+    }
+  }
+
   // Check to see if there's a special transparency setting.
   // Check to see if there's a special transparency setting.
   const TransparencyAttrib *trans;
   const TransparencyAttrib *trans;
   if (object->_state->get_attrib(trans)) {
   if (object->_state->get_attrib(trans)) {
@@ -216,29 +239,6 @@ add_object(CullableObject *object, const CullTraverser *traverser) {
     }
     }
   }
   }
 
 
-  // Check for a special wireframe setting.
-  const RenderModeAttrib *rmode;
-  if (object->_state->get_attrib(rmode)) {
-    if (rmode->get_mode() == RenderModeAttrib::M_filled_wireframe) {
-      CullableObject *wireframe_part = new CullableObject(*object);
-      wireframe_part->_state = get_wireframe_overlay_state(rmode);
-
-      if (wireframe_part->munge_geom
-          (_gsg, _gsg->get_geom_munger(wireframe_part->_state, current_thread),
-           traverser, force)) {
-        int wireframe_bin_index = bin_manager->find_bin("fixed");
-        CullBin *bin = get_bin(wireframe_bin_index);
-        nassertv(bin != (CullBin *)NULL);
-        check_flash_bin(wireframe_part->_state, bin_manager, wireframe_bin_index);
-        bin->add_object(wireframe_part, current_thread);
-      } else {
-        delete wireframe_part;
-      }
-
-      object->_state = object->_state->compose(get_wireframe_filled_state());
-    }
-  }
-
   int bin_index = object->_state->get_bin_index();
   int bin_index = object->_state->get_bin_index();
   CullBin *bin = get_bin(bin_index);
   CullBin *bin = get_bin(bin_index);
   nassertv(bin != (CullBin *)NULL);
   nassertv(bin != (CullBin *)NULL);