| 1 |  | 
|---|
| 2 |  | 
|---|
| 3 | /*  | 
|---|
| 4 |    orxonox - the future of 3D-vertical-scrollers | 
|---|
| 5 |  | 
|---|
| 6 |    Copyright (C) 2004 orx | 
|---|
| 7 |  | 
|---|
| 8 |    This program is free software; you can redistribute it and/or modify | 
|---|
| 9 |    it under the terms of the GNU General Public License as published by | 
|---|
| 10 |    the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 11 |    any later version. | 
|---|
| 12 |  | 
|---|
| 13 |    ### File Specific: | 
|---|
| 14 |    main-programmer: ... | 
|---|
| 15 |    co-programmer: ... | 
|---|
| 16 | */ | 
|---|
| 17 |  | 
|---|
| 18 |  | 
|---|
| 19 | #include "environment.h" | 
|---|
| 20 | #include <iostream> | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 | using namespace std; | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 |  | 
|---|
| 27 | Environment::Environment ()  | 
|---|
| 28 | { | 
|---|
| 29 |  | 
|---|
| 30 |   for (int x = 1; x < 9; x++) | 
|---|
| 31 |     { | 
|---|
| 32 |       for (int y = 1; y < 9; y++) | 
|---|
| 33 |         { | 
|---|
| 34 |           mountainTest[x][y] = (float)random() / 900000000; | 
|---|
| 35 |                                                   | 
|---|
| 36 |         } | 
|---|
| 37 |     } | 
|---|
| 38 | } | 
|---|
| 39 |  | 
|---|
| 40 |  | 
|---|
| 41 |  | 
|---|
| 42 | Environment::~Environment () {} | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 | void Environment::drawEnvironment()  | 
|---|
| 47 | { | 
|---|
| 48 |   glPushMatrix(); | 
|---|
| 49 |   //glScalef(0.5, 0.5, 1.0); | 
|---|
| 50 |   //glTranslatef(xCor, yCor, zCor); | 
|---|
| 51 |   glTranslatef( -16.0, -2.0, 0.0); | 
|---|
| 52 |    | 
|---|
| 53 |   glColor3f(0.0, 1.0, 0.0); | 
|---|
| 54 |    | 
|---|
| 55 |   glBegin(GL_LINES); | 
|---|
| 56 |   for (int x = 0; x < 10; x += 1) | 
|---|
| 57 |     { | 
|---|
| 58 |       for (int y = 0; y < 10; y += 1) | 
|---|
| 59 |         { | 
|---|
| 60 |           glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); | 
|---|
| 61 |           glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]); | 
|---|
| 62 |         } | 
|---|
| 63 |     } | 
|---|
| 64 |   glEnd(); | 
|---|
| 65 |    | 
|---|
| 66 |    | 
|---|
| 67 |   glBegin(GL_LINES); | 
|---|
| 68 |   for (int y = 0; y < 10; y += 1) | 
|---|
| 69 |     { | 
|---|
| 70 |       for (int x = 0; x < 10; x += 1) | 
|---|
| 71 |         { | 
|---|
| 72 |           glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); | 
|---|
| 73 |           glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]); | 
|---|
| 74 |         } | 
|---|
| 75 |     } | 
|---|
| 76 |   glEnd(); | 
|---|
| 77 |    | 
|---|
| 78 |   glPopMatrix(); | 
|---|
| 79 | } | 
|---|
| 80 |  | 
|---|