From 87a44bafc9b9c6d9dff307ff823de0cd0ad33e80 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 28 Oct 2013 12:37:47 -0700 Subject: [PATCH] added population data back for SIMPLE_CHILD_ARRAY implementation --- libraries/voxels/src/VoxelNode.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/voxels/src/VoxelNode.cpp b/libraries/voxels/src/VoxelNode.cpp index 456a2d8e58..3eb6047242 100644 --- a/libraries/voxels/src/VoxelNode.cpp +++ b/libraries/voxels/src/VoxelNode.cpp @@ -690,12 +690,23 @@ void VoxelNode::deleteAllChildren() { void VoxelNode::setChildAtIndex(int childIndex, VoxelNode* child) { #ifdef SIMPLE_CHILD_ARRAY + int previousChildCount = getChildCount(); if (child) { setAtBit(_childBitmask, childIndex); } else { clearAtBit(_childBitmask, childIndex); } + int newChildCount = getChildCount(); + + // store the child in our child array _simpleChildArray[childIndex] = child; + + // track our population data + if (previousChildCount != newChildCount) { + _childrenCount[previousChildCount]--; + _childrenCount[newChildCount]++; + } + #else PerformanceWarning warn(false,"setChildAtIndex",false,&_setChildAtIndexTime,&_setChildAtIndexCalls);