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::
|
bool EggTexture::
|
||||||
is_equivalent_to(const EggTexture &other, int eq) const {
|
is_equivalent_to(const EggTexture &other, int eq) const {
|
||||||
if ((eq & E_complete_filename) == E_complete_filename) {
|
if ((eq & E_complete_filename) == E_complete_filename) {
|
||||||
|
//cout << "compared by filename" << endl;
|
||||||
if (get_filename() != other.get_filename()) {
|
if (get_filename() != other.get_filename()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//cout << "compared by not complete filename" << endl;
|
||||||
const Filename &a = get_filename();
|
const Filename &a = get_filename();
|
||||||
const Filename &b = other.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) {
|
if (eq & E_transform) {
|
||||||
|
//cout << "compared by transform" << endl;
|
||||||
if (transform_is_identity() != other.transform_is_identity()) {
|
if (transform_is_identity() != other.transform_is_identity()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -321,6 +324,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (eq & E_attributes) {
|
if (eq & E_attributes) {
|
||||||
|
//cout << "compared by attributes" << endl;
|
||||||
if (_format != other._format ||
|
if (_format != other._format ||
|
||||||
_wrap_mode != other._wrap_mode ||
|
_wrap_mode != other._wrap_mode ||
|
||||||
_wrap_u != other._wrap_u ||
|
_wrap_u != other._wrap_u ||
|
||||||
@ -336,6 +340,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (eq & E_tref_name) {
|
if (eq & E_tref_name) {
|
||||||
|
//cout << "compared by tref_name" << endl;
|
||||||
if (get_name() != other.get_name()) {
|
if (get_name() != other.get_name()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -496,10 +496,11 @@ create_unique_texture(const EggTexture ©, int eq) {
|
|||||||
++oti) {
|
++oti) {
|
||||||
EggTexture *tex = (*oti);
|
EggTexture *tex = (*oti);
|
||||||
if (copy.is_equivalent_to(*tex, eq)) {
|
if (copy.is_equivalent_to(*tex, eq)) {
|
||||||
|
//cout << "tex:" << tex->get_name() << "---copy:" << copy.get_name() << endl;
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//cout << "adding a texture to collection: " << copy.get_name() << endl;
|
||||||
EggTexture *new_texture = new EggTexture(copy);
|
EggTexture *new_texture = new EggTexture(copy);
|
||||||
add_texture(new_texture);
|
add_texture(new_texture);
|
||||||
return new_texture;
|
return new_texture;
|
||||||
|
@ -735,12 +735,6 @@ load_textures() {
|
|||||||
EggTextureCollection tc;
|
EggTextureCollection tc;
|
||||||
tc.find_used_textures(&_data);
|
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;
|
EggTextureCollection::iterator ti;
|
||||||
for (ti = tc.begin(); ti != tc.end(); ++ti) {
|
for (ti = tc.begin(); ti != tc.end(); ++ti) {
|
||||||
PT_EggTexture egg_tex = (*ti);
|
PT_EggTexture egg_tex = (*ti);
|
||||||
@ -752,18 +746,6 @@ load_textures() {
|
|||||||
_textures[egg_tex] = def;
|
_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