update agent-mixer to use new AvatarData class

This commit is contained in:
Stephen Birarda 2013-04-15 18:19:01 -07:00
parent a5a93443c6
commit 61cf17da73
2 changed files with 3 additions and 18 deletions

View file

@ -40,22 +40,8 @@ unsigned char *addAgentToBroadcastPacket(unsigned char *currentPosition, Agent *
currentPosition += packAgentId(currentPosition, agentToAdd->getAgentId());
AvatarData *agentData = (AvatarData *)agentToAdd->getLinkedData();
currentPosition += agentData->getBroadcastData((char *) currentPosition);
// int bytesWritten = sprintf((char *)currentPosition,
// PACKET_FORMAT,
// agentData->getPitch(),
// agentData->getYaw(),
// agentData->getRoll(),
// agentData->getHeadPositionX(),
// agentData->getHeadPositionY(),
// agentData->getHeadPositionZ(),
// agentData->getLoudness(),
// agentData->getAverageLoudness(),
// agentData->getHandPositionX(),
// agentData->getHandPositionY(),
// agentData->getHandPositionZ());
// currentPosition += bytesWritten;
return currentPosition;
}
@ -91,7 +77,7 @@ int main(int argc, char* argv[])
switch (packetData[0]) {
case PACKET_HEADER_HEAD_DATA:
// this is positional data from an agent
agentList->updateAgentWithData(agentAddress, (void *)packetData, receivedBytes);
agentList->updateAgentWithData(agentAddress, (void *)(packetData + 1), receivedBytes);
currentBufferPosition = broadcastPacket + 1;
agentIndex = 0;

View file

@ -45,7 +45,6 @@ AvatarData* AvatarData::clone() const {
// called on me just prior to sending data to others (continuasly called)
int AvatarData::getBroadcastData(char* destinationBuffer) {
char* bufferPointer = destinationBuffer;
*(bufferPointer++) = PACKET_HEADER_HEAD_DATA;
// TODO: DRY this up to a shared method
// that can pack any type given the number of bytes
@ -63,7 +62,7 @@ int AvatarData::getBroadcastData(char* destinationBuffer) {
// called on the other agents - assigns it to my views of the others
void AvatarData::parseData(void *sourceBuffer, int numBytes) {
char* bufferPointer = (char*) sourceBuffer + 1;
char* bufferPointer = (char*) sourceBuffer ;
memcpy(&_bodyPosition, bufferPointer, sizeof(float) * 3);
bufferPointer += sizeof(float) * 3;