diff --git a/panda/src/egg2pg/eggLoader.cxx b/panda/src/egg2pg/eggLoader.cxx index c2c5e921a9..df12a69fac 100644 --- a/panda/src/egg2pg/eggLoader.cxx +++ b/panda/src/egg2pg/eggLoader.cxx @@ -1778,7 +1778,7 @@ make_node(EggGroup *egg_group, PandaNode *parent) { bool all_polysets = false; bool any_hidden = false; if (use_qpgeom) { - // check_for_polysets(egg_group, all_polysets, any_hidden); + check_for_polysets(egg_group, all_polysets, any_hidden); } if (all_polysets && !any_hidden) { diff --git a/panda/src/egg2pg/eggRenderState.I b/panda/src/egg2pg/eggRenderState.I index 96dbde7b0f..24c84d1ca3 100644 --- a/panda/src/egg2pg/eggRenderState.I +++ b/panda/src/egg2pg/eggRenderState.I @@ -42,27 +42,3 @@ INLINE void EggRenderState:: add_attrib(const RenderAttrib *attrib) { _state = _state->add_attrib(attrib); } - -//////////////////////////////////////////////////////////////////// -// Function: EggRenderState::int compare_to -// Access: Public -// Description: Provides a unique ordering for different -// EggRenderState objects, so that primitives of similar -// state can be grouped together by the EggBinner. -//////////////////////////////////////////////////////////////////// -INLINE int EggRenderState:: -compare_to(const EggRenderState &other) const { - if (_state != other._state) { - return _state < other._state ? -1 : 1; - } - if (_hidden != other._hidden) { - return (int)_hidden - (int)other._hidden; - } - if (_flat_shaded != other._flat_shaded) { - return (int)_flat_shaded - (int)other._flat_shaded; - } - if (_primitive_type != other._primitive_type) { - return (int)_primitive_type - (int)other._primitive_type; - } - return 0; -} diff --git a/panda/src/egg2pg/eggRenderState.cxx b/panda/src/egg2pg/eggRenderState.cxx index 19e4764e53..93a2e79de5 100644 --- a/panda/src/egg2pg/eggRenderState.cxx +++ b/panda/src/egg2pg/eggRenderState.cxx @@ -386,6 +386,51 @@ fill_state(EggPrimitive *egg_prim) { } } +//////////////////////////////////////////////////////////////////// +// Function: EggRenderState::int compare_to +// Access: Public +// Description: Provides a unique ordering for different +// EggRenderState objects, so that primitives of similar +// state can be grouped together by the EggBinner. +//////////////////////////////////////////////////////////////////// +int EggRenderState:: +compare_to(const EggRenderState &other) const { + if (_state != other._state) { + return _state < other._state ? -1 : 1; + } + if (_hidden != other._hidden) { + return (int)_hidden - (int)other._hidden; + } + if (_flat_shaded != other._flat_shaded) { + return (int)_flat_shaded - (int)other._flat_shaded; + } + if (_primitive_type != other._primitive_type) { + return (int)_primitive_type - (int)other._primitive_type; + } + + if (_bake_in_uvs.size() != other._bake_in_uvs.size()) { + return (int)_bake_in_uvs.size() - (int)other._bake_in_uvs.size(); + } + + BakeInUVs::const_iterator ai, bi; + ai = _bake_in_uvs.begin(); + bi = other._bake_in_uvs.begin(); + while (ai != _bake_in_uvs.end()) { + nassertr(bi != other._bake_in_uvs.end(), false); + if ((*ai).first != (*bi).first) { + return (*ai).first < (*bi).first ? -1 : 1; + } + if ((*ai).second != (*bi).second) { + return (*ai).second < (*bi).second ? -1 : 1; + } + ++ai; + ++bi; + } + nassertr(bi == other._bake_in_uvs.end(), false); + + return 0; +} + //////////////////////////////////////////////////////////////////// // Function: EggRenderState::get_material_attrib // Access: Private diff --git a/panda/src/egg2pg/eggRenderState.h b/panda/src/egg2pg/eggRenderState.h index 8f4299c8cb..a64a45095f 100644 --- a/panda/src/egg2pg/eggRenderState.h +++ b/panda/src/egg2pg/eggRenderState.h @@ -50,7 +50,7 @@ public: void fill_state(EggPrimitive *egg_prim); - INLINE int compare_to(const EggRenderState &other) const; + int compare_to(const EggRenderState &other) const; private: CPT(RenderAttrib) get_material_attrib(const EggMaterial *egg_mat,