add readCodeColorBufferToTree method to VoxelTree for point cloud render

This commit is contained in:
Stephen Birarda 2013-03-22 12:32:57 -07:00
parent 6a39934cb1
commit 3518ee15a8
2 changed files with 15 additions and 0 deletions

View file

@ -150,6 +150,20 @@ void VoxelTree::readBitstreamToTree(unsigned char * bitstream, int bufferSizeByt
readNodeData(bitstreamRootNode, bitstream + octalCodeBytes, bufferSizeBytes - octalCodeBytes);
}
void VoxelTree::readCodeColorBufferToTree(unsigned char *codeColorBuffer) {
int octalCodeBytes = bytesRequiredForCodeLength(*codeColorBuffer);
VoxelNode *lastCreatedNode = nodeForOctalCode(rootNode, codeColorBuffer);
// create the node if it does not exist
if (*lastCreatedNode->octalCode != *codeColorBuffer) {
lastCreatedNode = createMissingNode(lastCreatedNode, codeColorBuffer);
}
// give this node its color
memcpy(lastCreatedNode->color, codeColorBuffer + octalCodeBytes, 3);
lastCreatedNode->color[3] = 1;
}
unsigned char * VoxelTree::loadBitstreamBuffer(unsigned char *& bitstreamBuffer,
unsigned char * stopOctalCode,
VoxelNode *currentVoxelNode,

View file

@ -26,6 +26,7 @@ public:
int levelForViewerPosition(float * position);
void readBitstreamToTree(unsigned char * bitstream, int bufferSizeBytes);
void readCodeColorBufferToTree(unsigned char *codeColorBuffer);
unsigned char * loadBitstreamBuffer(unsigned char *& bitstreamBuffer,
unsigned char * octalCode,
VoxelNode *currentVoxelNode,