mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:36:45 +02:00
pack the UUID with the avatar data
This commit is contained in:
parent
97966592e1
commit
6bd71da84e
5 changed files with 18 additions and 7 deletions
|
@ -102,7 +102,6 @@ Avatar::Avatar(Node* owningNode) :
|
||||||
_leadingAvatar(NULL),
|
_leadingAvatar(NULL),
|
||||||
_voxels(this),
|
_voxels(this),
|
||||||
_moving(false),
|
_moving(false),
|
||||||
_uuid(),
|
|
||||||
_initialized(false),
|
_initialized(false),
|
||||||
_handHoldingPosition(0.0f, 0.0f, 0.0f),
|
_handHoldingPosition(0.0f, 0.0f, 0.0f),
|
||||||
_maxArmLength(0.0f),
|
_maxArmLength(0.0f),
|
||||||
|
|
|
@ -155,9 +155,6 @@ public:
|
||||||
glm::quat getOrientation() const;
|
glm::quat getOrientation() const;
|
||||||
glm::quat getWorldAlignedOrientation() const;
|
glm::quat getWorldAlignedOrientation() const;
|
||||||
AvatarVoxelSystem* getVoxels() { return &_voxels; }
|
AvatarVoxelSystem* getVoxels() { return &_voxels; }
|
||||||
|
|
||||||
QUuid& getUUID() { return _uuid; }
|
|
||||||
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
|
||||||
|
|
||||||
// Get the position/rotation of a single body ball
|
// Get the position/rotation of a single body ball
|
||||||
void getBodyBallTransform(AvatarJointID jointID, glm::vec3& position, glm::quat& rotation) const;
|
void getBodyBallTransform(AvatarJointID jointID, glm::vec3& position, glm::quat& rotation) const;
|
||||||
|
@ -225,7 +222,6 @@ protected:
|
||||||
AvatarVoxelSystem _voxels;
|
AvatarVoxelSystem _voxels;
|
||||||
|
|
||||||
bool _moving; ///< set when position is changing
|
bool _moving; ///< set when position is changing
|
||||||
QUuid _uuid;
|
|
||||||
|
|
||||||
// protected methods...
|
// protected methods...
|
||||||
glm::vec3 getBodyRightDirection() const { return getOrientation() * IDENTITY_RIGHT; }
|
glm::vec3 getBodyRightDirection() const { return getOrientation() * IDENTITY_RIGHT; }
|
||||||
|
|
|
@ -23,6 +23,7 @@ static const float fingerVectorRadix = 4; // bits of precision when converting f
|
||||||
|
|
||||||
AvatarData::AvatarData(Node* owningNode) :
|
AvatarData::AvatarData(Node* owningNode) :
|
||||||
NodeData(owningNode),
|
NodeData(owningNode),
|
||||||
|
_uuid(),
|
||||||
_handPosition(0,0,0),
|
_handPosition(0,0,0),
|
||||||
_bodyYaw(-90.0),
|
_bodyYaw(-90.0),
|
||||||
_bodyPitch(0.0),
|
_bodyPitch(0.0),
|
||||||
|
@ -116,6 +117,11 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
_handData = new HandData(this);
|
_handData = new HandData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UUID
|
||||||
|
QByteArray uuidByteArray = _uuid.toRfc4122();
|
||||||
|
memcpy(destinationBuffer, &uuidByteArray, uuidByteArray.size());
|
||||||
|
destinationBuffer += uuidByteArray.size();
|
||||||
|
|
||||||
// Body world position
|
// Body world position
|
||||||
memcpy(destinationBuffer, &_position, sizeof(float) * 3);
|
memcpy(destinationBuffer, &_position, sizeof(float) * 3);
|
||||||
destinationBuffer += sizeof(float) * 3;
|
destinationBuffer += sizeof(float) * 3;
|
||||||
|
@ -249,6 +255,11 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
// push past the node ID
|
// push past the node ID
|
||||||
sourceBuffer += sizeof(uint16_t);
|
sourceBuffer += sizeof(uint16_t);
|
||||||
|
|
||||||
|
// UUID
|
||||||
|
const int NUM_BYTES_RFC4122_UUID = 16;
|
||||||
|
_uuid = QUuid::fromRfc4122(QByteArray((char*) sourceBuffer, NUM_BYTES_RFC4122_UUID));
|
||||||
|
sourceBuffer += NUM_BYTES_RFC4122_UUID;
|
||||||
|
|
||||||
// Body world position
|
// Body world position
|
||||||
memcpy(&_position, sourceBuffer, sizeof(float) * 3);
|
memcpy(&_position, sourceBuffer, sizeof(float) * 3);
|
||||||
sourceBuffer += sizeof(float) * 3;
|
sourceBuffer += sizeof(float) * 3;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QUuid>
|
||||||
#include <QtCore/QVariantMap>
|
#include <QtCore/QVariantMap>
|
||||||
|
|
||||||
#include <NodeData.h>
|
#include <NodeData.h>
|
||||||
|
@ -72,6 +73,9 @@ public:
|
||||||
int getBroadcastData(unsigned char* destinationBuffer);
|
int getBroadcastData(unsigned char* destinationBuffer);
|
||||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||||
|
|
||||||
|
QUuid& getUUID() { return _uuid; }
|
||||||
|
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
||||||
|
|
||||||
// Body Rotation
|
// Body Rotation
|
||||||
float getBodyYaw() const { return _bodyYaw; }
|
float getBodyYaw() const { return _bodyYaw; }
|
||||||
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
|
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
|
||||||
|
@ -79,7 +83,6 @@ public:
|
||||||
void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; }
|
void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; }
|
||||||
float getBodyRoll() const { return _bodyRoll; }
|
float getBodyRoll() const { return _bodyRoll; }
|
||||||
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
|
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
|
||||||
|
|
||||||
|
|
||||||
// Hand State
|
// Hand State
|
||||||
void setHandState(char s) { _handState = s; }
|
void setHandState(char s) { _handState = s; }
|
||||||
|
@ -133,6 +136,8 @@ public slots:
|
||||||
void setWantOcclusionCulling(bool wantOcclusionCulling) { _wantOcclusionCulling = wantOcclusionCulling; }
|
void setWantOcclusionCulling(bool wantOcclusionCulling) { _wantOcclusionCulling = wantOcclusionCulling; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
QUuid _uuid;
|
||||||
|
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
glm::vec3 _handPosition;
|
glm::vec3 _handPosition;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PACKET_TYPE_HEAD_DATA:
|
case PACKET_TYPE_HEAD_DATA:
|
||||||
return 8;
|
return 9;
|
||||||
|
|
||||||
case PACKET_TYPE_AVATAR_URLS:
|
case PACKET_TYPE_AVATAR_URLS:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue