Ejemplo n.º 1
0
NodeIds NodeId::getParents() const
{
    NodeIds nodeIds;
    NodeId parent = getParent();

    while (parent.isValid())
    {
        nodeIds.push_back(parent);
        parent = parent.getParent();
    }

    return nodeIds;
}
Ejemplo n.º 2
0
NodeIds NodeId::getChildren( ) const
{
    NodeIds nodeIds;
    if( _level == INVALID_LEVEL )
        return nodeIds;

    const Vector3ui childPos = getPosition() * 2;
    for( uint32_t x = 0; x < 2; ++x )
        for( uint32_t y = 0; y < 2; ++y )
            for( uint32_t z = 0; z < 2; ++z )
            {
                const Vector3ui pos( childPos[ 0 ] + x,
                                     childPos[ 1 ] + y,
                                     childPos[ 2 ] + z );
                nodeIds.push_back( NodeId( _level + 1, pos, _frame ) );
            }

    return nodeIds;
}
Ejemplo n.º 3
0
NodeIds NodeId::getChildrenAtLevel( const uint32_t level ) const
{
    NodeIds nodeIds;
    if( _level == INVALID_LEVEL || _level >= level )
        return nodeIds;

    const uint32_t childCount = 1u << ( level - _level );
    const Vector3f& startPosInLevel = getPosition() * childCount;

    for( uint32_t x = 0; x < childCount; ++x )
        for( uint32_t y = 0; y < childCount; ++y )
            for( uint32_t z = 0; z < childCount; ++z )
            {
                const Vector3ui pos( startPosInLevel[ 0 ] + x,
                                     startPosInLevel[ 1 ] + y,
                                     startPosInLevel[ 2 ] + z );
                nodeIds.push_back( NodeId( level, pos, _frame ) );
            }

    return nodeIds;
}
Ejemplo n.º 4
0
    void visitPost()
    {
// Sort-last range selection:
#ifndef LIVRE_STATIC_DECOMPOSITION
        const size_t startIndex = _range[0] * _visibles.size();
        const size_t endIndex = _range[1] * _visibles.size();
#endif
        NodeIds selected;
        for (size_t i = 0; i < _visibles.size(); ++i)
        {
#ifdef LIVRE_STATIC_DECOMPOSITION
            const Range& nodeRange = _visibles[i].getRange();
            const bool isInRange =
                nodeRange[1] > _range[0] && nodeRange[1] <= _range[1];
#else
            const bool isInRange = i >= startIndex && i < endIndex;
#endif
            if (isInRange)
                selected.push_back(_visibles[i]);
        }
        _visibles.swap(selected);
    }