--- a/src/raytracer.cc Tue Dec 18 12:36:01 2007 +0100
+++ b/src/raytracer.cc Sat Dec 29 13:53:33 2007 +0100
@@ -59,7 +59,11 @@
// P is point of intersection, N normal in this point
Colour PhongShader_ambient(Material &mat, Vector3 &P)
{
- Colour col = mat.texture.colour; //mat.texture.evaluate(P);
+ Colour col;
+ if (mat.texture)
+ col = mat.texture->evaluate(P);
+ else
+ col = mat.colour;
// ambient
return mat.ambient * col;
@@ -80,7 +84,11 @@
Float L_dot_N = dot(L, N);
Float R_dot_V = dot(R, V);
- Colour col = mat.texture.colour; //mat.texture.evaluate(P);
+ Colour col;
+ if (mat.texture)
+ col = mat.texture->evaluate(P);
+ else
+ col = mat.colour;
// diffuse
I = mat.diffuse * col * light.colour * L_dot_N;