/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: ... co-programmer: ... */ #include "environment.h" #include using namespace std; //Sorry Bensch #define LEVEL_LENGTH 500 Environment::Environment () { //Sorry Bensch: x,y = 10 for (int x = 0; x < 50; x++) { for (int y = 0; y < 50; y++) { mountainTest[x][y] =0; } } //Sorry Bensch: x,y = 9 for (int x = 1; x < LEVEL_LENGTH; x++) { for (int y = 1; y < LEVEL_LENGTH; y++) { //mountainTest[x][y] = (float)random() / 900000000; mountainTest[x][y] = (float)(random() % 4); } } } Environment::~Environment () {} void Environment::drawEnvironment() { glPushMatrix(); glEnable(GL_DEPTH_TEST); //glScalef(0.5, 0.5, 1.0); //glTranslatef(xCor, yCor, zCor); glTranslatef( -100.0, -50.0, 0.0); glColor4f(0.0, 0.3, 0.4,1.0); glBegin(GL_LINES); for (int x = 0; x < LEVEL_LENGTH; x += 1) { for (int y = 0; y < 190; y += 1) { glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]); } } glEnd(); glBegin(GL_LINES); for (int y = 0; y < LEVEL_LENGTH; y += 1) { for (int x = 0; x < 90; x += 1) { glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]); } } glEnd(); glPopMatrix(); }