Showing the changes to interface/src/VoxelSystem.cpp (1 of 33 files). Show all
Unified · Split
| @@ -113,32 +113,31 @@ float VoxelSystem::getVoxelsBytesReadPerSecondAverage() { · 112 unmodified lines | |||
| 113 | int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { | 113 | int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { |
| 114 | 114 | ||
| 115 | unsigned char command = *sourceBuffer; | 115 | unsigned char command = *sourceBuffer; |
| 116 | unsigned char *voxelData = sourceBuffer + 1; | 116 | int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer); |
| 117 | unsigned char* voxelData = sourceBuffer + numBytesPacketHeader; | ||
| 117 | 118 | ||
| 118 | pthread_mutex_lock(&_treeLock); | 119 | pthread_mutex_lock(&_treeLock); |
| 119 | 120 | ||
| 120 | switch(command) { | 121 | switch(command) { |
| 121 | case PACKET_HEADER_VOXEL_DATA: | 122 | case PACKET_TYPE_VOXEL_DATA: { |
| 122 | { | ||
| 123 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); | 123 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); |
| 124 | // ask the VoxelTree to read the bitstream into the tree | 124 | // ask the VoxelTree to read the bitstream into the tree |
| 125 | _tree->readBitstreamToTree(voxelData, numBytes - 1, WANT_COLOR, WANT_EXISTS_BITS); | 125 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, WANT_COLOR, WANT_EXISTS_BITS); |
| 126 | } | 126 | } |
| 127 | break; | 127 | break; |
| 128 | case PACKET_HEADER_VOXEL_DATA_MONOCHROME: | 128 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: { |
| 129 | { | ||
| 130 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); | 129 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); |
| 131 | // ask the VoxelTree to read the MONOCHROME bitstream into the tree | 130 | // ask the VoxelTree to read the MONOCHROME bitstream into the tree |
| 132 | _tree->readBitstreamToTree(voxelData, numBytes - 1, NO_COLOR, WANT_EXISTS_BITS); | 131 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, NO_COLOR, WANT_EXISTS_BITS); |
| 133 | } | 132 | } |
| 134 | break; | 133 | break; |
| 135 | case PACKET_HEADER_Z_COMMAND: | 134 | case PACKET_TYPE_Z_COMMAND: |
| 136 | 135 | ||
| 137 | // the Z command is a special command that allows the sender to send high level semantic | 136 | // the Z command is a special command that allows the sender to send high level semantic |
| 138 | // requests, like erase all, or add sphere scene, different receivers may handle these | 137 | // requests, like erase all, or add sphere scene, different receivers may handle these |
| 139 | // messages differently | 138 | // messages differently |
| 140 | char* packetData = (char *)sourceBuffer; | 139 | char* packetData = (char *)sourceBuffer; |
| 141 | char* command = &packetData[1]; // start of the command | 140 | char* command = &packetData[numBytesPacketHeader]; // start of the command |
| 142 | int commandLength = strlen(command); // commands are null terminated strings | 141 | int commandLength = strlen(command); // commands are null terminated strings |
| 143 | int totalLength = 1+commandLength+1; | 142 | int totalLength = 1+commandLength+1; |
| 144 | 143 | ||