mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
Fix logic in zone-checking code, other clean-up
This commit is contained in:
parent
6b371ec388
commit
8b2fc968f6
2 changed files with 27 additions and 17 deletions
|
@ -100,7 +100,7 @@ struct FindContainingZone {
|
||||||
bool isInScreenshareZone { false };
|
bool isInScreenshareZone { false };
|
||||||
float priorityZoneVolume { std::numeric_limits<float>::max() };
|
float priorityZoneVolume { std::numeric_limits<float>::max() };
|
||||||
float screenshareZoneVolume { priorityZoneVolume };
|
float screenshareZoneVolume { priorityZoneVolume };
|
||||||
EntityItemID id{};
|
EntityItemID screenshareZoneid{};
|
||||||
|
|
||||||
static bool operation(const OctreeElementPointer& element, void* extraData) {
|
static bool operation(const OctreeElementPointer& element, void* extraData) {
|
||||||
auto findContainingZone = static_cast<FindContainingZone*>(extraData);
|
auto findContainingZone = static_cast<FindContainingZone*>(extraData);
|
||||||
|
@ -109,17 +109,19 @@ struct FindContainingZone {
|
||||||
entityTreeElement->forEachEntity([&findContainingZone](EntityItemPointer item) {
|
entityTreeElement->forEachEntity([&findContainingZone](EntityItemPointer item) {
|
||||||
if (item->getType() == EntityTypes::Zone && item->contains(findContainingZone->position)) {
|
if (item->getType() == EntityTypes::Zone && item->contains(findContainingZone->position)) {
|
||||||
auto zoneItem = static_pointer_cast<ZoneEntityItem>(item);
|
auto zoneItem = static_pointer_cast<ZoneEntityItem>(item);
|
||||||
if (zoneItem->getAvatarPriority() != COMPONENT_MODE_INHERIT) {
|
auto avatarPriorityProperty = zoneItem->getAvatarPriority();
|
||||||
float volume = zoneItem->getVolumeEstimate();
|
auto screenshareProperty = zoneItem->getScreenshare();
|
||||||
if (volume < findContainingZone->priorityZoneVolume) { // Smaller volume wins
|
float volume = zoneItem->getVolumeEstimate();
|
||||||
findContainingZone->isInPriorityZone = zoneItem->getAvatarPriority() == COMPONENT_MODE_ENABLED;
|
if (avatarPriorityProperty != COMPONENT_MODE_INHERIT
|
||||||
findContainingZone->priorityZoneVolume = volume;
|
&& volume < findContainingZone->priorityZoneVolume) { // Smaller volume wins
|
||||||
}
|
findContainingZone->isInPriorityZone = avatarPriorityProperty == COMPONENT_MODE_ENABLED;
|
||||||
if (volume < findContainingZone->screenshareZoneVolume) {
|
findContainingZone->priorityZoneVolume = volume;
|
||||||
findContainingZone->isInScreenshareZone = zoneItem->getScreenshare() == COMPONENT_MODE_ENABLED;
|
}
|
||||||
|
if (screenshareProperty != COMPONENT_MODE_INHERIT
|
||||||
|
&& volume < findContainingZone->screenshareZoneVolume) {
|
||||||
|
findContainingZone->isInScreenshareZone = screenshareProperty == COMPONENT_MODE_ENABLED;
|
||||||
findContainingZone->screenshareZoneVolume = volume;
|
findContainingZone->screenshareZoneVolume = volume;
|
||||||
findContainingZone->id = zoneItem->getEntityItemID();
|
findContainingZone->screenshareZoneid = zoneItem->getEntityItemID();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -162,12 +164,16 @@ int AvatarMixerClientData::parseData(ReceivedMessage& message, const SlaveShared
|
||||||
if (currentlyHasPriority != _avatar->getHasPriority()) {
|
if (currentlyHasPriority != _avatar->getHasPriority()) {
|
||||||
_avatar->setHasPriority(currentlyHasPriority);
|
_avatar->setHasPriority(currentlyHasPriority);
|
||||||
}
|
}
|
||||||
if (findContainingZone.isInScreenshareZone) {
|
bool isInScreenshareZone = findContainingZone.isInScreenshareZone;
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
if (isInScreenshareZone != _avatar->isInScreenshareZone()) {
|
||||||
auto packet = NLPacket::create(PacketType::AvatarZonePresence, 2 * NUM_BYTES_RFC4122_UUID, true);
|
_avatar->setInScreenshareZone(isInScreenshareZone);
|
||||||
packet->write(_avatar->getSessionUUID().toRfc4122());
|
if (isInScreenshareZone) {
|
||||||
packet->write(findContainingZone.id.toRfc4122());
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
nodeList->sendPacket(std::move(packet), nodeList->getDomainSockAddr());
|
auto packet = NLPacket::create(PacketType::AvatarZonePresence, 2 * NUM_BYTES_RFC4122_UUID, true);
|
||||||
|
packet->write(_avatar->getSessionUUID().toRfc4122());
|
||||||
|
packet->write(findContainingZone.screenshareZoneid.toRfc4122());
|
||||||
|
nodeList->sendPacket(std::move(packet), nodeList->getDomainSockAddr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_avatar->setNeedsHeroCheck(false);
|
_avatar->setNeedsHeroCheck(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,9 @@ public:
|
||||||
};
|
};
|
||||||
Q_ENUM(VerifyState)
|
Q_ENUM(VerifyState)
|
||||||
|
|
||||||
|
bool isInScreenshareZone() const { return _inScreenshareZone; }
|
||||||
|
void setInScreenshareZone(bool value = true) { _inScreenshareZone = value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _needsHeroCheck { false };
|
bool _needsHeroCheck { false };
|
||||||
static const char* stateToName(VerifyState state);
|
static const char* stateToName(VerifyState state);
|
||||||
|
@ -65,6 +68,7 @@ private:
|
||||||
int _numberChallenges { 0 };
|
int _numberChallenges { 0 };
|
||||||
bool _certifyFailed { false };
|
bool _certifyFailed { false };
|
||||||
bool _needsIdentityUpdate { false };
|
bool _needsIdentityUpdate { false };
|
||||||
|
bool _inScreenshareZone { false };
|
||||||
|
|
||||||
bool generateFSTHash();
|
bool generateFSTHash();
|
||||||
bool validateFSTHash(const QString& publicKey) const;
|
bool validateFSTHash(const QString& publicKey) const;
|
||||||
|
|
Loading…
Reference in a new issue