| 433 | } |
| 434 | |
| 435 | void TestbedApplication::update() { |
| 436 | |
| 437 | double currentTime = glfwGetTime(); |
| 438 | |
| 439 | mCurrentScene->setIsDebugRendererEnabled(mIsDebugRendererEnabled); |
| 440 | |
| 441 | // Update the physics |
| 442 | if (mSinglePhysicsStepEnabled && !mSinglePhysicsStepDone) { |
| 443 | updateSinglePhysicsStep(); |
| 444 | mSinglePhysicsStepDone = true; |
| 445 | } |
| 446 | else { |
| 447 | updatePhysics(); |
| 448 | } |
| 449 | |
| 450 | // Compute the physics update time |
| 451 | mTotalPhysicsTime = glfwGetTime() - currentTime; |
| 452 | |
| 453 | // Compute the interpolation factor |
| 454 | float factor = mTimer.computeInterpolationFactor(mDefaultEngineSettings.timeStep); |
| 455 | assert(factor >= 0.0f && factor <= 1.0f); |
| 456 | |
| 457 | // Notify the scene about the interpolation factor |
| 458 | mCurrentScene->setInterpolationFactor(factor); |
| 459 | |
| 460 | // Enable/Disable shadow mapping |
| 461 | mCurrentScene->setIsShadowMappingEnabled(mIsShadowMappingEnabled); |
| 462 | |
| 463 | // Display/Hide contact points |
| 464 | mCurrentScene->setAreContactPointsDisplayed(mAreContactPointsDisplayed); |
| 465 | |
| 466 | // Display/Hide contact normals |
| 467 | mCurrentScene->setAreContactNormalsDisplayed(mAreContactNormalsDisplayed); |
| 468 | |
| 469 | // Display/Hide the broad phase AABBs |
| 470 | mCurrentScene->setAreBroadPhaseAABBsDisplayed(mAreBroadPhaseAABBsDisplayed); |
| 471 | |
| 472 | // Display/Hide the colliders AABBs |
| 473 | mCurrentScene->setAreCollidersAABBsDisplayed(mAreCollidersAABBsDisplayed); |
| 474 | |
| 475 | // Display/Hide the collision shapes |
| 476 | mCurrentScene->setAreCollisionShapesDisplayed(mAreCollisionShapesDisplayed); |
| 477 | |
| 478 | // Display/Hide the collision shapes normals |
| 479 | mCurrentScene->setAreCollisionShapesNormalsDisplayed(mAreCollisionShapesNormalsDisplayed); |
| 480 | |
| 481 | // Enable/Disable wireframe mode |
| 482 | mCurrentScene->setIsWireframeEnabled(mAreObjectsWireframeEnabled); |
| 483 | |
| 484 | // Update the scene |
| 485 | mCurrentScene->update(); |
| 486 | |
| 487 | // Compute the current framerate |
| 488 | computeFPS(); |
| 489 | } |
| 490 | |
| 491 | void TestbedApplication::render() { |
| 492 |
no test coverage detected