瀏覽代碼

gobj: support writing Texture clear colors to .bam files (bam 6.45)

This fix requires setting "bam-version 6 45" in Config.prc.

Part of the fix for #844
rdb 5 年之前
父節點
當前提交
e138096578
共有 2 個文件被更改,包括 16 次插入1 次删除
  1. 14 0
      panda/src/gobj/texture.cxx
  2. 2 1
      panda/src/putil/bam.h

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

@@ -10023,6 +10023,13 @@ do_write_datagram_body(CData *cdata, BamWriter *manager, Datagram &me) {
     me.add_uint32(cdata->_simple_ram_image._image.size());
     me.add_uint32(cdata->_simple_ram_image._image.size());
     me.append_data(cdata->_simple_ram_image._image, cdata->_simple_ram_image._image.size());
     me.append_data(cdata->_simple_ram_image._image, cdata->_simple_ram_image._image.size());
   }
   }
+
+  if (manager->get_file_minor_ver() >= 45) {
+    me.add_bool(cdata->_has_clear_color);
+    if (cdata->_has_clear_color) {
+      cdata->_clear_color.write_datagram(me);
+    }
+  }
 }
 }
 
 
 /**
 /**
@@ -10268,6 +10275,13 @@ do_fillin_body(CData *cdata, DatagramIterator &scan, BamReader *manager) {
     cdata->_simple_ram_image._page_size = u_size;
     cdata->_simple_ram_image._page_size = u_size;
     cdata->inc_simple_image_modified();
     cdata->inc_simple_image_modified();
   }
   }
+
+  if (manager->get_file_minor_ver() >= 45) {
+    cdata->_has_clear_color = scan.get_bool();
+    if (cdata->_has_clear_color) {
+      cdata->_clear_color.read_datagram(scan);
+    }
+  }
 }
 }
 
 
 /**
 /**

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

@@ -32,7 +32,7 @@ static const unsigned short _bam_major_ver = 6;
 // Bumped to major version 6 on 2006-02-11 to factor out PandaNode::CData.
 // Bumped to major version 6 on 2006-02-11 to factor out PandaNode::CData.
 
 
 static const unsigned short _bam_first_minor_ver = 14;
 static const unsigned short _bam_first_minor_ver = 14;
-static const unsigned short _bam_last_minor_ver = 44;
+static const unsigned short _bam_last_minor_ver = 45;
 static const unsigned short _bam_minor_ver = 44;
 static const unsigned short _bam_minor_ver = 44;
 // Bumped to minor version 14 on 2007-12-19 to change default ColorAttrib.
 // Bumped to minor version 14 on 2007-12-19 to change default ColorAttrib.
 // Bumped to minor version 15 on 2008-04-09 to add TextureAttrib::_implicit_sort.
 // Bumped to minor version 15 on 2008-04-09 to add TextureAttrib::_implicit_sort.
@@ -65,5 +65,6 @@ static const unsigned short _bam_minor_ver = 44;
 // Bumped to minor version 42 on 2016-04-08 to expand ColorBlendAttrib.
 // Bumped to minor version 42 on 2016-04-08 to expand ColorBlendAttrib.
 // Bumped to minor version 43 on 2018-12-06 to expand BillboardEffect and CompassEffect.
 // Bumped to minor version 43 on 2018-12-06 to expand BillboardEffect and CompassEffect.
 // Bumped to minor version 44 on 2018-12-23 to rename CollisionTube to CollisionCapsule.
 // Bumped to minor version 44 on 2018-12-23 to rename CollisionTube to CollisionCapsule.
+// Bumped to minor version 45 on 2020-03-18 to add Texture::_clear_color.
 
 
 #endif
 #endif