mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:08:51 +02:00
This behavior was harder to change than expected...
This commit is contained in:
parent
825fc1cfa1
commit
495925a017
10 changed files with 52 additions and 6 deletions
|
@ -299,7 +299,7 @@ void AvatarMixer::broadcastAvatarData() {
|
||||||
AvatarMixerClientData* otherData = reinterpret_cast<AvatarMixerClientData*>(otherNode->getLinkedData());
|
AvatarMixerClientData* otherData = reinterpret_cast<AvatarMixerClientData*>(otherNode->getLinkedData());
|
||||||
AvatarMixerClientData* nodeData = reinterpret_cast<AvatarMixerClientData*>(node->getLinkedData());
|
AvatarMixerClientData* nodeData = reinterpret_cast<AvatarMixerClientData*>(node->getLinkedData());
|
||||||
// Check to see if the space bubble is enabled
|
// Check to see if the space bubble is enabled
|
||||||
if ((node->isIgnoreRadiusEnabled() && !getsIgnoredByMe) || (otherNode->isIgnoreRadiusEnabled() && !getsAnyIgnored)) {
|
if (node->isIgnoreRadiusEnabled() || otherNode->isIgnoreRadiusEnabled()) {
|
||||||
// Define the minimum bubble size
|
// Define the minimum bubble size
|
||||||
static const glm::vec3 minBubbleSize = glm::vec3(0.3f, 1.3f, 0.3f);
|
static const glm::vec3 minBubbleSize = glm::vec3(0.3f, 1.3f, 0.3f);
|
||||||
// Define the scale of the box for the current node
|
// Define the scale of the box for the current node
|
||||||
|
@ -326,11 +326,11 @@ void AvatarMixer::broadcastAvatarData() {
|
||||||
// Perform the collision check between the two bounding boxes
|
// Perform the collision check between the two bounding boxes
|
||||||
if (nodeBox.touches(otherNodeBox)) {
|
if (nodeBox.touches(otherNodeBox)) {
|
||||||
nodeData->ignoreOther(node, otherNode);
|
nodeData->ignoreOther(node, otherNode);
|
||||||
return false;
|
return getsIgnoredByMe || getsAnyIgnored;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Not close enough to ignore
|
// Not close enough to ignore
|
||||||
nodeData->removeFromRadiusIgnoringSet(otherNode->getUUID());
|
nodeData->removeFromRadiusIgnoringSet(node, otherNode->getUUID());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -57,6 +57,15 @@ void AvatarMixerClientData::ignoreOther(SharedNodePointer self, SharedNodePointe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvatarMixerClientData::removeFromRadiusIgnoringSet(SharedNodePointer self, const QUuid& other) {
|
||||||
|
if (isRadiusIgnoring(other)) {
|
||||||
|
_radiusIgnoredOthers.erase(other);
|
||||||
|
auto exitingSpaceBubblePacket = NLPacket::create(PacketType::ExitingSpaceBubble, NUM_BYTES_RFC4122_UUID);
|
||||||
|
exitingSpaceBubblePacket->write(other.toRfc4122());
|
||||||
|
DependencyManager::get<NodeList>()->sendUnreliablePacket(*exitingSpaceBubblePacket, *self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarMixerClientData::readViewFrustumPacket(const QByteArray& message) {
|
void AvatarMixerClientData::readViewFrustumPacket(const QByteArray& message) {
|
||||||
_currentViewFrustum.fromByteArray(message);
|
_currentViewFrustum.fromByteArray(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
glm::vec3 getGlobalBoundingBoxCorner() { return _avatar ? _avatar->getGlobalBoundingBoxCorner() : glm::vec3(0); }
|
glm::vec3 getGlobalBoundingBoxCorner() { return _avatar ? _avatar->getGlobalBoundingBoxCorner() : glm::vec3(0); }
|
||||||
bool isRadiusIgnoring(const QUuid& other) { return _radiusIgnoredOthers.find(other) != _radiusIgnoredOthers.end(); }
|
bool isRadiusIgnoring(const QUuid& other) { return _radiusIgnoredOthers.find(other) != _radiusIgnoredOthers.end(); }
|
||||||
void addToRadiusIgnoringSet(const QUuid& other) { _radiusIgnoredOthers.insert(other); }
|
void addToRadiusIgnoringSet(const QUuid& other) { _radiusIgnoredOthers.insert(other); }
|
||||||
void removeFromRadiusIgnoringSet(const QUuid& other) { _radiusIgnoredOthers.erase(other); }
|
void removeFromRadiusIgnoringSet(SharedNodePointer self, const QUuid& other);
|
||||||
void ignoreOther(SharedNodePointer self, SharedNodePointer other);
|
void ignoreOther(SharedNodePointer self, SharedNodePointer other);
|
||||||
|
|
||||||
void readViewFrustumPacket(const QByteArray& message);
|
void readViewFrustumPacket(const QByteArray& message);
|
||||||
|
|
|
@ -1339,7 +1339,9 @@ void Avatar::addToScene(AvatarSharedPointer myHandle) {
|
||||||
render::ScenePointer scene = qApp->getMain3DScene();
|
render::ScenePointer scene = qApp->getMain3DScene();
|
||||||
if (scene) {
|
if (scene) {
|
||||||
render::PendingChanges pendingChanges;
|
render::PendingChanges pendingChanges;
|
||||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars() && !DependencyManager::get<NodeList>()->isIgnoringNode(getSessionUUID())) {
|
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()
|
||||||
|
&& !DependencyManager::get<NodeList>()->isIgnoringNode(getSessionUUID())
|
||||||
|
&& !DependencyManager::get<NodeList>()->isRadiusIgnoringNode(getSessionUUID())) {
|
||||||
addToScene(myHandle, scene, pendingChanges);
|
addToScene(myHandle, scene, pendingChanges);
|
||||||
}
|
}
|
||||||
scene->enqueuePendingChanges(pendingChanges);
|
scene->enqueuePendingChanges(pendingChanges);
|
||||||
|
|
|
@ -79,6 +79,7 @@ AvatarManager::AvatarManager(QObject* parent) :
|
||||||
packetReceiver.registerListener(PacketType::BulkAvatarData, this, "processAvatarDataPacket");
|
packetReceiver.registerListener(PacketType::BulkAvatarData, this, "processAvatarDataPacket");
|
||||||
packetReceiver.registerListener(PacketType::KillAvatar, this, "processKillAvatar");
|
packetReceiver.registerListener(PacketType::KillAvatar, this, "processKillAvatar");
|
||||||
packetReceiver.registerListener(PacketType::AvatarIdentity, this, "processAvatarIdentityPacket");
|
packetReceiver.registerListener(PacketType::AvatarIdentity, this, "processAvatarIdentityPacket");
|
||||||
|
packetReceiver.registerListener(PacketType::ExitingSpaceBubble, this, "processExitingSpaceBubble");
|
||||||
|
|
||||||
// when we hear that the user has ignored an avatar by session UUID
|
// when we hear that the user has ignored an avatar by session UUID
|
||||||
// immediately remove that avatar instead of waiting for the absence of packets from avatar mixer
|
// immediately remove that avatar instead of waiting for the absence of packets from avatar mixer
|
||||||
|
@ -256,6 +257,7 @@ void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar
|
||||||
|
|
||||||
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble) {
|
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble) {
|
||||||
emit DependencyManager::get<UsersScriptingInterface>()->enteredIgnoreRadius();
|
emit DependencyManager::get<UsersScriptingInterface>()->enteredIgnoreRadius();
|
||||||
|
DependencyManager::get<NodeList>()->radiusIgnoreNodeBySessionID(avatar->getSessionUUID(), true);
|
||||||
}
|
}
|
||||||
_avatarFades.push_back(removedAvatar);
|
_avatarFades.push_back(removedAvatar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,13 @@ void AvatarHashMap::processKillAvatar(QSharedPointer<ReceivedMessage> message, S
|
||||||
removeAvatar(sessionUUID, reason);
|
removeAvatar(sessionUUID, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvatarHashMap::processExitingSpaceBubble(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode) {
|
||||||
|
// read the node id
|
||||||
|
QUuid sessionUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
nodeList->radiusIgnoreNodeBySessionID(sessionUUID, false);
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarHashMap::removeAvatar(const QUuid& sessionUUID, KillAvatarReason removalReason) {
|
void AvatarHashMap::removeAvatar(const QUuid& sessionUUID, KillAvatarReason removalReason) {
|
||||||
QWriteLocker locker(&_hashLock);
|
QWriteLocker locker(&_hashLock);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ private slots:
|
||||||
void processAvatarDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
void processAvatarDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||||
void processAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
void processAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||||
void processKillAvatar(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
void processKillAvatar(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||||
|
void processExitingSpaceBubble(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AvatarHashMap();
|
AvatarHashMap();
|
||||||
|
|
|
@ -238,6 +238,10 @@ void NodeList::reset() {
|
||||||
|
|
||||||
_numNoReplyDomainCheckIns = 0;
|
_numNoReplyDomainCheckIns = 0;
|
||||||
|
|
||||||
|
// lock and clear our set of radius ignored IDs
|
||||||
|
_radiusIgnoredSetLock.lockForWrite();
|
||||||
|
_radiusIgnoredNodeIDs.clear();
|
||||||
|
_radiusIgnoredSetLock.unlock();
|
||||||
// lock and clear our set of ignored IDs
|
// lock and clear our set of ignored IDs
|
||||||
_ignoredSetLock.lockForWrite();
|
_ignoredSetLock.lockForWrite();
|
||||||
_ignoredNodeIDs.clear();
|
_ignoredNodeIDs.clear();
|
||||||
|
@ -781,6 +785,22 @@ void NodeList::sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationN
|
||||||
sendPacket(std::move(ignorePacket), *destinationNode);
|
sendPacket(std::move(ignorePacket), *destinationNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeList::radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled) {
|
||||||
|
if (radiusIgnoreEnabled) {
|
||||||
|
QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for insert
|
||||||
|
// add this nodeID to our set of ignored IDs
|
||||||
|
_radiusIgnoredNodeIDs.insert(nodeID);
|
||||||
|
} else {
|
||||||
|
QWriteLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // write lock for unsafe_erase
|
||||||
|
_radiusIgnoredNodeIDs.unsafe_erase(nodeID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NodeList::isRadiusIgnoringNode(const QUuid& nodeID) const {
|
||||||
|
QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for reading
|
||||||
|
return _radiusIgnoredNodeIDs.find(nodeID) != _radiusIgnoredNodeIDs.cend();
|
||||||
|
}
|
||||||
|
|
||||||
void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) {
|
void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) {
|
||||||
// enumerate the nodes to send a reliable ignore packet to each that can leverage it
|
// enumerate the nodes to send a reliable ignore packet to each that can leverage it
|
||||||
if (!nodeID.isNull() && _sessionUUID != nodeID) {
|
if (!nodeID.isNull() && _sessionUUID != nodeID) {
|
||||||
|
|
|
@ -76,6 +76,8 @@ public:
|
||||||
void toggleIgnoreRadius() { ignoreNodesInRadius(!getIgnoreRadiusEnabled()); }
|
void toggleIgnoreRadius() { ignoreNodesInRadius(!getIgnoreRadiusEnabled()); }
|
||||||
void enableIgnoreRadius() { ignoreNodesInRadius(true); }
|
void enableIgnoreRadius() { ignoreNodesInRadius(true); }
|
||||||
void disableIgnoreRadius() { ignoreNodesInRadius(false); }
|
void disableIgnoreRadius() { ignoreNodesInRadius(false); }
|
||||||
|
void radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled);
|
||||||
|
bool isRadiusIgnoringNode(const QUuid& other) const;
|
||||||
void ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled);
|
void ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled);
|
||||||
bool isIgnoringNode(const QUuid& nodeID) const;
|
bool isIgnoringNode(const QUuid& nodeID) const;
|
||||||
void personalMuteNodeBySessionID(const QUuid& nodeID, bool muteEnabled);
|
void personalMuteNodeBySessionID(const QUuid& nodeID, bool muteEnabled);
|
||||||
|
@ -159,6 +161,8 @@ private:
|
||||||
QTimer _keepAlivePingTimer;
|
QTimer _keepAlivePingTimer;
|
||||||
bool _requestsDomainListData;
|
bool _requestsDomainListData;
|
||||||
|
|
||||||
|
mutable QReadWriteLock _radiusIgnoredSetLock;
|
||||||
|
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _radiusIgnoredNodeIDs;
|
||||||
mutable QReadWriteLock _ignoredSetLock;
|
mutable QReadWriteLock _ignoredSetLock;
|
||||||
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;
|
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;
|
||||||
mutable QReadWriteLock _personalMutedSetLock;
|
mutable QReadWriteLock _personalMutedSetLock;
|
||||||
|
|
|
@ -105,7 +105,8 @@ public:
|
||||||
UsernameFromIDReply,
|
UsernameFromIDReply,
|
||||||
ViewFrustum,
|
ViewFrustum,
|
||||||
RequestsDomainListData,
|
RequestsDomainListData,
|
||||||
LAST_PACKET_TYPE = RequestsDomainListData
|
ExitingSpaceBubble,
|
||||||
|
LAST_PACKET_TYPE = ExitingSpaceBubble //FIXME
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue