X-Git-Url: https://git.rohieb.name/MicroTrace.git/blobdiff_plain/49b259147e3ece2ed0aa4ad72b686970031cfc46..bb70135ac47130d65f8885b9c5fa9fa970b00cae:/Scene.cxx diff --git a/Scene.cxx b/Scene.cxx index bbd6785..a1d3acd 100644 --- a/Scene.cxx +++ b/Scene.cxx @@ -2,11 +2,11 @@ #include "PerspectiveCamera.hxx" Scene::Scene() - : m_camera(new PerspectiveCamera(Vec3f(0,0,8), - Vec3f(0,0,-1), - Vec3f(0,1,0), - 50, - 640, + : m_camera(new PerspectiveCamera(Vec3f(0,0,8), + Vec3f(0,0,-1), + Vec3f(0,1,0), + 50, + 640, 480) ), m_bgColor(Vec3f(0,0,0)) @@ -29,7 +29,7 @@ Scene::operator=(const Scene& s) return *this; } -void +void Scene::Add(Primitive* p) { m_primitives.push_back(p); @@ -38,6 +38,7 @@ Scene::Add(Primitive* p) void Scene::Add(Light* l) { + m_lights.push_back(l); } bool @@ -49,7 +50,7 @@ Scene::Intersect(Ray& ray) { intersect |= m_primitives[i]->Intersect(ray); } - + return intersect; } @@ -66,7 +67,7 @@ Scene::RayTrace(Ray& ray) return (intersect) ? ray.hit()->shader()->Shade(ray) : m_bgColor; } -const Camera* +const Camera* Scene::camera() const { return m_camera;