Skip to content
Permalink
Browse files

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
  • Loading branch information
rdb committed Mar 18, 2020
1 parent f1da4d4 commit e138096578c5cd7a7f509dfb0c2dbc30c369a7dc
Showing with 16 additions and 1 deletion.
  1. +14 −0 panda/src/gobj/texture.cxx
  2. +2 −1 panda/src/putil/bam.h
@@ -10023,6 +10023,13 @@ do_write_datagram_body(CData *cdata, BamWriter *manager, Datagram &me) {
me.add_uint32(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->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);
}
}
}

/**
@@ -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.

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;
// 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.
@@ -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 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 45 on 2020-03-18 to add Texture::_clear_color.

#endif

0 comments on commit e138096

Please sign in to comment.
You can’t perform that action at this time.