From b9d7c0dd691939a75a157f5532152ee61d6d15da Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Sun, 17 Jun 2007 07:02:47 +0000 Subject: [PATCH] Added ability to suppress texture caching in BamCache --- panda/src/putil/bamCache.cxx | 12 +++++++++++- panda/src/putil/bamCache.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/panda/src/putil/bamCache.cxx b/panda/src/putil/bamCache.cxx index 9addb91f18..2c798ecf8b 100644 --- a/panda/src/putil/bamCache.cxx +++ b/panda/src/putil/bamCache.cxx @@ -55,11 +55,17 @@ BamCache() : ("model-cache-flush", 30, PRC_DESC("This is the amount of time, in seconds, between automatic " "flushes of the model-cache index.")); - + + ConfigVariableBool model_cache_textures + ("model-cache-textures", true, + PRC_DESC("If this is set to true, textures will also be cached in the " + "model cache, as txo files.")); + ConfigVariableInt model_cache_max_kbytes ("model-cache-max-kbytes", 1048576, PRC_DESC("This is the maximum size of the model cache, in kilobytes.")); + _cache_textures = model_cache_textures; _flush_time = model_cache_flush; _max_kbytes = model_cache_max_kbytes; @@ -141,6 +147,10 @@ PT(BamCacheRecord) BamCache:: lookup(const Filename &source_filename, const string &cache_extension) { consider_flush_index(); + if ((cache_extension == "txo")&&(!_cache_textures)) { + return NULL; + } + Filename source_pathname(source_filename); source_pathname.make_absolute(); diff --git a/panda/src/putil/bamCache.h b/panda/src/putil/bamCache.h index 5a3190fbef..82e0d87229 100644 --- a/panda/src/putil/bamCache.h +++ b/panda/src/putil/bamCache.h @@ -100,6 +100,7 @@ private: Filename _root; int _flush_time; int _max_kbytes; + bool _cache_textures; static BamCache *_global_ptr; BamCacheIndex *_index;