display: don't apply color-scale-via-lighting to shader inputs

This isn't working properly at the moment, since the state gets set for the *next* object, causing significant artifacts.  I wasn't entirely sure whether to restore the "proper" behavior or not, since applications may be relying on one or the other behavior, but enabling this feature for shaders is a minefield and it's a lot better to just tell people to use p3d_ColorScale instead.
This commit is contained in:
rdb 2019-03-26 23:10:19 +01:00
parent b0a5cceafd
commit 364d5d82fe

View File

@ -1433,12 +1433,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
// Apply the default OpenGL lights otherwise. // Apply the default OpenGL lights otherwise.
// Special exception for light 0, which defaults to white. // Special exception for light 0, which defaults to white.
string basename = name->get_basename(); string basename = name->get_basename();
if (basename == "color" || basename == "diffuse") { return &LMatrix4::ones_mat();
t.set_row(3, _light_color_scale);
return &t;
} else if (basename == "specular") {
return &LMatrix4::ones_mat();
}
} }
return fetch_specified_member(NodePath(), name, t); return fetch_specified_member(NodePath(), name, t);
} }
@ -1551,7 +1546,6 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
nassertr(light != nullptr, &LMatrix4::ident_mat()); nassertr(light != nullptr, &LMatrix4::ident_mat());
if (node->is_ambient_light()) { if (node->is_ambient_light()) {
LColor c = light->get_color(); LColor c = light->get_color();
c.componentwise_mult(_light_color_scale);
t.set_row(3, c); t.set_row(3, c);
} else { } else {
// Non-ambient lights don't currently have an ambient color in Panda3D. // Non-ambient lights don't currently have an ambient color in Panda3D.
@ -1570,7 +1564,6 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
t.set_row(3, LColor(0.0f, 0.0f, 0.0f, 1.0f)); t.set_row(3, LColor(0.0f, 0.0f, 0.0f, 1.0f));
} else { } else {
LColor c = light->get_color(); LColor c = light->get_color();
c.componentwise_mult(_light_color_scale);
t.set_row(3, c); t.set_row(3, c);
} }
return &t; return &t;