mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:58:56 +02:00
fix a boneheaded mistake in AvatarMixer broadcastAvatarData
This commit is contained in:
parent
5e73e803e9
commit
3f9e00d977
3 changed files with 8 additions and 5 deletions
|
@ -58,9 +58,8 @@ void attachAvatarDataToNode(Node* newNode) {
|
||||||
// determine which avatars are included in the packet stream
|
// determine which avatars are included in the packet stream
|
||||||
// 4) we should optimize the avatar data format to be more compact (100 bytes is pretty wasteful).
|
// 4) we should optimize the avatar data format to be more compact (100 bytes is pretty wasteful).
|
||||||
void broadcastAvatarData() {
|
void broadcastAvatarData() {
|
||||||
static unsigned char broadcastPacketBuffer[MAX_PACKET_SIZE];
|
static unsigned char broadcastPacket[MAX_PACKET_SIZE];
|
||||||
static unsigned char avatarDataBuffer[MAX_PACKET_SIZE];
|
static unsigned char avatarDataBuffer[MAX_PACKET_SIZE];
|
||||||
unsigned char* broadcastPacket = (unsigned char*)&broadcastPacketBuffer[0];
|
|
||||||
int numHeaderBytes = populateTypeAndVersion(broadcastPacket, PACKET_TYPE_BULK_AVATAR_DATA);
|
int numHeaderBytes = populateTypeAndVersion(broadcastPacket, PACKET_TYPE_BULK_AVATAR_DATA);
|
||||||
unsigned char* currentBufferPosition = broadcastPacket + numHeaderBytes;
|
unsigned char* currentBufferPosition = broadcastPacket + numHeaderBytes;
|
||||||
int packetLength = currentBufferPosition - broadcastPacket;
|
int packetLength = currentBufferPosition - broadcastPacket;
|
||||||
|
@ -79,7 +78,9 @@ void broadcastAvatarData() {
|
||||||
// send back a packet with other active node data to this node
|
// send back a packet with other active node data to this node
|
||||||
for (NodeList::iterator otherNode = nodeList->begin(); otherNode != nodeList->end(); otherNode++) {
|
for (NodeList::iterator otherNode = nodeList->begin(); otherNode != nodeList->end(); otherNode++) {
|
||||||
if (otherNode->getLinkedData() && otherNode->getUUID() != node->getUUID()) {
|
if (otherNode->getLinkedData() && otherNode->getUUID() != node->getUUID()) {
|
||||||
unsigned char* avatarDataEndpoint = addNodeToBroadcastPacket((unsigned char*)&avatarDataBuffer[0], &*node);
|
|
||||||
|
unsigned char* avatarDataEndpoint = addNodeToBroadcastPacket((unsigned char*)&avatarDataBuffer[0],
|
||||||
|
&*otherNode);
|
||||||
int avatarDataLength = avatarDataEndpoint - (unsigned char*)&avatarDataBuffer;
|
int avatarDataLength = avatarDataEndpoint - (unsigned char*)&avatarDataBuffer;
|
||||||
|
|
||||||
if (avatarDataLength + packetLength <= MAX_PACKET_SIZE) {
|
if (avatarDataLength + packetLength <= MAX_PACKET_SIZE) {
|
||||||
|
@ -89,7 +90,8 @@ void broadcastAvatarData() {
|
||||||
} else {
|
} else {
|
||||||
packetsSent++;
|
packetsSent++;
|
||||||
//printf("packetsSent=%d packetLength=%d\n", packetsSent, packetLength);
|
//printf("packetsSent=%d packetLength=%d\n", packetsSent, packetLength);
|
||||||
nodeList->getNodeSocket().writeDatagram((char*) broadcastPacket, currentBufferPosition - broadcastPacket,
|
nodeList->getNodeSocket().writeDatagram((char*) broadcastPacket,
|
||||||
|
currentBufferPosition - broadcastPacket,
|
||||||
node->getActiveSocket()->getAddress(),
|
node->getActiveSocket()->getAddress(),
|
||||||
node->getActiveSocket()->getPort());
|
node->getActiveSocket()->getPort());
|
||||||
|
|
||||||
|
|
|
@ -1997,7 +1997,7 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::
|
||||||
|
|
||||||
for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
||||||
node->lock();
|
node->lock();
|
||||||
if (node->getLinkedData() != NULL) {
|
if (node->getLinkedData()) {
|
||||||
Avatar *avatar = (Avatar *)node->getLinkedData();
|
Avatar *avatar = (Avatar *)node->getLinkedData();
|
||||||
if (!avatar->isInitialized()) {
|
if (!avatar->isInitialized()) {
|
||||||
avatar->init();
|
avatar->init();
|
||||||
|
|
|
@ -175,6 +175,7 @@ void NodeList::processBulkNodeData(const HifiSockAddr& senderAddress, unsigned c
|
||||||
Node* bulkSendNode = nodeWithAddress(senderAddress);
|
Node* bulkSendNode = nodeWithAddress(senderAddress);
|
||||||
|
|
||||||
if (bulkSendNode) {
|
if (bulkSendNode) {
|
||||||
|
|
||||||
bulkSendNode->setLastHeardMicrostamp(usecTimestampNow());
|
bulkSendNode->setLastHeardMicrostamp(usecTimestampNow());
|
||||||
bulkSendNode->recordBytesReceived(numTotalBytes);
|
bulkSendNode->recordBytesReceived(numTotalBytes);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue