better respect for keep-texture-ram and preload-textures in the presence of a bam-cache

This commit is contained in:
David Rose 2007-06-03 16:31:43 +00:00
parent 2719a277e5
commit 5abe3a9e1c
2 changed files with 12 additions and 0 deletions

View File

@ -2392,7 +2392,9 @@ reload_ram_image() {
gobj_cat.info()
<< "Texture " << get_name() << " reloaded from disk cache.\n";
PT(Texture) tex = DCAST(Texture, record->extract_data());
bool keep_ram_image = _keep_ram_image;
(*this) = (*tex);
_keep_ram_image = keep_ram_image;
return;
}
}

View File

@ -282,6 +282,11 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
gobj_cat.info()
<< "Texture " << filename << " found in disk cache.\n";
tex = DCAST(Texture, record->extract_data());
if (!preload_textures) {
// But drop the RAM until we need it.
tex->clear_ram_image();
}
tex->set_keep_ram_image(false);
}
}
}
@ -329,6 +334,11 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
// Store the on-disk cache record for next time.
record->set_data(tex, false);
cache->store(record);
if (!preload_textures) {
// And now drop the RAM until we need it.
tex->clear_ram_image();
}
}
nassertr(!tex->get_fullpath().empty(), tex);