Add a version of list_contents that does not take any parameters so it can be used in Python.
Output more information in list_contents and reformat output.
This commit is contained in:
parent
41d23c0e92
commit
335d5a8ade
|
|
@ -59,9 +59,9 @@ verify_texture(const string &filename) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Texture *TexturePool::
|
||||
load_texture(const string &filename, int primary_file_num_channels,
|
||||
bool read_mipmaps) {
|
||||
bool read_mipmaps) {
|
||||
return get_global_ptr()->ns_load_texture(filename, primary_file_num_channels,
|
||||
read_mipmaps);
|
||||
read_mipmaps);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -82,11 +82,11 @@ load_texture(const string &filename, int primary_file_num_channels,
|
|||
INLINE Texture *TexturePool::
|
||||
load_texture(const string &filename, const string &alpha_filename,
|
||||
int primary_file_num_channels, int alpha_file_channel,
|
||||
bool read_mipmaps) {
|
||||
bool read_mipmaps) {
|
||||
return get_global_ptr()->ns_load_texture(filename, alpha_filename,
|
||||
primary_file_num_channels,
|
||||
alpha_file_channel,
|
||||
read_mipmaps);
|
||||
primary_file_num_channels,
|
||||
alpha_file_channel,
|
||||
read_mipmaps);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -226,6 +226,16 @@ list_contents(ostream &out) {
|
|||
get_global_ptr()->ns_list_contents(out);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: TexturePool::list_contents
|
||||
// Access: Published, Static
|
||||
// Description: Lists the contents of the texture pool to cout
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void TexturePool::
|
||||
list_contents() {
|
||||
get_global_ptr()->ns_list_contents(cout);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: TexturePool::set_fake_texture_image
|
||||
// Access: Published, Static
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ ns_has_texture(const Filename &orig_filename) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
Texture *TexturePool::
|
||||
ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
|
||||
bool read_mipmaps) {
|
||||
bool read_mipmaps) {
|
||||
Filename filename(orig_filename);
|
||||
|
||||
if (!_fake_texture_image.empty()) {
|
||||
|
|
@ -349,13 +349,13 @@ ns_load_texture(const Filename &orig_filename,
|
|||
const Filename &orig_alpha_filename,
|
||||
int primary_file_num_channels,
|
||||
int alpha_file_channel,
|
||||
bool read_mipmaps) {
|
||||
bool read_mipmaps) {
|
||||
Filename filename(orig_filename);
|
||||
Filename alpha_filename(orig_alpha_filename);
|
||||
|
||||
if (!_fake_texture_image.empty()) {
|
||||
return ns_load_texture(_fake_texture_image, primary_file_num_channels,
|
||||
read_mipmaps);
|
||||
read_mipmaps);
|
||||
}
|
||||
|
||||
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||
|
|
@ -465,7 +465,7 @@ ns_load_texture(const Filename &orig_filename,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
Texture *TexturePool::
|
||||
ns_load_3d_texture(const Filename &filename_pattern,
|
||||
bool read_mipmaps) {
|
||||
bool read_mipmaps) {
|
||||
Filename filename(filename_pattern);
|
||||
filename.set_pattern(true);
|
||||
|
||||
|
|
@ -787,15 +787,26 @@ void TexturePool::
|
|||
ns_list_contents(ostream &out) const {
|
||||
MutexHolder holder(_lock);
|
||||
|
||||
out << _textures.size() << " textures:\n";
|
||||
out << "texture pool contents:\n";
|
||||
|
||||
int total_size;
|
||||
|
||||
total_size = 0;
|
||||
Textures::const_iterator ti;
|
||||
for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
|
||||
Texture *tex = (*ti).second;
|
||||
out << " " << (*ti).first
|
||||
<< " (count = " << tex->get_ref_count() << ", ram = "
|
||||
<< tex->get_ram_image_size() / 1024 << " Kb)\n";
|
||||
out << (*ti).first << "\n";
|
||||
out << " (count = " << tex->get_ref_count()
|
||||
<< ", ram = " << tex->get_ram_image_size()
|
||||
<< ", w = " << tex->get_x_size()
|
||||
<< ", h = " << tex->get_y_size()
|
||||
<< ")\n";
|
||||
nassertv(tex->_texture_pool_key == (*ti).first);
|
||||
total_size += tex->get_ram_image_size();
|
||||
}
|
||||
|
||||
out << "total number of textures: " << _textures.size() << "\n";
|
||||
out << "texture pool size: " << total_size << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -45,16 +45,16 @@ PUBLISHED:
|
|||
INLINE static bool verify_texture(const string &filename);
|
||||
INLINE static Texture *load_texture(const string &filename,
|
||||
int primary_file_num_channels = 0,
|
||||
bool read_mipmaps = false);
|
||||
bool read_mipmaps = false);
|
||||
INLINE static Texture *load_texture(const string &filename,
|
||||
const string &alpha_filename,
|
||||
int primary_file_num_channels = 0,
|
||||
int alpha_file_channel = 0,
|
||||
bool read_mipmaps = false);
|
||||
bool read_mipmaps = false);
|
||||
INLINE static Texture *load_3d_texture(const string &filename_pattern,
|
||||
bool read_mipmaps = false);
|
||||
bool read_mipmaps = false);
|
||||
INLINE static Texture *load_cube_map(const string &filename_pattern,
|
||||
bool read_mipmaps = false);
|
||||
bool read_mipmaps = false);
|
||||
|
||||
INLINE static Texture *get_normalization_cube_map(int size);
|
||||
INLINE static Texture *get_alpha_scale_map();
|
||||
|
|
@ -66,6 +66,7 @@ PUBLISHED:
|
|||
INLINE static int garbage_collect();
|
||||
|
||||
INLINE static void list_contents(ostream &out);
|
||||
INLINE static void list_contents();
|
||||
|
||||
INLINE static void set_fake_texture_image(const string &filename);
|
||||
INLINE static void clear_fake_texture_image();
|
||||
|
|
@ -90,17 +91,17 @@ private:
|
|||
|
||||
bool ns_has_texture(const Filename &orig_filename);
|
||||
Texture *ns_load_texture(const Filename &orig_filename,
|
||||
int primary_file_num_channels,
|
||||
bool read_mipmaps);
|
||||
int primary_file_num_channels,
|
||||
bool read_mipmaps);
|
||||
Texture *ns_load_texture(const Filename &orig_filename,
|
||||
const Filename &orig_alpha_filename,
|
||||
int primary_file_num_channels,
|
||||
int alpha_file_channel,
|
||||
bool read_mipmaps);
|
||||
bool read_mipmaps);
|
||||
Texture *ns_load_3d_texture(const Filename &filename_pattern,
|
||||
bool read_mipmaps);
|
||||
bool read_mipmaps);
|
||||
Texture *ns_load_cube_map(const Filename &filename_pattern,
|
||||
bool read_mipmaps);
|
||||
bool read_mipmaps);
|
||||
Texture *ns_get_normalization_cube_map(int size);
|
||||
Texture *ns_get_alpha_scale_map();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue