mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:41:10 +02:00
fix differential avatar-joint sending to work if more than 2 avatars are in the domain
This commit is contained in:
parent
36ca789d92
commit
1071b98260
3 changed files with 30 additions and 28 deletions
|
@ -362,32 +362,34 @@ void AvatarMixer::broadcastAvatarData() {
|
||||||
} else {
|
} else {
|
||||||
nodeData->setMaxAvatarDistance(maxAvatarDistanceThisFrame);
|
nodeData->setMaxAvatarDistance(maxAvatarDistanceThisFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're done encoding this version of the otherAvatars. Update their "lastSent" joint-states so
|
|
||||||
// that we can notice differences, next time around.
|
|
||||||
nodeList->eachMatchingNode(
|
|
||||||
[&](const SharedNodePointer& otherNode)->bool {
|
|
||||||
if (!otherNode->getLinkedData()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (otherNode->getUUID() == node->getUUID()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
[&](const SharedNodePointer& otherNode) {
|
|
||||||
AvatarMixerClientData* otherNodeData = reinterpret_cast<AvatarMixerClientData*>(otherNode->getLinkedData());
|
|
||||||
MutexTryLocker lock(otherNodeData->getMutex());
|
|
||||||
if (!lock.isLocked()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
AvatarData& otherAvatar = otherNodeData->getAvatar();
|
|
||||||
otherAvatar.doneEncoding();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// We're done encoding this version of the otherAvatars. Update their "lastSent" joint-states so
|
||||||
|
// that we can notice differences, next time around.
|
||||||
|
nodeList->eachMatchingNode(
|
||||||
|
[&](const SharedNodePointer& otherNode)->bool {
|
||||||
|
if (!otherNode->getLinkedData()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (otherNode->getType() != NodeType::Agent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!otherNode->getActiveSocket()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
[&](const SharedNodePointer& otherNode) {
|
||||||
|
AvatarMixerClientData* otherNodeData = reinterpret_cast<AvatarMixerClientData*>(otherNode->getLinkedData());
|
||||||
|
MutexTryLocker lock(otherNodeData->getMutex());
|
||||||
|
if (!lock.isLocked()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AvatarData& otherAvatar = otherNodeData->getAvatar();
|
||||||
|
otherAvatar.doneEncoding();
|
||||||
|
});
|
||||||
|
|
||||||
_lastFrameTimestamp = QDateTime::currentMSecsSinceEpoch();
|
_lastFrameTimestamp = QDateTime::currentMSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,6 @@
|
||||||
|
|
||||||
quint64 DEFAULT_FILTERED_LOG_EXPIRY = 2 * USECS_PER_SECOND;
|
quint64 DEFAULT_FILTERED_LOG_EXPIRY = 2 * USECS_PER_SECOND;
|
||||||
|
|
||||||
// this controls how large a change in joint-rotation must be before the interface sends it to the avatar mixer
|
|
||||||
const float MIN_ROTATION_DOT = 0.9999999f;
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const glm::vec3 DEFAULT_LOCAL_AABOX_CORNER(-0.5f);
|
const glm::vec3 DEFAULT_LOCAL_AABOX_CORNER(-0.5f);
|
||||||
|
@ -249,7 +245,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
if (sendAll || _lastSentJointData[i].rotation != data.rotation) {
|
if (sendAll || _lastSentJointData[i].rotation != data.rotation) {
|
||||||
if (sendAll ||
|
if (sendAll ||
|
||||||
!cullSmallChanges ||
|
!cullSmallChanges ||
|
||||||
fabsf(glm::dot(data.rotation, _lastSentJointData[i].rotation)) <= MIN_ROTATION_DOT) {
|
fabsf(glm::dot(data.rotation, _lastSentJointData[i].rotation)) <= AVATAR_MIN_ROTATION_DOT) {
|
||||||
validity |= (1 << validityBit);
|
validity |= (1 << validityBit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,11 @@ const int AVATAR_BILLBOARD_PACKET_SEND_INTERVAL_MSECS = 5000;
|
||||||
// See also static AvatarData::defaultFullAvatarModelUrl().
|
// See also static AvatarData::defaultFullAvatarModelUrl().
|
||||||
const QString DEFAULT_FULL_AVATAR_MODEL_NAME = QString("Default");
|
const QString DEFAULT_FULL_AVATAR_MODEL_NAME = QString("Default");
|
||||||
|
|
||||||
|
// how often should we send a full report about joint rotations, even if they haven't changed?
|
||||||
const float AVATAR_SEND_FULL_UPDATE_RATIO = 0.02;
|
const float AVATAR_SEND_FULL_UPDATE_RATIO = 0.02;
|
||||||
|
// this controls how large a change in joint-rotation must be before the interface sends it to the avatar mixer
|
||||||
|
const float AVATAR_MIN_ROTATION_DOT = 0.99999999f;
|
||||||
|
|
||||||
|
|
||||||
// Where one's own Avatar begins in the world (will be overwritten if avatar data file is found).
|
// Where one's own Avatar begins in the world (will be overwritten if avatar data file is found).
|
||||||
// This is the start location in the Sandbox (xyz: 6270, 211, 6000).
|
// This is the start location in the Sandbox (xyz: 6270, 211, 6000).
|
||||||
|
|
Loading…
Reference in a new issue