diff -r 2a853d284a6a -r 64638385798a include/material.h --- a/include/material.h Thu May 15 19:15:57 2008 +0200 +++ b/include/material.h Mon May 19 22:59:04 2008 +0200 @@ -44,6 +44,8 @@ { public: virtual ~Texture() {}; + + /** evaluate texture colour in the point of space */ virtual Colour evaluate(const Vector &point) = 0; }; @@ -54,6 +56,8 @@ { public: virtual ~ColourMap() {}; + + /** map float value to colour */ virtual Colour map(const Float &val) = 0; }; @@ -107,9 +111,23 @@ Vector center; Float invsize; public: + /** + * texture map constructor + * @param[in] acenter central point of texture mapping + * @param[in] size Size of the texture. + * One world space unit is mapped to one texture size + * divided by this number. + */ TextureMap(const Vector &acenter, const Float &size): center(acenter), invsize(1.0f/size) {}; virtual ~TextureMap() {}; + + /** + * map 3D space point to 2D u,v coordinates + * @param[in] point a point in 3D space + * @param[out] u horizontal texture coordinate + * @param[out] v vertical texture coordinate + */ virtual void map(const Vector &point, Float &u, Float &v) const = 0; }; @@ -309,12 +327,24 @@ refract_index = 1.3f; } + /** set Phong parameters */ void setPhong(const Float amb, const Float dif, const Float spec, const Float shin) { ambient = amb; diffuse = dif; specular = spec; shininess = shin; }; + + /** set fraction of light to be reflected */ void setReflectivity(const Float refl) { reflectivity = refl; }; + + /** set fraction of light to be refracted + * @param[in] trans the transmissivity amount + * @param[in] rinde index of refraction + */ void setTransmissivity(const Float trans, const Float rindex) { transmissivity = trans; refract_index = rindex; }; + + /** allow triangle smoothing */ void setSmooth(int sm) { smooth = sm; }; + + /** set the texture */ void setTexture(Texture *tex) { texture = tex; }; };