mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
forgot some egg texture check in
This commit is contained in:
parent
e555739d63
commit
3b59b1d592
@ -284,10 +284,12 @@ write(ostream &out, int indent_level) const {
|
||||
bool EggTexture::
|
||||
is_equivalent_to(const EggTexture &other, int eq) const {
|
||||
if ((eq & E_complete_filename) == E_complete_filename) {
|
||||
//cout << "compared by filename" << endl;
|
||||
if (get_filename() != other.get_filename()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
//cout << "compared by not complete filename" << endl;
|
||||
const Filename &a = get_filename();
|
||||
const Filename &b = other.get_filename();
|
||||
|
||||
@ -309,6 +311,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
|
||||
}
|
||||
|
||||
if (eq & E_transform) {
|
||||
//cout << "compared by transform" << endl;
|
||||
if (transform_is_identity() != other.transform_is_identity()) {
|
||||
return false;
|
||||
}
|
||||
@ -321,6 +324,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
|
||||
}
|
||||
|
||||
if (eq & E_attributes) {
|
||||
//cout << "compared by attributes" << endl;
|
||||
if (_format != other._format ||
|
||||
_wrap_mode != other._wrap_mode ||
|
||||
_wrap_u != other._wrap_u ||
|
||||
@ -336,6 +340,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
|
||||
}
|
||||
|
||||
if (eq & E_tref_name) {
|
||||
//cout << "compared by tref_name" << endl;
|
||||
if (get_name() != other.get_name()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -496,10 +496,11 @@ create_unique_texture(const EggTexture ©, int eq) {
|
||||
++oti) {
|
||||
EggTexture *tex = (*oti);
|
||||
if (copy.is_equivalent_to(*tex, eq)) {
|
||||
//cout << "tex:" << tex->get_name() << "---copy:" << copy.get_name() << endl;
|
||||
return tex;
|
||||
}
|
||||
}
|
||||
|
||||
//cout << "adding a texture to collection: " << copy.get_name() << endl;
|
||||
EggTexture *new_texture = new EggTexture(copy);
|
||||
add_texture(new_texture);
|
||||
return new_texture;
|
||||
|
@ -735,12 +735,6 @@ load_textures() {
|
||||
EggTextureCollection tc;
|
||||
tc.find_used_textures(&_data);
|
||||
|
||||
// Collapse the textures down by filename only. Should we also
|
||||
// differentiate by attributes? Maybe.
|
||||
EggTextureCollection::TextureReplacement replace;
|
||||
tc.collapse_equivalent_textures(EggTexture::E_complete_filename,
|
||||
replace);
|
||||
|
||||
EggTextureCollection::iterator ti;
|
||||
for (ti = tc.begin(); ti != tc.end(); ++ti) {
|
||||
PT_EggTexture egg_tex = (*ti);
|
||||
@ -752,18 +746,6 @@ load_textures() {
|
||||
_textures[egg_tex] = def;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, associate all of the removed texture references back to
|
||||
// the same pointers as the others.
|
||||
EggTextureCollection::TextureReplacement::const_iterator ri;
|
||||
for (ri = replace.begin(); ri != replace.end(); ++ri) {
|
||||
PT_EggTexture orig = (*ri).first;
|
||||
PT_EggTexture repl = (*ri).second;
|
||||
|
||||
TextureDef &def = _textures[orig];
|
||||
def = _textures[repl];
|
||||
def._egg_tex = orig;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user