projects
/
MicroTrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Phong does not work yet, but saving here
[MicroTrace.git]
/
Scene.cxx
diff --git
a/Scene.cxx
b/Scene.cxx
index
184b7e1
..
a1d3acd
100644
(file)
--- a/
Scene.cxx
+++ b/
Scene.cxx
@@
-2,11
+2,11
@@
#include "PerspectiveCamera.hxx"
Scene::Scene()
#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))
480)
),
m_bgColor(Vec3f(0,0,0))
@@
-29,16
+29,29
@@
Scene::operator=(const Scene& s)
return *this;
}
return *this;
}
-void
+void
Scene::Add(Primitive* p)
{
Scene::Add(Primitive* p)
{
+ m_primitives.push_back(p);
}
}
+void
+Scene::Add(Light* l)
+{
+ m_lights.push_back(l);
+}
bool
Scene::Intersect(Ray& ray)
{
bool
Scene::Intersect(Ray& ray)
{
- return false;
+ bool intersect = false;
+
+ for(unsigned int i = 0; i < m_primitives.size(); ++i)
+ {
+ intersect |= m_primitives[i]->Intersect(ray);
+ }
+
+ return intersect;
}
bool
}
bool
@@
-50,10
+63,11
@@
Scene::Occluded(Ray& ray)
Vec3f
Scene::RayTrace(Ray& ray)
{
Vec3f
Scene::RayTrace(Ray& ray)
{
- return Vec3f();
+ bool intersect = this->Intersect(ray);
+ return (intersect) ? ray.hit()->shader()->Shade(ray) : m_bgColor;
}
}
-const Camera*
+const Camera*
Scene::camera() const
{
return m_camera;
Scene::camera() const
{
return m_camera;
This page took
0.024104 seconds
and
4
git commands to generate.