Changeset 7982 in orxonox.OLD for branches/water/src
- Timestamp:
- May 30, 2006, 3:30:47 PM (19 years ago)
- Location:
- branches/water/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/lib/graphics/importer/material.cc
r7788 r7982 107 107 if (unlikely(this == Material::selectedMaterial)) 108 108 return true; 109 else if (likely(Material::selectedMaterial != NULL)) 110 { 111 Material::unselect(); 112 // for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i) 113 // { 114 // glActiveTexture(Material::glTextureArbs[i]); 115 // glBindTexture(GL_TEXTURE_2D, 0); 116 // glDisable(GL_TEXTURE_2D); 117 // } 118 } 109 119 110 120 … … 137 147 else if (this->illumModel >= 2) 138 148 glShadeModel(GL_SMOOTH); 139 140 if (likely(Material::selectedMaterial != NULL))141 {142 for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)143 {144 glActiveTexture(Material::glTextureArbs[i]);145 glBindTexture(GL_TEXTURE_2D, 0);146 glDisable(GL_TEXTURE_2D);147 }148 }149 149 150 150 for(unsigned int i = 0; i < this->textures.size(); ++i) … … 172 172 } 173 173 174 void Material::unselect() 175 { 176 Material::selectedMaterial = NULL; 177 for(unsigned int i = 0; i < 8; ++i) 178 { 179 glActiveTexture(Material::glTextureArbs[i]); 180 glBindTexture(GL_TEXTURE_2D, 0); 181 glDisable(GL_TEXTURE_2D); 182 } 183 } 184 174 185 /** 175 186 * Sets the Material Illumination Model. -
branches/water/src/lib/graphics/importer/material.h
r7788 r7982 32 32 33 33 bool select () const; 34 static void unselect(); 34 35 35 36 void setIllum (int illum); -
branches/water/src/lib/graphics/shader.h
r7835 r7982 23 23 { 24 24 public: 25 Uniform(const Shader* shader, const std::string& location) { glGetUniformLocationARB(shader->getProgram(), location.c_str()) ; }26 Uniform(const Shader& shader, const std::string& location) { glGetUniformLocation(shader.getProgram(), location.c_str()) ; };27 Uniform(GLhandleARB shaderProgram, const std::string& location) { glGetUniformLocation(shaderProgram, location.c_str()) ; };25 Uniform(const Shader* shader, const std::string& location) { this->uniform = glGetUniformLocationARB(shader->getProgram(), location.c_str()) ; } 26 Uniform(const Shader& shader, const std::string& location) { this->uniform = glGetUniformLocation(shader.getProgram(), location.c_str()) ; }; 27 Uniform(GLhandleARB shaderProgram, const std::string& location) { this->uniform = glGetUniformLocation(shaderProgram, location.c_str()) ; }; 28 28 29 29 void set(float v0) const { glUniform1f(this->uniform, v0); } -
branches/water/src/world_entities/environments/mapped_water.cc
r7832 r7982 39 39 mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 0); 40 40 // load refraction texture 41 mat.setDiffuseMap("pictures/sky-replace.jpg", 1);41 // mat.setDiffuseMap("pictures/sky-replace.jpg", 1); 42 42 // load normal map 43 43 mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2); … … 123 123 // HACK 124 124 125 glDisable(GL_BLEND);126 125 //glActiveTexture(GL_TEXTURE0); 127 126 //glBindTexture(GL_TEXTURE_2D, this->texture); 128 127 mat.unselect(); 129 128 mat.select(); 130 glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));129 //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0)); 131 130 132 131 … … 134 133 this->shader->activateShader(); 135 134 GLint uniform; 135 Shader::Uniform* uni; 136 136 137 137 // Set the variable "reflection" to correspond to the first texture unit 138 uniform = glGetUniformLocationARB(shader->getProgram(), "reflection"); 139 glUniform1iARB(uniform, 0); //second paramter is the texture unit 138 uni = new Shader::Uniform (shader, "reflection"); 139 uni->set(0); 140 //uniform = glGetUniformLocationARB(shader->getProgram(), "reflection"); 141 //glUniform1iARB(uniform, 0); //second paramter is the texture unit 140 142 141 143 // Set the variable "refraction" to correspond to the second texture unit 142 uniform = glGetUniformLocationARB(shader->getProgram(), "refraction"); 143 glUniform1iARB(uniform, 1); 144 // uni = new Shader::Uniform (shader, "refraction"); 145 // uni->set(1); 146 //uniform = glGetUniformLocationARB(shader->getProgram(), "refraction"); 147 //glUniform1iARB(uniform, 1); 144 148 145 149 // Set the variable "normalMap" to correspond to the third texture unit 146 uniform = glGetUniformLocationARB(shader->getProgram(), "normalMap"); 147 glUniform1iARB(uniform, 2); 150 uni = new Shader::Uniform (shader, "normalMap"); 151 uni->set(2); 152 //uniform = glGetUniformLocationARB(shader->getProgram(), "normalMap"); 153 //glUniform1iARB(uniform, 2); 148 154 149 155 // Set the variable "dudvMap" to correspond to the fourth texture unit 150 uniform = glGetUniformLocationARB(shader->getProgram(), "dudvMap"); 151 glUniform1iARB(uniform, 3); 156 uni = new Shader::Uniform (shader, "dudvMap"); 157 uni->set(3); 158 //uniform = glGetUniformLocationARB(shader->getProgram(), "dudvMap"); 159 //glUniform1iARB(uniform, 3); 152 160 153 161 // Set the variable "depthMap" to correspond to the fifth texture unit 154 uniform = glGetUniformLocationARB(shader->getProgram(), "depthMap"); 155 glUniform1iARB(uniform, 4); 162 // uni = new Shader::Uniform (shader, "depthMap"); 163 // uni->set(4); 164 //uniform = glGetUniformLocationARB(shader->getProgram(), "depthMap"); 165 //glUniform1iARB(uniform, 4); 156 166 // FIXME we dont have a depthMap yet :-( 157 167 … … 177 187 178 188 179 float move2 = this->move * this->kNormalMapScale; 180 float refrUV = this->g_WaterUV; 181 float normalUV = this->g_WaterUV * this->kNormalMapScale; 189 182 190 183 191 … … 219 227 220 228 229 Material::unselect(); 230 221 231 glPopMatrix(); 222 232 } … … 225 235 { 226 236 this->move += this->g_WaterFlow = 0.004; 237 this->move2 = this->move * this->kNormalMapScale; 238 this->refrUV = this->g_WaterUV; 239 this->normalUV = this->g_WaterUV * this->kNormalMapScale; 227 240 } 228 241 -
branches/water/src/world_entities/environments/mapped_water.h
r7823 r7982 40 40 float kNormalMapScale; 41 41 float g_WaterFlow; 42 float move2; 43 float refrUV; 44 float normalUV; 42 45 43 46 int textureSize; //!< size of the texture
Note: See TracChangeset
for help on using the changeset viewer.