code cleanup

This commit is contained in:
ZappoMan 2013-05-21 11:31:47 -07:00
parent 0dde5b6411
commit a7f0a66aee
2 changed files with 8 additions and 5 deletions

View file

@ -106,14 +106,14 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
{
PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
// ask the VoxelTree to read the bitstream into the tree
_tree->readBitstreamToTree(voxelData, numBytes - 1, true, WANT_EXISTS_BITS);
_tree->readBitstreamToTree(voxelData, numBytes - 1, WANT_COLOR, WANT_EXISTS_BITS);
}
break;
case PACKET_HEADER_VOXEL_DATA_MONOCHROME:
{
PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
// ask the VoxelTree to read the MONOCHROME bitstream into the tree
_tree->readBitstreamToTree(voxelData, numBytes - 1, false, WANT_EXISTS_BITS);
_tree->readBitstreamToTree(voxelData, numBytes - 1, NO_COLOR, WANT_EXISTS_BITS);
}
break;
case PACKET_HEADER_Z_COMMAND:

View file

@ -19,7 +19,10 @@
typedef bool (*RecurseVoxelTreeOperation)(VoxelNode* node, void* extraData);
typedef enum {GRADIENT, RANDOM, NATURAL} creationMode;
#define NO_EXISTS_BITS false
#define WANT_EXISTS_BITS true
#define NO_COLOR false
#define WANT_COLOR true
class VoxelTree {
public:
@ -43,7 +46,7 @@ public:
void processRemoveVoxelBitstream(unsigned char * bitstream, int bufferSizeBytes);
void readBitstreamToTree(unsigned char * bitstream, unsigned long int bufferSizeBytes,
bool includeColor = true, bool includeExistsBits = false);
bool includeColor = WANT_COLOR, bool includeExistsBits = false);
void readCodeColorBufferToTree(unsigned char *codeColorBuffer, bool destructive = false);
void deleteVoxelCodeFromTree(unsigned char *codeBuffer, bool stage = false);
void printTreeForDebugging(VoxelNode *startNode);
@ -61,7 +64,7 @@ public:
int encodeTreeBitstream(int maxEncodeLevel, VoxelNode* node, unsigned char* outputBuffer, int availableBytes,
VoxelNodeBag& bag, const ViewFrustum* viewFrustum,
bool includeColor = true, bool includeExistsBits = false,
bool includeColor = WANT_COLOR, bool includeExistsBits = false,
bool deltaViewFrustum = false, const ViewFrustum* lastViewFrustum = NULL) const;
int searchForColoredNodes(int maxSearchLevel, VoxelNode* node, const ViewFrustum& viewFrustum, VoxelNodeBag& bag,
@ -100,7 +103,7 @@ private:
VoxelNode* nodeForOctalCode(VoxelNode* ancestorNode, unsigned char* needleCode, VoxelNode** parentOfFoundNode) const;
VoxelNode* createMissingNode(VoxelNode* lastParentNode, unsigned char* deepestCodeToCreate);
int readNodeData(VoxelNode *destinationNode, unsigned char* nodeData, int bufferSizeBytes,
bool includeColor = true, bool includeExistsBits = false);
bool includeColor = WANT_COLOR, bool includeExistsBits = false);
bool _isDirty;
unsigned long int _nodesChangedFromBitstream;