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