Пример #1
0
void CURRENT_CLASS::apply(osg::Transform &transform)
{
    if(shouldContinueTraversal(transform))
    {
        // Compute transform for current node
        osg::Matrix currMatrix = _viewMatrices.back();
        bool pushMatrix = transform.computeLocalToWorldMatrix(currMatrix,this);

        if(pushMatrix)
        {
            // Store the new modelview matrix and view frustum
            _viewMatrices.push_back(currMatrix);
            pushLocalFrustum();
        }

        ++_currentDepth;
        traverse(transform);
        --_currentDepth;

        if(pushMatrix)
        {
            // Restore the old modelview matrix and view frustum
            _localFrusta.pop_back();
            _bbCorners.pop_back();
            _viewMatrices.pop_back();
        }
    }
}
Пример #2
0
void CURRENT_CLASS::apply(osg::Projection &proj)
{
    if(shouldContinueTraversal(proj))
    {
        // Push the new projection matrix view frustum
        _projectionMatrices.push_back(proj.getMatrix());
        pushLocalFrustum();

        // Traverse the group
        ++_currentDepth;
        traverse(proj);
        --_currentDepth;

        // Reload original matrix and frustum
        _localFrusta.pop_back();
        _bbCorners.pop_back();
        _projectionMatrices.pop_back();
    }
}
void DistanceAccumulator::reset()
{
    // Clear vectors & values
    _distancePairs.clear();
    _cameraPairs.clear();
    _limits.first = DBL_MAX;
    _limits.second = 0.0;
    _currentDepth = 0;

    // Initial transform matrix is the modelview matrix
    _viewMatrices.clear();
    _viewMatrices.push_back(_modelview);

    // Set the initial projection matrix
    _projectionMatrices.clear();
    _projectionMatrices.push_back(_projection);

    // Create a frustum without near/far planes, for cull computations
    _localFrusta.clear();
    _bbCorners.clear();
    pushLocalFrustum();
}