mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
added population data back for SIMPLE_CHILD_ARRAY implementation
This commit is contained in:
parent
b792d01511
commit
87a44bafc9
1 changed files with 11 additions and 0 deletions
|
@ -690,12 +690,23 @@ void VoxelNode::deleteAllChildren() {
|
||||||
|
|
||||||
void VoxelNode::setChildAtIndex(int childIndex, VoxelNode* child) {
|
void VoxelNode::setChildAtIndex(int childIndex, VoxelNode* child) {
|
||||||
#ifdef SIMPLE_CHILD_ARRAY
|
#ifdef SIMPLE_CHILD_ARRAY
|
||||||
|
int previousChildCount = getChildCount();
|
||||||
if (child) {
|
if (child) {
|
||||||
setAtBit(_childBitmask, childIndex);
|
setAtBit(_childBitmask, childIndex);
|
||||||
} else {
|
} else {
|
||||||
clearAtBit(_childBitmask, childIndex);
|
clearAtBit(_childBitmask, childIndex);
|
||||||
}
|
}
|
||||||
|
int newChildCount = getChildCount();
|
||||||
|
|
||||||
|
// store the child in our child array
|
||||||
_simpleChildArray[childIndex] = child;
|
_simpleChildArray[childIndex] = child;
|
||||||
|
|
||||||
|
// track our population data
|
||||||
|
if (previousChildCount != newChildCount) {
|
||||||
|
_childrenCount[previousChildCount]--;
|
||||||
|
_childrenCount[newChildCount]++;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
PerformanceWarning warn(false,"setChildAtIndex",false,&_setChildAtIndexTime,&_setChildAtIndexCalls);
|
PerformanceWarning warn(false,"setChildAtIndex",false,&_setChildAtIndexTime,&_setChildAtIndexCalls);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue