src/raytracer.cc
branchpyrit
changeset 25 b8232edee786
parent 22 76b7bd51d64a
child 30 33f95441790e
--- a/src/raytracer.cc	Wed Dec 05 18:54:23 2007 +0100
+++ b/src/raytracer.cc	Fri Dec 07 14:56:39 2007 +0100
@@ -100,6 +100,9 @@
 		Colour acc = Colour();
 		Vector3 P = ray.o + ray.dir * nearest_distance; // point of intersection
 		Vector3 normal = nearest_shape->normal(P);
+		// make shapes double sided
+		if (dot(normal, ray.dir) > 0.0)
+			normal = - normal;
 		acc = PhongShader_ambient(*nearest_shape->material, P);
 
 		vector<Light*>::iterator light;