1 #ifndef PROCEDURALWAVE_HXX
 2 #define PROCEDURALWAVE_HXX
 3 
 4 #define dPdu Vec3f(1,0,0)
 5 #define dPdv Vec3f(0,0,1)
 6 
 7 #include "Procedural.hxx"
 8 
 9 // The wave function from the exercise, packed into a class
10 class ProceduralWave: public Procedural
11 {
12 public:
13 	ProceduralWave(bool useTexture, bool useBumpMap): Procedural(useTexture, useBumpMap, false, true)
14 	{};
15 
16 	virtual void BumpMap (Vec3f &normal, Vec3f coordinate)
17 	{
18 		normal = normal
19 		  + 0.1 * cos( 3 * coordinate.x * sin(coordinate.z)) * dPdu
20 		  + 0.1 * sin(13 * coordinate.z)                     * dPdv;
21 		Normalize(normal);
22 	}
23 };
24 
25 #endif


syntax highlighted by Code2HTML, v. 0.9.1