Changeset 6727 in orxonox.OLD for branches/height_map_merge/src/world_entities
- Timestamp:
- Jan 25, 2006, 5:46:16 PM (19 years ago)
- Location:
- branches/height_map_merge/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/height_map_merge/src/world_entities/terrain.cc
r6603 r6727 30 30 31 31 #include "glincl.h" 32 33 #include "state.h" 32 34 33 35 using namespace std; … … 154 156 155 157 this->heightMap = new HeightMap(hmName, hmColorName); 156 heightMap->scale(Vector(23.0f, 3.5f,23.0f));157 heightMap->s hift(Vector(-1000.0,-90.0,-4000.0));158 heightMap->scale(Vector(23.0f,1.1f,23.0f)); 159 heightMap->setAbsCoor(this->getAbsCoor()); 158 160 heightMap->load(); 159 161 delete[] hmName; … … 166 168 { 167 169 if (this->heightMapMaterial != NULL) 168 delete this->heightMapMaterial;170 delete this->heightMapMaterial; 169 171 170 172 … … 214 216 void Terrain::draw () const 215 217 { 218 219 220 216 221 glMatrixMode(GL_MODELVIEW); 217 222 glPushMatrix(); 218 223 219 224 /* translate */ 220 glTranslatef (this->getAbsCoor ().x,225 /* glTranslatef (this->getAbsCoor ().x, 221 226 this->getAbsCoor ().y, 222 227 this->getAbsCoor ().z); 228 */ 223 229 /* rotate */ 224 Vector tmpRot = this->getAbsDir().getSpacialAxis();225 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );230 // Vector tmpRot = this->getAbsDir().getSpacialAxis(); 231 //glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 226 232 227 233 if (this->objectList) … … 237 243 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 238 244 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 239 240 glEnable(GL_LIGHTING); 245 glEnable(GL_LIGHTING); 241 246 glColorMaterial ( GL_FRONT_AND_BACK, GL_EMISSION ) ; 242 247 glEnable (GL_COLOR_MATERIAL) ; … … 245 250 glPopMatrix(); 246 251 247 248 252 glMatrixMode(GL_MODELVIEW); 253 glPushMatrix(); 254 glLoadIdentity(); 255 Vector camera = State::getCamera()->getAbsCoor(); // Go on here ..........!!! 256 float height = heightMap->getHeight(camera.x, camera.z); 257 258 glEnable (GL_COLOR_MATERIAL) ; 259 glBegin(GL_QUADS); // Draw The Cube Using quads 260 glColor3f(0.0f,1.0f,0.0f); // Color Blue 261 glVertex3f(camera.x + 13.0f,height+13.0f,camera.z-13.0f); // Top Right Of The Quad (Top) 262 glVertex3f(camera.x-13.0f, height+13.0f,camera.z-13.0f); // Top Left Of The Quad (Top) 263 glVertex3f(camera.x-13.0f, height+13.0f, camera.z+13.0f); // Bottom Left Of The Quad (Top) 264 glVertex3f(camera.x+ 13.0f, height+13.0f, camera.z+13.0f); // Bottom Right Of The Quad (Top) 265 glEnd(); // End Drawing The Plan 266 267 268 glPopMatrix(); 249 269 /* THIS IS ONLY FOR DEBUGGING INFORMATION */ 250 270 if (this->ssp != NULL) … … 457 477 { 458 478 } 479 480 float Terrain::getHeight(float x, float y) 481 { 482 if(this->heightMap != NULL) 483 return (this->heightMap->getHeight(x, y)); 484 return 0; 485 } -
branches/height_map_merge/src/world_entities/terrain.h
r6495 r6727 46 46 47 47 void buildDebugTerrain(DebugTerrain debugTerrain); 48 49 float getHeight(float x, float y); 48 50 virtual void draw() const; 49 51
Note: See TracChangeset
for help on using the changeset viewer.