Rev | Line | |
---|
[162] | 1 | #ifndef __MATERIAL_H
|
---|
| 2 | #define __MATERIAL_H
|
---|
| 3 |
|
---|
[860] | 4 | namespace GtpVisibilityPreprocessor {
|
---|
[162] | 5 |
|
---|
| 6 |
|
---|
| 7 | class RgbColor
|
---|
| 8 | {
|
---|
| 9 | public:
|
---|
| 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 | }
|
---|
[608] | 21 |
|
---|
| 22 | friend RgbColor
|
---|
| 23 | RandomColor(const float a=0.0f, const float b=1.0f);
|
---|
| 24 |
|
---|
[2148] | 25 | // Mapping from interval 0.0-1.0 to RGB using "rainbow" color map
|
---|
| 26 | // (range of hue from 0-240)
|
---|
| 27 |
|
---|
[2173] | 28 | friend RgbColor RainbowColorMapping(const float value);
|
---|
[2148] | 29 |
|
---|
[162] | 30 | };
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | class Material
|
---|
| 34 | {
|
---|
| 35 | public:
|
---|
| 36 | RgbColor mDiffuseColor;
|
---|
| 37 | RgbColor mSpecularColor;
|
---|
| 38 | RgbColor mAmbientColor;
|
---|
| 39 |
|
---|
[1001] | 40 | Material(): mId(0)
|
---|
[162] | 41 | {
|
---|
| 42 | }
|
---|
[608] | 43 |
|
---|
[1001] | 44 | Material(const int id): mId(id)
|
---|
| 45 | {
|
---|
| 46 | }
|
---|
| 47 |
|
---|
[608] | 48 | Material(const RgbColor &color):mDiffuseColor(color),
|
---|
| 49 | mAmbientColor(color),
|
---|
[1001] | 50 | mSpecularColor(0,0,0), mId(0)
|
---|
[608] | 51 | {
|
---|
| 52 | }
|
---|
| 53 |
|
---|
[162] | 54 | friend Material RandomMaterial();
|
---|
| 55 |
|
---|
[1001] | 56 | /** Returns unique material id.
|
---|
| 57 | */
|
---|
| 58 | int GetId() const
|
---|
| 59 | {
|
---|
| 60 | return mId;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | protected:
|
---|
| 64 |
|
---|
| 65 | // unique material id
|
---|
| 66 | int mId;
|
---|
[162] | 67 | };
|
---|
| 68 |
|
---|
| 69 |
|
---|
[860] | 70 | }
|
---|
[162] | 71 |
|
---|
| 72 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.