mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
fix mipmap stale bug
This commit is contained in:
parent
90b87753ea
commit
c343dece60
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user