include/shapes.h
branchpyrit
changeset 100 c005054bf4c1
parent 98 64638385798a
equal deleted inserted replaced
99:f3abdaa2e8fb 100:c005054bf4c1
    67 	 * same as intersect, but for ray packets
    67 	 * same as intersect, but for ray packets
    68 	 */
    68 	 */
    69 #ifndef NO_SIMD
    69 #ifndef NO_SIMD
    70 	virtual mfloat4 intersect_packet(const RayPacket &rays, mfloat4 &dists) const
    70 	virtual mfloat4 intersect_packet(const RayPacket &rays, mfloat4 &dists) const
    71 	{
    71 	{
    72 		mfloat4 results;
    72 		union {
    73 		((int*)&results)[0] = intersect(rays[0], ((float*)&dists)[0]) ? -1 : 0;
    73 			mfloat4 mresults;
    74 		((int*)&results)[1] = intersect(rays[1], ((float*)&dists)[1]) ? -1 : 0;
    74 			int32_t results[4];
    75 		((int*)&results)[2] = intersect(rays[2], ((float*)&dists)[2]) ? -1 : 0;
    75 		};
    76 		((int*)&results)[3] = intersect(rays[3], ((float*)&dists)[3]) ? -1 : 0;
    76 		union {
    77 		return results;
    77 			mfloat4 m;
       
    78 			float arr[4];
       
    79 		} d = { dists };
       
    80 		for (int i = 0; i < 4; i++)
       
    81 			results[i] = intersect(rays[i], d.arr[i]) ? -1 : 0;
       
    82 		return mresults;
    78 	};
    83 	};
    79 #endif
    84 #endif
    80 
    85 
    81 	/** get all intersections -- not needed nor used currently */
    86 	/** get all intersections -- not needed nor used currently */
    82 	virtual bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const = 0;
    87 	virtual bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const = 0;