Showing the changes to interface/src/Application.cpp (1 of 23 files). Show all
Unified · Split
| @@ -509,6 +509,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 508 unmodified lines | ||
| 509 | 509 | _sessionRunTimer(startupTimer), |
| 510 | 510 | _previousSessionCrashed(setupEssentials(argc, argv)), |
| 511 | 511 | _undoStackScriptingInterface(&_undoStack), |
| 512 | + _entitySimulation(new PhysicalEntitySimulation()), | |
| 512 | 513 | _physicsEngine(new PhysicsEngine(Vectors::ZERO)), |
| 513 | 514 | _entityClipboardRenderer(false, this, this), |
| 514 | 515 | _entityClipboard(new EntityTree()), |
| @@ -2995,13 +2996,13 @@ void Application::init() { · 2480 unmodified lines | ||
| 2995 | 2996 | _physicsEngine->init(); |
| 2996 | 2997 | |
| 2997 | 2998 | EntityTreePointer tree = getEntities()->getTree(); |
| 2998 | − _entitySimulation.init(tree, _physicsEngine, &_entityEditSender); | |
| 2999 | − tree->setSimulation(&_entitySimulation); | |
| 2999 | + _entitySimulation->init(tree, _physicsEngine, &_entityEditSender); | |
| 3000 | + tree->setSimulation(_entitySimulation); | |
| 3000 | 3001 | |
| 3001 | 3002 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); |
| 3002 | 3003 | |
| 3003 | 3004 | // connect the _entityCollisionSystem to our EntityTreeRenderer since that's what handles running entity scripts |
| 3004 | − connect(&_entitySimulation, &EntitySimulation::entityCollisionWithEntity, | |
| 3005 | + connect(_entitySimulation.get(), &EntitySimulation::entityCollisionWithEntity, | |
| 3005 | 3006 | getEntities(), &EntityTreeRenderer::entityCollisionWithEntity); |
| 3006 | 3007 | |
| 3007 | 3008 | // connect the _entities (EntityTreeRenderer) to our script engine's EntityScriptingInterface for firing |
| @@ -3404,22 +3405,22 @@ void Application::update(float deltaTime) { · 396 unmodified lines | ||
| 3404 | 3405 | |
| 3405 | 3406 | PerformanceTimer perfTimer("updateStates)"); |
| 3406 | 3407 | static VectorOfMotionStates motionStates; |
| 3407 | − _entitySimulation.getObjectsToRemoveFromPhysics(motionStates); | |
| 3408 | + _entitySimulation->getObjectsToRemoveFromPhysics(motionStates); | |
| 3408 | 3409 | _physicsEngine->removeObjects(motionStates); |
| 3409 | − _entitySimulation.deleteObjectsRemovedFromPhysics(); | |
| 3410 | + _entitySimulation->deleteObjectsRemovedFromPhysics(); | |
| 3410 | 3411 | |
| 3411 | 3412 | getEntities()->getTree()->withReadLock([&] { |
| 3412 | − _entitySimulation.getObjectsToAddToPhysics(motionStates); | |
| 3413 | + _entitySimulation->getObjectsToAddToPhysics(motionStates); | |
| 3413 | 3414 | _physicsEngine->addObjects(motionStates); |
| 3414 | 3415 | |
| 3415 | 3416 | }); |
| 3416 | 3417 | getEntities()->getTree()->withReadLock([&] { |
| 3417 | − _entitySimulation.getObjectsToChange(motionStates); | |
| 3418 | + _entitySimulation->getObjectsToChange(motionStates); | |
| 3418 | 3419 | VectorOfMotionStates stillNeedChange = _physicsEngine->changeObjects(motionStates); |
| 3419 | − _entitySimulation.setObjectsToChange(stillNeedChange); | |
| 3420 | + _entitySimulation->setObjectsToChange(stillNeedChange); | |
| 3420 | 3421 | }); |
| 3421 | 3422 | |
| 3422 | − _entitySimulation.applyActionChanges(); | |
| 3423 | + _entitySimulation->applyActionChanges(); | |
| 3423 | 3424 | |
| 3424 | 3425 | avatarManager->getObjectsToRemoveFromPhysics(motionStates); |
| 3425 | 3426 | _physicsEngine->removeObjects(motionStates); |
| @@ -3447,7 +3448,7 @@ void Application::update(float deltaTime) { · 21 unmodified lines | ||
| 3447 | 3448 | getEntities()->getTree()->withWriteLock([&] { |
| 3448 | 3449 | PerformanceTimer perfTimer("handleOutgoingChanges"); |
| 3449 | 3450 | const VectorOfMotionStates& outgoingChanges = _physicsEngine->getOutgoingChanges(); |
| 3450 | − _entitySimulation.handleOutgoingChanges(outgoingChanges); | |
| 3451 | + _entitySimulation->handleOutgoingChanges(outgoingChanges); | |
| 3451 | 3452 | avatarManager->handleOutgoingChanges(outgoingChanges); |
| 3452 | 3453 | }); |
| 3453 | 3454 | |
| @@ -3460,7 +3461,7 @@ void Application::update(float deltaTime) { · 6 unmodified lines | ||
| 3460 | 3461 | PerformanceTimer perfTimer("entities"); |
| 3461 | 3462 | // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk |
| 3462 | 3463 | // deadlock.) |
| 3463 | − _entitySimulation.handleCollisionEvents(collisionEvents); | |
| 3464 | + _entitySimulation->handleCollisionEvents(collisionEvents); | |
| 3464 | 3465 | |
| 3465 | 3466 | // NOTE: the getEntities()->update() call below will wait for lock |
| 3466 | 3467 | // and will simulate entity motion (the EntityTree has been given an EntitySimulation). |