Changeset 8788 in orxonox.OLD
- Timestamp:
- Jun 26, 2006, 2:33:26 PM (18 years ago)
- Location:
- branches/water/src/world_entities/environments
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/world_entities/environments/mapped_water.cc
r8729 r8788 45 45 /// initialization of the shaders 46 46 this->initShaders(); 47 48 tempcounter = 0; 47 49 } 48 50 … … 155 157 156 158 /** 159 * @brief resets the waterColor in the Shader 160 * @param r new value for red 161 * @param g new value for green 162 * @param b new value for blue 163 */ 164 void MappedWater::resetWaterColor(float r, float g, float b) 165 { 166 this->shader->activateShader(); 167 this->waterColor = Vector(r, g, b); 168 169 // Give the variable "waterColor" a color 170 color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f); 171 172 this->shader->deactivateShader(); 173 }; 174 175 /** 176 * @brief resets the shininess in the Shader 177 * @param shine new value for the shininess 178 */ 179 void MappedWater::resetShininess(float shine) 180 { 181 this->shader->activateShader(); 182 this->shininess = shine; 183 184 // Set the variable "shine" 185 shine_uni->set(this->shininess); 186 187 this->shader->deactivateShader(); 188 }; 189 190 /** 191 * @brief resets the lightPos in the Shader 192 * @param x new x value 193 * @param y new y value 194 * @param z new z value 195 */ 196 void MappedWater::resetLightPos(float x, float y, float z) 197 { 198 this->shader->activateShader(); 199 this->lightPos = Vector(x, y, z); 200 201 // Give the variable "lightPos" our hard coded light position 202 light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f); 203 204 this->shader->deactivateShader(); 205 }; 206 207 /** 157 208 * @brief ends the refraction and saves the graphic buffer into a texture 158 209 * @param root xml data … … 239 290 this->move += this->waterFlow * dt; 240 291 this->move2 = this->move * this->kNormalMapScale; 292 293 294 if(this->tempcounter == 200) { 295 this->resetWaterColor(1, 0, 0); 296 resetShininess(1); 297 resetLightPos(0, 100, 0); 298 PRINTF(0)("test waterchangecolor "); 299 } 300 tempcounter++; 301 241 302 } 242 303 -
branches/water/src/world_entities/environments/mapped_water.h
r8729 r8788 54 54 void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); }; 55 55 56 // functions to change water parameters during runtime 57 // to reset waterUV and waterFlow just use the normal set functions 58 void resetWaterColor(float r, float g, float b); 59 void resetShininess(float shine); 60 void resetLightPos(float x, float y, float z); 61 56 62 private: 57 63 void initParams(); … … 80 86 Shader::Uniform* color_uni; //!< uniform that is used for the watercolor 81 87 Shader::Uniform* shine_uni; //!< uniform that is used for the specular shininessd of the water 88 89 90 int tempcounter; 82 91 }; 83 92
Note: See TracChangeset
for help on using the changeset viewer.