*** empty log message ***

This commit is contained in:
Mike Goslin 2000-11-18 00:25:00 +00:00
parent 3403c3b88d
commit c01eac1ecc
7 changed files with 76 additions and 18 deletions

View File

@ -104,10 +104,12 @@ request_decompress(const Filename &source_file, const string &event_name) {
string extension = source_file.get_extension();
if (extension == "pz")
dest_file = source_file.get_fullpath_wo_extension();
else
downloader_cat.debug()
<< "Decompressor::request_decompress() - Unknown file extension: ."
<< extension << endl;
else {
if (downloader_cat.is_debug())
downloader_cat.debug()
<< "Decompressor::request_decompress() - Unknown file extension: ."
<< extension << endl;
}
return request_decompress(source_file, dest_file, event_name);
}
@ -229,9 +231,10 @@ decompress(Filename &source_file) {
if (extension == "pz")
dest_file = source_file.get_fullpath_wo_extension();
else {
downloader_cat.debug()
<< "Decompressor::request_decompress() - Unknown file extension: ."
<< extension << endl;
if (downloader_cat.is_debug())
downloader_cat.debug()
<< "Decompressor::request_decompress() - Unknown file extension: ."
<< extension << endl;
return false;
}
return decompress(source_file, dest_file);

View File

@ -753,6 +753,10 @@ write_to_disk(DownloadStatus &status) {
_buffer_lock.lock();
#endif
if (downloader_cat.is_debug())
downloader_cat.debug()
<< "Downloader::write_to_buffer() - resizing buffer to: "
<< _new_buffer_size << endl;
_buffer.clear();
_buffer = new Buffer(_new_buffer_size);
_buffer_size = _new_buffer_size;

View File

@ -106,13 +106,11 @@ bool Texture::read(const string &name, const string &gray) {
return false;
}
int new_xsize, new_ysize;
int new_gxsize, new_gysize;
if (max_texture_dimension > 0 &&
(pnmimage.get_x_size() > max_texture_dimension ||
pnmimage.get_y_size() > max_texture_dimension)) {
new_xsize = min(pnmimage.get_x_size(), max_texture_dimension);
new_ysize = min(pnmimage.get_y_size(), max_texture_dimension);
int new_xsize = min(pnmimage.get_x_size(), max_texture_dimension);
int new_ysize = min(pnmimage.get_y_size(), max_texture_dimension);
gobj_cat.info()
<< "Automatically rescaling " << name << " from "
<< pnmimage.get_x_size() << " by " << pnmimage.get_y_size() << " to "
@ -128,8 +126,8 @@ bool Texture::read(const string &name, const string &gray) {
if (max_texture_dimension > 0 &&
(grayimage.get_x_size() > max_texture_dimension ||
grayimage.get_y_size() > max_texture_dimension)) {
new_gxsize = min(grayimage.get_x_size(), max_texture_dimension);
new_gysize = min(grayimage.get_y_size(), max_texture_dimension);
int new_xsize = min(grayimage.get_x_size(), max_texture_dimension);
int new_ysize = min(grayimage.get_y_size(), max_texture_dimension);
gobj_cat.info()
<< "Automatically rescaling " << gray << " from "
<< grayimage.get_x_size() << " by " << grayimage.get_y_size() << " to "
@ -142,17 +140,22 @@ bool Texture::read(const string &name, const string &gray) {
}
// Make sure the 2 images are the same size
if ((new_xsize != new_gxsize) || (new_ysize != new_gysize)) {
int xsize = pnmimage.get_x_size();
int ysize = pnmimage.get_y_size();
int gxsize = grayimage.get_x_size();
int gysize = grayimage.get_y_size();
if ((xsize != gxsize) || (ysize != gysize)) {
gobj_cat.error()
<< "Texture::read() - grayscale image not the same size as original"
<< endl;
<< "Texture::read() - grayscale image not the same size as original - "
<< "orig = " << xsize << "x" << ysize << " - gray = " << gxsize
<< "x" << gysize << endl;
return false;
}
// Make the original image a 4-component image
pnmimage.add_alpha();
for (int x = 0; x < new_xsize; x++) {
for (int y = 0; y < new_ysize; y++) {
for (int x = 0; x < xsize; x++) {
for (int y = 0; y < ysize; y++) {
pnmimage.set_alpha(x, y, grayimage.get_gray(x, y));
}
}

View File

@ -43,6 +43,20 @@ load_texture(const string &filename) {
return get_ptr()->ns_load_texture(filename);
}
////////////////////////////////////////////////////////////////////
// Function: TexturePool::load_texture
// Access: Public, Static
// Description: Loads the given filename up into a texture, if it has
// not already been loaded, and returns the new texture.
// If a texture with the same filename was previously
// loaded, returns that one instead. If the texture
// file cannot be found, returns NULL.
////////////////////////////////////////////////////////////////////
INLINE Texture *TexturePool::
load_texture(const string &filename, const string &grayfilename) {
return get_ptr()->ns_load_texture(filename, grayfilename);
}
////////////////////////////////////////////////////////////////////
// Function: TexturePool::add_texture
// Access: Public, Static

View File

@ -61,6 +61,37 @@ ns_load_texture(Filename filename) {
return tex;
}
////////////////////////////////////////////////////////////////////
// Function: TexturePool::ns_load_texture
// Access: Private
// Description: The nonstatic implementation of load_texture().
////////////////////////////////////////////////////////////////////
Texture *TexturePool::
ns_load_texture(Filename filename, Filename grayfilename) {
filename.resolve_filename(get_texture_path());
filename.resolve_filename(get_model_path());
Textures::const_iterator ti;
ti = _textures.find(filename);
if (ti != _textures.end()) {
// This texture was previously loaded.
return (*ti).second;
}
gobj_cat.info()
<< "Loading texture " << filename << " and grayscale texture "
<< grayfilename << endl;
PT(Texture) tex = new Texture;
if (!tex->read(filename, grayfilename)) {
// This texture was not found.
gobj_cat.error() << "Unable to read texture " << filename << "\n";
return NULL;
}
_textures[filename] = tex;
return tex;
}
////////////////////////////////////////////////////////////////////
// Function: TexturePool::ns_add_texture
// Access: Private

View File

@ -30,6 +30,8 @@ PUBLISHED:
INLINE static bool has_texture(const string &filename);
INLINE static bool verify_texture(const string &filename);
INLINE static Texture *load_texture(const string &filename);
INLINE static Texture *load_texture(const string &filename,
const string &grayfilename);
INLINE static void add_texture(Texture *texture);
INLINE static void release_texture(Texture *texture);
INLINE static void release_all_textures();
@ -39,6 +41,7 @@ private:
bool ns_has_texture(Filename filename);
Texture *ns_load_texture(Filename filename);
Texture *ns_load_texture(Filename filename, Filename grayfilename);
void ns_add_texture(Texture *texture);
void ns_release_texture(Texture *texture);
void ns_release_all_textures();

Binary file not shown.