summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2001-08-14 00:50:44 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2001-08-14 00:50:44 +0000
commit3d1df5554e0038c9e8ea95e86317355050a74cc6 (patch)
tree22d5e95697c5d55759548e9db939ab6bc52f04e0 /src/mesa/tnl
parent9a9077501043f33c24567dd574e53f17d3133fb8 (diff)
Compute first partials before taking cross product to calculate normal.
Fixes diego santa cruz' nurbs lighting bug.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_imm_eval.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c
index 1ae006666fd..6a69e9b3d86 100644
--- a/src/mesa/tnl/t_imm_eval.c
+++ b/src/mesa/tnl/t_imm_eval.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_eval.c,v 1.14 2001/08/01 05:10:42 keithw Exp $ */
+/* $Id: t_imm_eval.c,v 1.15 2001/08/14 00:50:44 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -206,6 +206,14 @@ static void eval2_obj_norm( GLvector4f *obj_ptr,
_math_de_casteljau_surf(map->Points, obj[i], du, dv, u, v, dimension,
map->Uorder, map->Vorder);
+ du[0] = du[0]*obj[i][3] - du[3]*obj[i][0];
+ du[1] = du[1]*obj[i][3] - du[3]*obj[i][1];
+ du[2] = du[2]*obj[i][3] - du[3]*obj[i][2];
+
+ dv[0] = dv[0]*obj[i][3] - dv[3]*obj[i][0];
+ dv[1] = dv[1]*obj[i][3] - dv[3]*obj[i][1];
+ dv[2] = dv[2]*obj[i][3] - dv[3]*obj[i][2];
+
CROSS3(normal[i], du, dv);
NORMALIZE_3FV(normal[i]);
}