mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 09:23:17 +02:00
Add isReplicated to avatar identity data
This commit is contained in:
parent
b3824c6a25
commit
8ce1474d9a
4 changed files with 19 additions and 5 deletions
|
@ -236,7 +236,7 @@ void AvatarMixer::start() {
|
|||
auto start = usecTimestampNow();
|
||||
nodeList->nestedEach([&](NodeList::const_iterator cbegin, NodeList::const_iterator cend) {
|
||||
std::for_each(cbegin, cend, [&](const SharedNodePointer& node) {
|
||||
if (node->getType() == NodeType::Agent && !node->isUpstream()) {
|
||||
if (node->getType() == NodeType::Agent) {
|
||||
manageIdentityData(node);
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ void AvatarMixer::manageIdentityData(const SharedNodePointer& node) {
|
|||
sendIdentity = true;
|
||||
}
|
||||
}
|
||||
if (sendIdentity) {
|
||||
if (sendIdentity && !node->isUpstream()) {
|
||||
sendIdentityPacket(nodeData, node); // Tell node whose name changed about its new session display name or avatar.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ int AvatarMixerSlave::sendIdentityPacket(const AvatarMixerClientData* nodeData,
|
|||
|
||||
int AvatarMixerSlave::sendReplicatedIdentityPacket(const AvatarMixerClientData* nodeData, const SharedNodePointer& destinationNode) {
|
||||
if (destinationNode->getType() == NodeType::DownstreamAvatarMixer) {
|
||||
QByteArray individualData = nodeData->getConstAvatarData()->identityByteArray(true);
|
||||
QByteArray individualData = nodeData->getConstAvatarData()->identityByteArray(true, true);
|
||||
individualData.replace(0, NUM_BYTES_RFC4122_UUID, nodeData->getNodeID().toRfc4122()); // FIXME, this looks suspicious
|
||||
auto identityPacket = NLPacket::create(PacketType::ReplicatedAvatarIdentity);
|
||||
identityPacket->write(individualData);
|
||||
|
|
|
@ -1509,6 +1509,7 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
|||
>> identity.attachmentData
|
||||
>> identity.displayName
|
||||
>> identity.sessionDisplayName
|
||||
>> identity.isReplicated
|
||||
>> identity.avatarEntityData;
|
||||
|
||||
// set the store identity sequence number to match the incoming identity
|
||||
|
@ -1531,6 +1532,11 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
|||
}
|
||||
maybeUpdateSessionDisplayNameFromTransport(identity.sessionDisplayName);
|
||||
|
||||
if (identity.isReplicated != _isReplicated) {
|
||||
_isReplicated = identity.isReplicated;
|
||||
identityChanged = true;
|
||||
}
|
||||
|
||||
if (identity.attachmentData != _attachmentData) {
|
||||
setAttachmentData(identity.attachmentData);
|
||||
identityChanged = true;
|
||||
|
@ -1563,7 +1569,7 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
|||
}
|
||||
}
|
||||
|
||||
QByteArray AvatarData::identityByteArray(bool shouldForwardIncomingSequenceNumber) const {
|
||||
QByteArray AvatarData::identityByteArray(bool shouldForwardIncomingSequenceNumber, bool setIsReplicated) const {
|
||||
QByteArray identityData;
|
||||
QDataStream identityStream(&identityData, QIODevice::Append);
|
||||
const QUrl& urlToSend = cannonicalSkeletonModelURL(emptyURL); // depends on _skeletonModelURL
|
||||
|
@ -1584,6 +1590,7 @@ QByteArray AvatarData::identityByteArray(bool shouldForwardIncomingSequenceNumbe
|
|||
<< _attachmentData
|
||||
<< _displayName
|
||||
<< getSessionDisplayNameForTransport() // depends on _sessionDisplayName
|
||||
<< (_isReplicated || setIsReplicated)
|
||||
<< _avatarEntityData;
|
||||
});
|
||||
|
||||
|
|
|
@ -531,6 +531,7 @@ public:
|
|||
QVector<AttachmentData> attachmentData;
|
||||
QString displayName;
|
||||
QString sessionDisplayName;
|
||||
bool isReplicated;
|
||||
AvatarEntityMap avatarEntityData;
|
||||
};
|
||||
|
||||
|
@ -539,7 +540,7 @@ public:
|
|||
void processAvatarIdentity(const QByteArray& identityData, bool& identityChanged,
|
||||
bool& displayNameChanged, bool& skeletonModelUrlChanged);
|
||||
|
||||
QByteArray identityByteArray(bool shouldForwardIncomingSequenceNumber = false) const;
|
||||
QByteArray identityByteArray(bool shouldForwardIncomingSequenceNumber = false, bool setIsReplicated = false) const;
|
||||
|
||||
const QUrl& getSkeletonModelURL() const { return _skeletonModelURL; }
|
||||
const QString& getDisplayName() const { return _displayName; }
|
||||
|
@ -627,6 +628,8 @@ public:
|
|||
|
||||
float getDensity() const { return _density; }
|
||||
|
||||
bool getIsReplicated() const { return _isReplicated; }
|
||||
|
||||
signals:
|
||||
void displayNameChanged();
|
||||
|
||||
|
@ -663,6 +666,10 @@ protected:
|
|||
bool hasParent() const { return !getParentID().isNull(); }
|
||||
bool hasFaceTracker() const { return _headData ? _headData->_isFaceTrackerConnected : false; }
|
||||
|
||||
// isReplicated will be true on downstream Avatar Mixers and their clients, but false on the upstream "master"
|
||||
// Audio Mixer that the replicated avatar is connected to.
|
||||
bool _isReplicated{ false };
|
||||
|
||||
glm::vec3 _handPosition;
|
||||
virtual const QString& getSessionDisplayNameForTransport() const { return _sessionDisplayName; }
|
||||
virtual void maybeUpdateSessionDisplayNameFromTransport(const QString& sessionDisplayName) { } // No-op in AvatarMixer
|
||||
|
|
Loading…
Reference in a new issue