From 869a100486dbea9bad2f8749aec51fa7c6406040 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 21 May 2013 13:37:58 -0700 Subject: [PATCH] cleanup --- libraries/voxels/src/VoxelTree.cpp | 4 ++-- libraries/voxels/src/VoxelTree.h | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index d7b7a11d87..3bf8b7a7a8 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -1043,7 +1043,7 @@ bool VoxelTree::readFromFileV2(const char* fileName) { // read the entire file into a buffer, WHAT!? Why not. unsigned char* entireFile = new unsigned char[fileLength]; file.read((char*)entireFile, fileLength); - readBitstreamToTree(entireFile, fileLength, true); + readBitstreamToTree(entireFile, fileLength, WANT_COLOR, NO_EXISTS_BITS); delete[] entireFile; file.close(); @@ -1068,7 +1068,7 @@ void VoxelTree::writeToFileV2(const char* fileName) const { while (!nodeBag.isEmpty()) { VoxelNode* subTree = nodeBag.extract(); bytesWritten = encodeTreeBitstream(INT_MAX, subTree, &outputBuffer[0], - MAX_VOXEL_PACKET_SIZE - 1, nodeBag, NULL, true); + MAX_VOXEL_PACKET_SIZE - 1, nodeBag, IGNORE_VIEW_FRUSTUM, WANT_COLOR, NO_EXISTS_BITS); file.write((const char*)&outputBuffer[0], bytesWritten); } diff --git a/libraries/voxels/src/VoxelTree.h b/libraries/voxels/src/VoxelTree.h index d0056534f5..4cc2e722e4 100644 --- a/libraries/voxels/src/VoxelTree.h +++ b/libraries/voxels/src/VoxelTree.h @@ -19,10 +19,11 @@ 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 +#define NO_EXISTS_BITS false +#define WANT_EXISTS_BITS true +#define NO_COLOR false +#define WANT_COLOR true +#define IGNORE_VIEW_FRUSTUM NULL class VoxelTree { public: @@ -46,7 +47,7 @@ public: void processRemoveVoxelBitstream(unsigned char * bitstream, int bufferSizeBytes); void readBitstreamToTree(unsigned char * bitstream, unsigned long int bufferSizeBytes, - bool includeColor = WANT_COLOR, bool includeExistsBits = false); + bool includeColor = WANT_COLOR, bool includeExistsBits = WANT_EXISTS_BITS); void readCodeColorBufferToTree(unsigned char *codeColorBuffer, bool destructive = false); void deleteVoxelCodeFromTree(unsigned char *codeBuffer, bool stage = false); void printTreeForDebugging(VoxelNode *startNode); @@ -64,7 +65,7 @@ public: int encodeTreeBitstream(int maxEncodeLevel, VoxelNode* node, unsigned char* outputBuffer, int availableBytes, VoxelNodeBag& bag, const ViewFrustum* viewFrustum, - bool includeColor = WANT_COLOR, bool includeExistsBits = false, + bool includeColor = WANT_COLOR, bool includeExistsBits = WANT_EXISTS_BITS, bool deltaViewFrustum = false, const ViewFrustum* lastViewFrustum = NULL) const; int searchForColoredNodes(int maxSearchLevel, VoxelNode* node, const ViewFrustum& viewFrustum, VoxelNodeBag& bag, @@ -103,7 +104,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 = WANT_COLOR, bool includeExistsBits = false); + bool includeColor = WANT_COLOR, bool includeExistsBits = WANT_EXISTS_BITS); bool _isDirty; unsigned long int _nodesChangedFromBitstream;