removed voxel addSphere since it wasn't compiling and was old debug code

This commit is contained in:
Brad Hefta-Gaub 2014-01-10 21:39:03 -08:00
parent ef60aec81e
commit 26adabf130
7 changed files with 48 additions and 236 deletions

View file

@ -2392,12 +2392,6 @@ void VoxelSystem::createLine(glm::vec3 point1, glm::vec3 point2, float unitSize,
setupNewVoxelsForDrawing();
};
void VoxelSystem::createSphere(float r,float xc, float yc, float zc, float s, bool solid,
creationMode mode, bool destructive, bool debug) {
_tree->createSphere(r, xc, yc, zc, s, solid, mode, destructive, debug);
setupNewVoxelsForDrawing();
};
void VoxelSystem::copySubTreeIntoNewTree(VoxelTreeElement* startNode, VoxelSystem* destination, bool rebaseToRoot) {
_tree->copySubTreeIntoNewTree(startNode, destination->_tree, rebaseToRoot);
destination->setupNewVoxelsForDrawing();

View file

@ -98,8 +98,6 @@ public:
void createVoxel(float x, float y, float z, float s,
unsigned char red, unsigned char green, unsigned char blue, bool destructive = false);
void createLine(glm::vec3 point1, glm::vec3 point2, float unitSize, rgbColor color, bool destructive = false);
void createSphere(float r,float xc, float yc, float zc, float s, bool solid,
creationMode mode, bool destructive = false, bool debug = false);
void copySubTreeIntoNewTree(VoxelTreeElement* startNode, VoxelSystem* destinationTree, bool rebaseToRoot);
void copySubTreeIntoNewTree(VoxelTreeElement* startNode, VoxelTree* destinationTree, bool rebaseToRoot);

View file

@ -41,45 +41,6 @@ void addCornersAndAxisLines(VoxelTree* tree) {
printf("DONE creating lines...\n");
}
void addSphereScene(VoxelTree * tree) {
printf("adding sphere scene...\n");
// Now some more examples... creating some spheres using the sphere primitive
// We want the smallest unit of our spheres to be about 1/16th of a meter tall
float sphereVoxelSize = 1.f / (8 * TREE_SCALE);
printf("creating spheres... sphereVoxelSize=%f\n",sphereVoxelSize);
tree->createSphere(0.030625, 0.5, 0.5, (0.25 - 0.06125), sphereVoxelSize, true, NATURAL);
printf("1 spheres added... sphereVoxelSize=%f\n",sphereVoxelSize);
tree->createSphere(0.030625, (0.75 - 0.030625), (0.75 - 0.030625), (0.75 - 0.06125), sphereVoxelSize, true, GRADIENT);
printf("2 spheres added... sphereVoxelSize=%f\n",sphereVoxelSize);
tree->createSphere(0.030625, (0.75 - 0.030625), (0.75 - 0.030625), 0.06125, sphereVoxelSize, true, RANDOM);
printf("3 spheres added... sphereVoxelSize=%f\n",sphereVoxelSize);
tree->createSphere(0.030625, (0.75 - 0.030625), 0.06125, (0.75 - 0.06125), sphereVoxelSize, true, GRADIENT);
printf("4 spheres added... sphereVoxelSize=%f\n",sphereVoxelSize);
tree->createSphere(0.06125, 0.125, 0.125, (0.75 - 0.125), sphereVoxelSize, true, GRADIENT);
/**
float radius = 0.0125f;
printf("5 spheres added...\n");
tree->createSphere(radius, 0.25, radius * 5.0f, 0.25, sphereVoxelSize, true, GRADIENT);
printf("6 spheres added...\n");
tree->createSphere(radius, 0.125, radius * 5.0f, 0.25, sphereVoxelSize, true, RANDOM);
printf("7 spheres added...\n");
tree->createSphere(radius, 0.075, radius * 5.0f, 0.25, sphereVoxelSize, true, GRADIENT);
printf("8 spheres added...\n");
tree->createSphere(radius, 0.05, radius * 5.0f, 0.25, sphereVoxelSize, true, RANDOM);
printf("9 spheres added...\n");
tree->createSphere(radius, 0.025, radius * 5.0f, 0.25, sphereVoxelSize, true, GRADIENT);
printf("10 spheres added...\n");
*/
float largeRadius = 0.1875f;
tree->createSphere(largeRadius, 0.5, 0.5, 0.5, sphereVoxelSize, true, NATURAL);
printf("11 - last large sphere added... largeRadius=%f sphereVoxelSize=%f\n", largeRadius, sphereVoxelSize);
printf("DONE adding scene of spheres...\n");
}
void addSurfaceScene(VoxelTree * tree) {
printf("adding surface scene...\n");
float voxelSize = 1.f / (8 * TREE_SCALE);

View file

@ -13,7 +13,6 @@
#include <SharedUtil.h>
void addCornersAndAxisLines(VoxelTree* tree);
void addSphereScene(VoxelTree * tree);
void addSurfaceScene(VoxelTree * tree);

View file

@ -27,7 +27,7 @@ VoxelTreeElement* VoxelTree::createNewElement(unsigned char * octalCode) const {
if (_rootNode) {
voxelSystem = ((VoxelTreeElement*)_rootNode)->getVoxelSystem();
}
VoxelTreeElement* newElement = new VoxelTreeElement(octalCode);
VoxelTreeElement* newElement = new VoxelTreeElement(octalCode);
newElement->setVoxelSystem(voxelSystem);
return newElement;
}
@ -43,7 +43,7 @@ VoxelTreeElement* VoxelTree::getVoxelAt(float x, float y, float z, float s) cons
void VoxelTree::createVoxel(float x, float y, float z, float s,
unsigned char red, unsigned char green, unsigned char blue, bool destructive) {
unsigned char* voxelData = pointToVoxel(x,y,z,s,red,green,blue);
//int length = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(voxelData)) + BYTES_PER_COLOR;
@ -67,139 +67,6 @@ void VoxelTree::createLine(glm::vec3 point1, glm::vec3 point2, float unitSize, r
}
}
void VoxelTree::createSphere(float radius, float xc, float yc, float zc, float voxelSize,
bool solid, creationMode mode, bool destructive, bool debug) {
bool wantColorRandomizer = (mode == RANDOM);
bool wantNaturalSurface = (mode == NATURAL);
bool wantNaturalColor = (mode == NATURAL);
// About the color of the sphere... we're going to make this sphere be a mixture of two colors
// in NATURAL mode, those colors will be green dominant and blue dominant. In GRADIENT mode we
// will randomly pick which color family red, green, or blue to be dominant. In RANDOM mode we
// ignore these dominant colors and make every voxel a completely random color.
unsigned char r1, g1, b1, r2, g2, b2;
if (wantNaturalColor) {
r1 = r2 = b2 = g1 = 0;
b1 = g2 = 255;
} else if (!wantColorRandomizer) {
unsigned char dominantColor1 = randIntInRange(1, 3); //1=r, 2=g, 3=b dominant
unsigned char dominantColor2 = randIntInRange(1, 3);
if (dominantColor1 == dominantColor2) {
dominantColor2 = dominantColor1 + 1 % 3;
}
r1 = (dominantColor1 == 1) ? randIntInRange(200, 255) : randIntInRange(40, 100);
g1 = (dominantColor1 == 2) ? randIntInRange(200, 255) : randIntInRange(40, 100);
b1 = (dominantColor1 == 3) ? randIntInRange(200, 255) : randIntInRange(40, 100);
r2 = (dominantColor2 == 1) ? randIntInRange(200, 255) : randIntInRange(40, 100);
g2 = (dominantColor2 == 2) ? randIntInRange(200, 255) : randIntInRange(40, 100);
b2 = (dominantColor2 == 3) ? randIntInRange(200, 255) : randIntInRange(40, 100);
}
// We initialize our rgb to be either "grey" in case of randomized surface, or
// the average of the gradient, in the case of the gradient sphere.
unsigned char red = wantColorRandomizer ? 128 : (r1 + r2) / 2; // average of the colors
unsigned char green = wantColorRandomizer ? 128 : (g1 + g2) / 2;
unsigned char blue = wantColorRandomizer ? 128 : (b1 + b2) / 2;
// I want to do something smart like make these inside circles with bigger voxels, but this doesn't seem to work.
float thisVoxelSize = voxelSize; // radius / 2.0f;
float thisRadius = 0.0;
if (!solid) {
thisRadius = radius; // just the outer surface
thisVoxelSize = voxelSize;
}
// If you also iterate form the interior of the sphere to the radius, making
// larger and larger spheres you'd end up with a solid sphere. And lots of voxels!
bool lastLayer = false;
while (!lastLayer) {
lastLayer = (thisRadius + (voxelSize * 2.0) >= radius);
// We want to make sure that as we "sweep" through our angles we use a delta angle that voxelSize
// small enough to not skip any voxels we can calculate theta from our desired arc length
// lenArc = ndeg/360deg * 2pi*R ---> lenArc = theta/2pi * 2pi*R
// lenArc = theta*R ---> theta = lenArc/R ---> theta = g/r
float angleDelta = (thisVoxelSize / thisRadius);
if (debug) {
int percentComplete = 100 * (thisRadius/radius);
qDebug("percentComplete=%d\n",percentComplete);
}
for (float theta=0.0; theta <= 2 * M_PI; theta += angleDelta) {
for (float phi=0.0; phi <= M_PI; phi += angleDelta) {
bool naturalSurfaceRendered = false;
float x = xc + thisRadius * cos(theta) * sin(phi);
float y = yc + thisRadius * sin(theta) * sin(phi);
float z = zc + thisRadius * cos(phi);
// if we're on the outer radius, then we do a couple of things differently.
// 1) If we're in NATURAL mode we will actually draw voxels from our surface outward (from the surface) up
// some random height. This will give our sphere some contours.
// 2) In all modes, we will use our "outer" color to draw the voxels. Otherwise we will use the average color
if (lastLayer) {
if (false && debug) {
qDebug("adding candy shell: theta=%f phi=%f thisRadius=%f radius=%f\n",
theta, phi, thisRadius,radius);
}
switch (mode) {
case RANDOM: {
red = randomColorValue(165);
green = randomColorValue(165);
blue = randomColorValue(165);
} break;
case GRADIENT: {
float gradient = (phi / M_PI);
red = r1 + ((r2 - r1) * gradient);
green = g1 + ((g2 - g1) * gradient);
blue = b1 + ((b2 - b1) * gradient);
} break;
case NATURAL: {
glm::vec3 position = glm::vec3(theta,phi,radius);
float perlin = glm::perlin(position) + .25f * glm::perlin(position * 4.f)
+ .125f * glm::perlin(position * 16.f);
float gradient = (1.0f + perlin)/ 2.0f;
red = (unsigned char)std::min(255, std::max(0, (int)(r1 + ((r2 - r1) * gradient))));
green = (unsigned char)std::min(255, std::max(0, (int)(g1 + ((g2 - g1) * gradient))));
blue = (unsigned char)std::min(255, std::max(0, (int)(b1 + ((b2 - b1) * gradient))));
if (debug) {
qDebug("perlin=%f gradient=%f color=(%d,%d,%d)\n",perlin, gradient, red, green, blue);
}
} break;
}
if (wantNaturalSurface) {
// for natural surfaces, we will render up to 16 voxel's above the surface of the sphere
glm::vec3 position = glm::vec3(theta,phi,radius);
float perlin = glm::perlin(position) + .25f * glm::perlin(position * 4.f)
+ .125f * glm::perlin(position * 16.f);
float gradient = (1.0f + perlin)/ 2.0f;
int height = (4 * gradient)+1; // make it at least 4 thick, so we get some averaging
float subVoxelScale = thisVoxelSize;
for (int i = 0; i < height; i++) {
x = xc + (thisRadius + i * subVoxelScale) * cos(theta) * sin(phi);
y = yc + (thisRadius + i * subVoxelScale) * sin(theta) * sin(phi);
z = zc + (thisRadius + i * subVoxelScale) * cos(phi);
this->createVoxel(x, y, z, subVoxelScale, red, green, blue, destructive);
}
naturalSurfaceRendered = true;
}
}
if (!naturalSurfaceRendered) {
this->createVoxel(x, y, z, thisVoxelSize, red, green, blue, destructive);
}
}
}
thisRadius += thisVoxelSize;
thisVoxelSize = std::max(voxelSize, thisVoxelSize / 2.0f);
}
}
class NodeChunkArgs {
public:
VoxelTree* thisVoxelTree;
@ -343,7 +210,7 @@ void VoxelTree::nudgeLeaf(VoxelTreeElement* element, void* extraData) {
// get voxel position/size
VoxelPositionSize unNudgedDetails;
voxelDetailsForCode(octalCode, unNudgedDetails);
VoxelDetail voxelDetails;
voxelDetails.x = unNudgedDetails.x;
voxelDetails.y = unNudgedDetails.y;
@ -660,7 +527,7 @@ int VoxelTree::processEditPacketData(PACKET_TYPE packetType, unsigned char* pack
case PACKET_TYPE_VOXEL_SET_DESTRUCTIVE: {
bool destructive = (packetType == PACKET_TYPE_VOXEL_SET_DESTRUCTIVE);
int octets = numberOfThreeBitSectionsInCode(editData, maxLength);
if (octets == OVERFLOWED_OCTCODE_BUFFER) {
printf("WARNING! Got voxel edit record that would overflow buffer in numberOfThreeBitSectionsInCode(), ");
printf("bailing processing of packet!\n");
@ -676,12 +543,12 @@ int VoxelTree::processEditPacketData(PACKET_TYPE packetType, unsigned char* pack
printf("bailing processing of packet!\n");
return processedBytes;
}
readCodeColorBufferToTree(editData, destructive);
return voxelDataSize;
} break;
case PACKET_TYPE_VOXEL_ERASE:
processRemoveOctreeElementsBitstream((unsigned char*)packetData, packetLength);
return maxLength;

View file

@ -29,25 +29,23 @@ class VoxelTree : public Octree {
public:
VoxelTree(bool shouldReaverage = false);
virtual VoxelTreeElement* createNewElement(unsigned char * octalCode = NULL) const;
VoxelTreeElement* getRoot() { return (VoxelTreeElement*)_rootNode; }
void deleteVoxelAt(float x, float y, float z, float s);
VoxelTreeElement* getVoxelAt(float x, float y, float z, float s) const;
void createVoxel(float x, float y, float z, float s,
void createVoxel(float x, float y, float z, float s,
unsigned char red, unsigned char green, unsigned char blue, bool destructive = false);
void createLine(glm::vec3 point1, glm::vec3 point2, float unitSize, rgbColor color, bool destructive = false);
void createSphere(float radius, float xc, float yc, float zc, float voxelSize,
bool solid, creationMode mode, bool destructive = false, bool debug = false);
void nudgeSubTree(VoxelTreeElement* elementToNudge, const glm::vec3& nudgeAmount, VoxelEditPacketSender& voxelEditSender);
/// reads voxels from square image with alpha as a Y-axis
bool readFromSquareARGB32Pixels(const char *filename);
/// reads from minecraft file
bool readFromSchematicFile(const char* filename);

View file

@ -29,7 +29,7 @@ void addLandscape(VoxelTree * tree) {
void voxelTutorial(VoxelTree * tree) {
printf("adding scene...\n");
// We want our corner voxels to be about 1/2 meter high, and our TREE_SCALE is in meters, so...
// We want our corner voxels to be about 1/2 meter high, and our TREE_SCALE is in meters, so...
float voxelSize = 0.5f / TREE_SCALE;
// Here's an example of how to create a voxel.
@ -40,7 +40,7 @@ void voxelTutorial(VoxelTree * tree) {
VoxelTreeElement* node = tree->getVoxelAt(0, 0, 0, voxelSize);
if (node) {
// and how to access it's color
printf("corner point 0,0,0 exists... color is (%d,%d,%d) \n",
printf("corner point 0,0,0 exists... color is (%d,%d,%d) \n",
node->getColor()[0], node->getColor()[1], node->getColor()[2]);
}
@ -60,7 +60,7 @@ void voxelTutorial(VoxelTree * tree) {
void processSplitSVOFile(const char* splitSVOFile,const char* splitJurisdictionRoot,const char* splitJurisdictionEndNodes) {
char outputFileName[512];
printf("splitSVOFile: %s Jurisdictions Root: %s EndNodes: %s\n",
printf("splitSVOFile: %s Jurisdictions Root: %s EndNodes: %s\n",
splitSVOFile, splitJurisdictionRoot, splitJurisdictionEndNodes);
VoxelTree rootSVO;
@ -90,7 +90,7 @@ void processSplitSVOFile(const char* splitSVOFile,const char* splitJurisdictionR
// for regions that don't contain anything even if they're not in the
// jurisdiction of the server
// This hack assumes the end nodes for demo dinner since it only guarantees
// nodes in the 8 child voxels of the main root voxel
// nodes in the 8 child voxels of the main root voxel
const float verySmall = 0.015625;
endNodeTree.createVoxel(0.0, 0.0, 0.0, verySmall, 1, 1, 1, true);
endNodeTree.createVoxel(1.0, 0.0, 0.0, verySmall, 1, 1, 1, true);
@ -105,9 +105,9 @@ void processSplitSVOFile(const char* splitSVOFile,const char* splitJurisdictionR
// import our endNode content into it...
endNodeTree.deleteOctalCodeFromTree(endNodeCode, COLLAPSE_EMPTY_TREE);
VoxelTreeElement* endNode = rootSVO.getVoxelAt(endNodeDetails.x,
endNodeDetails.y,
endNodeDetails.z,
VoxelTreeElement* endNode = rootSVO.getVoxelAt(endNodeDetails.x,
endNodeDetails.y,
endNodeDetails.z,
endNodeDetails.s);
rootSVO.copySubTreeIntoNewTree(endNode, &endNodeTree, false);
@ -115,10 +115,10 @@ void processSplitSVOFile(const char* splitSVOFile,const char* splitJurisdictionR
sprintf(outputFileName, "splitENDNODE%d%s", i, splitSVOFile);
printf("outputFile: %s\n", outputFileName);
endNodeTree.writeToSVOFile(outputFileName);
// Delete the voxel for the EndNode from the root tree...
rootSVO.deleteOctalCodeFromTree(endNodeCode, COLLAPSE_EMPTY_TREE);
// create a small voxel in center of each EndNode, this will is a hack
// to work around a bug in voxel server that will send Voxel not exists
// for regions that don't contain anything even if they're not in the
@ -127,9 +127,9 @@ void processSplitSVOFile(const char* splitSVOFile,const char* splitJurisdictionR
float y = endNodeDetails.y + endNodeDetails.s * 0.5;
float z = endNodeDetails.z + endNodeDetails.s * 0.5;
float s = endNodeDetails.s * verySmall;
rootSVO.createVoxel(x, y, z, s, 1, 1, 1, true);
}
sprintf(outputFileName, "splitROOT%s", splitSVOFile);
@ -145,7 +145,7 @@ public:
unsigned long outCount;
unsigned long inCount;
unsigned long originalCount;
};
bool copyAndFillOperation(OctreeElement* element, void* extraData) {
@ -170,20 +170,20 @@ bool copyAndFillOperation(OctreeElement* element, void* extraData) {
args->destinationTree->createVoxel(x, y, z, s, red, green, blue, destructive);
args->outCount++;
sprintf(outputMessage,"Completed: %d%% (%lu of %lu) - Creating voxel %lu at [%f,%f,%f,%f]",
percentDone,args->inCount,args->originalCount,args->outCount,x,y,z,s);
printf("%s",outputMessage);
for (int b = 0; b < strlen(outputMessage); b++) {
printf("\b");
}
// and create same sized leafs from this leaf voxel down to zero in the destination tree
for (float yFill = y-s; yFill >= 0.0f; yFill -= s) {
args->destinationTree->createVoxel(x, yFill, z, s, red, green, blue, destructive);
args->outCount++;
sprintf(outputMessage,"Completed: %d%% (%lu of %lu) - Creating fill voxel %lu at [%f,%f,%f,%f]",
percentDone,args->inCount,args->originalCount,args->outCount,x,y,z,s);
printf("%s",outputMessage);
@ -208,13 +208,13 @@ void processFillSVOFile(const char* fillSVOFile) {
originalSVO.reaverageOctreeElements();
qDebug("Original Voxels reAveraged\n");
qDebug("Nodes after reaveraging %lu nodes\n", originalSVO.getOctreeElementsCount());
copyAndFillArgs args;
args.destinationTree = &filledSVO;
args.inCount = 0;
args.outCount = 0;
args.originalCount = originalSVO.getOctreeElementsCount();
printf("Begin processing...\n");
originalSVO.recurseTreeWithOperation(copyAndFillOperation, &args);
printf("DONE processing...\n");
@ -242,10 +242,10 @@ int main(int argc, const char * argv[])
VoxelTree myTree;
qInstallMessageHandler(sharedMessageHandler);
unitTest(&myTree);
const char* GET_OCTCODE = "--getOctCode";
const char* octcodeParams = getCmdOption(argc, argv, GET_OCTCODE);
if (octcodeParams) {
@ -280,7 +280,7 @@ int main(int argc, const char * argv[])
}
return 0;
}
const char* DECODE_OCTCODE = "--decodeOctCode";
const char* decodeParam = getCmdOption(argc, argv, DECODE_OCTCODE);
if (decodeParam) {
@ -290,7 +290,7 @@ int main(int argc, const char * argv[])
VoxelPositionSize details;
voxelDetailsForCode(octalCodeToDecode, details);
delete[] octalCodeToDecode;
qDebug() << "octal code to decode: " << decodeParamsString << "\n";
@ -300,8 +300,8 @@ int main(int argc, const char * argv[])
qDebug() << " z:" << details.z << "[" << details.z * TREE_SCALE << "]" << "\n";
qDebug() << " s:" << details.s << "[" << details.s * TREE_SCALE << "]" << "\n";
return 0;
}
}
// Handles taking and SVO and splitting it into multiple SVOs based on
// jurisdiction details
@ -324,7 +324,7 @@ int main(int argc, const char * argv[])
processFillSVOFile(fillSVOFile);
return 0;
}
const char* DONT_CREATE_FILE = "--dontCreateSceneFile";
bool dontCreateFile = cmdOptionExists(argc, argv, DONT_CREATE_FILE);
@ -332,7 +332,7 @@ int main(int argc, const char * argv[])
printf("You asked us not to create a scene file, so we will not.\n");
} else {
printf("Creating Scene File...\n");
const char* RUN_TUTORIAL = "--runTutorial";
if (cmdOptionExists(argc, argv, RUN_TUTORIAL)) {
voxelTutorial(&myTree);
@ -343,11 +343,6 @@ int main(int argc, const char * argv[])
addCornersAndAxisLines(&myTree);
}
const char* ADD_SPHERE_SCENE = "--addSphereScene";
if (cmdOptionExists(argc, argv, ADD_SPHERE_SCENE)) {
addSphereScene(&myTree);
}
const char* ADD_SURFACE_SCENE = "--addSurfaceScene";
if (cmdOptionExists(argc, argv, ADD_SURFACE_SCENE)) {
addSurfaceScene(&myTree);
@ -366,7 +361,7 @@ void unitTest(VoxelTree * tree) {
printf("unit tests...\n");
unsigned long nodeCount;
// We want our corner voxels to be about 1/2 meter high, and our TREE_SCALE is in meters, so...
// We want our corner voxels to be about 1/2 meter high, and our TREE_SCALE is in meters, so...
float voxelSize = 0.5f / TREE_SCALE;
// Here's an example of how to create a voxel.
@ -374,12 +369,12 @@ void unitTest(VoxelTree * tree) {
tree->createVoxel(0, 0, 0, voxelSize, 255, 255 ,255);
printf("Nodes at line %d... %ld nodes\n", __LINE__, tree->getOctreeElementsCount());
// Here's an example of how to test if a voxel exists
node = tree->getVoxelAt(0, 0, 0, voxelSize);
if (node) {
// and how to access it's color
printf("CORRECT - corner point 0,0,0 exists... color is (%d,%d,%d) \n",
printf("CORRECT - corner point 0,0,0 exists... color is (%d,%d,%d) \n",
node->getColor()[0], node->getColor()[1], node->getColor()[2]);
}
@ -402,7 +397,7 @@ void unitTest(VoxelTree * tree) {
tree->createVoxel(0, 0, 0, voxelSize, 255, 255 ,255);
if ((node = tree->getVoxelAt(0, 0, 0, voxelSize))) {
printf("CORRECT - corner point 0,0,0 exists... color is (%d,%d,%d) \n",
printf("CORRECT - corner point 0,0,0 exists... color is (%d,%d,%d) \n",
node->getColor()[0], node->getColor()[1], node->getColor()[2]);
} else {
printf("FAIL corner point 0,0,0 does not exists...\n");
@ -412,7 +407,7 @@ void unitTest(VoxelTree * tree) {
tree->createVoxel(voxelSize, 0, 0, voxelSize, 255, 255 ,0);
if ((node = tree->getVoxelAt(voxelSize, 0, 0, voxelSize))) {
printf("CORRECT - corner point voxelSize,0,0 exists... color is (%d,%d,%d) \n",
printf("CORRECT - corner point voxelSize,0,0 exists... color is (%d,%d,%d) \n",
node->getColor()[0], node->getColor()[1], node->getColor()[2]);
} else {
printf("FAIL corner point voxelSize,0,0 does not exists...\n");
@ -422,7 +417,7 @@ void unitTest(VoxelTree * tree) {
tree->createVoxel(0, 0, voxelSize, voxelSize, 255, 0 ,0);
if ((node = tree->getVoxelAt(0, 0, voxelSize, voxelSize))) {
printf("CORRECT - corner point 0, 0, voxelSize exists... color is (%d,%d,%d) \n",
printf("CORRECT - corner point 0, 0, voxelSize exists... color is (%d,%d,%d) \n",
node->getColor()[0], node->getColor()[1], node->getColor()[2]);
} else {
printf("FAILED corner point 0, 0, voxelSize does not exists...\n");
@ -432,7 +427,7 @@ void unitTest(VoxelTree * tree) {
tree->createVoxel(voxelSize, 0, voxelSize, voxelSize, 0, 0 ,255);
if ((node = tree->getVoxelAt(voxelSize, 0, voxelSize, voxelSize))) {
printf("CORRECT - corner point voxelSize, 0, voxelSize exists... color is (%d,%d,%d) \n",
printf("CORRECT - corner point voxelSize, 0, voxelSize exists... color is (%d,%d,%d) \n",
node->getColor()[0], node->getColor()[1], node->getColor()[2]);
} else {
printf("corner point voxelSize, 0, voxelSize does not exists...\n");
@ -449,7 +444,7 @@ void unitTest(VoxelTree * tree) {
nodeCount = tree->getOctreeElementsCount();
printf("Nodes before writing file: %ld nodes\n", nodeCount);
tree->writeToSVOFile("voxels.svo");
printf("erasing the tree...\n");
@ -468,7 +463,7 @@ void unitTest(VoxelTree * tree) {
} else {
printf("corner point voxelSize, 0, voxelSize does not exists...\n");
}
tree->readFromSVOFile("voxels.svo");
// this should exist... we just loaded it...
@ -477,9 +472,9 @@ void unitTest(VoxelTree * tree) {
} else {
printf("corner point voxelSize, 0, voxelSize does not exists...\n");
}
nodeCount = tree->getOctreeElementsCount();
printf("Nodes after loading file: %ld nodes\n", nodeCount);
}