Exemplo n.º 1
0
static bool readTransformUpdating( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
{
    unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        std::string name; is >> name >> osgDB::BEGIN_BRACKET;
        if ( name=="DraggerTransformCallback" )
        {
            osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>( is.readObject() );
            if ( transform ) dragger.addTransformUpdating( transform );
        }
        is >> osgDB::END_BRACKET;
    }
    is >> osgDB::END_BRACKET;
    return true;
}
Exemplo n.º 2
0
static bool readTransformUpdating( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
{
    unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        std::string name; is >> name >> is.BEGIN_BRACKET;
        if ( name=="DraggerTransformCallback" )
        {
            osg::ref_ptr<osg::MatrixTransform> transform = is.readObjectOfType<osg::MatrixTransform>();
            if ( transform ) dragger.addTransformUpdating( transform.get() );
        }
        is >> is.END_BRACKET;
    }
    is >> is.END_BRACKET;
    return true;
}
Exemplo n.º 3
0
static bool writeTransformUpdating( osgDB::OutputStream& os, const osgManipulator::Dragger& dragger )
{
    const osgManipulator::Dragger::DraggerCallbacks& callbacks = dragger.getDraggerCallbacks();
    os.writeSize( callbacks.size() ); os << osgDB::BEGIN_BRACKET << std::endl;
    for ( osgManipulator::Dragger::DraggerCallbacks::const_iterator itr=callbacks.begin();
          itr!=callbacks.end(); ++itr )
    {
        osgManipulator::DraggerTransformCallback* dtcb =
            dynamic_cast<osgManipulator::DraggerTransformCallback*>( itr->get() );
        if ( dtcb )
        {
            os << std::string("DraggerTransformCallback") << osgDB::BEGIN_BRACKET << std::endl;
            os << dtcb->getTransform();
        }
        else
        {
            os << std::string("DraggerCallback") << osgDB::BEGIN_BRACKET << std::endl;
        }
        os << osgDB::END_BRACKET << std::endl;
    }
    os << osgDB::END_BRACKET << std::endl;
    return true;
}
Exemplo n.º 4
0
// TransformUpdating
static bool checkTransformUpdating( const osgManipulator::Dragger& dragger )
{
    return dragger.getDraggerCallbacks().size()>0;
}
Exemplo n.º 5
0
static bool readDefaultGeometry( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
{
    bool useDefGeometry = false; is >> useDefGeometry;
    dragger.setupDefaultGeometry();
    return true;
}