Changeset 2769 for GTP/trunk/App/Demos/Vis/CHC_revisited/Material.h
- Timestamp:
- 06/18/08 04:08:41 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/Material.h
r2768 r2769 7 7 8 8 class Texture; 9 class RenderState; 9 10 10 class RgbColor 11 12 class RgbaColor 11 13 { 12 14 13 15 public: 14 16 15 float r, g, b;17 float r, g, b, a; 16 18 17 RgbColor(): r(0.5f), g(0.5f), b(0.5f) 18 { 19 } 19 RgbaColor(): r(1), g(1), b(1), a(1) 20 {} 20 21 21 RgbColor(float _r, float _g, float _b): r(_r), g(_g), b(_b) 22 { 23 } 22 RgbaColor(float _r, float _g, float _b, float _a): r(_r), g(_g), b(_b), a(_a) 23 {} 24 24 25 friend RgbColor 26 RandomColor(float a = 0.0f, float b = 1.0f); 27 28 // Mapping from interval 0.0-1.0 to RGB using "rainbow" color map 29 // (range of hue from 0-240) 30 31 friend RgbColor RainbowColorMapping(float value); 32 25 friend RgbaColor RandomColor(float a = 0.0f, float b = 1.0f); 33 26 }; 34 27 35 28 36 29 // Forward declarations 37 Rgb Color RandomColor(const float a, constfloat b);30 RgbaColor RandomColor(float a, float b); 38 31 39 // Mapping from interval 0.0-1.0 to RGB using "rainbow" color map40 // (range of hue from 0-240)41 RgbColor RainbowColorMapping(const float value);42 32 43 44 33 45 34 class Material … … 47 36 public: 48 37 49 RgbColor mDiffuseColor; 50 RgbColor mSpecularColor; 51 RgbColor mAmbientColor; 52 53 Material(); 54 55 Material(int id); 38 Material(); 56 39 57 Material(const RgbColor &color); 58 /** Returns unique material id. 59 */ 60 int GetId() const; 40 Material(int id); 61 41 62 friend Material RandomMaterial(); 42 Material(const RgbaColor &color); 43 /** Returns unique material id. 44 */ 45 int GetId() const; 63 46 64 inline Texture *GetTexture() const { return mTexture; } 47 friend Material RandomMaterial(); 65 48 66 void SetTexture(Texture *texture) { mTexture = texture; } 67 /** Renders this material. 68 */ 69 void Render(); 49 inline Texture *GetTexture() const { return mTexture; } 50 51 void SetTexture(Texture *texture) { mTexture = texture; } 52 /** Renders this material. 53 */ 54 void Render(RenderState *state); 55 56 57 /////////// 58 59 RgbaColor mDiffuseColor; 60 RgbaColor mSpecularColor; 61 RgbaColor mAmbientColor; 62 63 bool mAlphaTestEnabled; 70 64 71 65 protected: … … 74 68 */ 75 69 void InitMaterial(); 70 71 //////////////// 76 72 77 73 /// unique material id
Note: See TracChangeset
for help on using the changeset viewer.