| Last change
                  on this file since 8093 was
                  7810,
                  checked in by bensch, 19 years ago | 
        
          | 
orxonox/trunk: merged the Weather effects back here 
 | 
        | File size:
            1.4 KB | 
      
      
        
  | Line |  | 
|---|
| 1 | /** | 
|---|
| 2 | * @file cloud_effect.h | 
|---|
| 3 | */ | 
|---|
| 4 |  | 
|---|
| 5 | #ifndef _CLOUD_EFFECT | 
|---|
| 6 | #define _CLOUD_EFFECT | 
|---|
| 7 |  | 
|---|
| 8 | #include "vector.h" | 
|---|
| 9 | #include "vector2D.h" | 
|---|
| 10 |  | 
|---|
| 11 | #include "weather_effect.h" | 
|---|
| 12 |  | 
|---|
| 13 | #include "sound_buffer.h" | 
|---|
| 14 | #include "sound_source.h" | 
|---|
| 15 |  | 
|---|
| 16 | class CloudEffect : public WeatherEffect | 
|---|
| 17 | { | 
|---|
| 18 | public: | 
|---|
| 19 | CloudEffect(const TiXmlElement* root = NULL); | 
|---|
| 20 | virtual ~CloudEffect(); | 
|---|
| 21 |  | 
|---|
| 22 | virtual void loadParams(const TiXmlElement* root); | 
|---|
| 23 |  | 
|---|
| 24 | virtual bool init(); | 
|---|
| 25 |  | 
|---|
| 26 | virtual bool activate(); | 
|---|
| 27 | virtual bool deactivate(); | 
|---|
| 28 |  | 
|---|
| 29 | virtual void draw() const; | 
|---|
| 30 | virtual void tick(float dt); | 
|---|
| 31 |  | 
|---|
| 32 | inline void setCloudAnimation(float timestep) { this->cloudAnimTimeStep = timestep; } | 
|---|
| 33 |  | 
|---|
| 34 | private: | 
|---|
| 35 | // Basic noise maps 32x32 | 
|---|
| 36 | float                                                                                                           cloudMap32_a[32 * 32]; | 
|---|
| 37 | float                                                                                                           cloudMap32_b[32 * 32]; | 
|---|
| 38 | float                                                                                                           cloudMap32_c[32 * 32]; | 
|---|
| 39 |  | 
|---|
| 40 | // The cloud map 256x256 | 
|---|
| 41 | float                                                                                                           cloudMap256[256 * 256]; | 
|---|
| 42 |  | 
|---|
| 43 | // Temporary array to hold texture RGB values | 
|---|
| 44 | char                                                                                                                    cloudTexture[256][256][3]; | 
|---|
| 45 |  | 
|---|
| 46 | GLuint                                                                                                          texID[2]; | 
|---|
| 47 | float                                                                                                           timer; | 
|---|
| 48 |  | 
|---|
| 49 | bool                                                                                                                    cloudAnimTimeStep; | 
|---|
| 50 |  | 
|---|
| 51 | float                                                                                                           noise(int x, int y, int random); | 
|---|
| 52 | float                                                                                                           interpolate(float x, float y, float  *map); | 
|---|
| 53 | void                                                                                                            overlapOctaves(); | 
|---|
| 54 | void                                                                                                            expFilter(); | 
|---|
| 55 |  | 
|---|
| 56 | void                                                                                                            genNoiseMap(float  *map); | 
|---|
| 57 | void                                                                                                            genCloudTexture(); | 
|---|
| 58 | void                                                                                                            calcAnimMap(float timer); | 
|---|
| 59 |  | 
|---|
| 60 | }; | 
|---|
| 61 |  | 
|---|
| 62 | #endif  /* _CLOUD_EFFECT */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.