Changeset 8866 in orxonox.OLD
- Timestamp:
- Jun 28, 2006, 3:55:15 PM (18 years ago)
- Location:
- branches/mountain_lake/src/world_entities/environments
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mountain_lake/src/world_entities/environments/mapped_water.cc
r8859 r8866 61 61 delete color_uni; 62 62 delete light_uni; 63 delete shine_uni; 63 delete shineSize_uni; 64 delete shineStrength_uni; 65 delete refr_uni; 64 66 } 65 67 … … 78 80 this->setNormalMapScale(0.25f); 79 81 this->setWaterColor(0.1f, 0.2f, 0.4f); 80 this->setShininess(128); 82 this->setShineSize(128); 83 this->setShineStrength(0.7); 84 this->setRefraction(0.009f); 81 85 82 86 // initialization of the texture coords, speeds etc... … … 151 155 light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f); 152 156 // Set the variable "shine" 153 shine_uni = new Shader::Uniform(shader, "kShine"); 154 shine_uni->set(this->shininess); 157 shineSize_uni = new Shader::Uniform(shader, "kShine"); 158 shineSize_uni->set(this->shineSize); 159 // Set the variable "shineStrength" 160 shineStrength_uni = new Shader::Uniform(shader, "shineStrength"); 161 shineStrength_uni->set(this->shineStrength); 162 // Set the variable "refraction" 163 refr_uni = new Shader::Uniform(shader, "kRefraction"); 164 refr_uni->set(this->refraction); 155 165 // uniform for the camera position 156 166 cam_uni = new Shader::Uniform(shader, "cameraPos"); … … 189 199 190 200 this->shader->deactivateShader(); 191 } ;201 } 192 202 193 203 /** … … 195 205 * @param shine new value for the shininess 196 206 */ 197 void MappedWater::resetShin iness(float shine)198 { 199 this->shader->activateShader(); 200 this->shin iness= shine;207 void MappedWater::resetShineSize(float shine) 208 { 209 this->shader->activateShader(); 210 this->shineSize = shine; 201 211 202 212 // Set the variable "shine" 203 shine_uni->set(this->shininess); 204 205 this->shader->deactivateShader(); 206 }; 213 shineSize_uni->set(this->shineSize); 214 215 this->shader->deactivateShader(); 216 } 217 218 /** 219 * @brief resets the strength of the specular reflection in the Shader 220 * @param strength new value for the strength of the specular reflection 221 */ 222 void MappedWater::resetShineStrength(float strength) 223 { 224 this->shader->activateShader(); 225 this->shineStrength = strength; 226 227 // Set the variable "shine" 228 shineStrength_uni->set(this->shineStrength); 229 230 this->shader->deactivateShader(); 231 } 232 233 /** 234 * @brief resets the refraction in the Shader 235 * @param refraction new value for the refraction 236 */ 237 void MappedWater::resetRefraction(float refraction) 238 { 239 this->shader->activateShader(); 240 this->refraction = refraction; 241 242 // Set the variable "shine" 243 refr_uni->set(this->refraction); 244 245 this->shader->deactivateShader(); 246 } 207 247 208 248 /** … … 221 261 222 262 this->shader->deactivateShader(); 223 } ;263 } 224 264 225 265 /** … … 239 279 LoadParam(root, "waterangle", this, MappedWater, setWaterAngle); 240 280 LoadParam(root, "watercolor", this, MappedWater, setWaterColor); 241 LoadParam(root, "shininess", this, MappedWater, setShininess); 281 LoadParam(root, "shinesize", this, MappedWater, setShineSize); 282 LoadParam(root, "shinestrength", this, MappedWater, setShineStrength); 283 LoadParam(root, "refraction", this, MappedWater, setRefraction); 242 284 } 243 285 -
branches/mountain_lake/src/world_entities/environments/mapped_water.h
r8859 r8866 12 12 <waterangle>0</waterangle> 13 13 <normalmapscale>0.25</normalmapscale><!-- you won't see a big differnce if you change that --> 14 <shininess>128</shininess><!-- the bigger the value, the smaller the specular reflection point --> 14 <shineSize>128</shineSize><!-- the bigger the value, the smaller the specular reflection point --> 15 <shineStrength>0.7</shineStrength> 16 <refraction>0.009</refraction> 15 17 <watercolor>0.1, 0.2, 0.4</watercolor> 16 18 </MappedWater> … … 51 53 void setWaterFlow(float flow) { this->waterFlow = flow; }; 52 54 void setNormalMapScale(float scale) { this->kNormalMapScale = scale; } 53 void setShininess(float shine) { this->shininess = shine; } 55 void setShineSize(float shine) { this->shineSize = shine; } 56 void setShineStrength(float strength) { this->shineStrength = strength; } 57 void setRefraction(float refraction) { this->refraction = refraction; } 54 58 void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); this->newWaterColor = this->waterColor; } 55 59 … … 57 61 // to reset waterUV and waterFlow just use the normal set functions 58 62 void resetWaterColor(float r, float g, float b); 59 void resetShininess(float shine); 63 void resetShineSize(float shine); 64 void resetShineStrength(float strength); 65 void resetRefraction(float refraction); 60 66 void resetLightPos(float x, float y, float z); 61 67 void resetWaterPos(float x, float y, float z) { this->setWaterPos(x, y, z); this->calcVerts(); } … … 88 94 float normalUV; 89 95 float kNormalMapScale; 90 float shininess; //!< the bigger the value, the smaller the specular reflection point 96 float shineSize; //!< the bigger the value, the smaller the specular reflection point 97 float shineStrength; 98 float refraction; 91 99 92 100 int textureSize; //!< height and width of the texture … … 96 104 Shader::Uniform* light_uni; //!< uniform that is used for the light position 97 105 Shader::Uniform* color_uni; //!< uniform that is used for the watercolor 98 Shader::Uniform* shine_uni; //!< uniform that is used for the specular shininessd of the water 99 106 Shader::Uniform* shineSize_uni; //!< uniform that is used for the specular shininessd of the water 107 Shader::Uniform* shineStrength_uni; //!< uniform that is used for the strenght of the specular reflection 108 Shader::Uniform* refr_uni; //!< uniform that is used for the strength of the refraction 100 109 101 110
Note: See TracChangeset
for help on using the changeset viewer.