Changeset 8911 in orxonox.OLD for branches/mountain_lake/src/lib/graphics/effects/cloud_effect.h
- Timestamp:
- Jun 29, 2006, 4:07:09 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.h
r8902 r8911 1 1 /** 2 2 * @file cloud_effect.h 3 * Create sclouds3 * Create clouds 4 4 */ 5 5 … … 33 33 34 34 // FORWARD DECLARATION 35 template <class T> class tAnimation; 35 template <class T> 36 class tAnimation; 36 37 38 class CloudEffect : public WeatherEffect { 37 39 38 class CloudEffect : public WeatherEffect39 {40 40 public: 41 CloudEffect(const TiXmlElement* root = NULL);42 virtual ~CloudEffect();43 41 44 virtual void loadParams(const TiXmlElement* root); 42 CloudEffect(const TiXmlElement* root = NULL); 43 virtual ~CloudEffect(); 45 44 46 virtual void init();45 virtual void loadParams(const TiXmlElement* root); 47 46 48 virtual void activate(); 49 virtual void deactivate(); 47 virtual void init(); 50 48 51 inline void activateCloud()52 { this->activate(); }49 virtual void activate(); 50 virtual void deactivate(); 53 51 54 inline void deactivateCloud() 55 { this->deactivate(); } 52 inline void activateCloud() { 53 this->activate(); 54 } 56 55 57 inline void setCloudOption(const std::string& option) 58 { 59 if (option == "activate") 60 this->cloudActivate = true; 61 } 56 inline void deactivateCloud() { 57 this->deactivate(); 58 } 62 59 63 inline void setAnimationSpeed(float speed) 64 { this->animationSpeed = speed; } 60 inline void setCloudOption(const std::string& option) { 61 if (option == "activate") 62 this->cloudActivate = true; 63 } 65 64 66 inline void setCloudScale(float scale) 67 { this->scale = scale; } 65 inline void setAnimationSpeed(float speed) { 66 this->animationSpeed = speed; 67 } 68 68 69 inline void setCloudColor(float colorX, float colorY, float colorZ) 70 { this->cloudColor = Vector(colorX, colorY, colorZ); } 69 inline void setCloudScale(float scale) { 70 this->scale = scale; 71 } 71 72 72 inline void setSkyColor(float colorX, float colorY, float colorZ) 73 { this->skyColor = Vector(colorX, colorY, colorZ); } 73 inline void setCloudColor(float colorX, float colorY, float colorZ) { 74 this->cloudColor = Vector(colorX, colorY, colorZ); 75 } 74 76 75 inline void setPlanetRadius(float planetRadius) 76 { this->planetRadius = planetRadius; } 77 inline void setSkyColor(float colorX, float colorY, float colorZ) { 78 this->skyColor = Vector(colorX, colorY, colorZ); 79 } 77 80 78 inline void setAtmosphericRadius(float atmosphericRadius) 79 { this->atmosphericRadius = atmosphericRadius; } 81 inline void setPlanetRadius(float planetRadius) { 82 this->planetRadius = planetRadius; 83 } 80 84 81 inline void setDivisions(int divs) 82 { this->divs = divs; } 85 inline void setAtmosphericRadius(float atmosphericRadius) { 86 this->atmosphericRadius = atmosphericRadius; 87 } 83 88 84 virtual void draw() const; 85 virtual void tick(float dt); 89 inline void setDivisions(int divs) { 90 this->divs = divs; 91 } 86 92 87 static void changeSkyColor(Vector color, float time); 88 static void changeCloudColor(Vector color, float time); 89 90 void setColorSkyX(float color); 91 void setColorSkyY(float color); 92 void setColorSkyZ(float color); 93 void setColorCloudX(float color); 94 void setColorCloudY(float color); 95 void setColorCloudZ(float color); 96 97 static Vector cloudColor; 98 static Vector skyColor; 93 virtual void draw() const; 94 virtual void tick(float dt); 99 95 100 void make3DNoiseTexture(); 101 void initNoise(); 102 void SetNoiseFrequency(int frequency); 103 double noise3(double vec[3]); 104 void normalize2(double v[2]); 105 void normalize3(double v[3]); 96 static void changeSkyColor(Vector color, float time); 97 static void changeCloudColor(Vector color, float time); 106 98 107 void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius, 108 float hTile, float vTile); 109 110 void shellSkyColor(float colorX, float colorY, float colorZ, float time); 111 void shellCloudColor(float colorX, float colorY, float colorZ, float time); 112 99 void setColorSkyX(float color); 100 void setColorSkyY(float color); 101 void setColorSkyZ(float color); 102 void setColorCloudX(float color); 103 void setColorCloudY(float color); 104 void setColorCloudZ(float color); 105 106 static Vector cloudColor; 107 static Vector skyColor; 108 109 void make3DNoiseTexture(); 110 void initNoise(); 111 void SetNoiseFrequency(int frequency); 112 double noise3(double vec[3]); 113 void normalize2(double v[2]); 114 void normalize3(double v[3]); 115 116 void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius, 117 float hTile, float vTile); 118 119 void shellSkyColor(float colorX, float colorY, float colorZ, float time); 120 void shellCloudColor(float colorX, float colorY, float colorZ, float time); 121 122 static void flashSky(float time); 123 113 124 private: 114 125 115 bool cloudActivate; 116 float animationSpeed; 117 118 static Vector newSkyColor; 119 static Vector newCloudColor; 126 bool cloudActivate; 127 float animationSpeed; 120 128 121 // Material cloudMaterial; 122 Skydome* skydome; 123 124 tAnimation<CloudEffect>* skyColorFadeX; 125 tAnimation<CloudEffect>* skyColorFadeY; 126 tAnimation<CloudEffect>* skyColorFadeZ; 127 tAnimation<CloudEffect>* cloudColorFadeX; 128 tAnimation<CloudEffect>* cloudColorFadeY; 129 tAnimation<CloudEffect>* cloudColorFadeZ; 130 static bool fadeSky; 131 static bool fadeCloud; 132 static float fadeTime; 129 static Vector newSkyColor; 130 static Vector newCloudColor; 133 131 134 // SHADER STUFF 135 Shader* shader; 136 Shader::Uniform* offset; 137 Shader::Uniform* skycolor; 138 Shader::Uniform* cloudcolor; 139 float offsetZ; 140 float scale; 141 float planetRadius; 142 float atmosphericRadius; 143 int divs; 132 // Material cloudMaterial; 133 Skydome* skydome; 144 134 145 // NOISE STUFF 146 int noise3DTexSize; 147 GLuint noise3DTexName; 148 GLubyte *noise3DTexPtr; 135 tAnimation<CloudEffect>* skyColorFadeX; 136 tAnimation<CloudEffect>* skyColorFadeY; 137 tAnimation<CloudEffect>* skyColorFadeZ; 138 tAnimation<CloudEffect>* cloudColorFadeX; 139 tAnimation<CloudEffect>* cloudColorFadeY; 140 tAnimation<CloudEffect>* cloudColorFadeZ; 141 static bool fadeSky; 142 static bool fadeCloud; 143 static float fadeTime; 149 144 150 int p[MAXB + MAXB + 2]; 151 double g3[MAXB + MAXB + 2][3]; 152 double g2[MAXB + MAXB + 2][2]; 153 double g1[MAXB + MAXB + 2]; 145 // SHADER STUFF 146 Shader* shader; 147 Shader::Uniform* offset; 148 Shader::Uniform* skycolor; 149 Shader::Uniform* cloudcolor; 150 float offsetZ; 151 float scale; 152 float planetRadius; 153 float atmosphericRadius; 154 int divs; 154 155 155 int start; 156 int B; 157 int BM; 156 // NOISE STUFF 157 int noise3DTexSize; 158 GLuint noise3DTexName; 159 GLubyte *noise3DTexPtr; 160 161 int p[MAXB + MAXB + 2]; 162 double g3[MAXB + MAXB + 2][3]; 163 double g2[MAXB + MAXB + 2][2]; 164 double g1[MAXB + MAXB + 2]; 165 166 int start; 167 int B; 168 int BM; 169 170 static bool flashSkyActivate; 171 static float localTimer; 172 static float flashTime; 173 158 174 }; 159 175
Note: See TracChangeset
for help on using the changeset viewer.