1 #ifndef PROCEDURALPAPER_HXX
 2 #define PROCEDURALPAPER_HXX
 3 
 4 #include "Procedural.hxx"
 5 #include "Noise.hxx"
 6 
 7 // Creates a paper structure by simply mapping the turbulence to colors
 8 class ProceduralPaper : public Procedural
 9 {
10 private:
11 	Noise *noise;
12 
13 	float factor;
14 
15 	Vec3f LightColor,
16 	      DarkColor;
17 
18 public:
19 	ProceduralPaper(bool useTexture, bool useBumpMap, float factor, Vec3f LightColor = Vec3f(0.89,0.84,0.71), Vec3f DarkColor = Vec3f(0.77,0.65,0.43))
20 		: Procedural(useTexture, useBumpMap, true, false), factor(factor),
21 		  LightColor(LightColor), DarkColor(DarkColor)
22 	{
23 		noise = new Noise(Vec3f(64));
24 	};
25 
26 	virtual ~ProceduralPaper()
27 	{
28 		delete noise;
29 	};
30 
31 	virtual Vec3f GetColor (Vec3f coordinate)
32 	{
33 		return noise->Turbulence(coordinate*factor, 0.01f) * (LightColor - DarkColor) + DarkColor;
34 	};
35 
36 	virtual void BumpMap(Vec3f &normal, Vec3f coordinate)
37 	{
38 	};
39 };
40 
41 #endif


syntax highlighted by Code2HTML, v. 0.9.1