include/scene.h
branchpyrit
changeset 38 5d043eeb09d9
parent 36 b490093b0ac3
child 40 929aad02c5f2
equal deleted inserted replaced
37:5f954c0d34fc 38:5d043eeb09d9
   154 	Sphere(const Vector3 &acenter, const Float aradius, Material *amaterial):
   154 	Sphere(const Vector3 &acenter, const Float aradius, Material *amaterial):
   155 		sqr_radius(aradius*aradius), inv_radius(1.0f/aradius),
   155 		sqr_radius(aradius*aradius), inv_radius(1.0f/aradius),
   156 		center(acenter), radius(aradius) { material = amaterial; }
   156 		center(acenter), radius(aradius) { material = amaterial; }
   157 	bool intersect(const Ray &ray, Float &dist) const;
   157 	bool intersect(const Ray &ray, Float &dist) const;
   158 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const;
   158 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const;
   159 	bool intersect_bbox(const BBox &bbox) const { return true; };
   159 	bool intersect_bbox(const BBox &bbox) const;
   160 	const Vector3 normal(const Vector3 &P) const { return (P - center) * inv_radius; };
   160 	const Vector3 normal(const Vector3 &P) const { return (P - center) * inv_radius; };
   161 	BBox get_bbox() const;
   161 	BBox get_bbox() const;
   162 };
   162 };
   163 
   163 
   164 class Box: public Shape
   164 class Box: public Shape
   173 				swap(L.cell[i], H.cell[i]);
   173 				swap(L.cell[i], H.cell[i]);
   174 		material = amaterial;
   174 		material = amaterial;
   175 	};
   175 	};
   176 	bool intersect(const Ray &ray, Float &dist) const;
   176 	bool intersect(const Ray &ray, Float &dist) const;
   177 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const { return false; };
   177 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const { return false; };
   178 	bool intersect_bbox(const BBox &bbox) const { return true; };
   178 	bool intersect_bbox(const BBox &bbox) const;
   179 	const Vector3 normal(const Vector3 &P) const;
   179 	const Vector3 normal(const Vector3 &P) const;
   180 	BBox get_bbox() const { return BBox(L, H); };
   180 	BBox get_bbox() const { return BBox(L, H); };
   181 };
   181 };
   182 
   182 
   183 class Vertex
   183 class Vertex