Browse Source

fix palettization issues with qpgeom

David Rose 20 years ago
parent
commit
e037e595cb

+ 1 - 1
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) {

+ 0 - 24
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;
-}

+ 45 - 0
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

+ 1 - 1
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,