include/material.h
branchpyrit
changeset 91 9d66d323c354
parent 88 f7edb3b90816
child 92 9af5c039b678
--- a/include/material.h	Tue Apr 29 23:31:08 2008 +0200
+++ b/include/material.h	Fri May 02 13:27:47 2008 +0200
@@ -43,7 +43,7 @@
 {
 public:
 	virtual ~Texture() {};
-	virtual Colour evaluate(const Vector3 &point) = 0;
+	virtual Colour evaluate(const Vector &point) = 0;
 };
 
 /**
@@ -103,13 +103,13 @@
 class TextureMap
 {
 protected:
-	Vector3 center;
+	Vector center;
 	Float invsize;
 public:
-	TextureMap(const Vector3 &acenter, const Float &size):
+	TextureMap(const Vector &acenter, const Float &size):
 		center(acenter), invsize(1./size) {};
 	virtual ~TextureMap() {};
-	virtual void map(const Vector3 &point, Float &u, Float &v) = 0;
+	virtual void map(const Vector &point, Float &u, Float &v) = 0;
 };
 
 /**
@@ -118,11 +118,11 @@
 class PlanarMap: public TextureMap
 {
 public:
-	PlanarMap(const Vector3 &acenter, const Float &size):
+	PlanarMap(const Vector &acenter, const Float &size):
 		TextureMap(acenter, size) {};
-	void map(const Vector3 &point, Float &u, Float &v)
+	void map(const Vector &point, Float &u, Float &v)
 	{
-		const Vector3 p = point - center;
+		const Vector p = point - center;
 		u = p.x*invsize;
 		v = p.y*invsize;
 	};
@@ -134,11 +134,11 @@
 class CubicMap: public TextureMap
 {
 public:
-	CubicMap(const Vector3 &acenter, const Float &size):
+	CubicMap(const Vector &acenter, const Float &size):
 		TextureMap(acenter, size) {};
-	void map(const Vector3 &point, Float &u, Float &v)
+	void map(const Vector &point, Float &u, Float &v)
 	{
-		const Vector3 p = point - center;
+		const Vector p = point - center;
 		if (fabs(p.x) > fabs(p.y))
 		{
 			if (fabs(p.x) > fabs(p.z))
@@ -188,11 +188,11 @@
 class CylinderMap: public TextureMap
 {
 public:
-	CylinderMap(const Vector3 &acenter, const Float &size):
+	CylinderMap(const Vector &acenter, const Float &size):
 		TextureMap(acenter, size) {};
-	void map(const Vector3 &point, Float &u, Float &v)
+	void map(const Vector &point, Float &u, Float &v)
 	{
-		const Vector3 p = point - center;
+		const Vector p = point - center;
 		u = ( M_PI + atan2(p.z, p.x) ) * invsize;
 		v = p.y * invsize;
 	};
@@ -204,11 +204,11 @@
 class SphereMap: public TextureMap
 {
 public:
-	SphereMap(const Vector3 &acenter, const Float &size):
+	SphereMap(const Vector &acenter, const Float &size):
 		TextureMap(acenter, size) {};
-	void map(const Vector3 &point, Float &u, Float &v)
+	void map(const Vector &point, Float &u, Float &v)
 	{
-		const Vector3 p = point - center;
+		const Vector p = point - center;
 		u = ( M_PI + atan2(p.z, p.x) ) * invsize;
 		v = acos(p.y / p.mag()) * invsize;
 	};
@@ -234,7 +234,7 @@
 public:
 	ImageTexture(TextureMap *tmap, Pixmap *image):
 		Texture2D(tmap), pixmap(image) {};
-	Colour evaluate(const Vector3 &point)
+	Colour evaluate(const Vector &point)
 	{
 		Float u,v;
 		map->map(point, u,v);
@@ -255,7 +255,7 @@
 public:
 	CheckersTexture(TextureMap *tmap, ColourMap *cmap):
 		Texture2D(tmap), colourmap(cmap) {};
-	Colour evaluate(const Vector3 &point)
+	Colour evaluate(const Vector &point)
 	{
 		Float u,v, val;
 		map->map(point, u,v);
@@ -274,7 +274,7 @@
 public:
 	CloudTexture(const Float &adetail, ColourMap *cmap):
 		detail(adetail), colourmap(cmap) {};
-	Colour evaluate(const Vector3 &point)
+	Colour evaluate(const Vector &point)
 	{
 		Float sum = 0.0;
 		for (int i = 1; i < detail; i++)