changed VoxelNodeBag to just compare pointers, since we don't really care about ordering the bag

This commit is contained in:
ZappoMan 2013-05-06 11:01:29 -07:00
parent 16b93f8c92
commit 17b137cc53

View file

@ -32,18 +32,12 @@ void VoxelNodeBag::insert(VoxelNode* node) {
// Note: change this to binary search... instead of linear!
int insertAt = _elementsInUse;
for (int i = 0; i < _elementsInUse; i++) {
// compare the newNode to the elements already in the bag
OctalCodeComparison comparison = compareOctalCodes(_bagElements[i]->getOctalCode(), node->getOctalCode());
// If we found a code in the bag that matches, then just return, since the element is already in the bag.
if (comparison == EXACT_MATCH) {
// just compare the pointers... that's good enough
if (_bagElements[i] == node) {
return; // exit early!!
}
}
// if we found a node "greater than" the inserted node, then
// we want to insert our node here.
if (comparison == GREATER_THAN) {
if (_bagElements[i] > node) {
insertAt = i;
break;
}