mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 21:26:25 +02:00
use new loadBitstreamBuffer function to return voxel data to requesting agent
This commit is contained in:
parent
807377ef97
commit
6e9fa80966
1 changed files with 22 additions and 46 deletions
|
@ -188,61 +188,37 @@ int main(int argc, const char * argv[])
|
||||||
// create an octal code buffer and load it with 0 so that the recursive tree fill can give
|
// create an octal code buffer and load it with 0 so that the recursive tree fill can give
|
||||||
// octal codes to the tree nodes that it is creating
|
// octal codes to the tree nodes that it is creating
|
||||||
randomlyFillVoxelTree(MAX_VOXEL_TREE_DEPTH_LEVELS, randomTree.rootNode);
|
randomlyFillVoxelTree(MAX_VOXEL_TREE_DEPTH_LEVELS, randomTree.rootNode);
|
||||||
|
|
||||||
char *voxelPacket = new char[MAX_VOXEL_PACKET_SIZE];
|
char *voxelPacket = new char[MAX_VOXEL_PACKET_SIZE];
|
||||||
char *voxelPacketEnd;
|
char *voxelPacketEnd;
|
||||||
// returned unsigned char * is end of last write to bitstream
|
|
||||||
int packetCount = 0;
|
|
||||||
|
|
||||||
unsigned char *stopOctal = randomTree.rootNode->octalCode;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
voxelPacketEnd = voxelPacket;
|
|
||||||
stopOctal = randomTree.loadBitstreamBuffer(voxelPacketEnd, stopOctal, randomTree.rootNode);
|
|
||||||
|
|
||||||
printf("Packet %d is %ld bytes\n", ++packetCount, voxelPacketEnd - voxelPacket);
|
|
||||||
|
|
||||||
if (stopOctal == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
unsigned char *stopOctal;
|
||||||
|
int packetCount;
|
||||||
|
|
||||||
sockaddr_in agentPublicAddress;
|
sockaddr_in agentPublicAddress;
|
||||||
|
|
||||||
char *packetData = new char[MAX_PACKET_SIZE];
|
char *packetData = new char[MAX_PACKET_SIZE];
|
||||||
ssize_t receivedBytes;
|
ssize_t receivedBytes;
|
||||||
|
|
||||||
int sentVoxels = 0;
|
|
||||||
|
|
||||||
// loop to send to agents requesting data
|
// loop to send to agents requesting data
|
||||||
// while (true) {
|
while (true) {
|
||||||
// if (agentList.getAgentSocket().receive((sockaddr *)&agentPublicAddress, packetData, &receivedBytes)) {
|
if (agentList.getAgentSocket().receive((sockaddr *)&agentPublicAddress, packetData, &receivedBytes)) {
|
||||||
// if (packetData[0] == 'I') {
|
if (packetData[0] == 'I') {
|
||||||
// printf("Sending voxels to agent at address %s\n", inet_ntoa(agentPublicAddress.sin_addr));
|
stopOctal = randomTree.rootNode->octalCode;
|
||||||
//
|
packetCount = 0;
|
||||||
// // send the bitstream to the client
|
|
||||||
// for (int i = 1; i < MAX_VOXEL_BITSTREAM_BYTES / MAX_PACKET_SIZE; i++) {
|
while (stopOctal != NULL) {
|
||||||
// if (packetSplitsPtrs[i] == NULL) {
|
voxelPacketEnd = voxelPacket;
|
||||||
// // no more split pointers to read, break out
|
stopOctal = randomTree.loadBitstreamBuffer(voxelPacketEnd, stopOctal, randomTree.rootNode);
|
||||||
// break;
|
|
||||||
// }
|
printf("Packet %d sent to agent at address %s is %ld bytes\n",
|
||||||
//
|
++packetCount,
|
||||||
// // figure out the number of bytes in this packet
|
inet_ntoa(agentPublicAddress.sin_addr),
|
||||||
// int thisPacketBytes = packetSplitsPtrs[i] - packetSplitsPtrs[i - 1];
|
voxelPacketEnd - voxelPacket);
|
||||||
//
|
}
|
||||||
// agentList.getAgentSocket().send((sockaddr *)&agentPublicAddress,
|
}
|
||||||
// packetSplitsPtrs[i - 1],
|
}
|
||||||
// thisPacketBytes);
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
// // output the bits in each byte of this packet
|
|
||||||
// for (int j = 0; j < thisPacketBytes; j++) {
|
|
||||||
// outputBits(*(packetSplitsPtrs[i - 1] + j));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
pthread_join(reportAliveThread, NULL);
|
pthread_join(reportAliveThread, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue