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! // Note: change this to binary search... instead of linear!
int insertAt = _elementsInUse; int insertAt = _elementsInUse;
for (int i = 0; i < _elementsInUse; i++) { for (int i = 0; i < _elementsInUse; i++) {
// just compare the pointers... that's good enough
// compare the newNode to the elements already in the bag if (_bagElements[i] == node) {
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) {
return; // exit early!! return; // exit early!!
} }
// if we found a node "greater than" the inserted node, then if (_bagElements[i] > node) {
// we want to insert our node here.
if (comparison == GREATER_THAN) {
insertAt = i; insertAt = i;
break; break;
} }