Changeset 10196
- Timestamp:
- Jan 13, 2015, 10:55:12 PM (10 years ago)
- Location:
- code/trunk/src/orxonox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/Scene.cc
r10192 r10196 44 44 #include "core/GUIManager.h" 45 45 #include "core/XMLPort.h" 46 #include "core/command/ConsoleCommand.h" 46 47 #include "tools/BulletConversions.h" 48 #include "tools/BulletDebugDrawer.h" 49 #include "tools/DebugDrawer.h" 47 50 #include "Radar.h" 48 51 #include "worldentities/WorldEntity.h" … … 53 56 RegisterClass(Scene); 54 57 58 SetConsoleCommand("Scene", "debugDrawPhysics", &Scene::consoleCommand_debugDrawPhysics).addShortcut().defaultValue(1, true).defaultValue(2, 0.5f); 59 55 60 Scene::Scene(Context* context) : BaseObject(context), Synchronisable(context), Context(context) 56 61 { … … 59 64 this->setScene(SmartPtr<Scene>(this, false), OBJECTID_UNKNOWN); 60 65 this->bShadows_ = true; 66 this->bDebugDrawPhysics_ = false; 67 this->debugDrawer_ = NULL; 61 68 this->soundReferenceDistance_ = 20.0; 62 69 … … 198 205 this->physicalWorld_->setGravity(multi_cast<btVector3>(this->gravity_)); 199 206 207 this->debugDrawer_ = new BulletDebugDrawer(this->sceneManager_); 208 this->physicalWorld_->setDebugDrawer(this->debugDrawer_); 209 200 210 // also set the collision callback variable. 201 211 // Note: This is a global variable which we assign a static function. … … 214 224 this->physicalObjects_.clear(); 215 225 226 delete this->debugDrawer_; 216 227 delete this->physicalWorld_; 217 228 delete this->solver_; … … 253 264 // Under that mark, the simulation will "loose time" and get unusable. 254 265 physicalWorld_->stepSimulation(dt, 60); 266 267 if (this->bDebugDrawPhysics_) 268 physicalWorld_->debugDrawWorld(); 255 269 } 256 270 } … … 358 372 return modified; 359 373 } 374 375 void Scene::setDebugDrawPhysics(bool bDraw, bool bFill, float fillAlpha) 376 { 377 this->bDebugDrawPhysics_ = bDraw; 378 if (this->debugDrawer_) 379 this->debugDrawer_->configure(bFill, fillAlpha); 380 } 381 382 /*static*/ void Scene::consoleCommand_debugDrawPhysics(bool bDraw, bool bFill, float fillAlpha) 383 { 384 for (ObjectListIterator<Scene> it = ObjectList<Scene>::begin(); it != ObjectList<Scene>::end(); ++it) 385 it->setDebugDrawPhysics(bDraw, bFill, fillAlpha); 386 } 360 387 } -
code/trunk/src/orxonox/Scene.h
r9667 r10196 129 129 void removePhysicalObject(WorldEntity* object); 130 130 131 void setDebugDrawPhysics(bool bDraw, bool bFill, float fillAlpha); 132 133 static void consoleCommand_debugDrawPhysics(bool bDraw, bool bFill, float fillAlpha); 134 131 135 private: 132 136 inline void networkcallback_hasPhysics() … … 156 160 Vector3 positiveWorldRange_; 157 161 Vector3 gravity_; 162 163 BulletDebugDrawer* debugDrawer_; 164 bool bDebugDrawPhysics_; 158 165 }; 159 166 }
Note: See TracChangeset
for help on using the changeset viewer.