Example #1
0
void Octant::GetDrawablesInternal(OctreeQuery& query, bool inside) const
{
    if (this != root_)
    {
        Intersection res = query.TestOctant(cullingBox_, inside);
        if (res == INSIDE)
            inside = true;
        else if (res == OUTSIDE)
        {
            // Fully outside, so cull this octant, its children & drawables
            return;
        }
    }

    if (drawables_.Size())
    {
        Drawable** start = const_cast<Drawable**>(&drawables_[0]);
        Drawable** end = start + drawables_.Size();
        query.TestDrawables(start, end, inside);
    }

    for (unsigned i = 0; i < NUM_OCTANTS; ++i)
    {
        if (children_[i])
            children_[i]->GetDrawablesInternal(query, inside);
    }
}
Example #2
0
    void Octant::ExecuteInternal(OctreeQuery& query, bool inside)
    {
        if (this != root_)
        {
            Intersection res = query.TestOctant(cullingBox_, inside);
            if (res == Intersection::INSIDE)
                inside = true;
            else if (res == Intersection::OUTSIDE)
            {
                // Fully outside, so cull this octant, its children & drawables
                return;
            }
        }

        if (drawables_.size())
        {
            query.Test(drawables_, inside);
        }

        for (unsigned i = 0; i < NUM_OCTANTS; ++i)
        {
            if (children_[i])
                children_[i]->ExecuteInternal(query, inside);
        }
    }