Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -741,91 +741,4 @@ void VoxelSystem::falseColorizeDistanceFromView(ViewFrustum* viewFrustum) { · 740 unmodified lines | |||
| 741 | tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); | 741 | tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); |
| 742 | printf("setting in distance false color for %d nodes\n",_nodeCount); | 742 | printf("setting in distance false color for %d nodes\n",_nodeCount); |
| 743 | setupNewVoxelsForDrawing(); | 743 | setupNewVoxelsForDrawing(); |
| 744 | |||
| 745 | |||
| 746 | printf("--------- DEBUG TESTING ------------\n"); | ||
| 747 | //const int MAX_VOXEL_PACKET_SIZE=13; // test tight fit... | ||
| 748 | unsigned char* tempOutputBuffer = new unsigned char[MAX_VOXEL_PACKET_SIZE]; | ||
| 749 | unsigned char* finalOutputBuffer = new unsigned char[MAX_VOXEL_PACKET_SIZE]; | ||
| 750 | unsigned char* finalOutputBufferAt = finalOutputBuffer; | ||
| 751 | int availableInFinal = MAX_VOXEL_PACKET_SIZE; | ||
| 752 | int bytesWritten = 0; | ||
| 753 | int totalBytesWritten = 0; | ||
| 754 | int totalPackets = 0; | ||
| 755 | |||
| 756 | VoxelNodeBag bagOfTrees; | ||
| 757 | |||
| 758 | // stick a "V" in the finalOutputBuffer | ||
| 759 | finalOutputBuffer[0] = 'V'; | ||
| 760 | finalOutputBufferAt++; | ||
| 761 | availableInFinal = MAX_VOXEL_PACKET_SIZE-1; | ||
| 762 | |||
| 763 | //bytesWritten = tree->encodeTreeBitstream(tree->rootNode, *viewFrustum, outputBuffer, MAX_VOXEL_PACKET_SIZE, bagOfTrees); | ||
| 764 | //totalBytesWritten += bytesWritten; | ||
| 765 | //printf("--------- initial results ---- bytesWritten=%d ------------\n",bytesWritten); | ||
| 766 | //outputBufferBits(finalOutputBuffer, bytesWritten, true); | ||
| 767 | //printf("--------- DONE initial results ------------\n"); | ||
| 768 | |||
| 769 | printf("--------- searchForColoredNodes() ------------\n"); | ||
| 770 | tree->searchForColoredNodes(tree->rootNode, *viewFrustum, bagOfTrees); | ||
| 771 | printf("--------- DONE searchForColoredNodes() ------------\n"); | ||
| 772 | |||
| 773 | printf("--------- bag of trees ------------\n"); | ||
| 774 | printf("bagOfTrees.count()=%d\n",bagOfTrees.count()); | ||
| 775 | |||
| 776 | int countOfTrees = 0; | ||
| 777 | bool finalOutputBufferWaiting = false; | ||
| 778 | while (!bagOfTrees.isEmpty()) { | ||
| 779 | countOfTrees++; | ||
| 780 | VoxelNode* extraTree = bagOfTrees.extract(); | ||
| 781 | printf("processing countOfTrees=%d\n", countOfTrees); | ||
| 782 | |||
| 783 | // Only let this guy create at largest packets equal to the amount of space we have left in our final??? | ||
| 784 | // Or let it create the largest possible size (minus 1 for the "V") | ||
| 785 | bytesWritten = tree->encodeTreeBitstream(extraTree, *viewFrustum, tempOutputBuffer, MAX_VOXEL_PACKET_SIZE-1, bagOfTrees); | ||
| 786 | |||
| 787 | printf("this tree size=%d\n", bytesWritten); | ||
| 788 | |||
| 789 | // if we have room in our final packet, add this buffer to the final packet | ||
| 790 | if (availableInFinal >= bytesWritten) { | ||
| 791 | memcpy(finalOutputBufferAt, tempOutputBuffer, bytesWritten); | ||
| 792 | availableInFinal -= bytesWritten; | ||
| 793 | finalOutputBufferAt += bytesWritten; | ||
| 794 | finalOutputBufferWaiting = true; | ||
| 795 | } else { | ||
| 796 | // otherwise "send" the packet! | ||
| 797 | int sizeOfFinal = MAX_VOXEL_PACKET_SIZE - availableInFinal; | ||
| 798 | |||
| 799 | totalBytesWritten += sizeOfFinal; | ||
| 800 | totalPackets++; | ||
| 801 | printf("---- voxel packet ---- sizeOfFinal=%d totalPackets=%d ----\n",sizeOfFinal,totalPackets); | ||
| 802 | //outputBufferBits(finalOutputBuffer, sizeOfFinal, true); | ||
| 803 | printf("---- DONE voxel packet ------------\n"); | ||
| 804 | |||
| 805 | // reset our finalOutputBuffer (keep the 'V') | ||
| 806 | finalOutputBufferAt = &finalOutputBuffer[1]; | ||
| 807 | availableInFinal = MAX_VOXEL_PACKET_SIZE - 1; | ||
| 808 | finalOutputBufferWaiting = false; | ||
| 809 | |||
| 810 | // we also need to stick the last created packet in here!! | ||
| 811 | memcpy(finalOutputBufferAt, tempOutputBuffer, bytesWritten); | ||
| 812 | availableInFinal -= bytesWritten; | ||
| 813 | finalOutputBufferAt += bytesWritten; | ||
| 814 | finalOutputBufferWaiting = true; | ||
| 815 | } | ||
| 816 | } | ||
| 817 | |||
| 818 | if (finalOutputBufferWaiting) { | ||
| 819 | // otherwise "send" the packet! | ||
| 820 | int sizeOfFinal = MAX_VOXEL_PACKET_SIZE - availableInFinal; | ||
| 821 | |||
| 822 | totalBytesWritten += sizeOfFinal; | ||
| 823 | totalPackets++; | ||
| 824 | printf("---- voxel packet ---- sizeOfFinal=%d totalPackets=%d ----\n",sizeOfFinal,totalPackets); | ||
| 825 | //outputBufferBits(finalOutputBuffer, sizeOfFinal, true); | ||
| 826 | printf("---- DONE voxel packet ------------\n"); | ||
| 827 | } | ||
| 828 | |||
| 829 | printf("--- DONE DEBUG TESTING --- countOfTrees=%d totalBytesWritten=%d totalPackets=%d ------\n", | ||
| 830 | countOfTrees, totalBytesWritten,totalPackets); | ||
| 831 | } | 744 | } |