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 | |
---|
31 | for (int x = 0; x < 10; x++) |
---|
32 | { |
---|
33 | for (int y = 0; y < 10; y++) |
---|
34 | { |
---|
35 | mountainTest[x][y] = 0; |
---|
36 | |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | for (int x = 1; x < 9; x++) |
---|
41 | { |
---|
42 | for (int y = 1; y < 9; y++) |
---|
43 | { |
---|
44 | mountainTest[x][y] = (float)random() / 900000000; |
---|
45 | |
---|
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); |
---|
66 | for (int x = 0; x < 9; x += 1) |
---|
67 | { |
---|
68 | for (int y = 0; y < 9; y += 1) |
---|
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); |
---|
78 | for (int y = 0; y < 9; y += 1) |
---|
79 | { |
---|
80 | for (int x = 0; x < 9; x += 1) |
---|
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 | |
---|