mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:58:10 +02:00
code cleanup
This commit is contained in:
parent
0dde5b6411
commit
a7f0a66aee
2 changed files with 8 additions and 5 deletions
|
@ -106,14 +106,14 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
{
|
{
|
||||||
PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
|
PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
|
||||||
// ask the VoxelTree to read the bitstream into the tree
|
// 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;
|
break;
|
||||||
case PACKET_HEADER_VOXEL_DATA_MONOCHROME:
|
case PACKET_HEADER_VOXEL_DATA_MONOCHROME:
|
||||||
{
|
{
|
||||||
PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
|
PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
|
||||||
// ask the VoxelTree to read the MONOCHROME bitstream into the tree
|
// 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;
|
break;
|
||||||
case PACKET_HEADER_Z_COMMAND:
|
case PACKET_HEADER_Z_COMMAND:
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
typedef bool (*RecurseVoxelTreeOperation)(VoxelNode* node, void* extraData);
|
typedef bool (*RecurseVoxelTreeOperation)(VoxelNode* node, void* extraData);
|
||||||
typedef enum {GRADIENT, RANDOM, NATURAL} creationMode;
|
typedef enum {GRADIENT, RANDOM, NATURAL} creationMode;
|
||||||
|
|
||||||
|
#define NO_EXISTS_BITS false
|
||||||
#define WANT_EXISTS_BITS true
|
#define WANT_EXISTS_BITS true
|
||||||
|
#define NO_COLOR false
|
||||||
|
#define WANT_COLOR true
|
||||||
|
|
||||||
class VoxelTree {
|
class VoxelTree {
|
||||||
public:
|
public:
|
||||||
|
@ -43,7 +46,7 @@ public:
|
||||||
|
|
||||||
void processRemoveVoxelBitstream(unsigned char * bitstream, int bufferSizeBytes);
|
void processRemoveVoxelBitstream(unsigned char * bitstream, int bufferSizeBytes);
|
||||||
void readBitstreamToTree(unsigned char * bitstream, unsigned long 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 readCodeColorBufferToTree(unsigned char *codeColorBuffer, bool destructive = false);
|
||||||
void deleteVoxelCodeFromTree(unsigned char *codeBuffer, bool stage = false);
|
void deleteVoxelCodeFromTree(unsigned char *codeBuffer, bool stage = false);
|
||||||
void printTreeForDebugging(VoxelNode *startNode);
|
void printTreeForDebugging(VoxelNode *startNode);
|
||||||
|
@ -61,7 +64,7 @@ public:
|
||||||
|
|
||||||
int encodeTreeBitstream(int maxEncodeLevel, VoxelNode* node, unsigned char* outputBuffer, int availableBytes,
|
int encodeTreeBitstream(int maxEncodeLevel, VoxelNode* node, unsigned char* outputBuffer, int availableBytes,
|
||||||
VoxelNodeBag& bag, const ViewFrustum* viewFrustum,
|
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;
|
bool deltaViewFrustum = false, const ViewFrustum* lastViewFrustum = NULL) const;
|
||||||
|
|
||||||
int searchForColoredNodes(int maxSearchLevel, VoxelNode* node, const ViewFrustum& viewFrustum, VoxelNodeBag& bag,
|
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* nodeForOctalCode(VoxelNode* ancestorNode, unsigned char* needleCode, VoxelNode** parentOfFoundNode) const;
|
||||||
VoxelNode* createMissingNode(VoxelNode* lastParentNode, unsigned char* deepestCodeToCreate);
|
VoxelNode* createMissingNode(VoxelNode* lastParentNode, unsigned char* deepestCodeToCreate);
|
||||||
int readNodeData(VoxelNode *destinationNode, unsigned char* nodeData, int bufferSizeBytes,
|
int readNodeData(VoxelNode *destinationNode, unsigned char* nodeData, int bufferSizeBytes,
|
||||||
bool includeColor = true, bool includeExistsBits = false);
|
bool includeColor = WANT_COLOR, bool includeExistsBits = false);
|
||||||
|
|
||||||
bool _isDirty;
|
bool _isDirty;
|
||||||
unsigned long int _nodesChangedFromBitstream;
|
unsigned long int _nodesChangedFromBitstream;
|
||||||
|
|
Loading…
Reference in a new issue