From d69d3fc470f953b7b47b72b385fe913691c159ab Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 9 Dec 2000 04:13:13 +0000 Subject: [PATCH] *** empty log message *** --- panda/src/chan/animBundle.cxx | 4 ++-- panda/src/chan/animChannel.h | 4 ++-- panda/src/chan/animChannelMatrixXfmTable.cxx | 12 ++++-------- panda/src/chan/animChannelScalarTable.cxx | 12 ++++-------- panda/src/char/computedVertices.cxx | 4 ++-- panda/src/collide/collisionNode.cxx | 9 ++------- panda/src/collide/collisionSphere.cxx | 4 ++-- panda/src/effects/lensFlareNode.cxx | 16 ++++++++-------- panda/src/gobj/LOD.I | 8 ++++---- panda/src/gobj/imageBuffer.cxx | 7 +------ panda/src/gobj/texture.cxx | 11 ++--------- panda/src/linmath/lmatrix3.I | 4 ++-- panda/src/linmath/lmatrix4.I | 4 ++-- panda/src/linmath/lvecBase2.I | 8 ++++---- panda/src/linmath/lvecBase3.I | 12 ++++++------ panda/src/linmath/lvecBase4.I | 16 ++++++++-------- panda/src/mathutil/plane.I | 16 ++++++++-------- panda/src/putil/bam.h | 10 ++++------ panda/src/putil/ioPtaDatagramFloat.cxx | 4 ++-- panda/src/putil/timedCycle.cxx | 4 ++-- 20 files changed, 71 insertions(+), 98 deletions(-) diff --git a/panda/src/chan/animBundle.cxx b/panda/src/chan/animBundle.cxx index 4bbf1f1ac0..b8021c7342 100644 --- a/panda/src/chan/animBundle.cxx +++ b/panda/src/chan/animBundle.cxx @@ -34,7 +34,7 @@ void AnimBundle:: write_datagram(BamWriter *manager, Datagram &me) { AnimGroup::write_datagram(manager, me); - me.add_float64(_fps); + me.add_float32(_fps); me.add_uint16(_num_frames); } @@ -50,7 +50,7 @@ void AnimBundle:: fillin(DatagramIterator& scan, BamReader* manager) { AnimGroup::fillin(scan, manager); - _fps = scan.get_float64(); + _fps = scan.get_float32(); _num_frames = scan.get_uint16(); } diff --git a/panda/src/chan/animChannel.h b/panda/src/chan/animChannel.h index 1174b89ee8..3cca05a6e9 100644 --- a/panda/src/chan/animChannel.h +++ b/panda/src/chan/animChannel.h @@ -94,11 +94,11 @@ public: static const char *get_part_type_name() { return "MovingPart"; } static void write_datagram(Datagram &dest, ValueType& me) { - dest.add_float64(me); + dest.add_float32(me); } static void read_datagram(DatagramIterator &source, ValueType& me) { - me = source.get_float64(); + me = source.get_float32(); } }; diff --git a/panda/src/chan/animChannelMatrixXfmTable.cxx b/panda/src/chan/animChannelMatrixXfmTable.cxx index 4368d497a0..5019998c47 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.cxx +++ b/panda/src/chan/animChannelMatrixXfmTable.cxx @@ -226,13 +226,13 @@ write_datagram(BamWriter *manager, Datagram &me) { AnimChannelMatrix::write_datagram(manager, me); - me.add_uint8(quantize_bam_channels); + me.add_bool(quantize_bam_channels); if (!quantize_bam_channels) { // Write out everything the old way, as floats. for(int i = 0; i < num_tables; i++) { me.add_uint16(_tables[i].size()); for(int j = 0; j < (int)_tables[i].size(); j++) { - me.add_float64(_tables[i][j]); + me.add_float32(_tables[i][j]); } } @@ -280,11 +280,7 @@ fillin(DatagramIterator& scan, BamReader* manager) { AnimChannelMatrix::fillin(scan, manager); - bool wrote_quantized = false; - if (manager->get_file_minor_ver() >= 1) { - // Version 1 and later: we might have quantized channels. - wrote_quantized = (bool)scan.get_uint8(); - } + bool wrote_quantized = scan.get_bool(); if (!wrote_quantized) { // Regular floats. @@ -292,7 +288,7 @@ fillin(DatagramIterator& scan, BamReader* manager) int size = scan.get_uint16(); PTA_float ind_table; for(int j = 0; j < size; j++) { - ind_table.push_back(scan.get_float64()); + ind_table.push_back(scan.get_float32()); } _tables[i] = ind_table; } diff --git a/panda/src/chan/animChannelScalarTable.cxx b/panda/src/chan/animChannelScalarTable.cxx index c6973e47b0..a929a272a4 100644 --- a/panda/src/chan/animChannelScalarTable.cxx +++ b/panda/src/chan/animChannelScalarTable.cxx @@ -118,12 +118,12 @@ write_datagram(BamWriter *manager, Datagram &me) { AnimChannelScalar::write_datagram(manager, me); - me.add_uint8(quantize_bam_channels); + me.add_bool(quantize_bam_channels); if (!quantize_bam_channels) { // Write out everything the old way, as floats. me.add_uint16(_table.size()); for(int i = 0; i < (int)_table.size(); i++) { - me.add_float64(_table[i]); + me.add_float32(_table[i]); } } else { @@ -150,18 +150,14 @@ fillin(DatagramIterator& scan, BamReader* manager) { AnimChannelScalar::fillin(scan, manager); - bool wrote_quantized = false; - if (manager->get_file_minor_ver() >= 1) { - // Version 1 and later: we might have quantized channels. - wrote_quantized = (bool)scan.get_uint8(); - } + bool wrote_quantized = scan.get_bool(); if (!wrote_quantized) { // Regular floats. int size = scan.get_uint16(); PTA_float temp_table; for(int i = 0; i < size; i++) { - temp_table.push_back(scan.get_float64()); + temp_table.push_back(scan.get_float32()); } _table = temp_table; diff --git a/panda/src/char/computedVertices.cxx b/panda/src/char/computedVertices.cxx index 057835c877..fcb998aec0 100644 --- a/panda/src/char/computedVertices.cxx +++ b/panda/src/char/computedVertices.cxx @@ -77,7 +77,7 @@ write_datagram(Datagram &dest) { int i; dest.add_int16(_joint_index); - dest.add_float64(_effect); + dest.add_float32(_effect); dest.add_uint16(_vindex.size()); for(i = 0; i < (int)_vindex.size(); i++) { @@ -100,7 +100,7 @@ read_datagram(DatagramIterator &source) { int i; _joint_index = source.get_int16(); - _effect = source.get_float64(); + _effect = source.get_float32(); int vsize = source.get_uint16(); for(i = 0; i < vsize; i++) { diff --git a/panda/src/collide/collisionNode.cxx b/panda/src/collide/collisionNode.cxx index 7e2e3e2707..71e56a3165 100644 --- a/panda/src/collide/collisionNode.cxx +++ b/panda/src/collide/collisionNode.cxx @@ -197,7 +197,7 @@ write_datagram(BamWriter *manager, Datagram &me) me.add_uint32(_from_collide_mask.get_word()); me.add_uint32(_into_collide_mask.get_word()); - me.add_uint8(_collide_geom); + me.add_bool(_collide_geom); } //////////////////////////////////////////////////////////////////// @@ -224,12 +224,7 @@ fillin(DatagramIterator& scan, BamReader* manager) _from_collide_mask.set_word(scan.get_uint32()); _into_collide_mask.set_word(scan.get_uint32()); - - if (manager->get_file_minor_ver() >= 2) { - _collide_geom = (scan.get_uint8() != 0); - } else { - _collide_geom = false; - } + _collide_geom = scan.get_bool(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/collide/collisionSphere.cxx b/panda/src/collide/collisionSphere.cxx index 0ea592995f..ed01dd4bfd 100644 --- a/panda/src/collide/collisionSphere.cxx +++ b/panda/src/collide/collisionSphere.cxx @@ -285,7 +285,7 @@ write_datagram(BamWriter *manager, Datagram &me) { CollisionSolid::write_datagram(manager, me); _center.write_datagram(me); - me.add_float64(_radius); + me.add_float32(_radius); } //////////////////////////////////////////////////////////////////// @@ -301,7 +301,7 @@ fillin(DatagramIterator& scan, BamReader* manager) { CollisionSolid::fillin(scan, manager); _center.read_datagram(scan); - _radius = scan.get_float64(); + _radius = scan.get_float32(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/effects/lensFlareNode.cxx b/panda/src/effects/lensFlareNode.cxx index 8c3a97a7be..71e3bb395f 100644 --- a/panda/src/effects/lensFlareNode.cxx +++ b/panda/src/effects/lensFlareNode.cxx @@ -413,10 +413,10 @@ write_datagram(BamWriter *manager, Datagram &me) { WRITE_PTA(manager, me, IPD_Colorf::write_datagram, _flare_colors[i]) } - me.add_float64(_global_scale); - me.add_float64(_texel_scale); - me.add_float64(_blind_fall_off); - me.add_float64(_flare_fall_off); + me.add_float32(_global_scale); + me.add_float32(_texel_scale); + me.add_float32(_blind_fall_off); + me.add_float32(_flare_fall_off); manager->write_pointer(me, _light_node); } @@ -481,10 +481,10 @@ fillin(DatagramIterator &scan, BamReader *manager) _flare_colors.push_back(temp); } - _global_scale = scan.get_float64(); - _texel_scale = scan.get_float64(); - _blind_fall_off = scan.get_float64(); - _flare_fall_off = scan.get_float64(); + _global_scale = scan.get_float32(); + _texel_scale = scan.get_float32(); + _blind_fall_off = scan.get_float32(); + _flare_fall_off = scan.get_float32(); manager->read_pointer(scan, this); } diff --git a/panda/src/gobj/LOD.I b/panda/src/gobj/LOD.I index ad3ff02762..816e0230ec 100644 --- a/panda/src/gobj/LOD.I +++ b/panda/src/gobj/LOD.I @@ -121,8 +121,8 @@ operator < (const LODSwitch &) const { //////////////////////////////////////////////////////////////////// INLINE void LODSwitch:: write_datagram(Datagram &destination) const { - destination.add_float64(_in); - destination.add_float64(_out); + destination.add_float32(_in); + destination.add_float32(_out); } //////////////////////////////////////////////////////////////////// @@ -134,6 +134,6 @@ write_datagram(Datagram &destination) const { //////////////////////////////////////////////////////////////////// INLINE void LODSwitch:: read_datagram(DatagramIterator &source) { - _in = source.get_float64(); - _out = source.get_float64(); + _in = source.get_float32(); + _out = source.get_float32(); } diff --git a/panda/src/gobj/imageBuffer.cxx b/panda/src/gobj/imageBuffer.cxx index 91f57a507a..97e2cdd3f3 100644 --- a/panda/src/gobj/imageBuffer.cxx +++ b/panda/src/gobj/imageBuffer.cxx @@ -77,10 +77,5 @@ write_datagram(BamWriter *, Datagram &me) void ImageBuffer:: fillin(DatagramIterator &scan, BamReader *manager) { set_name(scan.get_string()); - - if (manager->get_file_minor_ver() >= 3) { - set_alpha_name(scan.get_string()); - } else { - clear_alpha_name(); - } + set_alpha_name(scan.get_string()); } diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index a73d6f252f..df6516d2eb 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -423,11 +423,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { _magfiltercolor = (enum FilterType) scan.get_uint8(); _magfilteralpha = (enum FilterType) scan.get_uint8(); - if (manager->get_file_minor_ver() >= 4) { - _anisotropic_degree = scan.get_int16(); - } else { - _anisotropic_degree = 1; - } + _anisotropic_degree = scan.get_int16(); } //////////////////////////////////////////////////////////////////// @@ -451,10 +447,7 @@ make_Texture(const FactoryParams ¶ms) DatagramIterator scan(packet); string name = scan.get_string(); - string alpha_name; - if (manager->get_file_minor_ver() >= 3) { - alpha_name = scan.get_string(); - } + string alpha_name = scan.get_string(); PT(Texture) me; diff --git a/panda/src/linmath/lmatrix3.I b/panda/src/linmath/lmatrix3.I index 75c381e84b..48a137a66c 100644 --- a/panda/src/linmath/lmatrix3.I +++ b/panda/src/linmath/lmatrix3.I @@ -1043,7 +1043,7 @@ write_datagram(Datagram &destination) const { for(int j = 0; j < 3; j++) { - destination.add_float64(get_cell(i,j)); + destination.add_float32(get_cell(i,j)); } } } @@ -1060,7 +1060,7 @@ read_datagram(DatagramIterator &scan) { for(int j = 0; j < 3; j++) { - set_cell(i, j, scan.get_float64()); + set_cell(i, j, scan.get_float32()); } } } diff --git a/panda/src/linmath/lmatrix4.I b/panda/src/linmath/lmatrix4.I index 3148355a07..17593b9ff5 100644 --- a/panda/src/linmath/lmatrix4.I +++ b/panda/src/linmath/lmatrix4.I @@ -1449,7 +1449,7 @@ write_datagram(Datagram &destination) const { for(int j = 0; j < 4; j++) { - destination.add_float64(get_cell(i,j)); + destination.add_float32(get_cell(i,j)); } } } @@ -1467,7 +1467,7 @@ read_datagram(DatagramIterator &scan) { for(int j = 0; j < 4; j++) { - set_cell(i, j, scan.get_float64()); + set_cell(i, j, scan.get_float32()); } } } diff --git a/panda/src/linmath/lvecBase2.I b/panda/src/linmath/lvecBase2.I index 11b4a777ba..52717507fd 100644 --- a/panda/src/linmath/lvecBase2.I +++ b/panda/src/linmath/lvecBase2.I @@ -575,8 +575,8 @@ init_type() { template void LVecBase2:: write_datagram(Datagram &destination) const { - destination.add_float64(_data[0]); - destination.add_float64(_data[1]); + destination.add_float32(_data[0]); + destination.add_float32(_data[1]); } //////////////////////////////////////////////////////////////////// @@ -587,8 +587,8 @@ write_datagram(Datagram &destination) const { template void LVecBase2:: read_datagram(DatagramIterator &source) { - _data[0] = source.get_float64(); - _data[1] = source.get_float64(); + _data[0] = source.get_float32(); + _data[1] = source.get_float32(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvecBase3.I b/panda/src/linmath/lvecBase3.I index 5c7b2d1ddb..c69fd85da8 100644 --- a/panda/src/linmath/lvecBase3.I +++ b/panda/src/linmath/lvecBase3.I @@ -648,9 +648,9 @@ init_type() { template void LVecBase3:: write_datagram(Datagram &destination) const { - destination.add_float64(_data[0]); - destination.add_float64(_data[1]); - destination.add_float64(_data[2]); + destination.add_float32(_data[0]); + destination.add_float32(_data[1]); + destination.add_float32(_data[2]); } //////////////////////////////////////////////////////////////////// @@ -661,9 +661,9 @@ write_datagram(Datagram &destination) const { template void LVecBase3:: read_datagram(DatagramIterator &source) { - _data[0] = source.get_float64(); - _data[1] = source.get_float64(); - _data[2] = source.get_float64(); + _data[0] = source.get_float32(); + _data[1] = source.get_float32(); + _data[2] = source.get_float32(); } diff --git a/panda/src/linmath/lvecBase4.I b/panda/src/linmath/lvecBase4.I index eae2792345..e2e96e2475 100644 --- a/panda/src/linmath/lvecBase4.I +++ b/panda/src/linmath/lvecBase4.I @@ -676,10 +676,10 @@ init_type() { template void LVecBase4:: write_datagram(Datagram &destination) const { - destination.add_float64(_data[0]); - destination.add_float64(_data[1]); - destination.add_float64(_data[2]); - destination.add_float64(_data[3]); + destination.add_float32(_data[0]); + destination.add_float32(_data[1]); + destination.add_float32(_data[2]); + destination.add_float32(_data[3]); } //////////////////////////////////////////////////////////////////// @@ -690,10 +690,10 @@ write_datagram(Datagram &destination) const { template void LVecBase4:: read_datagram(DatagramIterator &source) { - _data[0] = source.get_float64(); - _data[1] = source.get_float64(); - _data[2] = source.get_float64(); - _data[3] = source.get_float64(); + _data[0] = source.get_float32(); + _data[1] = source.get_float32(); + _data[2] = source.get_float32(); + _data[3] = source.get_float32(); } diff --git a/panda/src/mathutil/plane.I b/panda/src/mathutil/plane.I index c311d83f89..d51ef97ffc 100644 --- a/panda/src/mathutil/plane.I +++ b/panda/src/mathutil/plane.I @@ -283,10 +283,10 @@ template void Plane:: write_datagram(Datagram &dest) { - dest.add_float64(_a); - dest.add_float64(_b); - dest.add_float64(_c); - dest.add_float64(_d); + dest.add_float32(_a); + dest.add_float32(_b); + dest.add_float32(_c); + dest.add_float32(_d); } //////////////////////////////////////////////////////////////////// @@ -298,8 +298,8 @@ template void Plane:: read_datagram(DatagramIterator &source) { - _a = source.get_float64(); - _b = source.get_float64(); - _c = source.get_float64(); - _d = source.get_float64(); + _a = source.get_float32(); + _b = source.get_float32(); + _c = source.get_float32(); + _d = source.get_float32(); } diff --git a/panda/src/putil/bam.h b/panda/src/putil/bam.h index c99e80715b..670bb3516b 100644 --- a/panda/src/putil/bam.h +++ b/panda/src/putil/bam.h @@ -15,13 +15,11 @@ //for detecting files damaged due to ASCII/Binary conversion static const string _bam_header = string("pbj\0\n\r", 6); -static const unsigned short _bam_major_ver = 2; +static const unsigned short _bam_major_ver = 3; // Bumped to major version 2 on 7/6/00 due to major changes in Character. -static const unsigned short _bam_minor_ver = 4; -// Bumped to minor version 1 on 7/19/00 to quantize channel files. -// Bumped to minor version 2 on 8/21/00 for CollisionNode::_collide_geom. -// Bumped to minor version 3 on 11/21/00 for dual-image textures. -// Bumped to minor version 4 on 11/28/00 for anisotropic texture filtering. +// Bumped to major version 3 on 12/8/00 to change float64's to float32's. + +static const unsigned short _bam_minor_ver = 0; #endif diff --git a/panda/src/putil/ioPtaDatagramFloat.cxx b/panda/src/putil/ioPtaDatagramFloat.cxx index 3d138bee4e..d4bdce1d50 100644 --- a/panda/src/putil/ioPtaDatagramFloat.cxx +++ b/panda/src/putil/ioPtaDatagramFloat.cxx @@ -19,7 +19,7 @@ write_datagram(Datagram &dest, CPTA_float array) { dest.add_uint32(array.size()); for (int i = 0; i < (int)array.size(); i++) { - dest.add_float64(array[i]); + dest.add_float32(array[i]); } } @@ -35,7 +35,7 @@ read_datagram(DatagramIterator &source) int size = source.get_uint32(); for (int i = 0; i < size; i++) { - array.push_back(source.get_float64()); + array.push_back(source.get_float32()); } return array; diff --git a/panda/src/putil/timedCycle.cxx b/panda/src/putil/timedCycle.cxx index 7fb44b1ccf..5aae7d9700 100644 --- a/panda/src/putil/timedCycle.cxx +++ b/panda/src/putil/timedCycle.cxx @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// void TimedCycle:: write_datagram(Datagram &me) { - me.add_float64(_cycle_time); + me.add_float32(_cycle_time); me.add_uint16(_element_count); } @@ -28,7 +28,7 @@ write_datagram(Datagram &me) { //////////////////////////////////////////////////////////////////// void TimedCycle:: fillin(DatagramIterator &scan) { - _cycle_time = scan.get_float64(); + _cycle_time = scan.get_float32(); _element_count = scan.get_uint16(); _inv_cycle_time = 1. / _cycle_time;