Ran script to remove trailing spaces and tabs

This commit is contained in:
Robert Osfield 2012-03-21 17:36:20 +00:00
parent 1e35f8975d
commit 14a563dc9f
1495 changed files with 21873 additions and 21873 deletions

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -15,7 +15,7 @@
// //
// Barrier - C++ barrier class // Barrier - C++ barrier class
// ~~~~~~~ // ~~~~~~~
// //
#ifndef _OPENTHREADS_BARRIER_ #ifndef _OPENTHREADS_BARRIER_
#define _OPENTHREADS_BARRIER_ #define _OPENTHREADS_BARRIER_
@ -66,12 +66,12 @@ public:
/** /**
* Return the number of threads currently blocked in the barrier, * Return the number of threads currently blocked in the barrier,
* Return -1 if error. * Return -1 if error.
*/ */
virtual int numThreadsCurrentlyBlocked(); virtual int numThreadsCurrentlyBlocked();
void invalidate(); void invalidate();
private: private:
/** /**

View File

@ -22,10 +22,10 @@
namespace OpenThreads { namespace OpenThreads {
/** Block is a block that can be used to halt a thread that is waiting another thread to release it.*/ /** Block is a block that can be used to halt a thread that is waiting another thread to release it.*/
class Block class Block
{ {
public: public:
Block(): Block():
_released(false) {} _released(false) {}
@ -75,7 +75,7 @@ class Block
ScopedLock<OpenThreads::Mutex> mutlock(_mut); ScopedLock<OpenThreads::Mutex> mutlock(_mut);
_released = false; _released = false;
} }
inline void set(bool doRelease) inline void set(bool doRelease)
{ {
if (doRelease!=_released) if (doRelease!=_released)
@ -97,10 +97,10 @@ class Block
}; };
/** BlockCount is a block that can be used to halt a thread that is waiting for a specified number of operations to be completed.*/ /** BlockCount is a block that can be used to halt a thread that is waiting for a specified number of operations to be completed.*/
class BlockCount class BlockCount
{ {
public: public:
BlockCount(unsigned int blockCount): BlockCount(unsigned int blockCount):
_blockCount(blockCount), _blockCount(blockCount),
_currentCount(0) {} _currentCount(0) {}
@ -132,7 +132,7 @@ class BlockCount
if (_currentCount) if (_currentCount)
_cond.wait(&_mut); _cond.wait(&_mut);
} }
inline void reset() inline void reset()
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> mutlock(_mut); OpenThreads::ScopedLock<OpenThreads::Mutex> mutlock(_mut);
@ -154,9 +154,9 @@ class BlockCount
} }
inline void setBlockCount(unsigned int blockCount) { _blockCount = blockCount; } inline void setBlockCount(unsigned int blockCount) { _blockCount = blockCount; }
inline unsigned int getBlockCount() const { return _blockCount; } inline unsigned int getBlockCount() const { return _blockCount; }
inline unsigned int getCurrentCount() const { return _currentCount; } inline unsigned int getCurrentCount() const { return _currentCount; }
protected: protected:
@ -167,7 +167,7 @@ class BlockCount
unsigned int _currentCount; unsigned int _currentCount;
private: private:
BlockCount(const BlockCount&) {} BlockCount(const BlockCount&) {}
}; };

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -25,13 +25,13 @@
#define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllexport) #define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllexport)
#else #else
#define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllimport) #define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllimport)
#if 0 // Commented out for now #if 0 // Commented out for now
#ifdef _MSC_VER #ifdef _MSC_VER
#ifdef _DEBUG #ifdef _DEBUG
#pragma comment(lib ,"OpenThreadsWin32d") #pragma comment(lib ,"OpenThreadsWin32d")
#else #else
#pragma comment(lib, "OpenThreadsWin32") #pragma comment(lib, "OpenThreadsWin32")
#endif #endif
#endif #endif

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads - Copyright (C) 1998-2007 Robert Osfield /* -*-c++-*- OpenThreads - Copyright (C) 1998-2007 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -22,12 +22,12 @@ namespace OpenThreads {
class ReadWriteMutex class ReadWriteMutex
{ {
public: public:
ReadWriteMutex(): ReadWriteMutex():
_readCount(0) {} _readCount(0) {}
virtual ~ReadWriteMutex() {} virtual ~ReadWriteMutex() {}
virtual int readLock() virtual int readLock()
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_readCountMutex); OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_readCountMutex);
@ -65,31 +65,31 @@ class ReadWriteMutex
{ {
return _readWriteMutex.unlock(); return _readWriteMutex.unlock();
} }
protected: protected:
ReadWriteMutex(const ReadWriteMutex&) {} ReadWriteMutex(const ReadWriteMutex&) {}
ReadWriteMutex& operator = (const ReadWriteMutex&) { return *(this); } ReadWriteMutex& operator = (const ReadWriteMutex&) { return *(this); }
#if 0 #if 0
ReentrantMutex _readWriteMutex; ReentrantMutex _readWriteMutex;
ReentrantMutex _readCountMutex; ReentrantMutex _readCountMutex;
#else #else
OpenThreads::Mutex _readWriteMutex; OpenThreads::Mutex _readWriteMutex;
OpenThreads::Mutex _readCountMutex; OpenThreads::Mutex _readCountMutex;
#endif #endif
unsigned int _readCount; unsigned int _readCount;
}; };
class ScopedReadLock class ScopedReadLock
{ {
public: public:
ScopedReadLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.readLock(); } ScopedReadLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.readLock(); }
~ScopedReadLock() { _mutex.readUnlock(); } ~ScopedReadLock() { _mutex.readUnlock(); }
protected: protected:
ReadWriteMutex& _mutex; ReadWriteMutex& _mutex;
ScopedReadLock& operator = (const ScopedReadLock&) { return *this; } ScopedReadLock& operator = (const ScopedReadLock&) { return *this; }
@ -99,11 +99,11 @@ class ScopedReadLock
class ScopedWriteLock class ScopedWriteLock
{ {
public: public:
ScopedWriteLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.writeLock(); } ScopedWriteLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.writeLock(); }
~ScopedWriteLock() { _mutex.writeUnlock(); } ~ScopedWriteLock() { _mutex.writeUnlock(); }
protected: protected:
ReadWriteMutex& _mutex; ReadWriteMutex& _mutex;
ScopedWriteLock& operator = (const ScopedWriteLock&) { return *this; } ScopedWriteLock& operator = (const ScopedWriteLock&) { return *this; }

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads - Copyright (C) 1998-2007 Robert Osfield /* -*-c++-*- OpenThreads - Copyright (C) 1998-2007 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -15,7 +15,7 @@
// //
// ScopedLock and ReverseScopedLock templates // ScopedLock and ReverseScopedLock templates
// ~~~~~~~ // ~~~~~~~
// //
#ifndef _ScopedLock_ #ifndef _ScopedLock_
#define _ScopedLock_ #define _ScopedLock_

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -29,7 +29,7 @@ namespace OpenThreads {
/** /**
* Get the number of processors. * Get the number of processors.
* *
* Note, systems where no support exists for querrying the number of processors, 1 is returned. * Note, systems where no support exists for querrying the number of processors, 1 is returned.
* *
*/ */
extern OPENTHREAD_EXPORT_DIRECTIVE int GetNumberOfProcessors(); extern OPENTHREAD_EXPORT_DIRECTIVE int GetNumberOfProcessors();
@ -37,7 +37,7 @@ extern OPENTHREAD_EXPORT_DIRECTIVE int GetNumberOfProcessors();
/** /**
* Set the processor affinity of current thread. * Set the processor affinity of current thread.
* *
* Note, systems where no support exists no affinity will be set, and -1 will be returned. * Note, systems where no support exists no affinity will be set, and -1 will be returned.
* *
*/ */
extern OPENTHREAD_EXPORT_DIRECTIVE int SetProcessorAffinityOfCurrentThread(unsigned int cpunum); extern OPENTHREAD_EXPORT_DIRECTIVE int SetProcessorAffinityOfCurrentThread(unsigned int cpunum);
@ -372,7 +372,7 @@ private:
* Implementation-specific data * Implementation-specific data
*/ */
void * _prvData; void * _prvData;
/** /**
* Master thread's priority, set by Thread::Init. * Master thread's priority, set by Thread::Init.
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -23,11 +23,11 @@
namespace osg { namespace osg {
/** Encapsulates OpenGL glAlphaFunc. /** Encapsulates OpenGL glAlphaFunc.
*/ */
class OSG_EXPORT AlphaFunc : public StateAttribute class OSG_EXPORT AlphaFunc : public StateAttribute
{ {
public : public :
enum ComparisonFunction { enum ComparisonFunction {
NEVER = GL_NEVER, NEVER = GL_NEVER,
LESS = GL_LESS, LESS = GL_LESS,
@ -41,7 +41,7 @@ class OSG_EXPORT AlphaFunc : public StateAttribute
AlphaFunc(); AlphaFunc();
AlphaFunc(ComparisonFunction func,float ref): AlphaFunc(ComparisonFunction func,float ref):
_comparisonFunc(func), _comparisonFunc(func),
_referenceValue(ref) {} _referenceValue(ref) {}
@ -51,9 +51,9 @@ class OSG_EXPORT AlphaFunc : public StateAttribute
StateAttribute(af,copyop), StateAttribute(af,copyop),
_comparisonFunc(af._comparisonFunc), _comparisonFunc(af._comparisonFunc),
_referenceValue(af._referenceValue) {} _referenceValue(af._referenceValue) {}
META_StateAttribute(osg, AlphaFunc,ALPHAFUNC); META_StateAttribute(osg, AlphaFunc,ALPHAFUNC);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -79,17 +79,17 @@ class OSG_EXPORT AlphaFunc : public StateAttribute
_comparisonFunc = func; _comparisonFunc = func;
_referenceValue = ref; _referenceValue = ref;
} }
inline void setFunction(ComparisonFunction func) { _comparisonFunc=func; } inline void setFunction(ComparisonFunction func) { _comparisonFunc=func; }
inline ComparisonFunction getFunction() const { return _comparisonFunc; } inline ComparisonFunction getFunction() const { return _comparisonFunc; }
inline void setReferenceValue(float value) { _referenceValue=value; } inline void setReferenceValue(float value) { _referenceValue=value; }
inline float getReferenceValue() const { return _referenceValue; } inline float getReferenceValue() const { return _referenceValue; }
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected: protected:
virtual ~AlphaFunc(); virtual ~AlphaFunc();
ComparisonFunction _comparisonFunc; ComparisonFunction _comparisonFunc;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -33,7 +33,7 @@ namespace osg {
class OSG_EXPORT AnimationPath : public virtual osg::Object class OSG_EXPORT AnimationPath : public virtual osg::Object
{ {
public: public:
AnimationPath():_loopMode(LOOP) {} AnimationPath():_loopMode(LOOP) {}
AnimationPath(const AnimationPath& ap, const CopyOp& copyop=CopyOp::SHALLOW_COPY): AnimationPath(const AnimationPath& ap, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
@ -63,7 +63,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object
_position(position), _position(position),
_rotation(rotation), _rotation(rotation),
_scale(scale) {} _scale(scale) {}
void setPosition(const osg::Vec3d& position) { _position = position; } void setPosition(const osg::Vec3d& position) { _position = position; }
const osg::Vec3d& getPosition() const { return _position; } const osg::Vec3d& getPosition() const { return _position; }
@ -80,7 +80,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object
_rotation.slerp(ratio,first._rotation,second._rotation); _rotation.slerp(ratio,first._rotation,second._rotation);
_scale = first._scale*one_minus_ratio + second._scale*ratio; _scale = first._scale*one_minus_ratio + second._scale*ratio;
} }
inline void interpolate(double ratio,const ControlPoint& first, const ControlPoint& second) inline void interpolate(double ratio,const ControlPoint& first, const ControlPoint& second)
{ {
double one_minus_ratio = 1.0f-ratio; double one_minus_ratio = 1.0f-ratio;
@ -124,7 +124,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object
osg::Vec3d _scale; osg::Vec3d _scale;
}; };
/** Given a specific time, return the transformation matrix for a point. */ /** Given a specific time, return the transformation matrix for a point. */
bool getMatrix(double time,Matrixf& matrix) const bool getMatrix(double time,Matrixf& matrix) const
@ -152,7 +152,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object
cp.getInverse(matrix); cp.getInverse(matrix);
return true; return true;
} }
bool getInverse(double time,Matrixd& matrix) const bool getInverse(double time,Matrixd& matrix) const
{ {
ControlPoint cp; ControlPoint cp;
@ -163,36 +163,36 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object
/** Given a specific time, return the local ControlPoint frame for a point. */ /** Given a specific time, return the local ControlPoint frame for a point. */
virtual bool getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const; virtual bool getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const;
/** Insert a control point into the AnimationPath.*/ /** Insert a control point into the AnimationPath.*/
void insert(double time,const ControlPoint& controlPoint); void insert(double time,const ControlPoint& controlPoint);
double getFirstTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.begin()->first; else return 0.0;} double getFirstTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.begin()->first; else return 0.0;}
double getLastTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.rbegin()->first; else return 0.0;} double getLastTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.rbegin()->first; else return 0.0;}
double getPeriod() const { return getLastTime()-getFirstTime();} double getPeriod() const { return getLastTime()-getFirstTime();}
enum LoopMode enum LoopMode
{ {
SWING, SWING,
LOOP, LOOP,
NO_LOOPING NO_LOOPING
}; };
void setLoopMode(LoopMode lm) { _loopMode = lm; } void setLoopMode(LoopMode lm) { _loopMode = lm; }
LoopMode getLoopMode() const { return _loopMode; } LoopMode getLoopMode() const { return _loopMode; }
typedef std::map<double,ControlPoint> TimeControlPointMap; typedef std::map<double,ControlPoint> TimeControlPointMap;
void setTimeControlPointMap(TimeControlPointMap& tcpm) { _timeControlPointMap=tcpm; } void setTimeControlPointMap(TimeControlPointMap& tcpm) { _timeControlPointMap=tcpm; }
TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; } TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; }
const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; } const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; }
bool empty() const { return _timeControlPointMap.empty(); } bool empty() const { return _timeControlPointMap.empty(); }
void clear() { _timeControlPointMap.clear(); } void clear() { _timeControlPointMap.clear(); }
/** Read the animation path from a flat ASCII file stream. */ /** Read the animation path from a flat ASCII file stream. */
@ -205,7 +205,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object
void write(TimeControlPointMap::const_iterator itr, std::ostream& out) const; void write(TimeControlPointMap::const_iterator itr, std::ostream& out) const;
protected: protected:
virtual ~AnimationPath() {} virtual ~AnimationPath() {}
TimeControlPointMap _timeControlPointMap; TimeControlPointMap _timeControlPointMap;
@ -240,7 +240,7 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback
_pause(apc._pause), _pause(apc._pause),
_pauseTime(apc._pauseTime) {} _pauseTime(apc._pauseTime) {}
META_Object(osg,AnimationPathCallback); META_Object(osg,AnimationPathCallback);
/** Construct an AnimationPathCallback with a specified animation path.*/ /** Construct an AnimationPathCallback with a specified animation path.*/
@ -257,8 +257,8 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback
/** Construct an AnimationPathCallback and automatically create an animation path to produce a rotation about a point.*/ /** Construct an AnimationPathCallback and automatically create an animation path to produce a rotation about a point.*/
AnimationPathCallback(const osg::Vec3d& pivot,const osg::Vec3d& axis,float angularVelocity); AnimationPathCallback(const osg::Vec3d& pivot,const osg::Vec3d& axis,float angularVelocity);
void setAnimationPath(AnimationPath* path) { _animationPath = path; } void setAnimationPath(AnimationPath* path) { _animationPath = path; }
AnimationPath* getAnimationPath() { return _animationPath.get(); } AnimationPath* getAnimationPath() { return _animationPath.get(); }
const AnimationPath* getAnimationPath() const { return _animationPath.get(); } const AnimationPath* getAnimationPath() const { return _animationPath.get(); }
@ -271,7 +271,7 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback
void setTimeOffset(double offset) { _timeOffset = offset; } void setTimeOffset(double offset) { _timeOffset = offset; }
double getTimeOffset() const { return _timeOffset; } double getTimeOffset() const { return _timeOffset; }
void setTimeMultiplier(double multiplier) { _timeMultiplier = multiplier; } void setTimeMultiplier(double multiplier) { _timeMultiplier = multiplier; }
double getTimeMultiplier() const { return _timeMultiplier; } double getTimeMultiplier() const { return _timeMultiplier; }
@ -288,7 +288,7 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback
/** Implements the callback. */ /** Implements the callback. */
virtual void operator()(Node* node, NodeVisitor* nv); virtual void operator()(Node* node, NodeVisitor* nv);
void update(osg::Node& node); void update(osg::Node& node);
public: public:
@ -304,7 +304,7 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback
double _pauseTime; double _pauseTime;
protected: protected:
~AnimationPathCallback(){} ~AnimationPathCallback(){}
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -25,7 +25,7 @@ namespace osg {
class OSG_EXPORT ApplicationUsage : public osg::Referenced class OSG_EXPORT ApplicationUsage : public osg::Referenced
{ {
public: public:
static ApplicationUsage* instance(); static ApplicationUsage* instance();
ApplicationUsage() {} ApplicationUsage() {}
@ -33,7 +33,7 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced
ApplicationUsage(const std::string& commandLineUsage); ApplicationUsage(const std::string& commandLineUsage);
typedef std::map<std::string,std::string> UsageMap; typedef std::map<std::string,std::string> UsageMap;
/** The ApplicationName is often displayed when logging errors, and frequently incorporated into the Description (below). */ /** The ApplicationName is often displayed when logging errors, and frequently incorporated into the Description (below). */
void setApplicationName(const std::string& name) { _applicationName = name; } void setApplicationName(const std::string& name) { _applicationName = name; }
@ -52,15 +52,15 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced
KEYBOARD_MOUSE_BINDING = 0x4, KEYBOARD_MOUSE_BINDING = 0x4,
HELP_ALL = KEYBOARD_MOUSE_BINDING|ENVIRONMENTAL_VARIABLE|COMMAND_LINE_OPTION HELP_ALL = KEYBOARD_MOUSE_BINDING|ENVIRONMENTAL_VARIABLE|COMMAND_LINE_OPTION
}; };
void addUsageExplanation(Type type,const std::string& option,const std::string& explanation); void addUsageExplanation(Type type,const std::string& option,const std::string& explanation);
void setCommandLineUsage(const std::string& explanation) { _commandLineUsage=explanation; } void setCommandLineUsage(const std::string& explanation) { _commandLineUsage=explanation; }
const std::string& getCommandLineUsage() const { return _commandLineUsage; } const std::string& getCommandLineUsage() const { return _commandLineUsage; }
void addCommandLineOption(const std::string& option,const std::string& explanation, const std::string &defaultValue = ""); void addCommandLineOption(const std::string& option,const std::string& explanation, const std::string &defaultValue = "");
void setCommandLineOptions(const UsageMap& usageMap) { _commandLineOptions=usageMap; } void setCommandLineOptions(const UsageMap& usageMap) { _commandLineOptions=usageMap; }
const UsageMap& getCommandLineOptions() const { return _commandLineOptions; } const UsageMap& getCommandLineOptions() const { return _commandLineOptions; }
@ -69,7 +69,7 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced
void addEnvironmentalVariable(const std::string& option,const std::string& explanation, const std::string& defaultValue = ""); void addEnvironmentalVariable(const std::string& option,const std::string& explanation, const std::string& defaultValue = "");
void setEnvironmentalVariables(const UsageMap& usageMap) { _environmentalVariables=usageMap; } void setEnvironmentalVariables(const UsageMap& usageMap) { _environmentalVariables=usageMap; }
const UsageMap& getEnvironmentalVariables() const { return _environmentalVariables; } const UsageMap& getEnvironmentalVariables() const { return _environmentalVariables; }
@ -86,13 +86,13 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced
void getFormattedString(std::string& str, const UsageMap& um,unsigned int widthOfOutput=80,bool showDefaults=false,const UsageMap& ud=UsageMap()); void getFormattedString(std::string& str, const UsageMap& um,unsigned int widthOfOutput=80,bool showDefaults=false,const UsageMap& ud=UsageMap());
void write(std::ostream& output,const UsageMap& um,unsigned int widthOfOutput=80,bool showDefaults=false,const UsageMap& ud=UsageMap()); void write(std::ostream& output,const UsageMap& um,unsigned int widthOfOutput=80,bool showDefaults=false,const UsageMap& ud=UsageMap());
void write(std::ostream& output,unsigned int type=COMMAND_LINE_OPTION, unsigned int widthOfOutput=80,bool showDefaults=false); void write(std::ostream& output,unsigned int type=COMMAND_LINE_OPTION, unsigned int widthOfOutput=80,bool showDefaults=false);
void writeEnvironmentSettings(std::ostream& output); void writeEnvironmentSettings(std::ostream& output);
protected: protected:
virtual ~ApplicationUsage() {} virtual ~ApplicationUsage() {}
std::string _applicationName; std::string _applicationName;
@ -103,11 +103,11 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced
UsageMap _keyboardMouse; UsageMap _keyboardMouse;
UsageMap _environmentalVariablesDefaults; UsageMap _environmentalVariablesDefaults;
UsageMap _commandLineOptionsDefaults; UsageMap _commandLineOptionsDefaults;
}; };
class ApplicationUsageProxy class ApplicationUsageProxy
{ {
public: public:
/** register an explanation of commandline/environmentvariable/keyboard mouse usage.*/ /** register an explanation of commandline/environmentvariable/keyboard mouse usage.*/

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -40,7 +40,7 @@ class OSG_EXPORT ArgumentParser
UNSIGNED_INT_PARAMETER, UNSIGNED_INT_PARAMETER,
STRING_PARAMETER STRING_PARAMETER
}; };
union ValueUnion union ValueUnion
{ {
bool* _bool; bool* _bool;
@ -54,13 +54,13 @@ class OSG_EXPORT ArgumentParser
Parameter(bool& value) { _type = BOOL_PARAMETER; _value._bool = &value; } Parameter(bool& value) { _type = BOOL_PARAMETER; _value._bool = &value; }
Parameter(float& value) { _type = FLOAT_PARAMETER; _value._float = &value; } Parameter(float& value) { _type = FLOAT_PARAMETER; _value._float = &value; }
Parameter(double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; } Parameter(double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; }
Parameter(int& value) { _type = INT_PARAMETER; _value._int = &value; } Parameter(int& value) { _type = INT_PARAMETER; _value._int = &value; }
Parameter(unsigned int& value) { _type = UNSIGNED_INT_PARAMETER; _value._uint = &value; } Parameter(unsigned int& value) { _type = UNSIGNED_INT_PARAMETER; _value._uint = &value; }
Parameter(std::string& value) { _type = STRING_PARAMETER; _value._string = &value; } Parameter(std::string& value) { _type = STRING_PARAMETER; _value._string = &value; }
Parameter(const Parameter& param) { _type = param._type; _value = param._value; } Parameter(const Parameter& param) { _type = param._type; _value = param._value; }
@ -71,7 +71,7 @@ class OSG_EXPORT ArgumentParser
bool assign(const char* str); bool assign(const char* str);
protected: protected:
ParameterType _type; ParameterType _type;
ValueUnion _value; ValueUnion _value;
}; };
@ -79,11 +79,11 @@ class OSG_EXPORT ArgumentParser
/** Return true if the specified string is an option in the form /** Return true if the specified string is an option in the form
* -option or --option. */ * -option or --option. */
static bool isOption(const char* str); static bool isOption(const char* str);
/** Return true if string is non-NULL and not an option in the form /** Return true if string is non-NULL and not an option in the form
* -option or --option. */ * -option or --option. */
static bool isString(const char* str); static bool isString(const char* str);
/** Return true if specified parameter is a number. */ /** Return true if specified parameter is a number. */
static bool isNumber(const char* str); static bool isNumber(const char* str);
@ -120,20 +120,20 @@ class OSG_EXPORT ArgumentParser
/** Return true if the specified parameter is an option in the form of /** Return true if the specified parameter is an option in the form of
* -option or --option. */ * -option or --option. */
bool isOption(int pos) const; bool isOption(int pos) const;
/** Return true if the specified parameter is a string not in /** Return true if the specified parameter is a string not in
* the form of an option. */ * the form of an option. */
bool isString(int pos) const; bool isString(int pos) const;
/** Return true if the specified parameter is a number. */ /** Return true if the specified parameter is a number. */
bool isNumber(int pos) const; bool isNumber(int pos) const;
bool containsOptions() const; bool containsOptions() const;
/** Remove one or more arguments from the argv argument list, /** Remove one or more arguments from the argv argument list,
* and decrement the argc respectively. */ * and decrement the argc respectively. */
void remove(int pos,int num=1); void remove(int pos,int num=1);
/** Return true if the specified argument matches the given string. */ /** Return true if the specified argument matches the given string. */
bool match(int pos, const std::string& str) const; bool match(int pos, const std::string& str) const;
@ -180,32 +180,32 @@ class OSG_EXPORT ArgumentParser
/** For each remaining option, report it as unrecognized. */ /** For each remaining option, report it as unrecognized. */
void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN); void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN);
/** Return the error message, if any has occurred. */ /** Return the error message, if any has occurred. */
ErrorMessageMap& getErrorMessageMap() { return _errorMessageMap; } ErrorMessageMap& getErrorMessageMap() { return _errorMessageMap; }
/** Return the error message, if any has occurred. */ /** Return the error message, if any has occurred. */
const ErrorMessageMap& getErrorMessageMap() const { return _errorMessageMap; } const ErrorMessageMap& getErrorMessageMap() const { return _errorMessageMap; }
/** Write error messages to the given ostream, if at or above the given severity. */ /** Write error messages to the given ostream, if at or above the given severity. */
void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN); void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN);
/** This convenience method handles help requests on the command line. /** This convenience method handles help requests on the command line.
* Return the type(s) of help requested. The return value of this * Return the type(s) of help requested. The return value of this
* function is suitable for passing into getApplicationUsage()->write(). * function is suitable for passing into getApplicationUsage()->write().
* If ApplicationUsage::NO_HELP is returned then no help commandline option * If ApplicationUsage::NO_HELP is returned then no help commandline option
* was found on the command line. */ * was found on the command line. */
ApplicationUsage::Type readHelpType(); ApplicationUsage::Type readHelpType();
protected: protected:
int* _argc; int* _argc;
char** _argv; char** _argv;
ErrorMessageMap _errorMessageMap; ErrorMessageMap _errorMessageMap;
ref_ptr<ApplicationUsage> _usage; ref_ptr<ApplicationUsage> _usage;
}; };
} }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -48,7 +48,7 @@ class OSG_EXPORT Array : public BufferData
{ {
public: public:
enum Type enum Type
{ {
ArrayType = 0, ArrayType = 0,
@ -73,7 +73,7 @@ class OSG_EXPORT Array : public BufferData
Vec2dArrayType = 19, Vec2dArrayType = 19,
Vec3dArrayType = 20, Vec3dArrayType = 20,
Vec4dArrayType = 21, Vec4dArrayType = 21,
MatrixArrayType = 22 MatrixArrayType = 22
}; };
Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0): Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0):
@ -144,28 +144,28 @@ class TemplateArray : public Array, public MixinVector<T>
Array(ta,copyop), Array(ta,copyop),
MixinVector<T>(ta) {} MixinVector<T>(ta) {}
TemplateArray(unsigned int no) : TemplateArray(unsigned int no) :
Array(ARRAYTYPE,DataSize,DataType), Array(ARRAYTYPE,DataSize,DataType),
MixinVector<T>(no) {} MixinVector<T>(no) {}
TemplateArray(unsigned int no,const T* ptr) : TemplateArray(unsigned int no,const T* ptr) :
Array(ARRAYTYPE,DataSize,DataType), Array(ARRAYTYPE,DataSize,DataType),
MixinVector<T>(ptr,ptr+no) {} MixinVector<T>(ptr,ptr+no) {}
template <class InputIterator> template <class InputIterator>
TemplateArray(InputIterator first,InputIterator last) : TemplateArray(InputIterator first,InputIterator last) :
Array(ARRAYTYPE,DataSize,DataType), Array(ARRAYTYPE,DataSize,DataType),
MixinVector<T>(first,last) {} MixinVector<T>(first,last) {}
TemplateArray& operator = (const TemplateArray& array) TemplateArray& operator = (const TemplateArray& array)
{ {
if (this==&array) return *this; if (this==&array) return *this;
this->assign(array.begin(),array.end()); this->assign(array.begin(),array.end());
return *this; return *this;
} }
virtual Object* cloneType() const { return new TemplateArray(); } virtual Object* cloneType() const { return new TemplateArray(); }
virtual Object* clone(const CopyOp& copyop) const { return new TemplateArray(*this,copyop); } virtual Object* clone(const CopyOp& copyop) const { return new TemplateArray(*this,copyop); }
inline virtual void accept(ArrayVisitor& av); inline virtual void accept(ArrayVisitor& av);
inline virtual void accept(ConstArrayVisitor& av) const; inline virtual void accept(ConstArrayVisitor& av) const;
@ -195,7 +195,7 @@ class TemplateArray : public Array, public MixinVector<T>
typedef T ElementDataType; // expose T typedef T ElementDataType; // expose T
protected: protected:
virtual ~TemplateArray() {} virtual ~TemplateArray() {}
}; };
@ -230,28 +230,28 @@ class TemplateIndexArray : public IndexArray, public MixinVector<T>
IndexArray(ta,copyop), IndexArray(ta,copyop),
MixinVector<T>(ta) {} MixinVector<T>(ta) {}
TemplateIndexArray(unsigned int no) : TemplateIndexArray(unsigned int no) :
IndexArray(ARRAYTYPE,DataSize,DataType), IndexArray(ARRAYTYPE,DataSize,DataType),
MixinVector<T>(no) {} MixinVector<T>(no) {}
TemplateIndexArray(unsigned int no,T* ptr) : TemplateIndexArray(unsigned int no,T* ptr) :
IndexArray(ARRAYTYPE,DataSize,DataType), IndexArray(ARRAYTYPE,DataSize,DataType),
MixinVector<T>(ptr,ptr+no) {} MixinVector<T>(ptr,ptr+no) {}
template <class InputIterator> template <class InputIterator>
TemplateIndexArray(InputIterator first,InputIterator last) : TemplateIndexArray(InputIterator first,InputIterator last) :
IndexArray(ARRAYTYPE,DataSize,DataType), IndexArray(ARRAYTYPE,DataSize,DataType),
MixinVector<T>(first,last) {} MixinVector<T>(first,last) {}
TemplateIndexArray& operator = (const TemplateIndexArray& array) TemplateIndexArray& operator = (const TemplateIndexArray& array)
{ {
if (this==&array) return *this; if (this==&array) return *this;
this->assign(array.begin(),array.end()); this->assign(array.begin(),array.end());
return *this; return *this;
} }
virtual Object* cloneType() const { return new TemplateIndexArray(); } virtual Object* cloneType() const { return new TemplateIndexArray(); }
virtual Object* clone(const CopyOp& copyop) const { return new TemplateIndexArray(*this,copyop); } virtual Object* clone(const CopyOp& copyop) const { return new TemplateIndexArray(*this,copyop); }
inline virtual void accept(ArrayVisitor& av); inline virtual void accept(ArrayVisitor& av);
inline virtual void accept(ConstArrayVisitor& av) const; inline virtual void accept(ConstArrayVisitor& av) const;
@ -323,7 +323,7 @@ class ArrayVisitor
public: public:
ArrayVisitor() {} ArrayVisitor() {}
virtual ~ArrayVisitor() {} virtual ~ArrayVisitor() {}
virtual void apply(Array&) {} virtual void apply(Array&) {}
virtual void apply(ByteArray&) {} virtual void apply(ByteArray&) {}
virtual void apply(ShortArray&) {} virtual void apply(ShortArray&) {}
@ -337,12 +337,12 @@ class ArrayVisitor
virtual void apply(Vec2Array&) {} virtual void apply(Vec2Array&) {}
virtual void apply(Vec3Array&) {} virtual void apply(Vec3Array&) {}
virtual void apply(Vec4Array&) {} virtual void apply(Vec4Array&) {}
virtual void apply(Vec4ubArray&) {} virtual void apply(Vec4ubArray&) {}
virtual void apply(Vec2bArray&) {} virtual void apply(Vec2bArray&) {}
virtual void apply(Vec3bArray&) {} virtual void apply(Vec3bArray&) {}
virtual void apply(Vec4bArray&) {} virtual void apply(Vec4bArray&) {}
virtual void apply(Vec2sArray&) {} virtual void apply(Vec2sArray&) {}
virtual void apply(Vec3sArray&) {} virtual void apply(Vec3sArray&) {}
@ -351,7 +351,7 @@ class ArrayVisitor
virtual void apply(Vec2dArray&) {} virtual void apply(Vec2dArray&) {}
virtual void apply(Vec3dArray&) {} virtual void apply(Vec3dArray&) {}
virtual void apply(Vec4dArray&) {} virtual void apply(Vec4dArray&) {}
virtual void apply(MatrixfArray&) {} virtual void apply(MatrixfArray&) {}
}; };
@ -360,7 +360,7 @@ class ConstArrayVisitor
public: public:
ConstArrayVisitor() {} ConstArrayVisitor() {}
virtual ~ConstArrayVisitor() {} virtual ~ConstArrayVisitor() {}
virtual void apply(const Array&) {} virtual void apply(const Array&) {}
virtual void apply(const ByteArray&) {} virtual void apply(const ByteArray&) {}
virtual void apply(const ShortArray&) {} virtual void apply(const ShortArray&) {}
@ -377,9 +377,9 @@ class ConstArrayVisitor
virtual void apply(const Vec4ubArray&) {} virtual void apply(const Vec4ubArray&) {}
virtual void apply(const Vec2bArray&) {} virtual void apply(const Vec2bArray&) {}
virtual void apply(const Vec3bArray&) {} virtual void apply(const Vec3bArray&) {}
virtual void apply(const Vec4bArray&) {} virtual void apply(const Vec4bArray&) {}
virtual void apply(const Vec2sArray&) {} virtual void apply(const Vec2sArray&) {}
virtual void apply(const Vec3sArray&) {} virtual void apply(const Vec3sArray&) {}
@ -388,7 +388,7 @@ class ConstArrayVisitor
virtual void apply(const Vec2dArray&) {} virtual void apply(const Vec2dArray&) {}
virtual void apply(const Vec3dArray&) {} virtual void apply(const Vec3dArray&) {}
virtual void apply(const Vec4dArray&) {} virtual void apply(const Vec4dArray&) {}
virtual void apply(const MatrixfArray&) {} virtual void apply(const MatrixfArray&) {}
}; };
@ -398,7 +398,7 @@ class ValueVisitor
public: public:
ValueVisitor() {} ValueVisitor() {}
virtual ~ValueVisitor() {} virtual ~ValueVisitor() {}
virtual void apply(GLbyte&) {} virtual void apply(GLbyte&) {}
virtual void apply(GLshort&) {} virtual void apply(GLshort&) {}
virtual void apply(GLint&) {} virtual void apply(GLint&) {}
@ -407,17 +407,17 @@ class ValueVisitor
virtual void apply(GLuint&) {} virtual void apply(GLuint&) {}
virtual void apply(GLfloat&) {} virtual void apply(GLfloat&) {}
virtual void apply(GLdouble&) {} virtual void apply(GLdouble&) {}
virtual void apply(Vec2&) {} virtual void apply(Vec2&) {}
virtual void apply(Vec3&) {} virtual void apply(Vec3&) {}
virtual void apply(Vec4&) {} virtual void apply(Vec4&) {}
virtual void apply(Vec4ub&) {} virtual void apply(Vec4ub&) {}
virtual void apply(Vec2b&) {} virtual void apply(Vec2b&) {}
virtual void apply(Vec3b&) {} virtual void apply(Vec3b&) {}
virtual void apply(Vec4b&) {} virtual void apply(Vec4b&) {}
virtual void apply(Vec2s&) {} virtual void apply(Vec2s&) {}
virtual void apply(Vec3s&) {} virtual void apply(Vec3s&) {}
@ -426,7 +426,7 @@ class ValueVisitor
virtual void apply(Vec2d&) {} virtual void apply(Vec2d&) {}
virtual void apply(Vec3d&) {} virtual void apply(Vec3d&) {}
virtual void apply(Vec4d&) {} virtual void apply(Vec4d&) {}
virtual void apply(Matrixf&) {} virtual void apply(Matrixf&) {}
}; };
@ -435,7 +435,7 @@ class ConstValueVisitor
public: public:
ConstValueVisitor() {} ConstValueVisitor() {}
virtual ~ConstValueVisitor() {} virtual ~ConstValueVisitor() {}
virtual void apply(const GLbyte&) {} virtual void apply(const GLbyte&) {}
virtual void apply(const GLshort&) {} virtual void apply(const GLshort&) {}
virtual void apply(const GLint&) {} virtual void apply(const GLint&) {}
@ -453,16 +453,16 @@ class ConstValueVisitor
virtual void apply(const Vec2b&) {} virtual void apply(const Vec2b&) {}
virtual void apply(const Vec3b&) {} virtual void apply(const Vec3b&) {}
virtual void apply(const Vec4b&) {} virtual void apply(const Vec4b&) {}
virtual void apply(const Vec2s&) {} virtual void apply(const Vec2s&) {}
virtual void apply(const Vec3s&) {} virtual void apply(const Vec3s&) {}
virtual void apply(const Vec4s&) {} virtual void apply(const Vec4s&) {}
virtual void apply(const Vec2d&) {} virtual void apply(const Vec2d&) {}
virtual void apply(const Vec3d&) {} virtual void apply(const Vec3d&) {}
virtual void apply(const Vec4d&) {} virtual void apply(const Vec4d&) {}
virtual void apply(const Matrixf&) {} virtual void apply(const Matrixf&) {}
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -63,9 +63,9 @@ class OSG_EXPORT AudioStream : public osg::Object
virtual const char* className() const { return "AudioStream"; } virtual const char* className() const { return "AudioStream"; }
virtual void setAudioSink(osg::AudioSink* audio_sink) = 0; virtual void setAudioSink(osg::AudioSink* audio_sink) = 0;
virtual void consumeAudioBuffer(void * const buffer, const size_t size) = 0; virtual void consumeAudioBuffer(void * const buffer, const size_t size) = 0;
virtual int audioFrequency() const = 0; virtual int audioFrequency() const = 0;
virtual int audioNbChannels() const = 0; virtual int audioNbChannels() const = 0;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -34,7 +34,7 @@ class OSG_EXPORT Billboard : public Geode
}; };
Billboard(); Billboard();
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
Billboard(const Billboard&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); Billboard(const Billboard&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
@ -64,13 +64,13 @@ class OSG_EXPORT Billboard : public Geode
/** Type definition for pivot point position list. */ /** Type definition for pivot point position list. */
typedef std::vector<Vec3> PositionList; typedef std::vector<Vec3> PositionList;
/** Set the list of pivot point positions. */ /** Set the list of pivot point positions. */
inline void setPositionList(PositionList& pl) { _positionList=pl; } inline void setPositionList(PositionList& pl) { _positionList=pl; }
/** Get the list of pivot point positions. */ /** Get the list of pivot point positions. */
inline PositionList& getPositionList() { return _positionList; } inline PositionList& getPositionList() { return _positionList; }
/** Get a const list of pivot point positions. */ /** Get a const list of pivot point positions. */
inline const PositionList& getPositionList() const { return _positionList; } inline const PositionList& getPositionList() const { return _positionList; }
@ -93,7 +93,7 @@ class OSG_EXPORT Billboard : public Geode
* remove its pivot point position. and return true. * remove its pivot point position. and return true.
* Otherwise, return false. */ * Otherwise, return false. */
virtual bool removeDrawable( Drawable *gset ); virtual bool removeDrawable( Drawable *gset );
bool computeMatrix(Matrix& modelview, const Vec3& eye_local, const Vec3& pos_local) const; bool computeMatrix(Matrix& modelview, const Vec3& eye_local, const Vec3& pos_local) const;
@ -118,7 +118,7 @@ class OSG_EXPORT Billboard : public Geode
Vec3 _normal; Vec3 _normal;
Matrix _rotateNormalToZAxis; Matrix _rotateNormalToZAxis;
PositionList _positionList; PositionList _positionList;
// used internally as cache of which what _axis is aligned to help // used internally as cache of which what _axis is aligned to help
// decide which method of rotation to use. // decide which method of rotation to use.
int _cachedMode; int _cachedMode;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -29,16 +29,16 @@ class OSG_EXPORT BlendColor : public StateAttribute
public : public :
BlendColor(); BlendColor();
BlendColor(const osg::Vec4& constantColor); BlendColor(const osg::Vec4& constantColor);
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
BlendColor(const BlendColor& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): BlendColor(const BlendColor& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(trans,copyop), StateAttribute(trans,copyop),
_constantColor(trans._constantColor) {} _constantColor(trans._constantColor) {}
META_StateAttribute(osg, BlendColor,BLENDCOLOR); META_StateAttribute(osg, BlendColor,BLENDCOLOR);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -71,34 +71,34 @@ class OSG_EXPORT BlendColor : public StateAttribute
/** Encapsulates queries of extension availability, obtains extension /** Encapsulates queries of extension availability, obtains extension
* function pointers, and provides convenience wrappers for * function pointers, and provides convenience wrappers for
* calling extension functions. */ * calling extension functions. */
class OSG_EXPORT Extensions : public osg::Referenced class OSG_EXPORT Extensions : public osg::Referenced
{ {
public: public:
Extensions(unsigned int contextID); Extensions(unsigned int contextID);
Extensions(const Extensions& rhs); Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs); void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID); void setupGLExtensions(unsigned int contextID);
void setBlendColorSupported(bool flag) { _isBlendColorSupported=flag; } void setBlendColorSupported(bool flag) { _isBlendColorSupported=flag; }
bool isBlendColorSupported() const { return _isBlendColorSupported; } bool isBlendColorSupported() const { return _isBlendColorSupported; }
void glBlendColor(GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha) const; void glBlendColor(GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha) const;
protected: protected:
~Extensions() {} ~Extensions() {}
typedef void (GL_APIENTRY * GLBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); typedef void (GL_APIENTRY * GLBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
bool _isBlendColorSupported; bool _isBlendColorSupported;
GLBlendColorProc _glBlendColor; GLBlendColorProc _glBlendColor;
}; };
/** Returns the Extensions object for the given context. /** Returns the Extensions object for the given context.
* If createIfNotInitalized is true and the Extensions object doesn't * If createIfNotInitalized is true and the Extensions object doesn't
* exist, getExtensions() creates it on the given context. * exist, getExtensions() creates it on the given context.

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -53,7 +53,7 @@ class OSG_EXPORT BlendEquation : public StateAttribute
}; };
BlendEquation(); BlendEquation();
BlendEquation(Equation equation); BlendEquation(Equation equation);
BlendEquation(Equation equationRGB, Equation equationAlpha); BlendEquation(Equation equationRGB, Equation equationAlpha);
@ -65,7 +65,7 @@ class OSG_EXPORT BlendEquation : public StateAttribute
_equationAlpha(trans._equationAlpha){} _equationAlpha(trans._equationAlpha){}
META_StateAttribute(osg, BlendEquation,BLENDEQUATION); META_StateAttribute(osg, BlendEquation,BLENDEQUATION);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -99,30 +99,30 @@ class OSG_EXPORT BlendEquation : public StateAttribute
virtual void apply(State& state) const; virtual void apply(State& state) const;
/** Encapsulates queries of extension availability, obtains extension /** Encapsulates queries of extension availability, obtains extension
* function pointers, and provides convenience wrappers for * function pointers, and provides convenience wrappers for
* calling extension functions. */ * calling extension functions. */
class OSG_EXPORT Extensions : public osg::Referenced class OSG_EXPORT Extensions : public osg::Referenced
{ {
public: public:
Extensions(unsigned int contextID); Extensions(unsigned int contextID);
Extensions(const Extensions& rhs); Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs); void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID); void setupGLExtensions(unsigned int contextID);
bool isBlendEquationSupported() const { return _isBlendEquationSupported; } bool isBlendEquationSupported() const { return _isBlendEquationSupported; }
bool isBlendEquationSeparateSupported() const { return _isBlendEquationSeparateSupported; } bool isBlendEquationSeparateSupported() const { return _isBlendEquationSeparateSupported; }
bool isSGIXMinMaxSupported() const { return _isSGIXMinMaxSupported; } bool isSGIXMinMaxSupported() const { return _isSGIXMinMaxSupported; }
bool isLogicOpSupported() const { return _isLogicOpSupported; } bool isLogicOpSupported() const { return _isLogicOpSupported; }
void glBlendEquation(GLenum mode) const; void glBlendEquation(GLenum mode) const;
void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) const; void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) const;
protected: protected:
~Extensions() {} ~Extensions() {}
typedef void (GL_APIENTRY * GLBlendEquationProc)(GLenum mode); typedef void (GL_APIENTRY * GLBlendEquationProc)(GLenum mode);
typedef void (GL_APIENTRY * GLBlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); typedef void (GL_APIENTRY * GLBlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha);
@ -130,11 +130,11 @@ class OSG_EXPORT BlendEquation : public StateAttribute
bool _isBlendEquationSeparateSupported; bool _isBlendEquationSeparateSupported;
bool _isSGIXMinMaxSupported; bool _isSGIXMinMaxSupported;
bool _isLogicOpSupported; bool _isLogicOpSupported;
GLBlendEquationProc _glBlendEquation; GLBlendEquationProc _glBlendEquation;
GLBlendEquationSeparateProc _glBlendEquationSeparate; GLBlendEquationSeparateProc _glBlendEquationSeparate;
}; };
/** Returns the Extensions object for the given context. /** Returns the Extensions object for the given context.
* If createIfNotInitalized is true and the Extensions object doesn't * If createIfNotInitalized is true and the Extensions object doesn't
* exist, getExtensions() creates it on the given context. * exist, getExtensions() creates it on the given context.

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -68,7 +68,7 @@ class OSG_EXPORT BlendFunc : public StateAttribute
public : public :
BlendFunc(); BlendFunc();
BlendFunc(GLenum source, GLenum destination); BlendFunc(GLenum source, GLenum destination);
BlendFunc(GLenum source, GLenum destination, GLenum source_alpha, GLenum destination_alpha); BlendFunc(GLenum source, GLenum destination, GLenum source_alpha, GLenum destination_alpha);
@ -81,7 +81,7 @@ class OSG_EXPORT BlendFunc : public StateAttribute
_destination_factor_alpha(trans._destination_factor_alpha) {} _destination_factor_alpha(trans._destination_factor_alpha) {}
META_StateAttribute(osg, BlendFunc,BLENDFUNC); META_StateAttribute(osg, BlendFunc,BLENDFUNC);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -146,7 +146,7 @@ class OSG_EXPORT BlendFunc : public StateAttribute
void setSourceAlpha(GLenum source) { _source_factor_alpha = source; } void setSourceAlpha(GLenum source) { _source_factor_alpha = source; }
inline GLenum getSourceAlpha() const { return _source_factor_alpha; } inline GLenum getSourceAlpha() const { return _source_factor_alpha; }
void setDestination(GLenum destination) { _destination_factor = _destination_factor_alpha = destination; } void setDestination(GLenum destination) { _destination_factor = _destination_factor_alpha = destination; }
inline GLenum getDestination() const { return _destination_factor; } inline GLenum getDestination() const { return _destination_factor; }
@ -159,7 +159,7 @@ class OSG_EXPORT BlendFunc : public StateAttribute
virtual void apply(State& state) const; virtual void apply(State& state) const;
/** Encapsulates queries of extension availability, obtains extension /** Encapsulates queries of extension availability, obtains extension
* function pointers, and provides convenience wrappers for * function pointers, and provides convenience wrappers for
* calling extension functions. */ * calling extension functions. */
class OSG_EXPORT Extensions : public osg::Referenced class OSG_EXPORT Extensions : public osg::Referenced
{ {
public: public:

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -35,7 +35,7 @@ class BoundingBoxImpl
public: public:
typedef VT vec_type; typedef VT vec_type;
typedef typename VT::value_type value_type; typedef typename VT::value_type value_type;
/** Minimum extent. (Smallest X, Y, and Z values of all coordinates.) */ /** Minimum extent. (Smallest X, Y, and Z values of all coordinates.) */
vec_type _min; vec_type _min;
/** Maximum extent. (Greatest X, Y, and Z values of all coordinates.) */ /** Maximum extent. (Greatest X, Y, and Z values of all coordinates.) */
@ -50,7 +50,7 @@ class BoundingBoxImpl
-FLT_MAX, -FLT_MAX,
-FLT_MAX) -FLT_MAX)
{} {}
/** Creates a bounding box initialized to the given extents. */ /** Creates a bounding box initialized to the given extents. */
inline BoundingBoxImpl(value_type xmin, value_type ymin, value_type zmin, inline BoundingBoxImpl(value_type xmin, value_type ymin, value_type zmin,
value_type xmax, value_type ymax, value_type zmax) : value_type xmax, value_type ymax, value_type zmax) :
@ -58,7 +58,7 @@ class BoundingBoxImpl
_max(xmax,ymax,zmax) {} _max(xmax,ymax,zmax) {}
/** Creates a bounding box initialized to the given extents. */ /** Creates a bounding box initialized to the given extents. */
inline BoundingBoxImpl(const vec_type& min,const vec_type& max) : inline BoundingBoxImpl(const vec_type& min,const vec_type& max) :
_min(min), _min(min),
_max(max) {} _max(max) {}
@ -72,8 +72,8 @@ class BoundingBoxImpl
-FLT_MAX, -FLT_MAX,
-FLT_MAX); -FLT_MAX);
} }
/** Returns true if the bounding box extents are valid, false otherwise. */ /** Returns true if the bounding box extents are valid, false otherwise. */
inline bool valid() const inline bool valid() const
{ {
return _max.x()>=_min.x() && _max.y()>=_min.y() && _max.z()>=_min.z(); return _max.x()>=_min.x() && _max.y()>=_min.y() && _max.z()>=_min.z();
@ -97,19 +97,19 @@ class BoundingBoxImpl
inline value_type& xMin() { return _min.x(); } inline value_type& xMin() { return _min.x(); }
inline value_type xMin() const { return _min.x(); } inline value_type xMin() const { return _min.x(); }
inline value_type& yMin() { return _min.y(); } inline value_type& yMin() { return _min.y(); }
inline value_type yMin() const { return _min.y(); } inline value_type yMin() const { return _min.y(); }
inline value_type& zMin() { return _min.z(); } inline value_type& zMin() { return _min.z(); }
inline value_type zMin() const { return _min.z(); } inline value_type zMin() const { return _min.z(); }
inline value_type& xMax() { return _max.x(); } inline value_type& xMax() { return _max.x(); }
inline value_type xMax() const { return _max.x(); } inline value_type xMax() const { return _max.x(); }
inline value_type& yMax() { return _max.y(); } inline value_type& yMax() { return _max.y(); }
inline value_type yMax() const { return _max.y(); } inline value_type yMax() const { return _max.y(); }
inline value_type& zMax() { return _max.z(); } inline value_type& zMax() { return _max.z(); }
inline value_type zMax() const { return _max.z(); } inline value_type zMax() const { return _max.z(); }
@ -202,7 +202,7 @@ class BoundingBoxImpl
if(sh._center.z()-sh._radius<_min.z()) _min.z() = sh._center.z()-sh._radius; if(sh._center.z()-sh._radius<_min.z()) _min.z() = sh._center.z()-sh._radius;
if(sh._center.z()+sh._radius>_max.z()) _max.z() = sh._center.z()+sh._radius; if(sh._center.z()+sh._radius>_max.z()) _max.z() = sh._center.z()+sh._radius;
} }
/** Returns the intersection of this bounding box and the specified bounding box. */ /** Returns the intersection of this bounding box and the specified bounding box. */
BoundingBoxImpl intersect(const BoundingBoxImpl& bb) const BoundingBoxImpl intersect(const BoundingBoxImpl& bb) const
@ -222,7 +222,7 @@ class BoundingBoxImpl
/** Returns true if this bounding box contains the specified coordinate. */ /** Returns true if this bounding box contains the specified coordinate. */
inline bool contains(const vec_type& v) const inline bool contains(const vec_type& v) const
{ {
return valid() && return valid() &&
(v.x()>=_min.x() && v.x()<=_max.x()) && (v.x()>=_min.x() && v.x()<=_max.x()) &&
(v.y()>=_min.y() && v.y()<=_max.y()) && (v.y()>=_min.y() && v.y()<=_max.y()) &&
(v.z()>=_min.z() && v.z()<=_max.z()); (v.z()>=_min.z() && v.z()<=_max.z());

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -35,14 +35,14 @@ class BoundingSphereImpl
{ {
public: public:
typedef VT vec_type; typedef VT vec_type;
typedef typename VT::value_type value_type; typedef typename VT::value_type value_type;
vec_type _center; vec_type _center;
value_type _radius; value_type _radius;
/** Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.*/ /** Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.*/
BoundingSphereImpl() : _center(0.0,0.0,0.0),_radius(-1.0) {} BoundingSphereImpl() : _center(0.0,0.0,0.0),_radius(-1.0) {}
/** Creates a bounding sphere initialized to the given extents. */ /** Creates a bounding sphere initialized to the given extents. */
BoundingSphereImpl(const vec_type& center, value_type radius) : _center(center),_radius(radius) {} BoundingSphereImpl(const vec_type& center, value_type radius) : _center(center),_radius(radius) {}
@ -63,7 +63,7 @@ class BoundingSphereImpl
* otherwise. */ * otherwise. */
inline bool valid() const { return _radius>=0.0; } inline bool valid() const { return _radius>=0.0; }
/** Set the bounding sphere to the given center/radius using floats. */ /** Set the bounding sphere to the given center/radius using floats. */
inline void set(const vec_type& center,value_type radius) inline void set(const vec_type& center,value_type radius)
{ {
_center = center; _center = center;
@ -72,7 +72,7 @@ class BoundingSphereImpl
/** Returns the center of the bounding sphere. */ /** Returns the center of the bounding sphere. */
inline vec_type& center() { return _center; } inline vec_type& center() { return _center; }
/** Returns the const center of the bounding sphere. */ /** Returns the const center of the bounding sphere. */
inline const vec_type& center() const { return _center; } inline const vec_type& center() const { return _center; }
@ -80,7 +80,7 @@ class BoundingSphereImpl
inline value_type& radius() { return _radius; } inline value_type& radius() { return _radius; }
/** Returns the const radius of the bounding sphere. */ /** Returns the const radius of the bounding sphere. */
inline value_type radius() const { return _radius; } inline value_type radius() const { return _radius; }
/** Returns the squared length of the radius. Note, For performance /** Returns the squared length of the radius. Note, For performance
* reasons, the calling method is responsible for checking to make * reasons, the calling method is responsible for checking to make
* sure the sphere is valid. */ * sure the sphere is valid. */
@ -130,7 +130,7 @@ class BoundingSphereImpl
return valid() && bs.valid() && return valid() && bs.valid() &&
((_center - bs._center).length2() <= (_radius + bs._radius)*(_radius + bs._radius)); ((_center - bs._center).length2() <= (_radius + bs._radius)*(_radius + bs._radius));
} }
}; };
@ -187,26 +187,26 @@ void BoundingSphereImpl<VT>::expandBy(const BoundingSphereImpl& sh)
return; return;
} }
// Calculate d == The distance between the sphere centers // Calculate d == The distance between the sphere centers
double d = ( _center - sh.center() ).length(); double d = ( _center - sh.center() ).length();
// New sphere is already inside this one // New sphere is already inside this one
if ( d + sh.radius() <= _radius ) if ( d + sh.radius() <= _radius )
{ {
return; return;
} }
// New sphere completely contains this one // New sphere completely contains this one
if ( d + _radius <= sh.radius() ) if ( d + _radius <= sh.radius() )
{ {
_center = sh._center; _center = sh._center;
_radius = sh._radius; _radius = sh._radius;
return; return;
} }
// Build a new sphere that completely contains the other two: // Build a new sphere that completely contains the other two:
// //
// The center point lies halfway along the line between the furthest // The center point lies halfway along the line between the furthest
@ -243,7 +243,7 @@ void BoundingSphereImpl<VT>::expandRadiusBy(const BoundingSphereImpl& sh)
} }
} }
template<typename VT> template<typename VT>
void BoundingSphereImpl<VT>::expandBy(const BoundingBoxImpl<VT>& bb) void BoundingSphereImpl<VT>::expandBy(const BoundingBoxImpl<VT>& bb)
{ {
if (bb.valid()) if (bb.valid())
@ -260,10 +260,10 @@ void BoundingSphereImpl<VT>::expandBy(const BoundingBoxImpl<VT>& bb)
v += _center; // move to absolute position. v += _center; // move to absolute position.
newbb.expandBy(v); // add it into the new bounding box. newbb.expandBy(v); // add it into the new bounding box.
} }
_center = newbb.center(); _center = newbb.center();
_radius = newbb.radius(); _radius = newbb.radius();
} }
else else
{ {
@ -299,7 +299,7 @@ typedef BoundingSphereImpl<Vec3d> BoundingSphered;
#ifdef OSG_USE_FLOAT_BOUNDINGSPHERE #ifdef OSG_USE_FLOAT_BOUNDINGSPHERE
typedef BoundingSpheref BoundingSphere; typedef BoundingSpheref BoundingSphere;
#else #else
typedef BoundingSphered BoundingSphere; typedef BoundingSphered BoundingSphere;
#endif #endif
} }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -64,7 +64,7 @@ inline void clampBetweenRange(T& value,const T minValue,const T maxValue,const c
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
value = maxValue; value = maxValue;
} }
} }
/** If value[i] is greater than or equal to minValue do nothing - legal value, /** If value[i] is greater than or equal to minValue do nothing - legal value,
@ -112,7 +112,7 @@ inline void clampArrayElementBetweenRange(A& value,unsigned int i,const T minVal
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
value[i] = maxValue; value[i] = maxValue;
} }
} }
/** For each element of value[] in the range (first,last), if the element is /** For each element of value[] in the range (first,last), if the element is
@ -145,7 +145,7 @@ template <typename A, typename T>
inline void clampArrayElementsBetweenRange(A& value,unsigned int first,unsigned int last,const T minValue,const T maxValue,const char* valueName) inline void clampArrayElementsBetweenRange(A& value,unsigned int first,unsigned int last,const T minValue,const T maxValue,const char* valueName)
{ {
for(unsigned int i=first;i<=last;++i) for(unsigned int i=first;i<=last;++i)
clampArrayElementBetweenRange(value,i,minValue,maxValue,valueName); clampArrayElementBetweenRange(value,i,minValue,maxValue,valueName);
} }

View File

@ -1,14 +1,14 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2010 Tim Moore * Copyright (C) 2010 Tim Moore
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -45,7 +45,7 @@ class OSG_EXPORT BufferIndexBinding : public StateAttribute
// the State class. Using the index target, we can seperately // the State class. Using the index target, we can seperately
// track the bindings for many different index targets. // track the bindings for many different index targets.
virtual unsigned getMember() const { return static_cast<unsigned int>(_index); } virtual unsigned getMember() const { return static_cast<unsigned int>(_index); }
GLenum getTarget() const { return _target; } GLenum getTarget() const { return _target; }
/** Get the index target. /** Get the index target.
*/ */

View File

@ -4,7 +4,7 @@
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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
@ -27,7 +27,7 @@
#if (defined(GL_VERSION_ES_CM_1_0) && GL_VERSION_ES_CM_1_0 > 0) || \ #if (defined(GL_VERSION_ES_CM_1_0) && GL_VERSION_ES_CM_1_0 > 0) || \
(defined(GL_VERSION_ES_CM_1_1) && GL_VERSION_ES_CM_1_1 > 0) (defined(GL_VERSION_ES_CM_1_1) && GL_VERSION_ES_CM_1_1 > 0)
#define OPENGLES_1_1_FOUND 1 #define OPENGLES_1_1_FOUND 1
#endif #endif
@ -50,10 +50,10 @@
#ifndef GL_ARB_vertex_buffer_object #ifndef GL_ARB_vertex_buffer_object
#define GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object
typedef GLintptr GLintptrARB; typedef GLintptr GLintptrARB;
typedef GLsizeiptr GLsizeiptrARB; typedef GLsizeiptr GLsizeiptrARB;
#define GL_ARRAY_BUFFER_ARB 0x8892 #define GL_ARRAY_BUFFER_ARB 0x8892
#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 #define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
@ -114,7 +114,7 @@
#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF #define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
#endif #endif
namespace osg namespace osg
{ {
class State; class State;
@ -226,7 +226,7 @@ class OSG_EXPORT GLBufferObject : public Referenced
inline void bindBuffer(); inline void bindBuffer();
inline void unbindBuffer() inline void unbindBuffer()
{ {
_extensions->glBindBuffer(_profile._target,0); _extensions->glBindBuffer(_profile._target,0);
} }
@ -321,9 +321,9 @@ class OSG_EXPORT GLBufferObject : public Referenced
}; };
/** Function to call to get the extension of a specified context. /** Function to call to get the extension of a specified context.
* If the Extension object for that context has not yet been created * If the Extension object for that context has not yet been created
* and the 'createIfNotInitalized' flag been set to false then returns NULL. * and the 'createIfNotInitalized' flag been set to false then returns NULL.
* If 'createIfNotInitalized' is true then the Extensions object is * If 'createIfNotInitalized' is true then the Extensions object is
* automatically created. However, in this case the extension object is * automatically created. However, in this case the extension object is
* only created with the graphics context associated with ContextID..*/ * only created with the graphics context associated with ContextID..*/
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
@ -723,7 +723,7 @@ class OSG_EXPORT ElementBufferObject : public BufferObject
ElementBufferObject(const ElementBufferObject& pbo,const CopyOp& copyop=CopyOp::SHALLOW_COPY); ElementBufferObject(const ElementBufferObject& pbo,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Object(osg,ElementBufferObject); META_Object(osg,ElementBufferObject);
unsigned int addDrawElements(osg::DrawElements* PrimitiveSet); unsigned int addDrawElements(osg::DrawElements* PrimitiveSet);
void removeDrawElements(osg::DrawElements* PrimitiveSet); void removeDrawElements(osg::DrawElements* PrimitiveSet);
@ -732,7 +732,7 @@ class OSG_EXPORT ElementBufferObject : public BufferObject
const DrawElements* getDrawElements(unsigned int i) const; const DrawElements* getDrawElements(unsigned int i) const;
protected: protected:
virtual ~ElementBufferObject(); virtual ~ElementBufferObject();
}; };
@ -756,7 +756,7 @@ class OSG_EXPORT PixelBufferObject : public BufferObject
bool isPBOSupported(unsigned int contextID) const { return _glBufferObjects[contextID]->isPBOSupported(); } bool isPBOSupported(unsigned int contextID) const { return _glBufferObjects[contextID]->isPBOSupported(); }
protected: protected:
virtual ~PixelBufferObject(); virtual ~PixelBufferObject();
}; };
@ -777,7 +777,7 @@ class OSG_EXPORT PixelDataBufferObject : public BufferObject
//! Set new size of the buffer object. This will reallocate the memory on the next compile //! Set new size of the buffer object. This will reallocate the memory on the next compile
inline void setDataSize(unsigned int size) { _profile._size = size; dirty(); } inline void setDataSize(unsigned int size) { _profile._size = size; dirty(); }
//! Get data size of the used buffer //! Get data size of the used buffer
inline unsigned int getDataSize() const { return _profile._size; } inline unsigned int getDataSize() const { return _profile._size; }
//! Compile the buffer (reallocate the memory if buffer is dirty) //! Compile the buffer (reallocate the memory if buffer is dirty)
@ -789,7 +789,7 @@ class OSG_EXPORT PixelDataBufferObject : public BufferObject
//! Bind the buffer in write mode, which means following OpenGL instructions will write data into the buffer (note: GL_PIXEL_PACK_BUFFER_ARB) //! Bind the buffer in write mode, which means following OpenGL instructions will write data into the buffer (note: GL_PIXEL_PACK_BUFFER_ARB)
virtual void bindBufferInWriteMode(State& state); virtual void bindBufferInWriteMode(State& state);
//! Unbind the buffer //! Unbind the buffer
virtual void unbindBuffer(unsigned int contextID) const; virtual void unbindBuffer(unsigned int contextID) const;
/** Resize any per context GLObject buffers to specified size. */ /** Resize any per context GLObject buffers to specified size. */
@ -814,9 +814,9 @@ class OSG_EXPORT PixelDataBufferObject : public BufferObject
virtual ~PixelDataBufferObject(); virtual ~PixelDataBufferObject();
typedef osg::buffered_value<unsigned int> ModeList; typedef osg::buffered_value<unsigned int> ModeList;
mutable ModeList _mode; mutable ModeList _mode;
}; };
class OSG_EXPORT UniformBufferObject : public BufferObject class OSG_EXPORT UniformBufferObject : public BufferObject

View File

@ -58,7 +58,7 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
const View* getView() const { return _view; } const View* getView() const { return _view; }
/** Set the Stats object used for collect various frame related /** Set the Stats object used for collect various frame related
* timing and scene graph stats. */ * timing and scene graph stats. */
void setStats(osg::Stats* stats) { _stats = stats; } void setStats(osg::Stats* stats) { _stats = stats; }
@ -69,7 +69,7 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
const osg::Stats* getStats() const { return _stats.get(); } const osg::Stats* getStats() const { return _stats.get(); }
/** Set whether this camera allows events to be generated by the /** Set whether this camera allows events to be generated by the
* associated graphics window to be associated with this camera. */ * associated graphics window to be associated with this camera. */
void setAllowEventFocus(bool focus) { _allowEventFocus = focus; } void setAllowEventFocus(bool focus) { _allowEventFocus = focus; }
@ -421,14 +421,14 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
Camera defaults are USE_DISPLAY_SETTINGS_MASK which means that by default Camera defaults are USE_DISPLAY_SETTINGS_MASK which means that by default
Camera chooses to substitue buffer attachments as defined by DisplaySettings. Camera chooses to substitue buffer attachments as defined by DisplaySettings.
Usually DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR Usually DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR
for both primary (Render) FBO and seconday Multisample (Resolve) FBO for both primary (Render) FBO and seconday Multisample (Resolve) FBO
ie: IMPLICT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT ie: IMPLICT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT
If these masks are not changed and user did not attach depth buffer and/or color buffer If these masks are not changed and user did not attach depth buffer and/or color buffer
to Camera, then OSG implicitly substitues these buffers. to Camera, then OSG implicitly substitues these buffers.
By default it does not implicitly allocate a stencil buffer. By default it does not implicitly allocate a stencil buffer.
Use implicti buffer attachment masks to override default behavior: Use implicti buffer attachment masks to override default behavior:
to turn off DEPTH or COLOR buffer substitution or to enforce STENCIL buffer substitution. to turn off DEPTH or COLOR buffer substitution or to enforce STENCIL buffer substitution.
Note that both values are ignored if not using FBO. Note that both values are ignored if not using FBO.
@ -460,13 +460,13 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
_implicitBufferAttachmentResolveMask = implicitBufferAttachmentResolveMask; _implicitBufferAttachmentResolveMask = implicitBufferAttachmentResolveMask;
} }
/** /**
Get mask selecting implict buffer attachments for Camera primary FBO Get mask selecting implict buffer attachments for Camera primary FBO
if effectiveMask parameter is set, method follows USE_DISPLAY_SETTINGS_MASK dependence and returns effective mask if effectiveMask parameter is set, method follows USE_DISPLAY_SETTINGS_MASK dependence and returns effective mask
if effectiveMask parameter is reset, method returns nominal mask set by the Camera if effectiveMask parameter is reset, method returns nominal mask set by the Camera
*/ */
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask(bool effectiveMask = false) const ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask(bool effectiveMask = false) const
{ {
if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK ) if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK )
{ {
const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get(); const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get();
@ -478,13 +478,13 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
} }
} }
/** /**
Get mask selecting implict buffer attachments for Camera secondary MULTISAMPLE FBO Get mask selecting implict buffer attachments for Camera secondary MULTISAMPLE FBO
if effectiveMask parameter is set, method follows USE_DISPLAY_SETTINGS_MASK dependence and returns effective mask if effectiveMask parameter is set, method follows USE_DISPLAY_SETTINGS_MASK dependence and returns effective mask
if effectiveMask parameter is reset, method returns nominal mask set by the Camera if effectiveMask parameter is reset, method returns nominal mask set by the Camera
*/ */
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask(bool effectiveMask = false) const ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask(bool effectiveMask = false) const
{ {
if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK ) if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK )
{ {
const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get(); const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get();

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -38,7 +38,7 @@ class OSG_EXPORT CameraView : public Transform
_fieldOfView(pat._fieldOfView), _fieldOfView(pat._fieldOfView),
_fieldOfViewMode(pat._fieldOfViewMode), _fieldOfViewMode(pat._fieldOfViewMode),
_focalLength(pat._focalLength) {} _focalLength(pat._focalLength) {}
META_Node(osg, CameraView); META_Node(osg, CameraView);
@ -62,7 +62,7 @@ class OSG_EXPORT CameraView : public Transform
/** Get the field of view.*/ /** Get the field of view.*/
inline double getFieldOfView() const { return _fieldOfView; } inline double getFieldOfView() const { return _fieldOfView; }
enum FieldOfViewMode enum FieldOfViewMode
{ {
UNCONSTRAINED, UNCONSTRAINED,
@ -83,14 +83,14 @@ class OSG_EXPORT CameraView : public Transform
/** Get the focal length of the camera.*/ /** Get the focal length of the camera.*/
inline double getFocalLength() const { return _focalLength; } inline double getFocalLength() const { return _focalLength; }
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const; virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const;
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const;
protected : protected :
virtual ~CameraView() {} virtual ~CameraView() {}
Vec3d _position; Vec3d _position;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -44,7 +44,7 @@ class OSG_EXPORT ClampColor : public StateAttribute
public : public :
ClampColor(); ClampColor();
ClampColor(GLenum vertexMode, GLenum fragmentMode, GLenum readMode); ClampColor(GLenum vertexMode, GLenum fragmentMode, GLenum readMode);
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
@ -55,7 +55,7 @@ class OSG_EXPORT ClampColor : public StateAttribute
_clampReadColor(rhs._clampReadColor) {} _clampReadColor(rhs._clampReadColor) {}
META_StateAttribute(osg, ClampColor,CLAMPCOLOR); META_StateAttribute(osg, ClampColor,CLAMPCOLOR);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -80,37 +80,37 @@ class OSG_EXPORT ClampColor : public StateAttribute
void setClampReadColor(GLenum mode) { _clampReadColor = mode; } void setClampReadColor(GLenum mode) { _clampReadColor = mode; }
GLenum getClampReadColor() const { return _clampReadColor; } GLenum getClampReadColor() const { return _clampReadColor; }
virtual void apply(State& state) const; virtual void apply(State& state) const;
/** Encapsulates queries of extension availability, obtains extension /** Encapsulates queries of extension availability, obtains extension
* function pointers, and provides convenience wrappers for * function pointers, and provides convenience wrappers for
* calling extension functions. */ * calling extension functions. */
class OSG_EXPORT Extensions : public osg::Referenced class OSG_EXPORT Extensions : public osg::Referenced
{ {
public: public:
Extensions(unsigned int contextID); Extensions(unsigned int contextID);
Extensions(const Extensions& rhs); Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs); void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID); void setupGLExtensions(unsigned int contextID);
void setClampColorSupported(bool flag) { _isClampColorSupported=flag; } void setClampColorSupported(bool flag) { _isClampColorSupported=flag; }
bool isClampColorSupported() const { return _isClampColorSupported; } bool isClampColorSupported() const { return _isClampColorSupported; }
void glClampColor(GLenum target, GLenum mode) const; void glClampColor(GLenum target, GLenum mode) const;
protected: protected:
~Extensions() {} ~Extensions() {}
typedef void (GL_APIENTRY * GLClampColorProc) (GLenum target, GLenum mode); typedef void (GL_APIENTRY * GLClampColorProc) (GLenum target, GLenum mode);
bool _isClampColorSupported; bool _isClampColorSupported;
GLClampColorProc _glClampColor; GLClampColorProc _glClampColor;
}; };
/** Returns the Extensions object for the given context. /** Returns the Extensions object for the given context.
* If createIfNotInitalized is true and the Extensions object doesn't * If createIfNotInitalized is true and the Extensions object doesn't
* exist, getExtensions() creates it on the given context. * exist, getExtensions() creates it on the given context.

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -30,14 +30,14 @@ namespace osg {
class OSG_EXPORT ClearNode : public Group class OSG_EXPORT ClearNode : public Group
{ {
public : public :
ClearNode(); ClearNode();
ClearNode(const ClearNode& cs, const CopyOp& copyop=CopyOp::SHALLOW_COPY): ClearNode(const ClearNode& cs, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
Group(cs,copyop), Group(cs,copyop),
_requiresClear(cs._requiresClear), _requiresClear(cs._requiresClear),
_clearColor(cs._clearColor), _clearColor(cs._clearColor),
_clearMask(cs._clearMask) {} _clearMask(cs._clearMask) {}
META_Node(osg, ClearNode); META_Node(osg, ClearNode);
@ -53,7 +53,7 @@ class OSG_EXPORT ClearNode : public Group
/** Returns the clear color. */ /** Returns the clear color. */
inline const Vec4& getClearColor() const { return _clearColor; } inline const Vec4& getClearColor() const { return _clearColor; }
/** Set the clear mask used in glClear(..). /** Set the clear mask used in glClear(..).
* Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */ * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */
inline void setClearMask(GLbitfield mask) { _clearMask = mask; } inline void setClearMask(GLbitfield mask) { _clearMask = mask; }
@ -62,9 +62,9 @@ class OSG_EXPORT ClearNode : public Group
inline GLbitfield getClearMask() const { return _clearMask; } inline GLbitfield getClearMask() const { return _clearMask; }
protected : protected :
virtual ~ClearNode() {} virtual ~ClearNode() {}
bool _requiresClear; bool _requiresClear;
Vec4 _clearColor; Vec4 _clearColor;
GLbitfield _clearMask; GLbitfield _clearMask;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -33,13 +33,13 @@ class OSG_EXPORT ClipNode : public Group
ClipNode(const ClipNode& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY); ClipNode(const ClipNode& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, ClipNode); META_Node(osg, ClipNode);
enum ReferenceFrame enum ReferenceFrame
{ {
RELATIVE_RF, RELATIVE_RF,
ABSOLUTE_RF ABSOLUTE_RF
}; };
/** Set the ClipNode's ReferenceFrame, either to be relative to its /** Set the ClipNode's ReferenceFrame, either to be relative to its
* parent reference frame, or relative to an absolute coordinate * parent reference frame, or relative to an absolute coordinate
* frame. RELATIVE_RF is the default. * frame. RELATIVE_RF is the default.
@ -52,7 +52,7 @@ class OSG_EXPORT ClipNode : public Group
* absolute ClipNode at the top of the scene. * absolute ClipNode at the top of the scene.
*/ */
void setReferenceFrame(ReferenceFrame rf); void setReferenceFrame(ReferenceFrame rf);
ReferenceFrame getReferenceFrame() const { return _referenceFrame; } ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
@ -104,7 +104,7 @@ class OSG_EXPORT ClipNode : public Group
StateAttribute::GLModeValue _value; StateAttribute::GLModeValue _value;
ClipPlaneList _planes; ClipPlaneList _planes;
ReferenceFrame _referenceFrame; ReferenceFrame _referenceFrame;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -51,14 +51,14 @@ class OSG_EXPORT ClipPlane : public StateAttribute
_clipPlane[3]=cp._clipPlane[3]; _clipPlane[3]=cp._clipPlane[3];
_clipPlaneNum=cp._clipPlaneNum; _clipPlaneNum=cp._clipPlaneNum;
} }
virtual osg::Object* cloneType() const { return new ClipPlane( _clipPlaneNum ); } virtual osg::Object* cloneType() const { return new ClipPlane( _clipPlaneNum ); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new ClipPlane(*this,copyop); } virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new ClipPlane(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const ClipPlane *>(obj)!=NULL; } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const ClipPlane *>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "ClipPlane"; } virtual const char* className() const { return "ClipPlane"; }
virtual Type getType() const { return CLIPPLANE; } virtual Type getType() const { return CLIPPLANE; }
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -86,7 +86,7 @@ class OSG_EXPORT ClipPlane : public StateAttribute
/** Set the clip plane with the given Plane. */ /** Set the clip plane with the given Plane. */
void setClipPlane(const Plane& plane) void setClipPlane(const Plane& plane)
{ {
_clipPlane.set(plane[0],plane[1],plane[2],plane[3]); _clipPlane.set(plane[0],plane[1],plane[2],plane[3]);
} }
@ -114,9 +114,9 @@ class OSG_EXPORT ClipPlane : public StateAttribute
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected : protected :
virtual ~ClipPlane(); virtual ~ClipPlane();
Vec4d _clipPlane; Vec4d _clipPlane;
unsigned int _clipPlaneNum; unsigned int _clipPlaneNum;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -36,7 +36,7 @@ class OSG_EXPORT ClusterCullingCallback : public Drawable::CullCallback, public
/** Computes the control point, normal, and deviation from the /** Computes the control point, normal, and deviation from the
* given drawable contents. */ * given drawable contents. */
void computeFrom(const osg::Drawable* drawable); void computeFrom(const osg::Drawable* drawable);
/** Transform the ClusterCullingCallback's positional members to a new coordinate frame.*/ /** Transform the ClusterCullingCallback's positional members to a new coordinate frame.*/
void transform(const osg::Matrixd& matrix); void transform(const osg::Matrixd& matrix);

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -39,7 +39,7 @@ class OSG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::
virtual float getDistanceToEyePoint(const Vec3& pos, bool withLODScale) const; virtual float getDistanceToEyePoint(const Vec3& pos, bool withLODScale) const;
virtual float getDistanceToViewPoint(const Vec3& pos, bool withLODScale) const; virtual float getDistanceToViewPoint(const Vec3& pos, bool withLODScale) const;
virtual float getDistanceFromEyePoint(const Vec3& pos, bool withLODScale) const; virtual float getDistanceFromEyePoint(const Vec3& pos, bool withLODScale) const;
virtual void apply(osg::Node&); virtual void apply(osg::Node&);
@ -81,7 +81,7 @@ class OSG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::
/** Prevents unwanted copy operator. */ /** Prevents unwanted copy operator. */
CollectOccludersVisitor& operator = (const CollectOccludersVisitor&) { return *this; } CollectOccludersVisitor& operator = (const CollectOccludersVisitor&) { return *this; }
inline void handle_cull_callbacks_and_traverse(osg::Node& node) inline void handle_cull_callbacks_and_traverse(osg::Node& node)
{ {
/*osg::NodeCallback* callback = node.getCullCallback(); /*osg::NodeCallback* callback = node.getCullCallback();

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -20,12 +20,12 @@
namespace osg { namespace osg {
/** Encapsulates OpenGL glColorMaskFunc/Op/Mask functions. /** Encapsulates OpenGL glColorMaskFunc/Op/Mask functions.
*/ */
class OSG_EXPORT ColorMask : public StateAttribute class OSG_EXPORT ColorMask : public StateAttribute
{ {
public : public :
ColorMask(); ColorMask();
ColorMask(bool red,bool green,bool blue,bool alpha): ColorMask(bool red,bool green,bool blue,bool alpha):
@ -33,7 +33,7 @@ class OSG_EXPORT ColorMask : public StateAttribute
_green(green), _green(green),
_blue(blue), _blue(blue),
_alpha(alpha) {} _alpha(alpha) {}
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
ColorMask(const ColorMask& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY): ColorMask(const ColorMask& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
@ -42,9 +42,9 @@ class OSG_EXPORT ColorMask : public StateAttribute
_green(cm._green), _green(cm._green),
_blue(cm._blue), _blue(cm._blue),
_alpha(cm._alpha) {} _alpha(cm._alpha) {}
META_StateAttribute(osg, ColorMask, COLORMASK); META_StateAttribute(osg, ColorMask, COLORMASK);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -67,9 +67,9 @@ class OSG_EXPORT ColorMask : public StateAttribute
_green = green; _green = green;
_blue = blue; _blue = blue;
_alpha = alpha; _alpha = alpha;
} }
inline void setRedMask(bool mask) { _red=mask; } inline void setRedMask(bool mask) { _red=mask; }
inline bool getRedMask() const { return _red; } inline bool getRedMask() const { return _red; }
@ -78,14 +78,14 @@ class OSG_EXPORT ColorMask : public StateAttribute
inline void setBlueMask(bool mask) { _blue=mask; } inline void setBlueMask(bool mask) { _blue=mask; }
inline bool getBlueMask() const { return _blue; } inline bool getBlueMask() const { return _blue; }
inline void setAlphaMask(bool mask) { _alpha=mask; } inline void setAlphaMask(bool mask) { _alpha=mask; }
inline bool getAlphaMask() const { return _alpha; } inline bool getAlphaMask() const { return _alpha; }
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected: protected:
virtual ~ColorMask(); virtual ~ColorMask();
bool _red; bool _red;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -23,7 +23,7 @@ namespace osg {
class OSG_EXPORT ColorMatrix : public StateAttribute class OSG_EXPORT ColorMatrix : public StateAttribute
{ {
public : public :
ColorMatrix(); ColorMatrix();
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
@ -32,7 +32,7 @@ class OSG_EXPORT ColorMatrix : public StateAttribute
_matrix(cm._matrix) {} _matrix(cm._matrix) {}
META_StateAttribute(osg, ColorMatrix, COLORMATRIX); META_StateAttribute(osg, ColorMatrix, COLORMATRIX);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -25,31 +25,31 @@ class OSG_EXPORT ComputeBoundsVisitor : public osg::NodeVisitor
public: public:
ComputeBoundsVisitor(TraversalMode traversalMode = TRAVERSE_ALL_CHILDREN); ComputeBoundsVisitor(TraversalMode traversalMode = TRAVERSE_ALL_CHILDREN);
META_NodeVisitor("osg","ComputeBoundsVisitor") META_NodeVisitor("osg","ComputeBoundsVisitor")
virtual void reset(); virtual void reset();
osg::BoundingBox& getBoundingBox() { return _bb; } osg::BoundingBox& getBoundingBox() { return _bb; }
void getPolytope(osg::Polytope& polytope, float margin=0.1) const; void getPolytope(osg::Polytope& polytope, float margin=0.1) const;
void getBase(osg::Polytope& polytope, float margin=0.1) const; void getBase(osg::Polytope& polytope, float margin=0.1) const;
void apply(osg::Node& node); void apply(osg::Node& node);
void apply(osg::Transform& transform); void apply(osg::Transform& transform);
void apply(osg::Geode& geode); void apply(osg::Geode& geode);
inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); } inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
inline void popMatrix() { _matrixStack.pop_back(); } inline void popMatrix() { _matrixStack.pop_back(); }
void applyDrawable(osg::Drawable* drawable); void applyDrawable(osg::Drawable* drawable);
protected: protected:
typedef std::vector<osg::Matrix> MatrixStack; typedef std::vector<osg::Matrix> MatrixStack;
MatrixStack _matrixStack; MatrixStack _matrixStack;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -32,25 +32,25 @@ class OSG_EXPORT ConvexPlanarOccluder : public Object
Object(cpo,copyop), Object(cpo,copyop),
_occluder(cpo._occluder), _occluder(cpo._occluder),
_holeList(cpo._holeList) {} _holeList(cpo._holeList) {}
META_Object(osg,ConvexPlanarOccluder); META_Object(osg,ConvexPlanarOccluder);
void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; } void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; }
ConvexPlanarPolygon& getOccluder() { return _occluder; } ConvexPlanarPolygon& getOccluder() { return _occluder; }
const ConvexPlanarPolygon& getOccluder() const { return _occluder; } const ConvexPlanarPolygon& getOccluder() const { return _occluder; }
typedef std::vector<ConvexPlanarPolygon> HoleList; typedef std::vector<ConvexPlanarPolygon> HoleList;
void addHole(const ConvexPlanarPolygon& cpp) { _holeList.push_back(cpp); } void addHole(const ConvexPlanarPolygon& cpp) { _holeList.push_back(cpp); }
void setHoleList(const HoleList& holeList) { _holeList=holeList; } void setHoleList(const HoleList& holeList) { _holeList=holeList; }
HoleList& getHoleList() { return _holeList; } HoleList& getHoleList() { return _holeList; }
const HoleList& getHoleList() const { return _holeList; } const HoleList& getHoleList() const { return _holeList; }
protected: protected:
@ -64,4 +64,4 @@ class OSG_EXPORT ConvexPlanarOccluder : public Object
} // end of namespace } // end of namespace
#endif #endif

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -27,17 +27,17 @@ class OSG_EXPORT ConvexPlanarPolygon
public: public:
ConvexPlanarPolygon(); ConvexPlanarPolygon();
typedef std::vector<osg::Vec3> VertexList; typedef std::vector<osg::Vec3> VertexList;
void add(const Vec3& v) { _vertexList.push_back(v); } void add(const Vec3& v) { _vertexList.push_back(v); }
void setVertexList(const VertexList& vertexList) { _vertexList=vertexList; } void setVertexList(const VertexList& vertexList) { _vertexList=vertexList; }
VertexList& getVertexList() { return _vertexList; } VertexList& getVertexList() { return _vertexList; }
const VertexList& getVertexList() const { return _vertexList; } const VertexList& getVertexList() const { return _vertexList; }
protected: protected:
VertexList _vertexList; VertexList _vertexList;
@ -46,4 +46,4 @@ class OSG_EXPORT ConvexPlanarPolygon
} // end of namespace } // end of namespace
#endif #endif

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -24,7 +24,7 @@ const double WGS_84_RADIUS_EQUATOR = 6378137.0;
const double WGS_84_RADIUS_POLAR = 6356752.3142; const double WGS_84_RADIUS_POLAR = 6356752.3142;
/** EllipsoidModel encapsulates the ellipsoid used to model astronomical bodies, /** EllipsoidModel encapsulates the ellipsoid used to model astronomical bodies,
* such as sun, planets, moon etc. * such as sun, planets, moon etc.
* All distance quantities (i.e. heights + radius) are in meters, * All distance quantities (i.e. heights + radius) are in meters,
* and latitude and longitude are in radians.*/ * and latitude and longitude are in radians.*/
class EllipsoidModel : public Object class EllipsoidModel : public Object
@ -87,7 +87,7 @@ class EllipsoidModel : public Object
}; };
/** CoordinateFrame encapsulates the orientation of east, north and up.*/ /** CoordinateFrame encapsulates the orientation of east, north and up.*/
typedef Matrixd CoordinateFrame; typedef Matrixd CoordinateFrame;
/** CoordinateSystem encapsulate the coordinate system that is associated with objects in a scene. /** CoordinateSystem encapsulate the coordinate system that is associated with objects in a scene.
@ -102,45 +102,45 @@ class OSG_EXPORT CoordinateSystemNode : public Group
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
CoordinateSystemNode(const CoordinateSystemNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); CoordinateSystemNode(const CoordinateSystemNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Node(osg,CoordinateSystemNode); META_Node(osg,CoordinateSystemNode);
/** Set the coordinate system node up by copying the format, coordinate system string, and ellipsoid model of another coordinate system node.*/ /** Set the coordinate system node up by copying the format, coordinate system string, and ellipsoid model of another coordinate system node.*/
void set(const CoordinateSystemNode& csn); void set(const CoordinateSystemNode& csn);
/** Set the coordinate system format string. Typical values would be WKT, PROJ4, USGS etc.*/ /** Set the coordinate system format string. Typical values would be WKT, PROJ4, USGS etc.*/
void setFormat(const std::string& format) { _format = format; } void setFormat(const std::string& format) { _format = format; }
/** Get the coordinate system format string.*/ /** Get the coordinate system format string.*/
const std::string& getFormat() const { return _format; } const std::string& getFormat() const { return _format; }
/** Set the CoordinateSystem reference string, should be stored in a form consistent with the Format.*/ /** Set the CoordinateSystem reference string, should be stored in a form consistent with the Format.*/
void setCoordinateSystem(const std::string& cs) { _cs = cs; } void setCoordinateSystem(const std::string& cs) { _cs = cs; }
/** Get the CoordinateSystem reference string.*/ /** Get the CoordinateSystem reference string.*/
const std::string& getCoordinateSystem() const { return _cs; } const std::string& getCoordinateSystem() const { return _cs; }
/** Set EllipsoidModel to describe the model used to map lat, long and height into geocentric XYZ and back. */ /** Set EllipsoidModel to describe the model used to map lat, long and height into geocentric XYZ and back. */
void setEllipsoidModel(EllipsoidModel* ellipsode) { _ellipsoidModel = ellipsode; } void setEllipsoidModel(EllipsoidModel* ellipsode) { _ellipsoidModel = ellipsode; }
/** Get the EllipsoidModel.*/ /** Get the EllipsoidModel.*/
EllipsoidModel* getEllipsoidModel() { return _ellipsoidModel.get(); } EllipsoidModel* getEllipsoidModel() { return _ellipsoidModel.get(); }
/** Get the const EllipsoidModel.*/ /** Get the const EllipsoidModel.*/
const EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); } const EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); }
/** Compute the local coordinate frame for specified point.*/ /** Compute the local coordinate frame for specified point.*/
CoordinateFrame computeLocalCoordinateFrame(const Vec3d& position) const; CoordinateFrame computeLocalCoordinateFrame(const Vec3d& position) const;
/** Compute the local up-vector for specified point.*/ /** Compute the local up-vector for specified point.*/
osg::Vec3d computeLocalUpVector(const Vec3d& position) const; osg::Vec3d computeLocalUpVector(const Vec3d& position) const;
protected: protected:
virtual ~CoordinateSystemNode() {} virtual ~CoordinateSystemNode() {}
std::string _format; std::string _format;
std::string _cs; std::string _cs;
ref_ptr<EllipsoidModel> _ellipsoidModel; ref_ptr<EllipsoidModel> _ellipsoidModel;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -40,7 +40,7 @@ class OSG_EXPORT CopyOp
{ {
public: public:
enum Options enum Options
{ {
SHALLOW_COPY = 0, SHALLOW_COPY = 0,
@ -84,7 +84,7 @@ class OSG_EXPORT CopyOp
virtual StateAttributeCallback* operator() (const StateAttributeCallback* stateattributecallback) const; virtual StateAttributeCallback* operator() (const StateAttributeCallback* stateattributecallback) const;
protected: protected:
CopyFlags _flags; CopyFlags _flags;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -20,17 +20,17 @@
namespace osg { namespace osg {
/** Class to globally enable/disable OpenGL's polygon culling mode. /** Class to globally enable/disable OpenGL's polygon culling mode.
*/ */
class OSG_EXPORT CullFace : public StateAttribute class OSG_EXPORT CullFace : public StateAttribute
{ {
public : public :
enum Mode { enum Mode {
FRONT = GL_FRONT, FRONT = GL_FRONT,
BACK = GL_BACK, BACK = GL_BACK,
FRONT_AND_BACK = GL_FRONT_AND_BACK FRONT_AND_BACK = GL_FRONT_AND_BACK
}; };
CullFace(Mode mode=BACK): CullFace(Mode mode=BACK):
_mode(mode) {} _mode(mode) {}
@ -40,7 +40,7 @@ class OSG_EXPORT CullFace : public StateAttribute
_mode(cf._mode) {} _mode(cf._mode) {}
META_StateAttribute(osg, CullFace, CULLFACE); META_StateAttribute(osg, CullFace, CULLFACE);
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -63,13 +63,13 @@ class OSG_EXPORT CullFace : public StateAttribute
inline void setMode(Mode mode) { _mode = mode; } inline void setMode(Mode mode) { _mode = mode; }
inline Mode getMode() const { return _mode; } inline Mode getMode() const { return _mode; }
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected: protected:
virtual ~CullFace(); virtual ~CullFace();
Mode _mode; Mode _mode;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -44,7 +44,7 @@ class OSG_EXPORT CullSettings
CullSettings(const CullSettings& cs); CullSettings(const CullSettings& cs);
virtual ~CullSettings() {} virtual ~CullSettings() {}
CullSettings& operator = (const CullSettings& settings) CullSettings& operator = (const CullSettings& settings)
{ {
if (this==&settings) return *this; if (this==&settings) return *this;
@ -55,7 +55,7 @@ class OSG_EXPORT CullSettings
virtual void setDefaults(); virtual void setDefaults();
enum VariablesMask enum VariablesMask
{ {
COMPUTE_NEAR_FAR_MODE = (0x1 << 0), COMPUTE_NEAR_FAR_MODE = (0x1 << 0),
@ -89,7 +89,7 @@ class OSG_EXPORT CullSettings
/** Get the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object.*/ /** Get the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object.*/
InheritanceMask getInheritanceMask() const { return _inheritanceMask; } InheritanceMask getInheritanceMask() const { return _inheritanceMask; }
/** Set the local cull settings values from specified CullSettings object.*/ /** Set the local cull settings values from specified CullSettings object.*/
void setCullSettings(const CullSettings& settings); void setCullSettings(const CullSettings& settings);
@ -111,7 +111,7 @@ class OSG_EXPORT CullSettings
DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT, DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT,
DO_NOT_MODIFY_INHERITANCE_MASK DO_NOT_MODIFY_INHERITANCE_MASK
}; };
void setInheritanceMaskActionOnAttributeSetting(InheritanceMaskActionOnAttributeSetting action) { _inheritanceMaskActionOnAttributeSetting = action; } void setInheritanceMaskActionOnAttributeSetting(InheritanceMaskActionOnAttributeSetting action) { _inheritanceMaskActionOnAttributeSetting = action; }
InheritanceMaskActionOnAttributeSetting getInheritanceMaskActionOnAttributeSetting() const { return _inheritanceMaskActionOnAttributeSetting; } InheritanceMaskActionOnAttributeSetting getInheritanceMaskActionOnAttributeSetting() const { return _inheritanceMaskActionOnAttributeSetting; }
@ -165,8 +165,8 @@ class OSG_EXPORT CullSettings
COMPUTE_NEAR_USING_PRIMITIVES COMPUTE_NEAR_USING_PRIMITIVES
}; };
void setComputeNearFarMode(ComputeNearFarMode cnfm) { _computeNearFar=cnfm; applyMaskAction(COMPUTE_NEAR_FAR_MODE); } void setComputeNearFarMode(ComputeNearFarMode cnfm) { _computeNearFar=cnfm; applyMaskAction(COMPUTE_NEAR_FAR_MODE); }
ComputeNearFarMode getComputeNearFarMode() const { return _computeNearFar;} ComputeNearFarMode getComputeNearFarMode() const { return _computeNearFar;}
void setNearFarRatio(double ratio) { _nearFarRatio = ratio; applyMaskAction(NEAR_FAR_RATIO); } void setNearFarRatio(double ratio) { _nearFarRatio = ratio; applyMaskAction(NEAR_FAR_RATIO); }
double getNearFarRatio() const { return _nearFarRatio; } double getNearFarRatio() const { return _nearFarRatio; }
@ -192,12 +192,12 @@ class OSG_EXPORT CullSettings
SHADOW_OCCLUSION_CULLING| SHADOW_OCCLUSION_CULLING|
CLUSTER_CULLING CLUSTER_CULLING
}; };
typedef int CullingMode; typedef int CullingMode;
/** Set the culling mode for the CullVisitor to use.*/ /** Set the culling mode for the CullVisitor to use.*/
void setCullingMode(CullingMode mode) { _cullingMode = mode; applyMaskAction(CULLING_MODE); } void setCullingMode(CullingMode mode) { _cullingMode = mode; applyMaskAction(CULLING_MODE); }
/** Returns the current CullingMode.*/ /** Returns the current CullingMode.*/
CullingMode getCullingMode() const { return _cullingMode; } CullingMode getCullingMode() const { return _cullingMode; }
@ -213,7 +213,7 @@ class OSG_EXPORT CullSettings
/** Set the LOD bias for the CullVisitor to use.*/ /** Set the LOD bias for the CullVisitor to use.*/
void setLODScale(float scale) { _LODScale = scale; applyMaskAction(LOD_SCALE); } void setLODScale(float scale) { _LODScale = scale; applyMaskAction(LOD_SCALE); }
/** Get the LOD bias.*/ /** Get the LOD bias.*/
float getLODScale() const { return _LODScale; } float getLODScale() const { return _LODScale; }
@ -234,7 +234,7 @@ class OSG_EXPORT CullSettings
virtual bool clampProjectionMatrixImplementation(osg::Matrixf& projection, double& znear, double& zfar) const = 0; virtual bool clampProjectionMatrixImplementation(osg::Matrixf& projection, double& znear, double& zfar) const = 0;
virtual bool clampProjectionMatrixImplementation(osg::Matrixd& projection, double& znear, double& zfar) const = 0; virtual bool clampProjectionMatrixImplementation(osg::Matrixd& projection, double& znear, double& zfar) const = 0;
}; };
/** set the ClampProjectionMatrixCallback.*/ /** set the ClampProjectionMatrixCallback.*/
void setClampProjectionMatrixCallback(ClampProjectionMatrixCallback* cpmc) { _clampProjectionMatrixCallback = cpmc; applyMaskAction(CLAMP_PROJECTION_MATRIX_CALLBACK); } void setClampProjectionMatrixCallback(ClampProjectionMatrixCallback* cpmc) { _clampProjectionMatrixCallback = cpmc; applyMaskAction(CLAMP_PROJECTION_MATRIX_CALLBACK); }
/** get the non const ClampProjectionMatrixCallback.*/ /** get the non const ClampProjectionMatrixCallback.*/
@ -261,12 +261,12 @@ class OSG_EXPORT CullSettings
bool _impostorActive; bool _impostorActive;
bool _depthSortImpostorSprites; bool _depthSortImpostorSprites;
float _impostorPixelErrorThreshold; float _impostorPixelErrorThreshold;
int _numFramesToKeepImpostorSprites; int _numFramesToKeepImpostorSprites;
Node::NodeMask _cullMask; Node::NodeMask _cullMask;
Node::NodeMask _cullMaskLeft; Node::NodeMask _cullMaskLeft;
Node::NodeMask _cullMaskRight; Node::NodeMask _cullMaskRight;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -28,17 +28,17 @@ class OSG_EXPORT CullStack : public osg::CullSettings
{ {
public: public:
CullStack(); CullStack();
CullStack(const CullStack& cs); CullStack(const CullStack& cs);
~CullStack(); ~CullStack();
typedef std::vector<ShadowVolumeOccluder> OccluderList; typedef std::vector<ShadowVolumeOccluder> OccluderList;
void reset(); void reset();
void pushCullingSet(); void pushCullingSet();
void popCullingSet(); void popCullingSet();
@ -63,7 +63,7 @@ class OSG_EXPORT CullStack : public osg::CullSettings
{ {
return getCurrentCullingSet().pixelSize(v,radius); return getCurrentCullingSet().pixelSize(v,radius);
} }
/** Compute the pixel size of the bounding sphere.*/ /** Compute the pixel size of the bounding sphere.*/
float pixelSize(const BoundingSphere& bs) const float pixelSize(const BoundingSphere& bs) const
{ {
@ -75,7 +75,7 @@ class OSG_EXPORT CullStack : public osg::CullSettings
{ {
return getCurrentCullingSet().clampedPixelSize(v,radius); return getCurrentCullingSet().clampedPixelSize(v,radius);
} }
/** Compute the pixel size of the bounding sphere. fabs()ed to always be positive. */ /** Compute the pixel size of the bounding sphere. fabs()ed to always be positive. */
float clampedPixelSize(const BoundingSphere& bs) const float clampedPixelSize(const BoundingSphere& bs) const
{ {
@ -101,12 +101,12 @@ class OSG_EXPORT CullStack : public osg::CullSettings
{ {
return bb.valid() && getCurrentCullingSet().isCulled(bb); return bb.valid() && getCurrentCullingSet().isCulled(bb);
} }
inline bool isCulled(const BoundingSphere& bs) inline bool isCulled(const BoundingSphere& bs)
{ {
return getCurrentCullingSet().isCulled(bs); return getCurrentCullingSet().isCulled(bs);
} }
inline bool isCulled(const osg::Node& node) inline bool isCulled(const osg::Node& node)
{ {
return node.isCullingActive() && getCurrentCullingSet().isCulled(node.getBound()); return node.isCullingActive() && getCurrentCullingSet().isCulled(node.getBound());
@ -116,30 +116,30 @@ class OSG_EXPORT CullStack : public osg::CullSettings
{ {
getCurrentCullingSet().pushCurrentMask(); getCurrentCullingSet().pushCurrentMask();
} }
inline void popCurrentMask() inline void popCurrentMask()
{ {
getCurrentCullingSet().popCurrentMask(); getCurrentCullingSet().popCurrentMask();
} }
typedef std::vector< CullingSet > CullingStack; typedef std::vector< CullingSet > CullingStack;
inline CullingStack& getClipSpaceCullingStack() { return _clipspaceCullingStack; } inline CullingStack& getClipSpaceCullingStack() { return _clipspaceCullingStack; }
inline CullingStack& getProjectionCullingStack() { return _projectionCullingStack; } inline CullingStack& getProjectionCullingStack() { return _projectionCullingStack; }
inline CullingStack& getModelViewCullingStack() { return _modelviewCullingStack; } inline CullingStack& getModelViewCullingStack() { return _modelviewCullingStack; }
inline CullingSet& getCurrentCullingSet() { return *_back_modelviewCullingStack; } inline CullingSet& getCurrentCullingSet() { return *_back_modelviewCullingStack; }
inline const CullingSet& getCurrentCullingSet() const { return *_back_modelviewCullingStack; } inline const CullingSet& getCurrentCullingSet() const { return *_back_modelviewCullingStack; }
inline osg::Viewport* getViewport(); inline osg::Viewport* getViewport();
inline osg::RefMatrix* getModelViewMatrix(); inline osg::RefMatrix* getModelViewMatrix();
inline osg::RefMatrix* getProjectionMatrix(); inline osg::RefMatrix* getProjectionMatrix();
inline osg::Matrix getWindowMatrix(); inline osg::Matrix getWindowMatrix();
inline const osg::RefMatrix* getMVPW(); inline const osg::RefMatrix* getMVPW();
inline const osg::Vec3& getReferenceViewPoint() const { return _referenceViewPoints.back(); } inline const osg::Vec3& getReferenceViewPoint() const { return _referenceViewPoints.back(); }
inline void pushReferenceViewPoint(const osg::Vec3& viewPoint) { _referenceViewPoints.push_back(viewPoint); } inline void pushReferenceViewPoint(const osg::Vec3& viewPoint) { _referenceViewPoints.push_back(viewPoint); }
inline void popReferenceViewPoint() { _referenceViewPoints.pop_back(); } inline void popReferenceViewPoint() { _referenceViewPoints.pop_back(); }
@ -159,10 +159,10 @@ class OSG_EXPORT CullStack : public osg::CullSettings
const osg::Matrix& matrix = *_modelviewStack.back(); const osg::Matrix& matrix = *_modelviewStack.back();
return osg::Vec3(-matrix(0,2),-matrix(1,2),-matrix(2,2)); return osg::Vec3(-matrix(0,2),-matrix(1,2),-matrix(2,2));
} }
protected: protected:
// base set of shadow volume occluder to use in culling. // base set of shadow volume occluder to use in culling.
ShadowVolumeOccluderList _occluderList; ShadowVolumeOccluderList _occluderList;
@ -175,7 +175,7 @@ class OSG_EXPORT CullStack : public osg::CullSettings
typedef fast_back_stack<ref_ptr<Viewport> > ViewportStack; typedef fast_back_stack<ref_ptr<Viewport> > ViewportStack;
ViewportStack _viewportStack; ViewportStack _viewportStack;
typedef fast_back_stack<Vec3> EyePointStack; typedef fast_back_stack<Vec3> EyePointStack;
EyePointStack _referenceViewPoints; EyePointStack _referenceViewPoints;
EyePointStack _eyePointStack; EyePointStack _eyePointStack;
@ -195,14 +195,14 @@ class OSG_EXPORT CullStack : public osg::CullSettings
unsigned int _bbCornerFar; unsigned int _bbCornerFar;
ref_ptr<osg::RefMatrix> _identity; ref_ptr<osg::RefMatrix> _identity;
typedef std::vector< osg::ref_ptr<osg::RefMatrix> > MatrixList; typedef std::vector< osg::ref_ptr<osg::RefMatrix> > MatrixList;
MatrixList _reuseMatrixList; MatrixList _reuseMatrixList;
unsigned int _currentReuseMatrixIndex; unsigned int _currentReuseMatrixIndex;
inline osg::RefMatrix* createOrReuseMatrix(const osg::Matrix& value); inline osg::RefMatrix* createOrReuseMatrix(const osg::Matrix& value);
}; };
inline osg::Viewport* CullStack::getViewport() inline osg::Viewport* CullStack::getViewport()
@ -275,7 +275,7 @@ inline const osg::RefMatrix* CullStack::getMVPW()
inline RefMatrix* CullStack::createOrReuseMatrix(const osg::Matrix& value) inline RefMatrix* CullStack::createOrReuseMatrix(const osg::Matrix& value)
{ {
// skip of any already reused matrix. // skip of any already reused matrix.
while (_currentReuseMatrixIndex<_reuseMatrixList.size() && while (_currentReuseMatrixIndex<_reuseMatrixList.size() &&
_reuseMatrixList[_currentReuseMatrixIndex]->referenceCount()>1) _reuseMatrixList[_currentReuseMatrixIndex]->referenceCount()>1)
{ {
++_currentReuseMatrixIndex; ++_currentReuseMatrixIndex;
@ -299,4 +299,4 @@ inline RefMatrix* CullStack::createOrReuseMatrix(const osg::Matrix& value)
} // end of namespace } // end of namespace
#endif #endif

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -32,8 +32,8 @@ class OSG_EXPORT CullingSet : public Referenced
public: public:
typedef std::pair< osg::ref_ptr<osg::StateSet>, osg::Polytope > StateFrustumPair; typedef std::pair< osg::ref_ptr<osg::StateSet>, osg::Polytope > StateFrustumPair;
typedef std::vector< StateFrustumPair > StateFrustumList; typedef std::vector< StateFrustumPair > StateFrustumList;
CullingSet(); CullingSet();
CullingSet(const CullingSet& cs): CullingSet(const CullingSet& cs):
@ -63,18 +63,18 @@ class OSG_EXPORT CullingSet : public Referenced
itr->transformProvidingInverse(matrix); itr->transformProvidingInverse(matrix);
} }
} }
CullingSet& operator = (const CullingSet& cs) CullingSet& operator = (const CullingSet& cs)
{ {
if (this==&cs) return *this; if (this==&cs) return *this;
_mask = cs._mask; _mask = cs._mask;
_frustum = cs._frustum; _frustum = cs._frustum;
_stateFrustumList = cs._stateFrustumList; _stateFrustumList = cs._stateFrustumList;
_occluderList = cs._occluderList; _occluderList = cs._occluderList;
_pixelSizeVector = cs._pixelSizeVector; _pixelSizeVector = cs._pixelSizeVector;
_smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize;
return *this; return *this;
} }
@ -88,7 +88,7 @@ class OSG_EXPORT CullingSet : public Referenced
_pixelSizeVector = cs._pixelSizeVector; _pixelSizeVector = cs._pixelSizeVector;
_smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize;
} }
inline void set(const CullingSet& cs,const Matrix& matrix, const Vec4& pixelSizeVector) inline void set(const CullingSet& cs,const Matrix& matrix, const Vec4& pixelSizeVector)
{ {
_mask = cs._mask; _mask = cs._mask;
@ -99,9 +99,9 @@ class OSG_EXPORT CullingSet : public Referenced
//_frustum = cs._frustum; //_frustum = cs._frustum;
//_frustum.transformProvidingInverse(matrix); //_frustum.transformProvidingInverse(matrix);
_frustum.setAndTransformProvidingInverse(cs._frustum,matrix); _frustum.setAndTransformProvidingInverse(cs._frustum,matrix);
for(StateFrustumList::iterator sitr=_stateFrustumList.begin(); for(StateFrustumList::iterator sitr=_stateFrustumList.begin();
sitr!=_stateFrustumList.end(); sitr!=_stateFrustumList.end();
++sitr) ++sitr)
@ -115,9 +115,9 @@ class OSG_EXPORT CullingSet : public Referenced
{ {
oitr->transformProvidingInverse(matrix); oitr->transformProvidingInverse(matrix);
} }
} }
typedef std::vector<ShadowVolumeOccluder> OccluderList; typedef std::vector<ShadowVolumeOccluder> OccluderList;
typedef int Mask; typedef int Mask;
@ -147,10 +147,10 @@ class OSG_EXPORT CullingSet : public Referenced
void setFrustum(Polytope& cv) { _frustum = cv; } void setFrustum(Polytope& cv) { _frustum = cv; }
Polytope& getFrustum() { return _frustum; } Polytope& getFrustum() { return _frustum; }
const Polytope& getFrustum() const { return _frustum; } const Polytope& getFrustum() const { return _frustum; }
void addStateFrustum(StateSet* stateset, Polytope& polytope) { _stateFrustumList.push_back(StateFrustumPair(stateset,polytope)); } void addStateFrustum(StateSet* stateset, Polytope& polytope) { _stateFrustumList.push_back(StateFrustumPair(stateset,polytope)); }
void getStateFrustumList(StateFrustumList& sfl) { _stateFrustumList = sfl; } void getStateFrustumList(StateFrustumList& sfl) { _stateFrustumList = sfl; }
StateFrustumList& getStateFrustumList() { return _stateFrustumList; } StateFrustumList& getStateFrustumList() { return _stateFrustumList; }
@ -164,12 +164,12 @@ class OSG_EXPORT CullingSet : public Referenced
/** Threshold at which small features are culled. /** Threshold at which small features are culled.
\param value Boulding volume size in screen space. Default is 2.0. */ \param value Boulding volume size in screen space. Default is 2.0. */
void setSmallFeatureCullingPixelSize(float value) { _smallFeatureCullingPixelSize=value; } void setSmallFeatureCullingPixelSize(float value) { _smallFeatureCullingPixelSize=value; }
float& getSmallFeatureCullingPixelSize() { return _smallFeatureCullingPixelSize; } float& getSmallFeatureCullingPixelSize() { return _smallFeatureCullingPixelSize; }
float getSmallFeatureCullingPixelSize() const { return _smallFeatureCullingPixelSize; } float getSmallFeatureCullingPixelSize() const { return _smallFeatureCullingPixelSize; }
/** Compute the pixel of an object at position v, with specified radius.*/ /** Compute the pixel of an object at position v, with specified radius.*/
float pixelSize(const Vec3& v,float radius) const { return radius/(v*_pixelSizeVector); } float pixelSize(const Vec3& v,float radius) const { return radius/(v*_pixelSizeVector); }
@ -190,7 +190,7 @@ class OSG_EXPORT CullingSet : public Referenced
// is it outside the view frustum... // is it outside the view frustum...
if (!_frustum.contains(vertices)) return true; if (!_frustum.contains(vertices)) return true;
} }
if (_mask&SMALL_FEATURE_CULLING) if (_mask&SMALL_FEATURE_CULLING)
{ {
} }
@ -208,10 +208,10 @@ class OSG_EXPORT CullingSet : public Referenced
} }
} }
} }
return false; return false;
} }
inline bool isCulled(const BoundingBox& bb) inline bool isCulled(const BoundingBox& bb)
{ {
if (_mask&VIEW_FRUSTUM_CULLING) if (_mask&VIEW_FRUSTUM_CULLING)
@ -219,7 +219,7 @@ class OSG_EXPORT CullingSet : public Referenced
// is it outside the view frustum... // is it outside the view frustum...
if (!_frustum.contains(bb)) return true; if (!_frustum.contains(bb)) return true;
} }
if (_mask&SMALL_FEATURE_CULLING) if (_mask&SMALL_FEATURE_CULLING)
{ {
} }
@ -237,10 +237,10 @@ class OSG_EXPORT CullingSet : public Referenced
} }
} }
} }
return false; return false;
} }
inline bool isCulled(const BoundingSphere& bs) inline bool isCulled(const BoundingSphere& bs)
{ {
if (_mask&VIEW_FRUSTUM_CULLING) if (_mask&VIEW_FRUSTUM_CULLING)
@ -248,7 +248,7 @@ class OSG_EXPORT CullingSet : public Referenced
// is it outside the view frustum... // is it outside the view frustum...
if (!_frustum.contains(bs)) return true; if (!_frustum.contains(bs)) return true;
} }
if (_mask&SMALL_FEATURE_CULLING) if (_mask&SMALL_FEATURE_CULLING)
{ {
if (((bs.center()*_pixelSizeVector)*_smallFeatureCullingPixelSize)>bs.radius()) return true; if (((bs.center()*_pixelSizeVector)*_smallFeatureCullingPixelSize)>bs.radius()) return true;
@ -267,14 +267,14 @@ class OSG_EXPORT CullingSet : public Referenced
} }
} }
} }
#endif #endif
return false; return false;
} }
inline void pushCurrentMask() inline void pushCurrentMask()
{ {
_frustum.pushCurrentMask(); _frustum.pushCurrentMask();
if (!_stateFrustumList.empty()) if (!_stateFrustumList.empty())
{ {
for(StateFrustumList::iterator itr=_stateFrustumList.begin(); for(StateFrustumList::iterator itr=_stateFrustumList.begin();
@ -298,7 +298,7 @@ class OSG_EXPORT CullingSet : public Referenced
} }
#endif #endif
} }
inline void popCurrentMask() inline void popCurrentMask()
{ {
_frustum.popCurrentMask(); _frustum.popCurrentMask();
@ -325,23 +325,23 @@ class OSG_EXPORT CullingSet : public Referenced
} }
#endif #endif
} }
void disableAndPushOccludersCurrentMask(NodePath& nodePath); void disableAndPushOccludersCurrentMask(NodePath& nodePath);
void popOccludersCurrentMask(NodePath& nodePath); void popOccludersCurrentMask(NodePath& nodePath);
static osg::Vec4 computePixelSizeVector(const Viewport& W, const Matrix& P, const Matrix& M); static osg::Vec4 computePixelSizeVector(const Viewport& W, const Matrix& P, const Matrix& M);
virtual ~CullingSet(); virtual ~CullingSet();
protected: protected:
Mask _mask; Mask _mask;
Polytope _frustum; Polytope _frustum;
StateFrustumList _stateFrustumList; StateFrustumList _stateFrustumList;
OccluderList _occluderList; OccluderList _occluderList;
Vec4 _pixelSizeVector; Vec4 _pixelSizeVector;
float _smallFeatureCullingPixelSize; float _smallFeatureCullingPixelSize;
@ -349,4 +349,4 @@ class OSG_EXPORT CullingSet : public Referenced
} // end of namespace } // end of namespace
#endif #endif

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -26,7 +26,7 @@ namespace osg {
* objects unintentionally. * objects unintentionally.
* Note, the DeleteHandler cannot itself be reference counted, otherwise it * Note, the DeleteHandler cannot itself be reference counted, otherwise it
* would be responsible for deleting itself! * would be responsible for deleting itself!
* An static auto_ptr<> is used internally in Referenced.cpp to manage the * An static auto_ptr<> is used internally in Referenced.cpp to manage the
* DeleteHandler's memory.*/ * DeleteHandler's memory.*/
class OSG_EXPORT DeleteHandler class OSG_EXPORT DeleteHandler
{ {
@ -43,7 +43,7 @@ class OSG_EXPORT DeleteHandler
* When set to zero objects are deleted immediately, by set to 1 there are kept around for an extra frame etc. * When set to zero objects are deleted immediately, by set to 1 there are kept around for an extra frame etc.
* The ability to retain objects for several frames is useful to prevent premature deletion when objects * The ability to retain objects for several frames is useful to prevent premature deletion when objects
* are still be used the graphics threads that are using double buffering of rendering data structures with * are still be used the graphics threads that are using double buffering of rendering data structures with
* non ref_ptr<> pointers to scene graph elements.*/ * non ref_ptr<> pointers to scene graph elements.*/
void setNumFramesToRetainObjects(unsigned int numberOfFramesToRetainObjects) { _numFramesToRetainObjects = numberOfFramesToRetainObjects; } void setNumFramesToRetainObjects(unsigned int numberOfFramesToRetainObjects) { _numFramesToRetainObjects = numberOfFramesToRetainObjects; }
unsigned int getNumFramesToRetainObjects() const { return _numFramesToRetainObjects; } unsigned int getNumFramesToRetainObjects() const { return _numFramesToRetainObjects; }
@ -63,8 +63,8 @@ class OSG_EXPORT DeleteHandler
* Note, this should only be called if there are no threads running with non ref_ptr<> pointers, such as graphics threads.*/ * Note, this should only be called if there are no threads running with non ref_ptr<> pointers, such as graphics threads.*/
virtual void flushAll(); virtual void flushAll();
/** Request the deletion of an object. /** Request the deletion of an object.
* Depending on users implementation of DeleteHandler, the delete of the object may occur * Depending on users implementation of DeleteHandler, the delete of the object may occur
* straight away or be delayed until doDelete is called. * straight away or be delayed until doDelete is called.
* The default implementation does a delete straight away.*/ * The default implementation does a delete straight away.*/
virtual void requestDelete(const osg::Referenced* object); virtual void requestDelete(const osg::Referenced* object);

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -19,12 +19,12 @@
namespace osg { namespace osg {
/** Encapsulate OpenGL glDepthFunc/Mask/Range functions. /** Encapsulate OpenGL glDepthFunc/Mask/Range functions.
*/ */
class OSG_EXPORT Depth : public StateAttribute class OSG_EXPORT Depth : public StateAttribute
{ {
public : public :
enum Function enum Function
{ {
NEVER = GL_NEVER, NEVER = GL_NEVER,
@ -39,7 +39,7 @@ class OSG_EXPORT Depth : public StateAttribute
Depth(Function func=LESS,double zNear=0.0, double zFar=1.0,bool writeMask=true); Depth(Function func=LESS,double zNear=0.0, double zFar=1.0,bool writeMask=true);
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Depth(const Depth& dp,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Depth(const Depth& dp,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(dp,copyop), StateAttribute(dp,copyop),
@ -47,10 +47,10 @@ class OSG_EXPORT Depth : public StateAttribute
_zNear(dp._zNear), _zNear(dp._zNear),
_zFar(dp._zFar), _zFar(dp._zFar),
_depthWriteMask(dp._depthWriteMask) {} _depthWriteMask(dp._depthWriteMask) {}
META_StateAttribute(osg, Depth, DEPTH); META_StateAttribute(osg, Depth, DEPTH);
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -73,9 +73,9 @@ class OSG_EXPORT Depth : public StateAttribute
return true; return true;
} }
inline void setFunction(Function func) { _func = func; } inline void setFunction(Function func) { _func = func; }
inline Function getFunction() const { return _func; } inline Function getFunction() const { return _func; }
inline void setRange(double zNear, double zFar) inline void setRange(double zNear, double zFar)
{ {
@ -85,22 +85,22 @@ class OSG_EXPORT Depth : public StateAttribute
inline void setZNear(double zNear) { _zNear=zNear; } inline void setZNear(double zNear) { _zNear=zNear; }
inline double getZNear() const { return _zNear; } inline double getZNear() const { return _zNear; }
inline void setZFar(double zFar) { _zFar=zFar; } inline void setZFar(double zFar) { _zFar=zFar; }
inline double getZFar() const { return _zFar; } inline double getZFar() const { return _zFar; }
inline void setWriteMask(bool mask) { _depthWriteMask = mask; } inline void setWriteMask(bool mask) { _depthWriteMask = mask; }
inline bool getWriteMask() const { return _depthWriteMask; } inline bool getWriteMask() const { return _depthWriteMask; }
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected: protected:
virtual ~Depth(); virtual ~Depth();
Function _func; Function _func;
double _zNear; double _zNear;
double _zFar; double _zFar;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -42,7 +42,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
setDefaults(); setDefaults();
readEnvironmentalVariables(); readEnvironmentalVariables();
} }
DisplaySettings(ArgumentParser& arguments): DisplaySettings(ArgumentParser& arguments):
Referenced(true) Referenced(true)
{ {
@ -52,23 +52,23 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
} }
DisplaySettings(const DisplaySettings& vs); DisplaySettings(const DisplaySettings& vs);
DisplaySettings& operator = (const DisplaySettings& vs); DisplaySettings& operator = (const DisplaySettings& vs);
void setDisplaySettings(const DisplaySettings& vs); void setDisplaySettings(const DisplaySettings& vs);
void merge(const DisplaySettings& vs); void merge(const DisplaySettings& vs);
void setDefaults(); void setDefaults();
/** read the environmental variables.*/ /** read the environmental variables.*/
void readEnvironmentalVariables(); void readEnvironmentalVariables();
/** read the commandline arguments.*/ /** read the commandline arguments.*/
void readCommandLine(ArgumentParser& arguments); void readCommandLine(ArgumentParser& arguments);
enum DisplayType enum DisplayType
{ {
MONITOR, MONITOR,
@ -78,7 +78,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
}; };
void setDisplayType(DisplayType type) { _displayType = type; } void setDisplayType(DisplayType type) { _displayType = type; }
DisplayType getDisplayType() const { return _displayType; } DisplayType getDisplayType() const { return _displayType; }
@ -97,7 +97,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
VERTICAL_INTERLACE, VERTICAL_INTERLACE,
CHECKERBOARD CHECKERBOARD
}; };
void setStereoMode(StereoMode mode) { _stereoMode = mode; } void setStereoMode(StereoMode mode) { _stereoMode = mode; }
StereoMode getStereoMode() const { return _stereoMode; } StereoMode getStereoMode() const { return _stereoMode; }
@ -109,7 +109,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
LEFT_EYE_LEFT_VIEWPORT, LEFT_EYE_LEFT_VIEWPORT,
LEFT_EYE_RIGHT_VIEWPORT LEFT_EYE_RIGHT_VIEWPORT
}; };
void setSplitStereoHorizontalEyeMapping(SplitStereoHorizontalEyeMapping m) { _splitStereoHorizontalEyeMapping = m; } void setSplitStereoHorizontalEyeMapping(SplitStereoHorizontalEyeMapping m) { _splitStereoHorizontalEyeMapping = m; }
SplitStereoHorizontalEyeMapping getSplitStereoHorizontalEyeMapping() const { return _splitStereoHorizontalEyeMapping; } SplitStereoHorizontalEyeMapping getSplitStereoHorizontalEyeMapping() const { return _splitStereoHorizontalEyeMapping; }
@ -177,13 +177,13 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
void setNumMultiSamples(unsigned int samples) { _numMultiSamples = samples; } void setNumMultiSamples(unsigned int samples) { _numMultiSamples = samples; }
unsigned int getNumMultiSamples() const { return _numMultiSamples; } unsigned int getNumMultiSamples() const { return _numMultiSamples; }
bool getMultiSamples() const { return _numMultiSamples!=0; } bool getMultiSamples() const { return _numMultiSamples!=0; }
void setCompileContextsHint(bool useCompileContexts) { _compileContextsHint = useCompileContexts; } void setCompileContextsHint(bool useCompileContexts) { _compileContextsHint = useCompileContexts; }
bool getCompileContextsHint() const { return _compileContextsHint; } bool getCompileContextsHint() const { return _compileContextsHint; }
void setSerializeDrawDispatch(bool serializeDrawDispatch) { _serializeDrawDispatch = serializeDrawDispatch; } void setSerializeDrawDispatch(bool serializeDrawDispatch) { _serializeDrawDispatch = serializeDrawDispatch; }
bool getSerializeDrawDispatch() const { return _serializeDrawDispatch; } bool getSerializeDrawDispatch() const { return _serializeDrawDispatch; }
/** Set the hint for the total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.*/ /** Set the hint for the total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.*/
void setNumOfDatabaseThreadsHint(unsigned int numThreads) { _numDatabaseThreadsHint = numThreads; } void setNumOfDatabaseThreadsHint(unsigned int numThreads) { _numDatabaseThreadsHint = numThreads; }
@ -195,7 +195,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
/** Get the hint for number of threads in the DatbasePager dedicated to reading http requests.*/ /** Get the hint for number of threads in the DatbasePager dedicated to reading http requests.*/
unsigned int getNumOfHttpDatabaseThreadsHint() const { return _numHttpDatabaseThreadsHint; } unsigned int getNumOfHttpDatabaseThreadsHint() const { return _numHttpDatabaseThreadsHint; }
void setApplication(const std::string& application) { _application = application; } void setApplication(const std::string& application) { _application = application; }
const std::string& getApplication() { return _application; } const std::string& getApplication() { return _application; }
@ -206,11 +206,11 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
void setMaxBufferObjectPoolSize(unsigned int size) { _maxBufferObjectPoolSize = size; } void setMaxBufferObjectPoolSize(unsigned int size) { _maxBufferObjectPoolSize = size; }
unsigned int getMaxBufferObjectPoolSize() const { return _maxBufferObjectPoolSize; } unsigned int getMaxBufferObjectPoolSize() const { return _maxBufferObjectPoolSize; }
/** /**
Methods used to set and get defaults for Cameras implicit buffer attachments. Methods used to set and get defaults for Cameras implicit buffer attachments.
For more info: See description of Camera::setImplicitBufferAttachment method For more info: See description of Camera::setImplicitBufferAttachment method
DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR
for both primary (Render) FBO and seconday Multisample (Resolve) FBO for both primary (Render) FBO and seconday Multisample (Resolve) FBO
ie: IMPLICT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT ie: IMPLICT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT
**/ **/
@ -249,11 +249,11 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
enum SwapMethod enum SwapMethod
{ {
SWAP_DEFAULT, // Leave swap method at default returned by choose Pixel Format. SWAP_DEFAULT, // Leave swap method at default returned by choose Pixel Format.
SWAP_EXCHANGE, // Flip front / back buffer. SWAP_EXCHANGE, // Flip front / back buffer.
SWAP_COPY, // Copy back to front buffer. SWAP_COPY, // Copy back to front buffer.
SWAP_UNDEFINED // Move back to front buffer leaving contents of back buffer undefined. SWAP_UNDEFINED // Move back to front buffer leaving contents of back buffer undefined.
}; };
/** Select preferred swap method */ /** Select preferred swap method */
void setSwapMethod( SwapMethod swapMethod ) { _swapMethod = swapMethod; } void setSwapMethod( SwapMethod swapMethod ) { _swapMethod = swapMethod; }
@ -271,7 +271,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
/** Get the hint of the flags to use in when creating graphic contexts.*/ /** Get the hint of the flags to use in when creating graphic contexts.*/
unsigned int getGLContextFlags() const { return _glContextFlags; } unsigned int getGLContextFlags() const { return _glContextFlags; }
/** Set the hint of the profile mask to use in when creating graphic contexts.*/ /** Set the hint of the profile mask to use in when creating graphic contexts.*/
void setGLContextProfileMask(unsigned int mask) { _glContextProfileMask = mask; } void setGLContextProfileMask(unsigned int mask) { _glContextProfileMask = mask; }
@ -279,7 +279,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
unsigned int getGLContextProfileMask() const { return _glContextProfileMask; } unsigned int getGLContextProfileMask() const { return _glContextProfileMask; }
protected: protected:
virtual ~DisplaySettings(); virtual ~DisplaySettings();
@ -296,7 +296,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
SplitStereoVerticalEyeMapping _splitStereoVerticalEyeMapping; SplitStereoVerticalEyeMapping _splitStereoVerticalEyeMapping;
int _splitStereoVerticalSeparation; int _splitStereoVerticalSeparation;
bool _splitStereoAutoAdjustAspectRatio; bool _splitStereoAutoAdjustAspectRatio;
bool _doubleBuffer; bool _doubleBuffer;
bool _RGB; bool _RGB;
bool _depthBuffer; bool _depthBuffer;
@ -308,15 +308,15 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
unsigned int _minimumNumberAccumAlphaBits; unsigned int _minimumNumberAccumAlphaBits;
unsigned int _maxNumOfGraphicsContexts; unsigned int _maxNumOfGraphicsContexts;
unsigned int _numMultiSamples; unsigned int _numMultiSamples;
bool _compileContextsHint; bool _compileContextsHint;
bool _serializeDrawDispatch; bool _serializeDrawDispatch;
unsigned int _numDatabaseThreadsHint; unsigned int _numDatabaseThreadsHint;
unsigned int _numHttpDatabaseThreadsHint; unsigned int _numHttpDatabaseThreadsHint;
std::string _application; std::string _application;
unsigned int _maxTexturePoolSize; unsigned int _maxTexturePoolSize;
@ -324,7 +324,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask; ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask;
ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask; ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask;
std::string _glContextVersion; std::string _glContextVersion;
unsigned int _glContextFlags; unsigned int _glContextFlags;
unsigned int _glContextProfileMask; unsigned int _glContextProfileMask;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -30,27 +30,27 @@ class OSG_EXPORT DrawPixels : public Drawable
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
DrawPixels(const DrawPixels& drawimage,const CopyOp& copyop=CopyOp::SHALLOW_COPY); DrawPixels(const DrawPixels& drawimage,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return new DrawPixels(); } virtual Object* cloneType() const { return new DrawPixels(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawPixels(*this,copyop); } virtual Object* clone(const CopyOp& copyop) const { return new DrawPixels(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawPixels*>(obj)!=NULL; } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawPixels*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawPixels"; } virtual const char* className() const { return "DrawPixels"; }
void setPosition(const osg::Vec3& position); void setPosition(const osg::Vec3& position);
osg::Vec3& getPosition() { return _position; } osg::Vec3& getPosition() { return _position; }
const osg::Vec3& getPosition() const { return _position; } const osg::Vec3& getPosition() const { return _position; }
void setImage(osg::Image* image) { _image = image; } void setImage(osg::Image* image) { _image = image; }
osg::Image* getImage() { return _image.get(); } osg::Image* getImage() { return _image.get(); }
const osg::Image* getImage() const { return _image.get(); } const osg::Image* getImage() const { return _image.get(); }
void setUseSubImage(bool useSubImage) { _useSubImage=useSubImage; } void setUseSubImage(bool useSubImage) { _useSubImage=useSubImage; }
bool getUseSubImage() const { return _useSubImage; } bool getUseSubImage() const { return _useSubImage; }
@ -60,7 +60,7 @@ class OSG_EXPORT DrawPixels : public Drawable
virtual void drawImplementation(RenderInfo& renderInfo) const; virtual void drawImplementation(RenderInfo& renderInfo) const;
virtual BoundingBox computeBound() const; virtual BoundingBox computeBound() const;
protected: protected:
DrawPixels& operator = (const DrawPixels&) { return *this;} DrawPixels& operator = (const DrawPixels&) { return *this;}
@ -69,10 +69,10 @@ class OSG_EXPORT DrawPixels : public Drawable
Vec3 _position; Vec3 _position;
ref_ptr<Image> _image; ref_ptr<Image> _image;
bool _useSubImage; bool _useSubImage;
unsigned int _offsetX, _offsetY, _width, _height; unsigned int _offsetX, _offsetY, _width, _height;
}; };
} }

View File

@ -4,7 +4,7 @@
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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
@ -122,7 +122,7 @@ class OSG_EXPORT Drawable : public Object
* Equivalent to dynamic_cast<Geometry*>(this).*/ * Equivalent to dynamic_cast<Geometry*>(this).*/
virtual Geometry* asGeometry() { return 0; } virtual Geometry* asGeometry() { return 0; }
/** Convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0. /** Convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0.
* Equivalent to dynamic_cast<const Geometry*>(this).*/ * Equivalent to dynamic_cast<const Geometry*>(this).*/
virtual const Geometry* asGeometry() const { return 0; } virtual const Geometry* asGeometry() const { return 0; }
@ -199,11 +199,11 @@ class OSG_EXPORT Drawable : public Object
if(!_boundingBoxComputed) if(!_boundingBoxComputed)
{ {
_boundingBox = _initialBound; _boundingBox = _initialBound;
if (_computeBoundCallback.valid()) if (_computeBoundCallback.valid())
_boundingBox.expandBy(_computeBoundCallback->computeBound(*this)); _boundingBox.expandBy(_computeBoundCallback->computeBound(*this));
else else
_boundingBox.expandBy(computeBound()); _boundingBox.expandBy(computeBound());
_boundingBoxComputed = true; _boundingBoxComputed = true;
} }
return _boundingBox; return _boundingBox;
@ -274,7 +274,7 @@ class OSG_EXPORT Drawable : public Object
/** Return OpenGL display list for specified contextID. */ /** Return OpenGL display list for specified contextID. */
inline GLuint& getDisplayList(unsigned int contextID) const { return _globjList[contextID]; } inline GLuint& getDisplayList(unsigned int contextID) const { return _globjList[contextID]; }
/** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation
method to use OpenGL vertex buffer objects for rendering.*/ method to use OpenGL vertex buffer objects for rendering.*/
virtual void setUseVertexBufferObjects(bool flag); virtual void setUseVertexBufferObjects(bool flag);
@ -425,7 +425,7 @@ class OSG_EXPORT Drawable : public Object
/** drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that /** drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that
* must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. * must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable.
* drawImplementation(RenderInfo&) is called from the draw(RenderInfo&) method, with the draw method handling management of OpenGL display lists, * drawImplementation(RenderInfo&) is called from the draw(RenderInfo&) method, with the draw method handling management of OpenGL display lists,
* and drawImplementation(RenderInfo&) handling the actual drawing itself. * and drawImplementation(RenderInfo&) handling the actual drawing itself.
* @param renderInfo The osg::RenderInfo object that encapsulates the current rendering information including the osg::State OpenGL state for the current graphics context. */ * @param renderInfo The osg::RenderInfo object that encapsulates the current rendering information including the osg::State OpenGL state for the current graphics context. */
virtual void drawImplementation(RenderInfo& renderInfo) const = 0; virtual void drawImplementation(RenderInfo& renderInfo) const = 0;
@ -800,9 +800,9 @@ class OSG_EXPORT Drawable : public Object
}; };
/** Function to call to get the extension of a specified context. /** Function to call to get the extension of a specified context.
* If the Extension object for that context has not yet been created * If the Extension object for that context has not yet been created
* and the 'createIfNotInitalized' flag been set to false then returns NULL. * and the 'createIfNotInitalized' flag been set to false then returns NULL.
* If 'createIfNotInitalized' is true then the Extensions object is * If 'createIfNotInitalized' is true then the Extensions object is
* automatically created. However, in this case the extension object is * automatically created. However, in this case the extension object is
* only created with the graphics context associated with ContextID..*/ * only created with the graphics context associated with ContextID..*/
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -35,9 +35,9 @@ inline Endian getCpuByteOrder()
if (u.is_it_really_1 == 1) if (u.is_it_really_1 == 1)
return BigEndian; return BigEndian;
else else
return LittleEndian; return LittleEndian;
} }
inline void swapBytes( char* in, unsigned int size ) inline void swapBytes( char* in, unsigned int size )
{ {

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -20,7 +20,7 @@
// well placed for compatibility with future versions. // well placed for compatibility with future versions.
#define USE_DEPRECATED_API #define USE_DEPRECATED_API
// disable VisualStudio warnings // disable VisualStudio warnings
#if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS) #if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS)
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4251 ) #pragma warning( disable : 4251 )

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -48,7 +48,7 @@
namespace osg { namespace osg {
/** Fog - encapsulates OpenGL fog state. */ /** Fog - encapsulates OpenGL fog state. */
class OSG_EXPORT Fog : public StateAttribute class OSG_EXPORT Fog : public StateAttribute
{ {
public : public :
@ -67,7 +67,7 @@ class OSG_EXPORT Fog : public StateAttribute
_useRadialFog(fog._useRadialFog) {} _useRadialFog(fog._useRadialFog) {}
META_StateAttribute(osg, Fog,FOG); META_StateAttribute(osg, Fog,FOG);
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -113,16 +113,16 @@ class OSG_EXPORT Fog : public StateAttribute
inline void setColor( const Vec4 &color ) { _color = color; } inline void setColor( const Vec4 &color ) { _color = color; }
inline const Vec4& getColor() const { return _color; } inline const Vec4& getColor() const { return _color; }
inline void setUseRadialFog( bool useRadialFog ) { _useRadialFog = useRadialFog; } inline void setUseRadialFog( bool useRadialFog ) { _useRadialFog = useRadialFog; }
inline bool getUseRadialFog() const { return _useRadialFog; } inline bool getUseRadialFog() const { return _useRadialFog; }
enum FogCoordinateSource enum FogCoordinateSource
{ {
FOG_COORDINATE = GL_FOG_COORDINATE, FOG_COORDINATE = GL_FOG_COORDINATE,
FRAGMENT_DEPTH = GL_FRAGMENT_DEPTH FRAGMENT_DEPTH = GL_FRAGMENT_DEPTH
}; };
inline void setFogCoordinateSource(GLint source) { _fogCoordinateSource = source; } inline void setFogCoordinateSource(GLint source) { _fogCoordinateSource = source; }
inline GLint getFogCoordinateSource() const { return _fogCoordinateSource; } inline GLint getFogCoordinateSource() const { return _fogCoordinateSource; }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -150,14 +150,14 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
return _fragmentProgramIDList[contextID]; return _fragmentProgramIDList[contextID];
} }
/** Set the fragment program using a C style string.*/ /** Set the fragment program using a C style string.*/
inline void setFragmentProgram( const char* program ) inline void setFragmentProgram( const char* program )
{ {
_fragmentProgram = program; _fragmentProgram = program;
dirtyFragmentProgramObject(); dirtyFragmentProgramObject();
} }
/** Set the fragment program using C++ style string.*/ /** Set the fragment program using C++ style string.*/
inline void setFragmentProgram( const std::string& program ) inline void setFragmentProgram( const std::string& program )
{ {
@ -204,7 +204,7 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
/** Force a recompile on next apply() of associated OpenGL vertex program objects.*/ /** Force a recompile on next apply() of associated OpenGL vertex program objects.*/
void dirtyFragmentProgramObject(); void dirtyFragmentProgramObject();
/** use deleteFragmentProgramObject instead of glDeletePrograms to allow /** use deleteFragmentProgramObject instead of glDeletePrograms to allow
* OpenGL Fragment Program objects to be cached until they can be deleted * OpenGL Fragment Program objects to be cached until they can be deleted
@ -235,17 +235,17 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
virtual void releaseGLObjects(State* state=0) const; virtual void releaseGLObjects(State* state=0) const;
/** Extensions class which encapsulates the querying of extensions and /** Extensions class which encapsulates the querying of extensions and
* associated function pointers, and provide convenience wrappers to * associated function pointers, and provide convenience wrappers to
* check for the extensions or use the associated functions.*/ * check for the extensions or use the associated functions.*/
class OSG_EXPORT Extensions : public osg::Referenced class OSG_EXPORT Extensions : public osg::Referenced
{ {
public: public:
Extensions(unsigned int contextID); Extensions(unsigned int contextID);
Extensions(const Extensions& rhs); Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs); void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID); void setupGLExtensions(unsigned int contextID);
void setFragmentProgramSupported(bool flag) { _isFragmentProgramSupported=flag; } void setFragmentProgramSupported(bool flag) { _isFragmentProgramSupported=flag; }
@ -254,19 +254,19 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
void glBindProgram(GLenum target, GLuint id) const; void glBindProgram(GLenum target, GLuint id) const;
void glGenPrograms(GLsizei n, GLuint *programs) const; void glGenPrograms(GLsizei n, GLuint *programs) const;
void glDeletePrograms(GLsizei n, GLuint *programs) const; void glDeletePrograms(GLsizei n, GLuint *programs) const;
void glProgramString(GLenum target, GLenum format, GLsizei len, const void *string) const; void glProgramString(GLenum target, GLenum format, GLsizei len, const void *string) const;
void glProgramLocalParameter4fv(GLenum target, GLuint index, const GLfloat *params) const; void glProgramLocalParameter4fv(GLenum target, GLuint index, const GLfloat *params) const;
protected: protected:
~Extensions() {} ~Extensions() {}
bool _isFragmentProgramSupported; bool _isFragmentProgramSupported;
typedef void (GL_APIENTRY * BindProgramProc) (GLenum target, GLuint id); typedef void (GL_APIENTRY * BindProgramProc) (GLenum target, GLuint id);
typedef void (GL_APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs); typedef void (GL_APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs);
typedef void (GL_APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs); typedef void (GL_APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs);
typedef void (GL_APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string); typedef void (GL_APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string);
typedef void (GL_APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params); typedef void (GL_APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params);
BindProgramProc _glBindProgram; BindProgramProc _glBindProgram;
@ -275,11 +275,11 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
ProgramStringProc _glProgramString; ProgramStringProc _glProgramString;
ProgramLocalParameter4fvProc _glProgramLocalParameter4fv; ProgramLocalParameter4fvProc _glProgramLocalParameter4fv;
}; };
/** Function to call to get the extension of a specified context. /** Function to call to get the extension of a specified context.
* If the Extension object for that context has not yet been created and the * If the Extension object for that context has not yet been created and the
* 'createIfNotInitalized' flag has been set to false then returns NULL. * 'createIfNotInitalized' flag has been set to false then returns NULL.
* If 'createIfNotInitalized' is true then the Extensions object is * If 'createIfNotInitalized' is true then the Extensions object is
* automatically created. However, in this case the extension object will * automatically created. However, in this case the extension object will
* only be created with the graphics context associated with ContextID..*/ * only be created with the graphics context associated with ContextID..*/
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -166,7 +166,7 @@ namespace osg
TglBindRenderbuffer* glBindRenderbuffer; TglBindRenderbuffer* glBindRenderbuffer;
TglGenRenderbuffers* glGenRenderbuffers; TglGenRenderbuffers* glGenRenderbuffers;
TglDeleteRenderbuffers* glDeleteRenderbuffers; TglDeleteRenderbuffers* glDeleteRenderbuffers;
TglRenderbufferStorage* glRenderbufferStorage; TglRenderbufferStorage* glRenderbufferStorage;
TglRenderbufferStorageMultisample* glRenderbufferStorageMultisample; TglRenderbufferStorageMultisample* glRenderbufferStorageMultisample;
TglRenderbufferStorageMultisampleCoverageNV* glRenderbufferStorageMultisampleCoverageNV; TglRenderbufferStorageMultisampleCoverageNV* glRenderbufferStorageMultisampleCoverageNV;
@ -376,10 +376,10 @@ namespace osg
explicit FrameBufferAttachment(TextureCubeMap* target, unsigned int face, unsigned int level = 0); explicit FrameBufferAttachment(TextureCubeMap* target, unsigned int face, unsigned int level = 0);
explicit FrameBufferAttachment(TextureRectangle* target); explicit FrameBufferAttachment(TextureRectangle* target);
explicit FrameBufferAttachment(Camera::Attachment& attachment); explicit FrameBufferAttachment(Camera::Attachment& attachment);
~FrameBufferAttachment(); ~FrameBufferAttachment();
FrameBufferAttachment&operator = (const FrameBufferAttachment& copy); FrameBufferAttachment&operator = (const FrameBufferAttachment& copy);
bool isMultisample() const; bool isMultisample() const;
void createRequiredTexturesAndApplyGenerateMipMap(State& state, const FBOExtensions* ext) const; void createRequiredTexturesAndApplyGenerateMipMap(State& state, const FBOExtensions* ext) const;
@ -412,7 +412,7 @@ namespace osg
public: public:
typedef std::map<Camera::BufferComponent, FrameBufferAttachment> AttachmentMap; typedef std::map<Camera::BufferComponent, FrameBufferAttachment> AttachmentMap;
typedef std::vector<GLenum> MultipleRenderingTargets; typedef std::vector<GLenum> MultipleRenderingTargets;
typedef Camera::BufferComponent BufferComponent; typedef Camera::BufferComponent BufferComponent;
FrameBufferObject(); FrameBufferObject();
@ -421,19 +421,19 @@ namespace osg
META_StateAttribute(osg, FrameBufferObject, (StateAttribute::Type)0x101010/*FrameBufferObject*/); META_StateAttribute(osg, FrameBufferObject, (StateAttribute::Type)0x101010/*FrameBufferObject*/);
inline const AttachmentMap& getAttachmentMap() const; inline const AttachmentMap& getAttachmentMap() const;
void setAttachment(BufferComponent attachment_point, const FrameBufferAttachment &attachment); void setAttachment(BufferComponent attachment_point, const FrameBufferAttachment &attachment);
inline const FrameBufferAttachment& getAttachment(BufferComponent attachment_point) const; inline const FrameBufferAttachment& getAttachment(BufferComponent attachment_point) const;
inline bool hasAttachment(BufferComponent attachment_point) const; inline bool hasAttachment(BufferComponent attachment_point) const;
inline bool hasMultipleRenderingTargets() const { return !_drawBuffers.empty(); } inline bool hasMultipleRenderingTargets() const { return !_drawBuffers.empty(); }
inline const MultipleRenderingTargets& getMultipleRenderingTargets() const { return _drawBuffers; } inline const MultipleRenderingTargets& getMultipleRenderingTargets() const { return _drawBuffers; }
bool isMultisample() const; bool isMultisample() const;
int compare(const StateAttribute &sa) const; int compare(const StateAttribute &sa) const;
void apply(State &state) const; void apply(State &state) const;
enum BindTarget enum BindTarget
@ -472,12 +472,12 @@ namespace osg
FrameBufferObject& operator = (const FrameBufferObject&) { return *this; } FrameBufferObject& operator = (const FrameBufferObject&) { return *this; }
void updateDrawBuffers(); void updateDrawBuffers();
inline void dirtyAll(); inline void dirtyAll();
GLenum convertBufferComponentToGLenum(BufferComponent attachment_point) const; GLenum convertBufferComponentToGLenum(BufferComponent attachment_point) const;
private: private:
AttachmentMap _attachments; AttachmentMap _attachments;
// Buffers passed to glDrawBuffers when using multiple render targets. // Buffers passed to glDrawBuffers when using multiple render targets.
@ -486,7 +486,7 @@ namespace osg
mutable buffered_value<int> _dirtyAttachmentList; mutable buffered_value<int> _dirtyAttachmentList;
mutable buffered_value<int> _unsupported; mutable buffered_value<int> _unsupported;
mutable buffered_value<GLuint> _fboID; mutable buffered_value<GLuint> _fboID;
}; };
// INLINE METHODS // INLINE METHODS

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -30,43 +30,43 @@ namespace osg
* time of specific frame, used to synchronize operations on the scene graph * time of specific frame, used to synchronize operations on the scene graph
* and other machines when using a graphics cluster. Note the calendar * and other machines when using a graphics cluster. Note the calendar
* time can be an artificial simulation time or capture the real time * time can be an artificial simulation time or capture the real time
* of day etc.*/ * of day etc.*/
class OSG_EXPORT FrameStamp : public Referenced class OSG_EXPORT FrameStamp : public Referenced
{ {
public: public:
FrameStamp(); FrameStamp();
FrameStamp(const FrameStamp& fs); FrameStamp(const FrameStamp& fs);
FrameStamp& operator = (const FrameStamp& fs); FrameStamp& operator = (const FrameStamp& fs);
void setFrameNumber(unsigned int fnum) { _frameNumber = fnum; } void setFrameNumber(unsigned int fnum) { _frameNumber = fnum; }
unsigned int getFrameNumber() const { return _frameNumber; } unsigned int getFrameNumber() const { return _frameNumber; }
void setReferenceTime(double refTime) { _referenceTime = refTime; } void setReferenceTime(double refTime) { _referenceTime = refTime; }
double getReferenceTime() const { return _referenceTime; } double getReferenceTime() const { return _referenceTime; }
void setSimulationTime(double refTime) { _simulationTime = refTime; } void setSimulationTime(double refTime) { _simulationTime = refTime; }
double getSimulationTime() const { return _simulationTime; } double getSimulationTime() const { return _simulationTime; }
void setCalendarTime(const tm& calendarTime); void setCalendarTime(const tm& calendarTime);
void getCalendarTime(tm& calendarTime) const; void getCalendarTime(tm& calendarTime) const;
// keep public to allow it to be permit allocation which is // keep public to allow it to be permit allocation which is
// not on the heap used osgcluster // not on the heap used osgcluster
virtual ~FrameStamp(); virtual ~FrameStamp();
protected: protected:
// note no dynamic memory is used so that data can be passed // note no dynamic memory is used so that data can be passed
// via a simple memory copy or within a data packet across // via a simple memory copy or within a data packet across
// the network. // the network.
unsigned int _frameNumber; unsigned int _frameNumber;
double _referenceTime; double _referenceTime;
double _simulationTime; double _simulationTime;
// member variables of time.h's tm structure, copied here to // member variables of time.h's tm structure, copied here to
// ensure that all data is not dynamic. The tm structure itself // ensure that all data is not dynamic. The tm structure itself
// is not completely consistent between implementations, which // is not completely consistent between implementations, which
@ -81,8 +81,8 @@ class OSG_EXPORT FrameStamp : public Referenced
int tm_wday; /* Day of week. [0-6] */ int tm_wday; /* Day of week. [0-6] */
int tm_yday; /* Days in year. [0-365] */ int tm_yday; /* Days in year. [0-365] */
int tm_isdst; /* DST. [-1/0/1]*/ int tm_isdst; /* DST. [-1/0/1]*/
}; };
} }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -20,16 +20,16 @@
namespace osg { namespace osg {
/** Class to specify the orientation of front-facing polygons. /** Class to specify the orientation of front-facing polygons.
*/ */
class OSG_EXPORT FrontFace : public StateAttribute class OSG_EXPORT FrontFace : public StateAttribute
{ {
public : public :
enum Mode { enum Mode {
CLOCKWISE = GL_CW, CLOCKWISE = GL_CW,
COUNTER_CLOCKWISE = GL_CCW COUNTER_CLOCKWISE = GL_CCW
}; };
FrontFace(Mode face=COUNTER_CLOCKWISE); FrontFace(Mode face=COUNTER_CLOCKWISE);
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
@ -38,7 +38,7 @@ class OSG_EXPORT FrontFace : public StateAttribute
_mode(ff._mode) {} _mode(ff._mode) {}
META_StateAttribute(osg, FrontFace, FRONTFACE); META_StateAttribute(osg, FrontFace, FRONTFACE);
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -51,16 +51,16 @@ class OSG_EXPORT FrontFace : public StateAttribute
return 0; // passed all the above comparison macros, must be equal. return 0; // passed all the above comparison macros, must be equal.
} }
inline void setMode(Mode mode) { _mode = mode; } inline void setMode(Mode mode) { _mode = mode; }
inline Mode getMode() const { return _mode; } inline Mode getMode() const { return _mode; }
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected: protected:
virtual ~FrontFace(); virtual ~FrontFace();
Mode _mode; Mode _mode;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -42,7 +42,7 @@
#ifndef WIN32 #ifndef WIN32
// Required for compatibility with glext.h sytle function definitions of // Required for compatibility with glext.h sytle function definitions of
// OpenGL extensions, such as in src/osg/Point.cpp. // OpenGL extensions, such as in src/osg/Point.cpp.
#ifndef APIENTRY #ifndef APIENTRY
#define APIENTRY #define APIENTRY
@ -56,7 +56,7 @@
#define GLUT_APIENTRY_DEFINED #define GLUT_APIENTRY_DEFINED
#define APIENTRY __stdcall #define APIENTRY __stdcall
#endif #endif
// XXX This is from Win32's <windef.h> // XXX This is from Win32's <windef.h>
#ifndef CALLBACK #ifndef CALLBACK
#define CALLBACK __stdcall #define CALLBACK __stdcall
#endif #endif
@ -64,9 +64,9 @@
#else // ! __CYGWIN__ #else // ! __CYGWIN__
// Under Windows avoid including <windows.h> // Under Windows avoid including <windows.h>
// to avoid name space pollution, but Win32's <GL/gl.h> // to avoid name space pollution, but Win32's <GL/gl.h>
// needs APIENTRY and WINGDIAPI defined properly. // needs APIENTRY and WINGDIAPI defined properly.
// XXX This is from Win32's <windef.h> // XXX This is from Win32's <windef.h>
#ifndef APIENTRY #ifndef APIENTRY
#define GLUT_APIENTRY_DEFINED #define GLUT_APIENTRY_DEFINED
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
@ -77,7 +77,7 @@
#endif #endif
#endif #endif
// XXX This is from Win32's <windef.h> // XXX This is from Win32's <windef.h>
#ifndef CALLBACK #ifndef CALLBACK
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#define CALLBACK __stdcall #define CALLBACK __stdcall
@ -88,13 +88,13 @@
#endif // __CYGWIN__ #endif // __CYGWIN__
// XXX This is from Win32's <wingdi.h> and <winnt.h> // XXX This is from Win32's <wingdi.h> and <winnt.h>
#ifndef WINGDIAPI #ifndef WINGDIAPI
#define GLUT_WINGDIAPI_DEFINED #define GLUT_WINGDIAPI_DEFINED
#define DECLSPEC_IMPORT __declspec(dllimport) #define DECLSPEC_IMPORT __declspec(dllimport)
#define WINGDIAPI DECLSPEC_IMPORT #define WINGDIAPI DECLSPEC_IMPORT
#endif #endif
// XXX This is from Win32's <ctype.h> // XXX This is from Win32's <ctype.h>
#if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4))) #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4)))
typedef unsigned short wchar_t; typedef unsigned short wchar_t;
@ -189,31 +189,31 @@
#ifdef OSG_GL1_AVAILABLE #ifdef OSG_GL1_AVAILABLE
#define OSG_GL1_FEATURES true #define OSG_GL1_FEATURES true
#else #else
#define OSG_GL1_FEATURES false #define OSG_GL1_FEATURES false
#endif #endif
#ifdef OSG_GL2_AVAILABLE #ifdef OSG_GL2_AVAILABLE
#define OSG_GL2_FEATURES true #define OSG_GL2_FEATURES true
#else #else
#define OSG_GL2_FEATURES false #define OSG_GL2_FEATURES false
#endif #endif
#ifdef OSG_GL3_AVAILABLE #ifdef OSG_GL3_AVAILABLE
#define OSG_GL3_FEATURES true #define OSG_GL3_FEATURES true
#else #else
#define OSG_GL3_FEATURES false #define OSG_GL3_FEATURES false
#endif #endif
#ifdef OSG_GLES1_AVAILABLE #ifdef OSG_GLES1_AVAILABLE
#define OSG_GLES1_FEATURES true #define OSG_GLES1_FEATURES true
#else #else
#define OSG_GLES1_FEATURES false #define OSG_GLES1_FEATURES false
#endif #endif
#ifdef OSG_GLES2_AVAILABLE #ifdef OSG_GLES2_AVAILABLE
#define OSG_GLES2_FEATURES true #define OSG_GLES2_FEATURES true
#else #else
#define OSG_GLES2_FEATURES false #define OSG_GLES2_FEATURES false
#endif #endif

View File

@ -1,14 +1,14 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd. * Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
* Copyright (C) 2004-2005 Nathan Cournia * Copyright (C) 2004-2005 Nathan Cournia
* Copyright (C) 2007 Art Tevs * Copyright (C) 2007 Art Tevs
* Copyright (C) 2008 Zebra Imaging * Copyright (C) 2008 Zebra Imaging
* Copyright (C) 2010 VIRES Simulationstechnologie GmbH * Copyright (C) 2010 VIRES Simulationstechnologie GmbH
* *
* 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 * freely and without restriction, both in commercial and non commercial
* applications, as long as this copyright notice is maintained. * applications, as long as this copyright notice is maintained.
* *
* This application is distributed in the hope that it will be useful, * This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@ -535,80 +535,80 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
typedef void (GL_APIENTRY * GetProgramivProc)(GLuint program, GLenum pname, GLint *params); typedef void (GL_APIENTRY * GetProgramivProc)(GLuint program, GLenum pname, GLint *params);
typedef void (GL_APIENTRY * GetObjectParameterivARBProc)(GLuint program, GLenum pname, GLint *params); typedef void (GL_APIENTRY * GetObjectParameterivARBProc)(GLuint program, GLenum pname, GLint *params);
typedef void (GL_APIENTRY * GetProgramInfoLogProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); typedef void (GL_APIENTRY * GetProgramInfoLogProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void (GL_APIENTRY * GetInfoLogARBProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); typedef void (GL_APIENTRY * GetInfoLogARBProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void (GL_APIENTRY * GetShaderivProc)(GLuint shader, GLenum pname, GLint *params); typedef void (GL_APIENTRY * GetShaderivProc)(GLuint shader, GLenum pname, GLint *params);
typedef void (GL_APIENTRY * GetShaderInfoLogProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); typedef void (GL_APIENTRY * GetShaderInfoLogProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void (GL_APIENTRY * GetShaderSourceProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); typedef void (GL_APIENTRY * GetShaderSourceProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
typedef GLint (GL_APIENTRY * GetUniformLocationProc)(GLuint program, const GLchar *name); typedef GLint (GL_APIENTRY * GetUniformLocationProc)(GLuint program, const GLchar *name);
typedef void (GL_APIENTRY * GetUniformfvProc)(GLuint program, GLint location, GLfloat *params); typedef void (GL_APIENTRY * GetUniformfvProc)(GLuint program, GLint location, GLfloat *params);
typedef void (GL_APIENTRY * GetUniformivProc)(GLuint program, GLint location, GLint *params); typedef void (GL_APIENTRY * GetUniformivProc)(GLuint program, GLint location, GLint *params);
typedef void (GL_APIENTRY * GetVertexAttribdvProc)(GLuint index, GLenum pname, GLdouble *params); typedef void (GL_APIENTRY * GetVertexAttribdvProc)(GLuint index, GLenum pname, GLdouble *params);
typedef void (GL_APIENTRY * GetVertexAttribfvProc)(GLuint index, GLenum pname, GLfloat *params); typedef void (GL_APIENTRY * GetVertexAttribfvProc)(GLuint index, GLenum pname, GLfloat *params);
typedef void (GL_APIENTRY * GetVertexAttribivProc)(GLuint index, GLenum pname, GLint *params); typedef void (GL_APIENTRY * GetVertexAttribivProc)(GLuint index, GLenum pname, GLint *params);
typedef void (GL_APIENTRY * GetVertexAttribPointervProc)(GLuint index, GLenum pname, GLvoid* *pointer); typedef void (GL_APIENTRY * GetVertexAttribPointervProc)(GLuint index, GLenum pname, GLvoid* *pointer);
typedef GLboolean (GL_APIENTRY * IsProgramProc)(GLuint program); typedef GLboolean (GL_APIENTRY * IsProgramProc)(GLuint program);
typedef GLboolean (GL_APIENTRY * IsShaderProc)(GLuint shader); typedef GLboolean (GL_APIENTRY * IsShaderProc)(GLuint shader);
typedef void (GL_APIENTRY * LinkProgramProc)(GLuint program); typedef void (GL_APIENTRY * LinkProgramProc)(GLuint program);
typedef void (GL_APIENTRY * ShaderSourceProc)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); typedef void (GL_APIENTRY * ShaderSourceProc)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
typedef void (GL_APIENTRY * UseProgramProc)(GLuint program); typedef void (GL_APIENTRY * UseProgramProc)(GLuint program);
typedef void (GL_APIENTRY * Uniform1fProc)(GLint location, GLfloat v0); typedef void (GL_APIENTRY * Uniform1fProc)(GLint location, GLfloat v0);
typedef void (GL_APIENTRY * Uniform2fProc)(GLint location, GLfloat v0, GLfloat v1); typedef void (GL_APIENTRY * Uniform2fProc)(GLint location, GLfloat v0, GLfloat v1);
typedef void (GL_APIENTRY * Uniform3fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); typedef void (GL_APIENTRY * Uniform3fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
typedef void (GL_APIENTRY * Uniform4fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); typedef void (GL_APIENTRY * Uniform4fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
typedef void (GL_APIENTRY * Uniform1iProc)(GLint location, GLint v0); typedef void (GL_APIENTRY * Uniform1iProc)(GLint location, GLint v0);
typedef void (GL_APIENTRY * Uniform2iProc)(GLint location, GLint v0, GLint v1); typedef void (GL_APIENTRY * Uniform2iProc)(GLint location, GLint v0, GLint v1);
typedef void (GL_APIENTRY * Uniform3iProc)(GLint location, GLint v0, GLint v1, GLint v2); typedef void (GL_APIENTRY * Uniform3iProc)(GLint location, GLint v0, GLint v1, GLint v2);
typedef void (GL_APIENTRY * Uniform4iProc)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); typedef void (GL_APIENTRY * Uniform4iProc)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
typedef void (GL_APIENTRY * Uniform1fvProc)(GLint location, GLsizei count, const GLfloat *value); typedef void (GL_APIENTRY * Uniform1fvProc)(GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRY * Uniform2fvProc)(GLint location, GLsizei count, const GLfloat *value); typedef void (GL_APIENTRY * Uniform2fvProc)(GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRY * Uniform3fvProc)(GLint location, GLsizei count, const GLfloat *value); typedef void (GL_APIENTRY * Uniform3fvProc)(GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRY * Uniform4fvProc)(GLint location, GLsizei count, const GLfloat *value); typedef void (GL_APIENTRY * Uniform4fvProc)(GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRY * Uniform1ivProc)(GLint location, GLsizei count, const GLint *value); typedef void (GL_APIENTRY * Uniform1ivProc)(GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRY * Uniform2ivProc)(GLint location, GLsizei count, const GLint *value); typedef void (GL_APIENTRY * Uniform2ivProc)(GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRY * Uniform3ivProc)(GLint location, GLsizei count, const GLint *value); typedef void (GL_APIENTRY * Uniform3ivProc)(GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRY * Uniform4ivProc)(GLint location, GLsizei count, const GLint *value); typedef void (GL_APIENTRY * Uniform4ivProc)(GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRY * UniformMatrix2fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GL_APIENTRY * UniformMatrix2fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRY * UniformMatrix3fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GL_APIENTRY * UniformMatrix3fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRY * UniformMatrix4fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GL_APIENTRY * UniformMatrix4fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRY * ValidateProgramProc)(GLuint program); typedef void (GL_APIENTRY * ValidateProgramProc)(GLuint program);
typedef void (GL_APIENTRY * VertexAttrib1dProc)(GLuint index, GLdouble x); typedef void (GL_APIENTRY * VertexAttrib1dProc)(GLuint index, GLdouble x);
typedef void (GL_APIENTRY * VertexAttrib1dvProc)(GLuint index, const GLdouble *v); typedef void (GL_APIENTRY * VertexAttrib1dvProc)(GLuint index, const GLdouble *v);
typedef void (GL_APIENTRY * VertexAttrib1fProc)(GLuint index, GLfloat x); typedef void (GL_APIENTRY * VertexAttrib1fProc)(GLuint index, GLfloat x);
typedef void (GL_APIENTRY * VertexAttrib1fvProc)(GLuint index, const GLfloat *v); typedef void (GL_APIENTRY * VertexAttrib1fvProc)(GLuint index, const GLfloat *v);
typedef void (GL_APIENTRY * VertexAttrib1sProc)(GLuint index, GLshort x); typedef void (GL_APIENTRY * VertexAttrib1sProc)(GLuint index, GLshort x);
typedef void (GL_APIENTRY * VertexAttrib1svProc)(GLuint index, const GLshort *v); typedef void (GL_APIENTRY * VertexAttrib1svProc)(GLuint index, const GLshort *v);
typedef void (GL_APIENTRY * VertexAttrib2dProc)(GLuint index, GLdouble x, GLdouble y); typedef void (GL_APIENTRY * VertexAttrib2dProc)(GLuint index, GLdouble x, GLdouble y);
typedef void (GL_APIENTRY * VertexAttrib2dvProc)(GLuint index, const GLdouble *v); typedef void (GL_APIENTRY * VertexAttrib2dvProc)(GLuint index, const GLdouble *v);
typedef void (GL_APIENTRY * VertexAttrib2fProc)(GLuint index, GLfloat x, GLfloat y); typedef void (GL_APIENTRY * VertexAttrib2fProc)(GLuint index, GLfloat x, GLfloat y);
typedef void (GL_APIENTRY * VertexAttrib2fvProc)(GLuint index, const GLfloat *v); typedef void (GL_APIENTRY * VertexAttrib2fvProc)(GLuint index, const GLfloat *v);
typedef void (GL_APIENTRY * VertexAttrib2sProc)(GLuint index, GLshort x, GLshort y); typedef void (GL_APIENTRY * VertexAttrib2sProc)(GLuint index, GLshort x, GLshort y);
typedef void (GL_APIENTRY * VertexAttrib2svProc)(GLuint index, const GLshort *v); typedef void (GL_APIENTRY * VertexAttrib2svProc)(GLuint index, const GLshort *v);
typedef void (GL_APIENTRY * VertexAttrib3dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (GL_APIENTRY * VertexAttrib3dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z);
typedef void (GL_APIENTRY * VertexAttrib3dvProc)(GLuint index, const GLdouble *v); typedef void (GL_APIENTRY * VertexAttrib3dvProc)(GLuint index, const GLdouble *v);
typedef void (GL_APIENTRY * VertexAttrib3fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z); typedef void (GL_APIENTRY * VertexAttrib3fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z);
typedef void (GL_APIENTRY * VertexAttrib3fvProc)(GLuint index, const GLfloat *v); typedef void (GL_APIENTRY * VertexAttrib3fvProc)(GLuint index, const GLfloat *v);
typedef void (GL_APIENTRY * VertexAttrib3sProc)(GLuint index, GLshort x, GLshort y, GLshort z); typedef void (GL_APIENTRY * VertexAttrib3sProc)(GLuint index, GLshort x, GLshort y, GLshort z);
typedef void (GL_APIENTRY * VertexAttrib3svProc)(GLuint index, const GLshort *v); typedef void (GL_APIENTRY * VertexAttrib3svProc)(GLuint index, const GLshort *v);
typedef void (GL_APIENTRY * VertexAttrib4NbvProc)(GLuint index, const GLbyte *v); typedef void (GL_APIENTRY * VertexAttrib4NbvProc)(GLuint index, const GLbyte *v);
typedef void (GL_APIENTRY * VertexAttrib4NivProc)(GLuint index, const GLint *v); typedef void (GL_APIENTRY * VertexAttrib4NivProc)(GLuint index, const GLint *v);
typedef void (GL_APIENTRY * VertexAttrib4NsvProc)(GLuint index, const GLshort *v); typedef void (GL_APIENTRY * VertexAttrib4NsvProc)(GLuint index, const GLshort *v);
typedef void (GL_APIENTRY * VertexAttrib4NubProc)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); typedef void (GL_APIENTRY * VertexAttrib4NubProc)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
typedef void (GL_APIENTRY * VertexAttrib4NubvProc)(GLuint index, const GLubyte *v); typedef void (GL_APIENTRY * VertexAttrib4NubvProc)(GLuint index, const GLubyte *v);
typedef void (GL_APIENTRY * VertexAttrib4NuivProc)(GLuint index, const GLuint *v); typedef void (GL_APIENTRY * VertexAttrib4NuivProc)(GLuint index, const GLuint *v);
typedef void (GL_APIENTRY * VertexAttrib4NusvProc)(GLuint index, const GLushort *v); typedef void (GL_APIENTRY * VertexAttrib4NusvProc)(GLuint index, const GLushort *v);
typedef void (GL_APIENTRY * VertexAttrib4bvProc)(GLuint index, const GLbyte *v); typedef void (GL_APIENTRY * VertexAttrib4bvProc)(GLuint index, const GLbyte *v);
typedef void (GL_APIENTRY * VertexAttrib4dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GL_APIENTRY * VertexAttrib4dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (GL_APIENTRY * VertexAttrib4dvProc)(GLuint index, const GLdouble *v); typedef void (GL_APIENTRY * VertexAttrib4dvProc)(GLuint index, const GLdouble *v);
typedef void (GL_APIENTRY * VertexAttrib4fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GL_APIENTRY * VertexAttrib4fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (GL_APIENTRY * VertexAttrib4fvProc)(GLuint index, const GLfloat *v); typedef void (GL_APIENTRY * VertexAttrib4fvProc)(GLuint index, const GLfloat *v);
typedef void (GL_APIENTRY * VertexAttrib4ivProc)(GLuint index, const GLint *v); typedef void (GL_APIENTRY * VertexAttrib4ivProc)(GLuint index, const GLint *v);
typedef void (GL_APIENTRY * VertexAttrib4sProc)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (GL_APIENTRY * VertexAttrib4sProc)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
typedef void (GL_APIENTRY * VertexAttrib4svProc)(GLuint index, const GLshort *v); typedef void (GL_APIENTRY * VertexAttrib4svProc)(GLuint index, const GLshort *v);
typedef void (GL_APIENTRY * VertexAttrib4ubvProc)(GLuint index, const GLubyte *v); typedef void (GL_APIENTRY * VertexAttrib4ubvProc)(GLuint index, const GLubyte *v);
typedef void (GL_APIENTRY * VertexAttrib4uivProc)(GLuint index, const GLuint *v); typedef void (GL_APIENTRY * VertexAttrib4uivProc)(GLuint index, const GLuint *v);
typedef void (GL_APIENTRY * VertexAttrib4usvProc)(GLuint index, const GLushort *v); typedef void (GL_APIENTRY * VertexAttrib4usvProc)(GLuint index, const GLushort *v);
typedef void (GL_APIENTRY * VertexAttribPointerProc)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); typedef void (GL_APIENTRY * VertexAttribPointerProc)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
typedef void (GL_APIENTRY * UniformMatrix2x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); typedef void (GL_APIENTRY * UniformMatrix2x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
typedef void (GL_APIENTRY * UniformMatrix3x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); typedef void (GL_APIENTRY * UniformMatrix3x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
typedef void (GL_APIENTRY * UniformMatrix2x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); typedef void (GL_APIENTRY * UniformMatrix2x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
typedef void (GL_APIENTRY * UniformMatrix4x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); typedef void (GL_APIENTRY * UniformMatrix4x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
@ -642,7 +642,7 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
typedef void (GL_APIENTRY * GetProgramBinaryProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); typedef void (GL_APIENTRY * GetProgramBinaryProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
typedef void (GL_APIENTRY * ProgramBinaryProc)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); typedef void (GL_APIENTRY * ProgramBinaryProc)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
BlendEquationSeparateProc _glBlendEquationSeparate; BlendEquationSeparateProc _glBlendEquationSeparate;
DrawBuffersProc _glDrawBuffers; DrawBuffersProc _glDrawBuffers;
StencilOpSeparateProc _glStencilOpSeparate; StencilOpSeparateProc _glStencilOpSeparate;
StencilFuncSeparateProc _glStencilFuncSeparate; StencilFuncSeparateProc _glStencilFuncSeparate;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -49,7 +49,7 @@ extern OSG_EXPORT bool isGLExtensionOrVersionSupported(unsigned int contextID, c
* Note, glGLExtensionFuncPtr is declared inline so that the code * Note, glGLExtensionFuncPtr is declared inline so that the code
* is compiled locally to the calling code. This should get by Windows' * is compiled locally to the calling code. This should get by Windows'
* dumb implementation of having different GL function ptr's for each * dumb implementation of having different GL function ptr's for each
* library when linked to it. * library when linked to it.
*/ */
extern OSG_EXPORT void* getGLExtensionFuncPtr(const char *funcName); extern OSG_EXPORT void* getGLExtensionFuncPtr(const char *funcName);
@ -109,12 +109,12 @@ bool setGLExtensionFuncPtr(T& t, const char* str1)
if (data) if (data)
{ {
memcpy(&t, &data, sizeof(T)); memcpy(&t, &data, sizeof(T));
return true; return true;
} }
else else
{ {
t = 0; t = 0;
return false; return false;
} }
} }
@ -125,12 +125,12 @@ bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2)
if (data) if (data)
{ {
memcpy(&t, &data, sizeof(T)); memcpy(&t, &data, sizeof(T));
return true; return true;
} }
else else
{ {
t = 0; t = 0;
return false; return false;
} }
} }
@ -141,12 +141,12 @@ bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2, const char*
if (data) if (data)
{ {
memcpy(&t, &data, sizeof(T)); memcpy(&t, &data, sizeof(T));
return true; return true;
} }
else else
{ {
t = 0; t = 0;
return false; return false;
} }
} }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -40,7 +40,7 @@ class OSG_EXPORT Geode : public Node
virtual Geode* asGeode() { return this; } virtual Geode* asGeode() { return this; }
virtual const Geode* asGeode() const { return this; } virtual const Geode* asGeode() const { return this; }
/** Add a \c Drawable to the \c Geode. /** Add a \c Drawable to the \c Geode.
* If \c drawable is not \c NULL and is not contained in the \c Geode * If \c drawable is not \c NULL and is not contained in the \c Geode
* then increment its reference count, add it to the drawables list and * then increment its reference count, add it to the drawables list and

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -32,9 +32,9 @@ class OSG_EXPORT Geometry : public Drawable
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY); Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return new Geometry(); } virtual Object* cloneType() const { return new Geometry(); }
virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); } virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Geometry*>(obj)!=NULL; } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Geometry*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Geometry"; } virtual const char* className() const { return "Geometry"; }
@ -52,13 +52,13 @@ class OSG_EXPORT Geometry : public Drawable
BIND_PER_PRIMITIVE, BIND_PER_PRIMITIVE,
BIND_PER_VERTEX BIND_PER_VERTEX
}; };
struct OSG_EXPORT ArrayData struct OSG_EXPORT ArrayData
{ {
ArrayData(): ArrayData():
binding(BIND_OFF), binding(BIND_OFF),
normalize(GL_FALSE) {} normalize(GL_FALSE) {}
ArrayData(const ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); ArrayData(const ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
ArrayData(Array* a, AttributeBinding b, GLboolean n = GL_FALSE): ArrayData(Array* a, AttributeBinding b, GLboolean n = GL_FALSE):
@ -81,21 +81,21 @@ class OSG_EXPORT Geometry : public Drawable
normalize = rhs.normalize; normalize = rhs.normalize;
return *this; return *this;
} }
inline bool empty() const { return !array.valid(); } inline bool empty() const { return !array.valid(); }
ref_ptr<Array> array; ref_ptr<Array> array;
ref_ptr<IndexArray> indices; ref_ptr<IndexArray> indices;
AttributeBinding binding; AttributeBinding binding;
GLboolean normalize; GLboolean normalize;
}; };
struct OSG_EXPORT Vec3ArrayData struct OSG_EXPORT Vec3ArrayData
{ {
Vec3ArrayData(): Vec3ArrayData():
binding(BIND_OFF), binding(BIND_OFF),
normalize(GL_FALSE) {} normalize(GL_FALSE) {}
Vec3ArrayData(const Vec3ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); Vec3ArrayData(const Vec3ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
Vec3ArrayData(Vec3Array* a, AttributeBinding b, GLboolean n = GL_FALSE): Vec3ArrayData(Vec3Array* a, AttributeBinding b, GLboolean n = GL_FALSE):
@ -119,7 +119,7 @@ class OSG_EXPORT Geometry : public Drawable
return *this; return *this;
} }
inline bool empty() const { return !array.valid(); } inline bool empty() const { return !array.valid(); }
ref_ptr<Vec3Array> array; ref_ptr<Vec3Array> array;
ref_ptr<IndexArray> indices; ref_ptr<IndexArray> indices;
@ -127,13 +127,13 @@ class OSG_EXPORT Geometry : public Drawable
GLboolean normalize; GLboolean normalize;
}; };
/** Static ArrayData which is returned from getTexCoordData(i) const and getVertexAttribData(i) const /** Static ArrayData which is returned from getTexCoordData(i) const and getVertexAttribData(i) const
* when i is out of range. * when i is out of range.
*/ */
static const ArrayData s_InvalidArrayData; static const ArrayData s_InvalidArrayData;
typedef std::vector< ArrayData > ArrayDataList; typedef std::vector< ArrayData > ArrayDataList;
void setVertexArray(Array* array); void setVertexArray(Array* array);
Array* getVertexArray() { return _vertexData.array.get(); } Array* getVertexArray() { return _vertexData.array.get(); }
@ -142,7 +142,7 @@ class OSG_EXPORT Geometry : public Drawable
void setVertexData(const ArrayData& arrayData); void setVertexData(const ArrayData& arrayData);
ArrayData& getVertexData() { return _vertexData; } ArrayData& getVertexData() { return _vertexData; }
const ArrayData& getVertexData() const { return _vertexData; } const ArrayData& getVertexData() const { return _vertexData; }
void setNormalBinding(AttributeBinding ab); void setNormalBinding(AttributeBinding ab);
AttributeBinding getNormalBinding() const { return _normalData.binding; } AttributeBinding getNormalBinding() const { return _normalData.binding; }
@ -189,7 +189,7 @@ class OSG_EXPORT Geometry : public Drawable
void setFogCoordData(const ArrayData& arrayData); void setFogCoordData(const ArrayData& arrayData);
ArrayData& getFogCoordData() { return _fogCoordData; } ArrayData& getFogCoordData() { return _fogCoordData; }
const ArrayData& getFogCoordData() const { return _fogCoordData; } const ArrayData& getFogCoordData() const { return _fogCoordData; }
void setTexCoordArray(unsigned int unit,Array*); void setTexCoordArray(unsigned int unit,Array*);
Array* getTexCoordArray(unsigned int unit); Array* getTexCoordArray(unsigned int unit);
@ -228,23 +228,23 @@ class OSG_EXPORT Geometry : public Drawable
typedef std::vector< ref_ptr<PrimitiveSet> > PrimitiveSetList; typedef std::vector< ref_ptr<PrimitiveSet> > PrimitiveSetList;
void setPrimitiveSetList(const PrimitiveSetList& primitives); void setPrimitiveSetList(const PrimitiveSetList& primitives);
PrimitiveSetList& getPrimitiveSetList() { return _primitives; } PrimitiveSetList& getPrimitiveSetList() { return _primitives; }
const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; } const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; }
unsigned int getNumPrimitiveSets() const { return static_cast<unsigned int>(_primitives.size()); } unsigned int getNumPrimitiveSets() const { return static_cast<unsigned int>(_primitives.size()); }
PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); } PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); }
const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); } const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); }
/** Add a primitive set to the geometry. */ /** Add a primitive set to the geometry. */
bool addPrimitiveSet(PrimitiveSet* primitiveset); bool addPrimitiveSet(PrimitiveSet* primitiveset);
/** Set a primitive set to the specified position in geometry's primitive set list. */ /** Set a primitive set to the specified position in geometry's primitive set list. */
bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
/** Insert a primitive set to the specified position in geometry's primitive set list. */ /** Insert a primitive set to the specified position in geometry's primitive set list. */
bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
/** Remove primitive set(s) from the specified position in geometry's primitive set list. */ /** Remove primitive set(s) from the specified position in geometry's primitive set list. */
bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1); bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1);
@ -260,7 +260,7 @@ class OSG_EXPORT Geometry : public Drawable
void setVertexIndices(IndexArray* array); void setVertexIndices(IndexArray* array);
IndexArray* getVertexIndices() { return _vertexData.indices.get(); } IndexArray* getVertexIndices() { return _vertexData.indices.get(); }
const IndexArray* getVertexIndices() const { return _vertexData.indices.get(); } const IndexArray* getVertexIndices() const { return _vertexData.indices.get(); }
/** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/
void setNormalIndices(IndexArray* array); void setNormalIndices(IndexArray* array);
IndexArray* getNormalIndices() { return _normalData.indices.get(); } IndexArray* getNormalIndices() { return _normalData.indices.get(); }
@ -294,7 +294,7 @@ class OSG_EXPORT Geometry : public Drawable
/** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation
method to use OpenGL vertex buffer objects for rendering.*/ method to use OpenGL vertex buffer objects for rendering.*/
virtual void setUseVertexBufferObjects(bool flag); virtual void setUseVertexBufferObjects(bool flag);
@ -358,9 +358,9 @@ class OSG_EXPORT Geometry : public Drawable
bool containsSharedArrays() const; bool containsSharedArrays() const;
void duplicateSharedArrays(); void duplicateSharedArrays();
void computeInternalOptimizedGeometry(); void computeInternalOptimizedGeometry();
@ -418,16 +418,16 @@ class OSG_EXPORT Geometry : public Drawable
Geometry& operator = (const Geometry&) { return *this;} Geometry& operator = (const Geometry&) { return *this;}
virtual ~Geometry(); virtual ~Geometry();
bool verifyBindings(const ArrayData& arrayData) const; bool verifyBindings(const ArrayData& arrayData) const;
bool verifyBindings(const Vec3ArrayData& arrayData) const; bool verifyBindings(const Vec3ArrayData& arrayData) const;
void computeCorrectBindingsAndArraySizes(ArrayData& arrayData,const char* arrayName); void computeCorrectBindingsAndArraySizes(ArrayData& arrayData,const char* arrayName);
void computeCorrectBindingsAndArraySizes(Vec3ArrayData& arrayData,const char* arrayName); void computeCorrectBindingsAndArraySizes(Vec3ArrayData& arrayData,const char* arrayName);
void addVertexBufferObjectIfRequired(osg::Array* array); void addVertexBufferObjectIfRequired(osg::Array* array);
void addElementBufferObjectIfRequired(osg::PrimitiveSet* primitiveSet); void addElementBufferObjectIfRequired(osg::PrimitiveSet* primitiveSet);
PrimitiveSetList _primitives; PrimitiveSetList _primitives;
ArrayData _vertexData; ArrayData _vertexData;

View File

@ -29,7 +29,7 @@ class Camera;
class OSG_EXPORT GraphicsContext : public Object class OSG_EXPORT GraphicsContext : public Object
{ {
public: public:
struct OSG_EXPORT ScreenIdentifier struct OSG_EXPORT ScreenIdentifier
{ {
ScreenIdentifier(); ScreenIdentifier();
@ -37,16 +37,16 @@ class OSG_EXPORT GraphicsContext : public Object
ScreenIdentifier(int in_screenNum); ScreenIdentifier(int in_screenNum);
ScreenIdentifier(const std::string& in_hostName,int in_displayNum, int in_screenNum); ScreenIdentifier(const std::string& in_hostName,int in_displayNum, int in_screenNum);
/** Return the display name in the form hostName::displayNum:screenNum. */ /** Return the display name in the form hostName::displayNum:screenNum. */
std::string displayName() const; std::string displayName() const;
/** Read the DISPLAY environmental variable, and set the ScreenIdentifier accordingly. /** Read the DISPLAY environmental variable, and set the ScreenIdentifier accordingly.
* Note, if either of displayNum or screenNum are not defined then -1 is set respectively to * Note, if either of displayNum or screenNum are not defined then -1 is set respectively to
* signify that this parameter has not been set. When parameters are undefined one can call * signify that this parameter has not been set. When parameters are undefined one can call
* call setUndefinedScreenDetailsToDefaultScreen() after readDISPLAY() to ensure valid values. */ * call setUndefinedScreenDetailsToDefaultScreen() after readDISPLAY() to ensure valid values. */
void readDISPLAY(); void readDISPLAY();
/** Set the screenIndentifier from the displayName string. /** Set the screenIndentifier from the displayName string.
* Note, if either of displayNum or screenNum are not defined then -1 is set to * Note, if either of displayNum or screenNum are not defined then -1 is set to
* signify that this parameter has not been set. When parameters are undefined one can call * signify that this parameter has not been set. When parameters are undefined one can call
@ -64,23 +64,23 @@ class OSG_EXPORT GraphicsContext : public Object
int displayNum; int displayNum;
int screenNum; int screenNum;
}; };
/** GraphicsContext Traits object provides the specification of what type of graphics context is required.*/ /** GraphicsContext Traits object provides the specification of what type of graphics context is required.*/
struct OSG_EXPORT Traits : public osg::Referenced, public ScreenIdentifier struct OSG_EXPORT Traits : public osg::Referenced, public ScreenIdentifier
{ {
Traits(DisplaySettings* ds=0); Traits(DisplaySettings* ds=0);
// graphics context original and size // graphics context original and size
int x; int x;
int y; int y;
int width; int width;
int height; int height;
// window decoration and behaviour // window decoration and behaviour
std::string windowName; std::string windowName;
bool windowDecoration; bool windowDecoration;
bool supportsResize; bool supportsResize;
// buffer depths, 0 equals off. // buffer depths, 0 equals off.
unsigned int red; unsigned int red;
unsigned int blue; unsigned int blue;
@ -104,10 +104,10 @@ class OSG_EXPORT GraphicsContext : public Object
unsigned int level; unsigned int level;
unsigned int face; unsigned int face;
unsigned int mipMapGeneration; unsigned int mipMapGeneration;
// V-sync // V-sync
bool vsync; bool vsync;
// Swap Group // Swap Group
bool swapGroupEnabled; bool swapGroupEnabled;
GLuint swapGroup; GLuint swapGroup;
@ -115,7 +115,7 @@ class OSG_EXPORT GraphicsContext : public Object
// use multithreaded OpenGL-engine (OS X only) // use multithreaded OpenGL-engine (OS X only)
bool useMultiThreadedOpenGLEngine; bool useMultiThreadedOpenGLEngine;
// enable cursor // enable cursor
bool useCursor; bool useCursor;
@ -126,15 +126,15 @@ class OSG_EXPORT GraphicsContext : public Object
/** return true if glContextVersion is set in the form major.minor, and assign the appropriate major and minor values to the associated parameters.*/ /** return true if glContextVersion is set in the form major.minor, and assign the appropriate major and minor values to the associated parameters.*/
bool getContextVersion(unsigned int& major, unsigned int& minor) const; bool getContextVersion(unsigned int& major, unsigned int& minor) const;
// shared context // shared context
GraphicsContext* sharedContext; GraphicsContext* sharedContext;
osg::ref_ptr<osg::Referenced> inheritedWindowData; osg::ref_ptr<osg::Referenced> inheritedWindowData;
// ask the GraphicsWindow implementation to set the pixel format of an inherited window // ask the GraphicsWindow implementation to set the pixel format of an inherited window
bool setInheritedWindowPixelFormat; bool setInheritedWindowPixelFormat;
// X11 hint whether to override the window managers window size/position redirection // X11 hint whether to override the window managers window size/position redirection
bool overrideRedirect; bool overrideRedirect;
@ -177,7 +177,7 @@ class OSG_EXPORT GraphicsContext : public Object
virtual void enumerateScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettingsList & resolutionList) = 0; virtual void enumerateScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettingsList & resolutionList) = 0;
virtual GraphicsContext* createGraphicsContext(Traits* traits) = 0; virtual GraphicsContext* createGraphicsContext(Traits* traits) = 0;
virtual ~WindowingSystemInterface() {} virtual ~WindowingSystemInterface() {}
@ -207,17 +207,17 @@ class OSG_EXPORT GraphicsContext : public Object
return setScreenSettings(screenIdentifier, settings); return setScreenSettings(screenIdentifier, settings);
} }
}; };
/** Set the query the windowing system for screens and create graphics context - this functor should be supplied by the windows toolkit. */ /** Set the query the windowing system for screens and create graphics context - this functor should be supplied by the windows toolkit. */
static void setWindowingSystemInterface(WindowingSystemInterface* wsInterface); static void setWindowingSystemInterface(WindowingSystemInterface* wsInterface);
/** Get the WindowingSystemInterface*/ /** Get the WindowingSystemInterface*/
static WindowingSystemInterface* getWindowingSystemInterface(); static WindowingSystemInterface* getWindowingSystemInterface();
/** Create a graphics context for a specified set of traits.*/ /** Create a graphics context for a specified set of traits.*/
static GraphicsContext* createGraphicsContext(Traits* traits); static GraphicsContext* createGraphicsContext(Traits* traits);
/** Create a contextID for a new graphics context, this contextID is used to set up the osg::State associate with context. /** Create a contextID for a new graphics context, this contextID is used to set up the osg::State associate with context.
* Automatically increments the usage count of the contextID to 1.*/ * Automatically increments the usage count of the contextID to 1.*/
static unsigned int createNewContextID(); static unsigned int createNewContextID();
@ -230,29 +230,29 @@ class OSG_EXPORT GraphicsContext : public Object
/** Decrement the usage count associate with a contextID. Once the contextID goes to 0 the contextID is then free to be reused.*/ /** Decrement the usage count associate with a contextID. Once the contextID goes to 0 the contextID is then free to be reused.*/
static void decrementContextIDUsageCount(unsigned int contextID); static void decrementContextIDUsageCount(unsigned int contextID);
typedef std::vector<GraphicsContext*> GraphicsContexts; typedef std::vector<GraphicsContext*> GraphicsContexts;
/** Get all the registered graphics contexts.*/ /** Get all the registered graphics contexts.*/
static GraphicsContexts getAllRegisteredGraphicsContexts(); static GraphicsContexts getAllRegisteredGraphicsContexts();
/** Get all the registered graphics contexts associated with a specific contextID.*/ /** Get all the registered graphics contexts associated with a specific contextID.*/
static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID); static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID);
/** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/ /** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/
static void setCompileContext(unsigned int contextID, GraphicsContext* gc); static void setCompileContext(unsigned int contextID, GraphicsContext* gc);
/** Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associated with specified contextID.*/ /** Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associated with specified contextID.*/
static GraphicsContext* getOrCreateCompileContext(unsigned int contextID); static GraphicsContext* getOrCreateCompileContext(unsigned int contextID);
/** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/ /** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/
static GraphicsContext* getCompileContext(unsigned int contextID); static GraphicsContext* getCompileContext(unsigned int contextID);
public: public:
/** Add operation to end of OperationQueue.*/ /** Add operation to end of OperationQueue.*/
void add(Operation* operation); void add(Operation* operation);
/** Remove operation from OperationQueue.*/ /** Remove operation from OperationQueue.*/
void remove(Operation* operation); void remove(Operation* operation);
@ -266,7 +266,7 @@ class OSG_EXPORT GraphicsContext : public Object
virtual void runOperations(); virtual void runOperations();
typedef std::list< ref_ptr<Operation> > GraphicsOperationQueue; typedef std::list< ref_ptr<Operation> > GraphicsOperationQueue;
/** Get the operations queue, not you must use the OperationsMutex when accessing the queue.*/ /** Get the operations queue, not you must use the OperationsMutex when accessing the queue.*/
GraphicsOperationQueue& getOperationsQueue() { return _operations; } GraphicsOperationQueue& getOperationsQueue() { return _operations; }
@ -281,7 +281,7 @@ class OSG_EXPORT GraphicsContext : public Object
public: public:
/** Get the traits of the GraphicsContext.*/ /** Get the traits of the GraphicsContext.*/
inline const Traits* getTraits() const { return _traits.get(); } inline const Traits* getTraits() const { return _traits.get(); }
@ -291,10 +291,10 @@ class OSG_EXPORT GraphicsContext : public Object
/** Set the State object which tracks the current OpenGL state for this graphics context.*/ /** Set the State object which tracks the current OpenGL state for this graphics context.*/
inline void setState(State* state) { _state = state; } inline void setState(State* state) { _state = state; }
/** Get the State object which tracks the current OpenGL state for this graphics context.*/ /** Get the State object which tracks the current OpenGL state for this graphics context.*/
inline State* getState() { return _state.get(); } inline State* getState() { return _state.get(); }
/** Get the const State object which tracks the current OpenGL state for this graphics context.*/ /** Get the const State object which tracks the current OpenGL state for this graphics context.*/
inline const State* getState() const { return _state.get(); } inline const State* getState() const { return _state.get(); }
@ -304,7 +304,7 @@ class OSG_EXPORT GraphicsContext : public Object
/** Returns the clear color. */ /** Returns the clear color. */
inline const Vec4& getClearColor() const { return _clearColor; } inline const Vec4& getClearColor() const { return _clearColor; }
/** Set the clear mask used in glClear(..). /** Set the clear mask used in glClear(..).
* Defaults to 0 - so no clear is done by default by the GraphicsContext, instead the Cameras attached to the GraphicsContext will do the clear. * Defaults to 0 - so no clear is done by default by the GraphicsContext, instead the Cameras attached to the GraphicsContext will do the clear.
* GraphicsContext::setClearMask() is useful for when the Camera Viewports don't cover the whole context, so the context will fill in the gaps. */ * GraphicsContext::setClearMask() is useful for when the Camera Viewports don't cover the whole context, so the context will fill in the gaps. */
@ -312,13 +312,13 @@ class OSG_EXPORT GraphicsContext : public Object
/** Get the clear mask.*/ /** Get the clear mask.*/
inline GLbitfield getClearMask() const { return _clearMask; } inline GLbitfield getClearMask() const { return _clearMask; }
/** Do an OpenGL clear of the full graphics context/window. /** Do an OpenGL clear of the full graphics context/window.
* Note, must only be called from a thread with this context current.*/ * Note, must only be called from a thread with this context current.*/
virtual void clear(); virtual void clear();
double getTimeSinceLastClear() const { return osg::Timer::instance()->delta_s(_lastClearTick, osg::Timer::instance()->tick()); } double getTimeSinceLastClear() const { return osg::Timer::instance()->delta_s(_lastClearTick, osg::Timer::instance()->tick()); }
/** Realize the GraphicsContext.*/ /** Realize the GraphicsContext.*/
bool realize(); bool realize();
@ -338,19 +338,19 @@ class OSG_EXPORT GraphicsContext : public Object
/** Make this graphics context current. /** Make this graphics context current.
* Implemented by calling makeCurrentImplementation(). * Implemented by calling makeCurrentImplementation().
* Returns true on success. */ * Returns true on success. */
bool makeCurrent(); bool makeCurrent();
/** Make this graphics context current with specified read context. /** Make this graphics context current with specified read context.
* Implemented by calling makeContextCurrentImplementation(). * Implemented by calling makeContextCurrentImplementation().
* Returns true on success. */ * Returns true on success. */
bool makeContextCurrent(GraphicsContext* readContext); bool makeContextCurrent(GraphicsContext* readContext);
/** Release the graphics context. /** Release the graphics context.
* Returns true on success. */ * Returns true on success. */
bool releaseContext(); bool releaseContext();
/** Return true if the current thread has this OpenGL graphics context.*/ /** Return true if the current thread has this OpenGL graphics context.*/
inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThread(); } inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThread(); }
@ -372,7 +372,7 @@ class OSG_EXPORT GraphicsContext : public Object
const GraphicsThread* getGraphicsThread() const { return _graphicsThread.get(); } const GraphicsThread* getGraphicsThread() const { return _graphicsThread.get(); }
/** Realize the GraphicsContext implementation, /** Realize the GraphicsContext implementation,
* Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */
virtual bool realizeImplementation() = 0; virtual bool realizeImplementation() = 0;
@ -387,7 +387,7 @@ class OSG_EXPORT GraphicsContext : public Object
/** Make this graphics context current implementation. /** Make this graphics context current implementation.
* Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */
virtual bool makeCurrentImplementation() = 0; virtual bool makeCurrentImplementation() = 0;
/** Make this graphics context current with specified read context implementation. /** Make this graphics context current with specified read context implementation.
* Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */
virtual bool makeContextCurrentImplementation(GraphicsContext* readContext) = 0; virtual bool makeContextCurrentImplementation(GraphicsContext* readContext) = 0;
@ -407,7 +407,7 @@ class OSG_EXPORT GraphicsContext : public Object
* GraphicsContext::swapBuffersImplementation(), allowing * GraphicsContext::swapBuffersImplementation(), allowing
* developers to provide custom behavior for swap. * developers to provide custom behavior for swap.
* The callback must call * The callback must call
* GraphicsContext::swapBuffersImplementation() */ * GraphicsContext::swapBuffersImplementation() */
void setSwapCallback(SwapCallback* rc) { _swapCallback = rc; } void setSwapCallback(SwapCallback* rc) { _swapCallback = rc; }
/** Get the swap callback which overrides the GraphicsContext::swapBuffersImplementation().*/ /** Get the swap callback which overrides the GraphicsContext::swapBuffersImplementation().*/
@ -467,10 +467,10 @@ class OSG_EXPORT GraphicsContext : public Object
/** Get the the const list of cameras associated with this graphics context.*/ /** Get the the const list of cameras associated with this graphics context.*/
const Cameras& getCameras() const { return _cameras; } const Cameras& getCameras() const { return _cameras; }
/** set the default FBO-id, this id will be used when the rendering-backend is finished with RTT FBOs */ /** set the default FBO-id, this id will be used when the rendering-backend is finished with RTT FBOs */
void setDefaultFboId(GLuint i) { _defaultFboId = i; } void setDefaultFboId(GLuint i) { _defaultFboId = i; }
GLuint getDefaultFboId() const { return _defaultFboId; } GLuint getDefaultFboId() const { return _defaultFboId; }
public: public:
@ -480,7 +480,7 @@ class OSG_EXPORT GraphicsContext : public Object
virtual const char* className() const { return "GraphicsContext"; } virtual const char* className() const { return "GraphicsContext"; }
protected: protected:
GraphicsContext(); GraphicsContext();
GraphicsContext(const GraphicsContext&, const osg::CopyOp&); GraphicsContext(const GraphicsContext&, const osg::CopyOp&);
@ -498,31 +498,31 @@ class OSG_EXPORT GraphicsContext : public Object
void addCamera(osg::Camera* camera); void addCamera(osg::Camera* camera);
void removeCamera(osg::Camera* camera); void removeCamera(osg::Camera* camera);
Cameras _cameras; Cameras _cameras;
friend class osg::Camera; friend class osg::Camera;
ref_ptr<Traits> _traits; ref_ptr<Traits> _traits;
ref_ptr<State> _state; ref_ptr<State> _state;
Vec4 _clearColor; Vec4 _clearColor;
GLbitfield _clearMask; GLbitfield _clearMask;
OpenThreads::Thread* _threadOfLastMakeCurrent; OpenThreads::Thread* _threadOfLastMakeCurrent;
OpenThreads::Mutex _operationsMutex; OpenThreads::Mutex _operationsMutex;
osg::ref_ptr<osg::RefBlock> _operationsBlock; osg::ref_ptr<osg::RefBlock> _operationsBlock;
GraphicsOperationQueue _operations; GraphicsOperationQueue _operations;
osg::ref_ptr<Operation> _currentOperation; osg::ref_ptr<Operation> _currentOperation;
ref_ptr<GraphicsThread> _graphicsThread; ref_ptr<GraphicsThread> _graphicsThread;
ref_ptr<ResizedCallback> _resizedCallback; ref_ptr<ResizedCallback> _resizedCallback;
ref_ptr<SwapCallback> _swapCallback; ref_ptr<SwapCallback> _swapCallback;
Timer_t _lastClearTick; Timer_t _lastClearTick;
GLuint _defaultFboId; GLuint _defaultFboId;
}; };

View File

@ -25,10 +25,10 @@ class GraphicsContext;
class OSG_EXPORT GraphicsThread : public osg::OperationThread class OSG_EXPORT GraphicsThread : public osg::OperationThread
{ {
public: public:
GraphicsThread(); GraphicsThread();
/** Run does the graphics thread run loop.*/ /** Run does the graphics thread run loop.*/
virtual void run(); virtual void run();
}; };
@ -72,11 +72,11 @@ struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barri
virtual void release(); virtual void release();
virtual void operator () (Object* object); virtual void operator () (Object* object);
PreBlockOp _preBlockOp; PreBlockOp _preBlockOp;
}; };
/** ReleaseContext_Block_MakeCurrentOperation releases the context for another thread to acquire, /** ReleaseContext_Block_MakeCurrentOperation releases the context for another thread to acquire,
* then blocks waiting for context to be released, once the block is release the context is re-acquired.*/ * then blocks waiting for context to be released, once the block is release the context is re-acquired.*/
struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public GraphicsOperation, public RefBlock struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public GraphicsOperation, public RefBlock
{ {
@ -103,7 +103,7 @@ struct OSG_EXPORT FlushDeletedGLObjectsOperation : public GraphicsOperation
FlushDeletedGLObjectsOperation(double availableTime, bool keep=false); FlushDeletedGLObjectsOperation(double availableTime, bool keep=false);
virtual void operator () (GraphicsContext*); virtual void operator () (GraphicsContext*);
double _availableTime; double _availableTime;
}; };
@ -113,17 +113,17 @@ public:
RunOperations(): RunOperations():
osg::GraphicsOperation("RunOperation",true) {} osg::GraphicsOperation("RunOperation",true) {}
virtual void operator () (osg::GraphicsContext* context); virtual void operator () (osg::GraphicsContext* context);
}; };
class OSG_EXPORT EndOfDynamicDrawBlock : public OpenThreads::BlockCount, public osg::State::DynamicObjectRenderingCompletedCallback class OSG_EXPORT EndOfDynamicDrawBlock : public OpenThreads::BlockCount, public osg::State::DynamicObjectRenderingCompletedCallback
{ {
public: public:
EndOfDynamicDrawBlock(unsigned int); EndOfDynamicDrawBlock(unsigned int);
void completed(osg::State* state); void completed(osg::State* state);
protected: protected:

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -31,7 +31,7 @@ class OSG_EXPORT Group : public Node
Group(); Group();
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
Group(const Group&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); Group(const Group&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
@ -53,13 +53,13 @@ class OSG_EXPORT Group : public Node
/** Insert Node to Group at specific location. /** Insert Node to Group at specific location.
* The new child node is inserted into the child list * The new child node is inserted into the child list
* before the node at the specified index. No nodes * before the node at the specified index. No nodes
* are removed from the group with this operation. * are removed from the group with this operation.
*/ */
virtual bool insertChild( unsigned int index, Node *child ); virtual bool insertChild( unsigned int index, Node *child );
/** Remove Node from Group. /** Remove Node from Group.
* If Node is contained in Group then remove it from the child * If Node is contained in Group then remove it from the child
* list, decrement its reference count, and dirty the * list, decrement its reference count, and dirty the
* bounding sphere to force it to recompute on next getBound() and * bounding sphere to force it to recompute on next getBound() and
* return true for success. If Node is not found then return false * return true for success. If Node is not found then return false
* and do not change the reference count of the Node. * and do not change the reference count of the Node.
@ -74,7 +74,7 @@ class OSG_EXPORT Group : public Node
/** Remove Node from Group. /** Remove Node from Group.
* If Node is contained in Group then remove it from the child * If Node is contained in Group then remove it from the child
* list, decrement its reference count, and dirty the * list, decrement its reference count, and dirty the
* bounding sphere to force it to recompute on next getBound() and * bounding sphere to force it to recompute on next getBound() and
* return true for success. If Node is not found then return false * return true for success. If Node is not found then return false
* and do not change the reference count of the Node. * and do not change the reference count of the Node.
@ -104,7 +104,7 @@ class OSG_EXPORT Group : public Node
* When Set can be successful applied, the algorithm is : decrement the reference count origNode and increment the * When Set can be successful applied, the algorithm is : decrement the reference count origNode and increment the
* reference count of newNode, and dirty the bounding sphere * reference count of newNode, and dirty the bounding sphere
* to force it to recompute on next getBound() and return true. * to force it to recompute on next getBound() and return true.
* If origNode is not found then return false and do not * If origNode is not found then return false and do not
* add newNode. If newNode is NULL then return false and do * add newNode. If newNode is NULL then return false and do
* not remove origNode. Also returns false if newChild is a Scene node. * not remove origNode. Also returns false if newChild is a Scene node.
*/ */
@ -119,7 +119,7 @@ class OSG_EXPORT Group : public Node
/** Return true if node is contained within Group. */ /** Return true if node is contained within Group. */
inline bool containsNode( const Node* node ) const inline bool containsNode( const Node* node ) const
{ {
for (NodeList::const_iterator itr=_children.begin(); for (NodeList::const_iterator itr=_children.begin();
itr!=_children.end(); itr!=_children.end();
++itr) ++itr)
@ -154,7 +154,7 @@ class OSG_EXPORT Group : public Node
virtual void releaseGLObjects(osg::State* = 0) const; virtual void releaseGLObjects(osg::State* = 0) const;
virtual BoundingSphere computeBound() const; virtual BoundingSphere computeBound() const;
protected: protected:
virtual ~Group(); virtual ~Group();

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -53,16 +53,16 @@ public:
// compare each parameter in turn against the rhs. // compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_target) COMPARE_StateAttribute_Parameter(_target)
COMPARE_StateAttribute_Parameter(_mode) COMPARE_StateAttribute_Parameter(_mode)
return 0; return 0;
} }
/** Return the member identifier within the attribute's class type. Used for light number/clip plane number etc.*/ /** Return the member identifier within the attribute's class type. Used for light number/clip plane number etc.*/
virtual unsigned int getMember() const { return static_cast<unsigned int>(_target); } virtual unsigned int getMember() const { return static_cast<unsigned int>(_target); }
void setTarget(GLenum target); void setTarget(GLenum target);
inline GLenum getTarget() const { return _target; } inline GLenum getTarget() const { return _target; }
inline void setMode(GLenum mode) { _mode = mode; } inline void setMode(GLenum mode) { _mode = mode; }
inline GLenum getMode() const { return _mode; } inline GLenum getMode() const { return _mode; }
@ -70,7 +70,7 @@ public:
protected: protected:
GLenum _target; GLenum _target;
GLenum _mode; GLenum _mode;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -93,7 +93,7 @@
#endif #endif
#ifndef GL_OES_compressed_ETC1_RGB8_texture #ifndef GL_OES_compressed_ETC1_RGB8_texture
#define GL_ETC1_RGB8_OES 0x8D64 #define GL_ETC1_RGB8_OES 0x8D64
#endif #endif
namespace osg { namespace osg {
@ -108,7 +108,7 @@ class OSG_EXPORT Image : public BufferData
public : public :
Image(); Image();
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
Image(const Image& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY); Image(const Image& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
@ -129,22 +129,22 @@ class OSG_EXPORT Image : public BufferData
void setFileName(const std::string& fileName); void setFileName(const std::string& fileName);
inline const std::string& getFileName() const { return _fileName; } inline const std::string& getFileName() const { return _fileName; }
enum WriteHint { enum WriteHint {
NO_PREFERENCE, NO_PREFERENCE,
STORE_INLINE, STORE_INLINE,
EXTERNAL_FILE EXTERNAL_FILE
}; };
void setWriteHint(WriteHint writeHint) { _writeHint = writeHint; } void setWriteHint(WriteHint writeHint) { _writeHint = writeHint; }
WriteHint getWriteHint() const { return _writeHint; } WriteHint getWriteHint() const { return _writeHint; }
enum AllocationMode { enum AllocationMode {
NO_DELETE, NO_DELETE,
USE_NEW_DELETE, USE_NEW_DELETE,
USE_MALLOC_FREE USE_MALLOC_FREE
}; };
/** Set the method used for deleting data once it goes out of scope. */ /** Set the method used for deleting data once it goes out of scope. */
void setAllocationMode(AllocationMode mode) { _allocationMode = mode; } void setAllocationMode(AllocationMode mode) { _allocationMode = mode; }
@ -156,8 +156,8 @@ class OSG_EXPORT Image : public BufferData
virtual void allocateImage(int s,int t,int r, virtual void allocateImage(int s,int t,int r,
GLenum pixelFormat,GLenum type, GLenum pixelFormat,GLenum type,
int packing=1); int packing=1);
/** Set the image dimensions, format and data. */ /** Set the image dimensions, format and data. */
virtual void setImage(int s,int t,int r, virtual void setImage(int s,int t,int r,
GLint internalTextureformat, GLint internalTextureformat,
@ -165,13 +165,13 @@ class OSG_EXPORT Image : public BufferData
unsigned char* data, unsigned char* data,
AllocationMode mode, AllocationMode mode,
int packing=1, int rowLength=0); int packing=1, int rowLength=0);
/** Read pixels from current frame buffer at specified position and size, using glReadPixels. /** Read pixels from current frame buffer at specified position and size, using glReadPixels.
* Create memory for storage if required, reuse existing pixel coords if possible. * Create memory for storage if required, reuse existing pixel coords if possible.
*/ */
virtual void readPixels(int x,int y,int width,int height, virtual void readPixels(int x,int y,int width,int height,
GLenum pixelFormat,GLenum type); GLenum pixelFormat,GLenum type);
/** Read the contents of the current bound texture, handling compressed pixelFormats if present. /** Read the contents of the current bound texture, handling compressed pixelFormats if present.
* Create memory for storage if required, reuse existing pixel coords if possible. * Create memory for storage if required, reuse existing pixel coords if possible.
@ -195,44 +195,44 @@ class OSG_EXPORT Image : public BufferData
virtual void copySubImage(int s_offset, int t_offset, int r_offset, const osg::Image* source); virtual void copySubImage(int s_offset, int t_offset, int r_offset, const osg::Image* source);
enum Origin enum Origin
{ {
BOTTOM_LEFT, BOTTOM_LEFT,
TOP_LEFT TOP_LEFT
}; };
/** Set the origin of the image. /** Set the origin of the image.
* The default value is BOTTOM_LEFT and is consistent with OpenGL. * The default value is BOTTOM_LEFT and is consistent with OpenGL.
* TOP_LEFT is used for imagery that follows standard Imagery convention, such as movies, * TOP_LEFT is used for imagery that follows standard Imagery convention, such as movies,
* and hasn't been flipped yet. For such images one much flip the t axis of the tex coords. * and hasn't been flipped yet. For such images one much flip the t axis of the tex coords.
* to handle this origin position. */ * to handle this origin position. */
void setOrigin(Origin origin) { _origin = origin; } void setOrigin(Origin origin) { _origin = origin; }
/** Get the origin of the image.*/ /** Get the origin of the image.*/
Origin getOrigin() const { return _origin; } Origin getOrigin() const { return _origin; }
/** Width of image. */ /** Width of image. */
inline int s() const { return _s; } inline int s() const { return _s; }
/** Height of image. */ /** Height of image. */
inline int t() const { return _t; } inline int t() const { return _t; }
/** Depth of image. */ /** Depth of image. */
inline int r() const { return _r; } inline int r() const { return _r; }
void setRowLength(int length); void setRowLength(int length);
inline int getRowLength() const { return _rowLength; } inline int getRowLength() const { return _rowLength; }
void setInternalTextureFormat(GLint internalFormat); void setInternalTextureFormat(GLint internalFormat);
inline GLint getInternalTextureFormat() const { return _internalTextureFormat; } inline GLint getInternalTextureFormat() const { return _internalTextureFormat; }
void setPixelFormat(GLenum pixelFormat); void setPixelFormat(GLenum pixelFormat);
inline GLenum getPixelFormat() const { return _pixelFormat; } inline GLenum getPixelFormat() const { return _pixelFormat; }
void setDataType(GLenum dataType); void setDataType(GLenum dataType);
inline GLenum getDataType() const { return _dataType; } inline GLenum getDataType() const { return _dataType; }
void setPacking(unsigned int packing) { _packing = packing; } void setPacking(unsigned int packing) { _packing = packing; }
inline unsigned int getPacking() const { return _packing; } inline unsigned int getPacking() const { return _packing; }
@ -244,7 +244,7 @@ class OSG_EXPORT Image : public BufferData
/** Get the pixel aspect ratio.*/ /** Get the pixel aspect ratio.*/
inline float getPixelAspectRatio() const { return _pixelAspectRatio; } inline float getPixelAspectRatio() const { return _pixelAspectRatio; }
/** Return the number of bits required for each pixel. */ /** Return the number of bits required for each pixel. */
inline unsigned int getPixelSizeInBits() const { return computePixelSizeInBits(_pixelFormat,_dataType); } inline unsigned int getPixelSizeInBits() const { return computePixelSizeInBits(_pixelFormat,_dataType); }
@ -257,8 +257,8 @@ class OSG_EXPORT Image : public BufferData
/** Return the number of bytes each image (_s*_t) of pixels occupies. */ /** Return the number of bytes each image (_s*_t) of pixels occupies. */
inline unsigned int getImageSizeInBytes() const { return getRowSizeInBytes()*_t; } inline unsigned int getImageSizeInBytes() const { return getRowSizeInBytes()*_t; }
/** Return the number of bytes between each successive image. /** Return the number of bytes between each successive image.
* Note, getImageSizeInBytes() will only equal getImageStepInBytes() when isDataContiguous() return true. */ * Note, getImageSizeInBytes() will only equal getImageStepInBytes() when isDataContiguous() return true. */
inline unsigned int getImageStepInBytes() const { return getRowStepInBytes()*_t; } inline unsigned int getImageStepInBytes() const { return getRowStepInBytes()*_t; }
@ -275,7 +275,7 @@ class OSG_EXPORT Image : public BufferData
* Note, data in successive rows may not be contiguous, isDataContiguous() return false then you should * Note, data in successive rows may not be contiguous, isDataContiguous() return false then you should
* take care to access the data per row rather than treating the whole data as a single block. */ * take care to access the data per row rather than treating the whole data as a single block. */
inline unsigned char* data() { return _data; } inline unsigned char* data() { return _data; }
/** Raw const image data. /** Raw const image data.
* Note, data in successive rows may not be contiguous, isDataContiguous() return false then you should * Note, data in successive rows may not be contiguous, isDataContiguous() return false then you should
* take care to access the data per row rather than treating the whole data as a single block. */ * take care to access the data per row rather than treating the whole data as a single block. */
@ -286,7 +286,7 @@ class OSG_EXPORT Image : public BufferData
if (!_data) return NULL; if (!_data) return NULL;
return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes(); return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes();
} }
inline const unsigned char* data(int column, int row=0,int image=0) const inline const unsigned char* data(int column, int row=0,int image=0) const
{ {
if (!_data) return NULL; if (!_data) return NULL;
@ -318,9 +318,9 @@ class OSG_EXPORT Image : public BufferData
protected: protected:
void assign(); void assign();
const osg::Image* _image; const osg::Image* _image;
int _rowNum; int _rowNum;
int _imageNum; int _imageNum;
@ -341,7 +341,7 @@ class OSG_EXPORT Image : public BufferData
/** Flip the image horizontally, around s dimension. */ /** Flip the image horizontally, around s dimension. */
void flipHorizontal(); void flipHorizontal();
/** Flip the image vertically, around t dimension. */ /** Flip the image vertically, around t dimension. */
void flipVertical(); void flipVertical();
@ -378,7 +378,7 @@ class OSG_EXPORT Image : public BufferData
/** Send offsets into data. It is assumed that first mipmap offset (index 0) is 0.*/ /** Send offsets into data. It is assumed that first mipmap offset (index 0) is 0.*/
inline void setMipmapLevels(const MipmapDataType& mipmapDataVector) { _mipmapData = mipmapDataVector; } inline void setMipmapLevels(const MipmapDataType& mipmapDataVector) { _mipmapData = mipmapDataVector; }
inline const MipmapDataType& getMipmapLevels() const { return _mipmapData; } inline const MipmapDataType& getMipmapLevels() const { return _mipmapData; }
inline unsigned int getMipmapOffset(unsigned int mipmapLevel) const inline unsigned int getMipmapOffset(unsigned int mipmapLevel) const
@ -389,7 +389,7 @@ class OSG_EXPORT Image : public BufferData
return _mipmapData[mipmapLevel-1]; return _mipmapData[mipmapLevel-1];
return 0; return 0;
}; };
inline unsigned char* getMipmapData(unsigned int mipmapLevel) inline unsigned char* getMipmapData(unsigned int mipmapLevel)
{ {
return _data+getMipmapOffset(mipmapLevel); return _data+getMipmapOffset(mipmapLevel);
@ -406,7 +406,7 @@ class OSG_EXPORT Image : public BufferData
/** Return true if this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized). */ /** Return true if this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized). */
virtual bool isImageTranslucent() const; virtual bool isImageTranslucent() const;
/** Set the optional PixelBufferObject used to map the image memory efficiently to graphics memory. */ /** Set the optional PixelBufferObject used to map the image memory efficiently to graphics memory. */
void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); } void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); }
/** Get the PixelBufferObject.*/ /** Get the PixelBufferObject.*/
@ -464,13 +464,13 @@ class OSG_EXPORT Image : public BufferData
AllocationMode _allocationMode; AllocationMode _allocationMode;
unsigned char* _data; unsigned char* _data;
void deallocateData(); void deallocateData();
void setData(unsigned char* data,AllocationMode allocationMode); void setData(unsigned char* data,AllocationMode allocationMode);
MipmapDataType _mipmapData; MipmapDataType _mipmapData;
ref_ptr<PixelBufferObject> _bufferObject; ref_ptr<PixelBufferObject> _bufferObject;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -44,13 +44,13 @@ class OSG_EXPORT ImageSequence : public ImageStream
virtual void setReferenceTime(double t) { _referenceTime = t; } virtual void setReferenceTime(double t) { _referenceTime = t; }
virtual double getReferenceTime() const { return _referenceTime; } virtual double getReferenceTime() const { return _referenceTime; }
virtual void setTimeMultiplier(double tm) { _timeMultiplier = tm; } virtual void setTimeMultiplier(double tm) { _timeMultiplier = tm; }
virtual double getTimeMultiplier() const { return _timeMultiplier; } virtual double getTimeMultiplier() const { return _timeMultiplier; }
typedef std::vector< osg::ref_ptr<osg::Image> > Images; typedef std::vector< osg::ref_ptr<osg::Image> > Images;
typedef std::vector< std::string > FileNames; typedef std::vector< std::string > FileNames;
virtual void seek(double time); virtual void seek(double time);
virtual void play(); virtual void play();
@ -58,33 +58,33 @@ class OSG_EXPORT ImageSequence : public ImageStream
virtual void pause(); virtual void pause();
virtual void rewind(); virtual void rewind();
enum Mode enum Mode
{ {
PRE_LOAD_ALL_IMAGES, PRE_LOAD_ALL_IMAGES,
PAGE_AND_RETAIN_IMAGES, PAGE_AND_RETAIN_IMAGES,
PAGE_AND_DISCARD_USED_IMAGES PAGE_AND_DISCARD_USED_IMAGES
}; };
void setMode(Mode mode); void setMode(Mode mode);
Mode getMode() const { return _mode; } Mode getMode() const { return _mode; }
void setLength(double length); void setLength(double length);
virtual double getLength() const { return _length; } virtual double getLength() const { return _length; }
void addImageFile(const std::string& fileName); void addImageFile(const std::string& fileName);
void setImageFile(unsigned int pos, const std::string& fileName); void setImageFile(unsigned int pos, const std::string& fileName);
std::string getImageFile(unsigned int pos) const; std::string getImageFile(unsigned int pos) const;
unsigned int getNumImageFiles() const { return _fileNames.size(); } unsigned int getNumImageFiles() const { return _fileNames.size(); }
FileNames& getFileNames() { return _fileNames; } FileNames& getFileNames() { return _fileNames; }
const FileNames& getFileNames() const { return _fileNames; } const FileNames& getFileNames() const { return _fileNames; }
void addImage(osg::Image* image); void addImage(osg::Image* image);
void setImage(int s,int t,int r, void setImage(int s,int t,int r,
GLint internalTextureformat, GLint internalTextureformat,
GLenum pixelFormat,GLenum type, GLenum pixelFormat,GLenum type,
@ -95,7 +95,7 @@ class OSG_EXPORT ImageSequence : public ImageStream
void setImage(unsigned int pos, osg::Image* image); void setImage(unsigned int pos, osg::Image* image);
Image* getImage(unsigned int pos); Image* getImage(unsigned int pos);
const Image* getImage(unsigned int pos) const; const Image* getImage(unsigned int pos) const;
unsigned int getNumImages() const { return _images.size(); } unsigned int getNumImages() const { return _images.size(); }
Images& getImages() { return _images; } Images& getImages() { return _images; }
@ -110,11 +110,11 @@ class OSG_EXPORT ImageSequence : public ImageStream
protected: protected:
virtual ~ImageSequence() {} virtual ~ImageSequence() {}
virtual void applyLoopingMode(); virtual void applyLoopingMode();
void setImageToChild(const osg::Image* image); void setImageToChild(const osg::Image* image);
void computeTimePerImage(); void computeTimePerImage();
int imageIndex(double time); int imageIndex(double time);
@ -132,17 +132,17 @@ class OSG_EXPORT ImageSequence : public ImageStream
FileNames _fileNames; FileNames _fileNames;
Images _images; Images _images;
typedef std::set< std::string > FilesRequested; typedef std::set< std::string > FilesRequested;
FilesRequested _filesRequested; FilesRequested _filesRequested;
int _previousAppliedImageIndex; int _previousAppliedImageIndex;
bool _seekTimeSet; bool _seekTimeSet;
double _seekTime; double _seekTime;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -46,7 +46,7 @@ class OSG_EXPORT ImageStream : public Image
PAUSED, PAUSED,
REWINDING REWINDING
}; };
virtual void seek(double /*time*/) {} virtual void seek(double /*time*/) {}
virtual void play() { _status=PLAYING; } virtual void play() { _status=PLAYING; }
@ -54,39 +54,39 @@ class OSG_EXPORT ImageStream : public Image
virtual void pause() { _status=PAUSED; } virtual void pause() { _status=PAUSED; }
virtual void rewind() { _status=REWINDING; } virtual void rewind() { _status=REWINDING; }
virtual void quit(bool /*waitForThreadToExit*/ = true) {} virtual void quit(bool /*waitForThreadToExit*/ = true) {}
StreamStatus getStatus() { return _status; } StreamStatus getStatus() { return _status; }
enum LoopingMode enum LoopingMode
{ {
NO_LOOPING, NO_LOOPING,
LOOPING LOOPING
}; };
void setLoopingMode(LoopingMode mode) void setLoopingMode(LoopingMode mode)
{ {
if (_loopingMode == mode) return; if (_loopingMode == mode) return;
_loopingMode = mode; _loopingMode = mode;
applyLoopingMode(); applyLoopingMode();
} }
LoopingMode getLoopingMode() const { return _loopingMode; } LoopingMode getLoopingMode() const { return _loopingMode; }
virtual double getCreationTime() const { return HUGE_VAL; } virtual double getCreationTime() const { return HUGE_VAL; }
virtual double getLength() const { return 0.0; } virtual double getLength() const { return 0.0; }
virtual double getFrameRate() const { return 0.0; } virtual double getFrameRate() const { return 0.0; }
virtual double getCurrentTime() const { return 0.0; } virtual double getCurrentTime() const { return 0.0; }
virtual void setReferenceTime(double) {} virtual void setReferenceTime(double) {}
virtual double getReferenceTime() const { return 0.0; } virtual double getReferenceTime() const { return 0.0; }
virtual void setTimeMultiplier(double) {} virtual void setTimeMultiplier(double) {}
virtual double getTimeMultiplier() const { return 0.0; } virtual double getTimeMultiplier() const { return 0.0; }
virtual void setVolume(float) {} virtual void setVolume(float) {}
virtual float getVolume() const { return 0.0f; } virtual float getVolume() const { return 0.0f; }
@ -94,7 +94,7 @@ class OSG_EXPORT ImageStream : public Image
void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; } void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; }
AudioStreams& getAudioStreams() { return _audioStreams; } AudioStreams& getAudioStreams() { return _audioStreams; }
const AudioStreams& getAudioStreams() const { return _audioStreams; } const AudioStreams& getAudioStreams() const { return _audioStreams; }
protected: protected:
virtual void applyLoopingMode() {} virtual void applyLoopingMode() {}
@ -103,7 +103,7 @@ class OSG_EXPORT ImageStream : public Image
StreamStatus _status; StreamStatus _status;
LoopingMode _loopingMode; LoopingMode _loopingMode;
AudioStreams _audioStreams; AudioStreams _audioStreams;
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -20,7 +20,7 @@
namespace osg { namespace osg {
template <typename T, class O> template <typename T, class O>
void _readRow(unsigned int num, GLenum pixelFormat, const T* data,float scale, O& operation) void _readRow(unsigned int num, GLenum pixelFormat, const T* data,float scale, O& operation)
{ {
switch(pixelFormat) switch(pixelFormat)
@ -35,7 +35,7 @@ void _readRow(unsigned int num, GLenum pixelFormat, const T* data,float scale, O
} }
} }
template <class O> template <class O>
void readRow(unsigned int num, GLenum pixelFormat, GLenum dataType, const unsigned char* data, O& operation) void readRow(unsigned int num, GLenum pixelFormat, GLenum dataType, const unsigned char* data, O& operation)
{ {
switch(dataType) switch(dataType)
@ -50,11 +50,11 @@ void readRow(unsigned int num, GLenum pixelFormat, GLenum dataType, const unsign
} }
} }
template <class O> template <class O>
void readImage(const osg::Image* image, O& operation) void readImage(const osg::Image* image, O& operation)
{ {
if (!image) return; if (!image) return;
for(int r=0;r<image->r();++r) for(int r=0;r<image->r();++r)
{ {
for(int t=0;t<image->t();++t) for(int t=0;t<image->t();++t)
@ -67,15 +67,15 @@ void readImage(const osg::Image* image, O& operation)
// example ModifyOperator // example ModifyOperator
// struct ModifyOperator // struct ModifyOperator
// { // {
// inline void luminance(float& l) const {} // inline void luminance(float& l) const {}
// inline void alpha(float& a) const {} // inline void alpha(float& a) const {}
// inline void luminance_alpha(float& l,float& a) const {} // inline void luminance_alpha(float& l,float& a) const {}
// inline void rgb(float& r,float& g,float& b) const {} // inline void rgb(float& r,float& g,float& b) const {}
// inline void rgba(float& r,float& g,float& b,float& a) const {} // inline void rgba(float& r,float& g,float& b,float& a) const {}
// }; // };
template <typename T, class M> template <typename T, class M>
void _modifyRow(unsigned int num, GLenum pixelFormat, T* data,float scale, const M& operation) void _modifyRow(unsigned int num, GLenum pixelFormat, T* data,float scale, const M& operation)
{ {
float inv_scale = 1.0f/scale; float inv_scale = 1.0f/scale;
@ -91,7 +91,7 @@ void _modifyRow(unsigned int num, GLenum pixelFormat, T* data,float scale, const
} }
} }
template <class M> template <class M>
void modifyRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned char* data, const M& operation) void modifyRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned char* data, const M& operation)
{ {
switch(dataType) switch(dataType)
@ -106,11 +106,11 @@ void modifyRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned c
} }
} }
template <class M> template <class M>
void modifyImage(osg::Image* image, const M& operation) void modifyImage(osg::Image* image, const M& operation)
{ {
if (!image) return; if (!image) return;
for(int r=0;r<image->r();++r) for(int r=0;r<image->r();++r)
{ {
for(int t=0;t<image->t();++t) for(int t=0;t<image->t();++t)

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -23,31 +23,31 @@ namespace osg
{ {
/** Implementation of a kdtree for Geometry leaves, to enable fast intersection tests.*/ /** Implementation of a kdtree for Geometry leaves, to enable fast intersection tests.*/
class OSG_EXPORT KdTree : public osg::Shape class OSG_EXPORT KdTree : public osg::Shape
{ {
public: public:
KdTree(); KdTree();
KdTree(const KdTree& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); KdTree(const KdTree& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Shape(osg, KdTree) META_Shape(osg, KdTree)
struct OSG_EXPORT BuildOptions struct OSG_EXPORT BuildOptions
{ {
BuildOptions(); BuildOptions();
unsigned int _numVerticesProcessed; unsigned int _numVerticesProcessed;
unsigned int _targetNumTrianglesPerLeaf; unsigned int _targetNumTrianglesPerLeaf;
unsigned int _maxNumLevels; unsigned int _maxNumLevels;
}; };
/** Build the kdtree from the specified source geometry object. /** Build the kdtree from the specified source geometry object.
* retun true on success. */ * retun true on success. */
virtual bool build(BuildOptions& buildOptions, osg::Geometry* geometry); virtual bool build(BuildOptions& buildOptions, osg::Geometry* geometry);
struct LineSegmentIntersection struct LineSegmentIntersection
{ {
LineSegmentIntersection(): LineSegmentIntersection():
@ -77,11 +77,11 @@ class OSG_EXPORT KdTree : public osg::Shape
float r2; float r2;
unsigned int primitiveIndex; unsigned int primitiveIndex;
}; };
typedef std::vector<LineSegmentIntersection> LineSegmentIntersections; typedef std::vector<LineSegmentIntersection> LineSegmentIntersections;
/** compute the intersection of a line segment and the kdtree, return true if an intersection has been found.*/ /** compute the intersection of a line segment and the kdtree, return true if an intersection has been found.*/
virtual bool intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegmentIntersections& intersections) const; virtual bool intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegmentIntersections& intersections) const;
@ -100,15 +100,15 @@ class OSG_EXPORT KdTree : public osg::Shape
osg::BoundingBox bb; osg::BoundingBox bb;
value_type first; value_type first;
value_type second; value_type second;
}; };
struct Triangle struct Triangle
{ {
Triangle(): Triangle():
p0(0),p1(0),p2(0) {} p0(0),p1(0),p2(0) {}
Triangle(unsigned int ip0, unsigned int ip1, unsigned int ip2): Triangle(unsigned int ip0, unsigned int ip1, unsigned int ip2):
p0(ip0), p1(ip1), p2(ip2) {} p0(ip0), p1(ip1), p2(ip2) {}
@ -131,14 +131,14 @@ class OSG_EXPORT KdTree : public osg::Shape
int addNode(const KdNode& node) int addNode(const KdNode& node)
{ {
int num = static_cast<int>(_kdNodes.size()); int num = static_cast<int>(_kdNodes.size());
_kdNodes.push_back(node); _kdNodes.push_back(node);
return num; return num;
} }
KdNode& getNode(int nodeNum) { return _kdNodes[nodeNum]; } KdNode& getNode(int nodeNum) { return _kdNodes[nodeNum]; }
const KdNode& getNode(int nodeNum) const { return _kdNodes[nodeNum]; } const KdNode& getNode(int nodeNum) const { return _kdNodes[nodeNum]; }
KdNodeList& getNodes() { return _kdNodes; } KdNodeList& getNodes() { return _kdNodes; }
const KdNodeList& getNodes() const { return _kdNodes; } const KdNodeList& getNodes() const { return _kdNodes; }
@ -170,9 +170,9 @@ class OSG_EXPORT KdTree : public osg::Shape
class OSG_EXPORT KdTreeBuilder : public osg::NodeVisitor class OSG_EXPORT KdTreeBuilder : public osg::NodeVisitor
{ {
public: public:
KdTreeBuilder(); KdTreeBuilder();
KdTreeBuilder(const KdTreeBuilder& rhs); KdTreeBuilder(const KdTreeBuilder& rhs);
META_NodeVisitor("osg","KdTreeBuilder") META_NodeVisitor("osg","KdTreeBuilder")
@ -180,17 +180,17 @@ class OSG_EXPORT KdTreeBuilder : public osg::NodeVisitor
virtual KdTreeBuilder* clone() { return new KdTreeBuilder(*this); } virtual KdTreeBuilder* clone() { return new KdTreeBuilder(*this); }
void apply(osg::Geode& geode); void apply(osg::Geode& geode);
KdTree::BuildOptions _buildOptions; KdTree::BuildOptions _buildOptions;
osg::ref_ptr<osg::KdTree> _kdTreePrototype; osg::ref_ptr<osg::KdTree> _kdTreePrototype;
protected: protected:
virtual ~KdTreeBuilder() {} virtual ~KdTreeBuilder() {}
}; };
} }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -35,7 +35,7 @@ namespace osg {
class OSG_EXPORT LOD : public Group class OSG_EXPORT LOD : public Group
{ {
public : public :
LOD(); LOD();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
@ -47,7 +47,7 @@ class OSG_EXPORT LOD : public Group
typedef osg::BoundingSphere::value_type value_type; typedef osg::BoundingSphere::value_type value_type;
virtual void traverse(NodeVisitor& nv); virtual void traverse(NodeVisitor& nv);
virtual bool addChild(Node *child); virtual bool addChild(Node *child);
virtual bool addChild(Node *child, float min, float max); virtual bool addChild(Node *child, float min, float max);
@ -56,7 +56,7 @@ class OSG_EXPORT LOD : public Group
typedef std::pair<float,float> MinMaxPair; typedef std::pair<float,float> MinMaxPair;
typedef std::vector<MinMaxPair> RangeList; typedef std::vector<MinMaxPair> RangeList;
/** Modes which control how the center of object should be determined when computing which child is active.*/ /** Modes which control how the center of object should be determined when computing which child is active.*/
enum CenterMode enum CenterMode
{ {
@ -71,18 +71,18 @@ class OSG_EXPORT LOD : public Group
/** Get how the center of object should be determined when computing which child is active.*/ /** Get how the center of object should be determined when computing which child is active.*/
CenterMode getCenterMode() const { return _centerMode; } CenterMode getCenterMode() const { return _centerMode; }
/** Sets the object-space point which defines the center of the osg::LOD. /** Sets the object-space point which defines the center of the osg::LOD.
center is affected by any transforms in the hierarchy above the osg::LOD.*/ center is affected by any transforms in the hierarchy above the osg::LOD.*/
inline void setCenter(const vec_type& center) { if (_centerMode!=UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED) { _centerMode=USER_DEFINED_CENTER; } _userDefinedCenter = center; } inline void setCenter(const vec_type& center) { if (_centerMode!=UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED) { _centerMode=USER_DEFINED_CENTER; } _userDefinedCenter = center; }
/** return the LOD center point. */ /** return the LOD center point. */
inline const vec_type& getCenter() const { if ((_centerMode==USER_DEFINED_CENTER)||(_centerMode==UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED)) return _userDefinedCenter; else return getBound().center(); } inline const vec_type& getCenter() const { if ((_centerMode==USER_DEFINED_CENTER)||(_centerMode==UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED)) return _userDefinedCenter; else return getBound().center(); }
/** Set the object-space reference radius of the volume enclosed by the LOD. /** Set the object-space reference radius of the volume enclosed by the LOD.
* Used to determine the bounding sphere of the LOD in the absence of any children.*/ * Used to determine the bounding sphere of the LOD in the absence of any children.*/
inline void setRadius(value_type radius) { _radius = radius; } inline void setRadius(value_type radius) { _radius = radius; }
/** Get the object-space radius of the volume enclosed by the LOD.*/ /** Get the object-space radius of the volume enclosed by the LOD.*/
inline value_type getRadius() const { return _radius; } inline value_type getRadius() const { return _radius; }
@ -92,7 +92,7 @@ class OSG_EXPORT LOD : public Group
DISTANCE_FROM_EYE_POINT, DISTANCE_FROM_EYE_POINT,
PIXEL_SIZE_ON_SCREEN PIXEL_SIZE_ON_SCREEN
}; };
/** Set how the range values should be interpreted when computing which child is active.*/ /** Set how the range values should be interpreted when computing which child is active.*/
void setRangeMode(RangeMode mode) { _rangeMode = mode; } void setRangeMode(RangeMode mode) { _rangeMode = mode; }
@ -103,14 +103,14 @@ class OSG_EXPORT LOD : public Group
/** Sets the min and max visible ranges of range of specific child. /** Sets the min and max visible ranges of range of specific child.
Values are floating point distance specified in local objects coordinates.*/ Values are floating point distance specified in local objects coordinates.*/
void setRange(unsigned int childNo, float min,float max); void setRange(unsigned int childNo, float min,float max);
/** returns the min visible range for specified child.*/ /** returns the min visible range for specified child.*/
inline float getMinRange(unsigned int childNo) const { return _rangeList[childNo].first; } inline float getMinRange(unsigned int childNo) const { return _rangeList[childNo].first; }
/** returns the max visible range for specified child.*/ /** returns the max visible range for specified child.*/
inline float getMaxRange(unsigned int childNo) const { return _rangeList[childNo].second; } inline float getMaxRange(unsigned int childNo) const { return _rangeList[childNo].second; }
/** returns the number of ranges currently set. /** returns the number of ranges currently set.
* An LOD which has been fully set up will have getNumChildren()==getNumRanges(). */ * An LOD which has been fully set up will have getNumChildren()==getNumRanges(). */
inline unsigned int getNumRanges() const { return _rangeList.size(); } inline unsigned int getNumRanges() const { return _rangeList.size(); }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -58,7 +58,7 @@ class OSG_EXPORT Light : public StateAttribute
_quadratic_attenuation(light._quadratic_attenuation), _quadratic_attenuation(light._quadratic_attenuation),
_spot_exponent(light._spot_exponent), _spot_exponent(light._spot_exponent),
_spot_cutoff(light._spot_cutoff) {} _spot_cutoff(light._spot_cutoff) {}
virtual osg::Object* cloneType() const { return new Light(_lightnum); } virtual osg::Object* cloneType() const { return new Light(_lightnum); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new Light(*this,copyop); } virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new Light(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Light *>(obj)!=NULL; } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Light *>(obj)!=NULL; }
@ -96,12 +96,12 @@ class OSG_EXPORT Light : public StateAttribute
usage.usesMode(GL_LIGHT0+_lightnum); usage.usesMode(GL_LIGHT0+_lightnum);
return true; return true;
} }
/** Set which OpenGL light to operate on. */ /** Set which OpenGL light to operate on. */
void setLightNum(int num); void setLightNum(int num);
/** Get which OpenGL light this osg::Light operates on. */ /** Get which OpenGL light this osg::Light operates on. */
int getLightNum() const { return _lightnum; } int getLightNum() const { return _lightnum; }
@ -123,16 +123,16 @@ class OSG_EXPORT Light : public StateAttribute
/** Get the specular component of the light. */ /** Get the specular component of the light. */
inline const Vec4& getSpecular() const { return _specular; } inline const Vec4& getSpecular() const { return _specular; }
/** Set the position of the light. */ /** Set the position of the light. */
inline void setPosition( const Vec4& position ) { _position = position; } inline void setPosition( const Vec4& position ) { _position = position; }
/** Get the position of the light. */ /** Get the position of the light. */
inline const Vec4& getPosition() const { return _position; } inline const Vec4& getPosition() const { return _position; }
/** Set the direction of the light. */ /** Set the direction of the light. */
inline void setDirection( const Vec3& direction ) { _direction = direction; } inline void setDirection( const Vec3& direction ) { _direction = direction; }
/** Get the direction of the light. */ /** Get the direction of the light. */
inline const Vec3& getDirection() const { return _direction; } inline const Vec3& getDirection() const { return _direction; }
/** Set the constant attenuation of the light. */ /** Set the constant attenuation of the light. */
@ -174,7 +174,7 @@ class OSG_EXPORT Light : public StateAttribute
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected : protected :
virtual ~Light(); virtual ~Light();
/** Initialize the light's settings with some decent defaults. */ /** Initialize the light's settings with some decent defaults. */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -62,7 +62,7 @@ class OSG_EXPORT LightModel : public StateAttribute
SEPARATE_SPECULAR_COLOR, SEPARATE_SPECULAR_COLOR,
SINGLE_COLOR SINGLE_COLOR
}; };
void setColorControl(ColorControl cc) { _colorControl = cc; } void setColorControl(ColorControl cc) { _colorControl = cc; }
inline ColorControl getColorControl() const { return _colorControl; } inline ColorControl getColorControl() const { return _colorControl; }

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -24,7 +24,7 @@ namespace osg {
class OSG_EXPORT LightSource : public Group class OSG_EXPORT LightSource : public Group
{ {
public: public:
LightSource(); LightSource();
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
@ -42,7 +42,7 @@ class OSG_EXPORT LightSource : public Group
RELATIVE_RF, RELATIVE_RF,
ABSOLUTE_RF ABSOLUTE_RF
}; };
/** Set the light sources's ReferenceFrame, either to be relative to its /** Set the light sources's ReferenceFrame, either to be relative to its
* parent reference frame, or relative to an absolute coordinate * parent reference frame, or relative to an absolute coordinate
* frame. RELATIVE_RF is the default. * frame. RELATIVE_RF is the default.
@ -55,7 +55,7 @@ class OSG_EXPORT LightSource : public Group
* absolute light source at the top of the scene. * absolute light source at the top of the scene.
*/ */
void setReferenceFrame(ReferenceFrame rf); void setReferenceFrame(ReferenceFrame rf);
ReferenceFrame getReferenceFrame() const { return _referenceFrame; } ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
/** Set the attached light. */ /** Set the attached light. */

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -35,7 +35,7 @@ class OSG_EXPORT LineSegment : public Referenced
LineSegment& operator = (const LineSegment& seg) { _s = seg._s; _e = seg._e; return *this; } LineSegment& operator = (const LineSegment& seg) { _s = seg._s; _e = seg._e; return *this; }
inline void set(const vec_type& s,const vec_type& e) { _s=s; _e=e; } inline void set(const vec_type& s,const vec_type& e) { _s=s; _e=e; }
inline vec_type& start() { return _s; } inline vec_type& start() { return _s; }
inline const vec_type& start() const { return _s; } inline const vec_type& start() const { return _s; }
@ -64,7 +64,7 @@ class OSG_EXPORT LineSegment : public Referenced
* intersection ratio. * intersection ratio.
*/ */
bool intersect(const BoundingSphere& bs,float& r1,float& r2) const; bool intersect(const BoundingSphere& bs,float& r1,float& r2) const;
/** return true if segment intersects BoundingSphere and return the /** return true if segment intersects BoundingSphere and return the
* intersection ratio. * intersection ratio.
*/ */
@ -89,7 +89,7 @@ class OSG_EXPORT LineSegment : public Referenced
protected: protected:
virtual ~LineSegment(); virtual ~LineSegment();
static bool intersectAndClip(vec_type& s,vec_type& e,const BoundingBox& bb); static bool intersectAndClip(vec_type& s,vec_type& e,const BoundingBox& bb);
vec_type _s; vec_type _s;

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -53,7 +53,7 @@ class OSG_EXPORT LineStipple : public StateAttribute
return 0; // passed all the above comparison macros, must be equal. return 0; // passed all the above comparison macros, must be equal.
} }
virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
{ {
usage.usesMode(GL_LINE_STIPPLE); usage.usesMode(GL_LINE_STIPPLE);

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -29,9 +29,9 @@ class OSG_EXPORT LineWidth : public StateAttribute
LineWidth(const LineWidth& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY) : LineWidth(const LineWidth& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
StateAttribute(lw,copyop), StateAttribute(lw,copyop),
_width(lw._width) {} _width(lw._width) {}
META_StateAttribute(osg, LineWidth, LINEWIDTH); META_StateAttribute(osg, LineWidth, LINEWIDTH);
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -46,7 +46,7 @@ class OSG_EXPORT LineWidth : public StateAttribute
} }
void setWidth(float width); void setWidth(float width);
inline float getWidth() const { return _width; } inline float getWidth() const { return _width; }
virtual void apply(State& state) const; virtual void apply(State& state) const;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -62,7 +62,7 @@ class OSG_EXPORT LogicOp : public StateAttribute
}; };
LogicOp(); LogicOp();
LogicOp(Opcode opcode); LogicOp(Opcode opcode);
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
@ -71,7 +71,7 @@ class OSG_EXPORT LogicOp : public StateAttribute
_opcode(trans._opcode){} _opcode(trans._opcode){}
META_StateAttribute(osg, LogicOp,LOGICOP); META_StateAttribute(osg, LogicOp,LOGICOP);
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -98,7 +98,7 @@ class OSG_EXPORT LogicOp : public StateAttribute
} }
inline Opcode getOpcode() const { return _opcode; } inline Opcode getOpcode() const { return _opcode; }
virtual void apply(State& state) const; virtual void apply(State& state) const;
protected : protected :

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -33,7 +33,7 @@ class OSG_EXPORT Material : public StateAttribute
public : public :
Material(); Material();
/** Copy constructor using CopyOp to manage deep vs shallow copy. */ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
Material(const Material& mat,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Material(const Material& mat,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(mat,copyop), StateAttribute(mat,copyop),
@ -55,7 +55,7 @@ class OSG_EXPORT Material : public StateAttribute
_shininessBack(mat._shininessBack) {} _shininessBack(mat._shininessBack) {}
META_StateAttribute(osg, Material, MATERIAL); META_StateAttribute(osg, Material, MATERIAL);
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -108,7 +108,7 @@ class OSG_EXPORT Material : public StateAttribute
SPECULAR = GL_SPECULAR, SPECULAR = GL_SPECULAR,
EMISSION = GL_EMISSION, EMISSION = GL_EMISSION,
AMBIENT_AND_DIFFUSE = GL_AMBIENT_AND_DIFFUSE, AMBIENT_AND_DIFFUSE = GL_AMBIENT_AND_DIFFUSE,
OFF OFF
}; };
inline void setColorMode(ColorMode mode) { _colorMode = mode; } inline void setColorMode(ColorMode mode) { _colorMode = mode; }
@ -122,27 +122,27 @@ class OSG_EXPORT Material : public StateAttribute
const Vec4& getDiffuse(Face face) const; const Vec4& getDiffuse(Face face) const;
inline bool getDiffuseFrontAndBack() const { return _diffuseFrontAndBack; } inline bool getDiffuseFrontAndBack() const { return _diffuseFrontAndBack; }
/** Set specular value of specified face(s) of the material, /** Set specular value of specified face(s) of the material,
* valid specular[0..3] range is 0.0 to 1.0. * valid specular[0..3] range is 0.0 to 1.0.
*/ */
void setSpecular( Face face, const Vec4& specular ); void setSpecular( Face face, const Vec4& specular );
/** Get the specular value for specified face. */ /** Get the specular value for specified face. */
const Vec4& getSpecular(Face face) const; const Vec4& getSpecular(Face face) const;
/** Return whether specular values are equal for front and back faces /** Return whether specular values are equal for front and back faces
* or not. * or not.
*/ */
inline bool getSpecularFrontAndBack() const { return _specularFrontAndBack; } inline bool getSpecularFrontAndBack() const { return _specularFrontAndBack; }
/** Set emission value of specified face(s) of the material, /** Set emission value of specified face(s) of the material,
* valid emission[0..3] range is 0.0 to 1.0. * valid emission[0..3] range is 0.0 to 1.0.
*/ */
void setEmission( Face face, const Vec4& emission ); void setEmission( Face face, const Vec4& emission );
/** Get the emission value for specified face. */ /** Get the emission value for specified face. */
const Vec4& getEmission(Face face) const; const Vec4& getEmission(Face face) const;
/** Return whether emission values are equal for front and back faces /** Return whether emission values are equal for front and back faces
* or not. * or not.
*/ */
@ -152,15 +152,15 @@ class OSG_EXPORT Material : public StateAttribute
* valid shininess range is 0.0 to 128.0. * valid shininess range is 0.0 to 128.0.
*/ */
void setShininess(Face face, float shininess ); void setShininess(Face face, float shininess );
/** Get the shininess value for specified face. */ /** Get the shininess value for specified face. */
float getShininess(Face face) const; float getShininess(Face face) const;
/** Return whether shininess values are equal for front and back faces /** Return whether shininess values are equal for front and back faces
* or not. * or not.
*/ */
inline bool getShininessFrontAndBack() const { return _shininessFrontAndBack; } inline bool getShininessFrontAndBack() const { return _shininessFrontAndBack; }
/** Set the alpha value of ambient, diffuse, specular and emission /** Set the alpha value of ambient, diffuse, specular and emission
* colors of specified face, to 1-transparency. * colors of specified face, to 1-transparency.
* Valid transparency range is 0.0 to 1.0. * Valid transparency range is 0.0 to 1.0.

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -21,8 +21,8 @@
//certain math functions were not defined until 10.2 //certain math functions were not defined until 10.2
//so this code checks the version so it can add in workarounds for older versions. //so this code checks the version so it can add in workarounds for older versions.
#ifdef __APPLE__ #ifdef __APPLE__
// Using std::isnan will work for OS X, but use of <cmath> // Using std::isnan will work for OS X, but use of <cmath>
// and std:: are not necessarily portible with other systems so // and std:: are not necessarily portible with other systems so
// the include of <cmath> is isolated here. // the include of <cmath> is isolated here.
#include <cmath> #include <cmath>
#include <AvailabilityMacros.h> #include <AvailabilityMacros.h>
@ -33,7 +33,7 @@
// pre-10.2 support is not intended and we need not define APPLE_PRE_10_2. // pre-10.2 support is not intended and we need not define APPLE_PRE_10_2.
// The reason for this extra check is that if the user relies on default // The reason for this extra check is that if the user relies on default
// settings, MAC_OS_X_VERSION_MIN_REQUIRED will be set to 1010 and hit // settings, MAC_OS_X_VERSION_MIN_REQUIRED will be set to 1010 and hit
// this code path, but this is probably not what they want if using gcc 4+. // this code path, but this is probably not what they want if using gcc 4+.
#if (__GNUC__ < 4) #if (__GNUC__ < 4)
#define APPLE_PRE_10_2 #define APPLE_PRE_10_2
#endif #endif
@ -41,7 +41,7 @@
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6) #if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
#define APPLE_PRE_10_6 #define APPLE_PRE_10_6
#endif #endif
#endif #endif
#endif #endif
@ -82,7 +82,7 @@
#ifndef sqrtf #ifndef sqrtf
inline float sqrtf(float value) { return static_cast<float>(sqrt(value)); } inline float sqrtf(float value) { return static_cast<float>(sqrt(value)); }
#endif #endif
#ifndef fabsf #ifndef fabsf
inline float fabsf(float value) { return static_cast<float>(fabs(value)); } inline float fabsf(float value) { return static_cast<float>(fabs(value)); }
#endif #endif

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -42,16 +42,16 @@ class OSG_EXPORT MatrixTransform : public Transform
/** Set the transform's matrix.*/ /** Set the transform's matrix.*/
void setMatrix(const Matrix& mat) { _matrix = mat; _inverseDirty=true; dirtyBound(); } void setMatrix(const Matrix& mat) { _matrix = mat; _inverseDirty=true; dirtyBound(); }
/** Get the matrix. */ /** Get the matrix. */
inline const Matrix& getMatrix() const { return _matrix; } inline const Matrix& getMatrix() const { return _matrix; }
/** pre multiply the transform's matrix.*/ /** pre multiply the transform's matrix.*/
void preMult(const Matrix& mat) { _matrix.preMult(mat); _inverseDirty=true; dirtyBound(); } void preMult(const Matrix& mat) { _matrix.preMult(mat); _inverseDirty=true; dirtyBound(); }
/** post multiply the transform's matrix.*/ /** post multiply the transform's matrix.*/
void postMult(const Matrix& mat) { _matrix.postMult(mat); _inverseDirty=true; dirtyBound(); } void postMult(const Matrix& mat) { _matrix.postMult(mat); _inverseDirty=true; dirtyBound(); }
/** Get the inverse matrix. */ /** Get the inverse matrix. */
inline const Matrix& getInverseMatrix() const inline const Matrix& getInverseMatrix() const
{ {
@ -69,9 +69,9 @@ class OSG_EXPORT MatrixTransform : public Transform
protected : protected :
virtual ~MatrixTransform(); virtual ~MatrixTransform();
Matrix _matrix; Matrix _matrix;
mutable Matrix _inverse; mutable Matrix _inverse;
mutable bool _inverseDirty; mutable bool _inverseDirty;

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -26,7 +26,7 @@ class Matrixf;
class OSG_EXPORT Matrixd class OSG_EXPORT Matrixd
{ {
public: public:
typedef double value_type; typedef double value_type;
typedef float other_value_type; typedef float other_value_type;
@ -65,7 +65,7 @@ class OSG_EXPORT Matrixd
set(rhs.ptr()); set(rhs.ptr());
return *this; return *this;
} }
Matrixd& operator = (const Matrixf& other); Matrixd& operator = (const Matrixf& other);
inline void set(const Matrixd& rhs) { set(rhs.ptr()); } inline void set(const Matrixd& rhs) { set(rhs.ptr()); }
@ -77,7 +77,7 @@ class OSG_EXPORT Matrixd
value_type* local_ptr = (value_type*)_mat; value_type* local_ptr = (value_type*)_mat;
for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i];
} }
inline void set(double const * const ptr) inline void set(double const * const ptr)
{ {
value_type* local_ptr = (value_type*)_mat; value_type* local_ptr = (value_type*)_mat;
@ -88,7 +88,7 @@ class OSG_EXPORT Matrixd
value_type a10, value_type a11, value_type a12,value_type a13, value_type a10, value_type a11, value_type a12,value_type a13,
value_type a20, value_type a21, value_type a22,value_type a23, value_type a20, value_type a21, value_type a22,value_type a23,
value_type a30, value_type a31, value_type a32,value_type a33); value_type a30, value_type a31, value_type a32,value_type a33);
value_type * ptr() { return (value_type*)_mat; } value_type * ptr() { return (value_type*)_mat; }
const value_type * ptr() const { return (const value_type *)_mat; } const value_type * ptr() const { return (const value_type *)_mat; }
@ -101,39 +101,39 @@ class OSG_EXPORT Matrixd
} }
void makeIdentity(); void makeIdentity();
void makeScale( const Vec3f& ); void makeScale( const Vec3f& );
void makeScale( const Vec3d& ); void makeScale( const Vec3d& );
void makeScale( value_type, value_type, value_type ); void makeScale( value_type, value_type, value_type );
void makeTranslate( const Vec3f& ); void makeTranslate( const Vec3f& );
void makeTranslate( const Vec3d& ); void makeTranslate( const Vec3d& );
void makeTranslate( value_type, value_type, value_type ); void makeTranslate( value_type, value_type, value_type );
void makeRotate( const Vec3f& from, const Vec3f& to ); void makeRotate( const Vec3f& from, const Vec3f& to );
void makeRotate( const Vec3d& from, const Vec3d& to ); void makeRotate( const Vec3d& from, const Vec3d& to );
void makeRotate( value_type angle, const Vec3f& axis ); void makeRotate( value_type angle, const Vec3f& axis );
void makeRotate( value_type angle, const Vec3d& axis ); void makeRotate( value_type angle, const Vec3d& axis );
void makeRotate( value_type angle, value_type x, value_type y, value_type z ); void makeRotate( value_type angle, value_type x, value_type y, value_type z );
void makeRotate( const Quat& ); void makeRotate( const Quat& );
void makeRotate( value_type angle1, const Vec3f& axis1, void makeRotate( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2, value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3); value_type angle3, const Vec3f& axis3);
void makeRotate( value_type angle1, const Vec3d& axis1, void makeRotate( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2, value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3); value_type angle3, const Vec3d& axis3);
/** decompose the matrix into translation, rotation, scale and scale orientation.*/ /** decompose the matrix into translation, rotation, scale and scale orientation.*/
void decompose( osg::Vec3f& translation, void decompose( osg::Vec3f& translation,
osg::Quat& rotation, osg::Quat& rotation,
osg::Vec3f& scale, osg::Vec3f& scale,
osg::Quat& so ) const; osg::Quat& so ) const;
/** decompose the matrix into translation, rotation, scale and scale orientation.*/ /** decompose the matrix into translation, rotation, scale and scale orientation.*/
void decompose( osg::Vec3d& translation, void decompose( osg::Vec3d& translation,
osg::Quat& rotation, osg::Quat& rotation,
osg::Vec3d& scale, osg::Vec3d& scale,
osg::Quat& so ) const; osg::Quat& so ) const;
@ -242,8 +242,8 @@ class OSG_EXPORT Matrixd
/** full 4x4 matrix invert. */ /** full 4x4 matrix invert. */
bool invert_4x4( const Matrixd& rhs); bool invert_4x4( const Matrixd& rhs);
/** ortho-normalize the 3x3 rotation & scale matrix */ /** ortho-normalize the 3x3 rotation & scale matrix */
void orthoNormalize(const Matrixd& rhs); void orthoNormalize(const Matrixd& rhs);
// basic utility functions to create new matrices // basic utility functions to create new matrices
inline static Matrixd identity( void ); inline static Matrixd identity( void );
@ -258,15 +258,15 @@ class OSG_EXPORT Matrixd
inline static Matrixd rotate( value_type angle, value_type x, value_type y, value_type z); inline static Matrixd rotate( value_type angle, value_type x, value_type y, value_type z);
inline static Matrixd rotate( value_type angle, const Vec3f& axis); inline static Matrixd rotate( value_type angle, const Vec3f& axis);
inline static Matrixd rotate( value_type angle, const Vec3d& axis); inline static Matrixd rotate( value_type angle, const Vec3d& axis);
inline static Matrixd rotate( value_type angle1, const Vec3f& axis1, inline static Matrixd rotate( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2, value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3); value_type angle3, const Vec3f& axis3);
inline static Matrixd rotate( value_type angle1, const Vec3d& axis1, inline static Matrixd rotate( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2, value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3); value_type angle3, const Vec3d& axis3);
inline static Matrixd rotate( const Quat& quat); inline static Matrixd rotate( const Quat& quat);
inline static Matrixd inverse( const Matrixd& matrix); inline static Matrixd inverse( const Matrixd& matrix);
inline static Matrixd orthoNormal(const Matrixd& matrix); inline static Matrixd orthoNormal(const Matrixd& matrix);
/** Create an orthographic projection matrix. /** Create an orthographic projection matrix.
* See glOrtho for further details. * See glOrtho for further details.
*/ */
@ -336,16 +336,16 @@ class OSG_EXPORT Matrixd
void setTrans( value_type tx, value_type ty, value_type tz ); void setTrans( value_type tx, value_type ty, value_type tz );
void setTrans( const Vec3f& v ); void setTrans( const Vec3f& v );
void setTrans( const Vec3d& v ); void setTrans( const Vec3d& v );
inline Vec3d getTrans() const { return Vec3d(_mat[3][0],_mat[3][1],_mat[3][2]); } inline Vec3d getTrans() const { return Vec3d(_mat[3][0],_mat[3][1],_mat[3][2]); }
inline Vec3d getScale() const { inline Vec3d getScale() const {
Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]);
Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]);
Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]);
return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length());
} }
/** apply a 3x3 transform of v*M[0..2,0..2]. */ /** apply a 3x3 transform of v*M[0..2,0..2]. */
inline static Vec3f transform3x3(const Vec3f& v,const Matrixd& m); inline static Vec3f transform3x3(const Vec3f& v,const Matrixd& m);
@ -382,12 +382,12 @@ class OSG_EXPORT Matrixd
/** Optimized version of postMult(rotate(q)); */ /** Optimized version of postMult(rotate(q)); */
inline void postMultRotate( const Quat& q ); inline void postMultRotate( const Quat& q );
inline void operator *= ( const Matrixd& other ) inline void operator *= ( const Matrixd& other )
{ if( this == &other ) { { if( this == &other ) {
Matrixd temp(other); Matrixd temp(other);
postMult( temp ); postMult( temp );
} }
else postMult( other ); else postMult( other );
} }
inline Matrixd operator * ( const Matrixd &m ) const inline Matrixd operator * ( const Matrixd &m ) const
@ -405,7 +405,7 @@ class OSG_EXPORT Matrixd
class RefMatrixd : public Object, public Matrixd class RefMatrixd : public Object, public Matrixd
{ {
public: public:
RefMatrixd():Object(false), Matrixd() {} RefMatrixd():Object(false), Matrixd() {}
RefMatrixd( const Matrixd& other) : Object(false), Matrixd(other) {} RefMatrixd( const Matrixd& other) : Object(false), Matrixd(other) {}
RefMatrixd( const Matrixf& other) : Object(false), Matrixd(other) {} RefMatrixd( const Matrixf& other) : Object(false), Matrixd(other) {}
@ -415,21 +415,21 @@ class RefMatrixd : public Object, public Matrixd
Matrixd::value_type a10, Matrixd::value_type a11, Matrixd::value_type a12, Matrixd::value_type a13, Matrixd::value_type a10, Matrixd::value_type a11, Matrixd::value_type a12, Matrixd::value_type a13,
Matrixd::value_type a20, Matrixd::value_type a21, Matrixd::value_type a22, Matrixd::value_type a23, Matrixd::value_type a20, Matrixd::value_type a21, Matrixd::value_type a22, Matrixd::value_type a23,
Matrixd::value_type a30, Matrixd::value_type a31, Matrixd::value_type a32, Matrixd::value_type a33): Matrixd::value_type a30, Matrixd::value_type a31, Matrixd::value_type a32, Matrixd::value_type a33):
Object(false), Object(false),
Matrixd(a00, a01, a02, a03, Matrixd(a00, a01, a02, a03,
a10, a11, a12, a13, a10, a11, a12, a13,
a20, a21, a22, a23, a20, a21, a22, a23,
a30, a31, a32, a33) {} a30, a31, a32, a33) {}
virtual Object* cloneType() const { return new RefMatrixd(); } virtual Object* cloneType() const { return new RefMatrixd(); }
virtual Object* clone(const CopyOp&) const { return new RefMatrixd(*this); } virtual Object* clone(const CopyOp&) const { return new RefMatrixd(*this); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const RefMatrixd*>(obj)!=NULL; } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const RefMatrixd*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Matrix"; } virtual const char* className() const { return "Matrix"; }
protected: protected:
virtual ~RefMatrixd() {} virtual ~RefMatrixd() {}
}; };
@ -498,7 +498,7 @@ inline Matrixd Matrixd::rotate(value_type angle, const Vec3d& axis )
m.makeRotate(angle,axis); m.makeRotate(angle,axis);
return m; return m;
} }
inline Matrixd Matrixd::rotate( value_type angle1, const Vec3f& axis1, inline Matrixd Matrixd::rotate( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2, value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3) value_type angle3, const Vec3f& axis3)
{ {
@ -506,7 +506,7 @@ inline Matrixd Matrixd::rotate( value_type angle1, const Vec3f& axis1,
m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
return m; return m;
} }
inline Matrixd Matrixd::rotate( value_type angle1, const Vec3d& axis1, inline Matrixd Matrixd::rotate( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2, value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3) value_type angle3, const Vec3d& axis3)
{ {
@ -538,7 +538,7 @@ inline Matrixd Matrixd::orthoNormal(const Matrixd& matrix)
{ {
Matrixd m; Matrixd m;
m.orthoNormalize(matrix); m.orthoNormalize(matrix);
return m; return m;
} }
inline Matrixd Matrixd::ortho(double left, double right, inline Matrixd Matrixd::ortho(double left, double right,

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -26,7 +26,7 @@ class Matrixf;
class OSG_EXPORT Matrixf class OSG_EXPORT Matrixf
{ {
public: public:
typedef float value_type; typedef float value_type;
typedef double other_value_type; typedef double other_value_type;
@ -65,7 +65,7 @@ class OSG_EXPORT Matrixf
set(rhs.ptr()); set(rhs.ptr());
return *this; return *this;
} }
Matrixf& operator = (const Matrixd& other); Matrixf& operator = (const Matrixd& other);
inline void set(const Matrixf& rhs) { set(rhs.ptr()); } inline void set(const Matrixf& rhs) { set(rhs.ptr()); }
@ -77,7 +77,7 @@ class OSG_EXPORT Matrixf
value_type* local_ptr = (value_type*)_mat; value_type* local_ptr = (value_type*)_mat;
for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i];
} }
inline void set(double const * const ptr) inline void set(double const * const ptr)
{ {
value_type* local_ptr = (value_type*)_mat; value_type* local_ptr = (value_type*)_mat;
@ -88,7 +88,7 @@ class OSG_EXPORT Matrixf
value_type a10, value_type a11, value_type a12,value_type a13, value_type a10, value_type a11, value_type a12,value_type a13,
value_type a20, value_type a21, value_type a22,value_type a23, value_type a20, value_type a21, value_type a22,value_type a23,
value_type a30, value_type a31, value_type a32,value_type a33); value_type a30, value_type a31, value_type a32,value_type a33);
value_type * ptr() { return (value_type*)_mat; } value_type * ptr() { return (value_type*)_mat; }
const value_type * ptr() const { return (const value_type *)_mat; } const value_type * ptr() const { return (const value_type *)_mat; }
@ -101,39 +101,39 @@ class OSG_EXPORT Matrixf
} }
void makeIdentity(); void makeIdentity();
void makeScale( const Vec3f& ); void makeScale( const Vec3f& );
void makeScale( const Vec3d& ); void makeScale( const Vec3d& );
void makeScale( value_type, value_type, value_type ); void makeScale( value_type, value_type, value_type );
void makeTranslate( const Vec3f& ); void makeTranslate( const Vec3f& );
void makeTranslate( const Vec3d& ); void makeTranslate( const Vec3d& );
void makeTranslate( value_type, value_type, value_type ); void makeTranslate( value_type, value_type, value_type );
void makeRotate( const Vec3f& from, const Vec3f& to ); void makeRotate( const Vec3f& from, const Vec3f& to );
void makeRotate( const Vec3d& from, const Vec3d& to ); void makeRotate( const Vec3d& from, const Vec3d& to );
void makeRotate( value_type angle, const Vec3f& axis ); void makeRotate( value_type angle, const Vec3f& axis );
void makeRotate( value_type angle, const Vec3d& axis ); void makeRotate( value_type angle, const Vec3d& axis );
void makeRotate( value_type angle, value_type x, value_type y, value_type z ); void makeRotate( value_type angle, value_type x, value_type y, value_type z );
void makeRotate( const Quat& ); void makeRotate( const Quat& );
void makeRotate( value_type angle1, const Vec3f& axis1, void makeRotate( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2, value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3); value_type angle3, const Vec3f& axis3);
void makeRotate( value_type angle1, const Vec3d& axis1, void makeRotate( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2, value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3); value_type angle3, const Vec3d& axis3);
/** decompose the matrix into translation, rotation, scale and scale orientation.*/ /** decompose the matrix into translation, rotation, scale and scale orientation.*/
void decompose( osg::Vec3f& translation, void decompose( osg::Vec3f& translation,
osg::Quat& rotation, osg::Quat& rotation,
osg::Vec3f& scale, osg::Vec3f& scale,
osg::Quat& so ) const; osg::Quat& so ) const;
/** decompose the matrix into translation, rotation, scale and scale orientation.*/ /** decompose the matrix into translation, rotation, scale and scale orientation.*/
void decompose( osg::Vec3d& translation, void decompose( osg::Vec3d& translation,
osg::Quat& rotation, osg::Quat& rotation,
osg::Vec3d& scale, osg::Vec3d& scale,
osg::Quat& so ) const; osg::Quat& so ) const;
@ -242,8 +242,8 @@ class OSG_EXPORT Matrixf
/** full 4x4 matrix invert. */ /** full 4x4 matrix invert. */
bool invert_4x4( const Matrixf& rhs); bool invert_4x4( const Matrixf& rhs);
/** ortho-normalize the 3x3 rotation & scale matrix */ /** ortho-normalize the 3x3 rotation & scale matrix */
void orthoNormalize(const Matrixf& rhs); void orthoNormalize(const Matrixf& rhs);
//basic utility functions to create new matrices //basic utility functions to create new matrices
inline static Matrixf identity( void ); inline static Matrixf identity( void );
@ -258,16 +258,16 @@ class OSG_EXPORT Matrixf
inline static Matrixf rotate( value_type angle, value_type x, value_type y, value_type z); inline static Matrixf rotate( value_type angle, value_type x, value_type y, value_type z);
inline static Matrixf rotate( value_type angle, const Vec3f& axis); inline static Matrixf rotate( value_type angle, const Vec3f& axis);
inline static Matrixf rotate( value_type angle, const Vec3d& axis); inline static Matrixf rotate( value_type angle, const Vec3d& axis);
inline static Matrixf rotate( value_type angle1, const Vec3f& axis1, inline static Matrixf rotate( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2, value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3); value_type angle3, const Vec3f& axis3);
inline static Matrixf rotate( value_type angle1, const Vec3d& axis1, inline static Matrixf rotate( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2, value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3); value_type angle3, const Vec3d& axis3);
inline static Matrixf rotate( const Quat& quat); inline static Matrixf rotate( const Quat& quat);
inline static Matrixf inverse( const Matrixf& matrix); inline static Matrixf inverse( const Matrixf& matrix);
inline static Matrixf orthoNormal(const Matrixf& matrix); inline static Matrixf orthoNormal(const Matrixf& matrix);
/** Create an orthographic projection matrix. /** Create an orthographic projection matrix.
* See glOrtho for further details. * See glOrtho for further details.
*/ */
@ -338,16 +338,16 @@ class OSG_EXPORT Matrixf
void setTrans( value_type tx, value_type ty, value_type tz ); void setTrans( value_type tx, value_type ty, value_type tz );
void setTrans( const Vec3f& v ); void setTrans( const Vec3f& v );
void setTrans( const Vec3d& v ); void setTrans( const Vec3d& v );
inline Vec3d getTrans() const { return Vec3d(_mat[3][0],_mat[3][1],_mat[3][2]); } inline Vec3d getTrans() const { return Vec3d(_mat[3][0],_mat[3][1],_mat[3][2]); }
inline Vec3d getScale() const { inline Vec3d getScale() const {
Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]);
Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]);
Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]);
return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length());
} }
/** apply a 3x3 transform of v*M[0..2,0..2]. */ /** apply a 3x3 transform of v*M[0..2,0..2]. */
inline static Vec3f transform3x3(const Vec3f& v,const Matrixf& m); inline static Vec3f transform3x3(const Vec3f& v,const Matrixf& m);
@ -384,12 +384,12 @@ class OSG_EXPORT Matrixf
/** Optimized version of postMult(rotate(q)); */ /** Optimized version of postMult(rotate(q)); */
inline void postMultRotate( const Quat& q ); inline void postMultRotate( const Quat& q );
inline void operator *= ( const Matrixf& other ) inline void operator *= ( const Matrixf& other )
{ if( this == &other ) { { if( this == &other ) {
Matrixf temp(other); Matrixf temp(other);
postMult( temp ); postMult( temp );
} }
else postMult( other ); else postMult( other );
} }
inline Matrixf operator * ( const Matrixf &m ) const inline Matrixf operator * ( const Matrixf &m ) const
@ -429,7 +429,7 @@ class OSG_EXPORT Matrixf
_mat[3][2]*=rhs; _mat[3][2]*=rhs;
_mat[3][3]*=rhs; _mat[3][3]*=rhs;
return *this; return *this;
} }
/** Divide by scalar. */ /** Divide by scalar. */
inline Matrixf operator / (value_type rhs) const inline Matrixf operator / (value_type rhs) const
@ -461,7 +461,7 @@ class OSG_EXPORT Matrixf
_mat[3][2]/=rhs; _mat[3][2]/=rhs;
_mat[3][3]/=rhs; _mat[3][3]/=rhs;
return *this; return *this;
} }
/** Binary vector add. */ /** Binary vector add. */
inline Matrixf operator + (const Matrixf& rhs) const inline Matrixf operator + (const Matrixf& rhs) const
@ -482,7 +482,7 @@ class OSG_EXPORT Matrixf
_mat[3][0] + rhs._mat[3][0], _mat[3][0] + rhs._mat[3][0],
_mat[3][1] + rhs._mat[3][1], _mat[3][1] + rhs._mat[3][1],
_mat[3][2] + rhs._mat[3][2], _mat[3][2] + rhs._mat[3][2],
_mat[3][3] + rhs._mat[3][3]); _mat[3][3] + rhs._mat[3][3]);
} }
/** Unary vector add. Slightly more efficient because no temporary /** Unary vector add. Slightly more efficient because no temporary
@ -507,7 +507,7 @@ class OSG_EXPORT Matrixf
_mat[3][2] += rhs._mat[3][2]; _mat[3][2] += rhs._mat[3][2];
_mat[3][3] += rhs._mat[3][3]; _mat[3][3] += rhs._mat[3][3];
return *this; return *this;
} }
protected: protected:
value_type _mat[4][4]; value_type _mat[4][4];
@ -517,7 +517,7 @@ class OSG_EXPORT Matrixf
class RefMatrixf : public Object, public Matrixf class RefMatrixf : public Object, public Matrixf
{ {
public: public:
RefMatrixf():Object(false), Matrixf() {} RefMatrixf():Object(false), Matrixf() {}
RefMatrixf( const Matrixf& other) : Object(false), Matrixf(other) {} RefMatrixf( const Matrixf& other) : Object(false), Matrixf(other) {}
RefMatrixf( const Matrixd& other) : Object(false), Matrixf(other) {} RefMatrixf( const Matrixd& other) : Object(false), Matrixf(other) {}
@ -527,21 +527,21 @@ class RefMatrixf : public Object, public Matrixf
Matrixf::value_type a10, Matrixf::value_type a11, Matrixf::value_type a12, Matrixf::value_type a13, Matrixf::value_type a10, Matrixf::value_type a11, Matrixf::value_type a12, Matrixf::value_type a13,
Matrixf::value_type a20, Matrixf::value_type a21, Matrixf::value_type a22, Matrixf::value_type a23, Matrixf::value_type a20, Matrixf::value_type a21, Matrixf::value_type a22, Matrixf::value_type a23,
Matrixf::value_type a30, Matrixf::value_type a31, Matrixf::value_type a32, Matrixf::value_type a33): Matrixf::value_type a30, Matrixf::value_type a31, Matrixf::value_type a32, Matrixf::value_type a33):
Object(false), Object(false),
Matrixf(a00, a01, a02, a03, Matrixf(a00, a01, a02, a03,
a10, a11, a12, a13, a10, a11, a12, a13,
a20, a21, a22, a23, a20, a21, a22, a23,
a30, a31, a32, a33) {} a30, a31, a32, a33) {}
virtual Object* cloneType() const { return new RefMatrixf(); } virtual Object* cloneType() const { return new RefMatrixf(); }
virtual Object* clone(const CopyOp&) const { return new RefMatrixf(*this); } virtual Object* clone(const CopyOp&) const { return new RefMatrixf(*this); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const RefMatrixf*>(obj)!=NULL; } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const RefMatrixf*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Matrix"; } virtual const char* className() const { return "Matrix"; }
protected: protected:
virtual ~RefMatrixf() {} virtual ~RefMatrixf() {}
}; };
@ -610,7 +610,7 @@ inline Matrixf Matrixf::rotate(value_type angle, const Vec3d& axis )
m.makeRotate(angle,axis); m.makeRotate(angle,axis);
return m; return m;
} }
inline Matrixf Matrixf::rotate( value_type angle1, const Vec3f& axis1, inline Matrixf Matrixf::rotate( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2, value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3) value_type angle3, const Vec3f& axis3)
{ {
@ -618,7 +618,7 @@ inline Matrixf Matrixf::rotate( value_type angle1, const Vec3f& axis1,
m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
return m; return m;
} }
inline Matrixf Matrixf::rotate( value_type angle1, const Vec3d& axis1, inline Matrixf Matrixf::rotate( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2, value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3) value_type angle3, const Vec3d& axis3)
{ {
@ -650,7 +650,7 @@ inline Matrixf Matrixf::orthoNormal(const Matrixf& matrix)
{ {
Matrixf m; Matrixf m;
m.orthoNormalize(matrix); m.orthoNormalize(matrix);
return m; return m;
} }
inline Matrixf Matrixf::ortho(double left, double right, inline Matrixf Matrixf::ortho(double left, double right,

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -84,7 +84,7 @@ public:
void clear() { _impl.clear(); } void clear() { _impl.clear(); }
void resize(size_type new_size, const value_type& fill_value = value_type()) { _impl.resize(new_size, fill_value); } void resize(size_type new_size, const value_type& fill_value = value_type()) { _impl.resize(new_size, fill_value); }
void reserve(size_type new_capacity) { _impl.reserve(new_capacity); } void reserve(size_type new_capacity) { _impl.reserve(new_capacity); }
void swap(vector_type& other) { _impl.swap(other); } void swap(vector_type& other) { _impl.swap(other); }
void swap(MixinVector& other) { _impl.swap(other._impl); } void swap(MixinVector& other) { _impl.swap(other._impl); }

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -45,13 +45,13 @@ class OSG_EXPORT Multisample : public StateAttribute
enum Mode enum Mode
{ {
FASTEST = GL_FASTEST, FASTEST = GL_FASTEST,
NICEST = GL_NICEST, NICEST = GL_NICEST,
DONT_CARE = GL_DONT_CARE DONT_CARE = GL_DONT_CARE
}; };
Multisample(); Multisample();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Multisample(const Multisample& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Multisample(const Multisample& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(trans,copyop), StateAttribute(trans,copyop),
@ -60,7 +60,7 @@ class OSG_EXPORT Multisample : public StateAttribute
_mode(trans._mode) {} _mode(trans._mode) {}
META_StateAttribute(osg, Multisample,MULTISAMPLE); META_StateAttribute(osg, Multisample,MULTISAMPLE);
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& sa) const virtual int compare(const StateAttribute& sa) const
{ {
@ -76,14 +76,14 @@ class OSG_EXPORT Multisample : public StateAttribute
return 0; // passed all the above comparison macros, must be equal. return 0; // passed all the above comparison macros, must be equal.
} }
void setSampleCoverage(float coverage, bool invert) void setSampleCoverage(float coverage, bool invert)
{ {
_coverage = coverage; _coverage = coverage;
_invert = invert; _invert = invert;
} }
inline void setCoverage(float coverage) { _coverage=coverage; } inline void setCoverage(float coverage) { _coverage=coverage; }
inline float getCoverage() const { return _coverage; } inline float getCoverage() const { return _coverage; }
inline void setInvert(bool invert) { _invert=invert; } inline void setInvert(bool invert) { _invert=invert; }
inline bool getInvert() const { return _invert; } inline bool getInvert() const { return _invert; }
@ -94,42 +94,42 @@ class OSG_EXPORT Multisample : public StateAttribute
/** Extensions class which encapsulates the querying of extensions and /** Extensions class which encapsulates the querying of extensions and
* associated function pointers, and provide convenience wrappers to * associated function pointers, and provide convenience wrappers to
* check for the extensions or use the associated functions.*/ * check for the extensions or use the associated functions.*/
class OSG_EXPORT Extensions : public osg::Referenced class OSG_EXPORT Extensions : public osg::Referenced
{ {
public: public:
Extensions(unsigned int contextID); Extensions(unsigned int contextID);
Extensions(const Extensions& rhs); Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs); void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID); void setupGLExtensions(unsigned int contextID);
void setMultisampleSupported(bool flag) { _isMultisampleSupported=flag; } void setMultisampleSupported(bool flag) { _isMultisampleSupported=flag; }
void setMultisampleFilterHintSupported(bool flag) { _isMultisampleFilterHintSupported=flag; } void setMultisampleFilterHintSupported(bool flag) { _isMultisampleFilterHintSupported=flag; }
bool isMultisampleSupported() const { return _isMultisampleSupported; } bool isMultisampleSupported() const { return _isMultisampleSupported; }
bool isMultisampleFilterHintSupported() const { return _isMultisampleFilterHintSupported; } bool isMultisampleFilterHintSupported() const { return _isMultisampleFilterHintSupported; }
void glSampleCoverage(GLclampf value, GLboolean invert) const; void glSampleCoverage(GLclampf value, GLboolean invert) const;
protected: protected:
~Extensions() {} ~Extensions() {}
bool _isMultisampleSupported; bool _isMultisampleSupported;
bool _isMultisampleFilterHintSupported; bool _isMultisampleFilterHintSupported;
typedef void (GL_APIENTRY * GLSampleCoverageProc) (GLclampf value, GLboolean invert); typedef void (GL_APIENTRY * GLSampleCoverageProc) (GLclampf value, GLboolean invert);
GLSampleCoverageProc _glSampleCoverage; GLSampleCoverageProc _glSampleCoverage;
}; };
/** Function to call to get the extension of a specified context. /** Function to call to get the extension of a specified context.
* If the Extension object for that context has not yet been created * If the Extension object for that context has not yet been created
* and the 'createIfNotInitalized' flag been set to false then returns NULL. * and the 'createIfNotInitalized' flag been set to false then returns NULL.
* If 'createIfNotInitalized' is true then the Extensions object is * If 'createIfNotInitalized' is true then the Extensions object is
* automatically created. However, in this case the extension object will * automatically created. However, in this case the extension object will
* only be created with the graphics context associated with ContextID..*/ * only be created with the graphics context associated with ContextID..*/
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -59,7 +59,7 @@ typedef std::vector< Matrix > MatrixList;
virtual const char* className() const { return #name; } \ virtual const char* className() const { return #name; } \
virtual const char* libraryName() const { return #library; } \ virtual const char* libraryName() const { return #library; } \
virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } } \ virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } } \
/** Base class for all internal nodes in the scene graph. /** Base class for all internal nodes in the scene graph.
Provides interface for most common node operations (Composite Pattern). Provides interface for most common node operations (Composite Pattern).
@ -69,7 +69,7 @@ class OSG_EXPORT Node : public Object
public: public:
/** Construct a node. /** Construct a node.
Initialize the parent list to empty, node name to "" and Initialize the parent list to empty, node name to "" and
bounding sphere dirty flag to true.*/ bounding sphere dirty flag to true.*/
Node(); Node();
@ -145,7 +145,7 @@ class OSG_EXPORT Node : public Object
/** Traverse upwards : calls parents' accept method with NodeVisitor.*/ /** Traverse upwards : calls parents' accept method with NodeVisitor.*/
virtual void ascend(NodeVisitor& nv); virtual void ascend(NodeVisitor& nv);
/** Traverse downwards : calls children's accept method with NodeVisitor.*/ /** Traverse downwards : calls children's accept method with NodeVisitor.*/
virtual void traverse(NodeVisitor& /*nv*/) {} virtual void traverse(NodeVisitor& /*nv*/) {}
/** A vector of osg::Group pointers which is used to store the parent(s) of node.*/ /** A vector of osg::Group pointers which is used to store the parent(s) of node.*/
typedef std::vector<Group*> ParentList; typedef std::vector<Group*> ParentList;
@ -153,7 +153,7 @@ class OSG_EXPORT Node : public Object
/** Get the parent list of node. */ /** Get the parent list of node. */
inline const ParentList& getParents() const { return _parents; } inline const ParentList& getParents() const { return _parents; }
/** Get the a copy of parent list of node. A copy is returned to /** Get the a copy of parent list of node. A copy is returned to
* prevent modification of the parent list.*/ * prevent modification of the parent list.*/
inline ParentList getParents() { return _parents; } inline ParentList getParents() { return _parents; }
@ -179,7 +179,7 @@ class OSG_EXPORT Node : public Object
/** Get the list of matrices that transform this node from local coordinates to world coordinates. /** Get the list of matrices that transform this node from local coordinates to world coordinates.
* The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */ * The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */
MatrixList getWorldMatrices(const osg::Node* haltTraversalAtNode=0) const; MatrixList getWorldMatrices(const osg::Node* haltTraversalAtNode=0) const;
/** Set update node callback, called during update traversal. */ /** Set update node callback, called during update traversal. */
void setUpdateCallback(NodeCallback* nc); void setUpdateCallback(NodeCallback* nc);
@ -285,7 +285,7 @@ class OSG_EXPORT Node : public Object
/** Get the number of Children of this node which are or have OccluderNode's.*/ /** Get the number of Children of this node which are or have OccluderNode's.*/
inline unsigned int getNumChildrenWithOccluderNodes() const { return _numChildrenWithOccluderNodes; } inline unsigned int getNumChildrenWithOccluderNodes() const { return _numChildrenWithOccluderNodes; }
/** return true if this node is an OccluderNode or the subgraph below this node are OccluderNodes.*/ /** return true if this node is an OccluderNode or the subgraph below this node are OccluderNodes.*/
bool containsOccluderNodes() const; bool containsOccluderNodes() const;
@ -353,7 +353,7 @@ class OSG_EXPORT Node : public Object
/** Add a description string to the node.*/ /** Add a description string to the node.*/
void addDescription(const std::string& desc); void addDescription(const std::string& desc);
/** Set the initial bounding volume to use when computing the overall bounding volume.*/ /** Set the initial bounding volume to use when computing the overall bounding volume.*/
void setInitialBound(const osg::BoundingSphere& bsphere) { _initialBound = bsphere; dirtyBound(); } void setInitialBound(const osg::BoundingSphere& bsphere) { _initialBound = bsphere; dirtyBound(); }
@ -372,11 +372,11 @@ class OSG_EXPORT Node : public Object
if(!_boundingSphereComputed) if(!_boundingSphereComputed)
{ {
_boundingSphere = _initialBound; _boundingSphere = _initialBound;
if (_computeBoundCallback.valid()) if (_computeBoundCallback.valid())
_boundingSphere.expandBy(_computeBoundCallback->computeBound(*this)); _boundingSphere.expandBy(_computeBoundCallback->computeBound(*this));
else else
_boundingSphere.expandBy(computeBound()); _boundingSphere.expandBy(computeBound());
_boundingSphereComputed = true; _boundingSphereComputed = true;
} }
return _boundingSphere; return _boundingSphere;
@ -458,10 +458,10 @@ class OSG_EXPORT Node : public Object
ref_ptr<NodeCallback> _cullCallback; ref_ptr<NodeCallback> _cullCallback;
bool _cullingActive; bool _cullingActive;
unsigned int _numChildrenWithCullingDisabled; unsigned int _numChildrenWithCullingDisabled;
void setNumChildrenWithCullingDisabled(unsigned int num); void setNumChildrenWithCullingDisabled(unsigned int num);
unsigned int _numChildrenWithOccluderNodes; unsigned int _numChildrenWithOccluderNodes;
void setNumChildrenWithOccluderNodes(unsigned int num); void setNumChildrenWithOccluderNodes(unsigned int num);
NodeMask _nodeMask; NodeMask _nodeMask;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -25,33 +25,33 @@ class NodeVisitor;
class OSG_EXPORT NodeCallback : public virtual Object { class OSG_EXPORT NodeCallback : public virtual Object {
public : public :
NodeCallback(){} NodeCallback(){}
NodeCallback(const NodeCallback& nc,const CopyOp&): NodeCallback(const NodeCallback& nc,const CopyOp&):
_nestedCallback(nc._nestedCallback) {} _nestedCallback(nc._nestedCallback) {}
META_Object(osg,NodeCallback); META_Object(osg,NodeCallback);
/** Callback method called by the NodeVisitor when visiting a node.*/ /** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(Node* node, NodeVisitor* nv) virtual void operator()(Node* node, NodeVisitor* nv)
{ {
// note, callback is responsible for scenegraph traversal so // note, callback is responsible for scenegraph traversal so
// they must call traverse(node,nv) to ensure that the // they must call traverse(node,nv) to ensure that the
// scene graph subtree (and associated callbacks) are traversed. // scene graph subtree (and associated callbacks) are traversed.
traverse(node,nv); traverse(node,nv);
} }
/** Call any nested callbacks and then traverse the scene graph. */ /** Call any nested callbacks and then traverse the scene graph. */
void traverse(Node* node,NodeVisitor* nv); void traverse(Node* node,NodeVisitor* nv);
void setNestedCallback(NodeCallback* nc) { _nestedCallback = nc; } void setNestedCallback(NodeCallback* nc) { _nestedCallback = nc; }
NodeCallback* getNestedCallback() { return _nestedCallback.get(); } NodeCallback* getNestedCallback() { return _nestedCallback.get(); }
const NodeCallback* getNestedCallback() const { return _nestedCallback.get(); } const NodeCallback* getNestedCallback() const { return _nestedCallback.get(); }
inline void addNestedCallback(NodeCallback* nc) inline void addNestedCallback(NodeCallback* nc)
{ {
if (nc) if (nc)
@ -67,7 +67,7 @@ class OSG_EXPORT NodeCallback : public virtual Object {
} }
} }
} }
inline void removeNestedCallback(NodeCallback* nc) inline void removeNestedCallback(NodeCallback* nc)
{ {
if (nc) if (nc)
@ -82,13 +82,13 @@ class OSG_EXPORT NodeCallback : public virtual Object {
} }
} }
} }
public: public:
ref_ptr<NodeCallback> _nestedCallback; ref_ptr<NodeCallback> _nestedCallback;
protected: protected:
virtual ~NodeCallback() {} virtual ~NodeCallback() {}
}; };

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -49,7 +49,7 @@ const unsigned int UNINITIALIZED_FRAME_NUMBER=0xffffffff;
virtual const char* className() const { return #name; } virtual const char* className() const { return #name; }
/** Visitor for type safe operations on osg::Nodes. /** Visitor for type safe operations on osg::Nodes.
Based on GOF's Visitor pattern. The NodeVisitor Based on GOF's Visitor pattern. The NodeVisitor
is useful for developing type safe operations to nodes is useful for developing type safe operations to nodes
in the scene graph (as per Visitor pattern), and adds to this in the scene graph (as per Visitor pattern), and adds to this
support for optional scene graph traversal to allow support for optional scene graph traversal to allow
@ -61,7 +61,7 @@ const unsigned int UNINITIALIZED_FRAME_NUMBER=0xffffffff;
apply directly. So use root->accept(myVisitor); instead of apply directly. So use root->accept(myVisitor); instead of
myVisitor.apply(*root). The later method will bypass the double myVisitor.apply(*root). The later method will bypass the double
dispatch and the appropriate NodeVisitor::apply(..) method will dispatch and the appropriate NodeVisitor::apply(..) method will
not be called. */ not be called. */
class OSG_EXPORT NodeVisitor : public virtual Referenced class OSG_EXPORT NodeVisitor : public virtual Referenced
{ {
public: public:
@ -73,7 +73,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
TRAVERSE_ALL_CHILDREN, TRAVERSE_ALL_CHILDREN,
TRAVERSE_ACTIVE_CHILDREN TRAVERSE_ACTIVE_CHILDREN
}; };
enum VisitorType enum VisitorType
{ {
NODE_VISITOR = 0, NODE_VISITOR = 0,
@ -84,11 +84,11 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
}; };
NodeVisitor(TraversalMode tm=TRAVERSE_NONE); NodeVisitor(TraversalMode tm=TRAVERSE_NONE);
NodeVisitor(VisitorType type,TraversalMode tm=TRAVERSE_NONE); NodeVisitor(VisitorType type,TraversalMode tm=TRAVERSE_NONE);
virtual ~NodeVisitor(); virtual ~NodeVisitor();
/** return the library name/namespapce of the visitor's. Should be defined by derived classes.*/ /** return the library name/namespapce of the visitor's. Should be defined by derived classes.*/
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
@ -96,7 +96,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
virtual const char* className() const { return "NodeVisitor"; } virtual const char* className() const { return "NodeVisitor"; }
/** Method to call to reset visitor. Useful if your visitor accumulates /** Method to call to reset visitor. Useful if your visitor accumulates
state during a traversal, and you plan to reuse the visitor. state during a traversal, and you plan to reuse the visitor.
To flush that state for the next traversal: call reset() prior To flush that state for the next traversal: call reset() prior
to each traversal.*/ to each traversal.*/
virtual void reset() {} virtual void reset() {}
@ -106,19 +106,19 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
* traversal of the scene, typically used in the Node::traverse() method * traversal of the scene, typically used in the Node::traverse() method
* to select which behaviour to use for different types of traversal/visitors.*/ * to select which behaviour to use for different types of traversal/visitors.*/
inline void setVisitorType(VisitorType type) { _visitorType = type; } inline void setVisitorType(VisitorType type) { _visitorType = type; }
/** Get the VisitorType.*/ /** Get the VisitorType.*/
inline VisitorType getVisitorType() const { return _visitorType; } inline VisitorType getVisitorType() const { return _visitorType; }
/** Set the traversal number. Typically used to denote the frame count.*/ /** Set the traversal number. Typically used to denote the frame count.*/
inline void setTraversalNumber(unsigned int fn) { _traversalNumber = fn; } inline void setTraversalNumber(unsigned int fn) { _traversalNumber = fn; }
/** Get the traversal number. Typically used to denote the frame count.*/ /** Get the traversal number. Typically used to denote the frame count.*/
inline unsigned int getTraversalNumber() const { return _traversalNumber; } inline unsigned int getTraversalNumber() const { return _traversalNumber; }
/** Set the FrameStamp that this traversal is associated with.*/ /** Set the FrameStamp that this traversal is associated with.*/
inline void setFrameStamp(FrameStamp* fs) { _frameStamp = fs; } inline void setFrameStamp(FrameStamp* fs) { _frameStamp = fs; }
/** Get the FrameStamp that this traversal is associated with.*/ /** Get the FrameStamp that this traversal is associated with.*/
inline const FrameStamp* getFrameStamp() const { return _frameStamp.get(); } inline const FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
@ -138,7 +138,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
inline Node::NodeMask getTraversalMask() const { return _traversalMask; } inline Node::NodeMask getTraversalMask() const { return _traversalMask; }
/** Set the NodeMaskOverride mask. /** Set the NodeMaskOverride mask.
* Used in validNodeMask() to determine whether to operate on a node or its * Used in validNodeMask() to determine whether to operate on a node or its
* subgraph, by OR'ing NodeVisitor::_nodeMaskOverride with the Node's own Node::_nodeMask. * subgraph, by OR'ing NodeVisitor::_nodeMaskOverride with the Node's own Node::_nodeMask.
* Typically used to force on nodes which may have * Typically used to force on nodes which may have
* been switched off by their own Node::_nodeMask.*/ * been switched off by their own Node::_nodeMask.*/
@ -146,7 +146,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
/** Get the NodeMaskOverride mask.*/ /** Get the NodeMaskOverride mask.*/
inline Node::NodeMask getNodeMaskOverride() const { return _nodeMaskOverride; } inline Node::NodeMask getNodeMaskOverride() const { return _nodeMaskOverride; }
/** Method to called by Node and its subclass' Node::accept() method, if the result is true /** Method to called by Node and its subclass' Node::accept() method, if the result is true
* it is used to cull operations of nodes and their subgraphs. * it is used to cull operations of nodes and their subgraphs.
* Return true if the result of a bit wise and of the NodeVisitor::_traversalMask * Return true if the result of a bit wise and of the NodeVisitor::_traversalMask
@ -158,33 +158,33 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
return (getTraversalMask() & (getNodeMaskOverride() | node.getNodeMask()))!=0; return (getTraversalMask() & (getNodeMaskOverride() | node.getNodeMask()))!=0;
} }
/** Set the traversal mode for Node::traverse() to use when /** Set the traversal mode for Node::traverse() to use when
deciding which children of a node to traverse. If a deciding which children of a node to traverse. If a
NodeVisitor has been attached via setTraverseVisitor() NodeVisitor has been attached via setTraverseVisitor()
and the new mode is not TRAVERSE_VISITOR then the attached and the new mode is not TRAVERSE_VISITOR then the attached
visitor is detached. Default mode is TRAVERSE_NONE.*/ visitor is detached. Default mode is TRAVERSE_NONE.*/
inline void setTraversalMode(TraversalMode mode) { _traversalMode = mode; } inline void setTraversalMode(TraversalMode mode) { _traversalMode = mode; }
/** Get the traversal mode.*/ /** Get the traversal mode.*/
inline TraversalMode getTraversalMode() const { return _traversalMode; } inline TraversalMode getTraversalMode() const { return _traversalMode; }
/** /**
* Set user data, data must be subclassed from Referenced to allow * Set user data, data must be subclassed from Referenced to allow
* automatic memory handling. If your own data isn't directly * automatic memory handling. If your own data isn't directly
* subclassed from Referenced then create an adapter object * subclassed from Referenced then create an adapter object
* which points to your own objects and handles the memory addressing. * which points to your own objects and handles the memory addressing.
*/ */
inline void setUserData(Referenced* obj) { _userData = obj; } inline void setUserData(Referenced* obj) { _userData = obj; }
/** Get user data.*/ /** Get user data.*/
inline Referenced* getUserData() { return _userData.get(); } inline Referenced* getUserData() { return _userData.get(); }
/** Get const user data.*/ /** Get const user data.*/
inline const Referenced* getUserData() const { return _userData.get(); } inline const Referenced* getUserData() const { return _userData.get(); }
/** Method for handling traversal of a nodes. /** Method for handling traversal of a nodes.
If you intend to use the visitor for actively traversing If you intend to use the visitor for actively traversing
the scene graph then make sure the accept() methods call the scene graph then make sure the accept() methods call
this method unless they handle traversal directly.*/ this method unless they handle traversal directly.*/
inline void traverse(Node& node) inline void traverse(Node& node)
@ -192,22 +192,22 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
if (_traversalMode==TRAVERSE_PARENTS) node.ascend(*this); if (_traversalMode==TRAVERSE_PARENTS) node.ascend(*this);
else if (_traversalMode!=TRAVERSE_NONE) node.traverse(*this); else if (_traversalMode!=TRAVERSE_NONE) node.traverse(*this);
} }
/** Method called by osg::Node::accept() method before /** Method called by osg::Node::accept() method before
* a call to the NodeVisitor::apply(..). The back of the list will, * a call to the NodeVisitor::apply(..). The back of the list will,
* therefore, be the current node being visited inside the apply(..), * therefore, be the current node being visited inside the apply(..),
* and the rest of the list will be the parental sequence of nodes * and the rest of the list will be the parental sequence of nodes
* from the top most node applied down the graph to the current node. * from the top most node applied down the graph to the current node.
* Note, the user does not typically call pushNodeOnPath() as it * Note, the user does not typically call pushNodeOnPath() as it
* will be called automatically by the Node::accept() method.*/ * will be called automatically by the Node::accept() method.*/
inline void pushOntoNodePath(Node* node) { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.push_back(node); else _nodePath.insert(_nodePath.begin(),node); } inline void pushOntoNodePath(Node* node) { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.push_back(node); else _nodePath.insert(_nodePath.begin(),node); }
/** Method called by osg::Node::accept() method after /** Method called by osg::Node::accept() method after
* a call to NodeVisitor::apply(..). * a call to NodeVisitor::apply(..).
* Note, the user does not typically call popFromNodePath() as it * Note, the user does not typically call popFromNodePath() as it
* will be called automatically by the Node::accept() method.*/ * will be called automatically by the Node::accept() method.*/
inline void popFromNodePath() { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.pop_back(); else _nodePath.erase(_nodePath.begin()); } inline void popFromNodePath() { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.pop_back(); else _nodePath.erase(_nodePath.begin()); }
/** Get the non const NodePath from the top most node applied down /** Get the non const NodePath from the top most node applied down
* to the current Node being visited.*/ * to the current Node being visited.*/
NodePath& getNodePath() { return _nodePath; } NodePath& getNodePath() { return _nodePath; }
@ -215,7 +215,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
/** Get the const NodePath from the top most node applied down /** Get the const NodePath from the top most node applied down
* to the current Node being visited.*/ * to the current Node being visited.*/
const NodePath& getNodePath() const { return _nodePath; } const NodePath& getNodePath() const { return _nodePath; }
/** Get the eye point in local coordinates. /** Get the eye point in local coordinates.
* Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.*/ * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.*/
virtual osg::Vec3 getEyePoint() const { return Vec3(0.0f,0.0f,0.0f); } virtual osg::Vec3 getEyePoint() const { return Vec3(0.0f,0.0f,0.0f); }
@ -238,13 +238,13 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
* Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.
* If the getDistanceToViewPoint(pos) is not implemented then a default value of 0.0 is returned.*/ * If the getDistanceToViewPoint(pos) is not implemented then a default value of 0.0 is returned.*/
virtual float getDistanceToViewPoint(const Vec3& /*pos*/, bool /*useLODScale*/) const { return 0.0f; } virtual float getDistanceToViewPoint(const Vec3& /*pos*/, bool /*useLODScale*/) const { return 0.0f; }
virtual void apply(Node& node); virtual void apply(Node& node);
virtual void apply(Geode& node); virtual void apply(Geode& node);
virtual void apply(Billboard& node); virtual void apply(Billboard& node);
virtual void apply(Group& node); virtual void apply(Group& node);
virtual void apply(ProxyNode& node); virtual void apply(ProxyNode& node);
@ -300,23 +300,23 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
class ImageRequestHandler : public osg::Referenced class ImageRequestHandler : public osg::Referenced
{ {
public: public:
ImageRequestHandler(): ImageRequestHandler():
Referenced(true) {} Referenced(true) {}
virtual double getPreLoadTime() const = 0; virtual double getPreLoadTime() const = 0;
virtual osg::Image* readImageFile(const std::string& fileName) = 0; virtual osg::Image* readImageFile(const std::string& fileName) = 0;
virtual void requestImageFile(const std::string& fileName,osg::Object* attachmentPoint, int attachmentIndex, double timeToMergeBy, const FrameStamp* framestamp) = 0; virtual void requestImageFile(const std::string& fileName,osg::Object* attachmentPoint, int attachmentIndex, double timeToMergeBy, const FrameStamp* framestamp) = 0;
protected: protected:
virtual ~ImageRequestHandler() {} virtual ~ImageRequestHandler() {}
}; };
/** Set the handler for image requests.*/ /** Set the handler for image requests.*/
void setImageRequestHandler(ImageRequestHandler* handler) { _imageRequestHandler = handler; } void setImageRequestHandler(ImageRequestHandler* handler) { _imageRequestHandler = handler; }
/** Get the handler for image requests.*/ /** Get the handler for image requests.*/
ImageRequestHandler* getImageRequestHandler() { return _imageRequestHandler.get(); } ImageRequestHandler* getImageRequestHandler() { return _imageRequestHandler.get(); }
@ -329,13 +329,13 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
VisitorType _visitorType; VisitorType _visitorType;
unsigned int _traversalNumber; unsigned int _traversalNumber;
ref_ptr<FrameStamp> _frameStamp; ref_ptr<FrameStamp> _frameStamp;
TraversalMode _traversalMode; TraversalMode _traversalMode;
Node::NodeMask _traversalMask; Node::NodeMask _traversalMask;
Node::NodeMask _nodeMaskOverride; Node::NodeMask _nodeMaskOverride;
NodePath _nodePath; NodePath _nodePath;
ref_ptr<Referenced> _userData; ref_ptr<Referenced> _userData;
@ -346,7 +346,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
}; };
/** Convenience functor for assisting visiting of arrays of osg::Node's.*/ /** Convenience functor for assisting visiting of arrays of osg::Node's.*/
class NodeAcceptOp class NodeAcceptOp
{ {
public: public:

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -57,7 +57,7 @@ extern OSG_EXPORT bool initNotifyLevel();
/** notify messaging function for providing fatal through to verbose /** notify messaging function for providing fatal through to verbose
* debugging messages. Level of messages sent to the console can * debugging messages. Level of messages sent to the console can
* be controlled by setting the NotifyLevel either within your * be controlled by setting the NotifyLevel either within your
* application or via the an environmental variable i.e. * application or via the an environmental variable i.e.
* - setenv OSGNOTIFYLEVEL DEBUG (for tsh) * - setenv OSGNOTIFYLEVEL DEBUG (for tsh)
* - export OSGNOTIFYLEVEL=DEBUG (for bourne shell) * - export OSGNOTIFYLEVEL=DEBUG (for bourne shell)
@ -66,10 +66,10 @@ extern OSG_EXPORT bool initNotifyLevel();
* All tell the osg to redirect all debugging and more important messages * All tell the osg to redirect all debugging and more important messages
* to the notification stream (useful for debugging) setting ALWAYS will force * to the notification stream (useful for debugging) setting ALWAYS will force
* all messages to be absorbed, which might be appropriate for final * all messages to be absorbed, which might be appropriate for final
* applications. Default NotifyLevel is NOTICE. Check the enum * applications. Default NotifyLevel is NOTICE. Check the enum
* #NotifySeverity for full range of possibilities. To use the notify * #NotifySeverity for full range of possibilities. To use the notify
* with your code simply use the notify function as a normal file * with your code simply use the notify function as a normal file
* stream (like std::cout) i.e * stream (like std::cout) i.e
* @code * @code
* osg::notify(osg::DEBUG) << "Hello Bugs!" << std::endl; * osg::notify(osg::DEBUG) << "Hello Bugs!" << std::endl;
* @endcode * @endcode
@ -88,15 +88,15 @@ inline std::ostream& notify(void) { return notify(osg::INFO); }
#define OSG_DEBUG OSG_NOTIFY(osg::DEBUG_INFO) #define OSG_DEBUG OSG_NOTIFY(osg::DEBUG_INFO)
#define OSG_DEBUG_FP OSG_NOTIFY(osg::DEBUG_FP) #define OSG_DEBUG_FP OSG_NOTIFY(osg::DEBUG_FP)
/** Handler processing output of notification stream. It acts as a sink to /** Handler processing output of notification stream. It acts as a sink to
* notification messages. It is called when notification stream needs to be * notification messages. It is called when notification stream needs to be
* synchronized (i.e. after osg::notify() << std::endl). * synchronized (i.e. after osg::notify() << std::endl).
* StandardNotifyHandler is used by default, it writes notifications to stderr * StandardNotifyHandler is used by default, it writes notifications to stderr
* (severity <= WARN) or stdout (severity > WARN). * (severity <= WARN) or stdout (severity > WARN).
* Notifications can be redirected to other sinks such as GUI widgets or * Notifications can be redirected to other sinks such as GUI widgets or
* windows debugger (WinDebugNotifyHandler) with custom handlers. * windows debugger (WinDebugNotifyHandler) with custom handlers.
* Use setNotifyHandler to set custom handler. * Use setNotifyHandler to set custom handler.
* Note that osg notification API is not thread safe although notification * Note that osg notification API is not thread safe although notification
* handler is called from many threads. When incorporating handlers into GUI * handler is called from many threads. When incorporating handlers into GUI
* widgets you must take care of thread safety on your own. * widgets you must take care of thread safety on your own.
* @see setNotifyHandler * @see setNotifyHandler
@ -128,7 +128,7 @@ public:
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(WIN32) && !defined(__CYGWIN__)
/** Redirects notification stream to windows debugger with use of /** Redirects notification stream to windows debugger with use of
* OuputDebugString functions. * OuputDebugString functions.
* @see setNotifyHandler * @see setNotifyHandler
*/ */

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -32,8 +32,8 @@ class UserDataContainer;
#define ADDQUOTES(def) _ADDQUOTES(def) #define ADDQUOTES(def) _ADDQUOTES(def)
/** META_Object macro define the standard clone, isSameKindAs and className methods. /** META_Object macro define the standard clone, isSameKindAs and className methods.
* Use when subclassing from Object to make it more convenient to define * Use when subclassing from Object to make it more convenient to define
* the standard pure virtual clone, isSameKindAs and className methods * the standard pure virtual clone, isSameKindAs and className methods
* which are required for all Object subclasses.*/ * which are required for all Object subclasses.*/
#define META_Object(library,name) \ #define META_Object(library,name) \
virtual osg::Object* cloneType() const { return new name (); } \ virtual osg::Object* cloneType() const { return new name (); } \
@ -42,7 +42,7 @@ class UserDataContainer;
virtual const char* libraryName() const { return #library; }\ virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; } virtual const char* className() const { return #name; }
/** Base class/standard interface for objects which require IO support, /** Base class/standard interface for objects which require IO support,
cloning and reference counting. cloning and reference counting.
Based on GOF Composite, Prototype and Template Method patterns. Based on GOF Composite, Prototype and Template Method patterns.
*/ */
@ -106,7 +106,7 @@ class OSG_EXPORT Object : public Referenced
STATIC, STATIC,
UNSPECIFIED UNSPECIFIED
}; };
/** Set the data variance of this object. /** Set the data variance of this object.
* Can be set to either STATIC for values that do not change over the lifetime of the object, * Can be set to either STATIC for values that do not change over the lifetime of the object,
* or DYNAMIC for values that vary over the lifetime of the object. The DataVariance value * or DYNAMIC for values that vary over the lifetime of the object. The DataVariance value
@ -116,7 +116,7 @@ class OSG_EXPORT Object : public Referenced
/** Get the data variance of this object.*/ /** Get the data variance of this object.*/
inline DataVariance getDataVariance() const { return _dataVariance; } inline DataVariance getDataVariance() const { return _dataVariance; }
/** Compute the DataVariance based on an assessment of callback etc.*/ /** Compute the DataVariance based on an assessment of callback etc.*/
virtual void computeDataVariance() {} virtual void computeDataVariance() {}
@ -137,7 +137,7 @@ class OSG_EXPORT Object : public Referenced
/** /**
* Set user data, data must be subclassed from Referenced to allow * Set user data, data must be subclassed from Referenced to allow
* automatic memory handling. If your own data isn't directly * automatic memory handling. If your own data isn't directly
* subclassed from Referenced then create an adapter object * subclassed from Referenced then create an adapter object
* which points to your own object and handles the memory addressing. * which points to your own object and handles the memory addressing.
*/ */
@ -148,7 +148,7 @@ class OSG_EXPORT Object : public Referenced
/** Get const user data.*/ /** Get const user data.*/
virtual const Referenced* getUserData() const; virtual const Referenced* getUserData() const;
/** Convinience method that casts the named UserObject to osg::TemplateValueObject<T> and gets the value. /** Convinience method that casts the named UserObject to osg::TemplateValueObject<T> and gets the value.
@ -162,7 +162,7 @@ class OSG_EXPORT Object : public Referenced
template<typename T> template<typename T>
void setUserValue(const std::string& name, const T& value); void setUserValue(const std::string& name, const T& value);
/** Resize any per context GLObject buffers to specified size. */ /** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {} virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
@ -182,7 +182,7 @@ class OSG_EXPORT Object : public Referenced
forcing all nodes to be created on the heap i.e Node* node forcing all nodes to be created on the heap i.e Node* node
= new Node().*/ = new Node().*/
virtual ~Object(); virtual ~Object();
std::string _name; std::string _name;
DataVariance _dataVariance; DataVariance _dataVariance;
@ -261,7 +261,7 @@ T* cloneType(const T* t)
return 0; return 0;
} }
} }
} }
#endif #endif

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -26,31 +26,31 @@ namespace osg {
class OSG_EXPORT OccluderNode : public Group class OSG_EXPORT OccluderNode : public Group
{ {
public : public :
OccluderNode(); OccluderNode();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
OccluderNode(const OccluderNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); OccluderNode(const OccluderNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, OccluderNode); META_Node(osg, OccluderNode);
/** Attach a ConvexPlanarOccluder to an OccluderNode.*/
/** Attach a ConvexPlanarOccluder to an OccluderNode.*/
void setOccluder(ConvexPlanarOccluder* occluder) { _occluder = occluder; } void setOccluder(ConvexPlanarOccluder* occluder) { _occluder = occluder; }
/** Get the ConvexPlanarOccluder* attached to a OccluderNode. */ /** Get the ConvexPlanarOccluder* attached to a OccluderNode. */
ConvexPlanarOccluder* getOccluder() { return _occluder.get(); } ConvexPlanarOccluder* getOccluder() { return _occluder.get(); }
/** Get the const ConvexPlanarOccluder* attached to a OccluderNode.*/ /** Get the const ConvexPlanarOccluder* attached to a OccluderNode.*/
const ConvexPlanarOccluder* getOccluder() const { return _occluder.get(); } const ConvexPlanarOccluder* getOccluder() const { return _occluder.get(); }
/** Overrides Group's computeBound.*/ /** Overrides Group's computeBound.*/
virtual BoundingSphere computeBound() const; virtual BoundingSphere computeBound() const;
protected : protected :
virtual ~OccluderNode() {} virtual ~OccluderNode() {}
ref_ptr<ConvexPlanarOccluder> _occluder; ref_ptr<ConvexPlanarOccluder> _occluder;
}; };

View File

@ -1,14 +1,14 @@
// //
// Copyright (C) 2007 Skew Matrix Software LLC (http://www.skew-matrix.com) // Copyright (C) 2007 Skew Matrix Software LLC (http://www.skew-matrix.com)
// //
// This library is open source and may be redistributed and/or modified under // 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 // 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 // (at your option) any later version. The full license is in LICENSE file
// included with this distribution, and on the openscenegraph.org website. // included with this distribution, and on the openscenegraph.org website.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // OpenSceneGraph Public License for more details.
// //
@ -75,11 +75,11 @@ public:
unsigned int getNumPixels( const osg::Camera* cam ); unsigned int getNumPixels( const osg::Camera* cam );
virtual void releaseGLObjects( osg::State* state = 0 ) const; virtual void releaseGLObjects( osg::State* state = 0 ) const;
static void deleteQueryObject( unsigned int contextID, GLuint handle ); static void deleteQueryObject( unsigned int contextID, GLuint handle );
static void flushDeletedQueryObjects( unsigned int contextID, double currentTime, double& availableTime ); static void flushDeletedQueryObjects( unsigned int contextID, double currentTime, double& availableTime );
static void discardDeletedQueryObjects( unsigned int contextID ); static void discardDeletedQueryObjects( unsigned int contextID );
protected: protected:
typedef std::map< const osg::Camera*, TestResult > ResultMap; typedef std::map< const osg::Camera*, TestResult > ResultMap;
mutable ResultMap _results; mutable ResultMap _results;
@ -107,8 +107,8 @@ public:
virtual osg::BoundingSphere computeBound() const; virtual osg::BoundingSphere computeBound() const;
virtual void releaseGLObjects( osg::State* state = 0 ) const; virtual void releaseGLObjects( osg::State* state = 0 ) const;
// When disabled, OQN doesn't perform occlusion queries, and simply // When disabled, OQN doesn't perform occlusion queries, and simply
// renders its children. // renders its children.
void setQueriesEnabled( bool enable=true ); void setQueriesEnabled( bool enable=true );
@ -153,8 +153,8 @@ public:
// For statistics gathering, e.g., by a NodeVisitor. // For statistics gathering, e.g., by a NodeVisitor.
bool getPassed() const; bool getPassed() const;
// These methods are public so that osgUtil::CullVisitor can access them. // These methods are public so that osgUtil::CullVisitor can access them.
// Not intended for application use. // Not intended for application use.
virtual bool getPassed( const osg::Camera* camera, osg::NodeVisitor& nv ); virtual bool getPassed( const osg::Camera* camera, osg::NodeVisitor& nv );

View File

@ -63,20 +63,20 @@ class Operation : virtual public Referenced
/** Get the human readable name of the operation.*/ /** Get the human readable name of the operation.*/
const std::string& getName() const { return _name; } const std::string& getName() const { return _name; }
/** Set whether the operation should be kept once its been applied.*/ /** Set whether the operation should be kept once its been applied.*/
void setKeep(bool keep) { _keep = keep; } void setKeep(bool keep) { _keep = keep; }
/** Get whether the operation should be kept once its been applied.*/ /** Get whether the operation should be kept once its been applied.*/
bool getKeep() const { return _keep; } bool getKeep() const { return _keep; }
/** if this operation is a barrier then release it.*/ /** if this operation is a barrier then release it.*/
virtual void release() {} virtual void release() {}
/** Do the actual task of this operation.*/ /** Do the actual task of this operation.*/
virtual void operator () (Object*) = 0; virtual void operator () (Object*) = 0;
protected: protected:
Operation(): Operation():
Referenced(true), Referenced(true),
_keep(false) {} _keep(false) {}
@ -97,23 +97,23 @@ class OperationThread;
class OSG_EXPORT OperationQueue : public Referenced class OSG_EXPORT OperationQueue : public Referenced
{ {
public: public:
OperationQueue(); OperationQueue();
/** Get the next operation from the operation queue. /** Get the next operation from the operation queue.
* Return null ref_ptr<> if no operations are left in queue. */ * Return null ref_ptr<> if no operations are left in queue. */
osg::ref_ptr<Operation> getNextOperation(bool blockIfEmpty = false); osg::ref_ptr<Operation> getNextOperation(bool blockIfEmpty = false);
/** Return true if the operation queue is empty. */ /** Return true if the operation queue is empty. */
bool empty(); bool empty();
/** Return the num of pending operations that are sitting in the OperationQueue.*/ /** Return the num of pending operations that are sitting in the OperationQueue.*/
unsigned int getNumOperationsInQueue(); unsigned int getNumOperationsInQueue();
/** Add operation to end of OperationQueue, this will be /** Add operation to end of OperationQueue, this will be
* executed by the operation thread once this operation gets to the head of the queue.*/ * executed by the operation thread once this operation gets to the head of the queue.*/
void add(Operation* operation); void add(Operation* operation);
/** Remove operation from OperationQueue.*/ /** Remove operation from OperationQueue.*/
void remove(Operation* operation); void remove(Operation* operation);
@ -122,18 +122,18 @@ class OSG_EXPORT OperationQueue : public Referenced
/** Remove all operations from OperationQueue.*/ /** Remove all operations from OperationQueue.*/
void removeAllOperations(); void removeAllOperations();
/** Run the operations. */ /** Run the operations. */
void runOperations(Object* callingObject=0); void runOperations(Object* callingObject=0);
/** Call release on all operations. */ /** Call release on all operations. */
void releaseAllOperations(); void releaseAllOperations();
/** Release operations block that is used to block threads that are waiting on an empty operations queue.*/ /** Release operations block that is used to block threads that are waiting on an empty operations queue.*/
void releaseOperationsBlock(); void releaseOperationsBlock();
typedef std::set<OperationThread*> OperationThreads; typedef std::set<OperationThread*> OperationThreads;
/** Get the set of OperationThreads that are sharing this OperationQueue. */ /** Get the set of OperationThreads that are sharing this OperationQueue. */
const OperationThreads& getOperationThreads() const { return _operationThreads; } const OperationThreads& getOperationThreads() const { return _operationThreads; }
@ -142,10 +142,10 @@ class OSG_EXPORT OperationQueue : public Referenced
virtual ~OperationQueue(); virtual ~OperationQueue();
friend class OperationThread; friend class OperationThread;
void addOperationThread(OperationThread* thread); void addOperationThread(OperationThread* thread);
void removeOperationThread(OperationThread* thread); void removeOperationThread(OperationThread* thread);
typedef std::list< osg::ref_ptr<Operation> > Operations; typedef std::list< osg::ref_ptr<Operation> > Operations;
OpenThreads::Mutex _operationsMutex; OpenThreads::Mutex _operationsMutex;
@ -165,7 +165,7 @@ class OSG_EXPORT OperationThread : public Referenced, public OpenThreads::Thread
void setParent(Object* parent) { _parent = parent; } void setParent(Object* parent) { _parent = parent; }
Object* getParent() { return _parent.get(); } Object* getParent() { return _parent.get(); }
const Object* getParent() const { return _parent.get(); } const Object* getParent() const { return _parent.get(); }
@ -178,11 +178,11 @@ class OSG_EXPORT OperationThread : public Referenced, public OpenThreads::Thread
/** Get the const OperationQueue. */ /** Get the const OperationQueue. */
const OperationQueue* getOperationQueue() const { return _operationQueue.get(); } const OperationQueue* getOperationQueue() const { return _operationQueue.get(); }
/** Add operation to end of OperationQueue, this will be /** Add operation to end of OperationQueue, this will be
* executed by the graphics thread once this operation gets to the head of the queue.*/ * executed by the graphics thread once this operation gets to the head of the queue.*/
void add(Operation* operation); void add(Operation* operation);
/** Remove operation from OperationQueue.*/ /** Remove operation from OperationQueue.*/
void remove(Operation* operation); void remove(Operation* operation);
@ -192,24 +192,24 @@ class OSG_EXPORT OperationThread : public Referenced, public OpenThreads::Thread
/** Remove all operations from OperationQueue.*/ /** Remove all operations from OperationQueue.*/
void removeAllOperations(); void removeAllOperations();
/** Get the operation currently being run.*/ /** Get the operation currently being run.*/
osg::ref_ptr<Operation> getCurrentOperation() { return _currentOperation; } osg::ref_ptr<Operation> getCurrentOperation() { return _currentOperation; }
/** Run does the opertion thread run loop.*/ /** Run does the opertion thread run loop.*/
virtual void run(); virtual void run();
void setDone(bool done); void setDone(bool done);
bool getDone() const { return _done; } bool getDone() const { return _done; }
/** Cancel this graphics thread.*/ /** Cancel this graphics thread.*/
virtual int cancel(); virtual int cancel();
protected: protected:
virtual ~OperationThread(); virtual ~OperationThread();
observer_ptr<Object> _parent; observer_ptr<Object> _parent;
bool _done; bool _done;

View File

@ -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 * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@ -23,18 +23,18 @@ namespace osg {
class OSG_EXPORT PagedLOD : public LOD class OSG_EXPORT PagedLOD : public LOD
{ {
public : public :
PagedLOD(); PagedLOD();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
PagedLOD(const PagedLOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); PagedLOD(const PagedLOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, PagedLOD); META_Node(osg, PagedLOD);
virtual void traverse(NodeVisitor& nv); virtual void traverse(NodeVisitor& nv);
virtual bool addChild(Node *child); virtual bool addChild(Node *child);
virtual bool addChild(Node *child, float min, float max); virtual bool addChild(Node *child, float min, float max);
@ -60,7 +60,7 @@ class OSG_EXPORT PagedLOD : public LOD
/** Get the database path used to prepend to children's filenames.*/ /** Get the database path used to prepend to children's filenames.*/
inline const std::string& getDatabasePath() const { return _databasePath; } inline const std::string& getDatabasePath() const { return _databasePath; }
struct OSG_EXPORT PerRangeData struct OSG_EXPORT PerRangeData
{ {
PerRangeData(); PerRangeData();
@ -79,7 +79,7 @@ class OSG_EXPORT PagedLOD : public LOD
}; };
typedef std::vector<PerRangeData> PerRangeDataList; typedef std::vector<PerRangeData> PerRangeDataList;
void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; } void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; }
const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; } const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; }
unsigned int getNumFileNames() const { return _perRangeDataList.size(); } unsigned int getNumFileNames() const { return _perRangeDataList.size(); }
@ -113,18 +113,18 @@ class OSG_EXPORT PagedLOD : public LOD
unsigned int getNumFrameNumbers() const { return _perRangeDataList.size(); } unsigned int getNumFrameNumbers() const { return _perRangeDataList.size(); }
/** Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests /** Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests
* being carried on behalf of the DatabasePager. * being carried on behalf of the DatabasePager.
* Note, in normal OSG usage you should not set this value yourself, as this will be managed by * Note, in normal OSG usage you should not set this value yourself, as this will be managed by
* the osgDB::DatabasePager.*/ * the osgDB::DatabasePager.*/
osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) { return _perRangeDataList[childNo]._databaseRequest; } osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) { return _perRangeDataList[childNo]._databaseRequest; }
/** Return the const DatabaseRequest object.*/ /** Return the const DatabaseRequest object.*/
const osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) const { return _perRangeDataList[childNo]._databaseRequest; } const osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) const { return _perRangeDataList[childNo]._databaseRequest; }
/** Set the frame number of the last time that this PageLOD node was traversed. /** Set the frame number of the last time that this PageLOD node was traversed.
* Note, this frame number is automatically set by the traverse() method for all traversals (update, cull etc.). * Note, this frame number is automatically set by the traverse() method for all traversals (update, cull etc.).
*/ */
inline void setFrameNumberOfLastTraversal(unsigned int frameNumber) { _frameNumberOfLastTraversal=frameNumber; } inline void setFrameNumberOfLastTraversal(unsigned int frameNumber) { _frameNumberOfLastTraversal=frameNumber; }
@ -150,11 +150,11 @@ class OSG_EXPORT PagedLOD : public LOD
* this allows the children to be deleted later at the caller's discretion. * this allows the children to be deleted later at the caller's discretion.
* Return true if children are removed, false otherwise. */ * Return true if children are removed, false otherwise. */
virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren); virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren);
protected : protected :
virtual ~PagedLOD(); virtual ~PagedLOD();
void expandPerRangeDataTo(unsigned int pos); void expandPerRangeDataTo(unsigned int pos);
ref_ptr<Referenced> _databaseOptions; ref_ptr<Referenced> _databaseOptions;

Some files were not shown because too many files have changed in this diff Show More