fix for bug#10196
authorXiang, Haihao <haihao.xiang@intel.com>
Sun, 11 Mar 2007 14:41:26 +0000 (22:41 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Sun, 11 Mar 2007 14:41:26 +0000 (22:41 +0800)
Compute half if LOCAL_VIEWER is enabled and the light is
a directional source.

src/mesa/drivers/dri/i965/brw_vs_tnl.c
src/mesa/tnl/t_vp_build.c

index 0d61092247ab0b61ef992a8f7de6c85a421c40bf..c05a9b5ea10e85af8f28608aaa129310ead68f7d 100644 (file)
@@ -988,7 +988,14 @@ static void build_lighting( struct tnl_program *p )
             */
            VPpli = register_param3(p, STATE_LIGHT, i, 
                                    STATE_POSITION_NORMALIZED); 
-           half = register_param3(p, STATE_LIGHT, i, STATE_HALF);
+            if (p->state->light_local_viewer) {
+                struct ureg eye_hat = get_eye_position_normalized(p);
+                half = get_temp(p);
+                emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
+                emit_normalize_vec3(p, half, half);
+            } else {
+                half = register_param3(p, STATE_LIGHT, i, STATE_HALF);
+            }
         } 
         else {
            struct ureg Ppli = register_param3(p, STATE_LIGHT, i, 
index 81266f3c8b430710975fe99d6f0b16803f6979b3..2a97a1c8c76693ea7633f5429292943f1446a533 100644 (file)
@@ -939,7 +939,14 @@ static void build_lighting( struct tnl_program *p )
             */
            VPpli = register_param3(p, STATE_LIGHT, i, 
                                    STATE_POSITION_NORMALIZED); 
-           half = register_param3(p, STATE_LIGHT, i, STATE_HALF);
+            if (p->state->light_local_viewer) {
+                struct ureg eye_hat = get_eye_position_normalized(p);
+                half = get_temp(p);
+                emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
+                emit_normalize_vec3(p, half, half);
+            } else {
+                half = register_param3(p, STATE_LIGHT, i, STATE_HALF);
+            }
         } 
         else {
            struct ureg Ppli = register_param3(p, STATE_LIGHT, i,