Showing the changes to interface/src/Application.cpp (1 of 40 files). Show all
Unified · Split
| @@ -4749,12 +4749,8 @@ void Application::resetPhysicsReadyInformation() { · 4748 unmodified lines | |||
| 4749 | 4749 | ||
| 4750 | void Application::reloadResourceCaches() { | 4750 | void Application::reloadResourceCaches() { |
| 4751 | resetPhysicsReadyInformation(); | 4751 | resetPhysicsReadyInformation(); |
| 4752 | { | 4752 | // Query the octree to refresh everything in view |
| 4753 | QMutexLocker viewLocker(&_viewMutex); | 4753 | _lastQueriedTime = 0; |
| 4754 | _viewFrustum.setPosition(glm::vec3(0.0f, 0.0f, TREE_SCALE)); | ||
| 4755 | _viewFrustum.setOrientation(glm::quat()); | ||
| 4756 | } | ||
| 4757 | // Clear entities out of view frustum | ||
| 4758 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions); | 4754 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions); |
| 4759 | 4755 | ||
| 4760 | DependencyManager::get<AssetClient>()->clearCache(); | 4756 | DependencyManager::get<AssetClient>()->clearCache(); |
| @@ -4912,13 +4908,9 @@ void Application::update(float deltaTime) { · 151 unmodified lines | |||
| 4912 | // we haven't yet enabled physics. we wait until we think we have all the collision information | 4908 | // we haven't yet enabled physics. we wait until we think we have all the collision information |
| 4913 | // for nearby entities before starting bullet up. | 4909 | // for nearby entities before starting bullet up. |
| 4914 | quint64 now = usecTimestampNow(); | 4910 | quint64 now = usecTimestampNow(); |
| 4915 | bool timeout = false; | ||
| 4916 | const int PHYSICS_CHECK_TIMEOUT = 2 * USECS_PER_SECOND; | 4911 | const int PHYSICS_CHECK_TIMEOUT = 2 * USECS_PER_SECOND; |
| 4917 | if (_lastPhysicsCheckTime > 0 && now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT) { | ||
| 4918 | timeout = true; | ||
| 4919 | } | ||
| 4920 | 4912 | ||
| 4921 | if (timeout || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { | 4913 | if (now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { |
| 4922 | // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway | 4914 | // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway |
| 4923 | _lastPhysicsCheckTime = now; | 4915 | _lastPhysicsCheckTime = now; |
| 4924 | _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; | 4916 | _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; |
| @@ -5470,7 +5462,7 @@ int Application::sendNackPackets() { · 545 unmodified lines | |||
| 5470 | return packetsSent; | 5462 | return packetsSent; |
| 5471 | } | 5463 | } |
| 5472 | 5464 | ||
| 5473 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions, bool forceResend) { | 5465 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { |
| 5474 | 5466 | ||
| 5475 | if (!_settingsLoaded) { | 5467 | if (!_settingsLoaded) { |
| 5476 | return; // bail early if settings are not loaded | 5468 | return; // bail early if settings are not loaded |
| @@ -5626,16 +5618,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 149 unmodified lines | |||
| 5626 | _octreeQuery.setMaxQueryPacketsPerSecond(0); | 5618 | _octreeQuery.setMaxQueryPacketsPerSecond(0); |
| 5627 | } | 5619 | } |
| 5628 | 5620 | ||
| 5629 | // if asked to forceResend, then set the query's position/orientation to be degenerate in a manner | ||
| 5630 | // that will cause our next query to be guarenteed to be different and the server will resend to us | ||
| 5631 | if (forceResend) { | ||
| 5632 | _octreeQuery.setCameraPosition(glm::vec3(-0.1, -0.1, -0.1)); | ||
| 5633 | const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0); | ||
| 5634 | _octreeQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE); | ||
| 5635 | _octreeQuery.setCameraNearClip(0.1f); | ||
| 5636 | _octreeQuery.setCameraFarClip(0.1f); | ||
| 5637 | } | ||
| 5638 | |||
| 5639 | // encode the query data | 5621 | // encode the query data |
| 5640 | int packetSize = _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload())); | 5622 | int packetSize = _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload())); |
| 5641 | queryPacket->setPayloadSize(packetSize); | 5623 | queryPacket->setPayloadSize(packetSize); |
| @@ -5870,8 +5852,6 @@ void Application::clearDomainOctreeDetails() { · 228 unmodified lines | |||
| 5870 | 5852 | ||
| 5871 | skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT); | 5853 | skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT); |
| 5872 | 5854 | ||
| 5873 | _recentlyClearedDomain = true; | ||
| 5874 | |||
| 5875 | DependencyManager::get<AnimationCache>()->clearUnusedResources(); | 5855 | DependencyManager::get<AnimationCache>()->clearUnusedResources(); |
| 5876 | DependencyManager::get<ModelCache>()->clearUnusedResources(); | 5856 | DependencyManager::get<ModelCache>()->clearUnusedResources(); |
| 5877 | DependencyManager::get<SoundCache>()->clearUnusedResources(); | 5857 | DependencyManager::get<SoundCache>()->clearUnusedResources(); |
| @@ -5918,14 +5898,10 @@ void Application::nodeActivated(SharedNodePointer node) { · 40 unmodified lines | |||
| 5918 | } | 5898 | } |
| 5919 | } | 5899 | } |
| 5920 | 5900 | ||
| 5921 | // If we get a new EntityServer activated, do a "forceRedraw" query. This will send a degenerate | 5901 | // If we get a new EntityServer activated, reset lastQueried time |
| 5922 | // query so that the server will think our next non-degenerate query is "different enough" to send | 5902 | // so we will do a proper query during update |
| 5923 | // us a full scene | 5903 | if (node->getType() == NodeType::EntityServer) { |
| 5924 | if (_recentlyClearedDomain && node->getType() == NodeType::EntityServer) { | 5904 | _lastQueriedTime = 0; |
| 5925 | _recentlyClearedDomain = false; | ||
| 5926 | if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) { | ||
| 5927 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions, true); | ||
| 5928 | } | ||
| 5929 | } | 5905 | } |
| 5930 | 5906 | ||
| 5931 | if (node->getType() == NodeType::AudioMixer) { | 5907 | if (node->getType() == NodeType::AudioMixer) { |