mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 23:17:08 +02:00
making pre review requests
This commit is contained in:
parent
8252481ce7
commit
e7d3844620
13 changed files with 144 additions and 72 deletions
|
@ -6774,8 +6774,7 @@ void Application::clearDomainOctreeDetails(bool clearAll) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// reset the model renderer
|
// reset the model renderer
|
||||||
qDebug() << "-----> clearAll: " << clearAll;
|
clearAll ? getEntities()->clear() : getEntities()->clearNonLocalEntities();
|
||||||
clearAll ? getEntities()->clear() : getEntities()->clearDomainEntities();
|
|
||||||
|
|
||||||
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
||||||
|
|
||||||
|
|
|
@ -197,8 +197,57 @@ void EntityTreeRenderer::resetEntitiesScriptEngine() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::stopEntityScripts() {
|
void EntityTreeRenderer::stopNonLocalEntityScripts() {
|
||||||
leaveAllEntities();
|
leaveNonLocalEntities();
|
||||||
|
// unload and stop the engine
|
||||||
|
if (_entitiesScriptEngine) {
|
||||||
|
QList<EntityItemID> entitiesWithEntityScripts = _entitiesScriptEngine->getListOfEntityScriptIDs();
|
||||||
|
|
||||||
|
foreach (EntityItemID entityID, entitiesWithEntityScripts) {
|
||||||
|
EntityItemPointer entityItem = getTree()->findEntityByEntityItemID(entityID);
|
||||||
|
|
||||||
|
if (entityItem) {
|
||||||
|
if (!entityItem->isLocalEntity()) {
|
||||||
|
_entitiesScriptEngine->unloadEntityScript(entityID, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityTreeRenderer::clearNonLocalEntities() {
|
||||||
|
stopNonLocalEntityScripts();
|
||||||
|
|
||||||
|
std::unordered_map<EntityItemID, EntityRendererPointer> savedEntities;
|
||||||
|
// remove all entities from the scene
|
||||||
|
_space->clear();
|
||||||
|
auto scene = _viewState->getMain3DScene();
|
||||||
|
if (scene) {
|
||||||
|
render::Transaction transaction;
|
||||||
|
for (const auto& entry : _entitiesInScene) {
|
||||||
|
const auto& renderer = entry.second;
|
||||||
|
const EntityItemPointer& entityItem = renderer->getEntity();
|
||||||
|
if (!entityItem->isLocalEntity()) {
|
||||||
|
renderer->removeFromScene(scene, transaction);
|
||||||
|
} else {
|
||||||
|
savedEntities[entry.first] = entry.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scene->enqueueTransaction(transaction);
|
||||||
|
} else {
|
||||||
|
qCWarning(entitiesrenderer) << "EntitityTreeRenderer::clear(), Unexpected null scene, possibly during application shutdown";
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderablesToUpdate = savedEntities;
|
||||||
|
_entitiesInScene = savedEntities;
|
||||||
|
|
||||||
|
_layeredZones.clearNonLocalLayeredZones();
|
||||||
|
|
||||||
|
OctreeProcessor::clearNonLocalEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityTreeRenderer::clear() {
|
||||||
|
leaveAllEntities();
|
||||||
// unload and stop the engine
|
// unload and stop the engine
|
||||||
if (_entitiesScriptEngine) {
|
if (_entitiesScriptEngine) {
|
||||||
// do this here (instead of in deleter) to avoid marshalling unload signals back to this thread
|
// do this here (instead of in deleter) to avoid marshalling unload signals back to this thread
|
||||||
|
@ -210,44 +259,8 @@ void EntityTreeRenderer::stopEntityScripts() {
|
||||||
if (_wantScripts && !_shuttingDown) {
|
if (_wantScripts && !_shuttingDown) {
|
||||||
resetEntitiesScriptEngine();
|
resetEntitiesScriptEngine();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void EntityTreeRenderer::clearDomainEntities() {
|
|
||||||
stopEntityScripts();
|
|
||||||
|
|
||||||
std::unordered_map<EntityItemID, EntityRendererPointer> savedEntities;
|
|
||||||
// remove all entities from the scene
|
// remove all entities from the scene
|
||||||
_space->clear();
|
|
||||||
auto scene = _viewState->getMain3DScene();
|
|
||||||
if (scene) {
|
|
||||||
render::Transaction transaction;
|
|
||||||
for (const auto& entry : _entitiesInScene) {
|
|
||||||
const auto& renderer = entry.second;
|
|
||||||
const EntityItemPointer& entityItem = renderer->getEntity();
|
|
||||||
if (entityItem->isDomainEntity()) {
|
|
||||||
renderer->removeFromScene(scene, transaction);
|
|
||||||
} else {
|
|
||||||
savedEntities[entry.first] = entry.second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scene->enqueueTransaction(transaction);
|
|
||||||
} else {
|
|
||||||
qCWarning(entitiesrenderer) << "EntitityTreeRenderer::clear(), Unexpected null scene, possibly during application shutdown";
|
|
||||||
}
|
|
||||||
_entitiesInScene.clear();
|
|
||||||
_renderablesToUpdate = savedEntities;
|
|
||||||
_entitiesInScene = savedEntities;
|
|
||||||
|
|
||||||
// reset the zone to the default (while we load the next scene)
|
|
||||||
_layeredZones.clear();
|
|
||||||
|
|
||||||
OctreeProcessor::clearDomainEntities();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityTreeRenderer::clear() {
|
|
||||||
stopEntityScripts();
|
|
||||||
|
|
||||||
// remove all entities from the scene
|
|
||||||
_space->clear();
|
_space->clear();
|
||||||
auto scene = _viewState->getMain3DScene();
|
auto scene = _viewState->getMain3DScene();
|
||||||
if (scene) {
|
if (scene) {
|
||||||
|
@ -542,8 +555,7 @@ bool EntityTreeRenderer::findBestZoneAndMaybeContainingEntities(QVector<EntityIt
|
||||||
auto entityTree = std::static_pointer_cast<EntityTree>(_tree);
|
auto entityTree = std::static_pointer_cast<EntityTree>(_tree);
|
||||||
|
|
||||||
// FIXME - if EntityTree had a findEntitiesContainingPoint() this could theoretically be a little faster
|
// FIXME - if EntityTree had a findEntitiesContainingPoint() this could theoretically be a little faster
|
||||||
entityTree->evalEntitiesInSphere(_avatarPosition, radius,
|
entityTree->evalEntitiesInSphere(_avatarPosition, radius, PickFilter(), entityIDs);
|
||||||
PickFilter(PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) | PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES)), entityIDs);
|
|
||||||
|
|
||||||
LayeredZones oldLayeredZones(std::move(_layeredZones));
|
LayeredZones oldLayeredZones(std::move(_layeredZones));
|
||||||
_layeredZones.clear();
|
_layeredZones.clear();
|
||||||
|
@ -649,6 +661,26 @@ bool EntityTreeRenderer::checkEnterLeaveEntities() {
|
||||||
return didUpdate;
|
return didUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityTreeRenderer::leaveNonLocalEntities() {
|
||||||
|
if (_tree && !_shuttingDown) {
|
||||||
|
QVector<EntityItemID> currentLocalEntitiesInside;
|
||||||
|
foreach (EntityItemID entityID, _currentEntitiesInside) {
|
||||||
|
EntityItemPointer entityItem = getTree()->findEntityByEntityItemID(entityID);
|
||||||
|
if (!entityItem->isLocalEntity()) {
|
||||||
|
emit leaveEntity(entityID);
|
||||||
|
if (_entitiesScriptEngine) {
|
||||||
|
_entitiesScriptEngine->callEntityScriptMethod(entityID, "leaveEntity");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
currentLocalEntitiesInside.push_back(entityID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_currentEntitiesInside = currentLocalEntitiesInside;
|
||||||
|
forceRecheckEntities();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::leaveAllEntities() {
|
void EntityTreeRenderer::leaveAllEntities() {
|
||||||
if (_tree && !_shuttingDown) {
|
if (_tree && !_shuttingDown) {
|
||||||
|
|
||||||
|
@ -1171,6 +1203,29 @@ EntityTreeRenderer::LayeredZones::LayeredZones(LayeredZones&& other) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityTreeRenderer::LayeredZones::clearNonLocalLayeredZones() {
|
||||||
|
std::set<LayeredZone> localLayeredZones;
|
||||||
|
std::map<QUuid, iterator> newMap;
|
||||||
|
|
||||||
|
for (auto iter = begin(); iter != end(); iter++) {
|
||||||
|
LayeredZone layeredZone = *iter;
|
||||||
|
|
||||||
|
if (layeredZone.zone->isLocalEntity()) {
|
||||||
|
bool success;
|
||||||
|
iterator it;
|
||||||
|
std::tie(it, success) = localLayeredZones.insert(layeredZone);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
newMap.emplace(layeredZone.id, it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::set<LayeredZone>::operator=(localLayeredZones);
|
||||||
|
_map = newMap;
|
||||||
|
_skyboxLayer = empty() ? end() : begin();
|
||||||
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::LayeredZones::clear() {
|
void EntityTreeRenderer::LayeredZones::clear() {
|
||||||
std::set<LayeredZone>::clear();
|
std::set<LayeredZone>::clear();
|
||||||
_map.clear();
|
_map.clear();
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
virtual void init() override;
|
virtual void init() override;
|
||||||
|
|
||||||
/// clears the tree
|
/// clears the tree
|
||||||
virtual void clearDomainEntities() override;
|
virtual void clearNonLocalEntities() override;
|
||||||
virtual void clear() override;
|
virtual void clear() override;
|
||||||
|
|
||||||
/// reloads the entity scripts, calling unload and preload
|
/// reloads the entity scripts, calling unload and preload
|
||||||
|
@ -162,7 +162,7 @@ private:
|
||||||
bool findBestZoneAndMaybeContainingEntities(QVector<EntityItemID>* entitiesContainingAvatar = nullptr);
|
bool findBestZoneAndMaybeContainingEntities(QVector<EntityItemID>* entitiesContainingAvatar = nullptr);
|
||||||
|
|
||||||
bool applyLayeredZones();
|
bool applyLayeredZones();
|
||||||
void stopEntityScripts();
|
void stopNonLocalEntityScripts();
|
||||||
|
|
||||||
void checkAndCallPreload(const EntityItemID& entityID, bool reload = false, bool unloadFirst = false);
|
void checkAndCallPreload(const EntityItemID& entityID, bool reload = false, bool unloadFirst = false);
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ private:
|
||||||
|
|
||||||
QScriptValueList createEntityArgs(const EntityItemID& entityID);
|
QScriptValueList createEntityArgs(const EntityItemID& entityID);
|
||||||
bool checkEnterLeaveEntities();
|
bool checkEnterLeaveEntities();
|
||||||
|
void leaveNonLocalEntities();
|
||||||
void leaveAllEntities();
|
void leaveAllEntities();
|
||||||
void forceRecheckEntities();
|
void forceRecheckEntities();
|
||||||
|
|
||||||
|
@ -221,6 +222,7 @@ private:
|
||||||
LayeredZones& operator=(LayeredZones&&) = delete;
|
LayeredZones& operator=(LayeredZones&&) = delete;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
void clearNonLocalLayeredZones();
|
||||||
std::pair<iterator, bool> insert(const LayeredZone& layer);
|
std::pair<iterator, bool> insert(const LayeredZone& layer);
|
||||||
void update(std::shared_ptr<ZoneEntityItem> zone);
|
void update(std::shared_ptr<ZoneEntityItem> zone);
|
||||||
bool contains(const LayeredZones& other);
|
bool contains(const LayeredZones& other);
|
||||||
|
|
|
@ -986,7 +986,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) {
|
||||||
shouldSendDeleteToServer = false;
|
shouldSendDeleteToServer = false;
|
||||||
} else {
|
} else {
|
||||||
// only delete local entities, server entities will round trip through the server filters
|
// only delete local entities, server entities will round trip through the server filters
|
||||||
if (entity->isAvatarEntity() || _entityTree->isServerlessMode()) {
|
if (!entity->isDomainEntity() || _entityTree->isServerlessMode()) {
|
||||||
shouldSendDeleteToServer = false;
|
shouldSendDeleteToServer = false;
|
||||||
_entityTree->deleteEntity(entityID);
|
_entityTree->deleteEntity(entityID);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ OctreeElementPointer EntityTree::createNewElement(unsigned char* octalCode) {
|
||||||
return std::static_pointer_cast<OctreeElement>(newElement);
|
return std::static_pointer_cast<OctreeElement>(newElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::eraseDomainEntities() {
|
void EntityTree::eraseNonLocalEntities() {
|
||||||
emit clearingEntities();
|
emit clearingEntities();
|
||||||
|
|
||||||
if (_simulation) {
|
if (_simulation) {
|
||||||
|
@ -84,10 +84,10 @@ void EntityTree::eraseDomainEntities() {
|
||||||
foreach(EntityItemPointer entity, localMap) {
|
foreach(EntityItemPointer entity, localMap) {
|
||||||
EntityTreeElementPointer element = entity->getElement();
|
EntityTreeElementPointer element = entity->getElement();
|
||||||
if (element) {
|
if (element) {
|
||||||
element->cleanupDomainEntities();
|
element->cleanupNonLocalEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity->isDomainEntity()) {
|
if (entity->isLocalEntity()) {
|
||||||
savedEntities[entity->getEntityItemID()] = entity;
|
savedEntities[entity->getEntityItemID()] = entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,15 @@ void EntityTree::eraseDomainEntities() {
|
||||||
|
|
||||||
{
|
{
|
||||||
QWriteLocker locker(&_needsParentFixupLock);
|
QWriteLocker locker(&_needsParentFixupLock);
|
||||||
_needsParentFixup.clear();
|
QVector<EntityItemWeakPointer> localEntitiesNeedsParentFixup;
|
||||||
|
|
||||||
|
foreach (EntityItemWeakPointer entityItem, _needsParentFixup) {
|
||||||
|
if (!entityItem.expired() && entityItem.lock()->isLocalEntity()) {
|
||||||
|
localEntitiesNeedsParentFixup.push_back(entityItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_needsParentFixup = localEntitiesNeedsParentFixup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void eraseDomainEntities() override;
|
virtual void eraseNonLocalEntities() override;
|
||||||
virtual void eraseAllOctreeElements(bool createNewRoot = true) override;
|
virtual void eraseAllOctreeElements(bool createNewRoot = true) override;
|
||||||
|
|
||||||
virtual void readBitstreamToTree(const unsigned char* bitstream,
|
virtual void readBitstreamToTree(const unsigned char* bitstream,
|
||||||
|
|
|
@ -683,11 +683,11 @@ EntityItemPointer EntityTreeElement::getEntityWithEntityItemID(const EntityItemI
|
||||||
return foundEntity;
|
return foundEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeElement::cleanupDomainEntities() {
|
void EntityTreeElement::cleanupNonLocalEntities() {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
EntityItems savedEntities;
|
EntityItems savedEntities;
|
||||||
foreach(EntityItemPointer entity, _entityItems) {
|
foreach(EntityItemPointer entity, _entityItems) {
|
||||||
if (entity->isDomainEntity()) {
|
if (!entity->isLocalEntity()) {
|
||||||
entity->preDelete();
|
entity->preDelete();
|
||||||
entity->_element = NULL;
|
entity->_element = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -189,7 +189,7 @@ public:
|
||||||
EntityItemPointer getEntityWithEntityItemID(const EntityItemID& id) const;
|
EntityItemPointer getEntityWithEntityItemID(const EntityItemID& id) const;
|
||||||
void getEntitiesInside(const AACube& box, QVector<EntityItemPointer>& foundEntities);
|
void getEntitiesInside(const AACube& box, QVector<EntityItemPointer>& foundEntities);
|
||||||
|
|
||||||
void cleanupDomainEntities();
|
void cleanupNonLocalEntities();
|
||||||
void cleanupEntities(); /// called by EntityTree on cleanup this will free all entities
|
void cleanupEntities(); /// called by EntityTree on cleanup this will free all entities
|
||||||
bool removeEntityItem(EntityItemPointer entity, bool deletion = false);
|
bool removeEntityItem(EntityItemPointer entity, bool deletion = false);
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ public:
|
||||||
|
|
||||||
OctreeElementPointer getRoot() { return _rootElement; }
|
OctreeElementPointer getRoot() { return _rootElement; }
|
||||||
|
|
||||||
virtual void eraseDomainEntities() { _isDirty = true; };
|
virtual void eraseNonLocalEntities() { _isDirty = true; };
|
||||||
virtual void eraseAllOctreeElements(bool createNewRoot = true);
|
virtual void eraseAllOctreeElements(bool createNewRoot = true);
|
||||||
|
|
||||||
virtual void readBitstreamToTree(const unsigned char* bitstream, uint64_t bufferSizeBytes, ReadBitstreamToTreeParams& args);
|
virtual void readBitstreamToTree(const unsigned char* bitstream, uint64_t bufferSizeBytes, ReadBitstreamToTreeParams& args);
|
||||||
|
|
|
@ -51,15 +51,15 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
||||||
|
|
||||||
bool showTimingDetails = false; // Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showTimingDetails = false; // Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
PerformanceWarning warn(showTimingDetails, "OctreeProcessor::processDatagram()", showTimingDetails);
|
PerformanceWarning warn(showTimingDetails, "OctreeProcessor::processDatagram()", showTimingDetails);
|
||||||
|
|
||||||
if (message.getType() == getExpectedPacketType()) {
|
if (message.getType() == getExpectedPacketType()) {
|
||||||
PerformanceWarning warn(showTimingDetails, "OctreeProcessor::processDatagram expected PacketType", showTimingDetails);
|
PerformanceWarning warn(showTimingDetails, "OctreeProcessor::processDatagram expected PacketType", showTimingDetails);
|
||||||
// if we are getting inbound packets, then our tree is also viewing, and we should remember that fact.
|
// if we are getting inbound packets, then our tree is also viewing, and we should remember that fact.
|
||||||
_tree->setIsViewing(true);
|
_tree->setIsViewing(true);
|
||||||
|
|
||||||
OCTREE_PACKET_FLAGS flags;
|
OCTREE_PACKET_FLAGS flags;
|
||||||
message.readPrimitive(&flags);
|
message.readPrimitive(&flags);
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE sequence;
|
OCTREE_PACKET_SEQUENCE sequence;
|
||||||
message.readPrimitive(&sequence);
|
message.readPrimitive(&sequence);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
||||||
|
|
||||||
bool packetIsColored = oneAtBit(flags, PACKET_IS_COLOR_BIT);
|
bool packetIsColored = oneAtBit(flags, PACKET_IS_COLOR_BIT);
|
||||||
bool packetIsCompressed = oneAtBit(flags, PACKET_IS_COMPRESSED_BIT);
|
bool packetIsCompressed = oneAtBit(flags, PACKET_IS_COMPRESSED_BIT);
|
||||||
|
|
||||||
OCTREE_PACKET_SENT_TIME arrivedAt = usecTimestampNow();
|
OCTREE_PACKET_SENT_TIME arrivedAt = usecTimestampNow();
|
||||||
qint64 clockSkew = sourceNode ? sourceNode->getClockSkewUsec() : 0;
|
qint64 clockSkew = sourceNode ? sourceNode->getClockSkewUsec() : 0;
|
||||||
qint64 flightTime = arrivedAt - sentAt + clockSkew;
|
qint64 flightTime = arrivedAt - sentAt + clockSkew;
|
||||||
|
@ -79,27 +79,27 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
||||||
qCDebug(octree) << "OctreeProcessor::processDatagram() ... "
|
qCDebug(octree) << "OctreeProcessor::processDatagram() ... "
|
||||||
"Got Packet Section color:" << packetIsColored <<
|
"Got Packet Section color:" << packetIsColored <<
|
||||||
"compressed:" << packetIsCompressed <<
|
"compressed:" << packetIsCompressed <<
|
||||||
"sequence: " << sequence <<
|
"sequence: " << sequence <<
|
||||||
"flight: " << flightTime << " usec" <<
|
"flight: " << flightTime << " usec" <<
|
||||||
"size:" << message.getSize() <<
|
"size:" << message.getSize() <<
|
||||||
"data:" << message.getBytesLeftToRead();
|
"data:" << message.getBytesLeftToRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
_packetsInLastWindow++;
|
_packetsInLastWindow++;
|
||||||
|
|
||||||
int elementsPerPacket = 0;
|
int elementsPerPacket = 0;
|
||||||
int entitiesPerPacket = 0;
|
int entitiesPerPacket = 0;
|
||||||
|
|
||||||
quint64 totalWaitingForLock = 0;
|
quint64 totalWaitingForLock = 0;
|
||||||
quint64 totalUncompress = 0;
|
quint64 totalUncompress = 0;
|
||||||
quint64 totalReadBitsteam = 0;
|
quint64 totalReadBitsteam = 0;
|
||||||
|
|
||||||
const QUuid& sourceUUID = sourceNode->getUUID();
|
const QUuid& sourceUUID = sourceNode->getUUID();
|
||||||
|
|
||||||
int subsection = 1;
|
int subsection = 1;
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
while (message.getBytesLeftToRead() > 0 && !error) {
|
while (message.getBytesLeftToRead() > 0 && !error) {
|
||||||
if (packetIsCompressed) {
|
if (packetIsCompressed) {
|
||||||
if (message.getBytesLeftToRead() > (qint64) sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE)) {
|
if (message.getBytesLeftToRead() > (qint64) sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE)) {
|
||||||
|
@ -111,7 +111,7 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
||||||
} else {
|
} else {
|
||||||
sectionLength = message.getBytesLeftToRead();
|
sectionLength = message.getBytesLeftToRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sectionLength) {
|
if (sectionLength) {
|
||||||
// ask the VoxelTree to read the bitstream into the tree
|
// ask the VoxelTree to read the bitstream into the tree
|
||||||
ReadBitstreamToTreeParams args(WANT_EXISTS_BITS, NULL,
|
ReadBitstreamToTreeParams args(WANT_EXISTS_BITS, NULL,
|
||||||
|
@ -149,7 +149,7 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
||||||
qCDebug(octree) << "OctreeProcessor::processDatagram() ******* END _tree->readBitstreamToTree()...";
|
qCDebug(octree) << "OctreeProcessor::processDatagram() ******* END _tree->readBitstreamToTree()...";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// seek forwards in packet
|
// seek forwards in packet
|
||||||
message.seek(message.getPosition() + sectionLength);
|
message.seek(message.getPosition() + sectionLength);
|
||||||
|
|
||||||
|
@ -172,13 +172,13 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
||||||
_waitLockPerPacket.updateAverage(totalWaitingForLock);
|
_waitLockPerPacket.updateAverage(totalWaitingForLock);
|
||||||
_uncompressPerPacket.updateAverage(totalUncompress);
|
_uncompressPerPacket.updateAverage(totalUncompress);
|
||||||
_readBitstreamPerPacket.updateAverage(totalReadBitsteam);
|
_readBitstreamPerPacket.updateAverage(totalReadBitsteam);
|
||||||
|
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
if (_lastWindowAt == 0) {
|
if (_lastWindowAt == 0) {
|
||||||
_lastWindowAt = now;
|
_lastWindowAt = now;
|
||||||
}
|
}
|
||||||
quint64 sinceLastWindow = now - _lastWindowAt;
|
quint64 sinceLastWindow = now - _lastWindowAt;
|
||||||
|
|
||||||
if (sinceLastWindow > USECS_PER_SECOND) {
|
if (sinceLastWindow > USECS_PER_SECOND) {
|
||||||
float packetsPerSecondInWindow = (float)_packetsInLastWindow / (float)(sinceLastWindow / USECS_PER_SECOND);
|
float packetsPerSecondInWindow = (float)_packetsInLastWindow / (float)(sinceLastWindow / USECS_PER_SECOND);
|
||||||
float elementsPerSecondInWindow = (float)_elementsInLastWindow / (float)(sinceLastWindow / USECS_PER_SECOND);
|
float elementsPerSecondInWindow = (float)_elementsInLastWindow / (float)(sinceLastWindow / USECS_PER_SECOND);
|
||||||
|
@ -198,10 +198,10 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OctreeProcessor::clearDomainEntities() {
|
void OctreeProcessor::clearNonLocalEntities() {
|
||||||
if (_tree) {
|
if (_tree) {
|
||||||
_tree->withWriteLock([&] {
|
_tree->withWriteLock([&] {
|
||||||
_tree->eraseDomainEntities();
|
_tree->eraseNonLocalEntities();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
/// clears the tree
|
/// clears the tree
|
||||||
virtual void clearDomainEntities();
|
virtual void clearNonLocalEntities();
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
float getAverageElementsPerPacket() const { return _elementsPerPacket.getAverage(); }
|
float getAverageElementsPerPacket() const { return _elementsPerPacket.getAverage(); }
|
||||||
|
|
|
@ -2393,6 +2393,11 @@ void ScriptEngine::unloadEntityScript(const EntityItemID& entityID, bool shouldR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<EntityItemID> ScriptEngine::getListOfEntityScriptIDs() {
|
||||||
|
QReadLocker locker{ &_entityScriptsLock };
|
||||||
|
return _entityScripts.keys();
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptEngine::unloadAllEntityScripts() {
|
void ScriptEngine::unloadAllEntityScripts() {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
#ifdef THREAD_DEBUGGING
|
#ifdef THREAD_DEBUGGING
|
||||||
|
|
|
@ -145,6 +145,9 @@ public:
|
||||||
|
|
||||||
QString getFilename() const;
|
QString getFilename() const;
|
||||||
|
|
||||||
|
|
||||||
|
QList<EntityItemID> getListOfEntityScriptIDs();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Stop the current script.
|
* Stop the current script.
|
||||||
* @function Script.stop
|
* @function Script.stop
|
||||||
|
|
Loading…
Reference in a new issue