include/scene.h
branchpyrit
changeset 42 fbdeb3e04543
parent 40 929aad02c5f2
child 44 3763b26244f0
--- a/include/scene.h	Tue Dec 18 12:36:01 2007 +0100
+++ b/include/scene.h	Sat Dec 29 13:53:33 2007 +0100
@@ -82,27 +82,20 @@
 class Texture
 {
 public:
-	Colour colour;
-	Colour evaluate(Vector3 point)
-	{
-		Float sum = 0.0;
-		for (int i = 1; i < 5; i++)
-			sum += fabsf(perlin(point.x*i, point.y*i, point.z*i))/i;
-		Float value = sinf(point.x + sum)/2 + 0.5;
-		return Colour(value*colour.r, value*colour.g, value*colour.b);
-	};
+	virtual Colour evaluate(Vector3 point) = 0;
 };
 
 class Material
 {
 public:
+	Colour colour;
 	Float ambient, diffuse, specular, shininess; // Phong constants
 	Float reflectivity; // how much reflective is the surface
 	Float transmissivity, refract_index; // part of light which can be refracted; index of refraction
-	Texture texture;
+	Texture *texture;
 
-	Material(const Colour &acolour) {
-		texture.colour = acolour;
+	Material(const Colour &acolour): colour(acolour), texture(NULL)
+	{
 		ambient = 0.2;
 		diffuse = 0.8;
 		specular = 0.2;