b681e47458f04452d011b774219d978943a76da9
1 #include "ReflectiveEyeLightShader.hxx"
2 #include "Primitive.hxx"
5 ReflectiveEyeLightShader::ReflectiveEyeLightShader(Scene
* scene
,
8 : EyeLightShader(scene
,color
),
9 m_reflectivity(reflectivity
)
13 ReflectiveEyeLightShader::~ReflectiveEyeLightShader()
17 ReflectiveEyeLightShader::ReflectiveEyeLightShader()
24 ReflectiveEyeLightShader::Shade(Ray
& ray
)
26 Vec3f eyeColor
= EyeLightShader::Shade(ray
);
29 if(ray
.recursionDepth() > 0) {
30 m_scene
->Intersect(ray
);
31 // intersection, - Epsilon to avoid numerical problems and getting the
32 // reflection on the object's inside ;-)
33 Vec3f i
= ray
.origin() + ray
.direction() * (ray
.t() - Epsilon
);
34 Vec3f r
= ray
.direction();
35 Vec3f n
= (ray
.hit()->GetNormal(ray
));
37 Ray
sec(i
, r
+ n
* (2 * r
.dot(n
* -1)));
38 sec
.setRecursionDepth(ray
.recursionDepth() - 1);
39 reflColor
= m_scene
->RayTrace(sec
);
41 return eyeColor
+ reflColor
* m_reflectivity
;
This page took 0.041357 seconds and 3 git commands to generate.