--- a/include/material.h Sat May 10 14:29:37 2008 +0200
+++ b/include/material.h Thu May 15 00:07:25 2008 +0200
@@ -110,7 +110,7 @@
TextureMap(const Vector &acenter, const Float &size):
center(acenter), invsize(1.0f/size) {};
virtual ~TextureMap() {};
- virtual void map(const Vector &point, Float &u, Float &v) = 0;
+ virtual void map(const Vector &point, Float &u, Float &v) const = 0;
};
/**
@@ -121,7 +121,7 @@
public:
PlanarMap(const Vector &acenter, const Float &size):
TextureMap(acenter, size) {};
- void map(const Vector &point, Float &u, Float &v)
+ void map(const Vector &point, Float &u, Float &v) const
{
const Vector p = point - center;
u = p.x*invsize;
@@ -137,7 +137,7 @@
public:
CubicMap(const Vector &acenter, const Float &size):
TextureMap(acenter, size) {};
- void map(const Vector &point, Float &u, Float &v)
+ void map(const Vector &point, Float &u, Float &v) const
{
const Vector p = point - center;
if (fabs(p.x) > fabs(p.y))
@@ -191,7 +191,7 @@
public:
CylinderMap(const Vector &acenter, const Float &size):
TextureMap(acenter, size) {};
- void map(const Vector &point, Float &u, Float &v)
+ void map(const Vector &point, Float &u, Float &v) const
{
const Vector p = point - center;
u = ( PI + atan2(p.z, p.x) ) * invsize;
@@ -207,7 +207,7 @@
public:
SphereMap(const Vector &acenter, const Float &size):
TextureMap(acenter, size) {};
- void map(const Vector &point, Float &u, Float &v)
+ void map(const Vector &point, Float &u, Float &v) const
{
const Vector p = point - center;
u = ( PI + atan2(p.z, p.x) ) * invsize;
@@ -221,9 +221,9 @@
class Texture2D: public Texture
{
protected:
- TextureMap *map;
+ const TextureMap *map;
public:
- Texture2D(TextureMap *amap): map(amap) {};
+ Texture2D(const TextureMap *amap): map(amap) {};
};
/**
@@ -231,9 +231,9 @@
*/
class ImageTexture: public Texture2D
{
- Pixmap *pixmap;
+ const Pixmap *pixmap;
public:
- ImageTexture(TextureMap *tmap, Pixmap *image):
+ ImageTexture(const TextureMap *tmap, const Pixmap *image):
Texture2D(tmap), pixmap(image) {};
Colour evaluate(const Vector &point)
{