diff --git a/pandatool/src/bam/bamInfo.cxx b/pandatool/src/bam/bamInfo.cxx index d5b455ceb9..2ac083fe37 100644 --- a/pandatool/src/bam/bamInfo.cxx +++ b/pandatool/src/bam/bamInfo.cxx @@ -27,6 +27,7 @@ #include "recorderTable.h" #include "dcast.h" #include "pvector.h" +#include "bamCacheRecord.h" //////////////////////////////////////////////////////////////////// // Function: BamInfo::Constructor @@ -131,6 +132,17 @@ get_info(const Filename &filename) { Objects objects; TypedWritable *object = bam_file.read_object(); + + if (object != (TypedWritable *)NULL && + object->is_exact_type(BamCacheRecord::get_class_type())) { + // Here's a special case: if the first object in the file is a + // BamCacheRecord, it's a cache data file; in this case, we output + // the cache record, and then pretend it doesn't exist. + DCAST(BamCacheRecord, object)->write(nout, 2); + nout << "\n"; + object = bam_file.read_object(); + } + while (object != (TypedWritable *)NULL || !bam_file.is_eof()) { if (object != (TypedWritable *)NULL) { objects.push_back(object); diff --git a/pandatool/src/bam/bamToEgg.cxx b/pandatool/src/bam/bamToEgg.cxx index 8911a75481..f7ec4bb148 100644 --- a/pandatool/src/bam/bamToEgg.cxx +++ b/pandatool/src/bam/bamToEgg.cxx @@ -35,6 +35,7 @@ #include "geomVertexReader.h" #include "string_utils.h" #include "bamFile.h" +#include "bamCacheRecord.h" #include "eggGroup.h" #include "eggVertexPool.h" #include "eggVertex.h" @@ -93,6 +94,16 @@ run() { typedef pvector Objects; Objects objects; TypedWritable *object = bam_file.read_object(); + + if (object != (TypedWritable *)NULL && + object->is_exact_type(BamCacheRecord::get_class_type())) { + // Here's a special case: if the first object in the file is a + // BamCacheRecord, it's really a cache data file and not a true + // bam file; but skip over the cache data record and let the user + // treat it like an ordinary bam file. + object = bam_file.read_object(); + } + while (object != (TypedWritable *)NULL || !bam_file.is_eof()) { if (object != (TypedWritable *)NULL) { objects.push_back(object); @@ -467,8 +478,6 @@ get_egg_texture(Texture *tex) { } switch (tex->get_minfilter()) { - case Texture::FT_invalid: - break; case Texture::FT_nearest: temp.set_minfilter(EggTexture::FT_nearest); break; @@ -487,6 +496,9 @@ get_egg_texture(Texture *tex) { case Texture::FT_linear_mipmap_linear: temp.set_minfilter(EggTexture::FT_linear_mipmap_linear); break; + + default: + break; } switch (tex->get_magfilter()) { @@ -496,6 +508,7 @@ get_egg_texture(Texture *tex) { case Texture::FT_linear: temp.set_magfilter(EggTexture::FT_linear); break; + default: break; }