示例#1
0
void CVRCullVisitor::apply(osg::LightSource& node)
{
    // push the node's state.
    StateSet* node_state = node.getStateSet();
    if(node_state)
        pushStateSet(node_state);

    StateAttribute* light = node.getLight();
    if(light)
    {
        if(node.getReferenceFrame() == osg::LightSource::RELATIVE_RF)
        {
            RefMatrix& matrix = *getModelViewMatrix();
            addPositionedAttribute(&matrix,light);
        }
        else
        {
            // relative to absolute.
            addPositionedAttribute(0,light);
        }
    }

    handle_cull_callbacks_and_traverse(node);

    // pop the node's state off the geostate stack.    
    if(node_state)
        popStateSet();
}
示例#2
0
    void apply(osg::LightSource& lightsource)
    {
        if (lightsource.getLight())
        {
            if (lightsource.getReferenceFrame()==osg::LightSource::RELATIVE_RF)
            {
                apply( osg::Matrix::identity(), lightsource.getLight());
            }
            else
            {
                apply(osg::computeEyeToLocal(_viewMatrix,_nodePath), lightsource.getLight());
            }
        }

        traverse(lightsource);
    }