Changeset 10207

Show
Ignore:
Timestamp:
05/14/09 15:40:02 (4 years ago)
Author:
robert
Message:

Integrated support for relative paths, and http hosted presentations

Location:
OpenSceneGraph/trunk/applications/present3D
Files:
1 added
6 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/applications/present3D/CMakeLists.txt

    r10165 r10207  
    88    present3D.cpp 
    99    ReaderWriterP3D.cpp 
     10    ReaderWriterPaths.cpp 
    1011    ReadShowFile.cpp 
    1112    ShowEventHandler.cpp 
  • OpenSceneGraph/trunk/applications/present3D/PickEventHandler.cpp

    r10117 r10207  
    131131            #endif 
    132132                std::string filepath("OSG_FILE_PATH="); 
    133                  
     133 
    134134                bool needDeliminator = false; 
    135135                for(osgDB::FilePathList::iterator itr = paths.begin(); 
     
    146146                char* path = getenv("PATH"); 
    147147                if (path) binpath += path; 
    148                  
     148 
    149149                needDeliminator = true; 
    150150                for(osgDB::FilePathList::iterator itr = paths.begin(); 
     
    159159 
    160160            } 
    161 #endif                                     
     161#endif 
    162162            int result = system(_command.c_str()); 
    163              
    164             osg::notify(osg::INFO)<<"system("<<_command<<") result "<<result<<std::endl; 
     163 
     164            osg::notify(osg::INFO)<<"system("<<_command<<") result "<<result<<std::endl; 
    165165 
    166166            break; 
     
    187187    { 
    188188        osg::notify(osg::NOTICE)<<"Requires jump "<<_relativeJump<<", "<<_slideNum<<", "<<_layerNum<<std::endl; 
    189          
     189 
    190190        if (_relativeJump) 
    191191        { 
     
    198198                newLayer = 0; 
    199199            } 
    200          
     200 
    201201            osg::notify(osg::NOTICE)<<"   jump to "<<newSlide<<", "<<newLayer<<std::endl; 
    202202 
  • OpenSceneGraph/trunk/applications/present3D/ReaderWriterP3D.cpp

    r10125 r10207  
    114114    virtual ReadResult readNode(std::istream& fin, const Options* options) const; 
    115115 
    116     ReadResult readNode(osgDB::XmlNode::Input& input, const osgDB::ReaderWriter::Options* options) const; 
     116    ReadResult readNode(osgDB::XmlNode::Input& input, osgDB::ReaderWriter::Options* options) const; 
    117117 
    118118    void parseModel(osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur) const; 
     
    871871        } 
    872872    } 
    873      
     873 
    874874    if (!filenameLeft.empty() && !filenameRight.empty())  
    875875        constructor.addStereoImagePair(filenameLeft,imageDataLeft, 
    876                                        filenameRight, imageDataRight, 
     876                                       filenameRight, imageDataRight, 
    877877                                       positionRead ? positionData : constructor.getImagePositionData()); 
    878878 
     
    13861386#include <iostream> 
    13871387 
     1388 
     1389struct MyFindFileCallback : public osgDB::FindFileCallback 
     1390{ 
     1391    virtual std::string findDataFile(const std::string& filename, const osgDB::Options* options, osgDB::CaseSensitivity caseSensitivity) 
     1392    { 
     1393        osg::notify(osg::NOTICE)<<std::endl<<std::endl<<"find file "<<filename<<std::endl; 
     1394 
     1395        const osgDB::FilePathList& paths = options ? options->getDatabasePathList() : osgDB::getDataFilePathList(); 
     1396 
     1397        for(osgDB::FilePathList::const_iterator itr = paths.begin(); 
     1398            itr != paths.end(); 
     1399            ++itr) 
     1400        { 
     1401            const std::string& path = *itr; 
     1402            std::string newpath = osgDB::concatPaths(path, filename); 
     1403            if (osgDB::containsServerAddress(path)) 
     1404            { 
     1405                osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension("curl"); 
     1406                osg::notify(osg::NOTICE)<<"  file on server "<<*itr<<", try path "<<newpath<<std::endl; 
     1407                osg::notify(osg::NOTICE)<<"  we have curl rw= "<<rw<<std::endl; 
     1408                if (rw && rw->fileExists(newpath, options)) 
     1409                { 
     1410                    osg::notify(osg::NOTICE)<<"  FOUND on server "<<newpath<<std::endl; 
     1411                    return newpath; 
     1412                } 
     1413            } 
     1414            else 
     1415            { 
     1416                if(osgDB::fileExists(newpath)) 
     1417                { 
     1418                    osg::notify(osg::NOTICE)<<" FOUND "<<newpath<<std::endl; 
     1419                    return newpath; 
     1420                } 
     1421            } 
     1422        } 
     1423 
     1424        return osgDB::Registry::instance()->findDataFileImplementation(filename, options, caseSensitivity); 
     1425    } 
     1426}; 
     1427 
     1428class OSGDB_EXPORT MyReadFileCallback : public virtual osgDB::ReadFileCallback 
     1429{ 
     1430    public: 
     1431 
     1432        osgDB::FilePathList _paths; 
     1433 
     1434        typedef std::map< std::string, osg::ref_ptr<osg::Object> >  ObjectCache; 
     1435 
     1436        enum ObjectType 
     1437        { 
     1438            OBJECT, 
     1439            IMAGE, 
     1440            HEIGHT_FIELD, 
     1441            NODE, 
     1442            SHADER 
     1443        }; 
     1444 
     1445        osgDB::ReaderWriter::ReadResult readLocal(ObjectType type, const std::string& filename, const osgDB::Options* options) 
     1446        { 
     1447            osg::notify(osg::INFO)<<"Trying local file "<<filename<<std::endl; 
     1448 
     1449            switch(type) 
     1450            { 
     1451                case(OBJECT): return osgDB::Registry::instance()->readObjectImplementation(filename,options); 
     1452                case(IMAGE): return osgDB::Registry::instance()->readImageImplementation(filename,options); 
     1453                case(HEIGHT_FIELD): return osgDB::Registry::instance()->readHeightFieldImplementation(filename,options); 
     1454                case(NODE): return osgDB::Registry::instance()->readNodeImplementation(filename,options); 
     1455                case(SHADER): return osgDB::Registry::instance()->readShaderImplementation(filename,options); 
     1456            } 
     1457            return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED; 
     1458        } 
     1459 
     1460         
     1461        osgDB::ReaderWriter::ReadResult readFileCache(ObjectType type, const std::string& filename, const osgDB::Options* options) 
     1462        { 
     1463 
     1464            osgDB::FileCache* fileCache = options ? options->getFileCache() : 0; 
     1465            if (!fileCache) fileCache = osgDB::Registry::instance()->getFileCache(); 
     1466            if (!fileCache) return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; 
     1467 
     1468            osg::notify(osg::INFO)<<"Trying fileCache "<<filename<<std::endl; 
     1469 
     1470            osgDB::ReaderWriter::ReadResult result; 
     1471            if (fileCache && fileCache->isFileAppropriateForFileCache(filename)) 
     1472            { 
     1473                if (fileCache->existsInCache(filename)) 
     1474                { 
     1475                    switch(type) 
     1476                    { 
     1477                        case(OBJECT): 
     1478                            result = fileCache->readObject(filename, 0); 
     1479                            break; 
     1480                        case(IMAGE): 
     1481                            result = fileCache->readImage(filename, 0); 
     1482                            break; 
     1483                        case(HEIGHT_FIELD): 
     1484                            result = fileCache->readHeightField(filename, 0); 
     1485                            break; 
     1486                        case(NODE): 
     1487                            result = fileCache->readNode(filename,0); 
     1488                            break; 
     1489                        case(SHADER): 
     1490                            result = fileCache->readShader(filename, 0); 
     1491                            break; 
     1492                    } 
     1493 
     1494                    if (result.success()) 
     1495                    { 
     1496                        osg::notify(osg::INFO)<<"   File read from FileCache."<<std::endl; 
     1497                        return result; 
     1498                    } 
     1499 
     1500                    osg::notify(osg::NOTICE)<<"   File in FileCache, but not successfully read"<<std::endl; 
     1501                } 
     1502                else 
     1503                { 
     1504                    osg::notify(osg::INFO)<<"   File does not exist in FileCache: "<<fileCache->createCacheFileName(filename)<<std::endl; 
     1505                } 
     1506            } 
     1507 
     1508            return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; 
     1509 
     1510        } 
     1511 
     1512        osgDB::ReaderWriter::ReadResult readServer(ObjectType type, const std::string& filename, const osgDB::Options* options) 
     1513        { 
     1514            osg::notify(osg::INFO)<<"Trying server file "<<filename<<std::endl; 
     1515 
     1516            osgDB::ReaderWriter::ReadResult result; 
     1517            osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension("curl"); 
     1518            if (!rw) return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED; 
     1519 
     1520            switch(type) 
     1521            { 
     1522                case(OBJECT): 
     1523                    result = rw->readObject(filename,options); 
     1524                    break; 
     1525                case(IMAGE): 
     1526                    result = rw->readImage(filename,options); 
     1527                    break; 
     1528                case(HEIGHT_FIELD): 
     1529                    result = rw->readHeightField(filename,options); 
     1530                    break; 
     1531                case(NODE): 
     1532                    result = rw->readNode(filename,options); 
     1533                    break; 
     1534                case(SHADER): 
     1535                    result = rw->readShader(filename,options); 
     1536                    break; 
     1537            } 
     1538 
     1539            if (result.success()) 
     1540            { 
     1541                osgDB::FileCache* fileCache = options ? options->getFileCache() : 0; 
     1542                if (!fileCache) fileCache = osgDB::Registry::instance()->getFileCache(); 
     1543 
     1544                if (fileCache && fileCache->isFileAppropriateForFileCache(filename)) 
     1545                { 
     1546                    switch(type) 
     1547                    { 
     1548                        case(OBJECT): 
     1549                            fileCache->writeObject(*result.getObject(),filename,options); 
     1550                            break; 
     1551                        case(IMAGE): 
     1552                            result.getImage()->setFileName(filename); 
     1553                            fileCache->writeImage(*result.getImage(),filename,options); 
     1554                            break; 
     1555                        case(HEIGHT_FIELD): 
     1556                            fileCache->writeHeightField(*result.getHeightField(),filename,options); 
     1557                            break; 
     1558                        case(NODE): 
     1559                            fileCache->writeNode(*result.getNode(),filename,options); 
     1560                            break; 
     1561                        case(SHADER): 
     1562                            fileCache->writeShader(*result.getShader(),filename,options); 
     1563                            break; 
     1564                    } 
     1565                } 
     1566 
     1567                return result; 
     1568            } 
     1569            return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; 
     1570        } 
     1571 
     1572 
     1573        osgDB::ReaderWriter::ReadResult read(const osgDB::FilePathList& filePathList, ObjectType type, const std::string& filename, const osgDB::Options* options, bool checkLocalFiles) 
     1574        { 
     1575            // go look in http paths 
     1576            for(osgDB::FilePathList::const_iterator itr = filePathList.begin(); 
     1577                itr != filePathList.end(); 
     1578                ++itr) 
     1579            { 
     1580                const std::string& path = *itr; 
     1581                std::string newpath = path.empty() ? filename : osgDB::concatPaths(path, filename); 
     1582                osgDB::ReaderWriter::ReadResult result; 
     1583                if (osgDB::containsServerAddress(newpath)) 
     1584                { 
     1585                    if (checkLocalFiles) result = readFileCache(type, newpath, options); 
     1586                    else result = readServer(type, newpath, options); 
     1587                } 
     1588                else if (checkLocalFiles && osgDB::fileExists(newpath)) 
     1589                { 
     1590                    result = readLocal(type, newpath, options); 
     1591                } 
     1592 
     1593                if (result.success()) 
     1594                { 
     1595                    osg::notify(osg::INFO)<<"   inserting object into file cache "<<filename<<", "<<result.getObject()<<std::endl; 
     1596                    _objectCache[filename] = result.getObject(); 
     1597 
     1598                    options->setPluginStringData("filename",newpath); 
     1599                    return result; 
     1600                } 
     1601            } 
     1602            return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; 
     1603        } 
     1604 
     1605        osgDB::ReaderWriter::ReadResult read(ObjectType type, const std::string& filename, const osgDB::Options* options) 
     1606        { 
     1607            osgDB::FileCache* fileCache = options ? options->getFileCache() : 0; 
     1608            if (!fileCache) fileCache = osgDB::Registry::instance()->getFileCache(); 
     1609            if (fileCache && !fileCache->isFileAppropriateForFileCache(filename)) fileCache = 0; 
     1610 
     1611            osg::notify(osg::INFO)<<"reading file "<<filename<<std::endl; 
     1612            ObjectCache::iterator itr = _objectCache.find(filename); 
     1613            if (itr != _objectCache.end()) 
     1614            { 
     1615                // object is in cache, just retrieve it. 
     1616                if (itr->second.valid()) 
     1617                { 
     1618                    osg::notify(osg::INFO)<<"File retrieved from cache, filename="<<filename<<std::endl; 
     1619                    return itr->second.get(); 
     1620                } 
     1621                else 
     1622                { 
     1623                    osg::notify(osg::INFO)<<"File failed to load previously, won't attempt a second time "<<filename<<std::endl; 
     1624                    return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; 
     1625                } 
     1626            } 
     1627 
     1628            { 
     1629                bool checkLocalFiles = true; 
     1630                osgDB::ReaderWriter::ReadResult result = read(_paths, type, filename, options, checkLocalFiles); 
     1631                if (result.success()) return result; 
     1632 
     1633                if (options && !(options->getDatabasePathList().empty())) 
     1634                { 
     1635                    result = read(options->getDatabasePathList(), type, filename, options, checkLocalFiles); 
     1636                    if (result.success()) return result; 
     1637                } 
     1638 
     1639                result = read(osgDB::Registry::instance()->getDataFilePathList(), type, filename, options, checkLocalFiles); 
     1640                if (result.success()) return result; 
     1641            } 
     1642 
     1643            { 
     1644                bool checkLocalFiles = false; 
     1645                osgDB::ReaderWriter::ReadResult result = read(_paths, type, filename, options, checkLocalFiles); 
     1646                if (result.success()) return result; 
     1647 
     1648                if (options && !(options->getDatabasePathList().empty())) 
     1649                { 
     1650                    result = read(options->getDatabasePathList(), type, filename, options, checkLocalFiles); 
     1651                    if (result.success()) return result; 
     1652                } 
     1653 
     1654                result = read(osgDB::Registry::instance()->getDataFilePathList(), type, filename, options, checkLocalFiles); 
     1655                if (result.success()) return result; 
     1656            } 
     1657 
     1658            _objectCache[filename] = 0; 
     1659 
     1660            return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; 
     1661        } 
     1662 
     1663        virtual osgDB::ReaderWriter::ReadResult readObject(const std::string& filename, const osgDB::Options* options) 
     1664        { 
     1665            return read(OBJECT, filename, options); 
     1666        } 
     1667 
     1668        virtual osgDB::ReaderWriter::ReadResult readImage(const std::string& filename, const osgDB::Options* options) 
     1669        { 
     1670            return read(IMAGE, filename, options); 
     1671        } 
     1672 
     1673        virtual osgDB::ReaderWriter::ReadResult readHeightField(const std::string& filename, const osgDB::Options* options) 
     1674        { 
     1675            return read(HEIGHT_FIELD, filename, options); 
     1676        } 
     1677 
     1678        virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& filename, const osgDB::Options* options) 
     1679        { 
     1680            return read(NODE, filename, options); 
     1681        } 
     1682 
     1683        virtual osgDB::ReaderWriter::ReadResult readShader(const std::string& filename, const osgDB::Options* options) 
     1684        { 
     1685            return read(SHADER, filename, options); 
     1686        } 
     1687 
     1688    protected: 
     1689        virtual ~MyReadFileCallback() {} 
     1690 
     1691        ObjectCache _objectCache; 
     1692}; 
     1693 
    13881694osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(const std::string& file, 
    13891695                                                           const osgDB::ReaderWriter::Options* options) const 
     
    13941700    std::string fileName = osgDB::findDataFile( file ); 
    13951701    if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
     1702 
     1703    // code for setting up the database path so that internally referenced file are searched for on relative paths. 
     1704    osg::ref_ptr<osgDB::ReaderWriter::Options> local_opt = options ? static_cast<osgDB::ReaderWriter::Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 
     1705    local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 
     1706    //local_opt->setFindFileCallback(new MyFindFileCallback); 
     1707    local_opt->setReadFileCallback(new MyReadFileCallback); 
    13961708 
    13971709    osgDB::XmlNode::Input input; 
     
    13991711    input.readAllDataIntoBuffer(); 
    14001712 
    1401     return readNode(input, options); 
     1713    return readNode(input, local_opt); 
    14021714} 
    14031715 
     
    14081720    input.readAllDataIntoBuffer(); 
    14091721 
    1410     return readNode(input, options); 
    1411 } 
    1412  
    1413 osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(osgDB::XmlNode::Input& input, const osgDB::ReaderWriter::Options* options) const 
     1722    osg::ref_ptr<osgDB::ReaderWriter::Options> local_opt = options ? static_cast<osgDB::ReaderWriter::Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 
     1723    //local_opt->setFindFileCallback(new MyFindFileCallback); 
     1724    local_opt->setReadFileCallback(new MyReadFileCallback); 
     1725 
     1726    return readNode(input, local_opt); 
     1727} 
     1728 
     1729osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(osgDB::XmlNode::Input& input, osgDB::ReaderWriter::Options* options) const 
    14141730{ 
    14151731    bool readOnlyHoldingPage = options ? options->getOptionString()=="holding_slide" : false; 
     
    14231739 
    14241740    doc->read(input); 
     1741 
     1742 
     1743    osg::notify(osg::NOTICE)<<"P3D parsing"<<std::endl; 
    14251744 
    14261745    // doc->write(std::cout); 
     
    14511770    } 
    14521771 
    1453     osgPresentation::SlideShowConstructor constructor; 
     1772    osgPresentation::SlideShowConstructor constructor(options); 
    14541773 
    14551774    osgDB::FilePathList previousPaths = osgDB::getDataFilePathList(); 
    14561775 
    14571776    bool readSlide = false; 
     1777 
     1778 
     1779    for(osgDB::XmlNode::Children::iterator itr = root->children.begin(); 
     1780        itr != root->children.end(); 
     1781        ++itr) 
     1782    { 
     1783        osgDB::XmlNode* cur = itr->get(); 
     1784 
     1785        if (cur->name=="env") 
     1786        { 
     1787            char* str = strdup(cur->contents.c_str()); 
     1788            osg::notify(osg::INFO)<<"putenv("<<str<<")"<<std::endl; 
     1789            putenv(str); 
     1790        } 
     1791    } 
     1792 
     1793    std::string pathToPresentation; 
     1794    MyReadFileCallback* readFileCallback = options ? dynamic_cast<MyReadFileCallback*>(options->getReadFileCallback()) : 0; 
     1795 
     1796    if (options && !(options->getDatabasePathList().empty())) 
     1797    { 
     1798        pathToPresentation = options->getDatabasePathList().front(); 
     1799 
     1800       if (readFileCallback) readFileCallback->_paths.push_front(pathToPresentation); 
     1801    } 
     1802 
     1803 
     1804    for(osgDB::XmlNode::Children::iterator itr = root->children.begin(); 
     1805        itr != root->children.end(); 
     1806        ++itr) 
     1807    { 
     1808        osgDB::XmlNode* cur = itr->get(); 
     1809 
     1810        if (cur->name == "path") 
     1811        { 
     1812            std::string newpath = expandEnvVarsInFileName(cur->contents); 
     1813 
     1814            // now check if an absolue or http path 
     1815            std::string::size_type colonPos = newpath.find_first_of(':'); 
     1816            std::string::size_type backslashPos = newpath.find_first_of('/'); 
     1817            std::string::size_type forwardslashPos = newpath.find_first_of('\\'); 
     1818            bool relativePath = colonPos == std::string::npos && 
     1819                                backslashPos != 0 && 
     1820                                forwardslashPos != 0; 
     1821 
     1822            if (relativePath && !pathToPresentation.empty()) 
     1823            { 
     1824                newpath = osgDB::concatPaths(pathToPresentation, newpath); 
     1825                osg::notify(osg::NOTICE)<<"relative path = "<<cur->contents<<", newpath="<<newpath<<std::endl; 
     1826            } 
     1827            else 
     1828            { 
     1829                osg::notify(osg::NOTICE)<<"absolute path = "<<cur->contents<<", newpath="<<newpath<<std::endl; 
     1830            } 
     1831 
     1832            if (readFileCallback) readFileCallback->_paths.push_back(newpath); 
     1833            else options->getDatabasePathList().push_back(newpath); 
     1834        } 
     1835    } 
     1836 
    14581837 
    14591838    for(osgDB::XmlNode::Children::iterator itr = root->children.begin(); 
  • OpenSceneGraph/trunk/applications/present3D/SlideEventHandler.cpp

    r10132 r10207  
    137137    virtual void setPause(bool pause) 
    138138    { 
    139         osg::AnimationPathCallback* apc = dynamic_cast<osg::AnimationPathCallback*>(_callback.get()); 
    140         osgUtil::TransformCallback* tc = dynamic_cast<osgUtil::TransformCallback*>(_callback.get()); 
    141         ss3d::AnimationMaterialCallback* amc = dynamic_cast<ss3d::AnimationMaterialCallback*>(_callback.get()); 
    142         if (apc) 
    143         { 
     139        osg::AnimationPathCallback* apc = dynamic_cast<osg::AnimationPathCallback*>(_callback.get()); 
     140        osgUtil::TransformCallback* tc = dynamic_cast<osgUtil::TransformCallback*>(_callback.get()); 
     141        ss3d::AnimationMaterialCallback* amc = dynamic_cast<ss3d::AnimationMaterialCallback*>(_callback.get()); 
     142        if (apc) 
     143        { 
    144144            osg::notify(osg::INFO)<<"apc->setPause("<<pause<<")"<<std::endl; 
    145145            apc->setPause(pause); 
    146         } 
    147         if (tc) 
    148         { 
     146        } 
     147        if (tc) 
     148        { 
    149149            osg::notify(osg::INFO)<<"tc->setPause("<<pause<<")"<<std::endl; 
    150150            tc->setPause(pause); 
    151         } 
    152         if (amc) 
    153         { 
     151        } 
     152        if (amc) 
     153        { 
    154154            osg::notify(osg::INFO)<<"amc->setPause("<<pause<<")"<<std::endl; 
    155155            amc->setPause(pause); 
    156         } 
     156        } 
    157157    } 
    158158 
    159159    virtual void reset() 
    160160    { 
    161         osg::AnimationPathCallback* apc = dynamic_cast<osg::AnimationPathCallback*>(_callback.get()); 
    162         osgUtil::TransformCallback* tc = dynamic_cast<osgUtil::TransformCallback*>(_callback.get()); 
    163         ss3d::AnimationMaterialCallback* amc = dynamic_cast<ss3d::AnimationMaterialCallback*>(_callback.get()); 
    164         if (apc) 
    165         { 
     161        osg::AnimationPathCallback* apc = dynamic_cast<osg::AnimationPathCallback*>(_callback.get()); 
     162        osgUtil::TransformCallback* tc = dynamic_cast<osgUtil::TransformCallback*>(_callback.get()); 
     163        ss3d::AnimationMaterialCallback* amc = dynamic_cast<ss3d::AnimationMaterialCallback*>(_callback.get()); 
     164        if (apc) 
     165        { 
    166166            apc->reset(); 
    167167            apc->update(*_node); 
    168         } 
    169         if (tc) 
    170         { 
    171         } 
    172         if (amc) 
    173         { 
     168        } 
     169        if (tc) 
     170        { 
     171        } 
     172        if (amc) 
     173        { 
    174174            amc->reset(); 
    175175            amc->update(*_node); 
    176         } 
     176        } 
    177177    } 
    178178 
     
    221221                int result = system(itr->c_str()); 
    222222 
    223                 osg::notify(osg::INFO)<<"system("<<*itr<<") result "<<result<<std::endl; 
     223                osg::notify(osg::INFO)<<"system("<<*itr<<") result "<<result<<std::endl; 
    224224 
    225225                double timeForRun = osg::Timer::instance()->delta_s(startTick, osg::Timer::instance()->tick()); 
     
    267267        osg::NodeVisitor(tm), 
    268268        _operatorList(operatorList) {} 
    269                  
    270     void apply(osg::Node& node)     
    271     { 
    272         if (node.getStateSet()) process(node.getStateSet()); 
    273  
    274         if (node.getUpdateCallback()) 
    275         { 
     269 
     270    void apply(osg::Node& node) 
     271    { 
     272        if (node.getStateSet()) process(node.getStateSet()); 
     273 
     274        if (node.getUpdateCallback()) 
     275        { 
    276276            _operatorList.insert(new CallbackOperator(&node, node.getUpdateCallback())); 
    277         } 
     277        } 
    278278 
    279279        LayerAttributes* la = dynamic_cast<LayerAttributes*>(node.getUserData()); 
     
    282282            _operatorList.insert(new LayerAttributesOperator(&node, la)); 
    283283        } 
    284          
     284 
    285285        traverse(node); 
    286286    } 
     
    289289    { 
    290290        apply((osg::Node&)node); 
    291          
    292291        for(unsigned int i=0;i<node.getNumDrawables();++i) 
    293292        { 
     
    309308            } 
    310309        } 
    311     }    
    312      
     310    } 
     311 
    313312    ActiveOperators::OperatorList& _operatorList; 
    314313}; 
  • OpenSceneGraph/trunk/applications/present3D/SlideShowConstructor.cpp

    r10117 r10207  
    8787}; 
    8888 
    89 SlideShowConstructor::SlideShowConstructor() 
     89SlideShowConstructor::SlideShowConstructor(const osgDB::ReaderWriter::Options* options): 
     90    _options(options) 
    9091{ 
    9192    _slideDistance = osg::DisplaySettings::instance()->getScreenDistance(); 
     
    322323 
    323324        osg::ref_ptr<osg::Image> image = !_slideBackgroundImageFileName.empty() ? 
    324             osgDB::readImageFile(_slideBackgroundImageFileName) : 
     325            osgDB::readImageFile(_slideBackgroundImageFileName, _options.get()) : 
    325326            0; 
    326327 
     
    636637    FindImageStreamsVisitor(): 
    637638        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} 
    638          
     639 
    639640    virtual void apply(osg::Node& node) 
    640641    { 
    641         if (node.getStateSet()) 
    642         { 
    643              process(node.getStateSet()); 
    644         } 
    645         traverse(node); 
    646     }            
     642        if (node.getStateSet()) 
     643        { 
     644                process(node.getStateSet()); 
     645        } 
     646        traverse(node); 
     647    } 
    647648 
    648649    virtual void apply(osg::Geode& node) 
    649650    { 
    650         if (node.getStateSet()) 
    651         { 
    652              process(node.getStateSet()); 
    653         } 
    654          
     651        if (node.getStateSet()) 
     652        { 
     653                process(node.getStateSet()); 
     654        } 
     655 
    655656        for(unsigned int i=0;i<node.getNumDrawables();++i) 
    656657        { 
     
    681682        } 
    682683    } 
    683      
     684 
    684685}; 
    685686 
     
    775776    if (!_currentLayer) addLayer(); 
    776777 
    777     osg::Image* image = osgDB::readImageFile(filename); 
    778      
     778    osg::Image* image = osgDB::readImageFile(filename, _options.get()); 
     779    if (image) recordOptionsFilePath(_options.get()); 
     780 
    779781    if (!image) return; 
    780782 
     
    889891 
    890892 
    891     osg::ref_ptr<osg::Image> imageLeft = osgDB::readImageFile(filenameLeft); 
    892     osg::ref_ptr<osg::Image> imageRight = (filenameRight==filenameLeft) ? imageLeft.get() : osgDB::readImageFile(filenameRight); 
     893    osg::ref_ptr<osg::Image> imageLeft = osgDB::readImageFile(filenameLeft, _options.get()); 
     894    if (imageLeft.valid()) recordOptionsFilePath(_options.get()); 
     895 
     896    osg::ref_ptr<osg::Image> imageRight = (filenameRight==filenameLeft) ? imageLeft.get() : osgDB::readImageFile(filenameRight, _options.get()); 
     897    if (imageRight.valid()) recordOptionsFilePath(_options.get()); 
    893898 
    894899    if (!imageLeft && !imageRight) return; 
     
    962967        } 
    963968 
    964         attachTexMat(pictureLeftStateSet, imageDataLeft, s, t, usedTextureRectangle); 
     969        attachTexMat(pictureLeftStateSet, imageDataLeft, s, t, usedTextureRectangle); 
    965970 
    966971        pictureLeft->addDrawable(pictureLeftQuad); 
     
    980985        } 
    981986 
    982         attachTexMat(pictureRightStateSet, imageDataRight, s, t, usedTextureRectangle); 
     987        attachTexMat(pictureRightStateSet, imageDataRight, s, t, usedTextureRectangle); 
    983988 
    984989        pictureRight->addDrawable(pictureRightQuad); 
     
    10841089    if (!_currentLayer) addLayer(); 
    10851090 
    1086     osg::Image* image = osgDB::readImageFile(filename); 
     1091    osg::Image* image = osgDB::readImageFile(filename, _options.get()); 
    10871092     
    10881093    osg::notify(osg::INFO)<<"addInteractiveImage("<<filename<<") "<<image<<std::endl; 
     
    12031208std::string SlideShowConstructor::findFileAndRecordPath(const std::string& filename) 
    12041209{ 
    1205     std::string foundFile = osgDB::findDataFile(filename); 
     1210    std::string foundFile = osgDB::findDataFile(filename, _options.get()); 
    12061211    if (foundFile.empty()) return foundFile; 
    12071212 
     
    12251230void SlideShowConstructor::addModel(const std::string& filename, const PositionData& positionData, const ModelData& modelData) 
    12261231{ 
     1232    osg::notify(osg::INFO)<<"SlideShowConstructor::addModel("<<filename<<")"<<std::endl; 
     1233 
    12271234    osg::Node* subgraph = 0; 
    12281235 
     
    12431250    else 
    12441251    { 
    1245         std::string foundFile = findFileAndRecordPath(filename); 
    1246         if (foundFile.empty()) return; 
    1247  
    1248         subgraph = osgDB::readNodeFile(foundFile); 
    1249     } 
    1250      
    1251     if (!subgraph) return; 
    1252  
    1253     addModel(subgraph, positionData, modelData); 
     1252        subgraph = osgDB::readNodeFile(filename, _options.get()); 
     1253        if (subgraph) recordOptionsFilePath(_options.get()); 
     1254    } 
     1255     
     1256    if (subgraph) 
     1257    { 
     1258        addModel(subgraph, positionData, modelData); 
     1259    } 
     1260 
     1261    osg::notify(osg::INFO)<<"end of SlideShowConstructor::addModel("<<filename<<")"<<std::endl<<std::endl; 
     1262 
    12541263} 
    12551264 
     
    13151324        subgraph = attachMaterialAnimation(subgraph,positionData); 
    13161325 
    1317  
    13181326    // attached any rotation 
    13191327    if (positionData.rotation[0]!=0.0) 
     
    13251333                                           osg::Vec3(positionData.rotation[1],positionData.rotation[2],positionData.rotation[3]), 
    13261334                                           osg::DegreesToRadians(positionData.rotation[0]))); 
    1327                                             
     1335 
    13281336        animation_transform->addChild(subgraph); 
    1329          
     1337 
    13301338        osg::notify(osg::INFO)<<"Rotation Matrix "<<animation_transform->getMatrix()<<std::endl; 
    13311339 
     
    13391347    { 
    13401348        osg::notify(osg::INFO)<<"Have animation path for model"<<std::endl; 
    1341          
     1349 
    13421350        osg::Vec3 pivot = positionData.absolute_path ? osg::Vec3(0.0f,0.0f,0.0f) : subgraph->getBound().center(); 
    1343                  
     1351 
    13441352        osg::AnimationPath* path = animation->getAnimationPath(); 
    13451353        if (positionData.animation_name=="wheel" && (path->getTimeControlPointMap()).size()>=2) 
     
    14391447    if (fileType == osgDB::DIRECTORY) 
    14401448    { 
    1441        image = osgDB::readImageFile(foundFile+".dicom"); 
     1449       image = osgDB::readImageFile(foundFile+".dicom", _options.get()); 
    14421450    } 
    14431451    else if (fileType == osgDB::REGULAR_FILE) 
    14441452    { 
    1445         image = osgDB::readImageFile( foundFile ); 
     1453        image = osgDB::readImageFile( foundFile, _options.get() ); 
     1454    } 
     1455    else 
     1456    { 
     1457        // not found image, so fallback to plguins/callbacks to find the model. 
     1458        image = osgDB::readImageFile( filename, _options.get() ); 
     1459        if (image) recordOptionsFilePath(_options.get() ); 
    14461460    } 
    14471461 
     
    15621576    if (!positionData.animation_material_filename.empty()) 
    15631577    { 
    1564         std::string absolute_animation_file_path = osgDB::findDataFile(positionData.animation_material_filename); 
     1578#if 0 
     1579        std::string absolute_animation_file_path = osgDB::findDataFile(positionData.animation_material_filename, _options.get()); 
    15651580        if (!absolute_animation_file_path.empty()) 
    15661581        {         
     
    15721587            } 
    15731588        } 
     1589#else 
     1590        osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(positionData.animation_material_filename, _options.get()); 
     1591        animationMaterial = dynamic_cast<ss3d::AnimationMaterial*>(object.get()); 
     1592#endif 
     1593 
    15741594    } 
    15751595    else if (!positionData.fade.empty()) 
     
    16171637} 
    16181638 
    1619 osg::AnimationPath* SlideShowConstructor::readPivotPath(const std::string& filename) const 
    1620 { 
    1621     std::ifstream in(filename.c_str()); 
    1622     if (!in.eof()) 
    1623     { 
    1624         osg::AnimationPath* animation = new osg::AnimationPath; 
    1625  
    1626         while (!in.eof()) 
    1627         { 
    1628             double time; 
    1629             osg::Vec3 pivot; 
    1630             osg::Vec3 position; 
    1631             float scale; 
    1632             osg::Quat rotation; 
    1633             in >> time >> pivot.x() >> pivot.y() >> pivot.z() >> position.x() >> position.y() >> position.z() >> rotation.x() >> rotation.y() >> rotation.z() >> rotation.w() >> scale; 
    1634             if(!in.eof()) 
     1639osg::AnimationPathCallback* SlideShowConstructor::getAnimationPathCallback(const PositionData& positionData) 
     1640{ 
     1641    if (!positionData.path.empty())  
     1642    { 
     1643        osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(positionData.path, _options.get()); 
     1644        osg::AnimationPath* animation = dynamic_cast<osg::AnimationPath*>(object.get()); 
     1645        if (animation) 
     1646        { 
     1647            if (positionData.frame==SlideShowConstructor::SLIDE) 
    16351648            { 
    1636                 osg::Matrix SR = osg::Matrix::scale(scale,scale,scale)* 
    1637                                  osg::Matrixf::rotate(rotation); 
    1638              
    1639                 osg::Matrix invSR; 
    1640                 invSR.invert(SR); 
    1641                  
    1642                 position += (invSR*pivot)*SR; 
    1643              
    1644                 animation->insert(time,osg::AnimationPath::ControlPoint(position,rotation,osg::Vec3(scale,scale,scale))); 
    1645             } 
    1646         } 
    1647          
    1648         return animation; 
    1649     } 
    1650     return 0; 
    1651 } 
    1652  
    1653 struct RotationPathData 
    1654 { 
    1655     RotationPathData(): 
    1656         time(0.0), 
    1657         scale(1.0f), 
    1658         azim(0.0f), 
    1659         elevation(0.0f) {} 
    1660  
    1661     double time; 
    1662     osg::Vec3 pivot; 
    1663     osg::Vec3 position; 
    1664     float scale; 
    1665     float azim; 
    1666     float elevation; 
    1667  
    1668     void addToPath(osg::AnimationPath* animation) const 
    1669     { 
    1670         osg::Quat Rx, Rz, rotation; 
    1671  
    1672         Rx.makeRotate(osg::DegreesToRadians(elevation),1.0f,0.0f,0.0f); 
    1673         Rz.makeRotate(osg::DegreesToRadians(azim),0.0f,0.0f,1.0f); 
    1674         rotation = Rz * Rx; // note, I believe this is the wrong way round, but I had to put it in this order to fix the Quat properly. 
    1675  
    1676         osg::Matrix SR = osg::Matrix::scale(scale,scale,scale)* 
    1677                          osg::Matrixf::rotate(rotation); 
    1678  
    1679         osg::Matrix invSR; 
    1680         invSR.invert(SR); 
    1681  
    1682         osg::Vec3 local_position = position + (invSR*pivot)*SR; 
    1683  
    1684         animation->insert(time,osg::AnimationPath::ControlPoint(local_position,rotation,osg::Vec3(scale,scale,scale))); 
    1685     } 
    1686      
    1687 }; 
    1688 osg::AnimationPath* SlideShowConstructor::readRotationPath(const std::string& filename) const 
    1689 { 
    1690     std::ifstream in(filename.c_str()); 
    1691     if (!in.eof()) 
    1692     { 
    1693         osg::AnimationPath* animation = new osg::AnimationPath; 
    1694  
    1695         RotationPathData prevValue; 
    1696         bool first = true; 
    1697         while (!in.eof()) 
    1698         { 
    1699             RotationPathData currValue; 
    1700             in >> currValue.time >> currValue.pivot.x() >> currValue.pivot.y() >> currValue.pivot.z() >> currValue.position.x() >> currValue.position.y() >> currValue.position.z() >> currValue.azim >> currValue.elevation >> currValue.scale; 
    1701             if(!in.eof()) 
    1702             { 
    1703              
    1704                 if (!first) 
     1649                osg::AnimationPath::TimeControlPointMap& controlPoints = animation->getTimeControlPointMap(); 
     1650                for(osg::AnimationPath::TimeControlPointMap::iterator itr=controlPoints.begin(); 
     1651                    itr!=controlPoints.end(); 
     1652                    ++itr) 
    17051653                { 
    1706              
    1707                     unsigned int num = 20; 
    1708                     float dr = 1.0f/(float)num; 
    1709                     float r=dr; 
    1710                     for(unsigned int i=0; 
    1711                         i<num; 
    1712                         ++i, r+=dr) 
    1713                     { 
    1714                         RotationPathData localValue; 
    1715                         localValue.time = currValue.time *r + prevValue.time * (1.0f-r); 
    1716                         localValue.pivot = currValue.pivot *r + prevValue.pivot * (1.0f-r); 
    1717                         localValue.position = currValue.position *r + prevValue.position * (1.0f-r); 
    1718                         localValue.scale = currValue.scale *r + prevValue.scale * (1.0f-r); 
    1719                         localValue.azim = currValue.azim *r + prevValue.azim * (1.0f-r); 
    1720                         localValue.elevation = currValue.elevation *r + prevValue.elevation * (1.0f-r); 
    1721  
    1722                         localValue.addToPath(animation); 
    1723                     } 
    1724                 } 
    1725                 else 
    1726                 { 
    1727                     currValue.addToPath(animation); 
    1728                 } 
    1729                 prevValue = currValue; 
    1730                 first = false; 
    1731             } 
    1732              
    1733         } 
    1734          
    1735         return animation; 
    1736     } 
    1737     return 0; 
    1738 } 
    1739  
    1740 osg::AnimationPathCallback* SlideShowConstructor::getAnimationPathCallback(const PositionData& positionData) 
    1741 { 
    1742     if (!positionData.path.empty())  
    1743     { 
    1744         std::string absolute_animation_file_path = osgDB::findDataFile(positionData.path); 
    1745         if (!absolute_animation_file_path.empty()) 
    1746         {         
    1747  
    1748             osg::AnimationPath* animation = 0; 
    1749  
    1750             std::string extension = osgDB::getLowerCaseFileExtension(absolute_animation_file_path); 
    1751             if (osgDB::equalCaseInsensitive(extension,"pivot_path")) 
    1752             { 
    1753                 animation = readPivotPath(absolute_animation_file_path); 
    1754             } 
    1755             else if (osgDB::equalCaseInsensitive(extension,"rotation_path")) 
    1756             { 
    1757                 animation = readRotationPath(absolute_animation_file_path); 
    1758             } 
    1759             else if (osgDB::equalCaseInsensitive(extension,"path")) 
    1760             {             
    1761                 std::ifstream animation_filestream(absolute_animation_file_path.c_str()); 
    1762                 if (!animation_filestream.eof()) 
    1763                 { 
    1764                     animation = new osg::AnimationPath; 
    1765                     animation->read(animation_filestream); 
     1654                    osg::AnimationPath::ControlPoint& cp = itr->second; 
     1655                    cp.setPosition(convertSlideToModel(cp.getPosition()+positionData.position)); 
    17661656                } 
    17671657            } 
    1768             else 
    1769             { 
    1770                 std::ifstream animation_filestream(absolute_animation_file_path.c_str()); 
    1771  
    1772                 osgDB::Input fr; 
    1773                 fr.attach(&animation_filestream); 
    1774  
    1775                 static osg::ref_ptr<osg::AnimationPath> s_path = new osg::AnimationPath; 
    1776                 osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(absolute_animation_file_path); // fr.readObjectOfType(*s_path); 
    1777                 object = fr.readObject(); // fr.readObjectOfType(*s_path); 
    1778                 if (object.valid()) 
    1779                 { 
    1780                     animation = dynamic_cast<osg::AnimationPath*>(object.get()); 
    1781                 } 
    1782             } 
    1783              
    1784             if (animation) 
    1785             { 
    1786                 if (positionData.frame==SlideShowConstructor::SLIDE) 
    1787                 { 
    1788                     osg::AnimationPath::TimeControlPointMap& controlPoints = animation->getTimeControlPointMap(); 
    1789                     for(osg::AnimationPath::TimeControlPointMap::iterator itr=controlPoints.begin(); 
    1790                         itr!=controlPoints.end(); 
    1791                         ++itr) 
    1792                     { 
    1793                         osg::AnimationPath::ControlPoint& cp = itr->second; 
    1794                         cp.setPosition(convertSlideToModel(cp.getPosition()+positionData.position)); 
    1795                     } 
    1796                 } 
    1797  
    1798                 animation->setLoopMode(positionData.path_loop_mode); 
    1799  
    1800                 osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(animation); 
    1801                 apc->setTimeOffset(positionData.path_time_offset); 
    1802                 apc->setTimeMultiplier(positionData.path_time_multiplier); 
    1803                 apc->setUseInverseMatrix(positionData.inverse_path); 
    1804                  
    1805                 osg::notify(osg::INFO)<<"UseInverseMatrix "<<positionData.inverse_path<<std::endl; 
    1806  
    1807                 return apc; 
    1808                  
    1809             } 
    1810         } 
     1658 
     1659            animation->setLoopMode(positionData.path_loop_mode); 
     1660 
     1661            osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(animation); 
     1662            apc->setTimeOffset(positionData.path_time_offset); 
     1663            apc->setTimeMultiplier(positionData.path_time_multiplier); 
     1664            apc->setUseInverseMatrix(positionData.inverse_path); 
     1665 
     1666            osg::notify(osg::INFO)<<"UseInverseMatrix "<<positionData.inverse_path<<std::endl; 
     1667 
     1668            return apc; 
     1669 
     1670        } 
     1671 
    18111672    } 
    18121673    return 0; 
    18131674} 
    1814  
    1815  
    18161675 
    18171676osg::Vec3 SlideShowConstructor::computePositionInModelCoords(const PositionData& positionData) const 
     
    18521711    } 
    18531712} 
     1713 
     1714void SlideShowConstructor::recordOptionsFilePath(const osgDB::Options* options) 
     1715{ 
     1716    if (options) 
     1717    { 
     1718        std::string filename_used = _options->getPluginStringData("filename"); 
     1719        std::string path = osgDB::getFilePath(filename_used); 
     1720        if (!path.empty() && _filePathData.valid()) 
     1721        { 
     1722            osgDB::FilePathList::iterator itr = std::find(_filePathData->filePathList.begin(),_filePathData->filePathList.end(),path); 
     1723            if (itr==_filePathData->filePathList.end()) 
     1724            { 
     1725                osg::notify(osg::INFO)<<"SlideShowConstructor::recordOptionsFilePath(..) - new path to record path="<<path<<" filename_used="<<filename_used<<std::endl; 
     1726                _filePathData->filePathList.push_front(path); 
     1727            } 
     1728        } 
     1729    } 
     1730} 
     1731 
  • OpenSceneGraph/trunk/applications/present3D/SlideShowConstructor.h

    r10117 r10207  
    115115    struct PositionData 
    116116    { 
    117         PositionData(): 
     117        PositionData(): 
    118118            frame(SlideShowConstructor::SLIDE), 
    119119            position(0.0f,1.0f,0.0f), 
     
    123123            rotation(0.0f,0.0f,1.0f,0.0f), 
    124124            absolute_path(false), 
    125             inverse_path(false), 
     125            inverse_path(false), 
    126126            path_time_offset(0.0), 
    127127            path_time_multiplier(1.0f), 
     
    156156        } 
    157157 
    158         CoordinateFrame                         frame; 
    159         osg::Vec3                               position; 
    160         osg::Vec3                               scale; 
    161         osg::Vec4                               rotate; 
    162         osg::Vec4                               rotation; 
     158        CoordinateFrame                         frame; 
     159        osg::Vec3                               position; 
     160        osg::Vec3                               scale; 
     161        osg::Vec4                               rotate; 
     162        osg::Vec4                               rotation; 
    163163        std::string                             animation_name; 
    164         bool                                    absolute_path; 
    165         bool                                    inverse_path; 
     164        bool                                    absolute_path; 
     165        bool                                    inverse_path; 
    166166        double                                  path_time_offset; 
    167167        double                                  path_time_multiplier; 
    168168        osg::AnimationPath::LoopMode            path_loop_mode; 
    169         std::string                             path; 
     169        std::string                             path; 
    170170        double                                  animation_material_time_offset; 
    171171        double                                  animation_material_time_multiplier; 
    172172        ss3d::AnimationMaterial::LoopMode       animation_material_loop_mode; 
    173         std::string                             animation_material_filename; 
    174         std::string                             fade; 
     173        std::string                             animation_material_filename; 
     174        std::string                             fade; 
    175175    }; 
    176176 
     
    207207    struct FontData 
    208208    { 
    209         FontData(): 
    210             font("fonts/arial.ttf"), 
    211             layout(osgText::Text::LEFT_TO_RIGHT), 
    212             alignment(osgText::Text::LEFT_BASE_LINE), 
    213             axisAlignment(osgText::Text::XZ_PLANE), 
    214             characterSize(0.04f), 
    215             maximumHeight(1.0f), 
    216             maximumWidth(1.0f), 
    217             color(1.0f,1.0f,1.0f,1.0f) {} 
    218      
    219         std::string                     font; 
    220         osgText::Text::Layout           layout; 
    221         osgText::Text::AlignmentType    alignment; 
    222         osgText::Text::AxisAlignment    axisAlignment; 
    223         float                           characterSize; 
    224         float                           maximumHeight; 
    225         float                           maximumWidth; 
    226         osg::Vec4                       color; 
     209        FontData(): 
     210            font("fonts/arial.ttf"), 
     211            layout(osgText::Text::LEFT_TO_RIGHT), 
     212            alignment(osgText::Text::LEFT_BASE_LINE), 
     213            axisAlignment(osgText::Text::XZ_PLANE), 
     214            characterSize(0.04f), 
     215            maximumHeight(1.0f), 
     216            maximumWidth(1.0f), 
     217            color(1.0f,1.0f,1.0f,1.0f) {} 
     218 
     219        std::string                     font; 
     220        osgText::Text::Layout           layout; 
     221        osgText::Text::AlignmentType    alignment; 
     222        osgText::Text::AxisAlignment    axisAlignment; 
     223        float                           characterSize; 
     224        float                           maximumHeight; 
     225        float                           maximumWidth; 
     226        osg::Vec4                       color; 
    227227    }; 
    228228 
    229229 
    230     SlideShowConstructor(); 
     230    SlideShowConstructor(const osgDB::ReaderWriter::Options* options); 
    231231 
    232232    void createPresentation(); 
     
    347347    osg::Vec3 convertModelToSlide(const osg::Vec3& position) const; 
    348348 
    349     osg::AnimationPath* readPivotPath(const std::string& filename) const; 
    350     osg::AnimationPath* readRotationPath(const std::string& filename) const; 
    351  
    352349    osg::AnimationPathCallback* getAnimationPathCallback(const PositionData& positionData); 
    353350     
     
    361358        return stateset; 
    362359    } 
     360 
     361    osg::ref_ptr<const osgDB::ReaderWriter::Options> _options; 
    363362 
    364363    osg::Vec3   _slideOrigin; 
     
    412411    std::string findFileAndRecordPath(const std::string& filename); 
    413412     
     413    void recordOptionsFilePath(const osgDB::Options* options); 
     414 
    414415}; 
    415416