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