mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Basically rebase and squash
This commit is contained in:
parent
781e0be0e3
commit
c9c07c4269
5 changed files with 71 additions and 58 deletions
|
@ -137,14 +137,18 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
|
||||||
// keep track of the number of other avatar frames skipped
|
// keep track of the number of other avatar frames skipped
|
||||||
int numAvatarsWithSkippedFrames = 0;
|
int numAvatarsWithSkippedFrames = 0;
|
||||||
|
|
||||||
// When this is true, the AvatarMixer will send Avatar data to a client about avatars that are not in the view frustrum
|
// When this is true, the AvatarMixer will send Avatar data to a client
|
||||||
bool getsOutOfView = nodeData->getRequestsDomainListData();
|
// about avatars they've ignored or that are out of view
|
||||||
|
bool PALIsOpen = nodeData->getRequestsDomainListData();
|
||||||
// When this is true, the AvatarMixer will send Avatar data to a client about avatars that they've ignored
|
|
||||||
bool getsIgnoredByMe = getsOutOfView;
|
|
||||||
|
|
||||||
// When this is true, the AvatarMixer will send Avatar data to a client about avatars that have ignored them
|
// When this is true, the AvatarMixer will send Avatar data to a client about avatars that have ignored them
|
||||||
bool getsAnyIgnored = getsIgnoredByMe && node->getCanKick();
|
bool getsAnyIgnored = PALIsOpen && node->getCanKick();
|
||||||
|
|
||||||
|
// Increase minimumBytesPerAvatar if the PAL is open or we're gettingAnyIgnored
|
||||||
|
if (PALIsOpen || getsAnyIgnored) {
|
||||||
|
minimumBytesPerAvatar += sizeof(AvatarDataPacket::AvatarGlobalPosition) +
|
||||||
|
sizeof(AvatarDataPacket::AudioLoudness);
|
||||||
|
}
|
||||||
|
|
||||||
// setup a PacketList for the avatarPackets
|
// setup a PacketList for the avatarPackets
|
||||||
auto avatarPacketList = NLPacketList::create(PacketType::BulkAvatarData);
|
auto avatarPacketList = NLPacketList::create(PacketType::BulkAvatarData);
|
||||||
|
@ -222,7 +226,7 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
|
||||||
// or that has ignored the viewing node
|
// or that has ignored the viewing node
|
||||||
if (!avatarNode->getLinkedData()
|
if (!avatarNode->getLinkedData()
|
||||||
|| avatarNode->getUUID() == node->getUUID()
|
|| avatarNode->getUUID() == node->getUUID()
|
||||||
|| (node->isIgnoringNodeWithID(avatarNode->getUUID()) && !getsIgnoredByMe)
|
|| (node->isIgnoringNodeWithID(avatarNode->getUUID()) && !PALIsOpen)
|
||||||
|| (avatarNode->isIgnoringNodeWithID(node->getUUID()) && !getsAnyIgnored)) {
|
|| (avatarNode->isIgnoringNodeWithID(node->getUUID()) && !getsAnyIgnored)) {
|
||||||
shouldIgnore = true;
|
shouldIgnore = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -335,9 +339,9 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
|
||||||
if (overBudget) {
|
if (overBudget) {
|
||||||
overBudgetAvatars++;
|
overBudgetAvatars++;
|
||||||
_stats.overBudgetAvatars++;
|
_stats.overBudgetAvatars++;
|
||||||
detail = AvatarData::NoData;
|
detail = (PALIsOpen || getsAnyIgnored) ? AvatarData::PALMinimum : AvatarData::NoData;
|
||||||
} else if (!isInView && !getsOutOfView) {
|
} else if (!isInView) {
|
||||||
detail = AvatarData::NoData;
|
detail = (PALIsOpen || getsAnyIgnored) ? AvatarData::PALMinimum : AvatarData::NoData;
|
||||||
nodeData->incrementAvatarOutOfView();
|
nodeData->incrementAvatarOutOfView();
|
||||||
} else {
|
} else {
|
||||||
detail = distribution(generator) < AVATAR_SEND_FULL_UPDATE_RATIO
|
detail = distribution(generator) < AVATAR_SEND_FULL_UPDATE_RATIO
|
||||||
|
|
|
@ -329,7 +329,7 @@ void AvatarManager::removeAvatar(const QUuid& sessionUUID, KillAvatarReason remo
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) {
|
void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) {
|
||||||
AvatarHashMap::handleRemovedAvatar(removedAvatar);
|
AvatarHashMap::handleRemovedAvatar(removedAvatar, removalReason);
|
||||||
|
|
||||||
// removedAvatar is a shared pointer to an AvatarData but we need to get to the derived Avatar
|
// removedAvatar is a shared pointer to an AvatarData but we need to get to the derived Avatar
|
||||||
// class in this context so we can call methods that don't exist at the base class.
|
// class in this context so we can call methods that don't exist at the base class.
|
||||||
|
|
|
@ -186,6 +186,7 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
||||||
bool cullSmallChanges = (dataDetail == CullSmallData);
|
bool cullSmallChanges = (dataDetail == CullSmallData);
|
||||||
bool sendAll = (dataDetail == SendAllData);
|
bool sendAll = (dataDetail == SendAllData);
|
||||||
bool sendMinimum = (dataDetail == MinimumData);
|
bool sendMinimum = (dataDetail == MinimumData);
|
||||||
|
bool sendPALMinimum = (dataDetail == PALMinimum);
|
||||||
|
|
||||||
lazyInitHeadData();
|
lazyInitHeadData();
|
||||||
|
|
||||||
|
@ -222,24 +223,45 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
||||||
auto parentID = getParentID();
|
auto parentID = getParentID();
|
||||||
|
|
||||||
bool hasAvatarGlobalPosition = true; // always include global position
|
bool hasAvatarGlobalPosition = true; // always include global position
|
||||||
bool hasAvatarOrientation = sendAll || rotationChangedSince(lastSentTime);
|
bool hasAvatarOrientation = false;
|
||||||
bool hasAvatarBoundingBox = sendAll || avatarBoundingBoxChangedSince(lastSentTime);
|
bool hasAvatarBoundingBox = false;
|
||||||
bool hasAvatarScale = sendAll || avatarScaleChangedSince(lastSentTime);
|
bool hasAvatarScale = false;
|
||||||
bool hasLookAtPosition = sendAll || lookAtPositionChangedSince(lastSentTime);
|
bool hasLookAtPosition = false;
|
||||||
bool hasAudioLoudness = sendAll || audioLoudnessChangedSince(lastSentTime);
|
bool hasAudioLoudness = false;
|
||||||
bool hasSensorToWorldMatrix = sendAll || sensorToWorldMatrixChangedSince(lastSentTime);
|
bool hasSensorToWorldMatrix = false;
|
||||||
bool hasAdditionalFlags = sendAll || additionalFlagsChangedSince(lastSentTime);
|
bool hasAdditionalFlags = false;
|
||||||
|
|
||||||
// local position, and parent info only apply to avatars that are parented. The local position
|
// local position, and parent info only apply to avatars that are parented. The local position
|
||||||
// and the parent info can change independently though, so we track their "changed since"
|
// and the parent info can change independently though, so we track their "changed since"
|
||||||
// separately
|
// separately
|
||||||
bool hasParentInfo = sendAll || parentInfoChangedSince(lastSentTime);
|
bool hasParentInfo = false;
|
||||||
bool hasAvatarLocalPosition = hasParent() && (sendAll ||
|
bool hasAvatarLocalPosition = false;
|
||||||
tranlationChangedSince(lastSentTime) ||
|
|
||||||
parentInfoChangedSince(lastSentTime));
|
|
||||||
|
|
||||||
bool hasFaceTrackerInfo = !dropFaceTracking && hasFaceTracker() && (sendAll || faceTrackerInfoChangedSince(lastSentTime));
|
bool hasFaceTrackerInfo = false;
|
||||||
bool hasJointData = sendAll || !sendMinimum;
|
bool hasJointData = false;
|
||||||
|
|
||||||
|
if (sendPALMinimum) {
|
||||||
|
hasAudioLoudness = true;
|
||||||
|
} else {
|
||||||
|
hasAvatarOrientation = sendAll || rotationChangedSince(lastSentTime);
|
||||||
|
hasAvatarBoundingBox = sendAll || avatarBoundingBoxChangedSince(lastSentTime);
|
||||||
|
hasAvatarScale = sendAll || avatarScaleChangedSince(lastSentTime);
|
||||||
|
hasLookAtPosition = sendAll || lookAtPositionChangedSince(lastSentTime);
|
||||||
|
hasAudioLoudness = sendAll || audioLoudnessChangedSince(lastSentTime);
|
||||||
|
hasSensorToWorldMatrix = sendAll || sensorToWorldMatrixChangedSince(lastSentTime);
|
||||||
|
hasAdditionalFlags = sendAll || additionalFlagsChangedSince(lastSentTime);
|
||||||
|
|
||||||
|
// local position, and parent info only apply to avatars that are parented. The local position
|
||||||
|
// and the parent info can change independently though, so we track their "changed since"
|
||||||
|
// separately
|
||||||
|
hasParentInfo = sendAll || parentInfoChangedSince(lastSentTime);
|
||||||
|
hasAvatarLocalPosition = hasParent() && (sendAll ||
|
||||||
|
tranlationChangedSince(lastSentTime) ||
|
||||||
|
parentInfoChangedSince(lastSentTime));
|
||||||
|
|
||||||
|
hasFaceTrackerInfo = !dropFaceTracking && hasFaceTracker() && (sendAll || faceTrackerInfoChangedSince(lastSentTime));
|
||||||
|
hasJointData = sendAll || !sendMinimum;
|
||||||
|
}
|
||||||
|
|
||||||
// Leading flags, to indicate how much data is actually included in the packet...
|
// Leading flags, to indicate how much data is actually included in the packet...
|
||||||
AvatarDataPacket::HasFlags packetStateFlags =
|
AvatarDataPacket::HasFlags packetStateFlags =
|
||||||
|
|
|
@ -379,7 +379,8 @@ public:
|
||||||
MinimumData,
|
MinimumData,
|
||||||
CullSmallData,
|
CullSmallData,
|
||||||
IncludeSmallData,
|
IncludeSmallData,
|
||||||
SendAllData
|
SendAllData,
|
||||||
|
PALMinimum
|
||||||
} AvatarDataDetail;
|
} AvatarDataDetail;
|
||||||
|
|
||||||
virtual QByteArray toByteArrayStateful(AvatarDataDetail dataDetail);
|
virtual QByteArray toByteArrayStateful(AvatarDataDetail dataDetail);
|
||||||
|
|
|
@ -526,17 +526,23 @@ var button;
|
||||||
var buttonName = "PEOPLE";
|
var buttonName = "PEOPLE";
|
||||||
var tablet = null;
|
var tablet = null;
|
||||||
|
|
||||||
|
function onTabletScreenChanged(type, url) {
|
||||||
|
if (type !== "QML" || url !== "../Pal.qml") {
|
||||||
|
off();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function startup() {
|
function startup() {
|
||||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
button = tablet.addButton({
|
button = tablet.addButton({
|
||||||
text: buttonName,
|
text: buttonName,
|
||||||
icon: "icons/tablet-icons/people-i.svg",
|
icon: "icons/tablet-icons/people-i.svg",
|
||||||
activeIcon: "icons/tablet-icons/people-a.svg",
|
|
||||||
sortOrder: 7
|
sortOrder: 7
|
||||||
});
|
});
|
||||||
tablet.fromQml.connect(fromQml);
|
tablet.fromQml.connect(fromQml);
|
||||||
button.clicked.connect(onTabletButtonClicked);
|
button.clicked.connect(onTabletButtonClicked);
|
||||||
tablet.screenChanged.connect(onTabletScreenChanged);
|
tablet.screenChanged.connect(onTabletScreenChanged);
|
||||||
|
|
||||||
Users.usernameFromIDReply.connect(usernameFromIDReply);
|
Users.usernameFromIDReply.connect(usernameFromIDReply);
|
||||||
Window.domainChanged.connect(clearLocalQMLDataAndClosePAL);
|
Window.domainChanged.connect(clearLocalQMLDataAndClosePAL);
|
||||||
Window.domainConnectionRefused.connect(clearLocalQMLDataAndClosePAL);
|
Window.domainConnectionRefused.connect(clearLocalQMLDataAndClosePAL);
|
||||||
|
@ -567,39 +573,17 @@ function off() {
|
||||||
Users.requestsDomainListData = false;
|
Users.requestsDomainListData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var onPalScreen = false;
|
|
||||||
var shouldActivateButton = false;
|
|
||||||
|
|
||||||
function onTabletButtonClicked() {
|
function onTabletButtonClicked() {
|
||||||
if (onPalScreen) {
|
tablet.loadQMLSource("../Pal.qml");
|
||||||
// for toolbar-mode: go back to home screen, this will close the window.
|
Users.requestsDomainListData = true;
|
||||||
tablet.gotoHomeScreen();
|
populateUserList();
|
||||||
} else {
|
isWired = true;
|
||||||
shouldActivateButton = true;
|
Script.update.connect(updateOverlays);
|
||||||
tablet.loadQMLSource("../Pal.qml");
|
Controller.mousePressEvent.connect(handleMouseEvent);
|
||||||
onPalScreen = true;
|
Controller.mouseMoveEvent.connect(handleMouseMoveEvent);
|
||||||
Users.requestsDomainListData = true;
|
triggerMapping.enable();
|
||||||
populateUserList();
|
triggerPressMapping.enable();
|
||||||
isWired = true;
|
audioTimer = createAudioInterval(conserveResources ? AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS : AUDIO_LEVEL_UPDATE_INTERVAL_MS);
|
||||||
Script.update.connect(updateOverlays);
|
|
||||||
Controller.mousePressEvent.connect(handleMouseEvent);
|
|
||||||
Controller.mouseMoveEvent.connect(handleMouseMoveEvent);
|
|
||||||
triggerMapping.enable();
|
|
||||||
triggerPressMapping.enable();
|
|
||||||
audioTimer = createAudioInterval(conserveResources ? AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS : AUDIO_LEVEL_UPDATE_INTERVAL_MS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTabletScreenChanged(type, url) {
|
|
||||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
|
||||||
button.editProperties({isActive: shouldActivateButton});
|
|
||||||
shouldActivateButton = false;
|
|
||||||
onPalScreen = false;
|
|
||||||
|
|
||||||
// disable sphere overlays when not on pal screen.
|
|
||||||
if (type !== "QML" || url !== "../Pal.qml") {
|
|
||||||
off();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -699,12 +683,14 @@ function shutdown() {
|
||||||
button.clicked.disconnect(onTabletButtonClicked);
|
button.clicked.disconnect(onTabletButtonClicked);
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
||||||
|
|
||||||
Users.usernameFromIDReply.disconnect(usernameFromIDReply);
|
Users.usernameFromIDReply.disconnect(usernameFromIDReply);
|
||||||
Window.domainChanged.disconnect(clearLocalQMLDataAndClosePAL);
|
Window.domainChanged.disconnect(clearLocalQMLDataAndClosePAL);
|
||||||
Window.domainConnectionRefused.disconnect(clearLocalQMLDataAndClosePAL);
|
Window.domainConnectionRefused.disconnect(clearLocalQMLDataAndClosePAL);
|
||||||
Messages.subscribe(CHANNEL);
|
Messages.subscribe(CHANNEL);
|
||||||
Messages.messageReceived.disconnect(receiveMessage);
|
Messages.messageReceived.disconnect(receiveMessage);
|
||||||
Users.avatarDisconnected.disconnect(avatarDisconnected);
|
Users.avatarDisconnected.disconnect(avatarDisconnected);
|
||||||
|
|
||||||
off();
|
off();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue