mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 02:55:25 +02:00
changed VoxelNodeBag to just compare pointers, since we don't really care about ordering the bag
This commit is contained in:
parent
16b93f8c92
commit
17b137cc53
1 changed files with 4 additions and 10 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue