src/scene.cc
branchpyrit
changeset 93 96d65f841791
parent 92 9af5c039b678
--- a/src/scene.cc	Mon May 05 15:31:14 2008 +0200
+++ b/src/scene.cc	Tue May 06 09:39:58 2008 +0200
@@ -77,7 +77,7 @@
 {
 	register Float tnear = -Inf;
 	register Float tfar = Inf;
-	register Float t1, t2;
+	register Float t1, t2, t;
 
 	for (int i = 0; i < 3; i++)
 	{
@@ -92,7 +92,11 @@
 			t2 = (H[i] - ray.o[i]) / ray.dir[i];
 
 			if (t1 > t2)
-				swap(t1, t2);
+			{
+				t = t1;
+				t1 = t2;
+				t2 = t;
+			}
 
 			if (t1 > tnear)
 				tnear = t1; /* want largest Tnear */