mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:43:35 +02:00
send mesh and billboard on receiver's first connect
This commit is contained in:
parent
e8b9594758
commit
e6b83ac52d
3 changed files with 16 additions and 4 deletions
|
@ -102,14 +102,16 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
// copy the avatar into the mixedAvatarByteArray packet
|
||||
mixedAvatarByteArray.append(avatarByteArray);
|
||||
|
||||
if (randFloat() < BILLBOARD_AND_IDENTITY_SEND_PROBABILITY) {
|
||||
bool forceSend = !myData->checkAndSetHasReceivedFirstPackets();
|
||||
|
||||
if (randFloat() < BILLBOARD_AND_IDENTITY_SEND_PROBABILITY || forceSend) {
|
||||
QByteArray billboardPacket = byteArrayWithPopulatedHeader(PacketTypeAvatarBillboard);
|
||||
billboardPacket.append(otherNode->getUUID().toRfc4122());
|
||||
billboardPacket.append(otherNodeData->getAvatar().getBillboard());
|
||||
nodeList->writeDatagram(billboardPacket, node);
|
||||
}
|
||||
|
||||
if (randFloat() < BILLBOARD_AND_IDENTITY_SEND_PROBABILITY) {
|
||||
if (randFloat() < BILLBOARD_AND_IDENTITY_SEND_PROBABILITY || forceSend) {
|
||||
QByteArray identityPacket = byteArrayWithPopulatedHeader(PacketTypeAvatarIdentity);
|
||||
|
||||
QByteArray individualData = otherNodeData->getAvatar().identityByteArray();
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "AvatarMixerClientData.h"
|
||||
|
||||
AvatarMixerClientData::AvatarMixerClientData() :
|
||||
NodeData()
|
||||
NodeData(),
|
||||
_hasReceivedFirstPackets(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -19,3 +20,9 @@ int AvatarMixerClientData::parseData(const QByteArray& packet) {
|
|||
int offset = numBytesForPacketHeader(packet);
|
||||
return _avatar.parseDataAtOffset(packet, offset);
|
||||
}
|
||||
|
||||
bool AvatarMixerClientData::checkAndSetHasReceivedFirstPackets() {
|
||||
bool oldValue = _hasReceivedFirstPackets;
|
||||
_hasReceivedFirstPackets = true;
|
||||
return oldValue;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,12 @@ public:
|
|||
|
||||
int parseData(const QByteArray& packet);
|
||||
AvatarData& getAvatar() { return _avatar; }
|
||||
|
||||
|
||||
bool checkAndSetHasReceivedFirstPackets();
|
||||
|
||||
private:
|
||||
AvatarData _avatar;
|
||||
bool _hasReceivedFirstPackets;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__AvatarMixerClientData__) */
|
||||
|
|
Loading…
Reference in a new issue