mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
resolve confusion with tex_gen and tex_mat interrelations
This commit is contained in:
parent
53f446569e
commit
3b8c754898
@ -611,6 +611,7 @@ reset() {
|
|||||||
_needs_tex_mat = false;
|
_needs_tex_mat = false;
|
||||||
_current_tex_gen = DCAST(TexGenAttrib, TexGenAttrib::make());
|
_current_tex_gen = DCAST(TexGenAttrib, TexGenAttrib::make());
|
||||||
_needs_tex_gen = false;
|
_needs_tex_gen = false;
|
||||||
|
_tex_gen_modifies_mat = false;
|
||||||
_auto_antialias_mode = false;
|
_auto_antialias_mode = false;
|
||||||
_render_mode = RenderModeAttrib::M_filled;
|
_render_mode = RenderModeAttrib::M_filled;
|
||||||
|
|
||||||
@ -4597,8 +4598,17 @@ finish_modify_state() {
|
|||||||
do_issue_texture();
|
do_issue_texture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If one of the previously-loaded TexGen modes modified the texture
|
||||||
|
// matrix, then if either state changed, we have to change both of
|
||||||
|
// them now.
|
||||||
|
if (_tex_gen_modifies_mat &&
|
||||||
|
(_needs_tex_mat || _needs_tex_gen)) {
|
||||||
|
_needs_tex_mat = true;
|
||||||
|
_needs_tex_gen = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Apply the texture matrix, if needed.
|
// Apply the texture matrix, if needed.
|
||||||
if (_needs_tex_mat || _needs_tex_gen) {
|
if (_needs_tex_mat) {
|
||||||
_needs_tex_mat = false;
|
_needs_tex_mat = false;
|
||||||
|
|
||||||
int num_stages = _current_texture->get_num_on_stages();
|
int num_stages = _current_texture->get_num_on_stages();
|
||||||
@ -4643,6 +4653,8 @@ finish_modify_state() {
|
|||||||
static const float r_data[4] = { 0, 0, 1, 0 };
|
static const float r_data[4] = { 0, 0, 1, 0 };
|
||||||
static const float q_data[4] = { 0, 0, 0, 1 };
|
static const float q_data[4] = { 0, 0, 0, 1 };
|
||||||
|
|
||||||
|
_tex_gen_modifies_mat = false;
|
||||||
|
|
||||||
for (int i = 0; i < num_stages; i++) {
|
for (int i = 0; i < num_stages; i++) {
|
||||||
TextureStage *stage = _current_texture->get_on_stage(i);
|
TextureStage *stage = _current_texture->get_on_stage(i);
|
||||||
_glActiveTexture(GL_TEXTURE0 + i);
|
_glActiveTexture(GL_TEXTURE0 + i);
|
||||||
@ -4685,7 +4697,7 @@ finish_modify_state() {
|
|||||||
|
|
||||||
// Now we need to reset the texture matrix next time
|
// Now we need to reset the texture matrix next time
|
||||||
// around to undo this.
|
// around to undo this.
|
||||||
_needs_tex_mat = true;
|
_tex_gen_modifies_mat = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLP(TexGeni)(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
|
GLP(TexGeni)(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
|
||||||
@ -4723,7 +4735,7 @@ finish_modify_state() {
|
|||||||
|
|
||||||
// Now we need to reset the texture matrix next time
|
// Now we need to reset the texture matrix next time
|
||||||
// around to undo this.
|
// around to undo this.
|
||||||
_needs_tex_mat = true;
|
_tex_gen_modifies_mat = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLP(TexGeni)(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP);
|
GLP(TexGeni)(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP);
|
||||||
|
@ -276,6 +276,7 @@ protected:
|
|||||||
bool _needs_tex_mat;
|
bool _needs_tex_mat;
|
||||||
CPT(TexGenAttrib) _current_tex_gen;
|
CPT(TexGenAttrib) _current_tex_gen;
|
||||||
bool _needs_tex_gen;
|
bool _needs_tex_gen;
|
||||||
|
bool _tex_gen_modifies_mat;
|
||||||
bool _auto_antialias_mode;
|
bool _auto_antialias_mode;
|
||||||
RenderModeAttrib::Mode _render_mode;
|
RenderModeAttrib::Mode _render_mode;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user