- Timestamp:
- May 24, 2006, 4:56:48 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
r7814 r7816 26 26 27 27 MappedWater::MappedWater(const TiXmlElement* root) 28 : texture(GL_TEXTURE_2D)29 28 { 30 29 this->setClassID(CL_MAPPED_WATER, "MappedWater"); … … 61 60 mat.select(); 62 61 glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0)); 63 printf("========= CREATE %d\n", this->texture.getTexture());64 62 65 63 // Create the texture and store it on the video card … … 120 118 121 119 122 /*// Shader init120 // Shader init 123 121 //this->shader->activateShader(); 124 GLint uniform;122 //GLint uniform; 125 123 126 124 // Set the variable "reflection" to correspond to the first texture unit 127 uniform = glGetUniformLocationARB(shader->getProgram(), "reflection");128 glUniform1iARB(uniform, 0); //second paramter is the texture unit125 //uniform = glGetUniformLocationARB(shader->getProgram(), "reflection"); 126 //glUniform1iARB(uniform, 0); //second paramter is the texture unit 129 127 130 128 // Set the variable "refraction" to correspond to the second texture unit … … 138 136 139 137 // Set the variable "dudvMap" to correspond to the fourth texture unit 140 uniform = glGetUniformLocationARB(shader->getProgram(), "dudvMap");141 glUniform1iARB(uniform, 3);138 //uniform = glGetUniformLocationARB(shader->getProgram(), "dudvMap"); 139 //glUniform1iARB(uniform, 3); 142 140 143 141 // Set the variable "depthMap" to correspond to the fifth texture unit … … 147 145 148 146 // Give the variable "waterColor" a blue color 149 uniform = glGetUniformLocationARB(shader->getProgram(), "waterColor");150 glUniform4fARB(uniform, 0.1f, 0.2f, 0.4f, 1.0f);147 //uniform = glGetUniformLocationARB(shader->getProgram(), "waterColor"); 148 //glUniform4fARB(uniform, 0.1f, 0.2f, 0.4f, 1.0f); 151 149 152 150 // FIXME set camera and light information … … 155 153 // Store the camera position in a variable 156 154 //CVector3 vPosition = g_Camera.Position(); 157 Vector vPosition(50.0f, 50.0f, 50.0f);155 //Vector vPosition(50.0f, 50.0f, 50.0f); 158 156 159 157 // Give the variable "lightPos" our hard coded light position 160 uniform = glGetUniformLocationARB(shader->getProgram(), "lightPos");161 glUniform4fARB(uniform, lightPos.x, lightPos.y, lightPos.z, 1.0f);158 //uniform = glGetUniformLocationARB(shader->getProgram(), "lightPos"); 159 //glUniform4fARB(uniform, lightPos.x, lightPos.y, lightPos.z, 1.0f); 162 160 163 161 // Give the variable "cameraPos" our camera position 164 uniform = glGetUniformLocationARB(shader->getProgram(), "cameraPos");165 glUniform4fARB(uniform, vPosition.x, vPosition.y, vPosition.z, 1.0f);166 */ 162 //uniform = glGetUniformLocationARB(shader->getProgram(), "cameraPos"); 163 //glUniform4fARB(uniform, vPosition.x, vPosition.y, vPosition.z, 1.0f); 164 167 165 glBegin(GL_QUADS); 168 166 glNormal3f(0, 1, 0); … … 172 170 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); 173 171 glMultiTexCoord2f(GL_TEXTURE4, 0, 0); 174 glVertex3f( -500, 0, 500);172 glVertex3f(0, 0, 0); 175 173 176 174 glMultiTexCoord2f(GL_TEXTURE0, 1, 0); … … 179 177 glMultiTexCoord2f(GL_TEXTURE3, 1, 0); 180 178 glMultiTexCoord2f(GL_TEXTURE4, 1, 0); 181 glVertex3f( 500, 0, 500);179 glVertex3f(0, 0, 1000); 182 180 183 181 glMultiTexCoord2f(GL_TEXTURE0, 1, 1); … … 186 184 glMultiTexCoord2f(GL_TEXTURE3, 1, 1); 187 185 glMultiTexCoord2f(GL_TEXTURE4, 1, 1); 188 glVertex3f( 500, 0, -500);186 glVertex3f(1000, 0, 1000); 189 187 190 188 glMultiTexCoord2f(GL_TEXTURE0, 0, 1); … … 193 191 glMultiTexCoord2f(GL_TEXTURE3, 0, 1); 194 192 glMultiTexCoord2f(GL_TEXTURE4, 0, 1); 195 glVertex3f( -500, 0, -500);193 glVertex3f(1000, 0, 0); 196 194 glEnd(); 197 //this->shader->deactivateShader(); 195 196 this->shader->deactivateShader(); 198 197 199 198 glPopMatrix(); … … 277 276 278 277 glPopAttrib(); 279 280 278 } 281 279 -
branches/water/src/world_entities/environments/mapped_water.h
r7796 r7816 37 37 Material mat; 38 38 39 Texture texture;40 39 int textureSize; //!< size of the texture 41 40 Shader* shader;
Note: See TracChangeset
for help on using the changeset viewer.