Browse Source

*** empty log message ***

David Rose 24 years ago
parent
commit
decb6d2007

+ 7 - 1
pandatool/src/flt/fltGeometry.I

@@ -56,5 +56,11 @@ get_material() const {
 ////////////////////////////////////////////////////////////////////
 INLINE bool FltGeometry::
 has_color() const {
-  return ((_flags & F_no_color) == 0) || has_material();
+  // Even if the no_color bit is not set, if the color_index is -1,
+  // the face doesn't have a color (unless we've got packed color).
+  // On the other hand, if we have a material than we always have
+  // color.
+  return ((_flags & F_no_color) == 0 &&
+	  (_color_index != -1 || ((_flags & F_packed_color) != 0)))
+    || has_material();
 }

+ 4 - 4
pandatool/src/flt/fltGeometry.cxx

@@ -189,8 +189,8 @@ extract_record(FltRecordReader &reader) {
   if (_header->get_flt_version() >= 15.2) {
     _texture_mapping_index = iterator.get_be_int16();
     iterator.skip_bytes(2);
-    _color_index = iterator.get_be_uint32();
-    _alt_color_index = iterator.get_be_uint32();
+    _color_index = iterator.get_be_int32();
+    _alt_color_index = iterator.get_be_int32();
     iterator.skip_bytes(2 + 2);
   }
 
@@ -242,8 +242,8 @@ build_record(FltRecordWriter &writer) const {
     // New with 15.2
     datagram.add_be_int16(_texture_mapping_index);
     datagram.pad_bytes(2);
-    datagram.add_be_uint32(_color_index);
-    datagram.add_be_uint32(_alt_color_index);
+    datagram.add_be_int32(_color_index);
+    datagram.add_be_int32(_alt_color_index);
     datagram.pad_bytes(2 + 2);
   }
 

+ 2 - 2
pandatool/src/flt/fltGeometry.h

@@ -83,8 +83,8 @@ public:
   FltPackedColor _packed_color;
   FltPackedColor _alt_packed_color;
   int _texture_mapping_index;
-  unsigned int _color_index;
-  unsigned int _alt_color_index;
+  int _color_index;
+  int _alt_color_index;
 
 public:
   INLINE bool has_texture() const;

+ 4 - 1
pandatool/src/flt/fltVertex.I

@@ -12,5 +12,8 @@
 ////////////////////////////////////////////////////////////////////
 INLINE bool FltVertex::
 has_color() const {
-  return (_flags & F_no_color) == 0;
+  // Even if the no_color bit is not set, if the color_index is -1,
+  // the vertex doesn't have a color (unless we've got packed color).
+  return ((_flags & F_no_color) == 0 &&
+	  (_color_index != -1 || ((_flags & F_packed_color) != 0)));
 }

+ 1 - 1
pandatool/src/flt/fltVertex.cxx

@@ -194,7 +194,7 @@ extract_record(FltRecordReader &reader) {
     return false;
   }
   if (_header->get_flt_version() >= 15.2) {
-    _color_index = iterator.get_be_uint32();
+    _color_index = iterator.get_be_int32();
 
     if (_has_normal && iterator.get_remaining_size() > 0) {
       // If we extracted a normal, our double-word alignment is off; now