87369bdcf820a63a52024072821db5976736104e
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 // get normal and turn towards ray if angle > 90°
30 Vec3f n
= ray
.hit()->GetNormal(ray
);
31 float cos_theta
= n
.dot(ray
.direction());
32 // we just need the sign, no value
34 std::cout
<< "cos_theta="<<cos_theta
<<", flipping normal" <<std::endl
;
38 // shoot secondary rays from intersection
39 Ray
sec(ray
.origin() + ray
.direction() * (ray
.t() - Epsilon
),
40 ray
.direction() + n
* 2);
41 sec
.setRecursionDepth(ray
.recursionDepth() - 1);
43 if(sec
.recursionDepth() + 1 > 0) {
44 reflColor
= m_scene
->RayTrace(sec
);
45 //reflColor = Shade(sec);
47 return eyeColor
+ (reflColor
* m_reflectivity
);
This page took 0.041191 seconds and 3 git commands to generate.