fix mipmap stale bug

This commit is contained in:
David Rose 2001-06-15 19:02:03 +00:00
parent 90b87753ea
commit c343dece60
5 changed files with 50 additions and 0 deletions

View File

@ -552,6 +552,13 @@ run() {
state_file.close();
pal = DCAST(Palettizer, obj);
if (pal->_read_pi_version > pal->_pi_version) {
nout << FilenameUnifier::make_user_filename(state_filename)
<< " was written by a more recent version of egg-palettize "
<< "than this one. You will need to update your egg-palettize.\n";
exit(1);
}
}
if (_report_pi) {

View File

@ -228,6 +228,23 @@ force_replace() {
}
}
////////////////////////////////////////////////////////////////////
// Function: TextureImage::mark_eggs_stale
// Access: Public
// Description: Marks all the egg files that reference this texture
// stale. Should be called only when the texture
// properties change in some catastrophic way that will
// required every egg file referencing it to be
// regenerated, even if it is not palettized.
////////////////////////////////////////////////////////////////////
void TextureImage::
mark_eggs_stale() {
Placement::iterator pi;
for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
(*pi).second->mark_eggs_stale();
}
}
////////////////////////////////////////////////////////////////////
// Function: TextureImage::pre_txa_file
// Access: Public
@ -323,6 +340,15 @@ post_txa_file() {
// session, we need to re-place ourself in all palette groups.
if (_properties != _pre_txa_properties) {
force_replace();
// The above will mark the egg files stale when the texture is
// palettized (since the UV's will certainly need to be
// recomputed), but sometimes we need to mark the egg files stale
// even when the texture is not palettized (if a critical property
// has changed). The following accomplishes this:
if (!_properties.egg_properties_match(_pre_txa_properties)) {
mark_eggs_stale();
}
}
}

View File

@ -61,6 +61,7 @@ public:
const PaletteGroups &get_groups() const;
TexturePlacement *get_placement(PaletteGroup *group) const;
void force_replace();
void mark_eggs_stale();
void pre_txa_file();
void post_txa_file();

View File

@ -308,6 +308,21 @@ update_egg_tex(EggTexture *egg_tex) const {
egg_tex->set_magfilter(_minfilter);
}
////////////////////////////////////////////////////////////////////
// Function: TextureProperties::egg_properties_match
// Access: Public
// Description: Returns true if all of the properties that are
// reflected directly in an egg file match between this
// TextureProperties object and the other, or false if
// any of them differ.
////////////////////////////////////////////////////////////////////
bool TextureProperties::
egg_properties_match(const TextureProperties &other) const {
return (_format == other._format &&
_minfilter == other._minfilter &&
_magfilter == other._magfilter);
}
////////////////////////////////////////////////////////////////////
// Function: TextureProperties::Ordering Operator
// Access: Public

View File

@ -49,6 +49,7 @@ public:
void fully_define();
void update_egg_tex(EggTexture *egg_tex) const;
bool egg_properties_match(const TextureProperties &other) const;
bool operator < (const TextureProperties &other) const;
bool operator == (const TextureProperties &other) const;