Преглед изворни кода

Eye normals weren't being normalised when lighting was disabled

rdb пре 13 година
родитељ
комит
f9b4dad6f9
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4 4
      panda/src/pgraphnodes/shaderGenerator.cxx

+ 4 - 4
panda/src/pgraphnodes/shaderGenerator.cxx

@@ -1015,12 +1015,12 @@ synthesize_shader(const RenderState *rs) {
       text << "\t l_eye_normal.xyz *= tsnormal.z;\n";
       text << "\t l_eye_normal.xyz += l_tangent * tsnormal.x;\n";
       text << "\t l_eye_normal.xyz += l_binormal * tsnormal.y;\n";
-      text << "\t l_eye_normal.xyz  = normalize(l_eye_normal.xyz);\n";
-    } else {
-      text << "\t // Correct the surface normal for interpolation effects\n";
-      text << "\t l_eye_normal.xyz = normalize(l_eye_normal.xyz);\n";
     }
   }
+  if (_need_eye_normal) {
+    text << "\t // Correct the surface normal for interpolation effects\n";
+    text << "\t l_eye_normal.xyz = normalize(l_eye_normal.xyz);\n";
+  }
   if (_out_aux_normal) {
     text << "\t // Output the camera-space surface normal\n";
     text << "\t o_aux.rgb = (l_eye_normal.xyz*0.5) + float3(0.5,0.5,0.5);\n";