include/shapes.h
branchpyrit
changeset 85 907a634e5c02
parent 84 6f7fe14782c2
child 87 1081e3dd3f3e
--- a/include/shapes.h	Sun Apr 27 09:44:49 2008 +0200
+++ b/include/shapes.h	Sun Apr 27 14:19:37 2008 +0200
@@ -55,12 +55,14 @@
 	// first intersection point
 	virtual bool intersect(const Ray &ray, Float &dist) const = 0;
 
-	virtual void intersect_packet(const RayPacket &rays, __m128 &dists, bool *results)
+	virtual __m128 intersect_packet(const RayPacket &rays, __m128 &dists)
 	{
-		results[0] = intersect(rays[0], ((float*)&dists)[0]);
-		results[1] = intersect(rays[1], ((float*)&dists)[1]);
-		results[2] = intersect(rays[2], ((float*)&dists)[2]);
-		results[3] = intersect(rays[3], ((float*)&dists)[3]);
+		__m128 results;
+		((int*)&results)[0] = intersect(rays[0], ((float*)&dists)[0]) ? -1 : 0;
+		((int*)&results)[1] = intersect(rays[1], ((float*)&dists)[1]) ? -1 : 0;
+		((int*)&results)[2] = intersect(rays[2], ((float*)&dists)[2]) ? -1 : 0;
+		((int*)&results)[3] = intersect(rays[3], ((float*)&dists)[3]) ? -1 : 0;
+		return results;
 	};
 
 	// all intersections (only for CSG)
@@ -203,6 +205,9 @@
 	Triangle() {};
 	Triangle(Vertex *aA, Vertex *aB, Vertex *aC, Material *amaterial);
 	bool intersect(const Ray &ray, Float &dist) const;
+#ifdef TRI_BARI_PRE
+	__m128 intersect_packet(const RayPacket &rays, __m128 &dists);
+#endif
 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const {return false;};
 	bool intersect_bbox(const BBox &bbox) const;
 	const Vector3 normal(const Vector3 &P) const { return (material->smooth ? smooth_normal(P) : N); };