src/container.cc
branchpyrit
changeset 95 ca7d4c665531
parent 92 9af5c039b678
--- a/src/container.cc	Thu May 08 09:21:25 2008 +0200
+++ b/src/container.cc	Sat May 10 14:29:37 2008 +0200
@@ -28,7 +28,7 @@
 #include "container.h"
 #include "serialize.h"
 
-void Container::addShape(Shape* aShape)
+void Container::addShape(const Shape* aShape)
 {
 	const Float e = Eps;
 	if (shapes.size() == 0) {
@@ -49,10 +49,10 @@
 	shapes.push_back(aShape);
 };
 
-Shape *Container::nearest_intersection(const Shape *origin_shape, const Ray &ray,
+const Shape *Container::nearest_intersection(const Shape *origin_shape, const Ray &ray,
         Float &nearest_distance)
 {
-	Shape *nearest_shape = NULL;
+	const Shape *nearest_shape = NULL;
 	ShapeList::iterator shape;
 	for (shape = shapes.begin(); shape != shapes.end(); shape++)
 		if (*shape != origin_shape && (*shape)->intersect(ray, nearest_distance))
@@ -62,7 +62,7 @@
 
 #ifndef NO_SIMD
 void Container::packet_intersection(const Shape* const* origin_shapes, const RayPacket &rays,
-	Float *nearest_distances, Shape **nearest_shapes)
+	Float *nearest_distances, const Shape **nearest_shapes)
 {
 	for (int i = 0; i < 4; i++)
 		nearest_shapes[i] = nearest_intersection(origin_shapes[i], rays[i],
@@ -70,10 +70,10 @@
 }
 #endif
 
-ostream & Container::dump(ostream &st)
+ostream & Container::dump(ostream &st) const
 {
 	st << "(container," << shapes.size();
-	ShapeList::iterator shape;
+	ShapeList::const_iterator shape;
 	for (shape = shapes.begin(); shape != shapes.end(); shape++)
 	{
 		int idx;