|
@@ -1568,6 +1568,12 @@ do_issue_color() {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void GraphicsStateGuardian::
|
|
void GraphicsStateGuardian::
|
|
|
do_issue_color_scale() {
|
|
do_issue_color_scale() {
|
|
|
|
|
+ // If the previous color scale had set a special texture, clear the
|
|
|
|
|
+ // texture now.
|
|
|
|
|
+ if (_has_texture_alpha_scale) {
|
|
|
|
|
+ _state._texture = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const ColorScaleAttrib *attrib = _target._color_scale;
|
|
const ColorScaleAttrib *attrib = _target._color_scale;
|
|
|
_color_scale_enabled = attrib->has_scale();
|
|
_color_scale_enabled = attrib->has_scale();
|
|
|
_current_color_scale = attrib->get_scale();
|
|
_current_color_scale = attrib->get_scale();
|
|
@@ -1588,8 +1594,11 @@ do_issue_color_scale() {
|
|
|
|
|
|
|
|
determine_light_color_scale();
|
|
determine_light_color_scale();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (_alpha_scale_via_texture && !_has_scene_graph_color &&
|
|
if (_alpha_scale_via_texture && !_has_scene_graph_color &&
|
|
|
attrib->has_alpha_scale()) {
|
|
attrib->has_alpha_scale()) {
|
|
|
|
|
+ // This color scale will set a special texture--so again, clear
|
|
|
|
|
+ // the texture.
|
|
|
_state._texture = 0;
|
|
_state._texture = 0;
|
|
|
_state._tex_matrix = 0;
|
|
_state._tex_matrix = 0;
|
|
|
|
|
|
|
@@ -1933,13 +1942,15 @@ end_bind_clip_planes() {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void GraphicsStateGuardian::
|
|
void GraphicsStateGuardian::
|
|
|
determine_effective_texture() {
|
|
determine_effective_texture() {
|
|
|
|
|
+ nassertv(_target._texture != (TextureAttrib *)NULL &&
|
|
|
|
|
+ _target._tex_gen != (TexGenAttrib *)NULL);
|
|
|
_effective_texture = _target._texture->filter_to_max(_max_texture_stages);
|
|
_effective_texture = _target._texture->filter_to_max(_max_texture_stages);
|
|
|
_effective_tex_gen = _target._tex_gen;
|
|
_effective_tex_gen = _target._tex_gen;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (_has_texture_alpha_scale) {
|
|
if (_has_texture_alpha_scale) {
|
|
|
PT(TextureStage) stage = get_alpha_scale_texture_stage();
|
|
PT(TextureStage) stage = get_alpha_scale_texture_stage();
|
|
|
PT(Texture) texture = TexturePool::get_alpha_scale_map();
|
|
PT(Texture) texture = TexturePool::get_alpha_scale_map();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
_effective_texture = DCAST(TextureAttrib, _effective_texture->add_on_stage(stage, texture));
|
|
_effective_texture = DCAST(TextureAttrib, _effective_texture->add_on_stage(stage, texture));
|
|
|
_effective_tex_gen = DCAST(TexGenAttrib, _effective_tex_gen->add_stage
|
|
_effective_tex_gen = DCAST(TexGenAttrib, _effective_tex_gen->add_stage
|
|
|
(stage, TexGenAttrib::M_constant, TexCoord3f(_current_color_scale[3], 0.0f, 0.0f)));
|
|
(stage, TexGenAttrib::M_constant, TexCoord3f(_current_color_scale[3], 0.0f, 0.0f)));
|