Added :
osg::PagedLOD::s/getDatabasePath() and support in PagedLOD::traverse().
osgDB::ReaderWriter::Options::s/getDatabasePath()
osgDB::Input::s/getOptions()
setting of osgDB::Input::setOptions() in ReaderWriterOSG.cpp
src/osgPlugins/ive/DataInputStream::s/getOptions()
setting of src/osgPlugins/ive/DataInputStream::setOptions() in ReaderWriterIVE.cpp
This commit is contained in:
@@ -43,6 +43,15 @@ class SG_EXPORT PagedLOD : public LOD
|
||||
|
||||
virtual bool removeChild(Node *child);
|
||||
|
||||
|
||||
|
||||
|
||||
/** Set the database path to prepend to children's filenames.*/
|
||||
void setDatabasePath(const std::string& path);
|
||||
|
||||
/** Get the database path used to prepend to children's filenames.*/
|
||||
inline const std::string& getDatabasePath() const { return _databasePath; }
|
||||
|
||||
|
||||
struct SG_EXPORT PerRangeData
|
||||
{
|
||||
@@ -57,7 +66,7 @@ class SG_EXPORT PagedLOD : public LOD
|
||||
};
|
||||
|
||||
typedef std::vector<PerRangeData> PerRangeDataList;
|
||||
|
||||
|
||||
void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; }
|
||||
const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; }
|
||||
unsigned int getNumFileNames() const { return _perRangeDataList.size(); }
|
||||
@@ -112,6 +121,8 @@ class SG_EXPORT PagedLOD : public LOD
|
||||
|
||||
void expandPerRangeDataTo(unsigned int pos);
|
||||
|
||||
std::string _databasePath;
|
||||
|
||||
int _frameNumberOfLastTraversal;
|
||||
unsigned int _numChildrenThatCannotBeExpired;
|
||||
PerRangeDataList _perRangeDataList;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <osg/StateAttribute>
|
||||
|
||||
#include <osgDB/FieldReaderIterator>
|
||||
#include <osgDB/ReaderWriter>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -35,6 +36,9 @@ class OSGDB_EXPORT Input : public FieldReaderIterator
|
||||
|
||||
Input();
|
||||
virtual ~Input();
|
||||
|
||||
void setOptions(const ReaderWriter::Options* options) { _options = options; }
|
||||
const ReaderWriter::Options* getOptions() const { return _options.get(); }
|
||||
|
||||
virtual osg::Object* readObjectOfType(const osg::Object& compObj);
|
||||
virtual osg::Object* readObjectOfType(const basic_type_wrapper &btw);
|
||||
@@ -56,6 +60,8 @@ class OSGDB_EXPORT Input : public FieldReaderIterator
|
||||
|
||||
typedef std::map< std::string, osg::ref_ptr<osg::Object> > UniqueIDToObjectMapping;
|
||||
UniqueIDToObjectMapping _uniqueIDToObjectMap;
|
||||
|
||||
osg::ref_ptr<const ReaderWriter::Options> _options;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ class OSGDB_EXPORT ReaderWriter : public osg::Referenced
|
||||
virtual const char* className() = 0;
|
||||
virtual bool acceptsExtension(const std::string& /*extension*/) { return false; }
|
||||
|
||||
/** Options base class used for passing options into plugins to control their operation.*/
|
||||
class Options : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
@@ -42,14 +43,24 @@ class OSGDB_EXPORT ReaderWriter : public osg::Referenced
|
||||
Options() {}
|
||||
Options(const std::string& str):_str(str) {}
|
||||
|
||||
/** Set the general Options string.*/
|
||||
void setOptionString(const std::string& str) { _str = str; }
|
||||
|
||||
/** Get the general Options string.*/
|
||||
const std::string& getOptionString() const { return _str; }
|
||||
|
||||
/** Set the database path to use a hint of where to look when loading models.*/
|
||||
void setDatabasePath(const std::string& str) { _databasePath = str; }
|
||||
|
||||
/** Get the database path which is used a hint of where to look when loading models.*/
|
||||
const std::string& getDatabasePath() const { return _databasePath; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Options() {}
|
||||
|
||||
std::string _str;
|
||||
std::string _databasePath;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user