binary scanner configuration for .cproject
[MicroTrace.git] / Scene.cxx
index 184b7e1..69ea9ed 100644 (file)
--- a/Scene.cxx
+++ b/Scene.cxx
@@ -32,13 +32,19 @@ Scene::operator=(const Scene& s)
 void 
 Scene::Add(Primitive* p)
 {
+  m_primitives.push_back(p);
 }
 
 
 bool
 Scene::Intersect(Ray& ray)
 {
-  return false;
+  bool hit = false;
+  for( std::vector<Primitive*>::iterator i = m_primitives.begin();
+    i != m_primitives.end(); i++ ) {
+    hit |= (*i)->Intersect(ray);
+  }
+  return hit;
 }
 
 bool
@@ -50,7 +56,7 @@ Scene::Occluded(Ray& ray)
 Vec3f
 Scene::RayTrace(Ray& ray)
 {
-  return Vec3f();
+  return (Intersect(ray)) ? Vec3f(255,255,255) : Vec3f(0,0,0);
 }
 
 const Camera* 
This page took 0.025038 seconds and 4 git commands to generate.