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;
177ns_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) {
204ns_get_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,
LoaderOptions());
212 Textures::const_iterator ti;
213 ti = _textures.find(key);
214 if (ti != _textures.end()) {
229ns_get_texture(
const Filename &orig_filename,
230 const Filename &orig_alpha_filename,
231 int primary_file_num_channels,
232 int alpha_file_channel,
235 key._primary_file_num_channels = primary_file_num_channels;
236 key._alpha_file_channel = alpha_file_channel;
240 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
241 resolve_filename(key._alpha_fullpath, orig_alpha_filename, read_mipmaps, options);
243 Textures::const_iterator ti;
244 ti = _textures.find(key);
245 if (ti != _textures.end()) {
260ns_load_texture(
const Filename &orig_filename,
int primary_file_num_channels,
263 key._primary_file_num_channels = primary_file_num_channels;
266 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
268 Textures::const_iterator ti;
269 ti = _textures.find(key);
270 if (ti != _textures.end()) {
281 bool store_record =
false;
284 tex = pre_load(orig_filename,
Filename(), primary_file_num_channels, 0,
285 read_mipmaps, options);
288 bool compressed_cache_record =
false;
289 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
292 if (tex ==
nullptr) {
296 <<
"Loading texture " << key._fullpath <<
"\n";
298 string ext =
downcase(key._fullpath.get_extension());
299 if (ext ==
"txo" || ext ==
"bam") {
305 key._fullpath.set_binary();
307 if (file ==
nullptr) {
310 <<
"Could not find " << key._fullpath <<
"\n";
314 if (gobj_cat.is_debug()) {
316 <<
"Reading texture object " << key._fullpath <<
"\n";
319 istream *in = file->open_read_file(
true);
320 tex = Texture::make_from_txo(*in, key._fullpath);
323 if (tex ==
nullptr) {
326 tex->set_fullpath(key._fullpath);
327 tex->clear_alpha_fullpath();
328 tex->set_keep_ram_image(
false);
332 tex = ns_make_texture(ext);
333 if (!tex->read(key._fullpath,
Filename(), primary_file_num_channels, 0,
334 0, 0,
false, read_mipmaps, record, options)) {
336 report_texture_unreadable(key._fullpath);
341 if (options.get_texture_flags() & LoaderOptions::TF_preload_simple) {
342 tex->generate_simple_ram_image();
345 store_record = (record !=
nullptr);
350 bool needs_driver_compression =
true;
352 bool needs_driver_compression = driver_compress_textures;
354 if (needs_driver_compression) {
357 store_record =
false;
358 if (!compressed_cache_record) {
359 tex->set_post_load_store_cache(
true);
365 store_record =
false;
369 nassertr(tex !=
nullptr,
nullptr);
370 tex->set_filename(orig_filename);
371 tex->set_fullpath(key._fullpath);
372 tex->_texture_pool_key = key._fullpath;
379 Textures::const_iterator ti;
380 ti = _textures.find(key);
381 if (ti != _textures.end()) {
388 _textures[std::move(key)] = tex;
391 if (store_record && tex->is_cacheable()) {
394 cache->
store(record);
397 if (!(options.get_texture_flags() & LoaderOptions::TF_preload)) {
399 tex->clear_ram_image();
402 nassertr(!tex->get_fullpath().empty(), tex);
405 tex = post_load(tex);
414ns_load_texture(
const Filename &orig_filename,
415 const Filename &orig_alpha_filename,
416 int primary_file_num_channels,
417 int alpha_file_channel,
419 if (!_fake_texture_image.empty()) {
420 return ns_load_texture(_fake_texture_image, primary_file_num_channels,
421 read_mipmaps, options);
425 key._primary_file_num_channels = primary_file_num_channels;
426 key._alpha_file_channel = alpha_file_channel;
429 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
430 resolve_filename(key._alpha_fullpath, orig_alpha_filename, read_mipmaps, options);
432 Textures::const_iterator ti;
433 ti = _textures.find(key);
434 if (ti != _textures.end()) {
444 bool store_record =
false;
447 tex = pre_load(orig_filename, orig_alpha_filename, primary_file_num_channels,
448 alpha_file_channel, read_mipmaps, options);
451 bool compressed_cache_record =
false;
452 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
455 if (tex ==
nullptr) {
459 <<
"Loading texture " << key._fullpath <<
" and alpha component "
460 << key._alpha_fullpath << std::endl;
461 tex = ns_make_texture(key._fullpath.get_extension());
462 if (!tex->read(key._fullpath, key._alpha_fullpath, primary_file_num_channels,
463 alpha_file_channel, 0, 0,
false, read_mipmaps,
nullptr,
466 report_texture_unreadable(key._fullpath);
470 if (options.get_texture_flags() & LoaderOptions::TF_preload_simple) {
471 tex->generate_simple_ram_image();
474 store_record = (record !=
nullptr);
479 bool needs_driver_compression =
true;
481 bool needs_driver_compression = driver_compress_textures;
483 if (needs_driver_compression) {
486 store_record =
false;
487 if (!compressed_cache_record) {
488 tex->set_post_load_store_cache(
true);
494 store_record =
false;
498 nassertr(tex !=
nullptr,
nullptr);
499 tex->set_filename(orig_filename);
500 tex->set_fullpath(key._fullpath);
501 tex->set_alpha_filename(orig_alpha_filename);
502 tex->set_alpha_fullpath(key._alpha_fullpath);
503 tex->_texture_pool_key = key._fullpath;
509 Textures::const_iterator ti;
510 ti = _textures.find(key);
511 if (ti != _textures.end()) {
518 _textures[std::move(key)] = tex;
521 if (store_record && tex->is_cacheable()) {
524 cache->
store(record);
527 if (!(options.get_texture_flags() & LoaderOptions::TF_preload)) {
529 tex->clear_ram_image();
532 nassertr(!tex->get_fullpath().empty(), tex);
535 tex = post_load(tex);
544ns_load_3d_texture(
const Filename &filename_pattern,
546 Filename orig_filename(filename_pattern);
550 key._texture_type = Texture::TT_3d_texture;
553 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
555 Textures::const_iterator ti;
556 ti = _textures.find(key);
557 if (ti != _textures.end()) {
567 bool store_record =
false;
570 bool compressed_cache_record =
false;
571 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
574 if (tex ==
nullptr ||
575 tex->get_texture_type() != Texture::TT_3d_texture) {
579 <<
"Loading 3-d texture " << key._fullpath <<
"\n";
580 tex = ns_make_texture(key._fullpath.get_extension());
581 tex->setup_3d_texture();
582 if (!tex->read(key._fullpath, 0, 0,
true, read_mipmaps, options)) {
584 report_texture_unreadable(key._fullpath);
587 store_record = (record !=
nullptr);
592 bool needs_driver_compression =
true;
594 bool needs_driver_compression = driver_compress_textures;
596 if (needs_driver_compression) {
599 store_record =
false;
600 if (!compressed_cache_record) {
601 tex->set_post_load_store_cache(
true);
607 store_record =
false;
611 nassertr(tex !=
nullptr,
nullptr);
612 tex->set_filename(filename_pattern);
613 tex->set_fullpath(key._fullpath);
614 tex->_texture_pool_key = key._fullpath;
620 Textures::const_iterator ti;
621 ti = _textures.find(key);
622 if (ti != _textures.end()) {
629 _textures[std::move(key)] = tex;
632 if (store_record && tex->is_cacheable()) {
635 cache->
store(record);
638 nassertr(!tex->get_fullpath().empty(), tex);
646ns_load_2d_texture_array(
const Filename &filename_pattern,
648 Filename orig_filename(filename_pattern);
652 key._texture_type = Texture::TT_2d_texture_array;
655 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
657 Textures::const_iterator ti;
658 ti = _textures.find(key);
659 if (ti != _textures.end()) {
669 bool store_record =
false;
672 bool compressed_cache_record =
false;
673 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
676 if (tex ==
nullptr ||
677 tex->get_texture_type() != Texture::TT_2d_texture_array) {
681 <<
"Loading 2-d texture array " << key._fullpath <<
"\n";
682 tex = ns_make_texture(key._fullpath.get_extension());
683 tex->setup_2d_texture_array();
684 if (!tex->read(key._fullpath, 0, 0,
true, read_mipmaps, options)) {
686 report_texture_unreadable(key._fullpath);
689 store_record = (record !=
nullptr);
694 bool needs_driver_compression =
true;
696 bool needs_driver_compression = driver_compress_textures;
698 if (needs_driver_compression) {
701 store_record =
false;
702 if (!compressed_cache_record) {
703 tex->set_post_load_store_cache(
true);
709 store_record =
false;
713 nassertr(tex !=
nullptr,
nullptr);
714 tex->set_filename(filename_pattern);
715 tex->set_fullpath(key._fullpath);
716 tex->_texture_pool_key = key._fullpath;
722 Textures::const_iterator ti;
723 ti = _textures.find(key);
724 if (ti != _textures.end()) {
731 _textures[std::move(key)] = tex;
734 if (store_record && tex->is_cacheable()) {
737 cache->
store(record);
740 nassertr(!tex->get_fullpath().empty(), tex);
748ns_load_cube_map(
const Filename &filename_pattern,
bool read_mipmaps,
750 Filename orig_filename(filename_pattern);
754 key._texture_type = Texture::TT_cube_map;
757 resolve_filename(key._fullpath, orig_filename, read_mipmaps, options);
759 Textures::const_iterator ti;
760 ti = _textures.find(key);
761 if (ti != _textures.end()) {
771 bool store_record =
false;
774 bool compressed_cache_record =
false;
775 try_load_cache(tex, cache, key._fullpath, record, compressed_cache_record,
778 if (tex ==
nullptr ||
779 tex->get_texture_type() != Texture::TT_cube_map) {
783 <<
"Loading cube map texture " << key._fullpath <<
"\n";
784 tex = ns_make_texture(key._fullpath.get_extension());
785 tex->setup_cube_map();
786 if (!tex->read(key._fullpath, 0, 0,
true, read_mipmaps, options)) {
788 report_texture_unreadable(key._fullpath);
791 store_record = (record !=
nullptr);
796 bool needs_driver_compression =
true;
798 bool needs_driver_compression = driver_compress_textures;
800 if (needs_driver_compression) {
803 store_record =
false;
804 if (!compressed_cache_record) {
805 tex->set_post_load_store_cache(
true);
811 store_record =
false;
815 nassertr(tex !=
nullptr,
nullptr);
816 tex->set_filename(filename_pattern);
817 tex->set_fullpath(key._fullpath);
818 tex->_texture_pool_key = key._fullpath;
824 Textures::const_iterator ti;
825 ti = _textures.find(key);
826 if (ti != _textures.end()) {
833 _textures[std::move(key)] = tex;
836 if (store_record && tex->is_cacheable()) {
839 cache->
store(record);
842 nassertr(!tex->get_fullpath().empty(), tex);
850ns_get_normalization_cube_map(
int size) {
853 if (_normalization_cube_map ==
nullptr) {
854 _normalization_cube_map =
new Texture(
"normalization_cube_map");
856 if (_normalization_cube_map->get_x_size() < size ||
857 _normalization_cube_map->get_texture_type() != Texture::TT_cube_map) {
858 _normalization_cube_map->generate_normalization_cube_map(size);
861 return _normalization_cube_map;
868ns_get_alpha_scale_map() {
871 if (_alpha_scale_map ==
nullptr) {
872 _alpha_scale_map =
new Texture(
"alpha_scale_map");
873 _alpha_scale_map->generate_alpha_scale_map();
876 return _alpha_scale_map;
887 if (!tex->_texture_pool_key.empty()) {
888 ns_release_texture(tex);
892 if (tex_cdata->_fullpath.empty()) {
893 gobj_cat.error() <<
"Attempt to call add_texture() on an unnamed texture.\n";
898 key._fullpath = tex_cdata->_fullpath;
899 key._alpha_fullpath = tex_cdata->_alpha_fullpath;
900 key._alpha_file_channel = tex_cdata->_alpha_file_channel;
901 key._texture_type = tex_cdata->_texture_type;
904 tex->_texture_pool_key = key._fullpath;
905 _textures[key] = tex;
912ns_release_texture(
Texture *tex) {
915 Textures::iterator ti;
916 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
917 if (tex == (*ti).second) {
919 tex->_texture_pool_key = string();
925 _relpath_lookup.clear();
932ns_release_all_textures() {
935 Textures::iterator ti;
936 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
938 tex->_texture_pool_key = string();
942 _normalization_cube_map =
nullptr;
945 _relpath_lookup.clear();
952ns_garbage_collect() {
955 int num_released = 0;
958 Textures::iterator ti;
959 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
962 if (gobj_cat.is_debug()) {
964 <<
"Releasing " << (*ti).first._fullpath <<
"\n";
967 tex->_texture_pool_key = string();
969 new_set.insert(new_set.end(), *ti);
973 _textures.swap(new_set);
975 if (_normalization_cube_map !=
nullptr &&
976 _normalization_cube_map->get_ref_count() == 1) {
977 if (gobj_cat.is_debug()) {
979 <<
"Releasing normalization cube map\n";
982 _normalization_cube_map =
nullptr;
992ns_list_contents(ostream &out)
const {
997 Textures::const_iterator ti;
999 out <<
"texture pool contents:\n";
1003 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
1005 out << (*ti).first._fullpath <<
"\n";
1012 nassertv(tex->_texture_pool_key == (*ti).first._fullpath);
1017 out <<
"total number of textures: " << _textures.size() <<
"\n";
1018 out <<
"texture pool ram : " << total_ram_size <<
"\n";
1019 out <<
"texture pool size: " << total_size <<
"\n";
1020 out <<
"texture pool size - texture pool ram: " << total_size - total_ram_size <<
"\n";
1027ns_find_texture(
const string &name)
const {
1031 Textures::const_iterator ti;
1032 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
1034 if (glob.matches(tex->get_name())) {
1046ns_find_all_textures(
const string &name)
const {
1051 Textures::const_iterator ti;
1052 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
1054 if (glob.matches(tex->get_name())) {
1068ns_make_texture(
const string &extension)
const {
1070 if (func !=
nullptr) {
1087 if (!_fake_texture_image.empty()) {
1088 new_filename = _fake_texture_image;
1092 RelpathLookup::iterator rpi = _relpath_lookup.find(orig_filename);
1093 if (rpi != _relpath_lookup.end()) {
1094 new_filename = (*rpi).second;
1098 new_filename = orig_filename;
1099 if (read_mipmaps || (options.get_texture_flags() & LoaderOptions::TF_multiview)) {
1106 _relpath_lookup[orig_filename] = new_filename;
1116 if (tex ==
nullptr) {
1126 PT(
Texture) dummy = ns_make_texture(ext);
1127 dummy->ensure_loader_type(filename);
1130 record = cache->lookup(filename,
"txo");
1131 if (record !=
nullptr) {
1132 if (record->has_data()) {
1141 if (gobj_cat.is_debug()) {
1143 <<
"Not caching uncompressed texture " << *tex <<
"\n";
1154 if (gobj_cat.is_debug()) {
1156 <<
"Cached texture " << *tex <<
" has size "
1158 <<
" instead of " << x_size <<
" x " << y_size
1159 <<
"; dropping cache.\n";
1165 if (gobj_cat.is_debug()) {
1167 <<
"Cached texture " << *tex
1168 <<
" is compressed in cache; dropping cache.\n";
1174 <<
"Texture " << filename <<
" found in disk cache.\n";
1175 if ((options.get_texture_flags() & LoaderOptions::TF_preload_simple) &&
1179 if (!(options.get_texture_flags() & LoaderOptions::TF_preload)) {
1185 if (tex->consider_auto_process_ram_image(tex->
uses_mipmaps(),
true)) {
1187 if (!was_compressed && is_compressed &&
1193 cache->
store(record);
1194 compressed_cache_record =
true;
1205 if (gobj_cat.is_debug()) {
1207 <<
"Not caching uncompressed texture\n";
1221report_texture_unreadable(
const Filename &filename)
const {
1223 bool has_hash = (filename.
get_fullpath().find(
'#') != string::npos);
1224 if (!has_hash && !vfs->
exists(filename)) {
1229 <<
"Unable to find texture \"" << filename <<
"\""
1230 <<
" on model-path " << get_model_path() <<
"\n";
1235 <<
"Texture \"" << filename <<
"\" does not exist.\n";
1242 <<
"Texture \"" << filename <<
"\" exists but cannot be read.\n";
1247 <<
"Texture \"" << filename <<
"\" cannot be read.\n";
1252 if (func ==
nullptr) {
1255 <<
"\" is unknown. Supported texture types:\n";
1267pre_load(
const Filename &orig_filename,
const Filename &orig_alpha_filename,
1268 int primary_file_num_channels,
int alpha_file_channel,
1274 FilterRegistry::iterator fi;
1275 for (fi = _filter_registry.begin();
1276 fi != _filter_registry.end();
1278 tex = (*fi)->pre_load(orig_filename, orig_alpha_filename,
1279 primary_file_num_channels, alpha_file_channel,
1280 read_mipmaps, options);
1281 if (tex !=
nullptr) {
1298 FilterRegistry::iterator fi;
1299 for (fi = _filter_registry.begin();
1300 fi != _filter_registry.end();
1302 result = (*fi)->post_load(result);
1316 PRC_DESC(
"Names one or more external libraries that should be loaded for the "
1317 "purposes of performing texture filtering. This variable may be repeated several "
1318 "times. As in load-display, the actual library filename is derived by "
1319 "prefixing 'lib' to the specified name."));
1321 int num_aux = texture_filter.get_num_unique_values();
1322 for (
int i = 0; i < num_aux; i++) {
1323 string name = texture_filter.get_unique_value(i);
1325 Filename dlname = Filename::dso_filename(
"lib" + name +
".so");
1327 <<
"loading texture filter: " << dlname.
to_os_specific() << std::endl;
1328 void *tmp = load_dso(get_plugin_path().get_value(), dlname);
1329 if (tmp ==
nullptr) {
1331 <<
"Unable to load: " << load_dso_error() << std::endl;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
get_data
Returns a pointer to the data stored in the record, or NULL if there is no data.
set_data
Stores a new data object on the record.
This class maintains a cache of Bam and/or Txo objects generated from model files and texture images ...
get_cache_textures
Returns whether texture files (e.g.
bool store(BamCacheRecord *record)
Flushes a cache entry to disk.
static BamCache * get_global_ptr()
Returns a pointer to the global BamCache object, which is used automatically by the ModelPool and Tex...
get_cache_compressed_textures
Returns whether compressed texture files will be stored in the cache, as compressed txo files.
This is a convenience class to specialize ConfigVariable as a Filename type.
This class is similar to ConfigVariable, but it reports its value as a list of strings.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
The name of a file, such as a texture file or an Egg file.
std::string get_basename() const
Returns the basename part of the filename.
std::string to_os_specific() const
Converts the filename from our generic Unix-like convention (forward slashes starting with the root a...
std::string get_fullpath() const
Returns the entire filename: directory, basename, extension.
std::string get_extension() const
Returns the file extension.
bool is_local() const
Returns true if the filename is local, e.g.
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...
Specifies parameters that may be passed to the loader.
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
This class maintains the set of all known PNMFileTypes in the universe.
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
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.
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...
This is the base class of a family of classes that represent particular image file types that PNMImag...
get_ref_count
Returns the current reference count.
Manages a list of Texture objects, as returned by TexturePool::find_all_textures().
void add_texture(Texture *texture)
Adds a new Texture to the collection.
This is an abstract base class, a placeholder for any number of different classes that may wish to im...
This is the preferred interface for loading textures from image files.
static TexturePool * get_global_ptr()
Initializes and/or returns the global pointer to the one TexturePool object in the system.
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...
void register_filter(TexturePoolFilter *filter)
Records a TexturePoolFilter object that may operate on texture images as they are loaded from disk.
void write_texture_types(std::ostream &out, int indent_level) const
Outputs a list of the available texture types to the indicated output stream.
static static PT(Texture) make_texture(const std void write(std::ostream &out)
Lists the contents of the texture pool 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...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
get_ram_image_size
Returns the total number of bytes used by the in-memory image, across all pages and views,...
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...
get_ram_image_compression
Returns the compression mode in which the ram image is already stored pre- compressed.
bool has_compression() const
Returns true if the texture indicates it wants to be compressed, either with CM_on or higher,...
get_y_size
Returns the height of the texture image in texels.
void clear_ram_image()
Discards the current system-RAM image.
bool uses_mipmaps() const
Returns true if the minfilter settings on this texture indicate the use of mipmapping,...
get_fullpath
Returns the fullpath that has been set.
has_simple_ram_image
Returns true if the Texture has a "simple" image available in main RAM.
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...
get_x_size
Returns the width of the texture image in texels.
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.
void generate_simple_ram_image()
Computes the "simple" ram image by loading the main RAM image, if it is not already available,...
set_keep_ram_image
Sets the flag that indicates whether this Texture is eligible to have its main RAM copy of the textur...
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...
A hierarchy of directories and files that appears to be one continuous file system,...
bool exists(const Filename &filename) const
Convenience function; returns true if the named file exists in the virtual file system hierarchy.
bool resolve_filename(Filename &filename, const DSearchPath &searchpath, const std::string &default_extension=std::string()) const
Searches the given search path for the filename.
static void close_read_file(std::istream *stream)
Closes a file opened by a previous call to open_read_file().
PointerTo< VirtualFile > get_file(const Filename &filename, bool status_only=false) const
Looks up the file by the indicated name in the file system.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
The abstract base class for a file or directory within the VirtualFileSystem.
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.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int extract_words(const string &str, vector_string &words)
Divides the string into a number of words according to whitespace.
string downcase(const string &s)
Returns the input string with all uppercase letters converted to lowercase.
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.