source: GTP/trunk/App/Demos/Vis/CHC_revisited/Material.h @ 2747

Revision 2747, 1.3 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef __MATERIAL_H
2#define __MATERIAL_H
3
4//namespace CHCDemo
5//{
6
7
8class RgbColor
9{
10public:
11  float r, g, b;
12
13  RgbColor():r(0.5f),g(0.5f),b(0.5f)
14  {
15  }
16
17  RgbColor(const float _r,
18           const float _g,
19           const float _b):r(_r),g(_g),b(_b)
20  {
21  }
22
23  friend RgbColor
24  RandomColor(const float a=0.0f, const float b=1.0f);
25
26  // Mapping from interval 0.0-1.0 to RGB using "rainbow" color map
27  // (range of hue from 0-240)
28
29  friend RgbColor RainbowColorMapping(const float value);
30 
31};
32
33
34// Forward declarations
35RgbColor RandomColor(const float a, const float b);
36
37// Mapping from interval 0.0-1.0 to RGB using "rainbow" color map
38// (range of hue from 0-240)
39RgbColor RainbowColorMapping(const float value);
40
41 
42
43class Material
44{
45public:
46  RgbColor mDiffuseColor;
47  RgbColor mSpecularColor;
48  RgbColor mAmbientColor;
49 
50  Material(): mId(0)
51  {
52  }
53 
54  Material(const int id): mId(id)
55  {
56  }
57
58  Material(const RgbColor &color):mDiffuseColor(color),
59                                                                  mAmbientColor(color),
60                                                                  mSpecularColor(0,0,0), mId(0)
61  {
62  }
63 
64  friend Material RandomMaterial();
65 
66  /** Returns unique material id.
67  */
68  int GetId() const
69  {
70          return mId;
71  }
72
73protected:
74
75        // unique material id
76        int mId;
77};
78
79
80extern Material RandomMaterial();
81
82//}
83
84#endif
Note: See TracBrowser for help on using the repository browser.