mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
d7f37e5972
4 changed files with 9 additions and 7 deletions
|
@ -74,6 +74,7 @@
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
#include <AvatarData.h>
|
||||||
|
|
||||||
#include "ViewFrustum.h"
|
#include "ViewFrustum.h"
|
||||||
|
|
||||||
|
@ -1310,7 +1311,7 @@ void *networkReceive(void *args)
|
||||||
AgentList::getInstance()->processBulkAgentData(&senderAddress,
|
AgentList::getInstance()->processBulkAgentData(&senderAddress,
|
||||||
incomingPacket,
|
incomingPacket,
|
||||||
bytesReceived,
|
bytesReceived,
|
||||||
(sizeof(float) * 3) + (sizeof(uint16_t) * 3));
|
BYTES_PER_AVATAR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AgentList::getInstance()->processAgentData(&senderAddress, incomingPacket, bytesReceived);
|
AgentList::getInstance()->processAgentData(&senderAddress, incomingPacket, bytesReceived);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <SharedUtil.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
|
||||||
#include "AvatarData.h"
|
#include "AvatarData.h"
|
||||||
|
@ -23,7 +24,7 @@ int packFloatAngleToTwoByte(unsigned char* buffer, float angle) {
|
||||||
return sizeof(uint16_t);
|
return sizeof(uint16_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
int unpackFloatAngleFromTwoByte(uint16_t *byteAnglePointer, float *destinationPointer) {
|
int unpackFloatAngleFromTwoByte(uint16_t* byteAnglePointer, float* destinationPointer) {
|
||||||
*destinationPointer = (*byteAnglePointer / std::numeric_limits<uint16_t>::max()) * 360.0 - 180;
|
*destinationPointer = (*byteAnglePointer / std::numeric_limits<uint16_t>::max()) * 360.0 - 180;
|
||||||
return sizeof(uint16_t);
|
return sizeof(uint16_t);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +70,6 @@ int AvatarData::getBroadcastData(unsigned 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(unsigned char* sourceBuffer, int numBytes) {
|
void AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
|
|
||||||
// increment to push past the packet header
|
// increment to push past the packet header
|
||||||
sourceBuffer++;
|
sourceBuffer++;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include <AgentData.h>
|
#include <AgentData.h>
|
||||||
|
|
||||||
|
const int BYTES_PER_AVATAR = 30;
|
||||||
|
|
||||||
class AvatarData : public AgentData {
|
class AvatarData : public AgentData {
|
||||||
public:
|
public:
|
||||||
AvatarData();
|
AvatarData();
|
||||||
|
|
|
@ -109,7 +109,7 @@ void AgentList::processBulkAgentData(sockaddr *senderAddress, unsigned char *pac
|
||||||
|
|
||||||
unsigned char *startPosition = (unsigned char *)packetData;
|
unsigned char *startPosition = (unsigned char *)packetData;
|
||||||
unsigned char *currentPosition = startPosition + 1;
|
unsigned char *currentPosition = startPosition + 1;
|
||||||
unsigned char *packetHolder = new unsigned char[numBytesPerAgent + 1];
|
unsigned char packetHolder[numBytesPerAgent + 1];
|
||||||
|
|
||||||
packetHolder[0] = PACKET_HEADER_HEAD_DATA;
|
packetHolder[0] = PACKET_HEADER_HEAD_DATA;
|
||||||
|
|
||||||
|
@ -122,13 +122,12 @@ void AgentList::processBulkAgentData(sockaddr *senderAddress, unsigned char *pac
|
||||||
int matchingAgentIndex = indexOfMatchingAgent(agentID);
|
int matchingAgentIndex = indexOfMatchingAgent(agentID);
|
||||||
|
|
||||||
if (matchingAgentIndex >= 0) {
|
if (matchingAgentIndex >= 0) {
|
||||||
|
|
||||||
updateAgentWithData(&agents[matchingAgentIndex], packetHolder, numBytesPerAgent + 1);
|
updateAgentWithData(&agents[matchingAgentIndex], packetHolder, numBytesPerAgent + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPosition += numBytesPerAgent;
|
currentPosition += numBytesPerAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] packetHolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AgentList::updateAgentWithData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes) {
|
void AgentList::updateAgentWithData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes) {
|
||||||
|
|
Loading…
Reference in a new issue