[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 | |
---|
| 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 | |
---|
[1942] | 26 | |
---|
[1883] | 27 | Environment::Environment () |
---|
| 28 | { |
---|
| 29 | |
---|
[1942] | 30 | |
---|
| 31 | for (int x = 0; x < 10; x++) |
---|
[1917] | 32 | { |
---|
[1942] | 33 | for (int y = 0; y < 10; y++) |
---|
[1917] | 34 | { |
---|
[1942] | 35 | mountainTest[x][y] = 0; |
---|
[1917] | 36 | |
---|
| 37 | } |
---|
| 38 | } |
---|
[1942] | 39 | |
---|
| 40 | for (int x = 1; x < 9; x++) |
---|
[1883] | 41 | { |
---|
[1942] | 42 | for (int y = 1; y < 9; y++) |
---|
[1883] | 43 | { |
---|
[1955] | 44 | mountainTest[x][y] = (float)rand() / 900000000; |
---|
[1942] | 45 | |
---|
[1883] | 46 | } |
---|
| 47 | } |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | Environment::~Environment () {} |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | void Environment::drawEnvironment() |
---|
| 57 | { |
---|
| 58 | glPushMatrix(); |
---|
| 59 | //glScalef(0.5, 0.5, 1.0); |
---|
| 60 | //glTranslatef(xCor, yCor, zCor); |
---|
| 61 | glTranslatef( -16.0, -2.0, 0.0); |
---|
| 62 | |
---|
| 63 | glColor3f(0.0, 1.0, 0.0); |
---|
| 64 | |
---|
| 65 | glBegin(GL_LINES); |
---|
[1942] | 66 | for (int x = 0; x < 9; x += 1) |
---|
[1883] | 67 | { |
---|
[1942] | 68 | for (int y = 0; y < 9; y += 1) |
---|
[1883] | 69 | { |
---|
| 70 | glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); |
---|
| 71 | glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]); |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | glEnd(); |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | glBegin(GL_LINES); |
---|
[1942] | 78 | for (int y = 0; y < 9; y += 1) |
---|
[1883] | 79 | { |
---|
[1942] | 80 | for (int x = 0; x < 9; x += 1) |
---|
[1883] | 81 | { |
---|
| 82 | glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); |
---|
| 83 | glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]); |
---|
| 84 | } |
---|
| 85 | } |
---|
| 86 | glEnd(); |
---|
| 87 | |
---|
| 88 | glPopMatrix(); |
---|
| 89 | } |
---|
| 90 | |
---|