Showing the changes to interface/src/VoxelSystem.cpp (1 of 121 files). Show all
Unified · Split
| @@ -16,7 +16,6 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <PerfStat.h> |
| 17 | 17 | #include <SharedUtil.h> |
| 18 | 18 | #include <NodeList.h> |
| 19 | −#include <NodeTypes.h> | |
| 20 | 19 | |
| 21 | 20 | #include "Application.h" |
| 22 | 21 | #include "CoverageMap.h" |
| @@ -550,17 +549,17 @@ bool VoxelSystem::readFromSchematicFile(const char* filename) { · 527 unmodified lines | ||
| 550 | 549 | return result; |
| 551 | 550 | } |
| 552 | 551 | |
| 553 | −int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { | |
| 552 | +int VoxelSystem::parseData(const QByteArray& packet) { | |
| 554 | 553 | bool showTimingDetails = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 555 | 554 | PerformanceWarning warn(showTimingDetails, "VoxelSystem::parseData()",showTimingDetails); |
| 556 | 555 | |
| 557 | − unsigned char command = *sourceBuffer; | |
| 558 | − int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer); | |
| 556 | + PacketType command = packetTypeForPacket(packet); | |
| 557 | + int numBytesPacketHeader = numBytesForPacketHeader(packet); | |
| 559 | 558 | switch(command) { |
| 560 | − case PACKET_TYPE_VOXEL_DATA: { | |
| 561 | − PerformanceWarning warn(showTimingDetails, "VoxelSystem::parseData() PACKET_TYPE_VOXEL_DATA part...",showTimingDetails); | |
| 562 | − | |
| 563 | − unsigned char* dataAt = sourceBuffer + numBytesPacketHeader; | |
| 559 | + case PacketTypeVoxelData: { | |
| 560 | + PerformanceWarning warn(showTimingDetails, "VoxelSystem::parseData() PacketType_VOXEL_DATA part...",showTimingDetails); | |
| 561 | + | |
| 562 | + const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(packet.data()) + numBytesPacketHeader; | |
| 564 | 563 | |
| 565 | 564 | VOXEL_PACKET_FLAGS flags = (*(VOXEL_PACKET_FLAGS*)(dataAt)); |
| 566 | 565 | dataAt += sizeof(VOXEL_PACKET_FLAGS); |
| @@ -577,7 +576,7 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 10 unmodified lines | ||
| 577 | 576 | int flightTime = arrivedAt - sentAt; |
| 578 | 577 | |
| 579 | 578 | VOXEL_PACKET_INTERNAL_SECTION_SIZE sectionLength = 0; |
| 580 | − int dataBytes = numBytes - VOXEL_PACKET_HEADER_SIZE; | |
| 579 | + int dataBytes = packet.size() - VOXEL_PACKET_HEADER_SIZE; | |
| 581 | 580 | |
| 582 | 581 | int subsection = 1; |
| 583 | 582 | while (dataBytes > 0) { |
| @@ -605,7 +604,8 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 21 unmodified lines | ||
| 605 | 604 | " color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d" |
| 606 | 605 | " subsection:%d sectionLength:%d uncompressed:%d", |
| 607 | 606 | debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed), |
| 608 | − sequence, flightTime, numBytes, dataBytes, subsection, sectionLength, packetData.getUncompressedSize()); | |
| 607 | + sequence, flightTime, packet.size(), dataBytes, subsection, sectionLength, | |
| 608 | + packetData.getUncompressedSize()); | |
| 609 | 609 | } |
| 610 | 610 | _tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args); |
| 611 | 611 | unlockTree(); |
| @@ -616,7 +616,8 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 4 unmodified lines | ||
| 616 | 616 | } |
| 617 | 617 | subsection++; |
| 618 | 618 | } |
| 619 | − break; | |
| 619 | + default: | |
| 620 | + break; | |
| 620 | 621 | } |
| 621 | 622 | if (!_useFastVoxelPipeline || _writeRenderFullVBO) { |
| 622 | 623 | setupNewVoxelsForDrawing(); |
| @@ -624,9 +625,9 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 1 unmodified line | ||
| 624 | 625 | setupNewVoxelsForDrawingSingleNode(DONT_BAIL_EARLY); |
| 625 | 626 | } |
| 626 | 627 | |
| 627 | − Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::VOXELS).updateValue(numBytes); | |
| 628 | + Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::VOXELS).updateValue(packet.size()); | |
| 628 | 629 | |
| 629 | − return numBytes; | |
| 630 | + return packet.size(); | |
| 630 | 631 | } |
| 631 | 632 | |
| 632 | 633 | void VoxelSystem::setupNewVoxelsForDrawing() { |