42class EXPCL_PANDA_PUTIL BamCache {
75 const std::string &cache_extension);
81 void list_index(std::ostream &out,
int indent_level = 0)
const;
102 bool read_index_pathname(
Filename &index_pathname,
103 std::string &index_ref_contents)
const;
105 void rebuild_index();
106 INLINE
void mark_index_stale();
109 void remove_from_index(
const Filename &source_filename);
111 void check_cache_size();
113 void emergency_read_only();
126 static std::string hash_filename(
const std::string &filename);
127 static void make_global();
131 bool _cache_textures;
132 bool _cache_compressed_textures;
133 bool _cache_compiled_shaders;
138 static BamCache *_global_ptr;
141 time_t _index_stale_since;
144 std::string _index_ref_contents;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This represents the in-memory index that records the list of files stored in the BamCache.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
static void consider_flush_global_index()
If there is a global BamCache object, calls consider_flush_index() on it.
get_active
Returns true if the BamCache is currently active, false if it is not.
get_cache_models
Returns whether model files (e.g.
set_read_only
Can be used to put the cache in read-only mode, or take it out of read-only mode.
void consider_flush_index()
Flushes the index if enough time has elapsed since the index was last flushed.
static void flush_global_index()
If there is a global BamCache object, calls flush_index() on it.
get_cache_textures
Returns whether texture files (e.g.
get_root
Returns the current root pathname of the cache.
void list_index(std::ostream &out, int indent_level=0) const
Writes the contents of the index to standard output.
bool store(BamCacheRecord *record)
Flushes a cache entry to disk.
set_flush_time
Specifies the time in seconds between automatic flushes of the cache index.
get_cache_max_kbytes
Returns the maximum size, in kilobytes, which the cache is allowed to grow to.
static BamCache * get_global_ptr()
Returns a pointer to the global BamCache object, which is used automatically by the ModelPool and Tex...
void flush_index()
Ensures the index is written to disk.
set_active
Changes the state of the active flag.
set_cache_compiled_shaders
Indicates whether compiled shader programs will be stored in the cache, as binary ....
get_flush_time
Returns the time in seconds between automatic flushes of the cache index.
get_cache_compressed_textures
Returns whether compressed texture files will be stored in the cache, as compressed txo files.
set_cache_max_kbytes
Specifies the maximum size, in kilobytes, which the cache is allowed to grow to.
set_cache_models
Indicates whether model files (e.g.
set_cache_textures
Indicates whether texture files will be stored in the cache, as uncompressed txo files.
get_cache_compiled_shaders
Returns whether compiled shader programs will be stored in the cache, as binary .txo files.
set_root
Changes the current root pathname of the cache.
set_cache_compressed_textures
Indicates whether compressed texture files will be stored in the cache, as compressed txo files.
get_read_only
Returns true if the cache is in read-only mode.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.