#ifndef MYBUMPMAP_HXX
#define MYBUMPMAP_HXX

/**
   Used to generate the waves on the lake of the landscape
   that is used for the Rendering Competition.
*/
class MyBumpMap : public AbstractBumpMap
{
 public:
    MyBumpMap() {
	clear();
    }

    /** Applies Bump Mapping to get a new normal. */
    virtual Vec3f getNewNormal(const Vec3f &a, const Vec3f &b, const Vec3f &c) const {
	Vec3f tmp[] = {a, b, c};
	for (int i=0; i<3; i++) {
	    // scaling
	    tmp[i] -= min;
	    tmp[i].x /= 5;
	    tmp[i].y /= 5;

	    // the height of the points is modified temporarily according to a fractal
	    tmp[i].z += 0.07 * fBm( tmp[i], 3, 2, 2 ); // fractal
	}
	// the new normal of the temporarily modified surface is returned
	// the change of the surface itself is discarded
	return cross(tmp[1]-tmp[0], tmp[2]-tmp[0]);
    }
};


#endif // MYBUMPMAP_HXX
