Showing the changes to interface/src/Application.cpp (1 of 61 files). Show all
Unified · Split
| @@ -445,6 +445,7 @@ void Application::aboutToQuit() { · 444 unmodified lines | ||
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | Application::~Application() { |
| 448 | + _entities.getTree()->setSimulation(NULL); | |
| 448 | 449 | qInstallMessageHandler(NULL); |
| 449 | 450 | |
| 450 | 451 | saveSettings(); |
| @@ -1972,7 +1973,9 @@ void Application::init() { · 1521 unmodified lines | ||
| 1972 | 1973 | _entities.init(); |
| 1973 | 1974 | _entities.setViewFrustum(getViewFrustum()); |
| 1974 | 1975 | |
| 1975 | − _entityCollisionSystem.init(&_entityEditSender, _entities.getTree(), _voxels.getTree(), &_audio, &_avatarManager); | |
| 1976 | + EntityTree* entityTree = _entities.getTree(); | |
| 1977 | + _entityCollisionSystem.init(&_entityEditSender, entityTree, _voxels.getTree(), &_audio, &_avatarManager); | |
| 1978 | + entityTree->setSimulation(&_entityCollisionSystem); | |
| 1976 | 1979 | |
| 1977 | 1980 | // connect the _entityCollisionSystem to our script engine's EntityScriptingInterface |
| 1978 | 1981 | connect(&_entityCollisionSystem, &EntityCollisionSystem::entityCollisionWithVoxel, |
| @@ -2335,11 +2338,12 @@ void Application::update(float deltaTime) { · 356 unmodified lines | ||
| 2335 | 2338 | |
| 2336 | 2339 | if (!_aboutToQuit) { |
| 2337 | 2340 | PerformanceTimer perfTimer("entities"); |
| 2341 | + // NOTE: the _entities.update() call below will wait for lock | |
| 2342 | + // and will simulate entity motion (the EntityTree has been given an EntitySimulation). | |
| 2338 | 2343 | _entities.update(); // update the models... |
| 2339 | − { | |
| 2340 | − PerformanceTimer perfTimer("collisions"); | |
| 2341 | − _entityCollisionSystem.update(); // collide the entities... | |
| 2342 | − } | |
| 2344 | + // The _entityCollisionSystem.updateCollisions() call below merely tries for lock, | |
| 2345 | + // and on failure it skips collision detection. | |
| 2346 | + _entityCollisionSystem.updateCollisions(); // collide the entities... | |
| 2343 | 2347 | } |
| 2344 | 2348 | |
| 2345 | 2349 | { |
| @@ -2852,7 +2856,12 @@ void Application::updateShadowMap() { · 506 unmodified lines | ||
| 2852 | 2856 | // render JS/scriptable overlays |
| 2853 | 2857 | { |
| 2854 | 2858 | PerformanceTimer perfTimer("3dOverlays"); |
| 2855 | − _overlays.render3D(RenderArgs::SHADOW_RENDER_MODE); | |
| 2859 | + _overlays.render3D(false, RenderArgs::SHADOW_RENDER_MODE); | |
| 2860 | + } | |
| 2861 | + | |
| 2862 | + { | |
| 2863 | + PerformanceTimer perfTimer("3dOverlaysFront"); | |
| 2864 | + _overlays.render3D(true, RenderArgs::SHADOW_RENDER_MODE); | |
| 2856 | 2865 | } |
| 2857 | 2866 | |
| 2858 | 2867 | glDisable(GL_POLYGON_OFFSET_FILL); |
| @@ -3067,7 +3076,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 208 unmodified lines | ||
| 3067 | 3076 | // render JS/scriptable overlays |
| 3068 | 3077 | { |
| 3069 | 3078 | PerformanceTimer perfTimer("3dOverlays"); |
| 3070 | − _overlays.render3D(); | |
| 3079 | + _overlays.render3D(false); | |
| 3071 | 3080 | } |
| 3072 | 3081 | |
| 3073 | 3082 | // render the ambient occlusion effect if enabled |
| @@ -3151,6 +3160,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 77 unmodified lines | ||
| 3151 | 3160 | if (Menu::getInstance()->isOptionChecked(MenuOption::Wireframe)) { |
| 3152 | 3161 | glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); |
| 3153 | 3162 | } |
| 3163 | + | |
| 3164 | + // Render 3D overlays that should be drawn in front | |
| 3165 | + { | |
| 3166 | + PerformanceTimer perfTimer("3dOverlaysFront"); | |
| 3167 | + glClear(GL_DEPTH_BUFFER_BIT); | |
| 3168 | + _overlays.render3D(true); | |
| 3169 | + } | |
| 3154 | 3170 | } |
| 3155 | 3171 | |
| 3156 | 3172 | void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) { |