projects
/
MicroTrace.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7a2c1f3
)
solution to assignment 2.2 b): eyelight shader
author
Roland Hieber
<rohieb@rohieb.name>
Wed, 20 Jan 2010 01:34:48 +0000
(
02:34
+0100)
committer
Roland Hieber
<rohieb@rohieb.name>
Wed, 20 Jan 2010 01:34:48 +0000
(
02:34
+0100)
EyeLightShader.cxx
patch
|
blob
|
history
diff --git
a/EyeLightShader.cxx
b/EyeLightShader.cxx
index
12578d7
..
8eae610
100644
(file)
--- a/
EyeLightShader.cxx
+++ b/
EyeLightShader.cxx
@@
-1,4
+1,5
@@
#include "EyeLightShader.hxx"
+#include "Primitive.hxx"
EyeLightShader::EyeLightShader(Scene* scene,
const Vec3f& color)
@@
-20,5
+21,9
@@
EyeLightShader::EyeLightShader()
Vec3f
EyeLightShader::Shade(Ray& ray)
{
- return Vec3f();
+ // shade according to cos(theta)
+ Vec3f r = ray.direction();
+ Vec3f n = ray.hit()->GetNormal(ray);
+ float cos_theta = fabs(r.dot(n) / (r.norm() * n.norm()));
+ return m_color * cos_theta;
}
This page took
0.02132 seconds
and
4
git commands to generate.