예제 #1
0
파일: Dragger.cpp 프로젝트: aalex/osg
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;
}
예제 #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;
}
예제 #3
0
파일: Dragger.cpp 프로젝트: aalex/osg
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;
}
예제 #4
0
파일: Dragger.cpp 프로젝트: aalex/osg
// TransformUpdating
static bool checkTransformUpdating( const osgManipulator::Dragger& dragger )
{
    return dragger.getDraggerCallbacks().size()>0;
}
예제 #5
0
파일: Dragger.cpp 프로젝트: aalex/osg
static bool readDefaultGeometry( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
{
    bool useDefGeometry = false; is >> useDefGeometry;
    dragger.setupDefaultGeometry();
    return true;
}