mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Fix shader generator bug when no diffuse defined
This commit is contained in:
parent
ee0c4dee8f
commit
ef44e25157
@ -645,7 +645,7 @@ synthesize_shader(const RenderState *rs) {
|
||||
text << "\t lcolor = alight_alight" << i << ";\n";
|
||||
if (_separate_ambient_diffuse && _have_ambient) {
|
||||
text << "\t tot_ambient += lcolor;\n";
|
||||
} else {
|
||||
} else if(_have_diffuse) {
|
||||
text << "\t tot_diffuse += lcolor;\n";
|
||||
}
|
||||
}
|
||||
@ -655,7 +655,9 @@ synthesize_shader(const RenderState *rs) {
|
||||
text << "\t lspec = dlight_dlight" << i << "_rel_view[1];\n";
|
||||
text << "\t lvec = dlight_dlight" << i << "_rel_view[2];\n";
|
||||
text << "\t lcolor *= saturate(dot(l_normal, lvec.xyz));\n";
|
||||
if (_have_diffuse) {
|
||||
text << "\t tot_diffuse += lcolor;\n";
|
||||
}
|
||||
if (_have_specular) {
|
||||
if (_material->get_local()) {
|
||||
text << "\t lhalf = normalize(lvec - normalize(l_pos));\n";
|
||||
@ -677,7 +679,9 @@ synthesize_shader(const RenderState *rs) {
|
||||
text << "\t lvec /= ldist;\n";
|
||||
text << "\t lattenv = 1/(latten.x + latten.y*ldist + latten.z*ldist*ldist);\n";
|
||||
text << "\t lcolor *= lattenv * saturate(dot(l_normal, lvec.xyz));\n";
|
||||
if (_have_diffuse) {
|
||||
text << "\t tot_diffuse += lcolor;\n";
|
||||
}
|
||||
if (_have_specular) {
|
||||
if (_material->get_local()) {
|
||||
text << "\t lhalf = normalize(lvec - normalize(l_pos));\n";
|
||||
@ -704,7 +708,9 @@ synthesize_shader(const RenderState *rs) {
|
||||
text << "\t lattenv *= pow(langle, latten.w);\n";
|
||||
text << "\t if (langle < ldir.w) lattenv = 0;\n";
|
||||
text << "\t lcolor *= lattenv * saturate(dot(l_normal, lvec.xyz));\n";
|
||||
if (_have_diffuse) {
|
||||
text << "\t tot_diffuse += lcolor;\n";
|
||||
}
|
||||
if (_have_specular) {
|
||||
if (_material->get_local()) {
|
||||
text << "\t lhalf = normalize(lvec - normalize(l_pos));\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user