Changeset 8636 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h
- Timestamp:
- Jun 20, 2006, 3:42:03 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h
r8495 r8636 15 15 #include "shader.h" 16 16 17 class CloudEffect : public WeatherEffect { 17 #define MAXB 0x100 18 #define N 0x1000 19 #define NP 12 /* 2^N */ 20 #define NM 0xfff 21 22 #define s_curve(t) ( t * t * (3. - 2. * t) ) 23 #define lerp(t, a, b) ( a + t * (b - a) ) 24 #define setup(i,b0,b1,r0,r1)\ 25 t = vec[i] + N;\ 26 b0 = ((int)t) & BM;\ 27 b1 = (b0+1) & BM;\ 28 r0 = t - (int)t;\ 29 r1 = r0 - 1.; 30 #define at2(rx,ry) ( rx * q[0] + ry * q[1] ) 31 #define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] ) 32 33 class CloudEffect : public WeatherEffect 34 { 18 35 public: 19 20 36 CloudEffect(const TiXmlElement* root = NULL); 37 virtual ~CloudEffect(); 21 38 22 39 virtual void loadParams(const TiXmlElement* root); 23 40 24 41 virtual void init(); 25 42 26 27 43 virtual void activate(); 44 virtual void deactivate(); 28 45 29 inline void activateCloud() { 30 this->activate(); 31 } 32 inline void deactivateCloud() { 33 this->deactivate(); 34 } 46 inline void activateCloud() 47 { 48 this->activate(); 49 } 50 inline void deactivateCloud() 51 { 52 this->deactivate(); 53 } 35 54 36 37 55 virtual void draw() const; 56 virtual void tick(float dt); 38 57 39 /*inline void setCloudOption(const std::string& option) { 40 if (option == "activate") 41 this->cloudActivate = true; 42 }*/ 58 void make3DNoiseTexture(); 59 void initNoise(); 60 void SetNoiseFrequency(int frequency); 61 double noise3(double vec[3]); 62 void normalize2(double v[2]); 63 void normalize3(double v[3]); 64 65 /*inline void setCloudOption(const std::string& option) { 66 if (option == "activate") 67 this->cloudActivate = true; 68 }*/ 43 69 44 70 45 71 private: 46 72 //void initialize(char* fileName); 47 73 48 74 //bool cloudActivate; 49 75 50 Material cloudMaterial; 51 Shader* shader; 76 // Material cloudMaterial; 77 Shader* shader; 78 Shader::Uniform* offset; 79 80 float coor; 81 82 int noise3DTexSize; 83 GLuint noise3DTexName; 84 GLubyte *noise3DTexPtr; 85 86 int p[MAXB + MAXB + 2]; 87 double g3[MAXB + MAXB + 2][3]; 88 double g2[MAXB + MAXB + 2][2]; 89 double g1[MAXB + MAXB + 2]; 90 91 int start; 92 int B; 93 int BM; 52 94 }; 53 95
Note: See TracChangeset
for help on using the changeset viewer.