mirror of
https://github.com/overte-org/overte.git
synced 2025-08-13 19:19:42 +02:00
add parsing of PacketTypeAvatarIdentity to AvatarMixer
This commit is contained in:
parent
e879a7f18d
commit
31bd5f7ce8
3 changed files with 71 additions and 2 deletions
|
@ -19,7 +19,7 @@
|
|||
#include <SharedUtil.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include "AvatarData.h"
|
||||
#include "AvatarMixerClientData.h"
|
||||
|
||||
#include "AvatarMixer.h"
|
||||
|
||||
|
@ -36,7 +36,7 @@ AvatarMixer::AvatarMixer(const QByteArray& packet) :
|
|||
|
||||
void attachAvatarDataToNode(Node* newNode) {
|
||||
if (newNode->getLinkedData() == NULL) {
|
||||
newNode->setLinkedData(new AvatarData());
|
||||
newNode->setLinkedData(new AvatarMixerClientData());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,6 +130,18 @@ void AvatarMixer::processDatagram(const QByteArray& dataByteArray, const HifiSoc
|
|||
}
|
||||
break;
|
||||
}
|
||||
case PacketTypeAvatarIdentity: {
|
||||
QUuid nodeUUID;
|
||||
deconstructPacketHeader(dataByteArray, nodeUUID);
|
||||
|
||||
// check if we have a matching node in our list
|
||||
SharedNodePointer avatarNode = nodeList->nodeWithUUID(nodeUUID);
|
||||
|
||||
if (avatarNode) {
|
||||
// process the avatar identity packet sent from the avatar
|
||||
reinterpret_cast<AvatarMixerClientData*>(avatarNode->getLinkedData())->parseIdentityPacket(dataByteArray);
|
||||
}
|
||||
}
|
||||
case PacketTypeKillAvatar: {
|
||||
nodeList->processKillNode(dataByteArray);
|
||||
break;
|
||||
|
@ -155,6 +167,8 @@ void AvatarMixer::run() {
|
|||
|
||||
gettimeofday(&startTime, NULL);
|
||||
|
||||
|
||||
|
||||
while (!_isFinished) {
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
|
|
25
assignment-client/src/avatars/AvatarMixerClientData.cpp
Normal file
25
assignment-client/src/avatars/AvatarMixerClientData.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// AvatarMixerClientData.cpp
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 2/4/2014.
|
||||
// Copyright (c) 2014 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include "AvatarMixerClientData.h"
|
||||
|
||||
void AvatarMixerClientData::parseIdentityPacket(const QByteArray &packet) {
|
||||
QDataStream packetStream(packet);
|
||||
packetStream.skipRawData(numBytesForPacketHeader(packet));
|
||||
|
||||
QUrl faceModelURL, skeletonURL;
|
||||
packetStream >> faceModelURL >> skeletonURL;
|
||||
|
||||
if (faceModelURL != _faceModelURL) {
|
||||
_faceModelURL = faceModelURL;
|
||||
}
|
||||
|
||||
if (skeletonURL != _skeletonURL) {
|
||||
_skeletonURL = skeletonURL;
|
||||
}
|
||||
}
|
30
assignment-client/src/avatars/AvatarMixerClientData.h
Normal file
30
assignment-client/src/avatars/AvatarMixerClientData.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// AvatarMixerClientData.h
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 2/4/2014.
|
||||
// Copyright (c) 2014 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __hifi__AvatarMixerClientData__
|
||||
#define __hifi__AvatarMixerClientData__
|
||||
|
||||
#include <QtCore/QUrl>
|
||||
|
||||
#include <AvatarData.h>
|
||||
|
||||
class AvatarMixerClientData : public AvatarData {
|
||||
public:
|
||||
const QUrl& getFaceModelURL() const { return _faceModelURL; }
|
||||
void setFaceModelURL(const QUrl& faceModelURL) { _faceModelURL = faceModelURL; }
|
||||
|
||||
const QUrl& getSkeletonURL() const { return _skeletonURL; }
|
||||
void setSkeletonURL(const QUrl& skeletonURL) { _skeletonURL = skeletonURL; }
|
||||
|
||||
void parseIdentityPacket(const QByteArray& packet);
|
||||
private:
|
||||
QUrl _faceModelURL;
|
||||
QUrl _skeletonURL;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__AvatarMixerClientData__) */
|
Loading…
Reference in a new issue