Changeset 1883 in orxonox.OLD for orxonox/trunk/core/world.cc
- Timestamp:
- May 10, 2004, 12:36:58 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/world.cc
r1879 r1883 32 32 lastPlayer = null; 33 33 lastNPC = null; 34 lastEnv = null; 34 35 } 35 36 … … 99 100 } 100 101 lastNPC = listMember; 102 } 103 104 105 /** 106 \brief Add environmental object 107 \param player A reference to the new env object 108 109 Add a new Environment to the world. Env has to be initialised before. 110 */ 111 bool World::addEnv(Environment* env) 112 { 113 envList* listMember = new envList; 114 listMember->env = env; 115 if ( lastEnv != null ) 116 { 117 listMember->number = lastEnv->number + 1; 118 listMember->next = lastEnv; 119 } 120 else 121 { 122 listMember->number = 0; 123 listMember->next = null; 124 } 125 lastEnv = listMember; 101 126 } 102 127 … … 137 162 } 138 163 /* now draw the rest of the world: environement */ 164 /* second draw all npcs */ 165 envList* tmpEnv = lastEnv; 166 while( tmpEnv != null ) 167 { 168 (*tmpEnv->env).drawEnvironment(); 169 tmpEnv = tmpEnv->next; 170 } 171 172 /* 139 173 glColor3f(0.0, 1.0, 0.0); 140 174 glBegin(GL_LINES); 141 glVertex3f(0.0, -10.0, 0.0); 142 glVertex3f(0.0, 200.0, 0.0); 143 144 glVertex3f(5.0, -10.0, 0.0); 145 glVertex3f(5.0, 200.0, 0.0); 146 147 glVertex3f(-5.0, -10.0, 0.0); 148 glVertex3f(-5.0, 200.0, 0.0); 149 150 glVertex3f(10.0, -10.0, 0.0); 151 glVertex3f(10.0, 200.0, 0.0); 152 153 glVertex3f(-10.0, -10.0, 0.0); 154 glVertex3f(-10.0, 200.0, 0.0); 155 156 glVertex3f(15.0, -10.0, 0.0); 157 glVertex3f(15.0, 200.0, 0.0); 158 159 glVertex3f(-15.0, -10.0, 0.0); 160 glVertex3f(-15.0, 200.0, 0.0); 161 162 glVertex3f(20.0, -10.0, 0.0); 163 glVertex3f(20.0, 200.0, 0.0); 164 165 glVertex3f(-20.0, -10.0, 0.0); 166 glVertex3f(-20.0, 200.0, 0.0); 167 168 glVertex3f(25.0, -10.0, 0.0); 169 glVertex3f(25.0, 200.0, 0.0); 170 171 glVertex3f(-25.0, -10.0, 0.0); 172 glVertex3f(-25.0, 200.0, 0.0); 175 for (int x = 0; x <= 35; x += 5) 176 { 177 glVertex3f((float)x, -10.0, 0.0); 178 glVertex3f((float)x, 200.0, 0.0); 179 180 glVertex3f(-(float)x, -10.0, 0.0); 181 glVertex3f(-(float)x, 200.0, 0.0); 182 } 183 for (int x = -10; x<= 200; x += 5) 184 { 185 glVertex3f(-50.0, (float)x, 0.0); 186 glVertex3f(50.0, (float)x, 0.0); 187 } 173 188 glEnd(); 174 175 189 */ 190 191 192 glColor3f(0.0, 1.0, 0.0); 193 194 glBegin(GL_LINES); 195 for (int x = 0; x < 60; x += 2) 196 { 197 for (int y = 0; y < 60; y += 2) 198 { 199 glVertex3f((float)(x - 30), (float)(y - 30), surface[x][y]); 200 glVertex3f((float)(x - 30), (float)(y - 28), surface[x][y+2]); 201 } 202 } 203 glEnd(); 204 205 206 glBegin(GL_LINES); 207 for (int y = 0; y < 60; y += 2) 208 { 209 for (int x = 0; x < 60; x += 2) 210 { 211 glVertex3f((float)(x - 30), (float)(y - 30), surface[x][y]); 212 glVertex3f((float)(x - 28), (float)(y - 30), surface[x+2][y]); 213 } 214 } 215 glEnd(); 216 217 } 218 219 220 void World::initEnvironement() 221 { 222 223 for (int x = 0; x < 60; x += 2) 224 { 225 for (int y = 0; y < 60; y += 2) 226 { 227 surface[x][y] = 0; 228 } 229 } 176 230 } 177 231 … … 217 271 } 218 272 273 274 /* test addEnv */ 275 cout << "addEnv test..." << endl; 276 envList* en = lastEnv; 277 while ( en != null ) 278 { 279 cout << "env " << en->number << " was found" << endl; 280 en = en->next; 281 } 282 219 283 /* test drawWorld() */ 220 cout << "drawWorld()..." << endl; 221 drawWorld(); 222 223 cout << "World::testThaTest() finished" << endl; 224 } 284 }
Note: See TracChangeset
for help on using the changeset viewer.