equal
deleted
inserted
replaced
53 virtual ~Shape() {}; |
53 virtual ~Shape() {}; |
54 |
54 |
55 // first intersection point |
55 // first intersection point |
56 virtual bool intersect(const Ray &ray, Float &dist) const = 0; |
56 virtual bool intersect(const Ray &ray, Float &dist) const = 0; |
57 |
57 |
58 virtual void intersect_packet(const RayPacket &rays, __m128 &dists, bool *results) |
58 virtual __m128 intersect_packet(const RayPacket &rays, __m128 &dists) |
59 { |
59 { |
60 results[0] = intersect(rays[0], ((float*)&dists)[0]); |
60 __m128 results; |
61 results[1] = intersect(rays[1], ((float*)&dists)[1]); |
61 ((int*)&results)[0] = intersect(rays[0], ((float*)&dists)[0]) ? -1 : 0; |
62 results[2] = intersect(rays[2], ((float*)&dists)[2]); |
62 ((int*)&results)[1] = intersect(rays[1], ((float*)&dists)[1]) ? -1 : 0; |
63 results[3] = intersect(rays[3], ((float*)&dists)[3]); |
63 ((int*)&results)[2] = intersect(rays[2], ((float*)&dists)[2]) ? -1 : 0; |
|
64 ((int*)&results)[3] = intersect(rays[3], ((float*)&dists)[3]) ? -1 : 0; |
|
65 return results; |
64 }; |
66 }; |
65 |
67 |
66 // all intersections (only for CSG) |
68 // all intersections (only for CSG) |
67 virtual bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const = 0; |
69 virtual bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const = 0; |
68 |
70 |
201 Vertex *A, *B, *C; |
203 Vertex *A, *B, *C; |
202 |
204 |
203 Triangle() {}; |
205 Triangle() {}; |
204 Triangle(Vertex *aA, Vertex *aB, Vertex *aC, Material *amaterial); |
206 Triangle(Vertex *aA, Vertex *aB, Vertex *aC, Material *amaterial); |
205 bool intersect(const Ray &ray, Float &dist) const; |
207 bool intersect(const Ray &ray, Float &dist) const; |
|
208 #ifdef TRI_BARI_PRE |
|
209 __m128 intersect_packet(const RayPacket &rays, __m128 &dists); |
|
210 #endif |
206 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const {return false;}; |
211 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const {return false;}; |
207 bool intersect_bbox(const BBox &bbox) const; |
212 bool intersect_bbox(const BBox &bbox) const; |
208 const Vector3 normal(const Vector3 &P) const { return (material->smooth ? smooth_normal(P) : N); }; |
213 const Vector3 normal(const Vector3 &P) const { return (material->smooth ? smooth_normal(P) : N); }; |
209 const Vector3 getNormal() const { return N; }; |
214 const Vector3 getNormal() const { return N; }; |
210 BBox get_bbox() const; |
215 BBox get_bbox() const; |