From 1b1c76b2e84bc4aa27a978d8f071c482e3275ac2 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 5 Mar 2018 06:10:11 -0700 Subject: [PATCH] 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. --- panda/src/pgraph/cullResult.cxx | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/panda/src/pgraph/cullResult.cxx b/panda/src/pgraph/cullResult.cxx index 0118888108..7dbe002c9e 100644 --- a/panda/src/pgraph/cullResult.cxx +++ b/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)); } + // 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. const TransparencyAttrib *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(); CullBin *bin = get_bin(bin_index); nassertv(bin != (CullBin *)NULL);