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 | 101 | if (!_sendQueue.empty()) { |
| 102 | 102 | EntityPriorityQueue prevSendQueue; |
| 103 | 103 | _sendQueue.swap(prevSendQueue); |
| 104 | − _entitiesToSend.clear(); | |
| 104 | + _entitiesInQueue.clear(); | |
| 105 | 105 | // Re-add elements from previous traversal if they still need to be sent |
| 106 | 106 | while (!prevSendQueue.empty()) { |
| 107 | 107 | EntityItemPointer entity = prevSendQueue.top().getEntity(); |
| @@ -122,14 +122,14 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O · 14 unmodified lines | ||
| 122 | 122 | // Only send entities if they are large enough to see |
| 123 | 123 | if (renderAccuracy > 0.0f) { |
| 124 | 124 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 125 | − _entitiesToSend.insert(entity.get()); | |
| 125 | + _entitiesInQueue.insert(entity.get()); | |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } else { |
| 130 | 130 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 131 | 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 | 161 | std::cout << "adebug send '" << entity->getName().toStdString() << "'" << " : " << entry.getPriority() << std::endl; // adebug |
| 162 | 162 | } |
| 163 | 163 | _sendQueue.pop(); |
| 164 | − _entitiesToSend.erase(entry.getRawEntityPointer()); | |
| 164 | + _entitiesInQueue.erase(entry.getRawEntityPointer()); | |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | #endif // SEND_SORTED_ENTITIES |
| @@ -239,7 +239,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 71 unmodified lines | ||
| 239 | 239 | _traversal.setScanCallback([&] (DiffTraversal::VisibleElement& next) { |
| 240 | 240 | next.element->forEachEntity([&](EntityItemPointer entity) { |
| 241 | 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 | 243 | return; |
| 244 | 244 | } |
| 245 | 245 | bool success = false; |
| @@ -259,13 +259,13 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 13 unmodified lines | ||
| 259 | 259 | if (renderAccuracy > 0.0f) { |
| 260 | 260 | float priority = _conicalView.computePriority(cube); |
| 261 | 261 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 262 | − _entitiesToSend.insert(entity.get()); | |
| 262 | + _entitiesInQueue.insert(entity.get()); | |
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | } else { |
| 266 | 266 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 267 | 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 | 276 | uint64_t timestamp = _traversal.getStartOfCompletedTraversal(); |
| 277 | 277 | next.element->forEachEntity([&](EntityItemPointer entity) { |
| 278 | 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 | 280 | return; |
| 281 | 281 | } |
| 282 | 282 | if (entity->getLastEdited() > timestamp) { |
| @@ -294,13 +294,13 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 11 unmodified lines | ||
| 294 | 294 | if (renderAccuracy > 0.0f) { |
| 295 | 295 | float priority = _conicalView.computePriority(cube); |
| 296 | 296 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 297 | − _entitiesToSend.insert(entity.get()); | |
| 297 | + _entitiesInQueue.insert(entity.get()); | |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | } else { |
| 301 | 301 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 302 | 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 | 314 | if (next.element->getLastChangedContent() > timestamp || next.intersection != ViewFrustum::INSIDE) { |
| 315 | 315 | next.element->forEachEntity([&](EntityItemPointer entity) { |
| 316 | 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 | 318 | return; |
| 319 | 319 | } |
| 320 | 320 | bool success = false; |
| @@ -332,7 +332,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 11 unmodified lines | ||
| 332 | 332 | if (entity->getLastEdited() > timestamp || !_traversal.getCompletedView().cubeIntersectsKeyhole(cube)) { |
| 333 | 333 | float priority = _conicalView.computePriority(cube); |
| 334 | 334 | _sendQueue.push(PrioritizedEntity(entity, priority)); |
| 335 | − _entitiesToSend.insert(entity.get()); | |
| 335 | + _entitiesInQueue.insert(entity.get()); | |
| 336 | 336 | } else { |
| 337 | 337 | // If this entity was skipped last time because it was too small, we still need to send it |
| 338 | 338 | float lastRenderAccuracy = calculateRenderAccuracy(_traversal.getCompletedView().getPosition(), |
| @@ -343,7 +343,7 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree · 4 unmodified lines | ||
| 343 | 343 | if (lastRenderAccuracy <= 0.0f) { |
| 344 | 344 | float priority = _conicalView.computePriority(cube); |
| 345 | 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 | 351 | } else { |
| 352 | 352 | const float WHEN_IN_DOUBT_PRIORITY = 1.0f; |
| 353 | 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 | } |