diff --git a/avatar-mixer/src/main.cpp b/avatar-mixer/src/main.cpp index 8aa57c0ad4..c56ddf4802 100644 --- a/avatar-mixer/src/main.cpp +++ b/avatar-mixer/src/main.cpp @@ -32,7 +32,7 @@ #include #include -#include "AvatarAgentData.h" +#include "AvatarData.h" const int AVATAR_LISTEN_PORT = 55444; const unsigned short BROADCAST_INTERVAL_USECS = 20 * 1000 * 1000; @@ -40,7 +40,7 @@ const unsigned short BROADCAST_INTERVAL_USECS = 20 * 1000 * 1000; unsigned char *addAgentToBroadcastPacket(unsigned char *currentPosition, Agent *agentToAdd) { currentPosition += packAgentId(currentPosition, agentToAdd->getAgentId()); - AvatarAgentData *agentData = (AvatarAgentData *)agentToAdd->getLinkedData(); + AvatarData *agentData = (AvatarData *)agentToAdd->getLinkedData(); int bytesWritten = sprintf((char *)currentPosition, PACKET_FORMAT, @@ -62,7 +62,7 @@ unsigned char *addAgentToBroadcastPacket(unsigned char *currentPosition, Agent * void attachAvatarDataToAgent(Agent *newAgent) { if (newAgent->getLinkedData() == NULL) { - newAgent->setLinkedData(new AvatarAgentData()); + newAgent->setLinkedData(new AvatarData()); } } diff --git a/libraries/avatars/src/AvatarAgentData.cpp b/libraries/avatars/src/AvatarAgentData.cpp deleted file mode 100644 index 0ee5981c53..0000000000 --- a/libraries/avatars/src/AvatarAgentData.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// -// AvatarAgentData.cpp -// hifi -// -// Created by Stephen Birarda on 4/9/13. -// -// - -#include - -#include "AvatarAgentData.h" - -AvatarAgentData::AvatarAgentData() { - -} - -AvatarAgentData::~AvatarAgentData() { - -} - -AvatarAgentData* AvatarAgentData::clone() const { - return new AvatarAgentData(*this); -} - -void AvatarAgentData::parseData(void *data, int size) { - char* packetData = (char *)data + 1; - - // Extract data from packet - sscanf(packetData, - PACKET_FORMAT, - &_pitch, - &_yaw, - &_roll, - &_headPositionX, - &_headPositionY, - &_headPositionZ, - &_loudness, - &_averageLoudness, - &_handPositionX, - &_handPositionY, - &_handPositionZ); -} - -float AvatarAgentData::getPitch() { - return _pitch; -} - -float AvatarAgentData::getYaw() { - return _yaw; -} - -float AvatarAgentData::getRoll() { - return _roll; -} - -float AvatarAgentData::getHeadPositionX() { - return _headPositionX; -} - -float AvatarAgentData::getHeadPositionY() { - return _headPositionY; -} - -float AvatarAgentData::getHeadPositionZ() { - return _headPositionZ; -} - -float AvatarAgentData::getLoudness() { - return _loudness; -} - -float AvatarAgentData::getAverageLoudness() { - return _averageLoudness; -} - -float AvatarAgentData::getHandPositionX() { - return _handPositionX; -} - -float AvatarAgentData::getHandPositionY() { - return _handPositionY; -} - -float AvatarAgentData::getHandPositionZ() { - return _handPositionZ; -} - -void AvatarAgentData::setPitch(float pitch) { - _pitch = pitch; -} - -void AvatarAgentData::setYaw(float yaw) { - _yaw = yaw; -} - -void AvatarAgentData::setRoll(float roll) { - _roll = roll; -} - -void AvatarAgentData::setHeadPosition(float x, float y, float z) { - _headPositionX = x; - _headPositionY = y; - _headPositionZ = z; -} - -void AvatarAgentData::setLoudness(float loudness) { - _loudness = loudness; -} - -void AvatarAgentData::setAverageLoudness(float averageLoudness) { - _averageLoudness = averageLoudness; -} - -void AvatarAgentData::setHandPosition(float x, float y, float z) { - _handPositionX = x; - _handPositionY = y; - _handPositionZ = z; -} diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp new file mode 100644 index 0000000000..c1f862b14c --- /dev/null +++ b/libraries/avatars/src/AvatarData.cpp @@ -0,0 +1,118 @@ +// +// AvatarData.cpp +// hifi +// +// Created by Stephen Birarda on 4/9/13. +// +// + +#include + +#include "AvatarData.h" + +AvatarData::AvatarData() { + +} + +AvatarData::~AvatarData() { + +} + +AvatarData* AvatarData::clone() const { + return new AvatarData(*this); +} + +void AvatarData::parseData(void *data, int size) { + char* packetData = (char *)data + 1; + +// // Extract data from packet +// sscanf(packetData, +// PACKET_FORMAT, +// &_pitch, +// &_yaw, +// &_roll, +// &_headPositionX, +// &_headPositionY, +// &_headPositionZ, +// &_loudness, +// &_averageLoudness, +// &_handPositionX, +// &_handPositionY, +// &_handPositionZ); +} + +float AvatarData::getPitch() { + return _pitch; +} + +float AvatarData::getYaw() { + return _yaw; +} + +float AvatarData::getRoll() { + return _roll; +} + +float AvatarData::getHeadPositionX() { + return _headPositionX; +} + +float AvatarData::getHeadPositionY() { + return _headPositionY; +} + +float AvatarData::getHeadPositionZ() { + return _headPositionZ; +} + +float AvatarData::getLoudness() { + return _loudness; +} + +float AvatarData::getAverageLoudness() { + return _averageLoudness; +} + +float AvatarData::getHandPositionX() { + return _handPositionX; +} + +float AvatarData::getHandPositionY() { + return _handPositionY; +} + +float AvatarData::getHandPositionZ() { + return _handPositionZ; +} + +void AvatarData::setPitch(float pitch) { + _pitch = pitch; +} + +void AvatarData::setYaw(float yaw) { + _yaw = yaw; +} + +void AvatarData::setRoll(float roll) { + _roll = roll; +} + +void AvatarData::setHeadPosition(float x, float y, float z) { + _headPositionX = x; + _headPositionY = y; + _headPositionZ = z; +} + +void AvatarData::setLoudness(float loudness) { + _loudness = loudness; +} + +void AvatarData::setAverageLoudness(float averageLoudness) { + _averageLoudness = averageLoudness; +} + +void AvatarData::setHandPosition(float x, float y, float z) { + _handPositionX = x; + _handPositionY = y; + _handPositionZ = z; +} diff --git a/libraries/avatars/src/AvatarAgentData.h b/libraries/avatars/src/AvatarData.h similarity index 75% rename from libraries/avatars/src/AvatarAgentData.h rename to libraries/avatars/src/AvatarData.h index 2b06928886..b22ce5df1f 100644 --- a/libraries/avatars/src/AvatarAgentData.h +++ b/libraries/avatars/src/AvatarData.h @@ -1,26 +1,24 @@ // -// AvatarAgentData.h +// AvatarData.h // hifi // // Created by Stephen Birarda on 4/9/13. // // -#ifndef __hifi__AvatarAgentData__ -#define __hifi__AvatarAgentData__ +#ifndef __hifi__AvatarData__ +#define __hifi__AvatarData__ #include #include -const char PACKET_FORMAT[] = "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f"; - -class AvatarAgentData : public AgentData { +class AvatarData : public AgentData { public: - AvatarAgentData(); - ~AvatarAgentData(); + AvatarData(); + ~AvatarData(); void parseData(void *data, int size); - AvatarAgentData* clone() const; + AvatarData* clone() const; float getPitch(); void setPitch(float pitch); @@ -55,4 +53,4 @@ private: float _handPositionZ; }; -#endif /* defined(__hifi__AvatarAgentData__) */ +#endif /* defined(__hifi__AvatarData__) */