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