source: GTP/trunk/Lib/Vis/Preprocessing/src/Material.h @ 2148

Revision 2148, 1.1 KB checked in by bittner, 17 years ago (diff)

rainbow color maps

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