include/shapes.h
branchpyrit
changeset 92 9af5c039b678
parent 91 9d66d323c354
child 93 96d65f841791
--- a/include/shapes.h	Fri May 02 13:27:47 2008 +0200
+++ b/include/shapes.h	Mon May 05 15:31:14 2008 +0200
@@ -55,10 +55,10 @@
 	// first intersection point
 	virtual bool intersect(const Ray &ray, Float &dist) const = 0;
 
-#ifndef NO_SSE
-	virtual __m128 intersect_packet(const RayPacket &rays, __m128 &dists)
+#ifndef NO_SIMD
+	virtual mfloat4 intersect_packet(const RayPacket &rays, mfloat4 &dists) const
 	{
-		__m128 results;
+		mfloat4 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;
@@ -109,8 +109,8 @@
 	const Vector getCenter() const { return center; };
 	Float getRadius() const { return radius; };
 	ostream & dump(ostream &st) const;
-#ifndef NO_SSE
-	__m128 intersect_packet(const RayPacket &rays, __m128 &dists);
+#ifndef NO_SIMD
+	mfloat4 intersect_packet(const RayPacket &rays, mfloat4 &dists) const;
 #endif
 };
 
@@ -125,8 +125,8 @@
 	Box(const Vector &aL, const Vector &aH, Material *amaterial): L(aL), H(aH)
 	{
 		for (int i = 0; i < 3; i++)
-			if (L.cell[i] > H.cell[i])
-				swap(L.cell[i], H.cell[i]);
+			if (L[i] > H[i])
+				swap(L[i], H[i]);
 		material = amaterial;
 	};
 	bool intersect(const Ray &ray, Float &dist) const;
@@ -137,8 +137,8 @@
 	const Vector getL() const { return L; };
 	const Vector getH() const { return H; };
 	ostream & dump(ostream &st) const;
-#ifndef NO_SSE
-	__m128 intersect_packet(const RayPacket &rays, __m128 &dists);
+#ifndef NO_SIMD
+	mfloat4 intersect_packet(const RayPacket &rays, mfloat4 &dists) const;
 #endif
 };
 
@@ -149,6 +149,7 @@
 {
 public:
 	Vector P;
+
 	Vertex(const Vector &aP): P(aP) {};
 	virtual ~Vertex() {};
 	virtual ostream & dump(ostream &st) const;
@@ -161,6 +162,7 @@
 {
 public:
 	Vector N;
+
 	NormalVertex(const NormalVertex *v): Vertex(v->P), N(v->N) {};
 	NormalVertex(const Vector &aP): Vertex(aP) {};
 	NormalVertex(const Vector &aP, const Vector &aN): Vertex(aP), N(aN) {};
@@ -219,8 +221,8 @@
 	const Vector getNormal() const { return N; };
 	BBox get_bbox() const;
 	ostream & dump(ostream &st) const;
-#if not defined(NO_SSE) and defined(TRI_BARI_PRE)
-	__m128 intersect_packet(const RayPacket &rays, __m128 &dists);
+#if !defined(NO_SIMD) && defined(TRI_BARI_PRE)
+	mfloat4 intersect_packet(const RayPacket &rays, mfloat4 &dists) const;
 #endif
 };