Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/dave/core/environment.cc @ 1994

Last change on this file since 1994 was 1994, checked in by dave, 20 years ago

orxonox/branches/dave:[test the Shit]

File size: 1.8 KB
RevLine 
[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
23using namespace std;
24
[1994]25//Sorry Bensch
26#define LEVEL_LENGTH 500
[1883]27
28Environment::Environment () 
29{
30
[1994]31  //Sorry Bensch: x,y = 10
32  for (int x = 0; x < 50; x++)
[1883]33    {
[1994]34      for (int y = 0; y < 50; y++)
[1883]35        {
[1994]36          mountainTest[x][y] =0;
[1883]37                                                 
38        }
39    }
[1994]40  //Sorry Bensch: x,y = 9
41  for (int x = 1; x < LEVEL_LENGTH; x++)
[1883]42    {
[1994]43      for (int y = 1; y < LEVEL_LENGTH; y++)
[1883]44        {
[1994]45          //mountainTest[x][y] = (float)random() / 900000000;
46          mountainTest[x][y] = (float)(random() % 4);                                       
[1883]47        }
48    }
49}
50
51
52
53Environment::~Environment () {}
54
55
56
57void Environment::drawEnvironment() 
58{
59  glPushMatrix();
[1994]60  glEnable(GL_DEPTH_TEST);
[1883]61  //glScalef(0.5, 0.5, 1.0);
62  //glTranslatef(xCor, yCor, zCor);
[1994]63  glTranslatef( -100.0, -50.0, 0.0);
[1883]64 
[1994]65  glColor4f(0.0, 0.3, 0.4,1.0);
[1883]66 
67  glBegin(GL_LINES);
[1994]68  for (int x = 0; x < LEVEL_LENGTH; x += 1)
[1883]69    {
[1994]70      for (int y = 0; y < 190; y += 1)
[1883]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);
[1994]80  for (int y = 0; y < LEVEL_LENGTH; y += 1)
[1883]81    {
[1994]82      for (int x = 0; x < 90; x += 1)
[1883]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
Note: See TracBrowser for help on using the repository browser.