mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:47:41 +02:00
cleanup
This commit is contained in:
parent
9f23f846a9
commit
869a100486
2 changed files with 10 additions and 9 deletions
|
@ -1043,7 +1043,7 @@ bool VoxelTree::readFromFileV2(const char* fileName) {
|
||||||
// read the entire file into a buffer, WHAT!? Why not.
|
// read the entire file into a buffer, WHAT!? Why not.
|
||||||
unsigned char* entireFile = new unsigned char[fileLength];
|
unsigned char* entireFile = new unsigned char[fileLength];
|
||||||
file.read((char*)entireFile, fileLength);
|
file.read((char*)entireFile, fileLength);
|
||||||
readBitstreamToTree(entireFile, fileLength, true);
|
readBitstreamToTree(entireFile, fileLength, WANT_COLOR, NO_EXISTS_BITS);
|
||||||
delete[] entireFile;
|
delete[] entireFile;
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -1068,7 +1068,7 @@ void VoxelTree::writeToFileV2(const char* fileName) const {
|
||||||
while (!nodeBag.isEmpty()) {
|
while (!nodeBag.isEmpty()) {
|
||||||
VoxelNode* subTree = nodeBag.extract();
|
VoxelNode* subTree = nodeBag.extract();
|
||||||
bytesWritten = encodeTreeBitstream(INT_MAX, subTree, &outputBuffer[0],
|
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);
|
file.write((const char*)&outputBuffer[0], bytesWritten);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,11 @@
|
||||||
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 NO_EXISTS_BITS false
|
||||||
#define WANT_EXISTS_BITS true
|
#define WANT_EXISTS_BITS true
|
||||||
#define NO_COLOR false
|
#define NO_COLOR false
|
||||||
#define WANT_COLOR true
|
#define WANT_COLOR true
|
||||||
|
#define IGNORE_VIEW_FRUSTUM NULL
|
||||||
|
|
||||||
class VoxelTree {
|
class VoxelTree {
|
||||||
public:
|
public:
|
||||||
|
@ -46,7 +47,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 = WANT_COLOR, bool includeExistsBits = false);
|
bool includeColor = WANT_COLOR, bool includeExistsBits = WANT_EXISTS_BITS);
|
||||||
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);
|
||||||
|
@ -64,7 +65,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 = WANT_COLOR, bool includeExistsBits = false,
|
bool includeColor = WANT_COLOR, bool includeExistsBits = WANT_EXISTS_BITS,
|
||||||
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,
|
||||||
|
@ -103,7 +104,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 = WANT_COLOR, bool includeExistsBits = false);
|
bool includeColor = WANT_COLOR, bool includeExistsBits = WANT_EXISTS_BITS);
|
||||||
|
|
||||||
bool _isDirty;
|
bool _isDirty;
|
||||||
unsigned long int _nodesChangedFromBitstream;
|
unsigned long int _nodesChangedFromBitstream;
|
||||||
|
|
Loading…
Reference in a new issue