Ran script to remove trailing spaces and tabs
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ class OSGDB_EXPORT Archive : public ReaderWriter
|
||||
{
|
||||
public:
|
||||
Archive();
|
||||
virtual ~Archive();
|
||||
virtual ~Archive();
|
||||
|
||||
virtual const char* libraryName() const { return "osgDB"; }
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@ class AuthenticationDetails : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
/** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/
|
||||
/** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/
|
||||
enum HttpAuthentication
|
||||
{
|
||||
BASIC = 1<<0,
|
||||
@@ -57,21 +57,21 @@ protected:
|
||||
class OSGDB_EXPORT AuthenticationMap : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
AuthenticationMap() {}
|
||||
|
||||
|
||||
|
||||
virtual void addAuthenticationDetails(const std::string& path, AuthenticationDetails* details);
|
||||
|
||||
virtual const AuthenticationDetails* getAuthenticationDetails(const std::string& path) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual ~AuthenticationMap() {}
|
||||
|
||||
|
||||
typedef std::map<std::string, osg::ref_ptr<AuthenticationDetails> > AuthenticationDetailsMap;
|
||||
AuthenticationDetailsMap _authenticationMap;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -90,16 +90,16 @@ class ObjectProperty
|
||||
public:
|
||||
ObjectProperty( const char* name, int value=0, bool useMap=false )
|
||||
: _name(name), _value(value), _mapProperty(useMap) {}
|
||||
|
||||
|
||||
ObjectProperty( const ObjectProperty& copy )
|
||||
: _name(copy._name), _value(copy._value), _mapProperty(copy._mapProperty) {}
|
||||
|
||||
|
||||
ObjectProperty& proto( const char* name )
|
||||
{ _name = name; return *this; }
|
||||
|
||||
|
||||
void set( int v ) { _value = v; }
|
||||
int get() const { return _value; }
|
||||
|
||||
|
||||
std::string _name;
|
||||
int _value;
|
||||
bool _mapProperty;
|
||||
@@ -119,10 +119,10 @@ class ObjectMark
|
||||
public:
|
||||
ObjectMark( const char* name, int delta=0 )
|
||||
: _name(name), _indentDelta(delta) {}
|
||||
|
||||
|
||||
ObjectMark( const ObjectMark& copy )
|
||||
: _name(copy._name), _indentDelta(copy._indentDelta) {}
|
||||
|
||||
|
||||
std::string _name;
|
||||
int _indentDelta;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace osgDB {
|
||||
|
||||
|
||||
|
||||
/** Database paging class which manages the loading of files in a background thread,
|
||||
/** Database paging class which manages the loading of files in a background thread,
|
||||
* and synchronizing of loaded models with the main scene graph.*/
|
||||
class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandler
|
||||
{
|
||||
@@ -63,11 +63,11 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
|
||||
/** get the prototype singleton used by DatabasePager::create().*/
|
||||
static osg::ref_ptr<DatabasePager>& prototype();
|
||||
|
||||
|
||||
/** create a DatabasePager by cloning DatabasePager::prototype().*/
|
||||
static DatabasePager* create();
|
||||
|
||||
|
||||
|
||||
|
||||
/** Add a request to load a node file to end the the database request list.*/
|
||||
virtual void requestNodeFile(const std::string& fileName, osg::NodePath& nodePath,
|
||||
@@ -78,27 +78,27 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
/** Set the priority of the database pager thread(s).*/
|
||||
int setSchedulePriority(OpenThreads::Thread::ThreadPriority priority);
|
||||
|
||||
/** Cancel the database pager thread(s).*/
|
||||
/** Cancel the database pager thread(s).*/
|
||||
virtual int cancel();
|
||||
|
||||
|
||||
virtual bool isRunning() const;
|
||||
|
||||
|
||||
/** Clear all internally cached structures.*/
|
||||
virtual void clear();
|
||||
|
||||
|
||||
class OSGDB_EXPORT DatabaseThread : public osg::Referenced, public OpenThreads::Thread
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
enum Mode
|
||||
{
|
||||
HANDLE_ALL_REQUESTS,
|
||||
HANDLE_NON_HTTP,
|
||||
HANDLE_ONLY_HTTP
|
||||
};
|
||||
|
||||
|
||||
DatabaseThread(DatabasePager* pager, Mode mode, const std::string& name);
|
||||
|
||||
|
||||
DatabaseThread(const DatabaseThread& dt, DatabasePager* pager);
|
||||
|
||||
void setName(const std::string& name) { _name = name; }
|
||||
@@ -106,18 +106,18 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
|
||||
void setDone(bool done) { _done.exchange(done?1:0); }
|
||||
bool getDone() const { return _done!=0; }
|
||||
|
||||
|
||||
void setActive(bool active) { _active = active; }
|
||||
bool getActive() const { return _active; }
|
||||
|
||||
virtual int cancel();
|
||||
|
||||
|
||||
virtual void run();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~DatabaseThread();
|
||||
|
||||
|
||||
OpenThreads::Atomic _done;
|
||||
volatile bool _active;
|
||||
DatabasePager* _pager;
|
||||
@@ -125,42 +125,42 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
std::string _name;
|
||||
|
||||
};
|
||||
|
||||
|
||||
void setUpThreads(unsigned int totalNumThreads=2, unsigned int numHttpThreads=1);
|
||||
|
||||
virtual unsigned int addDatabaseThread(DatabaseThread::Mode mode, const std::string& name);
|
||||
|
||||
DatabaseThread* getDatabaseThread(unsigned int i) { return _databaseThreads[i].get(); }
|
||||
|
||||
|
||||
const DatabaseThread* getDatabaseThread(unsigned int i) const { return _databaseThreads[i].get(); }
|
||||
|
||||
unsigned int getNumDatabaseThreads() const { return _databaseThreads.size(); }
|
||||
|
||||
|
||||
/** Set whether the database pager thread should be paused or not.*/
|
||||
void setDatabasePagerThreadPause(bool pause);
|
||||
|
||||
|
||||
/** Get whether the database pager thread should is paused or not.*/
|
||||
bool getDatabasePagerThreadPause() const { return _databasePagerThreadPaused; }
|
||||
|
||||
|
||||
/** Set whether new database request calls are accepted or ignored.*/
|
||||
void setAcceptNewDatabaseRequests(bool acceptNewRequests) { _acceptNewRequests = acceptNewRequests; }
|
||||
|
||||
|
||||
/** Get whether new database request calls are accepted or ignored.*/
|
||||
bool getAcceptNewDatabaseRequests() const { return _acceptNewRequests; }
|
||||
|
||||
|
||||
/** Get the number of frames that are currently active.*/
|
||||
int getNumFramesActive() const { return _numFramesActive; }
|
||||
|
||||
/** Signal the database thread that the update, cull and draw has begun for a new frame.
|
||||
* Note, this is called by the application so that the database pager can go to sleep while the CPU is busy on the main rendering threads. */
|
||||
virtual void signalBeginFrame(const osg::FrameStamp* framestamp);
|
||||
|
||||
|
||||
/** Signal the database thread that the update, cull and draw dispatch has completed.
|
||||
* Note, this is called by the application so that the database pager can go to wake back up now the main rendering threads are iddle waiting for the next frame.*/
|
||||
virtual void signalEndFrame();
|
||||
|
||||
|
||||
/** Find all PagedLOD nodes in a subgraph and register them with
|
||||
|
||||
/** Find all PagedLOD nodes in a subgraph and register them with
|
||||
* the DatabasePager so it can keep track of expired nodes.
|
||||
* note, should be only be called from the update thread. */
|
||||
virtual void registerPagedLODs(osg::Node* subgraph, unsigned int frameNumber = 0);
|
||||
@@ -197,7 +197,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
|
||||
/** Set whether the removed subgraphs should be deleted in the database thread or not.*/
|
||||
void setDeleteRemovedSubgraphsInDatabaseThread(bool flag) { _deleteRemovedSubgraphsInDatabaseThread = flag; }
|
||||
|
||||
|
||||
/** Get whether the removed subgraphs should be deleted in the database thread or not.*/
|
||||
bool getDeleteRemovedSubgraphsInDatabaseThread() const { return _deleteRemovedSubgraphsInDatabaseThread; }
|
||||
|
||||
@@ -239,7 +239,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
|
||||
/** Return true if there are pending updates to the scene graph that require a call to updateSceneGraph(double). */
|
||||
bool requiresUpdateSceneGraph() const;
|
||||
|
||||
|
||||
/** Merge the changes to the scene graph by calling calling removeExpiredSubgraphs then addLoadedDataToSceneGraph.
|
||||
* Note, must only be called from single thread update phase. */
|
||||
virtual void updateSceneGraph(const osg::FrameStamp& frameStamp);
|
||||
@@ -249,13 +249,13 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
|
||||
/** Report how many items are in the _dataToCompileList queue */
|
||||
unsigned int getDataToCompileListSize() const { return _dataToCompileList->size(); }
|
||||
|
||||
|
||||
/** Report how many items are in the _dataToMergeList queue */
|
||||
unsigned int getDataToMergeListSize() const { return _dataToMergeList->size(); }
|
||||
|
||||
/** Report whether any requests are in the pager.*/
|
||||
bool getRequestsInProgress() const;
|
||||
|
||||
|
||||
/** Get the minimum time between the first request for a tile to be loaded and the time of its merge into the main scene graph.*/
|
||||
double getMinimumTimeToMergeTile() const { return _minimumTimeToMergeTile; }
|
||||
|
||||
@@ -324,7 +324,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
double _timestampLastRequest;
|
||||
float _priorityLastRequest;
|
||||
unsigned int _numOfRequests;
|
||||
|
||||
|
||||
osg::observer_ptr<osg::Node> _terrain;
|
||||
osg::observer_ptr<osg::Group> _group;
|
||||
|
||||
@@ -380,7 +380,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
virtual ~RequestQueue();
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<DatabaseThread> > DatabaseThreadList;
|
||||
|
||||
struct OSGDB_EXPORT ReadQueue : public RequestQueue
|
||||
@@ -415,7 +415,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
struct SortFileRequestFunctor;
|
||||
friend struct SortFileRequestFunctor;
|
||||
|
||||
|
||||
|
||||
OpenThreads::Mutex _run_mutex;
|
||||
OpenThreads::Mutex _dr_mutex;
|
||||
bool _startThreadCalled;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ class OSGDB_EXPORT DotOsgWrapper : public osg::Referenced
|
||||
typedef std::vector<std::string> Associates;
|
||||
typedef bool (*ReadFunc)(osg::Object&,osgDB::Input&);
|
||||
typedef bool (*WriteFunc)(const osg::Object&,osgDB::Output&);
|
||||
|
||||
|
||||
enum ReadWriteMode
|
||||
{
|
||||
READ_AND_WRITE,
|
||||
@@ -47,7 +47,7 @@ class OSGDB_EXPORT DotOsgWrapper : public osg::Referenced
|
||||
ReadFunc readFunc,
|
||||
WriteFunc writeFunc,
|
||||
ReadWriteMode readWriteMode=READ_AND_WRITE);
|
||||
|
||||
|
||||
|
||||
inline const osg::Object* getPrototype() const { return _prototype.get(); }
|
||||
inline const std::string& getName() const { return _name; }
|
||||
@@ -68,10 +68,10 @@ class OSGDB_EXPORT DotOsgWrapper : public osg::Referenced
|
||||
virtual ~DotOsgWrapper() {}
|
||||
|
||||
osg::ref_ptr<osg::Object> _prototype;
|
||||
|
||||
|
||||
std::string _name;
|
||||
Associates _associates;
|
||||
|
||||
|
||||
ReadFunc _readFunc;
|
||||
WriteFunc _writeFunc;
|
||||
|
||||
@@ -168,4 +168,4 @@ class TemplateRegisterDotOsgWrapperProxy : public RegisterDotOsgWrapperProxy, pu
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ class OSGDB_EXPORT DynamicLibrary : public osg::Referenced
|
||||
|
||||
typedef void* HANDLE;
|
||||
typedef void* PROC_ADDRESS;
|
||||
|
||||
|
||||
/** returns a pointer to a DynamicLibrary object on successfully
|
||||
* opening of library returns NULL on failure.
|
||||
*/
|
||||
@@ -60,9 +60,9 @@ class OSGDB_EXPORT DynamicLibrary : public osg::Referenced
|
||||
DynamicLibrary(const DynamicLibrary&):osg::Referenced() {}
|
||||
/** disallow copy operator.*/
|
||||
DynamicLibrary& operator = (const DynamicLibrary&) { return *this; }
|
||||
|
||||
|
||||
/** Disallow public construction so that users have to go
|
||||
* through loadLibrary() above which returns NULL on
|
||||
* through loadLibrary() above which returns NULL on
|
||||
* failure, a valid DynamicLibrary object on success.
|
||||
*/
|
||||
DynamicLibrary(const std::string& name,HANDLE handle);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
\namespace osgDB
|
||||
|
||||
The osgDB library provides support for reading and writing scene graphs, providing a plugin framework and file utility classes.
|
||||
The osgDB library provides support for reading and writing scene graphs, providing a plugin framework and file utility classes.
|
||||
The plugin framework in centered around the osgDB::Registry, and allows plugins which provide specific file format support to be dynamically loaded on demand.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace osgDB {
|
||||
|
||||
class OSGDB_EXPORT FileCache : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
FileCache(const std::string& path);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ extern OSGDB_EXPORT bool makeDirectory( const std::string &directoryPath );
|
||||
|
||||
/** Make a new directory for a given file. */
|
||||
extern OSGDB_EXPORT bool makeDirectoryForFile( const std::string &filePath );
|
||||
|
||||
|
||||
/** Get current working directory. */
|
||||
extern OSGDB_EXPORT std::string getCurrentWorkingDirectory( void );
|
||||
|
||||
@@ -72,10 +72,10 @@ typedef std::vector<std::string> DirectoryContents;
|
||||
extern OSGDB_EXPORT DirectoryContents getDirectoryContents(const std::string& dirName);
|
||||
|
||||
/** Return the list of filenames that match the given filename with wildcards.
|
||||
* Will only expand '*', and will not expand wildcards in directory, only in
|
||||
* filename part of the given filename.
|
||||
* Return value will contain path+filename so that if ever the above
|
||||
* limitation (expanding wildcards in directory) is fixed, client code will
|
||||
* Will only expand '*', and will not expand wildcards in directory, only in
|
||||
* filename part of the given filename.
|
||||
* Return value will contain path+filename so that if ever the above
|
||||
* limitation (expanding wildcards in directory) is fixed, client code will
|
||||
* still work unchanged. */
|
||||
extern OSGDB_EXPORT DirectoryContents expandWildcardsInFilename(const std::string& filename);
|
||||
|
||||
@@ -108,12 +108,12 @@ inline void setDataFilePathList(const std::string& paths) { osgDB::Registry::ins
|
||||
|
||||
inline FilePathList& getDataFilePathList() { return osgDB::Registry::instance()->getDataFilePathList(); }
|
||||
|
||||
/** Search for specified file in file system, checking the DataFilePathList for possible paths,
|
||||
/** Search for specified file in file system, checking the DataFilePathList for possible paths,
|
||||
* returning the full path of the first valid file found, return an empty string if no string is found.
|
||||
*/
|
||||
extern OSGDB_EXPORT std::string findDataFile(const std::string& filename,CaseSensitivity caseSensitivity=CASE_SENSITIVE);
|
||||
|
||||
/** Search for specified file in file system, checking first the database path set in the Options structure, then the DataFilePathList for possible paths,
|
||||
/** Search for specified file in file system, checking first the database path set in the Options structure, then the DataFilePathList for possible paths,
|
||||
* returning the full path of the first valid file found, return an empty string if no string is found.
|
||||
*/
|
||||
extern OSGDB_EXPORT std::string findDataFile(const std::string& filename,const Options* options, CaseSensitivity caseSensitivity=CASE_SENSITIVE);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace osgDB {
|
||||
class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
ImageOptions();
|
||||
|
||||
|
||||
ImageOptions(const std::string& str);
|
||||
|
||||
|
||||
ImageOptions(const ImageOptions& options,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
||||
osgDB::Options(options,copyop),
|
||||
_sourceImageSamplingMode(options._sourceImageSamplingMode),
|
||||
@@ -38,7 +38,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
_destinationPixelWindow(options._destinationPixelWindow),
|
||||
_destinationDataType(options._destinationDataType),
|
||||
_destinationPixelFormat(options._destinationPixelFormat) {}
|
||||
|
||||
|
||||
|
||||
META_Object(osgDB,ImageOptions);
|
||||
|
||||
@@ -58,13 +58,13 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
windowWidth = w;
|
||||
windowHeight = h;
|
||||
}
|
||||
|
||||
|
||||
double windowX;
|
||||
double windowY;
|
||||
double windowWidth;
|
||||
double windowHeight;
|
||||
};
|
||||
|
||||
|
||||
/** PixelWindow stores the window (in exact pixels) from the overall imagery from which to extract the osg::Image*/
|
||||
struct PixelWindow
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
windowY(0),
|
||||
windowWidth(0),
|
||||
windowHeight(0) {}
|
||||
|
||||
|
||||
void set(unsigned int x, unsigned int y, unsigned int w, unsigned int h)
|
||||
{
|
||||
windowX = x;
|
||||
@@ -81,20 +81,20 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
windowWidth = w;
|
||||
windowHeight = h;
|
||||
}
|
||||
|
||||
|
||||
unsigned int windowX;
|
||||
unsigned int windowY;
|
||||
unsigned int windowWidth;
|
||||
unsigned int windowHeight;
|
||||
};
|
||||
|
||||
|
||||
enum ImageWindowMode
|
||||
{
|
||||
ALL_IMAGE,
|
||||
RATIO_WINDOW,
|
||||
PIXEL_WINDOW
|
||||
};
|
||||
|
||||
|
||||
enum ImageSamplingMode
|
||||
{
|
||||
NEAREST,
|
||||
@@ -110,7 +110,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
_y(0.0),
|
||||
_w(1.0),
|
||||
_h(1.0) {}
|
||||
|
||||
|
||||
void set(double x,double y, double w, double h)
|
||||
{
|
||||
_x = x;
|
||||
@@ -118,12 +118,12 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
_w = w;
|
||||
_h = h;
|
||||
}
|
||||
|
||||
|
||||
double _x,_y,_w,_h;
|
||||
};
|
||||
|
||||
|
||||
// source
|
||||
// source
|
||||
ImageSamplingMode _sourceImageSamplingMode;
|
||||
ImageWindowMode _sourceImageWindowMode;
|
||||
RatioWindow _sourceRatioWindow;
|
||||
@@ -131,7 +131,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
|
||||
// destination
|
||||
osg::ref_ptr<osg::Image> _destinationImage;
|
||||
|
||||
|
||||
ImageWindowMode _destinationImageWindowMode;
|
||||
RatioWindow _destinationRatioWindow;
|
||||
PixelWindow _destinationPixelWindow;
|
||||
@@ -140,7 +140,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options
|
||||
GLenum _destinationPixelFormat;
|
||||
|
||||
void init();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -31,35 +31,35 @@ namespace osgDB
|
||||
class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
ImagePager();
|
||||
|
||||
|
||||
class OSGDB_EXPORT ImageThread : public osg::Referenced, public OpenThreads::Thread
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
enum Mode
|
||||
{
|
||||
HANDLE_ALL_REQUESTS,
|
||||
HANDLE_NON_HTTP,
|
||||
HANDLE_ONLY_HTTP
|
||||
};
|
||||
|
||||
|
||||
ImageThread(ImagePager* pager, Mode mode, const std::string& name);
|
||||
|
||||
|
||||
ImageThread(const ImageThread& dt, ImagePager* pager);
|
||||
|
||||
|
||||
void setDone(bool done) { _done = done; }
|
||||
bool getDone() const { return _done; }
|
||||
|
||||
virtual int cancel();
|
||||
|
||||
|
||||
virtual void run();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ImageThread();
|
||||
|
||||
|
||||
bool _done;
|
||||
Mode _mode;
|
||||
ImagePager* _pager;
|
||||
@@ -68,11 +68,11 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler
|
||||
|
||||
|
||||
ImageThread* getImageThread(unsigned int i) { return _imageThreads[i].get(); }
|
||||
|
||||
|
||||
const ImageThread* getImageThread(unsigned int i) const { return _imageThreads[i].get(); }
|
||||
|
||||
unsigned int getNumImageThreads() const { return _imageThreads.size(); }
|
||||
|
||||
|
||||
|
||||
void setPreLoadTime(double preLoadTime) { _preLoadTime=preLoadTime; }
|
||||
virtual double getPreLoadTime() const { return _preLoadTime; }
|
||||
@@ -84,28 +84,28 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler
|
||||
|
||||
/** Return true if there are pending updates to the scene graph that require a call to updateSceneGraph(double). */
|
||||
virtual bool requiresUpdateSceneGraph() const;
|
||||
|
||||
|
||||
/** Merge the changes to the scene graph. */
|
||||
virtual void updateSceneGraph(const osg::FrameStamp &frameStamp);
|
||||
|
||||
|
||||
int cancel();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual ~ImagePager();
|
||||
// forward declare
|
||||
// forward declare
|
||||
struct RequestQueue;
|
||||
|
||||
|
||||
struct SortFileRequestFunctor;
|
||||
friend struct SortFileRequestFunctor;
|
||||
|
||||
|
||||
struct ImageRequest : public osg::Referenced
|
||||
{
|
||||
ImageRequest():
|
||||
osg::Referenced(true),
|
||||
_timeToMergeBy(0.0),
|
||||
_attachmentIndex(-1) {}
|
||||
|
||||
|
||||
double _timeToMergeBy;
|
||||
std::string _fileName;
|
||||
osg::ref_ptr<Options> _loadOptions;
|
||||
@@ -113,58 +113,58 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler
|
||||
int _attachmentIndex;
|
||||
osg::ref_ptr<osg::Image> _loadedImage;
|
||||
RequestQueue* _requestQueue;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct RequestQueue : public osg::Referenced
|
||||
{
|
||||
typedef std::vector< osg::ref_ptr<ImageRequest> > RequestList;
|
||||
|
||||
void sort();
|
||||
|
||||
|
||||
RequestList _requestList;
|
||||
OpenThreads::Mutex _requestMutex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct ReadQueue : public RequestQueue
|
||||
{
|
||||
ReadQueue(ImagePager* pager, const std::string& name);
|
||||
|
||||
|
||||
void block() { _block->block(); }
|
||||
|
||||
|
||||
void release() { _block->release(); }
|
||||
|
||||
|
||||
void updateBlock()
|
||||
{
|
||||
_block->set((!_requestList.empty() || !_pager->_databasePagerThreadPaused));
|
||||
}
|
||||
|
||||
|
||||
void clear();
|
||||
|
||||
|
||||
void add(ImageRequest* imageRequest);
|
||||
|
||||
|
||||
void takeFirst(osg::ref_ptr<ImageRequest>& databaseRequest);
|
||||
|
||||
|
||||
osg::ref_ptr<osg::RefBlock> _block;
|
||||
|
||||
|
||||
ImagePager* _pager;
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
|
||||
OpenThreads::Mutex _run_mutex;
|
||||
bool _startThreadCalled;
|
||||
|
||||
bool _done;
|
||||
bool _databasePagerThreadPaused;
|
||||
|
||||
|
||||
osg::ref_ptr<ReadQueue> _readQueue;
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<ImageThread> > ImageThreads;
|
||||
ImageThreads _imageThreads;
|
||||
|
||||
|
||||
osg::ref_ptr<RequestQueue> _completedQueue;
|
||||
|
||||
|
||||
double _preLoadTime;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -248,7 +248,7 @@ class OSGDB_EXPORT Input : public FieldReaderIterator
|
||||
|
||||
Input();
|
||||
virtual ~Input();
|
||||
|
||||
|
||||
void setOptions(const Options* options) { _options = options; }
|
||||
const Options* getOptions() const { return _options.get(); }
|
||||
|
||||
@@ -267,7 +267,7 @@ class OSGDB_EXPORT Input : public FieldReaderIterator
|
||||
virtual osg::Image* readImage(const std::string& fileName);
|
||||
virtual osg::Node* readNode(const std::string& fileName);
|
||||
virtual osg::Shader* readShader(const std::string& fileName);
|
||||
|
||||
|
||||
virtual osg::Object* getObjectForUniqueID(const std::string& uniqueID);
|
||||
virtual void registerUniqueIDForObject(const std::string& uniqueID,osg::Object* obj);
|
||||
|
||||
@@ -293,10 +293,10 @@ class OSGDB_EXPORT Input : public FieldReaderIterator
|
||||
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
typedef std::map< std::string, osg::ref_ptr<osg::Object> > UniqueIDToObjectMapping;
|
||||
UniqueIDToObjectMapping _uniqueIDToObjectMap;
|
||||
|
||||
|
||||
osg::ref_ptr<const Options> _options;
|
||||
|
||||
};
|
||||
|
||||
@@ -43,10 +43,10 @@ public:
|
||||
_field += " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const std::string& getField() const { return _field; }
|
||||
const std::string& getError() const { return _error; }
|
||||
|
||||
|
||||
protected:
|
||||
std::string _field;
|
||||
std::string _error;
|
||||
@@ -57,7 +57,7 @@ class OSGDB_EXPORT InputStream
|
||||
public:
|
||||
typedef std::map< unsigned int, osg::ref_ptr<osg::Array> > ArrayMap;
|
||||
typedef std::map< unsigned int, osg::ref_ptr<osg::Object> > IdentifierMap;
|
||||
|
||||
|
||||
enum ReadType
|
||||
{
|
||||
READ_UNKNOWN = 0,
|
||||
@@ -65,14 +65,14 @@ public:
|
||||
READ_IMAGE,
|
||||
READ_OBJECT
|
||||
};
|
||||
|
||||
|
||||
InputStream( const osgDB::Options* options );
|
||||
virtual ~InputStream();
|
||||
|
||||
|
||||
bool isBinary() const { return _in->isBinary(); }
|
||||
int getFileVersion() const { return _fileVersion; }
|
||||
const osgDB::Options* getOptions() const { return _options.get(); }
|
||||
|
||||
|
||||
// Serialization related functions
|
||||
InputStream& operator>>( bool& b ) { _in->readBool(b); checkStream(); return *this; }
|
||||
InputStream& operator>>( char& c ) { _in->readChar(c); checkStream(); return *this; }
|
||||
@@ -89,11 +89,11 @@ public:
|
||||
InputStream& operator>>( std::string& s ) { _in->readString(s); checkStream(); return *this; }
|
||||
InputStream& operator>>( std::istream& (*fn)(std::istream&) ) { _in->readStream(fn); checkStream(); return *this; }
|
||||
InputStream& operator>>( std::ios_base& (*fn)(std::ios_base&) ) { _in->readBase(fn); checkStream(); return *this; }
|
||||
|
||||
|
||||
InputStream& operator>>( ObjectGLenum& value ) { _in->readGLenum(value); checkStream(); return *this; }
|
||||
InputStream& operator>>( ObjectProperty& prop ) { _in->readProperty(prop); checkStream(); return *this; }
|
||||
InputStream& operator>>( ObjectMark& mark ) { _in->readMark(mark); checkStream(); return *this; }
|
||||
|
||||
|
||||
InputStream& operator>>( osg::Vec2b& v );
|
||||
InputStream& operator>>( osg::Vec3b& v );
|
||||
InputStream& operator>>( osg::Vec4b& v );
|
||||
@@ -111,19 +111,19 @@ public:
|
||||
InputStream& operator>>( osg::Plane& p );
|
||||
InputStream& operator>>( osg::Matrixf& mat );
|
||||
InputStream& operator>>( osg::Matrixd& mat );
|
||||
|
||||
|
||||
InputStream& operator>>( osg::Array*& a ) { a = readArray(); return *this; }
|
||||
InputStream& operator>>( osg::Image*& img ) { img = readImage(); return *this; }
|
||||
InputStream& operator>>( osg::PrimitiveSet*& p ) { p = readPrimitiveSet(); return *this; }
|
||||
InputStream& operator>>( osg::Object*& obj ) { obj = readObject(); return *this; }
|
||||
|
||||
|
||||
InputStream& operator>>( osg::ref_ptr<osg::Array>& ptr ) { ptr = readArray(); return *this; }
|
||||
InputStream& operator>>( osg::ref_ptr<osg::Image>& ptr ) { ptr = readImage(); return *this; }
|
||||
InputStream& operator>>( osg::ref_ptr<osg::PrimitiveSet>& ptr ) { ptr = readPrimitiveSet(); return *this; }
|
||||
|
||||
|
||||
template<typename T> InputStream& operator>>( osg::ref_ptr<T>& ptr )
|
||||
{ ptr = static_cast<T*>(readObject()); return *this; }
|
||||
|
||||
|
||||
// Convenient methods for reading
|
||||
bool matchString( const std::string& str ) { return _in->matchString(str); }
|
||||
void advanceToCurrentEndBracket() { _in->advanceToCurrentEndBracket(); }
|
||||
@@ -148,25 +148,25 @@ public:
|
||||
ReadType start( InputIterator* );
|
||||
|
||||
void decompress();
|
||||
|
||||
|
||||
// Schema handlers
|
||||
void readSchema( std::istream& fin );
|
||||
void resetSchema();
|
||||
|
||||
|
||||
// Exception handlers
|
||||
inline void throwException( const std::string& msg );
|
||||
const InputException* getException() const { return _exception.get(); }
|
||||
|
||||
|
||||
protected:
|
||||
inline void checkStream();
|
||||
void setWrapperSchema( const std::string& name, const std::string& properties );
|
||||
|
||||
|
||||
template<typename T>
|
||||
void readArrayImplementation( T* a, unsigned int numComponentsPerElements, unsigned int componentSizeInBytes );
|
||||
|
||||
|
||||
ArrayMap _arrayMap;
|
||||
IdentifierMap _identifierMap;
|
||||
|
||||
|
||||
int _fileVersion;
|
||||
bool _useSchemaData;
|
||||
bool _forceReadingImage;
|
||||
|
||||
@@ -47,11 +47,11 @@ class OSGDB_EXPORT ObjectWrapper : public osg::Referenced
|
||||
public:
|
||||
typedef std::vector< osg::ref_ptr<BaseSerializer> > SerializerList;
|
||||
typedef std::vector< osg::ref_ptr<FinishedObjectReadCallback> > FinishedObjectReadCallbackList;
|
||||
|
||||
|
||||
ObjectWrapper( osg::Object* proto, const std::string& name,
|
||||
const std::string& associates );
|
||||
void setUpdatedVersion( int ver ) { _version = ver; }
|
||||
|
||||
|
||||
const osg::Object* getProto() const { return _proto.get(); }
|
||||
const std::string& getName() const { return _name; }
|
||||
const StringList& getAssociates() const { return _associates; }
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
void writeSchema( StringList& properties, std::vector<int>& types );
|
||||
void resetSchema()
|
||||
{ if ( _backupSerializers.size()>0 ) _serializers = _backupSerializers; }
|
||||
|
||||
|
||||
protected:
|
||||
ObjectWrapper() : _version(0) {}
|
||||
virtual ~ObjectWrapper() {}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -173,7 +173,7 @@ class OSGDB_EXPORT Options : public osg::Object
|
||||
|
||||
/** Remove a value from the PluginData */
|
||||
void removePluginData(const std::string& s) const { _pluginData.erase(s); }
|
||||
|
||||
|
||||
/** Get number of PluginData values */
|
||||
unsigned int getNumPluginData() const { return _pluginData.size(); }
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -31,10 +31,10 @@ class OSGDB_EXPORT Output : public osgDB::ofstream
|
||||
|
||||
Output();
|
||||
Output(const char* name);
|
||||
|
||||
|
||||
virtual ~Output();
|
||||
|
||||
|
||||
|
||||
void setOptions(const Options* options);
|
||||
const Options* getOptions() const { return _options.get(); }
|
||||
|
||||
@@ -42,7 +42,7 @@ class OSGDB_EXPORT Output : public osgDB::ofstream
|
||||
bool getWriteOutDefaultValues() const { return _writeOutDefaultValues; }
|
||||
|
||||
void open(const char *name);
|
||||
|
||||
|
||||
// comment out temporarily to avoid compilation problems, RO Jan 2002.
|
||||
// void open(const char *name,int mode);
|
||||
|
||||
@@ -65,7 +65,7 @@ class OSGDB_EXPORT Output : public osgDB::ofstream
|
||||
|
||||
void moveIn();
|
||||
void moveOut();
|
||||
|
||||
|
||||
virtual bool writeObject(const osg::Object& obj);
|
||||
virtual void writeBeginObject(const std::string& name);
|
||||
virtual void writeEndObject();
|
||||
@@ -83,7 +83,7 @@ class OSGDB_EXPORT Output : public osgDB::ofstream
|
||||
RELATIVE_PATH,
|
||||
FILENAME_ONLY
|
||||
};
|
||||
|
||||
|
||||
inline void setPathNameHint(const PathNameHint pnh) { _pathNameHint = pnh; }
|
||||
inline PathNameHint getPathNameHint() const { return _pathNameHint; }
|
||||
|
||||
@@ -114,14 +114,14 @@ class OSGDB_EXPORT Output : public osgDB::ofstream
|
||||
|
||||
int _indent;
|
||||
int _indentStep;
|
||||
|
||||
|
||||
int _numIndicesPerLine;
|
||||
|
||||
typedef std::map<const osg::Object*,std::string> UniqueIDToLabelMapping;
|
||||
UniqueIDToLabelMapping _objectToUniqueIDMap;
|
||||
|
||||
|
||||
std::string _filename;
|
||||
|
||||
|
||||
PathNameHint _pathNameHint;
|
||||
|
||||
bool _outputTextureFiles;
|
||||
|
||||
@@ -41,10 +41,10 @@ public:
|
||||
_field += " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const std::string& getField() const { return _field; }
|
||||
const std::string& getError() const { return _error; }
|
||||
|
||||
|
||||
protected:
|
||||
std::string _field;
|
||||
std::string _error;
|
||||
@@ -55,7 +55,7 @@ class OSGDB_EXPORT OutputStream
|
||||
public:
|
||||
typedef std::map<const osg::Array*, unsigned int> ArrayMap;
|
||||
typedef std::map<const osg::Object*, unsigned int> ObjectMap;
|
||||
|
||||
|
||||
enum WriteType
|
||||
{
|
||||
WRITE_UNKNOWN = 0,
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
WRITE_IMAGE,
|
||||
WRITE_OBJECT
|
||||
};
|
||||
|
||||
|
||||
enum WriteImageHint
|
||||
{
|
||||
WRITE_USE_IMAGE_HINT = 0, /*!< Use image hint, write inline data or use external */
|
||||
@@ -72,17 +72,17 @@ public:
|
||||
WRITE_INLINE_FILE, /*!< Write the image file itself to stream */
|
||||
WRITE_EXTERNAL_FILE /*!< Write Image::data() to disk and use it as external file */
|
||||
};
|
||||
|
||||
|
||||
OutputStream( const osgDB::Options* options );
|
||||
virtual ~OutputStream();
|
||||
|
||||
|
||||
bool isBinary() const { return _out->isBinary(); }
|
||||
const std::string& getSchemaName() const { return _schemaName; }
|
||||
const osgDB::Options* getOptions() const { return _options.get(); }
|
||||
|
||||
|
||||
void setWriteImageHint( WriteImageHint hint ) { _writeImageHint = hint; }
|
||||
WriteImageHint getWriteImageHint() const { return _writeImageHint; }
|
||||
|
||||
|
||||
// Serialization related functions
|
||||
OutputStream& operator<<( bool b ) { _out->writeBool(b); return *this; }
|
||||
OutputStream& operator<<( char c ) { _out->writeChar(c); return *this; }
|
||||
@@ -99,11 +99,11 @@ public:
|
||||
OutputStream& operator<<( const char* s ) { _out->writeString(s); return *this; }
|
||||
OutputStream& operator<<( std::ostream& (*fn)(std::ostream&) ) { _out->writeStream(fn); return *this; }
|
||||
OutputStream& operator<<( std::ios_base& (*fn)(std::ios_base&) ) { _out->writeBase(fn); return *this; }
|
||||
|
||||
|
||||
OutputStream& operator<<( const ObjectGLenum& value ) { _out->writeGLenum(value); return *this; }
|
||||
OutputStream& operator<<( const ObjectProperty& prop ) { _out->writeProperty(prop); return *this; }
|
||||
OutputStream& operator<<( const ObjectMark& mark ) { _out->writeMark(mark); return *this; }
|
||||
|
||||
|
||||
OutputStream& operator<<( const osg::Vec2b& v );
|
||||
OutputStream& operator<<( const osg::Vec3b& v );
|
||||
OutputStream& operator<<( const osg::Vec4b& v );
|
||||
@@ -121,19 +121,19 @@ public:
|
||||
OutputStream& operator<<( const osg::Plane& p );
|
||||
OutputStream& operator<<( const osg::Matrixf& mat );
|
||||
OutputStream& operator<<( const osg::Matrixd& mat );
|
||||
|
||||
|
||||
OutputStream& operator<<( const osg::Array* a ) { writeArray(a); return *this; }
|
||||
OutputStream& operator<<( const osg::Image* img ) { writeImage(img); return *this; }
|
||||
OutputStream& operator<<( const osg::PrimitiveSet* p ) { writePrimitiveSet(p); return *this; }
|
||||
OutputStream& operator<<( const osg::Object* obj ) { writeObject(obj); return *this; }
|
||||
|
||||
|
||||
OutputStream& operator<<( const osg::ref_ptr<osg::Array>& ptr ) { writeArray(ptr.get()); return *this; }
|
||||
OutputStream& operator<<( const osg::ref_ptr<osg::Image>& ptr ) { writeImage(ptr.get()); return *this; }
|
||||
OutputStream& operator<<( const osg::ref_ptr<osg::PrimitiveSet>& ptr ) { writePrimitiveSet(ptr.get()); return *this; }
|
||||
|
||||
|
||||
template<typename T> OutputStream& operator<<( const osg::ref_ptr<T>& ptr )
|
||||
{ writeObject(ptr.get()); return *this; }
|
||||
|
||||
|
||||
// Convenient methods for writing
|
||||
void writeWrappedString( const std::string& str ) { _out->writeWrappedString(str); }
|
||||
void writeCharArray( const char* s, unsigned int size ) { _out->writeCharArray(s, size); }
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
void writeImage( const osg::Image* img );
|
||||
void writeObject( const osg::Object* obj );
|
||||
void writeObjectFields( const osg::Object* obj );
|
||||
|
||||
|
||||
/// set an output iterator, used directly when not using OutputStream with a traditional file releated stream.
|
||||
void setOutputIterator( OutputIterator* oi ) { _out = oi; }
|
||||
|
||||
@@ -156,24 +156,24 @@ public:
|
||||
void start( OutputIterator* outIterator, WriteType type );
|
||||
|
||||
void compress( std::ostream* ostream );
|
||||
|
||||
|
||||
// Schema handlers
|
||||
void writeSchema( std::ostream& fout );
|
||||
|
||||
|
||||
// Exception handlers
|
||||
inline void throwException( const std::string& msg );
|
||||
const OutputException* getException() const { return _exception.get(); }
|
||||
|
||||
|
||||
protected:
|
||||
template<typename T>
|
||||
void writeArrayImplementation( const T*, int write_size, unsigned int numInRow=1 );
|
||||
|
||||
|
||||
unsigned int findOrCreateArrayID( const osg::Array* array, bool& newID );
|
||||
unsigned int findOrCreateObjectID( const osg::Object* obj, bool& newID );
|
||||
|
||||
|
||||
ArrayMap _arrayMap;
|
||||
ObjectMap _objectMap;
|
||||
|
||||
|
||||
WriteImageHint _writeImageHint;
|
||||
bool _useSchemaData;
|
||||
std::map<std::string, std::string> _inbuiltSchemaMap;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace osgDB {
|
||||
class ParameterOutput
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
ParameterOutput(Output& fw):
|
||||
_fw(fw),
|
||||
_numItemsPerLine(fw.getNumIndicesPerLine()),
|
||||
_column(0) {}
|
||||
|
||||
|
||||
ParameterOutput(Output& fw,int numItemsPerLine):
|
||||
_fw(fw),
|
||||
_numItemsPerLine(numItemsPerLine),
|
||||
@@ -51,14 +51,14 @@ class ParameterOutput
|
||||
_fw.indent() << "}"<<std::endl;
|
||||
_column = 0;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void write(const T& t)
|
||||
{
|
||||
if (_column==0) _fw.indent();
|
||||
|
||||
_fw << t;
|
||||
|
||||
|
||||
++_column;
|
||||
if (_column==_numItemsPerLine)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class ParameterOutput
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class Iterator>
|
||||
void write(Iterator first, Iterator last)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ class ParameterOutput
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class Iterator>
|
||||
void writeAsInts(Iterator first, Iterator last)
|
||||
{
|
||||
@@ -95,10 +95,10 @@ class ParameterOutput
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
ParameterOutput& operator = (const ParameterOutput&) { return *this; }
|
||||
|
||||
Output& _fw;
|
||||
@@ -116,15 +116,15 @@ void writeArray(Output& fw, Iterator first, Iterator last,int noItemsPerLine=0)
|
||||
fw.moveIn();
|
||||
|
||||
int column=0;
|
||||
|
||||
|
||||
for(Iterator itr=first;
|
||||
itr!=last;
|
||||
++itr)
|
||||
{
|
||||
if (column==0) fw.indent();
|
||||
|
||||
|
||||
fw << *itr;
|
||||
|
||||
|
||||
++column;
|
||||
if (column==noItemsPerLine)
|
||||
{
|
||||
@@ -137,10 +137,10 @@ void writeArray(Output& fw, Iterator first, Iterator last,int noItemsPerLine=0)
|
||||
}
|
||||
}
|
||||
if (column!=0) fw << std::endl;
|
||||
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -153,15 +153,15 @@ void writeArrayAsInts(Output& fw, Iterator first, Iterator last,int noItemsPerLi
|
||||
fw.moveIn();
|
||||
|
||||
int column=0;
|
||||
|
||||
|
||||
for(Iterator itr=first;
|
||||
itr!=last;
|
||||
++itr)
|
||||
{
|
||||
if (column==0) fw.indent();
|
||||
|
||||
|
||||
fw << (int)*itr;
|
||||
|
||||
|
||||
++column;
|
||||
if (column==noItemsPerLine)
|
||||
{
|
||||
@@ -174,10 +174,10 @@ void writeArrayAsInts(Output& fw, Iterator first, Iterator last,int noItemsPerLi
|
||||
}
|
||||
}
|
||||
if (column!=0) fw << std::endl;
|
||||
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
*
|
||||
* This application is open source and may be redistributed and/or modified
|
||||
* This application is open source and may be redistributed and/or modified
|
||||
* freely and without restriction, both in commercial and non commercial applications,
|
||||
* as long as this copyright notice is maintained.
|
||||
*
|
||||
*
|
||||
* This application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
@@ -31,9 +31,9 @@ FileNameList OSGDB_EXPORT listAllAvailablePlugins();
|
||||
class ReaderWriterInfo : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
ReaderWriterInfo() {}
|
||||
|
||||
|
||||
std::string plugin;
|
||||
std::string description;
|
||||
ReaderWriter::FormatDescriptionMap protocols;
|
||||
@@ -42,7 +42,7 @@ class ReaderWriterInfo : public osg::Referenced
|
||||
ReaderWriter::Features features;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual ~ReaderWriterInfo() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
namespace osgDB {
|
||||
|
||||
|
||||
/** Read an osg::Object from file.
|
||||
/** Read an osg::Object from file.
|
||||
* Return valid osg::Object on success,
|
||||
* return NULL on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -35,7 +35,7 @@ namespace osgDB {
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::Object* readObjectFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Object from file.
|
||||
/** Read an osg::Object from file.
|
||||
* Return valid osg::Object on success,
|
||||
* return NULL on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -46,7 +46,7 @@ inline osg::Object* readObjectFile(const std::string& filename)
|
||||
return readObjectFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Image from file.
|
||||
/** Read an osg::Image from file.
|
||||
* Return valid osg::Image on success,
|
||||
* return NULL on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -55,7 +55,7 @@ inline osg::Object* readObjectFile(const std::string& filename)
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::Image* readImageFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Image from file.
|
||||
/** Read an osg::Image from file.
|
||||
* Return valid osg::Image on success,
|
||||
* return NULL on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -66,7 +66,7 @@ inline osg::Image* readImageFile(const std::string& filename)
|
||||
return readImageFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::HeightField from file.
|
||||
/** Read an osg::HeightField from file.
|
||||
* Return valid osg::HeightField on success,
|
||||
* return NULL on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -75,7 +75,7 @@ inline osg::Image* readImageFile(const std::string& filename)
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::HeightField* readHeightFieldFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::HeightField from file.
|
||||
/** Read an osg::HeightField from file.
|
||||
* Return valid osg::HeightField on success,
|
||||
* return NULL on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -86,7 +86,7 @@ inline osg::HeightField* readHeightFieldFile(const std::string& filename)
|
||||
return readHeightFieldFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Node from file.
|
||||
/** Read an osg::Node from file.
|
||||
* Return valid osg::Node on success,
|
||||
* return NULL on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -95,7 +95,7 @@ inline osg::HeightField* readHeightFieldFile(const std::string& filename)
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::Node* readNodeFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Node from file.
|
||||
/** Read an osg::Node from file.
|
||||
* Return valid osg::Node on success,
|
||||
* return NULL on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -133,7 +133,7 @@ inline osg::Node* readNodeFiles(osg::ArgumentParser& parser)
|
||||
return readNodeFiles(parser,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Shader from file.
|
||||
/** Read an osg::Shader from file.
|
||||
* Return valid osg::Shader on success,
|
||||
* return NULL on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -142,7 +142,7 @@ inline osg::Node* readNodeFiles(osg::ArgumentParser& parser)
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::Shader* readShaderFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Shader from file.
|
||||
/** Read an osg::Shader from file.
|
||||
* Return valid osg::Shader on success,
|
||||
* return NULL on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -153,7 +153,7 @@ inline osg::Shader* readShaderFile(const std::string& filename)
|
||||
return readShaderFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Shader from file and set to specified shader type.
|
||||
/** Read an osg::Shader from file and set to specified shader type.
|
||||
* Return valid osg::Shader on success,
|
||||
* return NULL on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -167,7 +167,7 @@ inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& fi
|
||||
return shader;
|
||||
}
|
||||
|
||||
/** Read an osg::Shader from file and set to specified shader type
|
||||
/** Read an osg::Shader from file and set to specified shader type
|
||||
* Return valid osg::Shader on success,
|
||||
* return NULL on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -178,7 +178,7 @@ inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& fi
|
||||
return readShaderFile(type, filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Object from file.
|
||||
/** Read an osg::Object from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -187,7 +187,7 @@ inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& fi
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::ref_ptr<osg::Object> readRefObjectFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Object from file.
|
||||
/** Read an osg::Object from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -198,7 +198,7 @@ inline osg::ref_ptr<osg::Object> readRefObjectFile(const std::string& filename)
|
||||
return readRefObjectFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Image from file.
|
||||
/** Read an osg::Image from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -207,7 +207,7 @@ inline osg::ref_ptr<osg::Object> readRefObjectFile(const std::string& filename)
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::ref_ptr<osg::Image> readRefImageFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Image from file.
|
||||
/** Read an osg::Image from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -218,7 +218,7 @@ inline osg::ref_ptr<osg::Image> readRefImageFile(const std::string& filename)
|
||||
return readRefImageFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::HeightField from file.
|
||||
/** Read an osg::HeightField from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -227,7 +227,7 @@ inline osg::ref_ptr<osg::Image> readRefImageFile(const std::string& filename)
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::ref_ptr<osg::HeightField> readRefHeightFieldFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::HeightField from file.
|
||||
/** Read an osg::HeightField from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -238,7 +238,7 @@ inline osg::ref_ptr<osg::HeightField> readRefHeightFieldFile(const std::string&
|
||||
return readRefHeightFieldFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Node from file.
|
||||
/** Read an osg::Node from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -247,7 +247,7 @@ inline osg::ref_ptr<osg::HeightField> readRefHeightFieldFile(const std::string&
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::ref_ptr<osg::Node> readRefNodeFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Node from file.
|
||||
/** Read an osg::Node from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -258,7 +258,7 @@ inline osg::ref_ptr<osg::Node> readRefNodeFile(const std::string& filename)
|
||||
return readRefNodeFile(filename,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Shader from file.
|
||||
/** Read an osg::Shader from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -267,7 +267,7 @@ inline osg::ref_ptr<osg::Node> readRefNodeFile(const std::string& filename)
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::ref_ptr<osg::Shader> readRefShaderFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Shader from file.
|
||||
/** Read an osg::Shader from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -38,11 +38,11 @@ class Options;
|
||||
class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
ReaderWriter():
|
||||
osg::Object(true) {}
|
||||
|
||||
|
||||
ReaderWriter(const ReaderWriter& rw,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
||||
osg::Object(rw,copyop) {}
|
||||
|
||||
@@ -70,10 +70,10 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
{
|
||||
FEATURE_NONE = 0,
|
||||
FEATURE_READ_OBJECT = 1<<0,
|
||||
FEATURE_READ_IMAGE = 1<<1,
|
||||
FEATURE_READ_IMAGE = 1<<1,
|
||||
FEATURE_READ_HEIGHT_FIELD = 1<<2,
|
||||
FEATURE_READ_NODE = 1<<3,
|
||||
FEATURE_READ_SHADER = 1<<4,
|
||||
FEATURE_READ_NODE = 1<<3,
|
||||
FEATURE_READ_SHADER = 1<<4,
|
||||
FEATURE_WRITE_OBJECT = 1<<5,
|
||||
FEATURE_WRITE_IMAGE = 1<<6,
|
||||
FEATURE_WRITE_HEIGHT_FIELD = 1<<7,
|
||||
@@ -88,8 +88,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
FEATURE_WRITE_IMAGE |
|
||||
FEATURE_WRITE_HEIGHT_FIELD |
|
||||
FEATURE_WRITE_NODE |
|
||||
FEATURE_WRITE_SHADER
|
||||
};
|
||||
FEATURE_WRITE_SHADER
|
||||
};
|
||||
/** Return available features*/
|
||||
virtual Features supportedFeatures() const;
|
||||
|
||||
@@ -117,10 +117,10 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
ReadResult(ReadStatus status=FILE_NOT_HANDLED):_status(status) {}
|
||||
ReadResult(const std::string& m):_status(ERROR_IN_READING_FILE),_message(m) {}
|
||||
ReadResult(osg::Object* obj, ReadStatus status=FILE_LOADED):_status(status),_object(obj) {}
|
||||
|
||||
|
||||
ReadResult(const ReadResult& rr):_status(rr._status),_message(rr._message),_object(rr._object) {}
|
||||
ReadResult& operator = (const ReadResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message;_object=rr._object; return *this; }
|
||||
|
||||
|
||||
osg::Object* getObject();
|
||||
osg::Image* getImage();
|
||||
osg::HeightField* getHeightField();
|
||||
@@ -154,7 +154,7 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
bool notEnoughMemory() const { return _status==INSUFFICIENT_MEMORY_TO_LOAD; }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
ReadStatus _status;
|
||||
std::string _message;
|
||||
osg::ref_ptr<osg::Object> _object;
|
||||
@@ -175,10 +175,10 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
|
||||
WriteResult(WriteStatus status=FILE_NOT_HANDLED):_status(status) {}
|
||||
WriteResult(const std::string& m):_status(ERROR_IN_WRITING_FILE),_message(m) {}
|
||||
|
||||
|
||||
WriteResult(const WriteResult& rr):_status(rr._status),_message(rr._message) {}
|
||||
WriteResult& operator = (const WriteResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message; return *this; }
|
||||
|
||||
|
||||
std::string& message() { return _message; }
|
||||
const std::string& message() const { return _message; }
|
||||
|
||||
@@ -188,7 +188,7 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
bool notHandled() const { return _status==FILE_NOT_HANDLED || _status==NOT_IMPLEMENTED; }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
WriteStatus _status;
|
||||
std::string _message;
|
||||
};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -74,7 +74,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static Registry* instance(bool erase = false);
|
||||
|
||||
/** read the command line arguments.*/
|
||||
@@ -126,10 +126,10 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
/** find the library in the OSG_LIBRARY_PATH and load it.*/
|
||||
LoadStatus loadLibrary(const std::string& fileName);
|
||||
|
||||
|
||||
/** close the attached library with specified name.*/
|
||||
bool closeLibrary(const std::string& fileName);
|
||||
|
||||
|
||||
/** close all libraries.*/
|
||||
void closeAllLibraries();
|
||||
|
||||
@@ -141,13 +141,13 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
/** gets a reader/writer that handles the extension mapped to by one of
|
||||
* the registered mime-types. */
|
||||
ReaderWriter* getReaderWriterForMimeType(const std::string& mimeType);
|
||||
|
||||
|
||||
/** get list of all registered ReaderWriters.*/
|
||||
ReaderWriterList& getReaderWriterList() { return _rwList; }
|
||||
|
||||
/** get const list of all registered ReaderWriters.*/
|
||||
const ReaderWriterList& getReaderWriterList() const { return _rwList; }
|
||||
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<ImageProcessor> > ImageProcessorList;
|
||||
|
||||
@@ -202,7 +202,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
/** Get the readFile callback.*/
|
||||
ReadFileCallback* getReadFileCallback() { return _readFileCallback.get(); }
|
||||
|
||||
|
||||
/** Get the const readFile callback.*/
|
||||
const ReadFileCallback* getReadFileCallback() const { return _readFileCallback.get(); }
|
||||
|
||||
@@ -271,7 +271,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
/** Get the writeFile callback.*/
|
||||
WriteFileCallback* getWriteFileCallback() { return _writeFileCallback.get(); }
|
||||
|
||||
|
||||
/** Get the const writeFile callback.*/
|
||||
const WriteFileCallback* getWriteFileCallback() const { return _writeFileCallback.get(); }
|
||||
|
||||
@@ -307,7 +307,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
else return writeNodeImplementation(node,fileName,options);
|
||||
}
|
||||
ReaderWriter::WriteResult writeNodeImplementation(const osg::Node& node, const std::string& fileName,const Options* options);
|
||||
|
||||
|
||||
ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options)
|
||||
{
|
||||
if (options && options->getWriteFileCallback()) return options->getWriteFileCallback()->writeShader(obj,fileName,options);
|
||||
@@ -315,7 +315,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
else return writeShaderImplementation(obj,fileName,options);
|
||||
}
|
||||
ReaderWriter::WriteResult writeShaderImplementation(const osg::Shader& obj, const std::string& fileName,const Options* options);
|
||||
|
||||
|
||||
|
||||
inline void _buildKdTreeIfRequired(ReaderWriter::ReadResult& result, const Options* options)
|
||||
{
|
||||
@@ -323,7 +323,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
options->getBuildKdTreesHint() == Options::BUILD_KDTREES :
|
||||
_buildKdTreesHint == Options::BUILD_KDTREES;
|
||||
|
||||
if (doKdTreeBuilder && _kdTreeBuilder.valid() && result.validNode())
|
||||
if (doKdTreeBuilder && _kdTreeBuilder.valid() && result.validNode())
|
||||
{
|
||||
osg::ref_ptr<osg::KdTreeBuilder> builder = _kdTreeBuilder->clone();
|
||||
result.getNode()->accept(*builder);
|
||||
@@ -373,18 +373,18 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
void setCreateNodeFromImage(bool flag) { _createNodeFromImage = flag; }
|
||||
bool getCreateNodeFromImage() const { return _createNodeFromImage; }
|
||||
|
||||
|
||||
|
||||
void setOptions(Options* opt) { _options = opt; }
|
||||
Options* getOptions() { return _options.get(); }
|
||||
const Options* getOptions() const { return _options.get(); }
|
||||
|
||||
|
||||
/** initialize both the Data and Library FilePaths, by default called by the
|
||||
/** initialize both the Data and Library FilePaths, by default called by the
|
||||
* constructor, so it should only be required if you want to force
|
||||
* the re-reading of environmental variables.*/
|
||||
void initFilePathLists() { initDataFilePathList(); initLibraryFilePathList(); }
|
||||
|
||||
|
||||
/** initialize the Data FilePath by reading the OSG_FILE_PATH environmental variable.*/
|
||||
void initDataFilePathList();
|
||||
|
||||
@@ -400,7 +400,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
/** get the const data file path which is used when search for data files.*/
|
||||
const FilePathList& getDataFilePathList() const { return _dataFilePath; }
|
||||
|
||||
/** initialize the Library FilePath by reading the OSG_LIBRARY_PATH
|
||||
/** initialize the Library FilePath by reading the OSG_LIBRARY_PATH
|
||||
* and the appropriate system environmental variables*/
|
||||
void initLibraryFilePathList();
|
||||
|
||||
@@ -412,11 +412,11 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
/** get the library file path which is used when search for library (dso/dll's) files.*/
|
||||
FilePathList& getLibraryFilePathList() { return _libraryFilePath; }
|
||||
|
||||
|
||||
/** get the const library file path which is used when search for library (dso/dll's) files.*/
|
||||
const FilePathList& getLibraryFilePathList() const { return _libraryFilePath; }
|
||||
|
||||
/** For each object in the cache which has an reference count greater than 1
|
||||
/** For each object in the cache which has an reference count greater than 1
|
||||
* (and therefore referenced by elsewhere in the application) set the time stamp
|
||||
* for that object in the cache to specified time.
|
||||
* This would typically be called once per frame by applications which are doing database paging,
|
||||
@@ -436,7 +436,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
double getExpiryDelay() const { return _expiryDelay; }
|
||||
|
||||
|
||||
/** Remove all objects in the cache regardless of having external references or expiry times.*/
|
||||
/** Remove all objects in the cache regardless of having external references or expiry times.*/
|
||||
void clearObjectCache();
|
||||
|
||||
/** Add a filename,object,timestamp triple to the Registry::ObjectCache.*/
|
||||
@@ -447,27 +447,27 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
/** Get an Object from the object cache*/
|
||||
osg::Object* getFromObjectCache(const std::string& fileName);
|
||||
|
||||
|
||||
/** Get an ref_ptr<Object> from the object cache*/
|
||||
osg::ref_ptr<osg::Object> getRefFromObjectCache(const std::string& fileName);
|
||||
|
||||
|
||||
|
||||
|
||||
/** Add archive to archive cache so that future calls reference this archive.*/
|
||||
void addToArchiveCache(const std::string& fileName, osgDB::Archive* archive);
|
||||
|
||||
/** Remove Archive from cache.*/
|
||||
void removeFromArchiveCache(const std::string& fileName);
|
||||
|
||||
|
||||
/** Get an Archive from the archive cache.*/
|
||||
osgDB::Archive* getFromArchiveCache(const std::string& fileName);
|
||||
|
||||
/** Get an ref_ptr<Archive> from the archive cache.*/
|
||||
osg::ref_ptr<osgDB::Archive> getRefFromArchiveCache(const std::string& fileName);
|
||||
|
||||
|
||||
/** Remove all archives from the archive cache.*/
|
||||
void clearArchiveCache();
|
||||
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
@@ -481,16 +481,16 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
/** Get the SharedStateManager, creating one if one is not already created.*/
|
||||
SharedStateManager* getOrCreateSharedStateManager();
|
||||
|
||||
|
||||
/** Get the SharedStateManager. Return 0 if no SharedStateManager has been assigned.*/
|
||||
SharedStateManager* getSharedStateManager() { return _sharedStateManager.get(); }
|
||||
|
||||
/** Add an Archive extension.*/
|
||||
void addArchiveExtension(const std::string ext);
|
||||
|
||||
|
||||
/** registers a protocol */
|
||||
void registerProtocol(const std::string& protocol);
|
||||
|
||||
|
||||
/** returns true, if named protocol is registered */
|
||||
bool isProtocolRegistered(const std::string& protocol);
|
||||
|
||||
@@ -509,11 +509,11 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
typedef std::vector< osg::ref_ptr<DynamicLibrary> > DynamicLibraryList;
|
||||
typedef std::map< std::string, std::string> ExtensionAliasMap;
|
||||
|
||||
|
||||
typedef std::pair<osg::ref_ptr<osg::Object>, double > ObjectTimeStampPair;
|
||||
typedef std::map<std::string, ObjectTimeStampPair > ObjectCache;
|
||||
typedef std::map<std::string, osg::ref_ptr<osgDB::Archive> > ArchiveCache;
|
||||
|
||||
|
||||
typedef std::set<std::string> RegisteredProtocolsSet;
|
||||
|
||||
/** constructor is private, as its a singleton, preventing
|
||||
@@ -526,13 +526,13 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
Options::BuildKdTreesHint _buildKdTreesHint;
|
||||
osg::ref_ptr<osg::KdTreeBuilder> _kdTreeBuilder;
|
||||
|
||||
|
||||
osg::ref_ptr<FileCache> _fileCache;
|
||||
|
||||
|
||||
osg::ref_ptr<AuthenticationMap> _authenticationMap;
|
||||
|
||||
|
||||
bool _createNodeFromImage;
|
||||
|
||||
|
||||
RegisteredProtocolsSet _registeredProtocols;
|
||||
|
||||
public:
|
||||
@@ -555,9 +555,9 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
void destruct();
|
||||
|
||||
|
||||
// forward declare helper classes
|
||||
struct ReadObjectFunctor;
|
||||
struct ReadImageFunctor;
|
||||
@@ -565,7 +565,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
struct ReadNodeFunctor;
|
||||
struct ReadArchiveFunctor;
|
||||
struct ReadShaderFunctor;
|
||||
|
||||
|
||||
// make helper classes friends to get round VS6.0 "issues"
|
||||
friend struct ReadFunctor;
|
||||
friend struct ReadObjectFunctor;
|
||||
@@ -600,7 +600,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
ArchiveCache _archiveCache;
|
||||
|
||||
bool _openingLibrary;
|
||||
|
||||
|
||||
// map to alias to extensions to plugins.
|
||||
ExtensionAliasMap _extAliasMap;
|
||||
|
||||
@@ -609,17 +609,17 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
// Utility: Removes whitespace from both ends of a string.
|
||||
static std::string trim( const std::string& str );
|
||||
|
||||
|
||||
// options to pass to reader writers.
|
||||
osg::ref_ptr<Options> _options;
|
||||
|
||||
|
||||
FilePathList _dataFilePath;
|
||||
FilePathList _libraryFilePath;
|
||||
|
||||
double _expiryDelay;
|
||||
ObjectCache _objectCache;
|
||||
OpenThreads::Mutex _objectCacheMutex;
|
||||
|
||||
|
||||
|
||||
ArchiveExtensionList _archiveExtList;
|
||||
|
||||
@@ -656,9 +656,9 @@ class RegisterReaderWriterProxy
|
||||
Registry::instance()->removeReaderWriter(_rw.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
T* get() { return _rw.get(); }
|
||||
|
||||
|
||||
protected:
|
||||
osg::ref_ptr<T> _rw;
|
||||
};
|
||||
|
||||
@@ -38,10 +38,10 @@ public:
|
||||
typedef int Value;
|
||||
typedef std::map<std::string, Value> StringToValue;
|
||||
typedef std::map<Value, std::string> ValueToString;
|
||||
|
||||
|
||||
IntLookup() {}
|
||||
unsigned int size() const { return _stringToValue.size(); }
|
||||
|
||||
|
||||
void add( const char* str, Value value )
|
||||
{
|
||||
if ( _valueToString.find(value)!=_valueToString.end() )
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
_valueToString[value] = str;
|
||||
_stringToValue[str] = value;
|
||||
}
|
||||
|
||||
|
||||
Value getValue( const char* str )
|
||||
{
|
||||
StringToValue::iterator itr = _stringToValue.find(str);
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
}
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
|
||||
const std::string& getString( Value value )
|
||||
{
|
||||
ValueToString::iterator itr = _valueToString.find(value);
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
}
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
StringToValue _stringToValue;
|
||||
ValueToString _valueToString;
|
||||
@@ -92,7 +92,7 @@ class UserLookupTableProxy
|
||||
public:
|
||||
typedef void (*AddValueFunc)( IntLookup* lookup );
|
||||
UserLookupTableProxy( AddValueFunc func ) { if ( func ) (*func)(&_lookup); }
|
||||
|
||||
|
||||
IntLookup _lookup;
|
||||
};
|
||||
|
||||
@@ -145,10 +145,10 @@ public:
|
||||
typedef bool (*Checker)( const C& );
|
||||
typedef bool (*Reader)( InputStream&, C& );
|
||||
typedef bool (*Writer)( OutputStream&, const C& );
|
||||
|
||||
|
||||
UserSerializer( const char* name, Checker cf, Reader rf, Writer wf )
|
||||
: BaseSerializer(), _name(name), _checker(cf), _reader(rf), _writer(wf) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
}
|
||||
return (*_reader)(is, object);
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -181,13 +181,13 @@ public:
|
||||
}
|
||||
return (*_writer)(os, object);
|
||||
}
|
||||
|
||||
|
||||
virtual const std::string& getName() const { return _name; }
|
||||
|
||||
|
||||
protected:
|
||||
std::string _name;
|
||||
Checker _checker;
|
||||
|
||||
|
||||
public:
|
||||
Reader _reader;
|
||||
Writer _writer;
|
||||
@@ -217,10 +217,10 @@ public:
|
||||
typedef TemplateSerializer<P> ParentType;
|
||||
typedef P (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( P );
|
||||
|
||||
|
||||
PropByValSerializer( const char* name, P def, Getter gf, Setter sf, bool useHex=false )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf), _useHex(useHex) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -259,11 +259,11 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
|
||||
|
||||
protected:
|
||||
bool _useHex;
|
||||
};
|
||||
@@ -276,10 +276,10 @@ public:
|
||||
typedef const P& CP;
|
||||
typedef CP (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( CP );
|
||||
|
||||
|
||||
PropByRefSerializer( const char* name, CP def, Getter gf, Setter sf )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
@@ -325,10 +325,10 @@ public:
|
||||
typedef TemplateSerializer<osg::Matrix> ParentType;
|
||||
typedef const osg::Matrix& (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( const osg::Matrix& );
|
||||
|
||||
|
||||
MatrixSerializer( const char* name, const osg::Matrix& def, Getter gf, Setter sf )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -346,7 +346,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
void readMatrixImplementation( InputStream& is, osg::Matrix& matrix )
|
||||
{
|
||||
@@ -381,7 +381,7 @@ protected:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
@@ -394,10 +394,10 @@ public:
|
||||
typedef TemplateSerializer<P> ParentType;
|
||||
typedef P (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( P );
|
||||
|
||||
|
||||
GLenumSerializer( const char* name, P def, Getter gf, Setter sf )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -414,7 +414,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -429,7 +429,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
@@ -442,10 +442,10 @@ public:
|
||||
typedef TemplateSerializer<std::string> ParentType;
|
||||
typedef const std::string& (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( const std::string& );
|
||||
|
||||
|
||||
StringSerializer( const char* name, const std::string& def, Getter gf, Setter sf )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -464,7 +464,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -481,7 +481,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
@@ -494,10 +494,10 @@ public:
|
||||
typedef TemplateSerializer<P*> ParentType;
|
||||
typedef const P* (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( P* );
|
||||
|
||||
|
||||
ObjectSerializer( const char* name, P* def, Getter gf, Setter sf )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -526,7 +526,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -550,7 +550,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
@@ -563,10 +563,10 @@ public:
|
||||
typedef TemplateSerializer<P*> ParentType;
|
||||
typedef const P* (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( P* );
|
||||
|
||||
|
||||
ImageSerializer( const char* name, P* def, Getter gf, Setter sf )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -595,7 +595,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -619,7 +619,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
@@ -632,19 +632,19 @@ public:
|
||||
typedef TemplateSerializer<P> ParentType;
|
||||
typedef P (C::*Getter)() const;
|
||||
typedef B (C::*Setter)( P );
|
||||
|
||||
|
||||
EnumSerializer( const char* name, P def, Getter gf, Setter sf )
|
||||
: ParentType(name, def), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
void add( const char* str, P value )
|
||||
{ _lookup.add(str, static_cast<IntLookup::Value>(value)); }
|
||||
|
||||
|
||||
P getValue( const char* str )
|
||||
{ return static_cast<P>(_lookup.getValue(str)); }
|
||||
|
||||
|
||||
const std::string& getString( P value )
|
||||
{ return _lookup.getString(static_cast<IntLookup::Value>(value)); }
|
||||
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
C& object = OBJECT_CAST<C&>(obj);
|
||||
@@ -662,7 +662,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( osgDB::OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -677,11 +677,11 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Getter _getter;
|
||||
Setter _setter;
|
||||
|
||||
|
||||
protected:
|
||||
IntLookup _lookup;
|
||||
};
|
||||
@@ -695,10 +695,10 @@ public:
|
||||
typedef typename P::const_iterator ConstIterator;
|
||||
typedef const P& (C::*Getter)() const;
|
||||
typedef void (C::*Setter)( const P& );
|
||||
|
||||
|
||||
ListSerializer( const char* name, Getter gf, Setter sf )
|
||||
: _name(name), _getter(gf), _setter(sf) {}
|
||||
|
||||
|
||||
virtual const std::string& getName() const { return _name; }
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
@@ -735,7 +735,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
@@ -763,7 +763,7 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
std::string _name;
|
||||
Getter _getter;
|
||||
@@ -809,7 +809,7 @@ public:
|
||||
#define ADD_UINT_SERIALIZER(PROP, DEF) \
|
||||
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned int >( \
|
||||
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_UINT )
|
||||
|
||||
|
||||
#define ADD_GLINT_SERIALIZER(PROP, DEF) \
|
||||
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, GLint >( \
|
||||
#PROP, ((int)(DEF)), &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_INT )
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGDB_SHAREDSTATEMANAGER
|
||||
#define OSGDB_SHAREDSTATEMANAGER 1
|
||||
|
||||
|
||||
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/Geode>
|
||||
@@ -29,7 +29,7 @@ namespace osgDB {
|
||||
|
||||
class OSGDB_EXPORT SharedStateManager : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
enum ShareMode
|
||||
{
|
||||
@@ -49,9 +49,9 @@ namespace osgDB {
|
||||
SharedStateManager(unsigned int mode = SHARE_ALL);
|
||||
|
||||
META_NodeVisitor("osgDB","SharedStateManager")
|
||||
|
||||
|
||||
void setShareMode(unsigned int mode);
|
||||
|
||||
|
||||
unsigned int getShareMode() { return _shareMode; }
|
||||
|
||||
// Call right after each unload and before Registry cache prune.
|
||||
@@ -108,7 +108,7 @@ namespace osgDB {
|
||||
return lhs->compare(*rhs, true) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Lists of shared objects
|
||||
typedef std::set< osg::ref_ptr<osg::StateAttribute>, CompareStateAttributes > TextureSet;
|
||||
TextureSet _sharedTextureList;
|
||||
@@ -129,7 +129,7 @@ namespace osgDB {
|
||||
bool _shareTexture[3];
|
||||
bool _shareStateSet[3];
|
||||
|
||||
// Share connection mutex
|
||||
// Share connection mutex
|
||||
|
||||
OpenThreads::Mutex *_mutex;
|
||||
// Mutex for doing isShared queries from other threads
|
||||
|
||||
@@ -18,13 +18,13 @@ class OSGDB_EXPORT OutputIterator : public osg::Referenced
|
||||
public:
|
||||
OutputIterator() : _out(0) {}
|
||||
virtual ~OutputIterator() {}
|
||||
|
||||
|
||||
void setStream( std::ostream* ostream ) { _out = ostream; }
|
||||
std::ostream* getStream() { return _out; }
|
||||
const std::ostream* getStream() const { return _out; }
|
||||
|
||||
virtual bool isBinary() const = 0;
|
||||
|
||||
|
||||
virtual void writeBool( bool b ) = 0;
|
||||
virtual void writeChar( char c ) = 0;
|
||||
virtual void writeUChar( unsigned char c ) = 0;
|
||||
@@ -39,15 +39,15 @@ public:
|
||||
virtual void writeString( const std::string& s ) = 0;
|
||||
virtual void writeStream( std::ostream& (*fn)(std::ostream&) ) = 0;
|
||||
virtual void writeBase( std::ios_base& (*fn)(std::ios_base&) ) = 0;
|
||||
|
||||
|
||||
virtual void writeGLenum( const ObjectGLenum& value ) = 0;
|
||||
virtual void writeProperty( const ObjectProperty& prop ) = 0;
|
||||
virtual void writeMark( const ObjectMark& mark ) = 0;
|
||||
virtual void writeCharArray( const char* s, unsigned int size ) = 0;
|
||||
virtual void writeWrappedString( const std::string& str ) = 0;
|
||||
|
||||
|
||||
virtual void flush() { _out->flush(); }
|
||||
|
||||
|
||||
protected:
|
||||
// Return true if the manipulator is std::endl
|
||||
bool isEndl( std::ostream& (*fn)(std::ostream&) )
|
||||
@@ -71,7 +71,7 @@ class OSGDB_EXPORT InputIterator : public osg::Referenced
|
||||
public:
|
||||
InputIterator() : _in(0), _inputStream(0), _byteSwap(0), _failed(false) {}
|
||||
virtual ~InputIterator() {}
|
||||
|
||||
|
||||
void setStream( std::istream* istream ) { _in = istream; }
|
||||
std::istream* getStream() { return _in; }
|
||||
const std::istream* getStream() const { return _in; }
|
||||
@@ -85,9 +85,9 @@ public:
|
||||
|
||||
void checkStream() const { if (_in->rdstate()&_in->failbit) _failed = true; }
|
||||
bool isFailed() const { return _failed; }
|
||||
|
||||
|
||||
virtual bool isBinary() const = 0;
|
||||
|
||||
|
||||
virtual void readBool( bool& b ) = 0;
|
||||
virtual void readChar( char& c ) = 0;
|
||||
virtual void readSChar( signed char& c ) = 0;
|
||||
@@ -103,13 +103,13 @@ public:
|
||||
virtual void readString( std::string& s ) = 0;
|
||||
virtual void readStream( std::istream& (*fn)(std::istream&) ) = 0;
|
||||
virtual void readBase( std::ios_base& (*fn)(std::ios_base&) ) = 0;
|
||||
|
||||
|
||||
virtual void readGLenum( ObjectGLenum& value ) = 0;
|
||||
virtual void readProperty( ObjectProperty& prop ) = 0;
|
||||
virtual void readMark( ObjectMark& mark ) = 0;
|
||||
virtual void readCharArray( char* s, unsigned int size ) = 0;
|
||||
virtual void readWrappedString( std::string& str ) = 0;
|
||||
|
||||
|
||||
virtual bool matchString( const std::string& /*str*/ ) { return false; }
|
||||
virtual void advanceToCurrentEndBracket() {}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace osgDB {
|
||||
|
||||
/** Write an osg::Object to file.
|
||||
/** Write an osg::Object to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -34,7 +34,7 @@ namespace osgDB {
|
||||
* to write the specified file.*/
|
||||
extern OSGDB_EXPORT bool writeObjectFile(const osg::Object& object, const std::string& filename, const Options* options );
|
||||
|
||||
/** Write an osg::Object to file.
|
||||
/** Write an osg::Object to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -45,7 +45,7 @@ inline bool writeObjectFile(const osg::Object& object, const std::string& filena
|
||||
return writeObjectFile( object, filename, Registry::instance()->getOptions() );
|
||||
}
|
||||
|
||||
/** Write an osg::Image to file.
|
||||
/** Write an osg::Image to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -54,7 +54,7 @@ inline bool writeObjectFile(const osg::Object& object, const std::string& filena
|
||||
* to write the specified file.*/
|
||||
extern OSGDB_EXPORT bool writeImageFile(const osg::Image& image, const std::string& filename, const Options* options );
|
||||
|
||||
/** Write an osg::Image to file.
|
||||
/** Write an osg::Image to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -65,7 +65,7 @@ inline bool writeImageFile(const osg::Image& image, const std::string& filename)
|
||||
return writeImageFile( image, filename, Registry::instance()->getOptions() );
|
||||
}
|
||||
|
||||
/** Write an osg::HeightField to file.
|
||||
/** Write an osg::HeightField to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -74,7 +74,7 @@ inline bool writeImageFile(const osg::Image& image, const std::string& filename)
|
||||
* to write the specified file.*/
|
||||
extern OSGDB_EXPORT bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename, const Options* options );
|
||||
|
||||
/** Write an osg::HeightField to file.
|
||||
/** Write an osg::HeightField to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -85,7 +85,7 @@ inline bool writeHeightFieldFile(const osg::HeightField& hf, const std::string&
|
||||
return writeHeightFieldFile( hf, filename, Registry::instance()->getOptions() );
|
||||
}
|
||||
|
||||
/** Write an osg::Node to file.
|
||||
/** Write an osg::Node to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -94,7 +94,7 @@ inline bool writeHeightFieldFile(const osg::HeightField& hf, const std::string&
|
||||
* to write the specified file.*/
|
||||
extern OSGDB_EXPORT bool writeNodeFile(const osg::Node& node, const std::string& filename, const Options* options );
|
||||
|
||||
/** Write an osg::Node to file.
|
||||
/** Write an osg::Node to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
@@ -105,7 +105,7 @@ inline bool writeNodeFile(const osg::Node& node, const std::string& filename)
|
||||
return writeNodeFile( node, filename, Registry::instance()->getOptions() );
|
||||
}
|
||||
|
||||
/** Write an osg::Shader to file.
|
||||
/** Write an osg::Shader to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
@@ -114,7 +114,7 @@ inline bool writeNodeFile(const osg::Node& node, const std::string& filename)
|
||||
* to write the specified file.*/
|
||||
extern OSGDB_EXPORT bool writeShaderFile(const osg::Shader& shader, const std::string& filename, const Options* options );
|
||||
|
||||
/** Write an osg::Shader to file.
|
||||
/** Write an osg::Shader to file.
|
||||
* Return true on success,
|
||||
* return false on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
|
||||
@@ -148,7 +148,7 @@ class OSGDB_EXPORT XmlNode : public osg::Referenced
|
||||
|
||||
bool writeChildren(const ControlMap& controlMap, std::ostream& fout, const std::string& indent) const;
|
||||
bool writeProperties(const ControlMap& controlMap, std::ostream& fout) const;
|
||||
|
||||
|
||||
bool readAndReplaceControl(std::string& contents, Input& input);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user