Showing the changes to interface/src/VoxelSystem.cpp (1 of 6 files). Show all
Unified · Split
| @@ -619,26 +619,41 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 618 unmodified lines | ||
| 619 | 619 | VOXEL_PACKET_INTERNAL_SECTION_SIZE sectionLength = 0; |
| 620 | 620 | int dataBytes = numBytes - VOXEL_PACKET_HEADER_SIZE; |
| 621 | 621 | |
| 622 | − if (packetIsCompressed && dataBytes > sizeof(VOXEL_PACKET_INTERNAL_SECTION_SIZE)) { | |
| 623 | − sectionLength = (*(VOXEL_PACKET_INTERNAL_SECTION_SIZE*)dataAt); | |
| 624 | − dataAt += sizeof(VOXEL_PACKET_INTERNAL_SECTION_SIZE); | |
| 625 | − } else { | |
| 626 | − sectionLength = dataBytes; | |
| 627 | − } | |
| 628 | − unsigned char* voxelData = dataAt; | |
| 629 | − | |
| 630 | − // ask the VoxelTree to read the bitstream into the tree | |
| 631 | − ReadBitstreamToTreeParams args(packetIsColored ? WANT_COLOR : NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceUUID()); | |
| 632 | − lockTree(); | |
| 633 | − VoxelPacketData packetData(packetIsCompressed); | |
| 634 | − packetData.loadFinalizedContent(voxelData, sectionLength); | |
| 635 | − if (true || Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging)) { | |
| 636 | − qDebug("Got Packet color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d sectionLength:%d uncompressed:%d\n", | |
| 637 | − debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed), | |
| 638 | − sequence, flightTime, numBytes, dataBytes, sectionLength, packetData.getUncompressedSize()); | |
| 622 | + int subsection = 1; | |
| 623 | + while (dataBytes > 0) { | |
| 624 | + if (packetIsCompressed) { | |
| 625 | + if (dataBytes > sizeof(VOXEL_PACKET_INTERNAL_SECTION_SIZE)) { | |
| 626 | + sectionLength = (*(VOXEL_PACKET_INTERNAL_SECTION_SIZE*)dataAt); | |
| 627 | + dataAt += sizeof(VOXEL_PACKET_INTERNAL_SECTION_SIZE); | |
| 628 | + dataBytes -= sizeof(VOXEL_PACKET_INTERNAL_SECTION_SIZE); | |
| 629 | + } else { | |
| 630 | + sectionLength = 0; | |
| 631 | + dataBytes = 0; // stop looping something is wrong | |
| 632 | + } | |
| 633 | + } else { | |
| 634 | + sectionLength = dataBytes; | |
| 635 | + } | |
| 636 | + | |
| 637 | + if (sectionLength) { | |
| 638 | + // ask the VoxelTree to read the bitstream into the tree | |
| 639 | + ReadBitstreamToTreeParams args(packetIsColored ? WANT_COLOR : NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceUUID()); | |
| 640 | + lockTree(); | |
| 641 | + VoxelPacketData packetData(packetIsCompressed); | |
| 642 | + packetData.loadFinalizedContent(dataAt, sectionLength); | |
| 643 | + if (Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging)) { | |
| 644 | + qDebug("Got Packet color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d" | |
| 645 | + " subsection:%d sectionLength:%d uncompressed:%d\n", | |
| 646 | + debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed), | |
| 647 | + sequence, flightTime, numBytes, dataBytes, subsection, sectionLength, packetData.getUncompressedSize()); | |
| 648 | + } | |
| 649 | + _tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args); | |
| 650 | + unlockTree(); | |
| 651 | + | |
| 652 | + dataBytes -= sectionLength; | |
| 653 | + dataAt += sectionLength; | |
| 654 | + } | |
| 639 | 655 | } |
| 640 | − _tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args); | |
| 641 | − unlockTree(); | |
| 656 | + subsection++; | |
| 642 | 657 | } |
| 643 | 658 | break; |
| 644 | 659 | } |