src/shapes.cc
branchpyrit
changeset 93 96d65f841791
parent 92 9af5c039b678
--- a/src/shapes.cc	Mon May 05 15:31:14 2008 +0200
+++ b/src/shapes.cc	Tue May 06 09:39:58 2008 +0200
@@ -58,9 +58,9 @@
 mfloat4 Sphere::intersect_packet(const RayPacket &rays, mfloat4 &dists) const
 {
 	VectorPacket V = rays.o - VectorPacket(center);
-	register mfloat4 d = msub(mZero, dot(V, rays.dir));
-	register mfloat4 Det = msub(mmul(d, d), msub(dot(V,V), mset1(sqr_radius)));
-	register mfloat4 t1, t2, mask;
+	mfloat4 d = msub(mZero, dot(V, rays.dir));
+	mfloat4 Det = msub(mmul(d, d), msub(dot(V,V), mset1(sqr_radius)));
+	mfloat4 t1, t2, mask;
 
 	mask = mcmpgt(Det, mZero);
 	if (!mmovemask(mask))
@@ -141,7 +141,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++)
 	{
@@ -157,7 +157,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 */
@@ -216,8 +220,8 @@
 
 const Vector Box::normal(const Vector &P) const
 {
-	register Vector l = P - L;
-	register Vector h = H - P;
+	Vector l = P - L;
+	Vector h = H - P;
 
 	if (l.x < h.x)
 		h.x = -1;
@@ -316,7 +320,7 @@
 	int u = (k + 1) % 3;
 	int v = (k + 2) % 3;
 
-	Float krec = 1.0 / N[k];
+	Float krec = 1.0f / N[k];
 	nu = N[u] * krec;
 	nv = N[v] * krec;
 	nd = dot(N, A->P) * krec;