Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 1890 was 1883, checked in by patrick, 21 years ago

orxonox/trunk: added envoronment eg. little mountain - its time to talk about further development…

File size: 1.6 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
26
27Environment::Environment () 
28{
29
30  for (int x = 1; x < 9; x++)
31    {
32      for (int y = 1; y < 9; y++)
33        {
34          mountainTest[x][y] = (float)random() / 900000000;
35                                                 
36        }
37    }
38
39 for (int x = 0; x < 10; x++)
40    {
41      for (int y = 0; y < 10; y++)
42        {
43          cout << " " << mountainTest[x][y] << " ";
44         
45        }
46      cout << endl;
47    }
48}
49
50
51
52Environment::~Environment () {}
53
54
55
56void 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 < 10; x += 1)
67    {
68      for (int y = 0; y < 10; 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 < 10; y += 1)
79    {
80      for (int x = 0; x < 10; 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
Note: See TracBrowser for help on using the repository browser.