98 Sphere(const Vector3 &acenter, const Float aradius, Material *amaterial): |
98 Sphere(const Vector3 &acenter, const Float aradius, Material *amaterial): |
99 center(acenter), radius(aradius), |
99 center(acenter), radius(aradius), |
100 sqr_radius(aradius*aradius), inv_radius(1.0f/aradius) |
100 sqr_radius(aradius*aradius), inv_radius(1.0f/aradius) |
101 { material = amaterial; } |
101 { material = amaterial; } |
102 bool intersect(const Ray &ray, Float &dist) const; |
102 bool intersect(const Ray &ray, Float &dist) const; |
|
103 __m128 intersect_packet(const RayPacket &rays, __m128 &dists); |
103 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const; |
104 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const; |
104 bool intersect_bbox(const BBox &bbox) const; |
105 bool intersect_bbox(const BBox &bbox) const; |
105 const Vector3 normal(const Vector3 &P) const { return (P - center) * inv_radius; }; |
106 const Vector3 normal(const Vector3 &P) const { return (P - center) * inv_radius; }; |
106 BBox get_bbox() const; |
107 BBox get_bbox() const; |
107 const Vector3 getCenter() const { return center; }; |
108 const Vector3 getCenter() const { return center; }; |
123 if (L.cell[i] > H.cell[i]) |
124 if (L.cell[i] > H.cell[i]) |
124 swap(L.cell[i], H.cell[i]); |
125 swap(L.cell[i], H.cell[i]); |
125 material = amaterial; |
126 material = amaterial; |
126 }; |
127 }; |
127 bool intersect(const Ray &ray, Float &dist) const; |
128 bool intersect(const Ray &ray, Float &dist) const; |
|
129 __m128 intersect_packet(const RayPacket &rays, __m128 &dists); |
128 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const { return false; }; |
130 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const { return false; }; |
129 bool intersect_bbox(const BBox &bbox) const; |
131 bool intersect_bbox(const BBox &bbox) const; |
130 const Vector3 normal(const Vector3 &P) const; |
132 const Vector3 normal(const Vector3 &P) const; |
131 BBox get_bbox() const { return BBox(L, H); }; |
133 BBox get_bbox() const { return BBox(L, H); }; |
132 const Vector3 getL() const { return L; }; |
134 const Vector3 getL() const { return L; }; |