59 vector_string::const_iterator wi;
60 for (wi = words.begin(); wi != words.end(); ++wi) {
61 _type_registry[*wi] = func;
74 <<
"Registering Texture filter " << *filter <<
"\n";
75 _filter_registry.push_back(filter);
88 TypeRegistry::const_iterator ti;
89 ti = _type_registry.find(c);
90 if (ti != _type_registry.end()) {
97 if (type !=
nullptr || c ==
"txo" || c ==
"dds" || c ==
"ktx") {
99 ((
TexturePool *)
this)->_type_registry[c] = Texture::make_texture;
100 return Texture::make_texture;
117 indent(out, indent_level) <<
"Texture Object .txo\n";
118 indent(out, indent_level) <<
"DirectDraw Surface .dds\n";
119 indent(out, indent_level) <<
"Khronos Texture .ktx\n";
122 pnm_reg->
write(out, indent_level);
126 TypeRegistry::const_iterator ti;
127 for (ti = _type_registry.begin(); ti != _type_registry.end(); ++ti) {
128 string extension = (*ti).first;
129 MakeTextureFunc *func = (*ti).second;
133 string name = tex->get_type().get_name();
134 indent(out, indent_level) << name;
135 indent(out, std::max(30 - (
int)name.length(), 0))
136 <<
" ." << extension <<
"\n";
147 if (_global_ptr ==
nullptr) {
152 _global_ptr->load_filters();
164 (
"fake-texture-image",
"",
165 PRC_DESC(
"Set this to enable a speedy-load mode in which you don't care " 166 "what the world looks like, you just want it to load in minimal " 167 "time. This causes all texture loads via the TexturePool to use " 168 "the same texture file, which will presumably only be loaded " 170 _fake_texture_image = fake_texture_image;
177 ns_has_texture(
const Filename &orig_filename) {
181 resolve_filename(key._fullpath, orig_filename,
false,
LoaderOptions());
183 Textures::const_iterator ti;
184 ti = _textures.find(key);
185 if (ti != _textures.end()) {
191 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
192 if (ti->first._fullpath == key._fullpath) {
204 ns_load_texture(
const Filename &orig_filename,
int primary_file_num_channels,
207 key._primary_file_num_channels = primary_file_num_channels;
210 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
212 Textures::const_iterator ti;
213 ti = _textures.find(key);
214 if (ti != _textures.end()) {
225 bool store_record =
false;
228 tex = pre_load(orig_filename,
Filename(), primary_file_num_channels, 0,
229 read_mipmaps, options);
232 bool compressed_cache_record =
false;
233 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
236 if (tex ==
nullptr) {
240 <<
"Loading texture " << key._fullpath <<
"\n";
242 string ext =
downcase(key._fullpath.get_extension());
243 if (ext ==
"txo" || ext ==
"bam") {
249 key._fullpath.set_binary();
251 if (file ==
nullptr) {
254 <<
"Could not find " << key._fullpath <<
"\n";
258 if (gobj_cat.is_debug()) {
260 <<
"Reading texture object " << key._fullpath <<
"\n";
263 istream *in = file->open_read_file(
true);
264 tex = Texture::make_from_txo(*in, key._fullpath);
267 if (tex ==
nullptr) {
276 tex = ns_make_texture(ext);
277 if (!tex->
read(key._fullpath,
Filename(), primary_file_num_channels, 0,
278 0, 0,
false, read_mipmaps, record, options)) {
280 report_texture_unreadable(key._fullpath);
285 if (options.get_texture_flags() & LoaderOptions::TF_preload_simple) {
289 store_record = (record !=
nullptr);
294 bool needs_driver_compression =
true;
296 bool needs_driver_compression = driver_compress_textures;
297 #endif // HAVE_SQUISH 298 if (needs_driver_compression) {
301 store_record =
false;
302 if (!compressed_cache_record) {
309 store_record =
false;
313 nassertr(tex !=
nullptr,
nullptr);
316 tex->_texture_pool_key = key._fullpath;
323 Textures::const_iterator ti;
324 ti = _textures.find(key);
325 if (ti != _textures.end()) {
332 _textures[std::move(key)] = tex;
338 cache->
store(record);
341 if (!(options.get_texture_flags() & LoaderOptions::TF_preload)) {
349 tex = post_load(tex);
358 ns_load_texture(
const Filename &orig_filename,
359 const Filename &orig_alpha_filename,
360 int primary_file_num_channels,
361 int alpha_file_channel,
363 if (!_fake_texture_image.empty()) {
364 return ns_load_texture(_fake_texture_image, primary_file_num_channels,
365 read_mipmaps, options);
369 key._primary_file_num_channels = primary_file_num_channels;
370 key._alpha_file_channel = alpha_file_channel;
373 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
374 resolve_filename(key._alpha_fullpath, orig_alpha_filename, read_mipmaps, options);
376 Textures::const_iterator ti;
377 ti = _textures.find(key);
378 if (ti != _textures.end()) {
388 bool store_record =
false;
391 tex = pre_load(orig_filename, orig_alpha_filename, primary_file_num_channels,
392 alpha_file_channel, read_mipmaps, options);
395 bool compressed_cache_record =
false;
396 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
399 if (tex ==
nullptr) {
403 <<
"Loading texture " << key._fullpath <<
" and alpha component " 404 << key._alpha_fullpath << std::endl;
405 tex = ns_make_texture(key._fullpath.get_extension());
406 if (!tex->
read(key._fullpath, key._alpha_fullpath, primary_file_num_channels,
407 alpha_file_channel, 0, 0,
false, read_mipmaps,
nullptr,
410 report_texture_unreadable(key._fullpath);
414 if (options.get_texture_flags() & LoaderOptions::TF_preload_simple) {
418 store_record = (record !=
nullptr);
423 bool needs_driver_compression =
true;
425 bool needs_driver_compression = driver_compress_textures;
426 #endif // HAVE_SQUISH 427 if (needs_driver_compression) {
430 store_record =
false;
431 if (!compressed_cache_record) {
438 store_record =
false;
442 nassertr(tex !=
nullptr,
nullptr);
447 tex->_texture_pool_key = key._fullpath;
453 Textures::const_iterator ti;
454 ti = _textures.find(key);
455 if (ti != _textures.end()) {
462 _textures[std::move(key)] = tex;
468 cache->
store(record);
471 if (!(options.get_texture_flags() & LoaderOptions::TF_preload)) {
479 tex = post_load(tex);
488 ns_load_3d_texture(
const Filename &filename_pattern,
490 Filename orig_filename(filename_pattern);
494 key._texture_type = Texture::TT_3d_texture;
497 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
499 Textures::const_iterator ti;
500 ti = _textures.find(key);
501 if (ti != _textures.end()) {
511 bool store_record =
false;
514 bool compressed_cache_record =
false;
515 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
518 if (tex ==
nullptr ||
523 <<
"Loading 3-d texture " << key._fullpath <<
"\n";
524 tex = ns_make_texture(key._fullpath.get_extension());
526 if (!tex->
read(key._fullpath, 0, 0,
true, read_mipmaps, options)) {
528 report_texture_unreadable(key._fullpath);
531 store_record = (record !=
nullptr);
536 bool needs_driver_compression =
true;
538 bool needs_driver_compression = driver_compress_textures;
539 #endif // HAVE_SQUISH 540 if (needs_driver_compression) {
543 store_record =
false;
544 if (!compressed_cache_record) {
551 store_record =
false;
555 nassertr(tex !=
nullptr,
nullptr);
558 tex->_texture_pool_key = key._fullpath;
564 Textures::const_iterator ti;
565 ti = _textures.find(key);
566 if (ti != _textures.end()) {
573 _textures[std::move(key)] = tex;
579 cache->
store(record);
590 ns_load_2d_texture_array(
const Filename &filename_pattern,
592 Filename orig_filename(filename_pattern);
596 key._texture_type = Texture::TT_2d_texture_array;
599 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
601 Textures::const_iterator ti;
602 ti = _textures.find(key);
603 if (ti != _textures.end()) {
613 bool store_record =
false;
616 bool compressed_cache_record =
false;
617 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
620 if (tex ==
nullptr ||
625 <<
"Loading 2-d texture array " << key._fullpath <<
"\n";
626 tex = ns_make_texture(key._fullpath.get_extension());
628 if (!tex->
read(key._fullpath, 0, 0,
true, read_mipmaps, options)) {
630 report_texture_unreadable(key._fullpath);
633 store_record = (record !=
nullptr);
638 bool needs_driver_compression =
true;
640 bool needs_driver_compression = driver_compress_textures;
641 #endif // HAVE_SQUISH 642 if (needs_driver_compression) {
645 store_record =
false;
646 if (!compressed_cache_record) {
653 store_record =
false;
657 nassertr(tex !=
nullptr,
nullptr);
660 tex->_texture_pool_key = key._fullpath;
666 Textures::const_iterator ti;
667 ti = _textures.find(key);
668 if (ti != _textures.end()) {
675 _textures[std::move(key)] = tex;
681 cache->
store(record);
692 ns_load_cube_map(
const Filename &filename_pattern,
bool read_mipmaps,
694 Filename orig_filename(filename_pattern);
698 key._texture_type = Texture::TT_cube_map;
701 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
703 Textures::const_iterator ti;
704 ti = _textures.find(key);
705 if (ti != _textures.end()) {
715 bool store_record =
false;
718 bool compressed_cache_record =
false;
719 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
722 if (tex ==
nullptr ||
727 <<
"Loading cube map texture " << key._fullpath <<
"\n";
728 tex = ns_make_texture(key._fullpath.get_extension());
730 if (!tex->
read(key._fullpath, 0, 0,
true, read_mipmaps, options)) {
732 report_texture_unreadable(key._fullpath);
735 store_record = (record !=
nullptr);
740 bool needs_driver_compression =
true;
742 bool needs_driver_compression = driver_compress_textures;
743 #endif // HAVE_SQUISH 744 if (needs_driver_compression) {
747 store_record =
false;
748 if (!compressed_cache_record) {
755 store_record =
false;
759 nassertr(tex !=
nullptr,
nullptr);
762 tex->_texture_pool_key = key._fullpath;
768 Textures::const_iterator ti;
769 ti = _textures.find(key);
770 if (ti != _textures.end()) {
777 _textures[std::move(key)] = tex;
783 cache->
store(record);
794 ns_get_normalization_cube_map(
int size) {
797 if (_normalization_cube_map ==
nullptr) {
798 _normalization_cube_map =
new Texture(
"normalization_cube_map");
800 if (_normalization_cube_map->get_x_size() < size ||
801 _normalization_cube_map->get_texture_type() != Texture::TT_cube_map) {
802 _normalization_cube_map->generate_normalization_cube_map(size);
805 return _normalization_cube_map;
812 ns_get_alpha_scale_map() {
815 if (_alpha_scale_map ==
nullptr) {
816 _alpha_scale_map =
new Texture(
"alpha_scale_map");
817 _alpha_scale_map->generate_alpha_scale_map();
820 return _alpha_scale_map;
831 if (!tex->_texture_pool_key.empty()) {
832 ns_release_texture(tex);
836 if (tex_cdata->_fullpath.empty()) {
837 gobj_cat.error() <<
"Attempt to call add_texture() on an unnamed texture.\n";
842 key._fullpath = tex_cdata->_fullpath;
843 key._alpha_fullpath = tex_cdata->_alpha_fullpath;
844 key._alpha_file_channel = tex_cdata->_alpha_file_channel;
845 key._texture_type = tex_cdata->_texture_type;
848 tex->_texture_pool_key = key._fullpath;
849 _textures[key] = tex;
856 ns_release_texture(
Texture *tex) {
859 Textures::iterator ti;
860 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
861 if (tex == (*ti).second) {
863 tex->_texture_pool_key = string();
869 _relpath_lookup.clear();
876 ns_release_all_textures() {
879 Textures::iterator ti;
880 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
882 tex->_texture_pool_key = string();
886 _normalization_cube_map =
nullptr;
889 _relpath_lookup.clear();
896 ns_garbage_collect() {
899 int num_released = 0;
902 Textures::iterator ti;
903 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
906 if (gobj_cat.is_debug()) {
908 <<
"Releasing " << (*ti).first._fullpath <<
"\n";
911 tex->_texture_pool_key = string();
913 new_set.insert(new_set.end(), *ti);
917 _textures.swap(new_set);
919 if (_normalization_cube_map !=
nullptr &&
920 _normalization_cube_map->get_ref_count() == 1) {
921 if (gobj_cat.is_debug()) {
923 <<
"Releasing normalization cube map\n";
926 _normalization_cube_map =
nullptr;
936 ns_list_contents(ostream &out)
const {
941 Textures::const_iterator ti;
943 out <<
"texture pool contents:\n";
947 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
949 out << (*ti).first._fullpath <<
"\n";
956 nassertv(tex->_texture_pool_key == (*ti).first._fullpath);
961 out <<
"total number of textures: " << _textures.size() <<
"\n";
962 out <<
"texture pool ram : " << total_ram_size <<
"\n";
963 out <<
"texture pool size: " << total_size <<
"\n";
964 out <<
"texture pool size - texture pool ram: " << total_size - total_ram_size <<
"\n";
971 ns_find_texture(
const string &name)
const {
975 Textures::const_iterator ti;
976 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
978 if (glob.matches(tex->get_name())) {
990 ns_find_all_textures(
const string &name)
const {
995 Textures::const_iterator ti;
996 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
998 if (glob.matches(tex->get_name())) {
1012 ns_make_texture(
const string &extension)
const {
1014 if (func !=
nullptr) {
1031 if (!_fake_texture_image.empty()) {
1032 new_filename = _fake_texture_image;
1036 RelpathLookup::iterator rpi = _relpath_lookup.find(orig_filename);
1037 if (rpi != _relpath_lookup.end()) {
1038 new_filename = (*rpi).second;
1042 new_filename = orig_filename;
1043 if (read_mipmaps || (options.get_texture_flags() & LoaderOptions::TF_multiview)) {
1050 _relpath_lookup[orig_filename] = new_filename;
1060 if (tex ==
nullptr) {
1070 PT(
Texture) dummy = ns_make_texture(ext);
1071 dummy->ensure_loader_type(filename);
1074 record = cache->lookup(filename,
"txo");
1075 if (record !=
nullptr) {
1076 if (record->has_data()) {
1085 if (gobj_cat.is_debug()) {
1087 <<
"Not caching uncompressed texture " << *tex <<
"\n";
1098 if (gobj_cat.is_debug()) {
1100 <<
"Cached texture " << *tex <<
" has size " 1102 <<
" instead of " << x_size <<
" x " << y_size
1103 <<
"; dropping cache.\n";
1109 if (gobj_cat.is_debug()) {
1111 <<
"Cached texture " << *tex
1112 <<
" is compressed in cache; dropping cache.\n";
1118 <<
"Texture " << filename <<
" found in disk cache.\n";
1119 if ((options.get_texture_flags() & LoaderOptions::TF_preload_simple) &&
1123 if (!(options.get_texture_flags() & LoaderOptions::TF_preload)) {
1129 if (tex->consider_auto_process_ram_image(tex->
uses_mipmaps(),
true)) {
1131 if (!was_compressed && is_compressed &&
1137 cache->
store(record);
1138 compressed_cache_record =
true;
1149 if (gobj_cat.is_debug()) {
1151 <<
"Not caching uncompressed texture\n";
1165 report_texture_unreadable(
const Filename &filename)
const {
1167 bool has_hash = (filename.
get_fullpath().find(
'#') != string::npos);
1168 if (!has_hash && !vfs->
exists(filename)) {
1173 <<
"Unable to find texture \"" << filename <<
"\"" 1174 <<
" on model-path " << get_model_path() <<
"\n";
1179 <<
"Texture \"" << filename <<
"\" does not exist.\n";
1186 <<
"Texture \"" << filename <<
"\" exists but cannot be read.\n";
1191 <<
"Texture \"" << filename <<
"\" cannot be read.\n";
1196 if (func ==
nullptr) {
1199 <<
"\" is unknown. Supported texture types:\n";
1211 pre_load(
const Filename &orig_filename,
const Filename &orig_alpha_filename,
1212 int primary_file_num_channels,
int alpha_file_channel,
1218 FilterRegistry::iterator fi;
1219 for (fi = _filter_registry.begin();
1220 fi != _filter_registry.end();
1222 tex = (*fi)->pre_load(orig_filename, orig_alpha_filename,
1223 primary_file_num_channels, alpha_file_channel,
1224 read_mipmaps, options);
1225 if (tex !=
nullptr) {
1242 FilterRegistry::iterator fi;
1243 for (fi = _filter_registry.begin();
1244 fi != _filter_registry.end();
1246 result = (*fi)->post_load(result);
1260 PRC_DESC(
"Names one or more external libraries that should be loaded for the " 1261 "purposes of performing texture filtering. This variable may be repeated several " 1262 "times. As in load-display, the actual library filename is derived by " 1263 "prefixing 'lib' to the specified name."));
1265 int num_aux = texture_filter.get_num_unique_values();
1266 for (
int i = 0; i < num_aux; i++) {
1267 string name = texture_filter.get_unique_value(i);
1269 Filename dlname = Filename::dso_filename(
"lib" + name +
".so");
1271 <<
"loading texture filter: " << dlname.
to_os_specific() << std::endl;
1272 void *tmp = load_dso(get_plugin_path().get_value(), dlname);
1273 if (tmp ==
nullptr) {
1275 <<
"Unable to load: " << load_dso_error() << std::endl;
Texture(const std::string &name=std::string())
Constructs an empty texture.
get_orig_file_y_size
Returns the Y size of the original disk image that this Texture was loaded from (if it came from a di...
get_y_size
Returns the height of the texture image in texels.
set_fullpath
Sets the full pathname to the file that contains the image's contents, as found along the search path...
get_ref_count
Returns the current reference count.
set_data
Stores a new data object on the record.
set_filename
Sets the name of the file that contains the image's contents.
void register_texture_type(MakeTextureFunc *func, const std::string &extensions)
Records a factory function that makes a Texture object of the appropriate type for one or more partic...
get_fullpath
Returns the fullpath that has been set.
void write_texture_types(std::ostream &out, int indent_level) const
Outputs a list of the available texture types to the indicated output stream.
MakeTextureFunc * get_texture_type(const std::string &extension) const
Returns the factory function to construct a new texture of the type appropriate for the indicated fil...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_cache_textures
Returns whether texture files (e.g.
Specifies parameters that may be passed to the loader.
This class maintains a cache of Bam and/or Txo objects generated from model files and texture images ...
This is a convenience class to specialize ConfigVariable as a Filename type.
void write(std::ostream &out, int indent_level=0) const
Writes a list of supported image file types to the indicated output stream, one per line.
A hierarchy of directories and files that appears to be one continuous file system,...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_texture_type
Returns the overall interpretation of the texture.
This is the base class of a family of classes that represent particular image file types that PNMImag...
string downcase(const string &s)
Returns the input string with all uppercase letters converted to lowercase.
bool resolve_filename(Filename &filename, const DSearchPath &searchpath, const std::string &default_extension=std::string()) const
Searches the given search path for the filename.
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
set_alpha_fullpath
Sets the full pathname to the file that contains the image's alpha channel contents,...
void add_texture(Texture *texture)
Adds a new Texture to the collection.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The abstract base class for a file or directory within the VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is similar to ConfigVariable, but it reports its value as a list of strings.
void register_filter(TexturePoolFilter *filter)
Records a TexturePoolFilter object that may operate on texture images as they are loaded from disk.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void setup_cube_map()
Sets the texture as an empty cube map texture with no dimensions.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_ram_page_size
Returns the number of bytes used by the in-memory image per page, or 0 if there is no in-memory image...
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
bool adjust_this_size(int &x_size, int &y_size, const std::string &name, bool for_padding) const
Works like adjust_size, but also considers the texture class.
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
static void close_read_file(std::istream *stream)
Closes a file opened by a previous call to open_read_file().
bool store(BamCacheRecord *record)
Flushes a cache entry to disk.
PT(Texture) TexturePool
Creates a new Texture object of the appropriate type for the indicated filename extension,...
bool uses_mipmaps() const
Returns true if the minfilter settings on this texture indicate the use of mipmapping,...
bool exists(const Filename &filename) const
Convenience function; returns true if the named file exists.
int extract_words(const string &str, vector_string &words)
Divides the string into a number of words according to whitespace.
void setup_3d_texture(int z_size=1)
Sets the texture as an empty 3-d texture with no dimensions (though if you know the depth ahead of ti...
The name of a file, such as a texture file or an Egg file.
set_keep_ram_image
Sets the flag that indicates whether this Texture is eligible to have its main RAM copy of the textur...
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
void setup_2d_texture_array(int z_size=1)
Sets the texture as an empty 2-d texture array with no dimensions (though if you know the depth ahead...
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
std::string get_fullpath() const
Returns the entire filename: directory, basename, extension.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
get_data
Returns a pointer to the data stored in the record, or NULL if there is no data.
get_orig_file_x_size
Returns the X size of the original disk image that this Texture was loaded from (if it came from a di...
Manages a list of Texture objects, as returned by TexturePool::find_all_textures().
PointerTo< VirtualFile > get_file(const Filename &filename, bool status_only=false) const
Looks up the file by the indicated name in the file system.
set_post_load_store_cache
Sets the post_load_store_cache flag.
bool is_local() const
Returns true if the filename is local, e.g.
static TexturePool * get_global_ptr()
Initializes and/or returns the global pointer to the one TexturePool object in the system.
PNMFileType * get_type_from_extension(const std::string &filename) const
Tries to determine what the PNMFileType is likely to be for a particular image file based on its exte...
std::string get_extension() const
Returns the file extension.
void clear_ram_image()
Discards the current system-RAM image.
std::string get_basename() const
Returns the basename part of the filename.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class maintains the set of all known PNMFileTypes in the universe.
void generate_simple_ram_image()
Computes the "simple" ram image by loading the main RAM image, if it is not already available,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_alpha_filename
Sets the name of the file that contains the image's alpha channel contents.
bool read(const Filename &fullpath, const LoaderOptions &options=LoaderOptions())
Reads the named filename into the texture.
This is an abstract base class, a placeholder for any number of different classes that may wish to im...
get_cache_compressed_textures
Returns whether compressed texture files will be stored in the cache, as compressed txo files.
has_simple_ram_image
Returns true if the Texture has a "simple" image available in main RAM.
This is the preferred interface for loading textures from image files.
is_cacheable
Returns true if there is enough information in this Texture object to write it to the bam cache succe...
clear_alpha_fullpath
Removes the alpha fullpath, if it was previously set.
bool has_compression() const
Returns true if the texture indicates it wants to be compressed, either with CM_on or higher,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::string to_os_specific() const
Converts the filename from our generic Unix-like convention (forward slashes starting with the root a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_x_size
Returns the width of the texture image in texels.
static BamCache * get_global_ptr()
Returns a pointer to the global BamCache object, which is used automatically by the ModelPool and Tex...
void set_pattern(bool pattern)
Sets the flag indicating whether this is a filename pattern.
This class can be used to test for string matches against standard Unix- shell filename globbing conv...
get_ram_image_compression
Returns the compression mode in which the ram image is already stored pre- compressed.
get_ram_image_size
Returns the total number of bytes used by the in-memory image, across all pages and views,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.