Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/environment.cc @ 2816

Last change on this file since 2816 was 2816, checked in by patrick, 19 years ago

orxonox/trunk/src: new list implemented

File size: 2.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: Patrick Boenzli
15   co-programmer:
16*/
17
18
19#include "environment.h"
20#include "stdincl.h"
21#include "world_entity.h"
22#include "vector.h"
23
24using namespace std;
25
26
27//Sorry Bensch
28#define LEVEL_LENGTH 500
29
30Environment::Environment () : WorldEntity()
31{
32
33  /*
34  //Sorry Bensch: x,y = 10
35  for (int x = 0; x < 50; x++)
36    {
37      for (int y = 0; y < 50; y++)
38        {
39          mountainTest[x][y] =0;
40                                                 
41        }
42    }
43  //Sorry Bensch: x,y = 9
44  for (int x = 1; x < LEVEL_LENGTH; x++)
45    {
46      for (int y = 1; y < LEVEL_LENGTH; y++)
47        {
48          //mountainTest[x][y] = (float)random() / 900000000;
49          mountainTest[x][y] = (float)(random() % 4);                                       
50        }
51    }
52  */
53}
54
55
56
57Environment::~Environment () {}
58
59void Environment::tick (float time) {}
60
61void Environment::hit (WorldEntity* weapon, Vector loc) {}
62
63void Environment::destroy () {}
64
65void Environment::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
66
67void Environment::draw () 
68{
69  printf("Environment::draw()");
70
71  glMatrixMode(GL_MODELVIEW);
72  glLoadIdentity();
73  float matrix[4][4];
74 
75  glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z);
76  get_placement()->w.matrix (matrix);
77  glMultMatrixf ((float*)matrix);
78
79  glBegin(GL_TRIANGLES);
80  glColor3f(1,1,1);
81  glVertex3f(0,0,0.5);
82  glVertex3f(-0.5,0,-1);
83  glVertex3f(0.5,0,-1);
84 
85  glVertex3f(0,0,0.5);
86  glVertex3f(0,0.5,-1);
87  glVertex3f(0,-0.5,-1);
88  glEnd();
89   
90  glBegin(GL_QUADS);
91  glColor3f(0,0,1);
92  glVertex3f(0.5,0.5,-1);
93  glVertex3f(0.5,-0.5,-1);
94  glVertex3f(-0.5,-0.5,-1);
95  glVertex3f(-0.5,0.5,-1);
96  glEnd();
97}
98
99/*
100void Environment::paint()
101{
102 
103  glPushMatrix();
104  //glScalef(0.5, 0.5, 1.0);
105  //glTranslatef(xCor, yCor, zCor);
106  glTranslatef( -16.0, -2.0, 0.0);
107 
108  glColor3f(0.0, 1.0, 0.0);
109 
110  glBegin(GL_LINES);
111  for (int x = 0; x < LEVEL_LENGTH; x += 1)
112    {
113      for (int y = 0; y < 190; y += 1)
114        {
115          glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
116          glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]);
117        }
118    }
119  glEnd();
120 
121 
122  glBegin(GL_LINES);
123  for (int y = 0; y < LEVEL_LENGTH; y += 1)
124    {
125      for (int x = 0; x < 90; x += 1)
126        {
127          glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
128          glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]);
129        }
130    }
131  glEnd();
132 
133  glPopMatrix();
134 
135}
136
137void Environment::drawEnvironment()
138{
139
140}
141
142*/
Note: See TracBrowser for help on using the repository browser.