Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/core/environment.cc @ 1934

Last change on this file since 1934 was 1934, checked in by bensch, 20 years ago

orxonox/trunk: endless Mountains added by Tom

File size: 1.7 KB
Line 
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
23using namespace std;
24
25//Sorry Bensch
26#define LEVEL_LENGTH 500
27
28Environment::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
53Environment::~Environment () {}
54
55
56
57void Environment::drawEnvironment() 
58{
59  glPushMatrix();
60  //glScalef(0.5, 0.5, 1.0);
61  //glTranslatef(xCor, yCor, zCor);
62  glTranslatef( -16.0, -2.0, 0.0);
63 
64  glColor3f(0.0, 1.0, 0.0);
65 
66  glBegin(GL_LINES);
67  for (int x = 0; x < LEVEL_LENGTH; x += 1)
68    {
69      for (int y = 0; y < 190; y += 1)
70        {
71          glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
72          glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]);
73        }
74    }
75  glEnd();
76 
77 
78  glBegin(GL_LINES);
79  for (int y = 0; y < LEVEL_LENGTH; y += 1)
80    {
81      for (int x = 0; x < 90; x += 1)
82        {
83          glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
84          glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]);
85        }
86    }
87  glEnd();
88 
89  glPopMatrix();
90}
91
Note: See TracBrowser for help on using the repository browser.