include/material.h
branchpyrit
changeset 92 9af5c039b678
parent 91 9d66d323c354
child 93 96d65f841791
--- a/include/material.h	Fri May 02 13:27:47 2008 +0200
+++ b/include/material.h	Mon May 05 15:31:14 2008 +0200
@@ -107,7 +107,7 @@
 	Float invsize;
 public:
 	TextureMap(const Vector &acenter, const Float &size):
-		center(acenter), invsize(1./size) {};
+		center(acenter), invsize(1.0f/size) {};
 	virtual ~TextureMap() {};
 	virtual void map(const Vector &point, Float &u, Float &v) = 0;
 };
@@ -238,9 +238,9 @@
 	{
 		Float u,v;
 		map->map(point, u,v);
-		u = u - 0.5;
+		u = u - 0.5f;
 		u -= floor(u);
-		v = -(v - 0.5);
+		v = -(v - 0.5f);
 		v -= floor(v);
 		return pixmap->get((int)(u*pixmap->getWidth()), (int)(v*pixmap->getHeight()));
 	};
@@ -259,7 +259,7 @@
 	{
 		Float u,v, val;
 		map->map(point, u,v);
-		val = 0.5*(round(u - floor(u)) + round(v - floor(v)));
+		val = 0.5f*(floor(0.5f + u - floor(u)) + floor(0.5f + v - floor(v)));
 		return colourmap->map(val);
 	};
 };
@@ -299,13 +299,13 @@
 
 	Material(const Colour &acolour): colour(acolour), texture(NULL), smooth(false)
 	{
-		ambient = 0.2;
-		diffuse = 0.8;
-		specular = 0.2;
-		shininess = 0.5;
-		reflectivity = 0.2;
-		transmissivity = 0.0;
-		refract_index = 1.3;
+		ambient = 0.2f;
+		diffuse = 0.8f;
+		specular = 0.2f;
+		shininess = 0.5f;
+		reflectivity = 0.2f;
+		transmissivity = 0.0f;
+		refract_index = 1.3f;
 	}
 
 	void setPhong(const Float amb, const Float dif, const Float spec, const Float shin)