Browse Source

record Texture::pad_size in bam cache too

David Rose 14 years ago
parent
commit
deb8a56b8a
2 changed files with 16 additions and 2 deletions
  1. 14 1
      panda/src/gobj/texture.cxx
  2. 2 1
      panda/src/putil/bam.h

+ 14 - 1
panda/src/gobj/texture.cxx

@@ -7146,6 +7146,11 @@ do_write_datagram_rawdata(CData *cdata, BamWriter *manager, Datagram &me) {
   me.add_uint32(cdata->_x_size);
   me.add_uint32(cdata->_y_size);
   me.add_uint32(cdata->_z_size);
+
+  me.add_uint32(cdata->_pad_x_size);
+  me.add_uint32(cdata->_pad_y_size);
+  me.add_uint32(cdata->_pad_z_size);
+
   me.add_uint32(cdata->_num_views);
   me.add_uint8(cdata->_component_type);
   me.add_uint8(cdata->_component_width);
@@ -7384,6 +7389,15 @@ do_fillin_rawdata(CData *cdata, DatagramIterator &scan, BamReader *manager) {
   cdata->_x_size = scan.get_uint32();
   cdata->_y_size = scan.get_uint32();
   cdata->_z_size = scan.get_uint32();
+
+  if (manager->get_file_minor_ver() >= 30) {
+    cdata->_pad_x_size = scan.get_uint32();
+    cdata->_pad_y_size = scan.get_uint32();
+    cdata->_pad_z_size = scan.get_uint32();
+  } else {
+    do_set_pad_size(cdata, 0, 0, 0);
+  }
+
   cdata->_num_views = 1;
   if (manager->get_file_minor_ver() >= 26) {
     cdata->_num_views = scan.get_uint32();
@@ -7419,7 +7433,6 @@ do_fillin_rawdata(CData *cdata, DatagramIterator &scan, BamReader *manager) {
     cdata->_ram_images[n]._image = image;
   }
   cdata->_loaded_from_image = true;
-  do_set_pad_size(cdata, 0, 0, 0);
   ++(cdata->_image_modified);
 }
 

+ 2 - 1
panda/src/putil/bam.h

@@ -33,7 +33,7 @@ static const unsigned short _bam_major_ver = 6;
 // Bumped to major version 6 on 2/11/06 to factor out PandaNode::CData.
 
 static const unsigned short _bam_first_minor_ver = 14;
-static const unsigned short _bam_minor_ver = 29;
+static const unsigned short _bam_minor_ver = 30;
 // Bumped to minor version 14 on 12/19/07 to change default ColorAttrib.
 // Bumped to minor version 15 on 4/9/08 to add TextureAttrib::_implicit_sort.
 // Bumped to minor version 16 on 5/13/08 to add Texture::_quality_level.
@@ -50,6 +50,7 @@ static const unsigned short _bam_minor_ver = 29;
 // Bumped to minor version 27 on 10/9/11 to add stdfloat_double.
 // Bumped to minor version 28 on 11/28/11 to add Texture::_auto_texture_scale.
 // Bumped to minor version 29 on 12/17/11 to add GeomVertexColumn::_column_alignment.
+// Bumped to minor version 30 on 1/22/12 to add Texture::_pad_*_size.
 
 
 #endif