Showing the changes to assignment-client/src/entities/EntityTreeSendThread.cpp (1 of 2 files). Show all
Unified · Split
| @@ -101,7 +101,7 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O · 100 unmodified lines | |||
| 101 | if (!_sendQueue.empty()) { | 101 | if (!_sendQueue.empty()) { |
| 102 | EntityPriorityQueue prevSendQueue; | 102 | EntityPriorityQueue prevSendQueue; |
| 103 | _sendQueue.swap(prevSendQueue); | 103 | _sendQueue.swap(prevSendQueue); |
| 104 | _entitiesToSend.clear(); | 104 | _entitiesInQueue.clear(); |
| 105 | // Re-add elements from previous traversal if they still need to be sent | 105 | // Re-add elements from previous traversal if they still need to be sent |
| 106 | while (!prevSendQueue.empty()) { | 106 | while (!prevSendQueue.empty()) { |
| 107 | EntityItemPointer entity = prevSendQueue.top().getEntity(); | 107 | EntityItemPointer entity = prevSendQueue.top().getEntity(); |
| @@ -122,14 +122,14 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O · 14 unmodified lines | |||
| 122 | // Only send entities if they are large enough to see | 122 | // Only send entities if they are large enough to see |
| 123 | if (renderAccuracy > 0.0f) { | 123 | if (renderAccuracy > 0.0f) { |
| 124 | _sendQueue.push(PrioritizedEntity(entity, priority)); | 124 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 125 | _entitiesToSend.insert(entity.get()); | 125 | _entitiesInQueue.insert(entity.get()); |
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | } else { | 129 | } else { |
| 130 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; | 130 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 131 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); | 131 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); |
| 132 | _entitiesToSend.insert(entity.get()); | 132 | _entitiesInQueue.insert(entity.get()); |
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| @@ -161,7 +161,7 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O · 25 unmodified lines | |||
| 161 | std::cout << "adebug send '" << entity->getName().toStdString() << "'" << " : " << entry.getPriority() << std::endl; // adebug | 161 | std::cout << "adebug send '" << entity->getName().toStdString() << "'" << " : " << entry.getPriority() << std::endl; // adebug |
| 162 | } | 162 | } |
| 163 | _sendQueue.pop(); | 163 | _sendQueue.pop(); |
| 164 | _entitiesToSend.erase(entry.getRawEntityPointer()); | 164 | _entitiesInQueue.erase(entry.getRawEntityPointer()); |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | #endif // SEND_SORTED_ENTITIES | 167 | #endif // SEND_SORTED_ENTITIES |
| @@ -239,7 +239,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 71 unmodified lines | |||
| 239 | _traversal.setScanCallback([&] (DiffTraversal::VisibleElement& next) { | 239 | _traversal.setScanCallback([&] (DiffTraversal::VisibleElement& next) { |
| 240 | next.element->forEachEntity([&](EntityItemPointer entity) { | 240 | next.element->forEachEntity([&](EntityItemPointer entity) { |
| 241 | // Bail early if we've already checked this entity this frame | 241 | // Bail early if we've already checked this entity this frame |
| 242 | if (_entitiesToSend.find(entity.get()) != _entitiesToSend.end()) { | 242 | if (_entitiesInQueue.find(entity.get()) != _entitiesInQueue.end()) { |
| 243 | return; | 243 | return; |
| 244 | } | 244 | } |
| 245 | bool success = false; | 245 | bool success = false; |
| @@ -259,13 +259,13 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 13 unmodified lines | |||
| 259 | if (renderAccuracy > 0.0f) { | 259 | if (renderAccuracy > 0.0f) { |
| 260 | float priority = _conicalView.computePriority(cube); | 260 | float priority = _conicalView.computePriority(cube); |
| 261 | _sendQueue.push(PrioritizedEntity(entity, priority)); | 261 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 262 | _entitiesToSend.insert(entity.get()); | 262 | _entitiesInQueue.insert(entity.get()); |
| 263 | } | 263 | } |
| 264 | } | 264 | } |
| 265 | } else { | 265 | } else { |
| 266 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; | 266 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 267 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); | 267 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); |
| 268 | _entitiesToSend.insert(entity.get()); | 268 | _entitiesInQueue.insert(entity.get()); |
| 269 | } | 269 | } |
| 270 | }); | 270 | }); |
| 271 | }); | 271 | }); |
| @@ -276,7 +276,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 4 unmodified lines | |||
| 276 | uint64_t timestamp = _traversal.getStartOfCompletedTraversal(); | 276 | uint64_t timestamp = _traversal.getStartOfCompletedTraversal(); |
| 277 | next.element->forEachEntity([&](EntityItemPointer entity) { | 277 | next.element->forEachEntity([&](EntityItemPointer entity) { |
| 278 | // Bail early if we've already checked this entity this frame | 278 | // Bail early if we've already checked this entity this frame |
| 279 | if (_entitiesToSend.find(entity.get()) != _entitiesToSend.end()) { | 279 | if (_entitiesInQueue.find(entity.get()) != _entitiesInQueue.end()) { |
| 280 | return; | 280 | return; |
| 281 | } | 281 | } |
| 282 | if (entity->getLastEdited() > timestamp) { | 282 | if (entity->getLastEdited() > timestamp) { |
| @@ -294,13 +294,13 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 11 unmodified lines | |||
| 294 | if (renderAccuracy > 0.0f) { | 294 | if (renderAccuracy > 0.0f) { |
| 295 | float priority = _conicalView.computePriority(cube); | 295 | float priority = _conicalView.computePriority(cube); |
| 296 | _sendQueue.push(PrioritizedEntity(entity, priority)); | 296 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 297 | _entitiesToSend.insert(entity.get()); | 297 | _entitiesInQueue.insert(entity.get()); |
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | } else { | 300 | } else { |
| 301 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; | 301 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 302 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); | 302 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); |
| 303 | _entitiesToSend.insert(entity.get()); | 303 | _entitiesInQueue.insert(entity.get()); |
| 304 | } | 304 | } |
| 305 | } | 305 | } |
| 306 | }); | 306 | }); |
| @@ -314,7 +314,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 7 unmodified lines | |||
| 314 | if (next.element->getLastChangedContent() > timestamp || next.intersection != ViewFrustum::INSIDE) { | 314 | if (next.element->getLastChangedContent() > timestamp || next.intersection != ViewFrustum::INSIDE) { |
| 315 | next.element->forEachEntity([&](EntityItemPointer entity) { | 315 | next.element->forEachEntity([&](EntityItemPointer entity) { |
| 316 | // Bail early if we've already checked this entity this frame | 316 | // Bail early if we've already checked this entity this frame |
| 317 | if (_entitiesToSend.find(entity.get()) != _entitiesToSend.end()) { | 317 | if (_entitiesInQueue.find(entity.get()) != _entitiesInQueue.end()) { |
| 318 | return; | 318 | return; |
| 319 | } | 319 | } |
| 320 | bool success = false; | 320 | bool success = false; |
| @@ -332,7 +332,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 11 unmodified lines | |||
| 332 | if (entity->getLastEdited() > timestamp || !_traversal.getCompletedView().cubeIntersectsKeyhole(cube)) { | 332 | if (entity->getLastEdited() > timestamp || !_traversal.getCompletedView().cubeIntersectsKeyhole(cube)) { |
| 333 | float priority = _conicalView.computePriority(cube); | 333 | float priority = _conicalView.computePriority(cube); |
| 334 | _sendQueue.push(PrioritizedEntity(entity, priority)); | 334 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 335 | _entitiesToSend.insert(entity.get()); | 335 | _entitiesInQueue.insert(entity.get()); |
| 336 | } else { | 336 | } else { |
| 337 | // If this entity was skipped last time because it was too small, we still need to send it | 337 | // If this entity was skipped last time because it was too small, we still need to send it |
| 338 | float lastRenderAccuracy = calculateRenderAccuracy(_traversal.getCompletedView().getPosition(), | 338 | float lastRenderAccuracy = calculateRenderAccuracy(_traversal.getCompletedView().getPosition(), |
| @@ -343,7 +343,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 4 unmodified lines | |||
| 343 | if (lastRenderAccuracy <= 0.0f) { | 343 | if (lastRenderAccuracy <= 0.0f) { |
| 344 | float priority = _conicalView.computePriority(cube); | 344 | float priority = _conicalView.computePriority(cube); |
| 345 | _sendQueue.push(PrioritizedEntity(entity, priority)); | 345 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 346 | _entitiesToSend.insert(entity.get()); | 346 | _entitiesInQueue.insert(entity.get()); |
| 347 | } | 347 | } |
| 348 | } | 348 | } |
| 349 | } | 349 | } |
| @@ -351,7 +351,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 1 unmodified line | |||
| 351 | } else { | 351 | } else { |
| 352 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; | 352 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 353 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); | 353 | _sendQueue.push(PrioritizedEntity(entity, WHEN_IN_DOUBT_PRIORITY)); |
| 354 | _entitiesToSend.insert(entity.get()); | 354 | _entitiesInQueue.insert(entity.get()); |
| 355 | } | 355 | } |
| 356 | }); | 356 | }); |
| 357 | } | 357 | } |