diff --git a/panda/src/pgraph/textureAttrib.cxx b/panda/src/pgraph/textureAttrib.cxx index 8d376215ed..10fa07ff3f 100644 --- a/panda/src/pgraph/textureAttrib.cxx +++ b/panda/src/pgraph/textureAttrib.cxx @@ -504,10 +504,10 @@ compare_to_impl(const RenderAttrib *other) const { check_sorted(); ta->check_sorted(); - OnStages::const_iterator si = _on_stages.begin(); - OnStages::const_iterator osi = ta->_on_stages.begin(); + OnStages::const_iterator si = _on_ptr_stages.begin(); + OnStages::const_iterator osi = ta->_on_ptr_stages.begin(); - while (si != _on_stages.end() && osi != ta->_on_stages.end()) { + while (si != _on_ptr_stages.end() && osi != ta->_on_ptr_stages.end()) { TextureStage *stage = (*si)._stage; TextureStage *other_stage = (*osi)._stage; @@ -525,10 +525,10 @@ compare_to_impl(const RenderAttrib *other) const { ++osi; } - if (si != _on_stages.end()) { + if (si != _on_ptr_stages.end()) { return 1; } - if (osi != ta->_on_stages.end()) { + if (osi != ta->_on_ptr_stages.end()) { return -1; } @@ -941,7 +941,8 @@ sort_on_stages() { // It's important that this assignment not be based on the whims of // render order--it mustn't change arbitrarily--so we must first // sort the on_stages list into pointer order for this purpose. - sort(_on_stages.begin(), _on_stages.end(), CompareTextureStagePointer()); + _on_ptr_stages = _on_stages; + sort(_on_ptr_stages.begin(), _on_ptr_stages.end(), CompareTextureStagePointer()); typedef pmap UsedTexcoordIndex; UsedTexcoordIndex used_texcoord_index; @@ -950,7 +951,7 @@ sort_on_stages() { TexcoordMap tc_map; OnStages::const_iterator si; - for (si = _on_stages.begin(); si != _on_stages.end(); ++si) { + for (si = _on_ptr_stages.begin(); si != _on_ptr_stages.end(); ++si) { TextureStage *stage = (*si)._stage; if (stage->is_fixed_function()) { const InternalName *name = stage->get_texcoord_name(); @@ -966,7 +967,7 @@ sort_on_stages() { } } - // Now we can sort the on_stages map into render order. + // Now we can sort the on_stages list into render order. sort(_on_stages.begin(), _on_stages.end(), CompareTextureStageSort()); _sort_seq = TextureStage::get_sort_seq(); diff --git a/panda/src/pgraph/textureAttrib.h b/panda/src/pgraph/textureAttrib.h index 0caf7bf682..068a16fa7a 100644 --- a/panda/src/pgraph/textureAttrib.h +++ b/panda/src/pgraph/textureAttrib.h @@ -118,8 +118,9 @@ private: }; typedef pvector OnStages; - OnStages _on_stages; - OnStages _on_ff_stages; + OnStages _on_stages; // list of all "on" stages, sorted in render order. + OnStages _on_ptr_stages; // above, sorted in pointer order. + OnStages _on_ff_stages; // fixed-function stages only, in render order. vector_int _ff_tc_index; unsigned int _next_implicit_sort;