Exemple #1
0
OSG::Action::ResultE
ObjectCollector::enterFunc(OSG::Node *node)
{
    OSG::NodeCore *core = node->getCore();

    if(core->getType().isDerivedFrom(OSG::SkinnedGeometry::getClassType()))
    {
        OSG::SkinnedGeometry *skinGeo = dynamic_cast<OSG::SkinnedGeometry*>(core);

        g->skinGeos .insert(skinGeo               );
        g->materials.insert(skinGeo->getMaterial());
    }

    return OSG::Action::Continue;
}
OSG::Action::ResultE doCollectGeometry(OSG::Node *node)
{
    if(node == NULL)
    {
        std::cerr << "WARNING: collectGeometry called with node == NULL"
                  << std::endl;
        return OSG::Action::Continue;
    }

    OSG::NodeCore *core = node->getCore();

    if(core == NULL)
    {
        std::cerr << "WARNING: collectGeometry called with core == NULL"
                  << std::endl;
        return OSG::Action::Continue;
    }

    if(core->getType().isDerivedFrom(OSG::Geometry::getClassType()))
    {
        geoN.push_back(node);
    }

    if(core->getType().isDerivedFrom(OSG::SkinnedGeometry::getClassType()))
    {
        skinnedGeoN.push_back(node);

        OSG::SkinnedGeometry *sgeo =
            dynamic_cast<OSG::SkinnedGeometry *>(core);
        skinnedGeoMat.push_back(sgeo->getMaterial());

        sgeo->setRenderMode(OSG::SkinnedGeometry::RMUnskinned);
    }

    return OSG::Action::Continue;
}