mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 20:33:09 +02:00
Remove redundant code in getOrCreateChildElementAt()
This commit is contained in:
parent
fc80e427b9
commit
85f06639a5
1 changed files with 1 additions and 44 deletions
|
@ -640,50 +640,7 @@ OctreeElement* OctreeElement::getOrCreateChildElementAt(float x, float y, float
|
||||||
// otherwise, we need to find which of our children we should recurse
|
// otherwise, we need to find which of our children we should recurse
|
||||||
glm::vec3 ourCenter = _cube.calcCenter();
|
glm::vec3 ourCenter = _cube.calcCenter();
|
||||||
|
|
||||||
int childIndex = CHILD_UNKNOWN;
|
int childIndex = getMyChildContainingPoint(glm::vec3(x, y, z));
|
||||||
// left half
|
|
||||||
if (x > ourCenter.x) {
|
|
||||||
if (y > ourCenter.y) {
|
|
||||||
// top left
|
|
||||||
if (z > ourCenter.z) {
|
|
||||||
// top left far
|
|
||||||
childIndex = CHILD_TOP_LEFT_FAR;
|
|
||||||
} else {
|
|
||||||
// top left near
|
|
||||||
childIndex = CHILD_TOP_LEFT_NEAR;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// bottom left
|
|
||||||
if (z > ourCenter.z) {
|
|
||||||
// bottom left far
|
|
||||||
childIndex = CHILD_BOTTOM_LEFT_FAR;
|
|
||||||
} else {
|
|
||||||
// bottom left near
|
|
||||||
childIndex = CHILD_BOTTOM_LEFT_NEAR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// right half
|
|
||||||
if (y > ourCenter.y) {
|
|
||||||
// top right
|
|
||||||
if (z > ourCenter.z) {
|
|
||||||
// top right far
|
|
||||||
childIndex = CHILD_TOP_RIGHT_FAR;
|
|
||||||
} else {
|
|
||||||
// top right near
|
|
||||||
childIndex = CHILD_TOP_RIGHT_NEAR;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// bottom right
|
|
||||||
if (z > ourCenter.z) {
|
|
||||||
// bottom right far
|
|
||||||
childIndex = CHILD_BOTTOM_RIGHT_FAR;
|
|
||||||
} else {
|
|
||||||
// bottom right near
|
|
||||||
childIndex = CHILD_BOTTOM_RIGHT_NEAR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now, check if we have a child at that location
|
// Now, check if we have a child at that location
|
||||||
child = getChildAtIndex(childIndex);
|
child = getChildAtIndex(childIndex);
|
||||||
|
|
Loading…
Reference in a new issue