Changeset 4679 in orxonox.OLD for orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
- Timestamp:
- Jun 24, 2005, 12:10:46 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
r4678 r4679 28 28 #include "model.h" 29 29 #include "test_entity.h" 30 #include "environment.h" 30 31 31 32 #include "graphics_engine.h" … … 39 40 tList<WorldEntity>* entityList; 40 41 42 int lastFrame, currentFrame, dt; 43 41 44 void Framework::moduleInit(int argc, char** argv) 42 45 { … … 44 47 45 48 CDEngine::getInstance(); 49 50 /* Simple Test */ 46 51 //CDEngine::getInstance()->debug(); 47 52 53 /* MD2 Model Test */ 48 54 // model = new MD2Model("models/tris.md2", "models/tris.pcx"); 49 55 // model->tick(0.1f); 50 56 // CDEngine::getInstance()->debugSpawnTree(9, model->data->pVertices, model->data->numVertices); 51 57 58 /* OBJ - Model Test */ 59 // mod = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 60 // CDEngine::getInstance()->debugSpawnTree(9, (sVec3D*)mod->getVertexArray(), mod->getVertexArrayCount()); 61 62 63 52 64 entityList = new tList<WorldEntity>(); 53 65 54 66 TestEntity* a = new TestEntity(); 67 Environment* b = new Environment(); 68 b->setRelCoor(0.0, 0.0, -10.0); 55 69 56 70 entityList->add(a); 57 58 59 mod = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 60 CDEngine::getInstance()->debugSpawnTree(9, (sVec3D*)mod->getVertexArray(), mod->getVertexCount()); 61 62 /* ligths */ 71 entityList->add(b); 72 73 63 74 LightManager* lightMan = LightManager::getInstance(); 64 75 lightMan->setAmbientColor(.1,.1,.1); … … 71 82 drawMode = DRAW_MODEL; 72 83 depth = 0; 84 dt = lastFrame = currentFrame = 0; 85 73 86 74 87 moduleHelp(); … … 184 197 void Framework::moduleTick(float dt) 185 198 { 199 200 currentFrame = SDL_GetTicks(); 201 dt = currentFrame - lastFrame; 202 203 if( dt > 55) 204 { 205 float fps = 1000/dt; 206 207 // temporary, only for showing how fast the text-engine is 208 char tmpChar[20]; 209 sprintf(tmpChar, "fps: %4.0f", fps); 210 } 211 else 212 { 213 /* the frame-rate is limited to 100 frames per second, all other things are for nothing. 214 */ 215 SDL_Delay((unsigned int)(50-dt)); 216 dt = 55; 217 } 218 219 186 220 tIterator<WorldEntity>* iterator = entityList->getIterator(); /* get the iterator - JAVA style */ 187 221 WorldEntity* entity = iterator->nextElement(); /* this returns the FIRST element */ 188 222 while( entity != NULL) /* nextElement() will return NULL at the end */ 189 223 { 190 entity->tick(0. 2);224 entity->tick(0.1); 191 225 entity = iterator->nextElement(); /* give back the next element or NULL if last */ 192 226 } 193 227 delete iterator; 194 228 229 lastFrame = currentFrame; 195 230 } 196 231 … … 198 233 void Framework::moduleDraw() const 199 234 { 200 CDEngine::getInstance()->drawBV(depth, drawMode); 201 235 //CDEngine::getInstance()->drawBV(depth, drawMode); 202 236 LightManager::getInstance()->draw(); 203 237 204 //tIterator<WorldEntity>* iterator = entityList->getIterator(); /* get the iterator - JAVA style */205 //WorldEntity* entity = iterator->nextElement(); /* this returns the FIRST element */206 //while( entity != NULL) /* nextElement() will return NULL at the end */207 //{208 //entity->draw();209 //entity = iterator->nextElement(); /* give back the next element or NULL if last */210 //}211 //delete iterator;238 tIterator<WorldEntity>* iterator = entityList->getIterator(); /* get the iterator - JAVA style */ 239 WorldEntity* entity = iterator->nextElement(); /* this returns the FIRST element */ 240 while( entity != NULL) /* nextElement() will return NULL at the end */ 241 { 242 entity->draw(); 243 entity = iterator->nextElement(); /* give back the next element or NULL if last */ 244 } 245 delete iterator; 212 246 //model->draw(); 213 247 }
Note: See TracChangeset
for help on using the changeset viewer.