|
Last change
on this file since 8053 was
8052,
checked in by amaechler, 19 years ago
|
|
branches/atmospheric_engine: sound now with gain control, new cloud thoughts / todo..maaaan
|
|
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 Material; |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | class CloudEffect : public WeatherEffect |
|---|
| 20 | { |
|---|
| 21 | public: |
|---|
| 22 | CloudEffect(const TiXmlElement* root = NULL); |
|---|
| 23 | virtual ~CloudEffect(); |
|---|
| 24 | |
|---|
| 25 | virtual void loadParams(const TiXmlElement* root); |
|---|
| 26 | |
|---|
| 27 | virtual bool init(); |
|---|
| 28 | |
|---|
| 29 | virtual bool activate(); |
|---|
| 30 | virtual bool deactivate(); |
|---|
| 31 | |
|---|
| 32 | virtual void draw() const; |
|---|
| 33 | virtual void tick(float dt); |
|---|
| 34 | |
|---|
| 35 | inline void setCloudAnimation(float timestep) { this->cloudAnimTimeStep = timestep; } |
|---|
| 36 | |
|---|
| 37 | private: |
|---|
| 38 | // Basic noise maps 32x32 |
|---|
| 39 | float cloudMap32_a[32 * 32]; |
|---|
| 40 | float cloudMap32_b[32 * 32]; |
|---|
| 41 | float cloudMap32_c[32 * 32]; |
|---|
| 42 | |
|---|
| 43 | // The cloud map 256x256 |
|---|
| 44 | float cloudMap256[256 * 256]; |
|---|
| 45 | |
|---|
| 46 | // Temporary array to hold texture RGB values |
|---|
| 47 | char cloudTexture[256][256][3]; |
|---|
| 48 | |
|---|
| 49 | GLuint texID[2]; |
|---|
| 50 | float timer; |
|---|
| 51 | |
|---|
| 52 | bool cloudAnimTimeStep; |
|---|
| 53 | |
|---|
| 54 | float noise(int x, int y, int random); |
|---|
| 55 | float interpolate(float x, float y, float *map); |
|---|
| 56 | void overlapOctaves(); |
|---|
| 57 | void expFilter(); |
|---|
| 58 | |
|---|
| 59 | void genNoiseMap(float *map); |
|---|
| 60 | void genCloudTexture(); |
|---|
| 61 | void calcAnimMap(float timer); |
|---|
| 62 | Material* material; |
|---|
| 63 | |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | #endif /* _CLOUD_EFFECT */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.