mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 17:54:15 +02:00
update agent-mixer to use new AvatarData class
This commit is contained in:
parent
a5a93443c6
commit
61cf17da73
2 changed files with 3 additions and 18 deletions
|
@ -40,22 +40,8 @@ unsigned char *addAgentToBroadcastPacket(unsigned char *currentPosition, Agent *
|
||||||
currentPosition += packAgentId(currentPosition, agentToAdd->getAgentId());
|
currentPosition += packAgentId(currentPosition, agentToAdd->getAgentId());
|
||||||
|
|
||||||
AvatarData *agentData = (AvatarData *)agentToAdd->getLinkedData();
|
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;
|
return currentPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +77,7 @@ int main(int argc, char* argv[])
|
||||||
switch (packetData[0]) {
|
switch (packetData[0]) {
|
||||||
case PACKET_HEADER_HEAD_DATA:
|
case PACKET_HEADER_HEAD_DATA:
|
||||||
// this is positional data from an agent
|
// this is positional data from an agent
|
||||||
agentList->updateAgentWithData(agentAddress, (void *)packetData, receivedBytes);
|
agentList->updateAgentWithData(agentAddress, (void *)(packetData + 1), receivedBytes);
|
||||||
|
|
||||||
currentBufferPosition = broadcastPacket + 1;
|
currentBufferPosition = broadcastPacket + 1;
|
||||||
agentIndex = 0;
|
agentIndex = 0;
|
||||||
|
|
|
@ -45,7 +45,6 @@ AvatarData* AvatarData::clone() const {
|
||||||
// called on me just prior to sending data to others (continuasly called)
|
// called on me just prior to sending data to others (continuasly called)
|
||||||
int AvatarData::getBroadcastData(char* destinationBuffer) {
|
int AvatarData::getBroadcastData(char* destinationBuffer) {
|
||||||
char* bufferPointer = destinationBuffer;
|
char* bufferPointer = destinationBuffer;
|
||||||
*(bufferPointer++) = PACKET_HEADER_HEAD_DATA;
|
|
||||||
|
|
||||||
// TODO: DRY this up to a shared method
|
// TODO: DRY this up to a shared method
|
||||||
// that can pack any type given the number of bytes
|
// 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
|
// called on the other agents - assigns it to my views of the others
|
||||||
void AvatarData::parseData(void *sourceBuffer, int numBytes) {
|
void AvatarData::parseData(void *sourceBuffer, int numBytes) {
|
||||||
|
|
||||||
char* bufferPointer = (char*) sourceBuffer + 1;
|
char* bufferPointer = (char*) sourceBuffer ;
|
||||||
|
|
||||||
memcpy(&_bodyPosition, bufferPointer, sizeof(float) * 3);
|
memcpy(&_bodyPosition, bufferPointer, sizeof(float) * 3);
|
||||||
bufferPointer += sizeof(float) * 3;
|
bufferPointer += sizeof(float) * 3;
|
||||||
|
|
Loading…
Reference in a new issue