Ignore:
Timestamp:
06/18/08 04:08:41 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/CHC_revisited/Material.h

    r2768 r2769  
    77 
    88class Texture; 
     9class RenderState; 
    910 
    10 class RgbColor  
     11 
     12class RgbaColor  
    1113{ 
    1214 
    1315public: 
    1416 
    15   float r, g, b; 
     17        float r, g, b, a; 
    1618 
    17   RgbColor(): r(0.5f), g(0.5f), b(0.5f) 
    18   { 
    19   } 
     19        RgbaColor(): r(1), g(1), b(1), a(1) 
     20        {} 
    2021 
    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        {} 
    2424 
    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); 
    3326}; 
    3427 
    3528 
    3629// Forward declarations 
    37 RgbColor RandomColor(const float a, const float b); 
     30RgbaColor RandomColor(float a, float b); 
    3831 
    39 // Mapping from interval 0.0-1.0 to RGB using "rainbow" color map 
    40 // (range of hue from 0-240) 
    41 RgbColor RainbowColorMapping(const float value); 
    4232 
    43    
    4433 
    4534class Material  
     
    4736public: 
    4837 
    49   RgbColor mDiffuseColor; 
    50   RgbColor mSpecularColor; 
    51   RgbColor mAmbientColor; 
    52    
    53   Material(); 
    54    
    55   Material(int id); 
     38        Material(); 
    5639 
    57   Material(const RgbColor &color); 
    58   /** Returns unique material id. 
    59   */ 
    60   int GetId() const; 
     40        Material(int id); 
    6141 
    62   friend Material RandomMaterial(); 
     42        Material(const RgbaColor &color); 
     43        /** Returns unique material id. 
     44        */ 
     45        int GetId() const; 
    6346 
    64   inline Texture *GetTexture() const { return mTexture; } 
     47        friend Material RandomMaterial(); 
    6548 
    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; 
    7064 
    7165protected: 
     
    7468        */ 
    7569        void InitMaterial(); 
     70 
     71        //////////////// 
    7672 
    7773        /// unique material id 
Note: See TracChangeset for help on using the changeset viewer.