[1883] | 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 | |
---|
[2036] | 13 | ### File Specific |
---|
| 14 | main-programmer: Patrick Boenzli |
---|
| 15 | co-programmer: |
---|
[1883] | 16 | */ |
---|
| 17 | |
---|
[2036] | 18 | #include <iostream> |
---|
| 19 | #include <GL/glut.h> |
---|
| 20 | #include <stdlib.h> |
---|
[1883] | 21 | |
---|
[2036] | 22 | #include "data_tank.h" |
---|
| 23 | |
---|
[1883] | 24 | #include "environment.h" |
---|
| 25 | |
---|
| 26 | using namespace std; |
---|
| 27 | |
---|
| 28 | |
---|
[2036] | 29 | //Sorry Bensch |
---|
| 30 | #define LEVEL_LENGTH 500 |
---|
[1942] | 31 | |
---|
[1883] | 32 | Environment::Environment () |
---|
[2036] | 33 | : WorldEntity() |
---|
[1883] | 34 | { |
---|
| 35 | |
---|
[2036] | 36 | /* |
---|
| 37 | //Sorry Bensch: x,y = 10 |
---|
| 38 | for (int x = 0; x < 50; x++) |
---|
[1917] | 39 | { |
---|
[2036] | 40 | for (int y = 0; y < 50; y++) |
---|
[1917] | 41 | { |
---|
[2036] | 42 | mountainTest[x][y] =0; |
---|
[1917] | 43 | |
---|
| 44 | } |
---|
| 45 | } |
---|
[2036] | 46 | //Sorry Bensch: x,y = 9 |
---|
| 47 | for (int x = 1; x < LEVEL_LENGTH; x++) |
---|
[1883] | 48 | { |
---|
[2036] | 49 | for (int y = 1; y < LEVEL_LENGTH; y++) |
---|
[1883] | 50 | { |
---|
[2036] | 51 | //mountainTest[x][y] = (float)random() / 900000000; |
---|
| 52 | mountainTest[x][y] = (float)(random() % 4); |
---|
[1883] | 53 | } |
---|
| 54 | } |
---|
[2036] | 55 | */ |
---|
[1883] | 56 | } |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | Environment::~Environment () {} |
---|
| 61 | |
---|
| 62 | |
---|
[2036] | 63 | void Environment::paint() |
---|
[1883] | 64 | { |
---|
[2036] | 65 | /* |
---|
[1883] | 66 | glPushMatrix(); |
---|
| 67 | //glScalef(0.5, 0.5, 1.0); |
---|
| 68 | //glTranslatef(xCor, yCor, zCor); |
---|
| 69 | glTranslatef( -16.0, -2.0, 0.0); |
---|
| 70 | |
---|
| 71 | glColor3f(0.0, 1.0, 0.0); |
---|
| 72 | |
---|
| 73 | glBegin(GL_LINES); |
---|
[2036] | 74 | for (int x = 0; x < LEVEL_LENGTH; x += 1) |
---|
[1883] | 75 | { |
---|
[2036] | 76 | for (int y = 0; y < 190; y += 1) |
---|
[1883] | 77 | { |
---|
| 78 | glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); |
---|
| 79 | glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]); |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | glEnd(); |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | glBegin(GL_LINES); |
---|
[2036] | 86 | for (int y = 0; y < LEVEL_LENGTH; y += 1) |
---|
[1883] | 87 | { |
---|
[2036] | 88 | for (int x = 0; x < 90; x += 1) |
---|
[1883] | 89 | { |
---|
| 90 | glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); |
---|
| 91 | glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]); |
---|
| 92 | } |
---|
| 93 | } |
---|
| 94 | glEnd(); |
---|
| 95 | |
---|
| 96 | glPopMatrix(); |
---|
[2036] | 97 | */ |
---|
[1883] | 98 | } |
---|
| 99 | |
---|
[2036] | 100 | void Environment::drawEnvironment() |
---|
| 101 | { |
---|
| 102 | |
---|
| 103 | } |
---|
| 104 | |
---|