diff --git a/include/OpenThreads/Barrier b/include/OpenThreads/Barrier index 663d198f1..f15368dd3 100644 --- a/include/OpenThreads/Barrier +++ b/include/OpenThreads/Barrier @@ -1,13 +1,13 @@ /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -15,7 +15,7 @@ // // Barrier - C++ barrier class // ~~~~~~~ -// +// #ifndef _OPENTHREADS_BARRIER_ #define _OPENTHREADS_BARRIER_ @@ -66,12 +66,12 @@ public: /** * Return the number of threads currently blocked in the barrier, * Return -1 if error. - */ + */ virtual int numThreadsCurrentlyBlocked(); void invalidate(); - + private: /** diff --git a/include/OpenThreads/Block b/include/OpenThreads/Block index 0b821e4ed..380ed22fe 100644 --- a/include/OpenThreads/Block +++ b/include/OpenThreads/Block @@ -22,10 +22,10 @@ namespace OpenThreads { /** 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: - + Block(): _released(false) {} @@ -75,7 +75,7 @@ class Block ScopedLock mutlock(_mut); _released = false; } - + inline void set(bool doRelease) { 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.*/ -class BlockCount +class BlockCount { public: - + BlockCount(unsigned int blockCount): _blockCount(blockCount), _currentCount(0) {} @@ -132,7 +132,7 @@ class BlockCount if (_currentCount) _cond.wait(&_mut); } - + inline void reset() { OpenThreads::ScopedLock mutlock(_mut); @@ -154,9 +154,9 @@ class BlockCount } inline void setBlockCount(unsigned int blockCount) { _blockCount = blockCount; } - + inline unsigned int getBlockCount() const { return _blockCount; } - + inline unsigned int getCurrentCount() const { return _currentCount; } protected: @@ -167,7 +167,7 @@ class BlockCount unsigned int _currentCount; private: - + BlockCount(const BlockCount&) {} }; diff --git a/include/OpenThreads/Condition b/include/OpenThreads/Condition index 454c079d3..cf966358c 100644 --- a/include/OpenThreads/Condition +++ b/include/OpenThreads/Condition @@ -1,13 +1,13 @@ /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/OpenThreads/Exports b/include/OpenThreads/Exports index 2a5414424..9331f0ebe 100644 --- a/include/OpenThreads/Exports +++ b/include/OpenThreads/Exports @@ -1,13 +1,13 @@ /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,13 +25,13 @@ #define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllexport) #else #define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllimport) - + #if 0 // Commented out for now #ifdef _MSC_VER #ifdef _DEBUG #pragma comment(lib ,"OpenThreadsWin32d") - #else + #else #pragma comment(lib, "OpenThreadsWin32") #endif #endif diff --git a/include/OpenThreads/Mutex b/include/OpenThreads/Mutex index e13ad189f..b9e8b9c16 100644 --- a/include/OpenThreads/Mutex +++ b/include/OpenThreads/Mutex @@ -1,13 +1,13 @@ /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/OpenThreads/ReadWriteMutex b/include/OpenThreads/ReadWriteMutex index c78a651d6..a74c075c0 100644 --- a/include/OpenThreads/ReadWriteMutex +++ b/include/OpenThreads/ReadWriteMutex @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -22,12 +22,12 @@ namespace OpenThreads { class ReadWriteMutex { public: - + ReadWriteMutex(): _readCount(0) {} - + virtual ~ReadWriteMutex() {} - + virtual int readLock() { OpenThreads::ScopedLock lock(_readCountMutex); @@ -65,31 +65,31 @@ class ReadWriteMutex { return _readWriteMutex.unlock(); } - + protected: - + ReadWriteMutex(const ReadWriteMutex&) {} ReadWriteMutex& operator = (const ReadWriteMutex&) { return *(this); } #if 0 - ReentrantMutex _readWriteMutex; + ReentrantMutex _readWriteMutex; ReentrantMutex _readCountMutex; #else - OpenThreads::Mutex _readWriteMutex; + OpenThreads::Mutex _readWriteMutex; OpenThreads::Mutex _readCountMutex; -#endif +#endif unsigned int _readCount; - + }; class ScopedReadLock { public: - + ScopedReadLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.readLock(); } ~ScopedReadLock() { _mutex.readUnlock(); } - - protected: + + protected: ReadWriteMutex& _mutex; ScopedReadLock& operator = (const ScopedReadLock&) { return *this; } @@ -99,11 +99,11 @@ class ScopedReadLock class ScopedWriteLock { public: - + ScopedWriteLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.writeLock(); } ~ScopedWriteLock() { _mutex.writeUnlock(); } - - protected: + + protected: ReadWriteMutex& _mutex; ScopedWriteLock& operator = (const ScopedWriteLock&) { return *this; } diff --git a/include/OpenThreads/ReentrantMutex b/include/OpenThreads/ReentrantMutex index fdfefb32d..84f73157b 100644 --- a/include/OpenThreads/ReentrantMutex +++ b/include/OpenThreads/ReentrantMutex @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/OpenThreads/ScopedLock b/include/OpenThreads/ScopedLock index b665ecaa8..4176f3b1d 100644 --- a/include/OpenThreads/ScopedLock +++ b/include/OpenThreads/ScopedLock @@ -1,13 +1,13 @@ /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -15,7 +15,7 @@ // // ScopedLock and ReverseScopedLock templates // ~~~~~~~ -// +// #ifndef _ScopedLock_ #define _ScopedLock_ diff --git a/include/OpenThreads/Thread b/include/OpenThreads/Thread index 0297b9876..1c13aee72 100644 --- a/include/OpenThreads/Thread +++ b/include/OpenThreads/Thread @@ -1,13 +1,13 @@ /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ namespace OpenThreads { /** * 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(); @@ -37,7 +37,7 @@ extern OPENTHREAD_EXPORT_DIRECTIVE int GetNumberOfProcessors(); /** * 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); @@ -372,7 +372,7 @@ private: * Implementation-specific data */ void * _prvData; - + /** * Master thread's priority, set by Thread::Init. */ diff --git a/include/osg/AlphaFunc b/include/osg/AlphaFunc index c35dc3c91..f63f50f1f 100644 --- a/include/osg/AlphaFunc +++ b/include/osg/AlphaFunc @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,11 +23,11 @@ namespace osg { /** Encapsulates OpenGL glAlphaFunc. -*/ +*/ class OSG_EXPORT AlphaFunc : public StateAttribute { public : - + enum ComparisonFunction { NEVER = GL_NEVER, LESS = GL_LESS, @@ -41,7 +41,7 @@ class OSG_EXPORT AlphaFunc : public StateAttribute AlphaFunc(); - + AlphaFunc(ComparisonFunction func,float ref): _comparisonFunc(func), _referenceValue(ref) {} @@ -51,9 +51,9 @@ class OSG_EXPORT AlphaFunc : public StateAttribute StateAttribute(af,copyop), _comparisonFunc(af._comparisonFunc), _referenceValue(af._referenceValue) {} - + META_StateAttribute(osg, AlphaFunc,ALPHAFUNC); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -79,17 +79,17 @@ class OSG_EXPORT AlphaFunc : public StateAttribute _comparisonFunc = func; _referenceValue = ref; } - + inline void setFunction(ComparisonFunction func) { _comparisonFunc=func; } inline ComparisonFunction getFunction() const { return _comparisonFunc; } - + inline void setReferenceValue(float value) { _referenceValue=value; } inline float getReferenceValue() const { return _referenceValue; } - + virtual void apply(State& state) const; protected: - + virtual ~AlphaFunc(); ComparisonFunction _comparisonFunc; diff --git a/include/osg/AnimationPath b/include/osg/AnimationPath index 9062e3cd5..8207be38e 100644 --- a/include/osg/AnimationPath +++ b/include/osg/AnimationPath @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,7 +33,7 @@ namespace osg { class OSG_EXPORT AnimationPath : public virtual osg::Object { public: - + AnimationPath():_loopMode(LOOP) {} AnimationPath(const AnimationPath& ap, const CopyOp& copyop=CopyOp::SHALLOW_COPY): @@ -63,7 +63,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object _position(position), _rotation(rotation), _scale(scale) {} - + void setPosition(const osg::Vec3d& position) { _position = 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); _scale = first._scale*one_minus_ratio + second._scale*ratio; } - + inline void interpolate(double ratio,const ControlPoint& first, const ControlPoint& second) { double one_minus_ratio = 1.0f-ratio; @@ -124,7 +124,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object osg::Vec3d _scale; }; - + /** Given a specific time, return the transformation matrix for a point. */ bool getMatrix(double time,Matrixf& matrix) const @@ -152,7 +152,7 @@ class OSG_EXPORT AnimationPath : public virtual osg::Object cp.getInverse(matrix); return true; } - + bool getInverse(double time,Matrixd& matrix) const { 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. */ virtual bool getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const; - + /** Insert a control point into the AnimationPath.*/ void insert(double time,const ControlPoint& controlPoint); - + 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 getPeriod() const { return getLastTime()-getFirstTime();} - + enum LoopMode { SWING, LOOP, NO_LOOPING }; - + void setLoopMode(LoopMode lm) { _loopMode = lm; } - + LoopMode getLoopMode() const { return _loopMode; } typedef std::map TimeControlPointMap; - + void setTimeControlPointMap(TimeControlPointMap& tcpm) { _timeControlPointMap=tcpm; } TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; } - + const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; } - + bool empty() const { return _timeControlPointMap.empty(); } - + void clear() { _timeControlPointMap.clear(); } /** 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; protected: - + virtual ~AnimationPath() {} TimeControlPointMap _timeControlPointMap; @@ -240,7 +240,7 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback _pause(apc._pause), _pauseTime(apc._pauseTime) {} - + META_Object(osg,AnimationPathCallback); /** 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.*/ AnimationPathCallback(const osg::Vec3d& pivot,const osg::Vec3d& axis,float angularVelocity); - - + + void setAnimationPath(AnimationPath* path) { _animationPath = path; } AnimationPath* getAnimationPath() { 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; } double getTimeOffset() const { return _timeOffset; } - + void setTimeMultiplier(double multiplier) { _timeMultiplier = multiplier; } double getTimeMultiplier() const { return _timeMultiplier; } @@ -288,7 +288,7 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback /** Implements the callback. */ virtual void operator()(Node* node, NodeVisitor* nv); - + void update(osg::Node& node); public: @@ -304,7 +304,7 @@ class OSG_EXPORT AnimationPathCallback : public NodeCallback double _pauseTime; protected: - + ~AnimationPathCallback(){} }; diff --git a/include/osg/ApplicationUsage b/include/osg/ApplicationUsage index a035c919e..034efdcd0 100644 --- a/include/osg/ApplicationUsage +++ b/include/osg/ApplicationUsage @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ namespace osg { class OSG_EXPORT ApplicationUsage : public osg::Referenced { public: - + static ApplicationUsage* instance(); ApplicationUsage() {} @@ -33,7 +33,7 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced ApplicationUsage(const std::string& commandLineUsage); typedef std::map UsageMap; - + /** The ApplicationName is often displayed when logging errors, and frequently incorporated into the Description (below). */ void setApplicationName(const std::string& name) { _applicationName = name; } @@ -52,15 +52,15 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced KEYBOARD_MOUSE_BINDING = 0x4, HELP_ALL = KEYBOARD_MOUSE_BINDING|ENVIRONMENTAL_VARIABLE|COMMAND_LINE_OPTION }; - + void addUsageExplanation(Type type,const std::string& option,const std::string& explanation); - + void setCommandLineUsage(const std::string& explanation) { _commandLineUsage=explanation; } const std::string& getCommandLineUsage() const { return _commandLineUsage; } void addCommandLineOption(const std::string& option,const std::string& explanation, const std::string &defaultValue = ""); - + void setCommandLineOptions(const UsageMap& usageMap) { _commandLineOptions=usageMap; } 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 setEnvironmentalVariables(const UsageMap& usageMap) { _environmentalVariables=usageMap; } 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 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 writeEnvironmentSettings(std::ostream& output); protected: - + virtual ~ApplicationUsage() {} std::string _applicationName; @@ -103,11 +103,11 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced UsageMap _keyboardMouse; UsageMap _environmentalVariablesDefaults; UsageMap _commandLineOptionsDefaults; - + }; class ApplicationUsageProxy -{ +{ public: /** register an explanation of commandline/environmentvariable/keyboard mouse usage.*/ diff --git a/include/osg/ArgumentParser b/include/osg/ArgumentParser index e20bdee32..21b8ca33b 100644 --- a/include/osg/ArgumentParser +++ b/include/osg/ArgumentParser @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ class OSG_EXPORT ArgumentParser UNSIGNED_INT_PARAMETER, STRING_PARAMETER }; - + union ValueUnion { bool* _bool; @@ -54,13 +54,13 @@ class OSG_EXPORT ArgumentParser Parameter(bool& value) { _type = BOOL_PARAMETER; _value._bool = &value; } Parameter(float& value) { _type = FLOAT_PARAMETER; _value._float = &value; } - + Parameter(double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; } Parameter(int& value) { _type = INT_PARAMETER; _value._int = &value; } Parameter(unsigned int& value) { _type = UNSIGNED_INT_PARAMETER; _value._uint = &value; } - + Parameter(std::string& value) { _type = STRING_PARAMETER; _value._string = &value; } Parameter(const Parameter& param) { _type = param._type; _value = param._value; } @@ -71,7 +71,7 @@ class OSG_EXPORT ArgumentParser bool assign(const char* str); protected: - + ParameterType _type; ValueUnion _value; }; @@ -79,11 +79,11 @@ class OSG_EXPORT ArgumentParser /** Return true if the specified string is an option in the form * -option or --option. */ static bool isOption(const char* str); - + /** Return true if string is non-NULL and not an option in the form * -option or --option. */ static bool isString(const char* str); - + /** Return true if specified parameter is a number. */ 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 * -option or --option. */ bool isOption(int pos) const; - + /** Return true if the specified parameter is a string not in * the form of an option. */ bool isString(int pos) const; - + /** Return true if the specified parameter is a number. */ bool isNumber(int pos) const; - + bool containsOptions() const; /** Remove one or more arguments from the argv argument list, * and decrement the argc respectively. */ void remove(int pos,int num=1); - + /** Return true if the specified argument matches the given string. */ 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. */ void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN); - + /** Return the error message, if any has occurred. */ ErrorMessageMap& getErrorMessageMap() { return _errorMessageMap; } - + /** Return the error message, if any has occurred. */ const ErrorMessageMap& getErrorMessageMap() const { return _errorMessageMap; } /** Write error messages to the given ostream, if at or above the given severity. */ void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN); - + /** This convenience method handles help requests on the command line. * Return the type(s) of help requested. The return value of this * 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. */ ApplicationUsage::Type readHelpType(); - + protected: - + int* _argc; char** _argv; ErrorMessageMap _errorMessageMap; ref_ptr _usage; - + }; } diff --git a/include/osg/Array b/include/osg/Array index 47266df35..46e7464f5 100644 --- a/include/osg/Array +++ b/include/osg/Array @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -48,7 +48,7 @@ class OSG_EXPORT Array : public BufferData { public: - + enum Type { ArrayType = 0, @@ -73,7 +73,7 @@ class OSG_EXPORT Array : public BufferData Vec2dArrayType = 19, Vec3dArrayType = 20, Vec4dArrayType = 21, - MatrixArrayType = 22 + MatrixArrayType = 22 }; Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0): @@ -144,28 +144,28 @@ class TemplateArray : public Array, public MixinVector Array(ta,copyop), MixinVector(ta) {} - TemplateArray(unsigned int no) : + TemplateArray(unsigned int no) : Array(ARRAYTYPE,DataSize,DataType), MixinVector(no) {} - TemplateArray(unsigned int no,const T* ptr) : + TemplateArray(unsigned int no,const T* ptr) : Array(ARRAYTYPE,DataSize,DataType), MixinVector(ptr,ptr+no) {} template - TemplateArray(InputIterator first,InputIterator last) : + TemplateArray(InputIterator first,InputIterator last) : Array(ARRAYTYPE,DataSize,DataType), - MixinVector(first,last) {} + MixinVector(first,last) {} TemplateArray& operator = (const TemplateArray& array) { if (this==&array) return *this; this->assign(array.begin(),array.end()); return *this; - } + } 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(ConstArrayVisitor& av) const; @@ -195,7 +195,7 @@ class TemplateArray : public Array, public MixinVector typedef T ElementDataType; // expose T protected: - + virtual ~TemplateArray() {} }; @@ -230,28 +230,28 @@ class TemplateIndexArray : public IndexArray, public MixinVector IndexArray(ta,copyop), MixinVector(ta) {} - TemplateIndexArray(unsigned int no) : + TemplateIndexArray(unsigned int no) : IndexArray(ARRAYTYPE,DataSize,DataType), MixinVector(no) {} - TemplateIndexArray(unsigned int no,T* ptr) : + TemplateIndexArray(unsigned int no,T* ptr) : IndexArray(ARRAYTYPE,DataSize,DataType), MixinVector(ptr,ptr+no) {} template - TemplateIndexArray(InputIterator first,InputIterator last) : + TemplateIndexArray(InputIterator first,InputIterator last) : IndexArray(ARRAYTYPE,DataSize,DataType), - MixinVector(first,last) {} + MixinVector(first,last) {} TemplateIndexArray& operator = (const TemplateIndexArray& array) { if (this==&array) return *this; this->assign(array.begin(),array.end()); return *this; - } + } 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(ConstArrayVisitor& av) const; @@ -323,7 +323,7 @@ class ArrayVisitor public: ArrayVisitor() {} virtual ~ArrayVisitor() {} - + virtual void apply(Array&) {} virtual void apply(ByteArray&) {} virtual void apply(ShortArray&) {} @@ -337,12 +337,12 @@ class ArrayVisitor virtual void apply(Vec2Array&) {} virtual void apply(Vec3Array&) {} virtual void apply(Vec4Array&) {} - + virtual void apply(Vec4ubArray&) {} - virtual void apply(Vec2bArray&) {} - virtual void apply(Vec3bArray&) {} - virtual void apply(Vec4bArray&) {} + virtual void apply(Vec2bArray&) {} + virtual void apply(Vec3bArray&) {} + virtual void apply(Vec4bArray&) {} virtual void apply(Vec2sArray&) {} virtual void apply(Vec3sArray&) {} @@ -351,7 +351,7 @@ class ArrayVisitor virtual void apply(Vec2dArray&) {} virtual void apply(Vec3dArray&) {} virtual void apply(Vec4dArray&) {} - + virtual void apply(MatrixfArray&) {} }; @@ -360,7 +360,7 @@ class ConstArrayVisitor public: ConstArrayVisitor() {} virtual ~ConstArrayVisitor() {} - + virtual void apply(const Array&) {} virtual void apply(const ByteArray&) {} virtual void apply(const ShortArray&) {} @@ -377,9 +377,9 @@ class ConstArrayVisitor virtual void apply(const Vec4ubArray&) {} - virtual void apply(const Vec2bArray&) {} - virtual void apply(const Vec3bArray&) {} - virtual void apply(const Vec4bArray&) {} + virtual void apply(const Vec2bArray&) {} + virtual void apply(const Vec3bArray&) {} + virtual void apply(const Vec4bArray&) {} virtual void apply(const Vec2sArray&) {} virtual void apply(const Vec3sArray&) {} @@ -388,7 +388,7 @@ class ConstArrayVisitor virtual void apply(const Vec2dArray&) {} virtual void apply(const Vec3dArray&) {} virtual void apply(const Vec4dArray&) {} - + virtual void apply(const MatrixfArray&) {} }; @@ -398,7 +398,7 @@ class ValueVisitor public: ValueVisitor() {} virtual ~ValueVisitor() {} - + virtual void apply(GLbyte&) {} virtual void apply(GLshort&) {} virtual void apply(GLint&) {} @@ -407,17 +407,17 @@ class ValueVisitor virtual void apply(GLuint&) {} virtual void apply(GLfloat&) {} virtual void apply(GLdouble&) {} - - + + virtual void apply(Vec2&) {} virtual void apply(Vec3&) {} virtual void apply(Vec4&) {} - + virtual void apply(Vec4ub&) {} - virtual void apply(Vec2b&) {} - virtual void apply(Vec3b&) {} - virtual void apply(Vec4b&) {} + virtual void apply(Vec2b&) {} + virtual void apply(Vec3b&) {} + virtual void apply(Vec4b&) {} virtual void apply(Vec2s&) {} virtual void apply(Vec3s&) {} @@ -426,7 +426,7 @@ class ValueVisitor virtual void apply(Vec2d&) {} virtual void apply(Vec3d&) {} virtual void apply(Vec4d&) {} - + virtual void apply(Matrixf&) {} }; @@ -435,7 +435,7 @@ class ConstValueVisitor public: ConstValueVisitor() {} virtual ~ConstValueVisitor() {} - + virtual void apply(const GLbyte&) {} virtual void apply(const GLshort&) {} virtual void apply(const GLint&) {} @@ -453,16 +453,16 @@ class ConstValueVisitor virtual void apply(const Vec2b&) {} virtual void apply(const Vec3b&) {} - virtual void apply(const Vec4b&) {} - + virtual void apply(const Vec4b&) {} + virtual void apply(const Vec2s&) {} virtual void apply(const Vec3s&) {} virtual void apply(const Vec4s&) {} - + virtual void apply(const Vec2d&) {} virtual void apply(const Vec3d&) {} virtual void apply(const Vec4d&) {} - + virtual void apply(const Matrixf&) {} }; diff --git a/include/osg/ArrayDispatchers b/include/osg/ArrayDispatchers index d2c0505f1..4322fc8ba 100644 --- a/include/osg/ArrayDispatchers +++ b/include/osg/ArrayDispatchers @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/AudioStream b/include/osg/AudioStream index a9d5c124b..a13ac9daa 100644 --- a/include/osg/AudioStream +++ b/include/osg/AudioStream @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -63,9 +63,9 @@ class OSG_EXPORT AudioStream : public osg::Object virtual const char* className() const { return "AudioStream"; } virtual void setAudioSink(osg::AudioSink* audio_sink) = 0; - + virtual void consumeAudioBuffer(void * const buffer, const size_t size) = 0; - + virtual int audioFrequency() const = 0; virtual int audioNbChannels() const = 0; diff --git a/include/osg/Billboard b/include/osg/Billboard index dcec5d935..85fa6c9b1 100644 --- a/include/osg/Billboard +++ b/include/osg/Billboard @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ class OSG_EXPORT Billboard : public Geode }; Billboard(); - + /** Copy constructor using CopyOp to manage deep vs 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. */ typedef std::vector PositionList; - + /** Set the list of pivot point positions. */ inline void setPositionList(PositionList& pl) { _positionList=pl; } /** Get the list of pivot point positions. */ inline PositionList& getPositionList() { return _positionList; } - + /** Get a const list of pivot point positions. */ 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. * Otherwise, return false. */ virtual bool removeDrawable( Drawable *gset ); - + 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; Matrix _rotateNormalToZAxis; PositionList _positionList; - + // used internally as cache of which what _axis is aligned to help // decide which method of rotation to use. int _cachedMode; diff --git a/include/osg/BlendColor b/include/osg/BlendColor index 3670a6065..f3932bb09 100644 --- a/include/osg/BlendColor +++ b/include/osg/BlendColor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,16 +29,16 @@ class OSG_EXPORT BlendColor : public StateAttribute public : BlendColor(); - + BlendColor(const osg::Vec4& constantColor); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ BlendColor(const BlendColor& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(trans,copyop), _constantColor(trans._constantColor) {} META_StateAttribute(osg, BlendColor,BLENDCOLOR); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -71,34 +71,34 @@ class OSG_EXPORT BlendColor : public StateAttribute /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ class OSG_EXPORT Extensions : public osg::Referenced { public: Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setBlendColorSupported(bool flag) { _isBlendColorSupported=flag; } bool isBlendColorSupported() const { return _isBlendColorSupported; } - + void glBlendColor(GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha) const; protected: ~Extensions() {} - + typedef void (GL_APIENTRY * GLBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); bool _isBlendColorSupported; GLBlendColorProc _glBlendColor; }; - + /** Returns the Extensions object for the given context. * If createIfNotInitalized is true and the Extensions object doesn't * exist, getExtensions() creates it on the given context. diff --git a/include/osg/BlendEquation b/include/osg/BlendEquation index de4ab4fe9..d0da4b087 100644 --- a/include/osg/BlendEquation +++ b/include/osg/BlendEquation @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -53,7 +53,7 @@ class OSG_EXPORT BlendEquation : public StateAttribute }; BlendEquation(); - + BlendEquation(Equation equation); BlendEquation(Equation equationRGB, Equation equationAlpha); @@ -65,7 +65,7 @@ class OSG_EXPORT BlendEquation : public StateAttribute _equationAlpha(trans._equationAlpha){} META_StateAttribute(osg, BlendEquation,BLENDEQUATION); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -99,30 +99,30 @@ class OSG_EXPORT BlendEquation : public StateAttribute virtual void apply(State& state) const; /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ class OSG_EXPORT Extensions : public osg::Referenced { public: Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); bool isBlendEquationSupported() const { return _isBlendEquationSupported; } bool isBlendEquationSeparateSupported() const { return _isBlendEquationSeparateSupported; } bool isSGIXMinMaxSupported() const { return _isSGIXMinMaxSupported; } bool isLogicOpSupported() const { return _isLogicOpSupported; } - + void glBlendEquation(GLenum mode) const; void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) const; protected: ~Extensions() {} - + typedef void (GL_APIENTRY * GLBlendEquationProc)(GLenum mode); typedef void (GL_APIENTRY * GLBlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); @@ -130,11 +130,11 @@ class OSG_EXPORT BlendEquation : public StateAttribute bool _isBlendEquationSeparateSupported; bool _isSGIXMinMaxSupported; bool _isLogicOpSupported; - + GLBlendEquationProc _glBlendEquation; GLBlendEquationSeparateProc _glBlendEquationSeparate; }; - + /** Returns the Extensions object for the given context. * If createIfNotInitalized is true and the Extensions object doesn't * exist, getExtensions() creates it on the given context. diff --git a/include/osg/BlendFunc b/include/osg/BlendFunc index 4b75e310c..d2cb3d2a4 100644 --- a/include/osg/BlendFunc +++ b/include/osg/BlendFunc @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -68,7 +68,7 @@ class OSG_EXPORT BlendFunc : public StateAttribute public : BlendFunc(); - + BlendFunc(GLenum source, GLenum destination); 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) {} META_StateAttribute(osg, BlendFunc,BLENDFUNC); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ 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; } inline GLenum getSourceAlpha() const { return _source_factor_alpha; } - + void setDestination(GLenum destination) { _destination_factor = _destination_factor_alpha = destination; } inline GLenum getDestination() const { return _destination_factor; } @@ -159,7 +159,7 @@ class OSG_EXPORT BlendFunc : public StateAttribute virtual void apply(State& state) const; /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ class OSG_EXPORT Extensions : public osg::Referenced { public: diff --git a/include/osg/BoundingBox b/include/osg/BoundingBox index da52b10dd..4201d4047 100644 --- a/include/osg/BoundingBox +++ b/include/osg/BoundingBox @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,7 +35,7 @@ class BoundingBoxImpl public: typedef VT vec_type; typedef typename VT::value_type value_type; - + /** Minimum extent. (Smallest X, Y, and Z values of all coordinates.) */ vec_type _min; /** Maximum extent. (Greatest X, Y, and Z values of all coordinates.) */ @@ -50,7 +50,7 @@ class BoundingBoxImpl -FLT_MAX, -FLT_MAX) {} - + /** Creates a bounding box initialized to the given extents. */ inline BoundingBoxImpl(value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax) : @@ -58,7 +58,7 @@ class BoundingBoxImpl _max(xmax,ymax,zmax) {} /** 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), _max(max) {} @@ -72,8 +72,8 @@ class BoundingBoxImpl -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 { 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() const { return _min.x(); } - + inline value_type& yMin() { return _min.y(); } inline value_type yMin() const { return _min.y(); } - + inline value_type& zMin() { return _min.z(); } inline value_type zMin() const { return _min.z(); } inline value_type& xMax() { return _max.x(); } inline value_type xMax() const { return _max.x(); } - + inline value_type& yMax() { return _max.y(); } inline value_type yMax() const { return _max.y(); } - + inline value_type& zMax() { 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>_max.z()) _max.z() = sh._center.z()+sh._radius; } - + /** Returns the intersection of this bounding box and the specified bounding box. */ BoundingBoxImpl intersect(const BoundingBoxImpl& bb) const @@ -222,7 +222,7 @@ class BoundingBoxImpl /** Returns true if this bounding box contains the specified coordinate. */ inline bool contains(const vec_type& v) const { - return valid() && + return valid() && (v.x()>=_min.x() && v.x()<=_max.x()) && (v.y()>=_min.y() && v.y()<=_max.y()) && (v.z()>=_min.z() && v.z()<=_max.z()); diff --git a/include/osg/BoundingSphere b/include/osg/BoundingSphere index b24a011ff..722899759 100644 --- a/include/osg/BoundingSphere +++ b/include/osg/BoundingSphere @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,14 +35,14 @@ class BoundingSphereImpl { public: typedef VT vec_type; - typedef typename VT::value_type value_type; + typedef typename VT::value_type value_type; vec_type _center; 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) {} - + /** Creates a bounding sphere initialized to the given extents. */ BoundingSphereImpl(const vec_type& center, value_type radius) : _center(center),_radius(radius) {} @@ -63,7 +63,7 @@ class BoundingSphereImpl * otherwise. */ 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) { _center = center; @@ -72,7 +72,7 @@ class BoundingSphereImpl /** Returns the center of the bounding sphere. */ inline vec_type& center() { return _center; } - + /** Returns the const center of the bounding sphere. */ inline const vec_type& center() const { return _center; } @@ -80,7 +80,7 @@ class BoundingSphereImpl inline value_type& radius() { return _radius; } /** Returns the const radius of the bounding sphere. */ inline value_type radius() const { return _radius; } - + /** Returns the squared length of the radius. Note, For performance * reasons, the calling method is responsible for checking to make * sure the sphere is valid. */ @@ -130,7 +130,7 @@ class BoundingSphereImpl return valid() && bs.valid() && ((_center - bs._center).length2() <= (_radius + bs._radius)*(_radius + bs._radius)); } - + }; @@ -187,26 +187,26 @@ void BoundingSphereImpl::expandBy(const BoundingSphereImpl& sh) return; } - - - // Calculate d == The distance between the sphere centers + + + // Calculate d == The distance between the sphere centers double d = ( _center - sh.center() ).length(); // New sphere is already inside this one - if ( d + sh.radius() <= _radius ) + if ( d + sh.radius() <= _radius ) { return; } - // New sphere completely contains this one - if ( d + _radius <= sh.radius() ) + // New sphere completely contains this one + if ( d + _radius <= sh.radius() ) { _center = sh._center; _radius = sh._radius; return; } - + // Build a new sphere that completely contains the other two: // // The center point lies halfway along the line between the furthest @@ -243,7 +243,7 @@ void BoundingSphereImpl::expandRadiusBy(const BoundingSphereImpl& sh) } } -template +template void BoundingSphereImpl::expandBy(const BoundingBoxImpl& bb) { if (bb.valid()) @@ -260,10 +260,10 @@ void BoundingSphereImpl::expandBy(const BoundingBoxImpl& bb) v += _center; // move to absolute position. newbb.expandBy(v); // add it into the new bounding box. } - + _center = newbb.center(); _radius = newbb.radius(); - + } else { @@ -299,7 +299,7 @@ typedef BoundingSphereImpl BoundingSphered; #ifdef OSG_USE_FLOAT_BOUNDINGSPHERE typedef BoundingSpheref BoundingSphere; #else - typedef BoundingSphered BoundingSphere; + typedef BoundingSphered BoundingSphere; #endif } diff --git a/include/osg/BoundsChecking b/include/osg/BoundsChecking index d33cd038a..0afb3eaaf 100644 --- a/include/osg/BoundsChecking +++ b/include/osg/BoundsChecking @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -64,7 +64,7 @@ inline void clampBetweenRange(T& value,const T minValue,const T maxValue,const c notify(WARN) << "Warning: "< 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) - clampArrayElementBetweenRange(value,i,minValue,maxValue,valueName); + clampArrayElementBetweenRange(value,i,minValue,maxValue,valueName); } diff --git a/include/osg/BufferIndexBinding b/include/osg/BufferIndexBinding index c073ecd2e..544c0f9dc 100644 --- a/include/osg/BufferIndexBinding +++ b/include/osg/BufferIndexBinding @@ -1,14 +1,14 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * Copyright (C) 2010 Tim Moore * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -45,7 +45,7 @@ class OSG_EXPORT BufferIndexBinding : public StateAttribute // the State class. Using the index target, we can seperately // track the bindings for many different index targets. virtual unsigned getMember() const { return static_cast(_index); } - + GLenum getTarget() const { return _target; } /** Get the index target. */ diff --git a/include/osg/BufferObject b/include/osg/BufferObject index 4b9d5f3c6..9693efa71 100644 --- a/include/osg/BufferObject +++ b/include/osg/BufferObject @@ -4,7 +4,7 @@ * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -27,7 +27,7 @@ #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) - #define OPENGLES_1_1_FOUND 1 + #define OPENGLES_1_1_FOUND 1 #endif @@ -50,10 +50,10 @@ #ifndef GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object - + typedef GLintptr GLintptrARB; typedef GLsizeiptr GLsizeiptrARB; - + #define GL_ARRAY_BUFFER_ARB 0x8892 #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 #define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 @@ -114,7 +114,7 @@ #define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF #endif -namespace osg +namespace osg { class State; @@ -226,7 +226,7 @@ class OSG_EXPORT GLBufferObject : public Referenced inline void bindBuffer(); inline void unbindBuffer() - { + { _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. - * 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. - * 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 * only created with the graphics context associated with ContextID..*/ 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); META_Object(osg,ElementBufferObject); - + unsigned int addDrawElements(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; protected: - + virtual ~ElementBufferObject(); }; @@ -756,7 +756,7 @@ class OSG_EXPORT PixelBufferObject : public BufferObject bool isPBOSupported(unsigned int contextID) const { return _glBufferObjects[contextID]->isPBOSupported(); } protected: - + 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 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; } //! 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) virtual void bindBufferInWriteMode(State& state); - //! Unbind the buffer + //! Unbind the buffer virtual void unbindBuffer(unsigned int contextID) const; /** Resize any per context GLObject buffers to specified size. */ @@ -814,9 +814,9 @@ class OSG_EXPORT PixelDataBufferObject : public BufferObject virtual ~PixelDataBufferObject(); typedef osg::buffered_value ModeList; - + mutable ModeList _mode; - + }; class OSG_EXPORT UniformBufferObject : public BufferObject diff --git a/include/osg/Camera b/include/osg/Camera index 823b3a661..c12544f51 100644 --- a/include/osg/Camera +++ b/include/osg/Camera @@ -58,7 +58,7 @@ class OSG_EXPORT Camera : public Transform, public CullSettings 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. */ 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(); } - /** 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. */ 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 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 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. 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. Note that both values are ignored if not using FBO. @@ -460,13 +460,13 @@ class OSG_EXPORT Camera : public Transform, public CullSettings _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 reset, method returns nominal mask set by the Camera */ ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask(bool effectiveMask = false) const - { + { if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK ) { 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 reset, method returns nominal mask set by the Camera */ ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask(bool effectiveMask = false) const - { + { if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK ) { const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get(); diff --git a/include/osg/CameraNode b/include/osg/CameraNode index 676b84b80..7bd132de3 100644 --- a/include/osg/CameraNode +++ b/include/osg/CameraNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/CameraView b/include/osg/CameraView index 048394710..c97294b4d 100644 --- a/include/osg/CameraView +++ b/include/osg/CameraView @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -38,7 +38,7 @@ class OSG_EXPORT CameraView : public Transform _fieldOfView(pat._fieldOfView), _fieldOfViewMode(pat._fieldOfViewMode), _focalLength(pat._focalLength) {} - + META_Node(osg, CameraView); @@ -62,7 +62,7 @@ class OSG_EXPORT CameraView : public Transform /** Get the field of view.*/ inline double getFieldOfView() const { return _fieldOfView; } - + enum FieldOfViewMode { UNCONSTRAINED, @@ -83,14 +83,14 @@ class OSG_EXPORT CameraView : public Transform /** Get the focal length of the camera.*/ inline double getFocalLength() const { return _focalLength; } - + virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const; virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; protected : - + virtual ~CameraView() {} Vec3d _position; diff --git a/include/osg/ClampColor b/include/osg/ClampColor index b817f4fbc..e1882ebc1 100644 --- a/include/osg/ClampColor +++ b/include/osg/ClampColor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -44,7 +44,7 @@ class OSG_EXPORT ClampColor : public StateAttribute public : ClampColor(); - + ClampColor(GLenum vertexMode, GLenum fragmentMode, GLenum readMode); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ @@ -55,7 +55,7 @@ class OSG_EXPORT ClampColor : public StateAttribute _clampReadColor(rhs._clampReadColor) {} META_StateAttribute(osg, ClampColor,CLAMPCOLOR); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -80,37 +80,37 @@ class OSG_EXPORT ClampColor : public StateAttribute void setClampReadColor(GLenum mode) { _clampReadColor = mode; } GLenum getClampReadColor() const { return _clampReadColor; } - + virtual void apply(State& state) const; /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ class OSG_EXPORT Extensions : public osg::Referenced { public: Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setClampColorSupported(bool flag) { _isClampColorSupported=flag; } bool isClampColorSupported() const { return _isClampColorSupported; } - + void glClampColor(GLenum target, GLenum mode) const; protected: ~Extensions() {} - + typedef void (GL_APIENTRY * GLClampColorProc) (GLenum target, GLenum mode); bool _isClampColorSupported; GLClampColorProc _glClampColor; }; - + /** Returns the Extensions object for the given context. * If createIfNotInitalized is true and the Extensions object doesn't * exist, getExtensions() creates it on the given context. diff --git a/include/osg/ClearNode b/include/osg/ClearNode index a2e3e31b0..6da81885a 100644 --- a/include/osg/ClearNode +++ b/include/osg/ClearNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,14 +30,14 @@ namespace osg { class OSG_EXPORT ClearNode : public Group { public : - + ClearNode(); ClearNode(const ClearNode& cs, const CopyOp& copyop=CopyOp::SHALLOW_COPY): Group(cs,copyop), _requiresClear(cs._requiresClear), _clearColor(cs._clearColor), - _clearMask(cs._clearMask) {} + _clearMask(cs._clearMask) {} META_Node(osg, ClearNode); @@ -53,7 +53,7 @@ class OSG_EXPORT ClearNode : public Group /** Returns the clear color. */ inline const Vec4& getClearColor() const { return _clearColor; } - + /** Set the clear mask used in glClear(..). * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */ inline void setClearMask(GLbitfield mask) { _clearMask = mask; } @@ -62,9 +62,9 @@ class OSG_EXPORT ClearNode : public Group inline GLbitfield getClearMask() const { return _clearMask; } protected : - + virtual ~ClearNode() {} - + bool _requiresClear; Vec4 _clearColor; GLbitfield _clearMask; diff --git a/include/osg/ClipNode b/include/osg/ClipNode index d66cd348e..a300e5438 100644 --- a/include/osg/ClipNode +++ b/include/osg/ClipNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,13 +33,13 @@ class OSG_EXPORT ClipNode : public Group ClipNode(const ClipNode& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Node(osg, ClipNode); - + enum ReferenceFrame { RELATIVE_RF, ABSOLUTE_RF }; - + /** Set the ClipNode's ReferenceFrame, either to be relative to its * parent reference frame, or relative to an absolute coordinate * frame. RELATIVE_RF is the default. @@ -52,7 +52,7 @@ class OSG_EXPORT ClipNode : public Group * absolute ClipNode at the top of the scene. */ void setReferenceFrame(ReferenceFrame rf); - + ReferenceFrame getReferenceFrame() const { return _referenceFrame; } @@ -104,7 +104,7 @@ class OSG_EXPORT ClipNode : public Group StateAttribute::GLModeValue _value; ClipPlaneList _planes; - + ReferenceFrame _referenceFrame; }; diff --git a/include/osg/ClipPlane b/include/osg/ClipPlane index 0913039b7..52f2a7816 100644 --- a/include/osg/ClipPlane +++ b/include/osg/ClipPlane @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -51,14 +51,14 @@ class OSG_EXPORT ClipPlane : public StateAttribute _clipPlane[3]=cp._clipPlane[3]; _clipPlaneNum=cp._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 bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "ClipPlane"; } virtual Type getType() const { return CLIPPLANE; } - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ 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. */ - void setClipPlane(const Plane& plane) + void setClipPlane(const Plane& plane) { _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; protected : - + virtual ~ClipPlane(); - + Vec4d _clipPlane; unsigned int _clipPlaneNum; diff --git a/include/osg/ClusterCullingCallback b/include/osg/ClusterCullingCallback index 9aa8a9590..339fcdc31 100644 --- a/include/osg/ClusterCullingCallback +++ b/include/osg/ClusterCullingCallback @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ class OSG_EXPORT ClusterCullingCallback : public Drawable::CullCallback, public /** Computes the control point, normal, and deviation from the * given drawable contents. */ void computeFrom(const osg::Drawable* drawable); - + /** Transform the ClusterCullingCallback's positional members to a new coordinate frame.*/ void transform(const osg::Matrixd& matrix); diff --git a/include/osg/CollectOccludersVisitor b/include/osg/CollectOccludersVisitor index b0491318f..de50e1338 100644 --- a/include/osg/CollectOccludersVisitor +++ b/include/osg/CollectOccludersVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -39,7 +39,7 @@ class OSG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg:: virtual float getDistanceToEyePoint(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 void apply(osg::Node&); @@ -81,7 +81,7 @@ class OSG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg:: /** Prevents unwanted copy operator. */ CollectOccludersVisitor& operator = (const CollectOccludersVisitor&) { return *this; } - + inline void handle_cull_callbacks_and_traverse(osg::Node& node) { /*osg::NodeCallback* callback = node.getCullCallback(); diff --git a/include/osg/ColorMask b/include/osg/ColorMask index 48ac2eb53..b1cc17261 100644 --- a/include/osg/ColorMask +++ b/include/osg/ColorMask @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,12 +20,12 @@ namespace osg { /** Encapsulates OpenGL glColorMaskFunc/Op/Mask functions. -*/ +*/ class OSG_EXPORT ColorMask : public StateAttribute { public : - - + + ColorMask(); ColorMask(bool red,bool green,bool blue,bool alpha): @@ -33,7 +33,7 @@ class OSG_EXPORT ColorMask : public StateAttribute _green(green), _blue(blue), _alpha(alpha) {} - + /** Copy constructor using CopyOp to manage deep vs 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), _blue(cm._blue), _alpha(cm._alpha) {} - + META_StateAttribute(osg, ColorMask, COLORMASK); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -67,9 +67,9 @@ class OSG_EXPORT ColorMask : public StateAttribute _green = green; _blue = blue; _alpha = alpha; - + } - + inline void setRedMask(bool mask) { _red=mask; } inline bool getRedMask() const { return _red; } @@ -78,14 +78,14 @@ class OSG_EXPORT ColorMask : public StateAttribute inline void setBlueMask(bool mask) { _blue=mask; } inline bool getBlueMask() const { return _blue; } - + inline void setAlphaMask(bool mask) { _alpha=mask; } inline bool getAlphaMask() const { return _alpha; } virtual void apply(State& state) const; protected: - + virtual ~ColorMask(); bool _red; diff --git a/include/osg/ColorMatrix b/include/osg/ColorMatrix index 169419c01..db7afd723 100644 --- a/include/osg/ColorMatrix +++ b/include/osg/ColorMatrix @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,7 +23,7 @@ namespace osg { class OSG_EXPORT ColorMatrix : public StateAttribute { public : - + ColorMatrix(); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ @@ -32,7 +32,7 @@ class OSG_EXPORT ColorMatrix : public StateAttribute _matrix(cm._matrix) {} META_StateAttribute(osg, ColorMatrix, COLORMATRIX); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { diff --git a/include/osg/ComputeBoundsVisitor b/include/osg/ComputeBoundsVisitor index 320870ff1..da61f0afe 100644 --- a/include/osg/ComputeBoundsVisitor +++ b/include/osg/ComputeBoundsVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,31 +25,31 @@ class OSG_EXPORT ComputeBoundsVisitor : public osg::NodeVisitor public: ComputeBoundsVisitor(TraversalMode traversalMode = TRAVERSE_ALL_CHILDREN); - + META_NodeVisitor("osg","ComputeBoundsVisitor") virtual void reset(); - + osg::BoundingBox& getBoundingBox() { return _bb; } void getPolytope(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::Transform& transform); - + void apply(osg::Geode& geode); - + inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); } - + inline void popMatrix() { _matrixStack.pop_back(); } void applyDrawable(osg::Drawable* drawable); - + protected: - + typedef std::vector MatrixStack; MatrixStack _matrixStack; diff --git a/include/osg/ConvexPlanarOccluder b/include/osg/ConvexPlanarOccluder index 397eb40a1..ac7153937 100644 --- a/include/osg/ConvexPlanarOccluder +++ b/include/osg/ConvexPlanarOccluder @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,25 +32,25 @@ class OSG_EXPORT ConvexPlanarOccluder : public Object Object(cpo,copyop), _occluder(cpo._occluder), _holeList(cpo._holeList) {} - + META_Object(osg,ConvexPlanarOccluder); void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; } - + ConvexPlanarPolygon& getOccluder() { return _occluder; } - + const ConvexPlanarPolygon& getOccluder() const { return _occluder; } - - + + typedef std::vector HoleList; void addHole(const ConvexPlanarPolygon& cpp) { _holeList.push_back(cpp); } void setHoleList(const HoleList& holeList) { _holeList=holeList; } - + HoleList& getHoleList() { return _holeList; } - + const HoleList& getHoleList() const { return _holeList; } protected: @@ -64,4 +64,4 @@ class OSG_EXPORT ConvexPlanarOccluder : public Object } // end of namespace -#endif +#endif diff --git a/include/osg/ConvexPlanarPolygon b/include/osg/ConvexPlanarPolygon index 8c4546b8b..64efcc892 100644 --- a/include/osg/ConvexPlanarPolygon +++ b/include/osg/ConvexPlanarPolygon @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -27,17 +27,17 @@ class OSG_EXPORT ConvexPlanarPolygon public: ConvexPlanarPolygon(); - + typedef std::vector VertexList; void add(const Vec3& v) { _vertexList.push_back(v); } - + void setVertexList(const VertexList& vertexList) { _vertexList=vertexList; } VertexList& getVertexList() { return _vertexList; } - + const VertexList& getVertexList() const { return _vertexList; } - + protected: VertexList _vertexList; @@ -46,4 +46,4 @@ class OSG_EXPORT ConvexPlanarPolygon } // end of namespace -#endif +#endif diff --git a/include/osg/CoordinateSystemNode b/include/osg/CoordinateSystemNode index 4235ffe30..38d7df9b7 100644 --- a/include/osg/CoordinateSystemNode +++ b/include/osg/CoordinateSystemNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,7 +24,7 @@ const double WGS_84_RADIUS_EQUATOR = 6378137.0; const double WGS_84_RADIUS_POLAR = 6356752.3142; /** 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, * and latitude and longitude are in radians.*/ 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; /** 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.*/ CoordinateSystemNode(const CoordinateSystemNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + 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.*/ void set(const CoordinateSystemNode& csn); - + /** Set the coordinate system format string. Typical values would be WKT, PROJ4, USGS etc.*/ void setFormat(const std::string& format) { _format = format; } - + /** Get the coordinate system format string.*/ const std::string& getFormat() const { return _format; } /** Set the CoordinateSystem reference string, should be stored in a form consistent with the Format.*/ void setCoordinateSystem(const std::string& cs) { _cs = cs; } - + /** Get the CoordinateSystem reference string.*/ 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. */ void setEllipsoidModel(EllipsoidModel* ellipsode) { _ellipsoidModel = ellipsode; } - + /** Get the EllipsoidModel.*/ EllipsoidModel* getEllipsoidModel() { return _ellipsoidModel.get(); } - + /** Get the const EllipsoidModel.*/ const EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); } - + /** Compute the local coordinate frame for specified point.*/ CoordinateFrame computeLocalCoordinateFrame(const Vec3d& position) const; - + /** Compute the local up-vector for specified point.*/ osg::Vec3d computeLocalUpVector(const Vec3d& position) const; protected: virtual ~CoordinateSystemNode() {} - + std::string _format; std::string _cs; ref_ptr _ellipsoidModel; diff --git a/include/osg/CopyOp b/include/osg/CopyOp index 129225b9e..096e0c526 100644 --- a/include/osg/CopyOp +++ b/include/osg/CopyOp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ class OSG_EXPORT CopyOp { public: - + enum Options { SHALLOW_COPY = 0, @@ -84,7 +84,7 @@ class OSG_EXPORT CopyOp virtual StateAttributeCallback* operator() (const StateAttributeCallback* stateattributecallback) const; protected: - + CopyFlags _flags; }; diff --git a/include/osg/CullFace b/include/osg/CullFace index 647ce2056..6c544744a 100644 --- a/include/osg/CullFace +++ b/include/osg/CullFace @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,17 +20,17 @@ namespace osg { /** Class to globally enable/disable OpenGL's polygon culling mode. - */ + */ class OSG_EXPORT CullFace : public StateAttribute { public : - + enum Mode { FRONT = GL_FRONT, BACK = GL_BACK, FRONT_AND_BACK = GL_FRONT_AND_BACK }; - + CullFace(Mode mode=BACK): _mode(mode) {} @@ -40,7 +40,7 @@ class OSG_EXPORT CullFace : public StateAttribute _mode(cf._mode) {} META_StateAttribute(osg, CullFace, CULLFACE); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ 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 Mode getMode() const { return _mode; } - + virtual void apply(State& state) const; - + protected: - + virtual ~CullFace(); - + Mode _mode; }; diff --git a/include/osg/CullSettings b/include/osg/CullSettings index 38f2dc5c5..b7a7e1695 100644 --- a/include/osg/CullSettings +++ b/include/osg/CullSettings @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -44,7 +44,7 @@ class OSG_EXPORT CullSettings CullSettings(const CullSettings& cs); virtual ~CullSettings() {} - + CullSettings& operator = (const CullSettings& settings) { if (this==&settings) return *this; @@ -55,7 +55,7 @@ class OSG_EXPORT CullSettings virtual void setDefaults(); - + enum VariablesMask { 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.*/ InheritanceMask getInheritanceMask() const { return _inheritanceMask; } - + /** Set the local cull settings values from specified CullSettings object.*/ void setCullSettings(const CullSettings& settings); @@ -111,7 +111,7 @@ class OSG_EXPORT CullSettings DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT, DO_NOT_MODIFY_INHERITANCE_MASK }; - + void setInheritanceMaskActionOnAttributeSetting(InheritanceMaskActionOnAttributeSetting action) { _inheritanceMaskActionOnAttributeSetting = action; } InheritanceMaskActionOnAttributeSetting getInheritanceMaskActionOnAttributeSetting() const { return _inheritanceMaskActionOnAttributeSetting; } @@ -165,8 +165,8 @@ class OSG_EXPORT CullSettings COMPUTE_NEAR_USING_PRIMITIVES }; - void setComputeNearFarMode(ComputeNearFarMode cnfm) { _computeNearFar=cnfm; applyMaskAction(COMPUTE_NEAR_FAR_MODE); } - ComputeNearFarMode getComputeNearFarMode() const { return _computeNearFar;} + void setComputeNearFarMode(ComputeNearFarMode cnfm) { _computeNearFar=cnfm; applyMaskAction(COMPUTE_NEAR_FAR_MODE); } + ComputeNearFarMode getComputeNearFarMode() const { return _computeNearFar;} void setNearFarRatio(double ratio) { _nearFarRatio = ratio; applyMaskAction(NEAR_FAR_RATIO); } double getNearFarRatio() const { return _nearFarRatio; } @@ -192,12 +192,12 @@ class OSG_EXPORT CullSettings SHADOW_OCCLUSION_CULLING| CLUSTER_CULLING }; - + typedef int CullingMode; /** Set the culling mode for the CullVisitor to use.*/ void setCullingMode(CullingMode mode) { _cullingMode = mode; applyMaskAction(CULLING_MODE); } - + /** Returns the current CullingMode.*/ CullingMode getCullingMode() const { return _cullingMode; } @@ -213,7 +213,7 @@ class OSG_EXPORT CullSettings /** Set the LOD bias for the CullVisitor to use.*/ void setLODScale(float scale) { _LODScale = scale; applyMaskAction(LOD_SCALE); } - + /** Get the LOD bias.*/ 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::Matrixd& projection, double& znear, double& zfar) const = 0; }; - + /** set the ClampProjectionMatrixCallback.*/ void setClampProjectionMatrixCallback(ClampProjectionMatrixCallback* cpmc) { _clampProjectionMatrixCallback = cpmc; applyMaskAction(CLAMP_PROJECTION_MATRIX_CALLBACK); } /** get the non const ClampProjectionMatrixCallback.*/ @@ -261,12 +261,12 @@ class OSG_EXPORT CullSettings bool _impostorActive; bool _depthSortImpostorSprites; float _impostorPixelErrorThreshold; - int _numFramesToKeepImpostorSprites; + int _numFramesToKeepImpostorSprites; Node::NodeMask _cullMask; Node::NodeMask _cullMaskLeft; Node::NodeMask _cullMaskRight; - + }; diff --git a/include/osg/CullStack b/include/osg/CullStack index 04ec4873a..fbb9bf375 100644 --- a/include/osg/CullStack +++ b/include/osg/CullStack @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,17 +28,17 @@ class OSG_EXPORT CullStack : public osg::CullSettings { public: - - + + CullStack(); CullStack(const CullStack& cs); - + ~CullStack(); - + typedef std::vector OccluderList; void reset(); - + void pushCullingSet(); void popCullingSet(); @@ -63,7 +63,7 @@ class OSG_EXPORT CullStack : public osg::CullSettings { return getCurrentCullingSet().pixelSize(v,radius); } - + /** Compute the pixel size of the bounding sphere.*/ float pixelSize(const BoundingSphere& bs) const { @@ -75,7 +75,7 @@ class OSG_EXPORT CullStack : public osg::CullSettings { return getCurrentCullingSet().clampedPixelSize(v,radius); } - + /** Compute the pixel size of the bounding sphere. fabs()ed to always be positive. */ float clampedPixelSize(const BoundingSphere& bs) const { @@ -101,12 +101,12 @@ class OSG_EXPORT CullStack : public osg::CullSettings { return bb.valid() && getCurrentCullingSet().isCulled(bb); } - + inline bool isCulled(const BoundingSphere& bs) { return getCurrentCullingSet().isCulled(bs); } - + inline bool isCulled(const osg::Node& node) { return node.isCullingActive() && getCurrentCullingSet().isCulled(node.getBound()); @@ -116,30 +116,30 @@ class OSG_EXPORT CullStack : public osg::CullSettings { getCurrentCullingSet().pushCurrentMask(); } - + inline void popCurrentMask() { getCurrentCullingSet().popCurrentMask(); } - - + + typedef std::vector< CullingSet > CullingStack; inline CullingStack& getClipSpaceCullingStack() { return _clipspaceCullingStack; } - + inline CullingStack& getProjectionCullingStack() { return _projectionCullingStack; } - + inline CullingStack& getModelViewCullingStack() { return _modelviewCullingStack; } - + inline CullingSet& getCurrentCullingSet() { return *_back_modelviewCullingStack; } inline const CullingSet& getCurrentCullingSet() const { return *_back_modelviewCullingStack; } - + inline osg::Viewport* getViewport(); inline osg::RefMatrix* getModelViewMatrix(); inline osg::RefMatrix* getProjectionMatrix(); inline osg::Matrix getWindowMatrix(); inline const osg::RefMatrix* getMVPW(); - + inline const osg::Vec3& getReferenceViewPoint() const { return _referenceViewPoints.back(); } inline void pushReferenceViewPoint(const osg::Vec3& viewPoint) { _referenceViewPoints.push_back(viewPoint); } inline void popReferenceViewPoint() { _referenceViewPoints.pop_back(); } @@ -159,10 +159,10 @@ class OSG_EXPORT CullStack : public osg::CullSettings const osg::Matrix& matrix = *_modelviewStack.back(); return osg::Vec3(-matrix(0,2),-matrix(1,2),-matrix(2,2)); } - + protected: - + // base set of shadow volume occluder to use in culling. ShadowVolumeOccluderList _occluderList; @@ -175,7 +175,7 @@ class OSG_EXPORT CullStack : public osg::CullSettings typedef fast_back_stack > ViewportStack; ViewportStack _viewportStack; - + typedef fast_back_stack EyePointStack; EyePointStack _referenceViewPoints; EyePointStack _eyePointStack; @@ -195,14 +195,14 @@ class OSG_EXPORT CullStack : public osg::CullSettings unsigned int _bbCornerFar; ref_ptr _identity; - + typedef std::vector< osg::ref_ptr > MatrixList; MatrixList _reuseMatrixList; unsigned int _currentReuseMatrixIndex; - + inline osg::RefMatrix* createOrReuseMatrix(const osg::Matrix& value); - + }; inline osg::Viewport* CullStack::getViewport() @@ -275,7 +275,7 @@ inline const osg::RefMatrix* CullStack::getMVPW() inline RefMatrix* CullStack::createOrReuseMatrix(const osg::Matrix& value) { // skip of any already reused matrix. - while (_currentReuseMatrixIndex<_reuseMatrixList.size() && + while (_currentReuseMatrixIndex<_reuseMatrixList.size() && _reuseMatrixList[_currentReuseMatrixIndex]->referenceCount()>1) { ++_currentReuseMatrixIndex; @@ -299,4 +299,4 @@ inline RefMatrix* CullStack::createOrReuseMatrix(const osg::Matrix& value) } // end of namespace -#endif +#endif diff --git a/include/osg/CullingSet b/include/osg/CullingSet index 549237e3e..7847f0801 100644 --- a/include/osg/CullingSet +++ b/include/osg/CullingSet @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,8 +32,8 @@ class OSG_EXPORT CullingSet : public Referenced public: typedef std::pair< osg::ref_ptr, osg::Polytope > StateFrustumPair; - typedef std::vector< StateFrustumPair > StateFrustumList; - + typedef std::vector< StateFrustumPair > StateFrustumList; + CullingSet(); CullingSet(const CullingSet& cs): @@ -63,18 +63,18 @@ class OSG_EXPORT CullingSet : public Referenced itr->transformProvidingInverse(matrix); } } - + CullingSet& operator = (const CullingSet& cs) { if (this==&cs) return *this; - + _mask = cs._mask; _frustum = cs._frustum; _stateFrustumList = cs._stateFrustumList; _occluderList = cs._occluderList; _pixelSizeVector = cs._pixelSizeVector; _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; - + return *this; } @@ -88,7 +88,7 @@ class OSG_EXPORT CullingSet : public Referenced _pixelSizeVector = cs._pixelSizeVector; _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; } - + inline void set(const CullingSet& cs,const Matrix& matrix, const Vec4& pixelSizeVector) { _mask = cs._mask; @@ -99,9 +99,9 @@ class OSG_EXPORT CullingSet : public Referenced //_frustum = cs._frustum; //_frustum.transformProvidingInverse(matrix); - + _frustum.setAndTransformProvidingInverse(cs._frustum,matrix); - + for(StateFrustumList::iterator sitr=_stateFrustumList.begin(); sitr!=_stateFrustumList.end(); ++sitr) @@ -115,9 +115,9 @@ class OSG_EXPORT CullingSet : public Referenced { oitr->transformProvidingInverse(matrix); } - + } - + typedef std::vector OccluderList; typedef int Mask; @@ -147,10 +147,10 @@ class OSG_EXPORT CullingSet : public Referenced void setFrustum(Polytope& cv) { _frustum = cv; } 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 getStateFrustumList(StateFrustumList& sfl) { _stateFrustumList = sfl; } StateFrustumList& getStateFrustumList() { return _stateFrustumList; } @@ -164,12 +164,12 @@ class OSG_EXPORT CullingSet : public Referenced /** Threshold at which small features are culled. \param value Boulding volume size in screen space. Default is 2.0. */ void setSmallFeatureCullingPixelSize(float value) { _smallFeatureCullingPixelSize=value; } - + float& getSmallFeatureCullingPixelSize() { return _smallFeatureCullingPixelSize; } float getSmallFeatureCullingPixelSize() const { return _smallFeatureCullingPixelSize; } - - + + /** Compute the pixel of an object at position v, with specified radius.*/ 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... if (!_frustum.contains(vertices)) return true; } - + if (_mask&SMALL_FEATURE_CULLING) { } @@ -208,10 +208,10 @@ class OSG_EXPORT CullingSet : public Referenced } } } - + return false; } - + inline bool isCulled(const BoundingBox& bb) { if (_mask&VIEW_FRUSTUM_CULLING) @@ -219,7 +219,7 @@ class OSG_EXPORT CullingSet : public Referenced // is it outside the view frustum... if (!_frustum.contains(bb)) return true; } - + if (_mask&SMALL_FEATURE_CULLING) { } @@ -237,10 +237,10 @@ class OSG_EXPORT CullingSet : public Referenced } } } - + return false; } - + inline bool isCulled(const BoundingSphere& bs) { if (_mask&VIEW_FRUSTUM_CULLING) @@ -248,7 +248,7 @@ class OSG_EXPORT CullingSet : public Referenced // is it outside the view frustum... if (!_frustum.contains(bs)) return true; } - + if (_mask&SMALL_FEATURE_CULLING) { if (((bs.center()*_pixelSizeVector)*_smallFeatureCullingPixelSize)>bs.radius()) return true; @@ -267,14 +267,14 @@ class OSG_EXPORT CullingSet : public Referenced } } } -#endif +#endif return false; } - + inline void pushCurrentMask() { _frustum.pushCurrentMask(); - + if (!_stateFrustumList.empty()) { for(StateFrustumList::iterator itr=_stateFrustumList.begin(); @@ -298,7 +298,7 @@ class OSG_EXPORT CullingSet : public Referenced } #endif } - + inline void popCurrentMask() { _frustum.popCurrentMask(); @@ -325,23 +325,23 @@ class OSG_EXPORT CullingSet : public Referenced } #endif } - + void disableAndPushOccludersCurrentMask(NodePath& nodePath); void popOccludersCurrentMask(NodePath& nodePath); - + static osg::Vec4 computePixelSizeVector(const Viewport& W, const Matrix& P, const Matrix& M); virtual ~CullingSet(); - + protected: - + Mask _mask; Polytope _frustum; - StateFrustumList _stateFrustumList; - OccluderList _occluderList; + StateFrustumList _stateFrustumList; + OccluderList _occluderList; Vec4 _pixelSizeVector; float _smallFeatureCullingPixelSize; @@ -349,4 +349,4 @@ class OSG_EXPORT CullingSet : public Referenced } // end of namespace -#endif +#endif diff --git a/include/osg/DeleteHandler b/include/osg/DeleteHandler index 0d10e7a1f..5d0302d94 100644 --- a/include/osg/DeleteHandler +++ b/include/osg/DeleteHandler @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ namespace osg { * objects unintentionally. * Note, the DeleteHandler cannot itself be reference counted, otherwise it * 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.*/ 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. * 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 - * non ref_ptr<> pointers to scene graph elements.*/ + * non ref_ptr<> pointers to scene graph elements.*/ void setNumFramesToRetainObjects(unsigned int numberOfFramesToRetainObjects) { _numFramesToRetainObjects = numberOfFramesToRetainObjects; } 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.*/ virtual void flushAll(); - /** Request the deletion of an object. - * Depending on users implementation of DeleteHandler, the delete of the object may occur + /** Request the deletion of an object. + * Depending on users implementation of DeleteHandler, the delete of the object may occur * straight away or be delayed until doDelete is called. * The default implementation does a delete straight away.*/ virtual void requestDelete(const osg::Referenced* object); diff --git a/include/osg/Depth b/include/osg/Depth index 7080f3a0a..aecbc6ee0 100644 --- a/include/osg/Depth +++ b/include/osg/Depth @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,12 +19,12 @@ namespace osg { /** Encapsulate OpenGL glDepthFunc/Mask/Range functions. -*/ +*/ class OSG_EXPORT Depth : public StateAttribute { public : - - + + enum Function { 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); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ Depth(const Depth& dp,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(dp,copyop), @@ -47,10 +47,10 @@ class OSG_EXPORT Depth : public StateAttribute _zNear(dp._zNear), _zFar(dp._zFar), _depthWriteMask(dp._depthWriteMask) {} - - + + META_StateAttribute(osg, Depth, DEPTH); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ virtual int compare(const StateAttribute& sa) const { @@ -73,9 +73,9 @@ class OSG_EXPORT Depth : public StateAttribute return true; } - inline void setFunction(Function func) { _func = func; } + inline void setFunction(Function func) { _func = func; } inline Function getFunction() const { return _func; } - + 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 double getZNear() const { return _zNear; } - + inline void setZFar(double zFar) { _zFar=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; } virtual void apply(State& state) const; protected: - + virtual ~Depth(); Function _func; - + double _zNear; double _zFar; diff --git a/include/osg/DisplaySettings b/include/osg/DisplaySettings index 6f0ddda04..321440cad 100644 --- a/include/osg/DisplaySettings +++ b/include/osg/DisplaySettings @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced setDefaults(); readEnvironmentalVariables(); } - + DisplaySettings(ArgumentParser& arguments): Referenced(true) { @@ -52,23 +52,23 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced } DisplaySettings(const DisplaySettings& vs); - + DisplaySettings& operator = (const DisplaySettings& vs); - + void setDisplaySettings(const DisplaySettings& vs); - + void merge(const DisplaySettings& vs); void setDefaults(); - + /** read the environmental variables.*/ void readEnvironmentalVariables(); /** read the commandline arguments.*/ void readCommandLine(ArgumentParser& arguments); - - + + enum DisplayType { MONITOR, @@ -78,7 +78,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced }; void setDisplayType(DisplayType type) { _displayType = type; } - + DisplayType getDisplayType() const { return _displayType; } @@ -97,7 +97,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced VERTICAL_INTERLACE, CHECKERBOARD }; - + void setStereoMode(StereoMode mode) { _stereoMode = mode; } StereoMode getStereoMode() const { return _stereoMode; } @@ -109,7 +109,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced LEFT_EYE_LEFT_VIEWPORT, LEFT_EYE_RIGHT_VIEWPORT }; - + void setSplitStereoHorizontalEyeMapping(SplitStereoHorizontalEyeMapping m) { _splitStereoHorizontalEyeMapping = m; } SplitStereoHorizontalEyeMapping getSplitStereoHorizontalEyeMapping() const { return _splitStereoHorizontalEyeMapping; } @@ -177,13 +177,13 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced void setNumMultiSamples(unsigned int samples) { _numMultiSamples = samples; } unsigned int getNumMultiSamples() const { return _numMultiSamples; } bool getMultiSamples() const { return _numMultiSamples!=0; } - + void setCompileContextsHint(bool useCompileContexts) { _compileContextsHint = useCompileContexts; } bool getCompileContextsHint() const { return _compileContextsHint; } - + void setSerializeDrawDispatch(bool serializeDrawDispatch) { _serializeDrawDispatch = 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.*/ 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.*/ unsigned int getNumOfHttpDatabaseThreadsHint() const { return _numHttpDatabaseThreadsHint; } - + void setApplication(const std::string& application) { _application = 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; } unsigned int getMaxBufferObjectPoolSize() const { return _maxBufferObjectPoolSize; } - /** - Methods used to set and get defaults for Cameras implicit buffer attachments. - For more info: See description of Camera::setImplicitBufferAttachment method + /** + Methods used to set and get defaults for Cameras implicit buffer attachments. + 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 ie: IMPLICT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT **/ @@ -249,11 +249,11 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced enum SwapMethod { SWAP_DEFAULT, // Leave swap method at default returned by choose Pixel Format. - SWAP_EXCHANGE, // Flip front / back buffer. - SWAP_COPY, // Copy back to front buffer. + SWAP_EXCHANGE, // Flip front / back buffer. + SWAP_COPY, // Copy back to front buffer. SWAP_UNDEFINED // Move back to front buffer leaving contents of back buffer undefined. }; - + /** Select preferred swap method */ 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.*/ unsigned int getGLContextFlags() const { return _glContextFlags; } - + /** Set the hint of the profile mask to use in when creating graphic contexts.*/ void setGLContextProfileMask(unsigned int mask) { _glContextProfileMask = mask; } @@ -279,7 +279,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced unsigned int getGLContextProfileMask() const { return _glContextProfileMask; } protected: - + virtual ~DisplaySettings(); @@ -296,7 +296,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced SplitStereoVerticalEyeMapping _splitStereoVerticalEyeMapping; int _splitStereoVerticalSeparation; bool _splitStereoAutoAdjustAspectRatio; - + bool _doubleBuffer; bool _RGB; bool _depthBuffer; @@ -308,15 +308,15 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced unsigned int _minimumNumberAccumAlphaBits; unsigned int _maxNumOfGraphicsContexts; - + unsigned int _numMultiSamples; - + bool _compileContextsHint; bool _serializeDrawDispatch; unsigned int _numDatabaseThreadsHint; unsigned int _numHttpDatabaseThreadsHint; - + std::string _application; unsigned int _maxTexturePoolSize; @@ -324,7 +324,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask; ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask; - + std::string _glContextVersion; unsigned int _glContextFlags; unsigned int _glContextProfileMask; diff --git a/include/osg/DrawPixels b/include/osg/DrawPixels index f47783f65..14c66b4ed 100644 --- a/include/osg/DrawPixels +++ b/include/osg/DrawPixels @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,27 +30,27 @@ class OSG_EXPORT DrawPixels : public Drawable /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ DrawPixels(const DrawPixels& drawimage,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - + virtual Object* cloneType() const { return new DrawPixels(); } virtual Object* clone(const CopyOp& copyop) const { return new DrawPixels(*this,copyop); } - + virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - + virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "DrawPixels"; } void setPosition(const osg::Vec3& position); - + osg::Vec3& getPosition() { return _position; } const osg::Vec3& getPosition() const { return _position; } void setImage(osg::Image* image) { _image = image; } - + osg::Image* getImage() { return _image.get(); } const osg::Image* getImage() const { return _image.get(); } - + void setUseSubImage(bool useSubImage) { _useSubImage=useSubImage; } bool getUseSubImage() const { return _useSubImage; } @@ -60,7 +60,7 @@ class OSG_EXPORT DrawPixels : public Drawable virtual void drawImplementation(RenderInfo& renderInfo) const; virtual BoundingBox computeBound() const; - + protected: DrawPixels& operator = (const DrawPixels&) { return *this;} @@ -69,10 +69,10 @@ class OSG_EXPORT DrawPixels : public Drawable Vec3 _position; ref_ptr _image; - + bool _useSubImage; unsigned int _offsetX, _offsetY, _width, _height; - + }; } diff --git a/include/osg/Drawable b/include/osg/Drawable index e1e6cd698..13cee3d03 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -4,7 +4,7 @@ * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -122,7 +122,7 @@ class OSG_EXPORT Drawable : public Object * Equivalent to dynamic_cast(this).*/ 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(this).*/ virtual const Geometry* asGeometry() const { return 0; } @@ -199,11 +199,11 @@ class OSG_EXPORT Drawable : public Object if(!_boundingBoxComputed) { _boundingBox = _initialBound; - if (_computeBoundCallback.valid()) + if (_computeBoundCallback.valid()) _boundingBox.expandBy(_computeBoundCallback->computeBound(*this)); else _boundingBox.expandBy(computeBound()); - + _boundingBoxComputed = true; } return _boundingBox; @@ -274,7 +274,7 @@ class OSG_EXPORT Drawable : public Object /** Return OpenGL display list for specified 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.*/ 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 * 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, - * 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. */ 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. - * 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. - * 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 * only created with the graphics context associated with ContextID..*/ static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); diff --git a/include/osg/Endian b/include/osg/Endian index 9476ef13c..3e3934f7b 100644 --- a/include/osg/Endian +++ b/include/osg/Endian @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,9 +35,9 @@ inline Endian getCpuByteOrder() if (u.is_it_really_1 == 1) return BigEndian; - else + else return LittleEndian; -} +} inline void swapBytes( char* in, unsigned int size ) { diff --git a/include/osg/Export b/include/osg/Export index 922b377e3..7fd42bfbd 100644 --- a/include/osg/Export +++ b/include/osg/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,7 +20,7 @@ // well placed for compatibility with future versions. #define USE_DEPRECATED_API -// disable VisualStudio warnings +// disable VisualStudio warnings #if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS) #pragma warning( disable : 4244 ) #pragma warning( disable : 4251 ) diff --git a/include/osg/Fog b/include/osg/Fog index 56bf41113..abed4b1df 100644 --- a/include/osg/Fog +++ b/include/osg/Fog @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -48,7 +48,7 @@ namespace osg { -/** Fog - encapsulates OpenGL fog state. */ +/** Fog - encapsulates OpenGL fog state. */ class OSG_EXPORT Fog : public StateAttribute { public : @@ -67,7 +67,7 @@ class OSG_EXPORT Fog : public StateAttribute _useRadialFog(fog._useRadialFog) {} META_StateAttribute(osg, Fog,FOG); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ 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 const Vec4& getColor() const { return _color; } - + inline void setUseRadialFog( bool useRadialFog ) { _useRadialFog = useRadialFog; } inline bool getUseRadialFog() const { return _useRadialFog; } - + enum FogCoordinateSource { FOG_COORDINATE = GL_FOG_COORDINATE, FRAGMENT_DEPTH = GL_FRAGMENT_DEPTH }; - + inline void setFogCoordinateSource(GLint source) { _fogCoordinateSource = source; } inline GLint getFogCoordinateSource() const { return _fogCoordinateSource; } diff --git a/include/osg/FragmentProgram b/include/osg/FragmentProgram index 9d86311e8..b4781c010 100644 --- a/include/osg/FragmentProgram +++ b/include/osg/FragmentProgram @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -150,14 +150,14 @@ class OSG_EXPORT FragmentProgram : public StateAttribute return _fragmentProgramIDList[contextID]; } - + /** Set the fragment program using a C style string.*/ - inline void setFragmentProgram( const char* program ) - { - _fragmentProgram = program; + inline void setFragmentProgram( const char* program ) + { + _fragmentProgram = program; dirtyFragmentProgramObject(); } - + /** Set the fragment program using C++ style string.*/ 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.*/ - void dirtyFragmentProgramObject(); + void dirtyFragmentProgramObject(); /** use deleteFragmentProgramObject instead of glDeletePrograms to allow * 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; /** Extensions class which encapsulates the querying of extensions and - * associated function pointers, and provide convenience wrappers to - * check for the extensions or use the associated functions.*/ + * associated function pointers, and provide convenience wrappers to + * check for the extensions or use the associated functions.*/ class OSG_EXPORT Extensions : public osg::Referenced { public: Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setFragmentProgramSupported(bool flag) { _isFragmentProgramSupported=flag; } @@ -254,19 +254,19 @@ class OSG_EXPORT FragmentProgram : public StateAttribute void glBindProgram(GLenum target, GLuint id) const; void glGenPrograms(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; protected: ~Extensions() {} - + bool _isFragmentProgramSupported; - + typedef void (GL_APIENTRY * BindProgramProc) (GLenum target, GLuint id); typedef void (GL_APIENTRY * GenProgramsProc) (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); BindProgramProc _glBindProgram; @@ -275,11 +275,11 @@ class OSG_EXPORT FragmentProgram : public StateAttribute ProgramStringProc _glProgramString; ProgramLocalParameter4fvProc _glProgramLocalParameter4fv; }; - + /** 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. - * 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 * only be created with the graphics context associated with ContextID..*/ static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); diff --git a/include/osg/FrameBufferObject b/include/osg/FrameBufferObject index c84226ec0..f5a95080e 100644 --- a/include/osg/FrameBufferObject +++ b/include/osg/FrameBufferObject @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -166,7 +166,7 @@ namespace osg TglBindRenderbuffer* glBindRenderbuffer; TglGenRenderbuffers* glGenRenderbuffers; - TglDeleteRenderbuffers* glDeleteRenderbuffers; + TglDeleteRenderbuffers* glDeleteRenderbuffers; TglRenderbufferStorage* glRenderbufferStorage; TglRenderbufferStorageMultisample* glRenderbufferStorageMultisample; TglRenderbufferStorageMultisampleCoverageNV* glRenderbufferStorageMultisampleCoverageNV; @@ -376,10 +376,10 @@ namespace osg explicit FrameBufferAttachment(TextureCubeMap* target, unsigned int face, unsigned int level = 0); explicit FrameBufferAttachment(TextureRectangle* target); explicit FrameBufferAttachment(Camera::Attachment& attachment); - + ~FrameBufferAttachment(); - FrameBufferAttachment&operator = (const FrameBufferAttachment& copy); + FrameBufferAttachment&operator = (const FrameBufferAttachment& copy); bool isMultisample() const; void createRequiredTexturesAndApplyGenerateMipMap(State& state, const FBOExtensions* ext) const; @@ -412,7 +412,7 @@ namespace osg public: typedef std::map AttachmentMap; typedef std::vector MultipleRenderingTargets; - + typedef Camera::BufferComponent BufferComponent; FrameBufferObject(); @@ -421,19 +421,19 @@ namespace osg META_StateAttribute(osg, FrameBufferObject, (StateAttribute::Type)0x101010/*FrameBufferObject*/); inline const AttachmentMap& getAttachmentMap() const; - + void setAttachment(BufferComponent attachment_point, const FrameBufferAttachment &attachment); inline const FrameBufferAttachment& getAttachment(BufferComponent attachment_point) const; inline bool hasAttachment(BufferComponent attachment_point) const; - + inline bool hasMultipleRenderingTargets() const { return !_drawBuffers.empty(); } inline const MultipleRenderingTargets& getMultipleRenderingTargets() const { return _drawBuffers; } bool isMultisample() const; int compare(const StateAttribute &sa) const; - + void apply(State &state) const; enum BindTarget @@ -472,12 +472,12 @@ namespace osg FrameBufferObject& operator = (const FrameBufferObject&) { return *this; } void updateDrawBuffers(); - + inline void dirtyAll(); GLenum convertBufferComponentToGLenum(BufferComponent attachment_point) const; - private: + private: AttachmentMap _attachments; // Buffers passed to glDrawBuffers when using multiple render targets. @@ -486,7 +486,7 @@ namespace osg mutable buffered_value _dirtyAttachmentList; mutable buffered_value _unsupported; mutable buffered_value _fboID; - + }; // INLINE METHODS diff --git a/include/osg/FrameStamp b/include/osg/FrameStamp index 7cdea2164..ce48e1e2b 100644 --- a/include/osg/FrameStamp +++ b/include/osg/FrameStamp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,43 +30,43 @@ namespace osg * time of specific frame, used to synchronize operations on the scene graph * and other machines when using a graphics cluster. Note the calendar * time can be an artificial simulation time or capture the real time - * of day etc.*/ + * of day etc.*/ class OSG_EXPORT FrameStamp : public Referenced { public: FrameStamp(); FrameStamp(const FrameStamp& fs); - + FrameStamp& operator = (const FrameStamp& fs); - + void setFrameNumber(unsigned int fnum) { _frameNumber = fnum; } unsigned int getFrameNumber() const { return _frameNumber; } - + void setReferenceTime(double refTime) { _referenceTime = refTime; } double getReferenceTime() const { return _referenceTime; } - + void setSimulationTime(double refTime) { _simulationTime = refTime; } double getSimulationTime() const { return _simulationTime; } - + void setCalendarTime(const tm& calendarTime); 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 virtual ~FrameStamp(); protected: - + // note no dynamic memory is used so that data can be passed // via a simple memory copy or within a data packet across // the network. - + unsigned int _frameNumber; double _referenceTime; - double _simulationTime; - + double _simulationTime; + // member variables of time.h's tm structure, copied here to // ensure that all data is not dynamic. The tm structure itself // 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_yday; /* Days in year. [0-365] */ int tm_isdst; /* DST. [-1/0/1]*/ - - + + }; } diff --git a/include/osg/FrontFace b/include/osg/FrontFace index 43eeb8eb8..2f7f9fb2f 100644 --- a/include/osg/FrontFace +++ b/include/osg/FrontFace @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,16 +20,16 @@ namespace osg { /** Class to specify the orientation of front-facing polygons. -*/ +*/ class OSG_EXPORT FrontFace : public StateAttribute { public : - + enum Mode { CLOCKWISE = GL_CW, COUNTER_CLOCKWISE = GL_CCW }; - + FrontFace(Mode face=COUNTER_CLOCKWISE); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ @@ -38,7 +38,7 @@ class OSG_EXPORT FrontFace : public StateAttribute _mode(ff._mode) {} META_StateAttribute(osg, FrontFace, FRONTFACE); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ 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. } - + inline void setMode(Mode mode) { _mode = mode; } inline Mode getMode() const { return _mode; } - + virtual void apply(State& state) const; - + protected: - + virtual ~FrontFace(); - + Mode _mode; }; diff --git a/include/osg/GL b/include/osg/GL index 7a1b48990..f4fe0fcfb 100644 --- a/include/osg/GL +++ b/include/osg/GL @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ #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. #ifndef APIENTRY #define APIENTRY @@ -56,7 +56,7 @@ #define GLUT_APIENTRY_DEFINED #define APIENTRY __stdcall #endif - // XXX This is from Win32's + // XXX This is from Win32's #ifndef CALLBACK #define CALLBACK __stdcall #endif @@ -64,9 +64,9 @@ #else // ! __CYGWIN__ // Under Windows avoid including - // to avoid name space pollution, but Win32's - // needs APIENTRY and WINGDIAPI defined properly. - // XXX This is from Win32's + // to avoid name space pollution, but Win32's + // needs APIENTRY and WINGDIAPI defined properly. + // XXX This is from Win32's #ifndef APIENTRY #define GLUT_APIENTRY_DEFINED #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) @@ -77,7 +77,7 @@ #endif #endif - // XXX This is from Win32's + // XXX This is from Win32's #ifndef CALLBACK #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) #define CALLBACK __stdcall @@ -88,13 +88,13 @@ #endif // __CYGWIN__ - // XXX This is from Win32's and + // XXX This is from Win32's and #ifndef WINGDIAPI #define GLUT_WINGDIAPI_DEFINED #define DECLSPEC_IMPORT __declspec(dllimport) #define WINGDIAPI DECLSPEC_IMPORT #endif - + // XXX This is from Win32's #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4))) typedef unsigned short wchar_t; @@ -189,31 +189,31 @@ #ifdef OSG_GL1_AVAILABLE #define OSG_GL1_FEATURES true -#else +#else #define OSG_GL1_FEATURES false #endif #ifdef OSG_GL2_AVAILABLE #define OSG_GL2_FEATURES true -#else +#else #define OSG_GL2_FEATURES false #endif #ifdef OSG_GL3_AVAILABLE #define OSG_GL3_FEATURES true -#else +#else #define OSG_GL3_FEATURES false #endif #ifdef OSG_GLES1_AVAILABLE #define OSG_GLES1_FEATURES true -#else +#else #define OSG_GLES1_FEATURES false #endif #ifdef OSG_GLES2_AVAILABLE #define OSG_GLES2_FEATURES true -#else +#else #define OSG_GLES2_FEATURES false #endif diff --git a/include/osg/GL2Extensions b/include/osg/GL2Extensions index 8137951bf..55a4fa7c4 100644 --- a/include/osg/GL2Extensions +++ b/include/osg/GL2Extensions @@ -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) 2004-2005 Nathan Cournia * Copyright (C) 2007 Art Tevs * Copyright (C) 2008 Zebra Imaging * 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 * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -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 * GetObjectParameterivARBProc)(GLuint program, GLenum pname, GLint *params); 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 * GetShaderivProc)(GLuint shader, GLenum pname, GLint *params); - 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 GLint (GL_APIENTRY * GetUniformLocationProc)(GLuint program, const GLchar *name); - 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 * GetVertexAttribdvProc)(GLuint index, GLenum pname, GLdouble *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 * GetVertexAttribPointervProc)(GLuint index, GLenum pname, GLvoid* *pointer); - typedef GLboolean (GL_APIENTRY * IsProgramProc)(GLuint program); - typedef GLboolean (GL_APIENTRY * IsShaderProc)(GLuint shader); - typedef void (GL_APIENTRY * LinkProgramProc)(GLuint program); + 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 * GetShaderInfoLogProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + typedef void (GL_APIENTRY * GetShaderSourceProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); + 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 * GetUniformivProc)(GLuint program, GLint location, GLint *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 * GetVertexAttribivProc)(GLuint index, GLenum pname, GLint *params); + typedef void (GL_APIENTRY * GetVertexAttribPointervProc)(GLuint index, GLenum pname, GLvoid* *pointer); + typedef GLboolean (GL_APIENTRY * IsProgramProc)(GLuint program); + typedef GLboolean (GL_APIENTRY * IsShaderProc)(GLuint shader); + 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 * UseProgramProc)(GLuint program); - typedef void (GL_APIENTRY * Uniform1fProc)(GLint location, GLfloat v0); - 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 * Uniform4fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); - typedef void (GL_APIENTRY * Uniform1iProc)(GLint location, GLint v0); - 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 * 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 * Uniform2fvProc)(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 * Uniform1ivProc)(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 * Uniform4ivProc)(GLint location, GLsizei count, const GLint *value); + typedef void (GL_APIENTRY * UseProgramProc)(GLuint program); + typedef void (GL_APIENTRY * Uniform1fProc)(GLint location, GLfloat v0); + 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 * Uniform4fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + typedef void (GL_APIENTRY * Uniform1iProc)(GLint location, GLint v0); + 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 * 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 * Uniform2fvProc)(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 * Uniform1ivProc)(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 * 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 * 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 * ValidateProgramProc)(GLuint program); - typedef void (GL_APIENTRY * VertexAttrib1dProc)(GLuint index, GLdouble x); - typedef void (GL_APIENTRY * VertexAttrib1dvProc)(GLuint index, const GLdouble *v); - typedef void (GL_APIENTRY * VertexAttrib1fProc)(GLuint index, GLfloat x); - typedef void (GL_APIENTRY * VertexAttrib1fvProc)(GLuint index, const GLfloat *v); - typedef void (GL_APIENTRY * VertexAttrib1sProc)(GLuint index, GLshort x); - 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 * VertexAttrib2dvProc)(GLuint index, const GLdouble *v); - 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 * VertexAttrib2sProc)(GLuint index, GLshort x, GLshort y); - 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 * VertexAttrib3dvProc)(GLuint index, const GLdouble *v); - 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 * VertexAttrib3sProc)(GLuint index, GLshort x, GLshort y, GLshort z); - typedef void (GL_APIENTRY * VertexAttrib3svProc)(GLuint index, const GLshort *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 * 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 * VertexAttrib4NubvProc)(GLuint index, const GLubyte *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 * 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 * 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 * VertexAttrib4fvProc)(GLuint index, const GLfloat *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 * VertexAttrib4svProc)(GLuint index, const GLshort *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 * VertexAttrib4usvProc)(GLuint index, const GLushort *v); + 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 * VertexAttrib1dProc)(GLuint index, GLdouble x); + typedef void (GL_APIENTRY * VertexAttrib1dvProc)(GLuint index, const GLdouble *v); + typedef void (GL_APIENTRY * VertexAttrib1fProc)(GLuint index, GLfloat x); + typedef void (GL_APIENTRY * VertexAttrib1fvProc)(GLuint index, const GLfloat *v); + typedef void (GL_APIENTRY * VertexAttrib1sProc)(GLuint index, GLshort x); + 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 * VertexAttrib2dvProc)(GLuint index, const GLdouble *v); + 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 * VertexAttrib2sProc)(GLuint index, GLshort x, GLshort y); + 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 * VertexAttrib3dvProc)(GLuint index, const GLdouble *v); + 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 * VertexAttrib3sProc)(GLuint index, GLshort x, GLshort y, GLshort z); + typedef void (GL_APIENTRY * VertexAttrib3svProc)(GLuint index, const GLshort *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 * 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 * VertexAttrib4NubvProc)(GLuint index, const GLubyte *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 * 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 * 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 * VertexAttrib4fvProc)(GLuint index, const GLfloat *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 * VertexAttrib4svProc)(GLuint index, const GLshort *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 * 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 * 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 * UniformMatrix2x4fvProc)( 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 * ProgramBinaryProc)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); - BlendEquationSeparateProc _glBlendEquationSeparate; + BlendEquationSeparateProc _glBlendEquationSeparate; DrawBuffersProc _glDrawBuffers; StencilOpSeparateProc _glStencilOpSeparate; StencilFuncSeparateProc _glStencilFuncSeparate; diff --git a/include/osg/GLBeginEndAdapter b/include/osg/GLBeginEndAdapter index 39312e59e..a343a81d8 100644 --- a/include/osg/GLBeginEndAdapter +++ b/include/osg/GLBeginEndAdapter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/GLExtensions b/include/osg/GLExtensions index 6981004a2..cac563a93 100644 --- a/include/osg/GLExtensions +++ b/include/osg/GLExtensions @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -49,7 +49,7 @@ extern OSG_EXPORT bool isGLExtensionOrVersionSupported(unsigned int contextID, c * Note, glGLExtensionFuncPtr is declared inline so that the code * is compiled locally to the calling code. This should get by Windows' * 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); @@ -109,12 +109,12 @@ bool setGLExtensionFuncPtr(T& t, const char* str1) if (data) { memcpy(&t, &data, sizeof(T)); - return true; + return true; } else { t = 0; - return false; + return false; } } @@ -125,12 +125,12 @@ bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2) if (data) { memcpy(&t, &data, sizeof(T)); - return true; + return true; } else { t = 0; - return false; + return false; } } @@ -141,12 +141,12 @@ bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2, const char* if (data) { memcpy(&t, &data, sizeof(T)); - return true; + return true; } else { t = 0; - return false; + return false; } } diff --git a/include/osg/GLObjects b/include/osg/GLObjects index 2c3a52277..b8fd2bf40 100644 --- a/include/osg/GLObjects +++ b/include/osg/GLObjects @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/GLU b/include/osg/GLU index d86bf4d25..27fd7c85b 100644 --- a/include/osg/GLU +++ b/include/osg/GLU @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/Geode b/include/osg/Geode index c09686892..b6a97fcde 100644 --- a/include/osg/Geode +++ b/include/osg/Geode @@ -40,7 +40,7 @@ class OSG_EXPORT Geode : public Node virtual Geode* asGeode() { return this; } virtual const Geode* asGeode() const { return this; } - + /** Add a \c Drawable to 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 diff --git a/include/osg/Geometry b/include/osg/Geometry index ab24b0cc7..b9636aa88 100644 --- a/include/osg/Geometry +++ b/include/osg/Geometry @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,9 +32,9 @@ class OSG_EXPORT Geometry : public Drawable /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - + 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(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "Geometry"; } @@ -52,13 +52,13 @@ class OSG_EXPORT Geometry : public Drawable BIND_PER_PRIMITIVE, BIND_PER_VERTEX }; - + struct OSG_EXPORT ArrayData { ArrayData(): binding(BIND_OFF), normalize(GL_FALSE) {} - + ArrayData(const ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); ArrayData(Array* a, AttributeBinding b, GLboolean n = GL_FALSE): @@ -81,21 +81,21 @@ class OSG_EXPORT Geometry : public Drawable normalize = rhs.normalize; return *this; } - - inline bool empty() const { return !array.valid(); } + + inline bool empty() const { return !array.valid(); } ref_ptr array; ref_ptr indices; AttributeBinding binding; GLboolean normalize; }; - + struct OSG_EXPORT Vec3ArrayData { Vec3ArrayData(): binding(BIND_OFF), normalize(GL_FALSE) {} - + Vec3ArrayData(const Vec3ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); Vec3ArrayData(Vec3Array* a, AttributeBinding b, GLboolean n = GL_FALSE): @@ -119,7 +119,7 @@ class OSG_EXPORT Geometry : public Drawable return *this; } - inline bool empty() const { return !array.valid(); } + inline bool empty() const { return !array.valid(); } ref_ptr array; ref_ptr indices; @@ -127,13 +127,13 @@ class OSG_EXPORT Geometry : public Drawable 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. */ static const ArrayData s_InvalidArrayData; - + typedef std::vector< ArrayData > ArrayDataList; - + void setVertexArray(Array* array); Array* getVertexArray() { return _vertexData.array.get(); } @@ -142,7 +142,7 @@ class OSG_EXPORT Geometry : public Drawable void setVertexData(const ArrayData& arrayData); ArrayData& getVertexData() { return _vertexData; } const ArrayData& getVertexData() const { return _vertexData; } - + void setNormalBinding(AttributeBinding ab); AttributeBinding getNormalBinding() const { return _normalData.binding; } @@ -189,7 +189,7 @@ class OSG_EXPORT Geometry : public Drawable void setFogCoordData(const ArrayData& arrayData); ArrayData& getFogCoordData() { return _fogCoordData; } const ArrayData& getFogCoordData() const { return _fogCoordData; } - + void setTexCoordArray(unsigned int unit,Array*); Array* getTexCoordArray(unsigned int unit); @@ -228,23 +228,23 @@ class OSG_EXPORT Geometry : public Drawable typedef std::vector< ref_ptr > PrimitiveSetList; void setPrimitiveSetList(const PrimitiveSetList& primitives); - + PrimitiveSetList& getPrimitiveSetList() { return _primitives; } const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; } unsigned int getNumPrimitiveSets() const { return static_cast(_primitives.size()); } PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); } const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); } - + /** Add a primitive set to the geometry. */ bool addPrimitiveSet(PrimitiveSet* primitiveset); - + /** Set a primitive set to the specified position in geometry's primitive set list. */ bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); - + /** Insert a primitive set to the specified position in geometry's primitive set list. */ bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); - + /** Remove primitive set(s) from the specified position in geometry's primitive set list. */ bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1); @@ -260,7 +260,7 @@ class OSG_EXPORT Geometry : public Drawable void setVertexIndices(IndexArray* array); IndexArray* getVertexIndices() { return _vertexData.indices.get(); } const IndexArray* getVertexIndices() const { return _vertexData.indices.get(); } - + /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ void setNormalIndices(IndexArray* array); 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.*/ virtual void setUseVertexBufferObjects(bool flag); @@ -358,9 +358,9 @@ class OSG_EXPORT Geometry : public Drawable bool containsSharedArrays() const; - + void duplicateSharedArrays(); - + void computeInternalOptimizedGeometry(); @@ -418,16 +418,16 @@ class OSG_EXPORT Geometry : public Drawable Geometry& operator = (const Geometry&) { return *this;} virtual ~Geometry(); - + bool verifyBindings(const ArrayData& arrayData) const; bool verifyBindings(const Vec3ArrayData& arrayData) const; - + void computeCorrectBindingsAndArraySizes(ArrayData& arrayData,const char* arrayName); void computeCorrectBindingsAndArraySizes(Vec3ArrayData& arrayData,const char* arrayName); - + void addVertexBufferObjectIfRequired(osg::Array* array); void addElementBufferObjectIfRequired(osg::PrimitiveSet* primitiveSet); - + PrimitiveSetList _primitives; ArrayData _vertexData; diff --git a/include/osg/GraphicsContext b/include/osg/GraphicsContext index 7b19c4319..d7adf6dba 100644 --- a/include/osg/GraphicsContext +++ b/include/osg/GraphicsContext @@ -29,7 +29,7 @@ class Camera; class OSG_EXPORT GraphicsContext : public Object { public: - + struct OSG_EXPORT ScreenIdentifier { ScreenIdentifier(); @@ -37,16 +37,16 @@ class OSG_EXPORT GraphicsContext : public Object ScreenIdentifier(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; - + /** 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 * signify that this parameter has not been set. When parameters are undefined one can call * call setUndefinedScreenDetailsToDefaultScreen() after readDISPLAY() to ensure valid values. */ void readDISPLAY(); - + /** Set the screenIndentifier from the displayName string. * 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 @@ -64,23 +64,23 @@ class OSG_EXPORT GraphicsContext : public Object int displayNum; int screenNum; }; - + /** GraphicsContext Traits object provides the specification of what type of graphics context is required.*/ struct OSG_EXPORT Traits : public osg::Referenced, public ScreenIdentifier { Traits(DisplaySettings* ds=0); - + // graphics context original and size int x; int y; int width; int height; - + // window decoration and behaviour std::string windowName; bool windowDecoration; bool supportsResize; - + // buffer depths, 0 equals off. unsigned int red; unsigned int blue; @@ -104,10 +104,10 @@ class OSG_EXPORT GraphicsContext : public Object unsigned int level; unsigned int face; unsigned int mipMapGeneration; - + // V-sync bool vsync; - + // Swap Group bool swapGroupEnabled; GLuint swapGroup; @@ -115,7 +115,7 @@ class OSG_EXPORT GraphicsContext : public Object // use multithreaded OpenGL-engine (OS X only) bool useMultiThreadedOpenGLEngine; - + // enable cursor 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.*/ bool getContextVersion(unsigned int& major, unsigned int& minor) const; - + // shared context GraphicsContext* sharedContext; - + osg::ref_ptr inheritedWindowData; - + // ask the GraphicsWindow implementation to set the pixel format of an inherited window bool setInheritedWindowPixelFormat; - + // X11 hint whether to override the window managers window size/position redirection bool overrideRedirect; @@ -177,7 +177,7 @@ class OSG_EXPORT GraphicsContext : public Object virtual void enumerateScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettingsList & resolutionList) = 0; virtual GraphicsContext* createGraphicsContext(Traits* traits) = 0; - + virtual ~WindowingSystemInterface() {} @@ -207,17 +207,17 @@ class OSG_EXPORT GraphicsContext : public Object 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. */ static void setWindowingSystemInterface(WindowingSystemInterface* wsInterface); - + /** Get the WindowingSystemInterface*/ static WindowingSystemInterface* getWindowingSystemInterface(); - + /** Create a graphics context for a specified set of 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. * Automatically increments the usage count of the contextID to 1.*/ 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.*/ static void decrementContextIDUsageCount(unsigned int contextID); - + typedef std::vector GraphicsContexts; - + /** Get all the registered graphics contexts.*/ static GraphicsContexts getAllRegisteredGraphicsContexts(); - + /** Get all the registered graphics contexts associated with a specific contextID.*/ static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID); - + /** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/ 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.*/ static GraphicsContext* getOrCreateCompileContext(unsigned int contextID); - + /** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/ static GraphicsContext* getCompileContext(unsigned int contextID); public: - + /** Add operation to end of OperationQueue.*/ void add(Operation* operation); - + /** Remove operation from OperationQueue.*/ void remove(Operation* operation); @@ -266,7 +266,7 @@ class OSG_EXPORT GraphicsContext : public Object virtual void runOperations(); typedef std::list< ref_ptr > GraphicsOperationQueue; - + /** Get the operations queue, not you must use the OperationsMutex when accessing the queue.*/ GraphicsOperationQueue& getOperationsQueue() { return _operations; } @@ -281,7 +281,7 @@ class OSG_EXPORT GraphicsContext : public Object public: - + /** Get the traits of the GraphicsContext.*/ 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.*/ inline void setState(State* state) { _state = state; } - + /** Get the State object which tracks the current OpenGL state for this graphics context.*/ inline State* getState() { return _state.get(); } - + /** Get the const State object which tracks the current OpenGL state for this graphics context.*/ inline const State* getState() const { return _state.get(); } @@ -304,7 +304,7 @@ class OSG_EXPORT GraphicsContext : public Object /** Returns the clear color. */ inline const Vec4& getClearColor() const { return _clearColor; } - + /** 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. * 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.*/ inline GLbitfield getClearMask() const { return _clearMask; } - + /** Do an OpenGL clear of the full graphics context/window. * Note, must only be called from a thread with this context current.*/ virtual void clear(); - + double getTimeSinceLastClear() const { return osg::Timer::instance()->delta_s(_lastClearTick, osg::Timer::instance()->tick()); } - + /** Realize the GraphicsContext.*/ bool realize(); @@ -338,19 +338,19 @@ class OSG_EXPORT GraphicsContext : public Object /** Make this graphics context current. - * Implemented by calling makeCurrentImplementation(). + * Implemented by calling makeCurrentImplementation(). * Returns true on success. */ bool makeCurrent(); - + /** Make this graphics context current with specified read context. * Implemented by calling makeContextCurrentImplementation(). * Returns true on success. */ bool makeContextCurrent(GraphicsContext* readContext); - + /** Release the graphics context. * Returns true on success. */ bool releaseContext(); - + /** Return true if the current thread has this OpenGL graphics context.*/ 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(); } - /** Realize the GraphicsContext implementation, + /** Realize the GraphicsContext implementation, * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual bool realizeImplementation() = 0; @@ -387,7 +387,7 @@ class OSG_EXPORT GraphicsContext : public Object /** Make this graphics context current implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual bool makeCurrentImplementation() = 0; - + /** Make this graphics context current with specified read context implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual bool makeContextCurrentImplementation(GraphicsContext* readContext) = 0; @@ -407,7 +407,7 @@ class OSG_EXPORT GraphicsContext : public Object * GraphicsContext::swapBuffersImplementation(), allowing * developers to provide custom behavior for swap. * The callback must call - * GraphicsContext::swapBuffersImplementation() */ + * GraphicsContext::swapBuffersImplementation() */ void setSwapCallback(SwapCallback* rc) { _swapCallback = rc; } /** 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.*/ 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 */ void setDefaultFboId(GLuint i) { _defaultFboId = i; } - + GLuint getDefaultFboId() const { return _defaultFboId; } public: @@ -480,7 +480,7 @@ class OSG_EXPORT GraphicsContext : public Object virtual const char* className() const { return "GraphicsContext"; } protected: - + GraphicsContext(); GraphicsContext(const GraphicsContext&, const osg::CopyOp&); @@ -498,31 +498,31 @@ class OSG_EXPORT GraphicsContext : public Object void addCamera(osg::Camera* camera); void removeCamera(osg::Camera* camera); - + Cameras _cameras; friend class osg::Camera; - ref_ptr _traits; + ref_ptr _traits; ref_ptr _state; Vec4 _clearColor; GLbitfield _clearMask; OpenThreads::Thread* _threadOfLastMakeCurrent; - + OpenThreads::Mutex _operationsMutex; osg::ref_ptr _operationsBlock; GraphicsOperationQueue _operations; osg::ref_ptr _currentOperation; ref_ptr _graphicsThread; - + ref_ptr _resizedCallback; ref_ptr _swapCallback; - + Timer_t _lastClearTick; - + GLuint _defaultFboId; }; diff --git a/include/osg/GraphicsThread b/include/osg/GraphicsThread index 7b67a8554..60ee085e8 100644 --- a/include/osg/GraphicsThread +++ b/include/osg/GraphicsThread @@ -25,10 +25,10 @@ class GraphicsContext; class OSG_EXPORT GraphicsThread : public osg::OperationThread { public: - + GraphicsThread(); - - /** Run does the graphics thread run loop.*/ + + /** Run does the graphics thread run loop.*/ virtual void run(); }; @@ -72,11 +72,11 @@ struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barri virtual void release(); virtual void operator () (Object* object); - + 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.*/ 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); virtual void operator () (GraphicsContext*); - + double _availableTime; }; @@ -113,17 +113,17 @@ public: RunOperations(): osg::GraphicsOperation("RunOperation",true) {} - + virtual void operator () (osg::GraphicsContext* context); - + }; class OSG_EXPORT EndOfDynamicDrawBlock : public OpenThreads::BlockCount, public osg::State::DynamicObjectRenderingCompletedCallback { public: - + EndOfDynamicDrawBlock(unsigned int); - + void completed(osg::State* state); protected: diff --git a/include/osg/Group b/include/osg/Group index 8bedbc44c..9434d724a 100644 --- a/include/osg/Group +++ b/include/osg/Group @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ class OSG_EXPORT Group : public Node Group(); - + /** Copy constructor using CopyOp to manage deep vs 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. * The new child node is inserted into the child list * 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 ); /** Remove Node from Group. * 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 * return true for success. If Node is not found then return false * and do not change the reference count of the Node. @@ -74,7 +74,7 @@ class OSG_EXPORT Group : public Node /** Remove Node from Group. * 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 * return true for success. If Node is not found then return false * 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 * reference count of newNode, and dirty the bounding sphere * 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 * 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. */ inline bool containsNode( const Node* node ) const { - + for (NodeList::const_iterator itr=_children.begin(); itr!=_children.end(); ++itr) @@ -154,7 +154,7 @@ class OSG_EXPORT Group : public Node virtual void releaseGLObjects(osg::State* = 0) const; virtual BoundingSphere computeBound() const; - + protected: virtual ~Group(); diff --git a/include/osg/Hint b/include/osg/Hint index 63b1d5f1f..274af53ce 100644 --- a/include/osg/Hint +++ b/include/osg/Hint @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -53,16 +53,16 @@ public: // compare each parameter in turn against the rhs. COMPARE_StateAttribute_Parameter(_target) COMPARE_StateAttribute_Parameter(_mode) - + return 0; } /** 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(_target); } - + void setTarget(GLenum target); inline GLenum getTarget() const { return _target; } - + inline void setMode(GLenum mode) { _mode = mode; } inline GLenum getMode() const { return _mode; } @@ -70,7 +70,7 @@ public: protected: - + GLenum _target; GLenum _mode; }; diff --git a/include/osg/Image b/include/osg/Image index b071c1d26..febe09037 100644 --- a/include/osg/Image +++ b/include/osg/Image @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -93,7 +93,7 @@ #endif #ifndef GL_OES_compressed_ETC1_RGB8_texture - #define GL_ETC1_RGB8_OES 0x8D64 + #define GL_ETC1_RGB8_OES 0x8D64 #endif namespace osg { @@ -108,7 +108,7 @@ class OSG_EXPORT Image : public BufferData public : Image(); - + /** Copy constructor using CopyOp to manage deep vs 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); inline const std::string& getFileName() const { return _fileName; } - + enum WriteHint { NO_PREFERENCE, STORE_INLINE, EXTERNAL_FILE }; - + void setWriteHint(WriteHint writeHint) { _writeHint = writeHint; } WriteHint getWriteHint() const { return _writeHint; } - + enum AllocationMode { NO_DELETE, USE_NEW_DELETE, USE_MALLOC_FREE }; - + /** Set the method used for deleting data once it goes out of scope. */ 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, GLenum pixelFormat,GLenum type, int packing=1); - - + + /** Set the image dimensions, format and data. */ virtual void setImage(int s,int t,int r, GLint internalTextureformat, @@ -165,13 +165,13 @@ class OSG_EXPORT Image : public BufferData unsigned char* data, AllocationMode mode, int packing=1, int rowLength=0); - + /** 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. */ virtual void readPixels(int x,int y,int width,int height, GLenum pixelFormat,GLenum type); - + /** 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. @@ -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); - enum Origin + enum Origin { BOTTOM_LEFT, TOP_LEFT }; - + /** Set the origin of the image. * 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, * and hasn't been flipped yet. For such images one much flip the t axis of the tex coords. * to handle this origin position. */ void setOrigin(Origin origin) { _origin = origin; } - + /** Get the origin of the image.*/ Origin getOrigin() const { return _origin; } - + /** Width of image. */ inline int s() const { return _s; } /** Height of image. */ inline int t() const { return _t; } - + /** Depth of image. */ inline int r() const { return _r; } void setRowLength(int length); inline int getRowLength() const { return _rowLength; } - + void setInternalTextureFormat(GLint internalFormat); inline GLint getInternalTextureFormat() const { return _internalTextureFormat; } - + void setPixelFormat(GLenum pixelFormat); inline GLenum getPixelFormat() const { return _pixelFormat; } - + void setDataType(GLenum dataType); - inline GLenum getDataType() const { return _dataType; } - + inline GLenum getDataType() const { return _dataType; } + void setPacking(unsigned int packing) { _packing = packing; } inline unsigned int getPacking() const { return _packing; } @@ -244,7 +244,7 @@ class OSG_EXPORT Image : public BufferData /** Get the pixel aspect ratio.*/ inline float getPixelAspectRatio() const { return _pixelAspectRatio; } - + /** Return the number of bits required for each pixel. */ 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. */ 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. */ 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 * take care to access the data per row rather than treating the whole data as a single block. */ inline unsigned char* data() { return _data; } - + /** Raw const image data. * 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. */ @@ -286,7 +286,7 @@ class OSG_EXPORT Image : public BufferData if (!_data) return NULL; return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes(); } - + inline const unsigned char* data(int column, int row=0,int image=0) const { if (!_data) return NULL; @@ -318,9 +318,9 @@ class OSG_EXPORT Image : public BufferData protected: - + void assign(); - + const osg::Image* _image; int _rowNum; int _imageNum; @@ -341,7 +341,7 @@ class OSG_EXPORT Image : public BufferData /** Flip the image horizontally, around s dimension. */ void flipHorizontal(); - + /** Flip the image vertically, around t dimension. */ 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.*/ inline void setMipmapLevels(const MipmapDataType& mipmapDataVector) { _mipmapData = mipmapDataVector; } - + inline const MipmapDataType& getMipmapLevels() const { return _mipmapData; } inline unsigned int getMipmapOffset(unsigned int mipmapLevel) const @@ -389,7 +389,7 @@ class OSG_EXPORT Image : public BufferData return _mipmapData[mipmapLevel-1]; return 0; }; - + inline unsigned char* getMipmapData(unsigned int 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). */ 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); } /** Get the PixelBufferObject.*/ @@ -464,13 +464,13 @@ class OSG_EXPORT Image : public BufferData AllocationMode _allocationMode; unsigned char* _data; - + void deallocateData(); - + void setData(unsigned char* data,AllocationMode allocationMode); MipmapDataType _mipmapData; - + ref_ptr _bufferObject; }; diff --git a/include/osg/ImageSequence b/include/osg/ImageSequence index 94503b741..9cc4a0bfa 100644 --- a/include/osg/ImageSequence +++ b/include/osg/ImageSequence @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -44,13 +44,13 @@ class OSG_EXPORT ImageSequence : public ImageStream virtual void setReferenceTime(double t) { _referenceTime = t; } virtual double getReferenceTime() const { return _referenceTime; } - + virtual void setTimeMultiplier(double tm) { _timeMultiplier = tm; } virtual double getTimeMultiplier() const { return _timeMultiplier; } typedef std::vector< osg::ref_ptr > Images; typedef std::vector< std::string > FileNames; - + virtual void seek(double time); virtual void play(); @@ -58,33 +58,33 @@ class OSG_EXPORT ImageSequence : public ImageStream virtual void pause(); virtual void rewind(); - + enum Mode { PRE_LOAD_ALL_IMAGES, PAGE_AND_RETAIN_IMAGES, PAGE_AND_DISCARD_USED_IMAGES }; - + void setMode(Mode mode); Mode getMode() const { return _mode; } void setLength(double length); virtual double getLength() const { return _length; } - + void addImageFile(const std::string& fileName); - + void setImageFile(unsigned int pos, const std::string& fileName); std::string getImageFile(unsigned int pos) const; - + unsigned int getNumImageFiles() const { return _fileNames.size(); } FileNames& getFileNames() { return _fileNames; } const FileNames& getFileNames() const { return _fileNames; } void addImage(osg::Image* image); - + void setImage(int s,int t,int r, GLint internalTextureformat, GLenum pixelFormat,GLenum type, @@ -95,7 +95,7 @@ class OSG_EXPORT ImageSequence : public ImageStream void setImage(unsigned int pos, osg::Image* image); Image* getImage(unsigned int pos); const Image* getImage(unsigned int pos) const; - + unsigned int getNumImages() const { return _images.size(); } Images& getImages() { return _images; } @@ -110,11 +110,11 @@ class OSG_EXPORT ImageSequence : public ImageStream protected: virtual ~ImageSequence() {} - + virtual void applyLoopingMode(); void setImageToChild(const osg::Image* image); - + void computeTimePerImage(); int imageIndex(double time); @@ -132,17 +132,17 @@ class OSG_EXPORT ImageSequence : public ImageStream FileNames _fileNames; Images _images; - + typedef std::set< std::string > FilesRequested; FilesRequested _filesRequested; - + int _previousAppliedImageIndex; - - + + bool _seekTimeSet; double _seekTime; - - + + }; diff --git a/include/osg/ImageStream b/include/osg/ImageStream index 3f339cdf1..a18d59f07 100644 --- a/include/osg/ImageStream +++ b/include/osg/ImageStream @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -46,7 +46,7 @@ class OSG_EXPORT ImageStream : public Image PAUSED, REWINDING }; - + virtual void seek(double /*time*/) {} virtual void play() { _status=PLAYING; } @@ -54,39 +54,39 @@ class OSG_EXPORT ImageStream : public Image virtual void pause() { _status=PAUSED; } virtual void rewind() { _status=REWINDING; } - + virtual void quit(bool /*waitForThreadToExit*/ = true) {} StreamStatus getStatus() { return _status; } - + enum LoopingMode { NO_LOOPING, LOOPING }; - + void setLoopingMode(LoopingMode mode) { if (_loopingMode == mode) return; - + _loopingMode = mode; applyLoopingMode(); } - + LoopingMode getLoopingMode() const { return _loopingMode; } virtual double getCreationTime() const { return HUGE_VAL; } 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 void setReferenceTime(double) {} virtual double getReferenceTime() const { return 0.0; } - + virtual void setTimeMultiplier(double) {} virtual double getTimeMultiplier() const { return 0.0; } - + virtual void setVolume(float) {} virtual float getVolume() const { return 0.0f; } @@ -94,7 +94,7 @@ class OSG_EXPORT ImageStream : public Image void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; } AudioStreams& getAudioStreams() { return _audioStreams; } const AudioStreams& getAudioStreams() const { return _audioStreams; } - + protected: virtual void applyLoopingMode() {} @@ -103,7 +103,7 @@ class OSG_EXPORT ImageStream : public Image StreamStatus _status; LoopingMode _loopingMode; - + AudioStreams _audioStreams; }; diff --git a/include/osg/ImageUtils b/include/osg/ImageUtils index d3f2a0dc4..782019533 100644 --- a/include/osg/ImageUtils +++ b/include/osg/ImageUtils @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,7 +20,7 @@ namespace osg { -template +template void _readRow(unsigned int num, GLenum pixelFormat, const T* data,float scale, O& operation) { switch(pixelFormat) @@ -35,7 +35,7 @@ void _readRow(unsigned int num, GLenum pixelFormat, const T* data,float scale, O } } -template +template void readRow(unsigned int num, GLenum pixelFormat, GLenum dataType, const unsigned char* data, O& operation) { switch(dataType) @@ -50,11 +50,11 @@ void readRow(unsigned int num, GLenum pixelFormat, GLenum dataType, const unsign } } -template +template void readImage(const osg::Image* image, O& operation) { if (!image) return; - + for(int r=0;rr();++r) { for(int t=0;tt();++t) @@ -67,15 +67,15 @@ void readImage(const osg::Image* image, O& operation) // example ModifyOperator // struct ModifyOperator // { -// inline void luminance(float& l) const {} -// inline void alpha(float& a) const {} -// inline void luminance_alpha(float& l,float& a) const {} +// inline void luminance(float& l) const {} +// inline void alpha(float& a) const {} +// inline void luminance_alpha(float& l,float& a) const {} // inline void rgb(float& r,float& g,float& b) const {} // inline void rgba(float& r,float& g,float& b,float& a) const {} // }; -template +template void _modifyRow(unsigned int num, GLenum pixelFormat, T* data,float scale, const M& operation) { float inv_scale = 1.0f/scale; @@ -91,7 +91,7 @@ void _modifyRow(unsigned int num, GLenum pixelFormat, T* data,float scale, const } } -template +template void modifyRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned char* data, const M& operation) { switch(dataType) @@ -106,11 +106,11 @@ void modifyRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned c } } -template +template void modifyImage(osg::Image* image, const M& operation) { if (!image) return; - + for(int r=0;rr();++r) { for(int t=0;tt();++t) diff --git a/include/osg/KdTree b/include/osg/KdTree index 2ef9add11..4f35d50cc 100644 --- a/include/osg/KdTree +++ b/include/osg/KdTree @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,31 +23,31 @@ namespace osg { /** 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: - - + + KdTree(); - + KdTree(const KdTree& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); META_Shape(osg, KdTree) - + struct OSG_EXPORT BuildOptions { BuildOptions(); - + unsigned int _numVerticesProcessed; unsigned int _targetNumTrianglesPerLeaf; unsigned int _maxNumLevels; }; - - + + /** 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); - + struct LineSegmentIntersection { LineSegmentIntersection(): @@ -77,11 +77,11 @@ class OSG_EXPORT KdTree : public osg::Shape float r2; unsigned int primitiveIndex; - }; - + }; + typedef std::vector LineSegmentIntersections; - + /** 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; @@ -100,15 +100,15 @@ class OSG_EXPORT KdTree : public osg::Shape osg::BoundingBox bb; - value_type first; + value_type first; value_type second; }; - + struct Triangle { Triangle(): p0(0),p1(0),p2(0) {} - + Triangle(unsigned int ip0, unsigned int ip1, unsigned int ip2): p0(ip0), p1(ip1), p2(ip2) {} @@ -131,14 +131,14 @@ class OSG_EXPORT KdTree : public osg::Shape int addNode(const KdNode& node) { - int num = static_cast(_kdNodes.size()); - _kdNodes.push_back(node); + int num = static_cast(_kdNodes.size()); + _kdNodes.push_back(node); return num; } KdNode& getNode(int nodeNum) { return _kdNodes[nodeNum]; } const KdNode& getNode(int nodeNum) const { return _kdNodes[nodeNum]; } - + KdNodeList& getNodes() { 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 { public: - + KdTreeBuilder(); - + KdTreeBuilder(const KdTreeBuilder& rhs); META_NodeVisitor("osg","KdTreeBuilder") @@ -180,17 +180,17 @@ class OSG_EXPORT KdTreeBuilder : public osg::NodeVisitor virtual KdTreeBuilder* clone() { return new KdTreeBuilder(*this); } void apply(osg::Geode& geode); - + KdTree::BuildOptions _buildOptions; osg::ref_ptr _kdTreePrototype; - + protected: - + virtual ~KdTreeBuilder() {} - + }; } diff --git a/include/osg/LOD b/include/osg/LOD index 35a3aa917..9345daabc 100644 --- a/include/osg/LOD +++ b/include/osg/LOD @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,7 +35,7 @@ namespace osg { class OSG_EXPORT LOD : public Group { public : - + LOD(); /** 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; virtual void traverse(NodeVisitor& nv); - + virtual bool addChild(Node *child); virtual bool addChild(Node *child, float min, float max); @@ -56,7 +56,7 @@ class OSG_EXPORT LOD : public Group typedef std::pair MinMaxPair; typedef std::vector RangeList; - + /** Modes which control how the center of object should be determined when computing which child is active.*/ 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.*/ 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.*/ 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. */ 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.*/ inline void setRadius(value_type radius) { _radius = radius; } - + /** Get the object-space radius of the volume enclosed by the LOD.*/ inline value_type getRadius() const { return _radius; } @@ -92,7 +92,7 @@ class OSG_EXPORT LOD : public Group DISTANCE_FROM_EYE_POINT, PIXEL_SIZE_ON_SCREEN }; - + /** Set how the range values should be interpreted when computing which child is active.*/ 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. Values are floating point distance specified in local objects coordinates.*/ void setRange(unsigned int childNo, float min,float max); - + /** returns the min visible range for specified child.*/ inline float getMinRange(unsigned int childNo) const { return _rangeList[childNo].first; } /** returns the max visible range for specified child.*/ 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(). */ inline unsigned int getNumRanges() const { return _rangeList.size(); } diff --git a/include/osg/Light b/include/osg/Light index 58e4bcf2e..d0cb67d97 100644 --- a/include/osg/Light +++ b/include/osg/Light @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -58,7 +58,7 @@ class OSG_EXPORT Light : public StateAttribute _quadratic_attenuation(light._quadratic_attenuation), _spot_exponent(light._spot_exponent), _spot_cutoff(light._spot_cutoff) {} - + virtual osg::Object* cloneType() const { return new Light(_lightnum); } 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(obj)!=NULL; } @@ -96,12 +96,12 @@ class OSG_EXPORT Light : public StateAttribute usage.usesMode(GL_LIGHT0+_lightnum); return true; } - - + + /** Set which OpenGL light to operate on. */ void setLightNum(int num); - + /** Get which OpenGL light this osg::Light operates on. */ int getLightNum() const { return _lightnum; } @@ -123,16 +123,16 @@ class OSG_EXPORT Light : public StateAttribute /** Get the specular component of the light. */ 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; } - /** Get the position of the light. */ + /** Get the position of the light. */ 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; } - /** Get the direction of the light. */ + /** Get the direction of the light. */ inline const Vec3& getDirection() const { return _direction; } /** Set the constant attenuation of the light. */ @@ -174,7 +174,7 @@ class OSG_EXPORT Light : public StateAttribute virtual void apply(State& state) const; protected : - + virtual ~Light(); /** Initialize the light's settings with some decent defaults. */ diff --git a/include/osg/LightModel b/include/osg/LightModel index 310ef7301..696f0f78f 100644 --- a/include/osg/LightModel +++ b/include/osg/LightModel @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -62,7 +62,7 @@ class OSG_EXPORT LightModel : public StateAttribute SEPARATE_SPECULAR_COLOR, SINGLE_COLOR }; - + void setColorControl(ColorControl cc) { _colorControl = cc; } inline ColorControl getColorControl() const { return _colorControl; } diff --git a/include/osg/LightSource b/include/osg/LightSource index 166876039..1131b7120 100644 --- a/include/osg/LightSource +++ b/include/osg/LightSource @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,7 +24,7 @@ namespace osg { class OSG_EXPORT LightSource : public Group { public: - + LightSource(); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ @@ -42,7 +42,7 @@ class OSG_EXPORT LightSource : public Group RELATIVE_RF, ABSOLUTE_RF }; - + /** Set the light sources's ReferenceFrame, either to be relative to its * parent reference frame, or relative to an absolute coordinate * 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. */ void setReferenceFrame(ReferenceFrame rf); - + ReferenceFrame getReferenceFrame() const { return _referenceFrame; } /** Set the attached light. */ diff --git a/include/osg/LineSegment b/include/osg/LineSegment index d368cc6e5..b6b9224b0 100644 --- a/include/osg/LineSegment +++ b/include/osg/LineSegment @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,7 +35,7 @@ class OSG_EXPORT LineSegment : public Referenced 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 vec_type& start() { return _s; } inline const vec_type& start() const { return _s; } @@ -64,7 +64,7 @@ class OSG_EXPORT LineSegment : public Referenced * intersection ratio. */ bool intersect(const BoundingSphere& bs,float& r1,float& r2) const; - + /** return true if segment intersects BoundingSphere and return the * intersection ratio. */ @@ -89,7 +89,7 @@ class OSG_EXPORT LineSegment : public Referenced protected: virtual ~LineSegment(); - + static bool intersectAndClip(vec_type& s,vec_type& e,const BoundingBox& bb); vec_type _s; diff --git a/include/osg/LineStipple b/include/osg/LineStipple index 1179eaa5a..dd52a22d9 100644 --- a/include/osg/LineStipple +++ b/include/osg/LineStipple @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -53,7 +53,7 @@ class OSG_EXPORT LineStipple : public StateAttribute return 0; // passed all the above comparison macros, must be equal. } - + virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const { usage.usesMode(GL_LINE_STIPPLE); diff --git a/include/osg/LineWidth b/include/osg/LineWidth index 61dc926d8..6c458883c 100644 --- a/include/osg/LineWidth +++ b/include/osg/LineWidth @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,9 +29,9 @@ class OSG_EXPORT LineWidth : public StateAttribute LineWidth(const LineWidth& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY) : StateAttribute(lw,copyop), _width(lw._width) {} - + META_StateAttribute(osg, LineWidth, LINEWIDTH); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -46,7 +46,7 @@ class OSG_EXPORT LineWidth : public StateAttribute } void setWidth(float width); - + inline float getWidth() const { return _width; } virtual void apply(State& state) const; diff --git a/include/osg/LogicOp b/include/osg/LogicOp index 37677db9e..2511af1cd 100644 --- a/include/osg/LogicOp +++ b/include/osg/LogicOp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -62,7 +62,7 @@ class OSG_EXPORT LogicOp : public StateAttribute }; LogicOp(); - + LogicOp(Opcode opcode); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ @@ -71,7 +71,7 @@ class OSG_EXPORT LogicOp : public StateAttribute _opcode(trans._opcode){} META_StateAttribute(osg, LogicOp,LOGICOP); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -98,7 +98,7 @@ class OSG_EXPORT LogicOp : public StateAttribute } inline Opcode getOpcode() const { return _opcode; } - + virtual void apply(State& state) const; protected : diff --git a/include/osg/Material b/include/osg/Material index 6a2f41a0e..459d1e4da 100644 --- a/include/osg/Material +++ b/include/osg/Material @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,7 +33,7 @@ class OSG_EXPORT Material : public StateAttribute public : Material(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Material(const Material& mat,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(mat,copyop), @@ -55,7 +55,7 @@ class OSG_EXPORT Material : public StateAttribute _shininessBack(mat._shininessBack) {} META_StateAttribute(osg, Material, MATERIAL); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -108,7 +108,7 @@ class OSG_EXPORT Material : public StateAttribute SPECULAR = GL_SPECULAR, EMISSION = GL_EMISSION, AMBIENT_AND_DIFFUSE = GL_AMBIENT_AND_DIFFUSE, - OFF + OFF }; inline void setColorMode(ColorMode mode) { _colorMode = mode; } @@ -122,27 +122,27 @@ class OSG_EXPORT Material : public StateAttribute const Vec4& getDiffuse(Face face) const; 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. */ void setSpecular( Face face, const Vec4& specular ); - + /** Get the specular value for specified face. */ const Vec4& getSpecular(Face face) const; - + /** Return whether specular values are equal for front and back faces * or not. */ 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. */ void setEmission( Face face, const Vec4& emission ); - + /** Get the emission value for specified face. */ const Vec4& getEmission(Face face) const; - + /** Return whether emission values are equal for front and back faces * or not. */ @@ -152,15 +152,15 @@ class OSG_EXPORT Material : public StateAttribute * valid shininess range is 0.0 to 128.0. */ void setShininess(Face face, float shininess ); - + /** Get the shininess value for specified face. */ float getShininess(Face face) const; - + /** Return whether shininess values are equal for front and back faces * or not. */ inline bool getShininessFrontAndBack() const { return _shininessFrontAndBack; } - + /** Set the alpha value of ambient, diffuse, specular and emission * colors of specified face, to 1-transparency. * Valid transparency range is 0.0 to 1.0. diff --git a/include/osg/Math b/include/osg/Math index 7f10e864d..7d85722e6 100644 --- a/include/osg/Math +++ b/include/osg/Math @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -21,8 +21,8 @@ //certain math functions were not defined until 10.2 //so this code checks the version so it can add in workarounds for older versions. #ifdef __APPLE__ -// Using std::isnan will work for OS X, but use of -// and std:: are not necessarily portible with other systems so +// Using std::isnan will work for OS X, but use of +// and std:: are not necessarily portible with other systems so // the include of is isolated here. #include #include @@ -33,7 +33,7 @@ // 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 // 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) #define APPLE_PRE_10_2 #endif @@ -41,7 +41,7 @@ #if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6) #define APPLE_PRE_10_6 #endif - + #endif #endif @@ -82,7 +82,7 @@ #ifndef sqrtf inline float sqrtf(float value) { return static_cast(sqrt(value)); } #endif - + #ifndef fabsf inline float fabsf(float value) { return static_cast(fabs(value)); } #endif diff --git a/include/osg/Matrix b/include/osg/Matrix index 0e6d93acd..0277e1ea0 100644 --- a/include/osg/Matrix +++ b/include/osg/Matrix @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/MatrixTransform b/include/osg/MatrixTransform index f63f9e440..ebb8afbd0 100644 --- a/include/osg/MatrixTransform +++ b/include/osg/MatrixTransform @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,16 +42,16 @@ class OSG_EXPORT MatrixTransform : public Transform /** Set the transform's matrix.*/ void setMatrix(const Matrix& mat) { _matrix = mat; _inverseDirty=true; dirtyBound(); } - + /** Get the matrix. */ inline const Matrix& getMatrix() const { return _matrix; } /** pre multiply the transform's matrix.*/ void preMult(const Matrix& mat) { _matrix.preMult(mat); _inverseDirty=true; dirtyBound(); } - + /** post multiply the transform's matrix.*/ void postMult(const Matrix& mat) { _matrix.postMult(mat); _inverseDirty=true; dirtyBound(); } - + /** Get the inverse matrix. */ inline const Matrix& getInverseMatrix() const { @@ -69,9 +69,9 @@ class OSG_EXPORT MatrixTransform : public Transform protected : - + virtual ~MatrixTransform(); - + Matrix _matrix; mutable Matrix _inverse; mutable bool _inverseDirty; diff --git a/include/osg/Matrixd b/include/osg/Matrixd index 3e50124b6..18eca9a57 100644 --- a/include/osg/Matrixd +++ b/include/osg/Matrixd @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ class Matrixf; class OSG_EXPORT Matrixd { public: - + typedef double value_type; typedef float other_value_type; @@ -65,7 +65,7 @@ class OSG_EXPORT Matrixd set(rhs.ptr()); return *this; } - + Matrixd& operator = (const Matrixf& other); inline void set(const Matrixd& rhs) { set(rhs.ptr()); } @@ -77,7 +77,7 @@ class OSG_EXPORT Matrixd value_type* local_ptr = (value_type*)_mat; for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; } - + inline void set(double const * const ptr) { 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 a20, value_type a21, value_type a22,value_type a23, value_type a30, value_type a31, value_type a32,value_type a33); - + value_type * ptr() { return (value_type*)_mat; } const value_type * ptr() const { return (const value_type *)_mat; } @@ -101,39 +101,39 @@ class OSG_EXPORT Matrixd } void makeIdentity(); - + void makeScale( const Vec3f& ); void makeScale( const Vec3d& ); void makeScale( value_type, value_type, value_type ); - + void makeTranslate( const Vec3f& ); void makeTranslate( const Vec3d& ); void makeTranslate( value_type, value_type, value_type ); - + void makeRotate( const Vec3f& from, const Vec3f& to ); void makeRotate( const Vec3d& from, const Vec3d& to ); void makeRotate( value_type angle, const Vec3f& 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( 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 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 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, - osg::Quat& rotation, - osg::Vec3f& scale, + osg::Quat& rotation, + osg::Vec3f& scale, 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, - osg::Quat& rotation, - osg::Vec3d& scale, + osg::Quat& rotation, + osg::Vec3d& scale, osg::Quat& so ) const; @@ -242,8 +242,8 @@ class OSG_EXPORT Matrixd /** full 4x4 matrix invert. */ bool invert_4x4( const Matrixd& rhs); - /** ortho-normalize the 3x3 rotation & scale matrix */ - void orthoNormalize(const Matrixd& rhs); + /** ortho-normalize the 3x3 rotation & scale matrix */ + void orthoNormalize(const Matrixd& rhs); // basic utility functions to create new matrices 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, const Vec3f& 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 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 angle3, const Vec3d& axis3); inline static Matrixd rotate( const Quat& quat); 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. * 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( const Vec3f& 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 { - 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 z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); - return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); + 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 z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); + return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } - + /** apply a 3x3 transform of v*M[0..2,0..2]. */ inline static Vec3f transform3x3(const Vec3f& v,const Matrixd& m); @@ -382,12 +382,12 @@ class OSG_EXPORT Matrixd /** Optimized version of postMult(rotate(q)); */ inline void postMultRotate( const Quat& q ); - inline void operator *= ( const Matrixd& other ) + inline void operator *= ( const Matrixd& other ) { if( this == &other ) { Matrixd temp(other); postMult( temp ); } - else postMult( other ); + else postMult( other ); } inline Matrixd operator * ( const Matrixd &m ) const @@ -405,7 +405,7 @@ class OSG_EXPORT Matrixd class RefMatrixd : public Object, public Matrixd { public: - + RefMatrixd():Object(false), Matrixd() {} RefMatrixd( const Matrixd& 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 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): - Object(false), + Object(false), Matrixd(a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, 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 bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "Matrix"; } - - + + protected: - + virtual ~RefMatrixd() {} }; @@ -498,7 +498,7 @@ inline Matrixd Matrixd::rotate(value_type angle, const Vec3d& axis ) m.makeRotate(angle,axis); 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 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); 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 angle3, const Vec3d& axis3) { @@ -538,7 +538,7 @@ inline Matrixd Matrixd::orthoNormal(const Matrixd& matrix) { Matrixd m; m.orthoNormalize(matrix); - return m; + return m; } inline Matrixd Matrixd::ortho(double left, double right, diff --git a/include/osg/Matrixf b/include/osg/Matrixf index 586eb447c..0d60501f8 100644 --- a/include/osg/Matrixf +++ b/include/osg/Matrixf @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ class Matrixf; class OSG_EXPORT Matrixf { public: - + typedef float value_type; typedef double other_value_type; @@ -65,7 +65,7 @@ class OSG_EXPORT Matrixf set(rhs.ptr()); return *this; } - + Matrixf& operator = (const Matrixd& other); inline void set(const Matrixf& rhs) { set(rhs.ptr()); } @@ -77,7 +77,7 @@ class OSG_EXPORT Matrixf value_type* local_ptr = (value_type*)_mat; for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; } - + inline void set(double const * const ptr) { 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 a20, value_type a21, value_type a22,value_type a23, value_type a30, value_type a31, value_type a32,value_type a33); - + value_type * ptr() { return (value_type*)_mat; } const value_type * ptr() const { return (const value_type *)_mat; } @@ -101,39 +101,39 @@ class OSG_EXPORT Matrixf } void makeIdentity(); - + void makeScale( const Vec3f& ); void makeScale( const Vec3d& ); void makeScale( value_type, value_type, value_type ); - + void makeTranslate( const Vec3f& ); void makeTranslate( const Vec3d& ); void makeTranslate( value_type, value_type, value_type ); - + void makeRotate( const Vec3f& from, const Vec3f& to ); void makeRotate( const Vec3d& from, const Vec3d& to ); void makeRotate( value_type angle, const Vec3f& 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( 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 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 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, - osg::Quat& rotation, - osg::Vec3f& scale, + osg::Quat& rotation, + osg::Vec3f& scale, 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, - osg::Quat& rotation, - osg::Vec3d& scale, + osg::Quat& rotation, + osg::Vec3d& scale, osg::Quat& so ) const; @@ -242,8 +242,8 @@ class OSG_EXPORT Matrixf /** full 4x4 matrix invert. */ bool invert_4x4( const Matrixf& rhs); - /** ortho-normalize the 3x3 rotation & scale matrix */ - void orthoNormalize(const Matrixf& rhs); + /** ortho-normalize the 3x3 rotation & scale matrix */ + void orthoNormalize(const Matrixf& rhs); //basic utility functions to create new matrices 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, const Vec3f& 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 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 angle3, const Vec3d& axis3); inline static Matrixf rotate( const Quat& quat); 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. * 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( const Vec3f& 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 { - 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 z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); - return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); + 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 z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); + return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } - + /** apply a 3x3 transform of v*M[0..2,0..2]. */ inline static Vec3f transform3x3(const Vec3f& v,const Matrixf& m); @@ -384,12 +384,12 @@ class OSG_EXPORT Matrixf /** Optimized version of postMult(rotate(q)); */ inline void postMultRotate( const Quat& q ); - inline void operator *= ( const Matrixf& other ) + inline void operator *= ( const Matrixf& other ) { if( this == &other ) { Matrixf temp(other); postMult( temp ); } - else postMult( other ); + else postMult( other ); } inline Matrixf operator * ( const Matrixf &m ) const @@ -429,7 +429,7 @@ class OSG_EXPORT Matrixf _mat[3][2]*=rhs; _mat[3][3]*=rhs; return *this; - } + } /** Divide by scalar. */ inline Matrixf operator / (value_type rhs) const @@ -461,7 +461,7 @@ class OSG_EXPORT Matrixf _mat[3][2]/=rhs; _mat[3][3]/=rhs; return *this; - } + } /** Binary vector add. */ inline Matrixf operator + (const Matrixf& rhs) const @@ -482,7 +482,7 @@ class OSG_EXPORT Matrixf _mat[3][0] + rhs._mat[3][0], _mat[3][1] + rhs._mat[3][1], _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 @@ -507,7 +507,7 @@ class OSG_EXPORT Matrixf _mat[3][2] += rhs._mat[3][2]; _mat[3][3] += rhs._mat[3][3]; return *this; - } + } protected: value_type _mat[4][4]; @@ -517,7 +517,7 @@ class OSG_EXPORT Matrixf class RefMatrixf : public Object, public Matrixf { public: - + RefMatrixf():Object(false), Matrixf() {} RefMatrixf( const Matrixf& 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 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): - Object(false), + Object(false), Matrixf(a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, 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 bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "Matrix"; } - - + + protected: - + virtual ~RefMatrixf() {} }; @@ -610,7 +610,7 @@ inline Matrixf Matrixf::rotate(value_type angle, const Vec3d& axis ) m.makeRotate(angle,axis); 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 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); 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 angle3, const Vec3d& axis3) { @@ -650,7 +650,7 @@ inline Matrixf Matrixf::orthoNormal(const Matrixf& matrix) { Matrixf m; m.orthoNormalize(matrix); - return m; + return m; } inline Matrixf Matrixf::ortho(double left, double right, diff --git a/include/osg/MixinVector b/include/osg/MixinVector index 0ed454c38..bd8b53633 100644 --- a/include/osg/MixinVector +++ b/include/osg/MixinVector @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -84,7 +84,7 @@ public: void clear() { _impl.clear(); } 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 swap(vector_type& other) { _impl.swap(other); } void swap(MixinVector& other) { _impl.swap(other._impl); } diff --git a/include/osg/Multisample b/include/osg/Multisample index 322085a02..60477a932 100644 --- a/include/osg/Multisample +++ b/include/osg/Multisample @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -45,13 +45,13 @@ class OSG_EXPORT Multisample : public StateAttribute enum Mode { - FASTEST = GL_FASTEST, + FASTEST = GL_FASTEST, NICEST = GL_NICEST, - DONT_CARE = GL_DONT_CARE + DONT_CARE = GL_DONT_CARE }; Multisample(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ Multisample(const Multisample& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(trans,copyop), @@ -60,7 +60,7 @@ class OSG_EXPORT Multisample : public StateAttribute _mode(trans._mode) {} META_StateAttribute(osg, Multisample,MULTISAMPLE); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ 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. } - void setSampleCoverage(float coverage, bool invert) + void setSampleCoverage(float coverage, bool invert) { - _coverage = coverage; + _coverage = coverage; _invert = invert; } inline void setCoverage(float coverage) { _coverage=coverage; } inline float getCoverage() const { return _coverage; } - + inline void setInvert(bool invert) { _invert=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 - * associated function pointers, and provide convenience wrappers to - * check for the extensions or use the associated functions.*/ + * associated function pointers, and provide convenience wrappers to + * check for the extensions or use the associated functions.*/ class OSG_EXPORT Extensions : public osg::Referenced { public: Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setMultisampleSupported(bool flag) { _isMultisampleSupported=flag; } void setMultisampleFilterHintSupported(bool flag) { _isMultisampleFilterHintSupported=flag; } bool isMultisampleSupported() const { return _isMultisampleSupported; } bool isMultisampleFilterHintSupported() const { return _isMultisampleFilterHintSupported; } - + void glSampleCoverage(GLclampf value, GLboolean invert) const; protected: ~Extensions() {} - + bool _isMultisampleSupported; bool _isMultisampleFilterHintSupported; - + typedef void (GL_APIENTRY * GLSampleCoverageProc) (GLclampf value, GLboolean invert); GLSampleCoverageProc _glSampleCoverage; }; - + /** 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. - * 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 * only be created with the graphics context associated with ContextID..*/ static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); diff --git a/include/osg/Node b/include/osg/Node index 16029632c..343277468 100644 --- a/include/osg/Node +++ b/include/osg/Node @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -59,7 +59,7 @@ typedef std::vector< Matrix > MatrixList; virtual const char* className() const { return #name; } \ 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(); } } \ - + /** Base class for all internal nodes in the scene graph. Provides interface for most common node operations (Composite Pattern). @@ -69,7 +69,7 @@ class OSG_EXPORT Node : public Object public: /** 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.*/ Node(); @@ -145,7 +145,7 @@ class OSG_EXPORT Node : public Object /** Traverse upwards : calls parents' accept method with NodeVisitor.*/ virtual void ascend(NodeVisitor& nv); /** 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.*/ typedef std::vector ParentList; @@ -153,7 +153,7 @@ class OSG_EXPORT Node : public Object /** Get the parent list of node. */ 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.*/ 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. * The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */ MatrixList getWorldMatrices(const osg::Node* haltTraversalAtNode=0) const; - + /** Set update node callback, called during update traversal. */ 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.*/ inline unsigned int getNumChildrenWithOccluderNodes() const { return _numChildrenWithOccluderNodes; } - + /** return true if this node is an OccluderNode or the subgraph below this node are OccluderNodes.*/ bool containsOccluderNodes() const; @@ -353,7 +353,7 @@ class OSG_EXPORT Node : public Object /** Add a description string to the node.*/ void addDescription(const std::string& desc); - + /** Set the initial bounding volume to use when computing the overall bounding volume.*/ void setInitialBound(const osg::BoundingSphere& bsphere) { _initialBound = bsphere; dirtyBound(); } @@ -372,11 +372,11 @@ class OSG_EXPORT Node : public Object if(!_boundingSphereComputed) { _boundingSphere = _initialBound; - if (_computeBoundCallback.valid()) + if (_computeBoundCallback.valid()) _boundingSphere.expandBy(_computeBoundCallback->computeBound(*this)); else _boundingSphere.expandBy(computeBound()); - + _boundingSphereComputed = true; } return _boundingSphere; @@ -458,10 +458,10 @@ class OSG_EXPORT Node : public Object ref_ptr _cullCallback; bool _cullingActive; - unsigned int _numChildrenWithCullingDisabled; + unsigned int _numChildrenWithCullingDisabled; void setNumChildrenWithCullingDisabled(unsigned int num); - unsigned int _numChildrenWithOccluderNodes; + unsigned int _numChildrenWithOccluderNodes; void setNumChildrenWithOccluderNodes(unsigned int num); NodeMask _nodeMask; diff --git a/include/osg/NodeCallback b/include/osg/NodeCallback index 949f97ca0..ae3254eb9 100644 --- a/include/osg/NodeCallback +++ b/include/osg/NodeCallback @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,33 +25,33 @@ class NodeVisitor; class OSG_EXPORT NodeCallback : public virtual Object { public : - + NodeCallback(){} NodeCallback(const NodeCallback& nc,const CopyOp&): _nestedCallback(nc._nestedCallback) {} - + META_Object(osg,NodeCallback); - - + + /** Callback method called by the NodeVisitor when visiting a node.*/ virtual void operator()(Node* node, NodeVisitor* nv) - { + { // note, callback is responsible for scenegraph traversal so // they must call traverse(node,nv) to ensure that the // scene graph subtree (and associated callbacks) are traversed. traverse(node,nv); } - + /** Call any nested callbacks and then traverse the scene graph. */ void traverse(Node* node,NodeVisitor* nv); - + void setNestedCallback(NodeCallback* nc) { _nestedCallback = nc; } NodeCallback* getNestedCallback() { return _nestedCallback.get(); } const NodeCallback* getNestedCallback() const { return _nestedCallback.get(); } - + inline void addNestedCallback(NodeCallback* nc) { if (nc) @@ -67,7 +67,7 @@ class OSG_EXPORT NodeCallback : public virtual Object { } } } - + inline void removeNestedCallback(NodeCallback* nc) { if (nc) @@ -82,13 +82,13 @@ class OSG_EXPORT NodeCallback : public virtual Object { } } } - + public: ref_ptr _nestedCallback; - + protected: - + virtual ~NodeCallback() {} }; diff --git a/include/osg/NodeTrackerCallback b/include/osg/NodeTrackerCallback index 3b79bca3e..ed35229f9 100644 --- a/include/osg/NodeTrackerCallback +++ b/include/osg/NodeTrackerCallback @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/NodeVisitor b/include/osg/NodeVisitor index fe85bbe7e..7e8a7e5c7 100644 --- a/include/osg/NodeVisitor +++ b/include/osg/NodeVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -49,7 +49,7 @@ const unsigned int UNINITIALIZED_FRAME_NUMBER=0xffffffff; virtual const char* className() const { return #name; } /** 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 in the scene graph (as per Visitor pattern), and adds to this 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 myVisitor.apply(*root). The later method will bypass the double dispatch and the appropriate NodeVisitor::apply(..) method will - not be called. */ + not be called. */ class OSG_EXPORT NodeVisitor : public virtual Referenced { public: @@ -73,7 +73,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced TRAVERSE_ALL_CHILDREN, TRAVERSE_ACTIVE_CHILDREN }; - + enum VisitorType { NODE_VISITOR = 0, @@ -84,11 +84,11 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced }; NodeVisitor(TraversalMode tm=TRAVERSE_NONE); - + NodeVisitor(VisitorType type,TraversalMode tm=TRAVERSE_NONE); - + virtual ~NodeVisitor(); - + /** return the library name/namespapce of the visitor's. Should be defined by derived classes.*/ 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"; } /** 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 each traversal.*/ 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 * to select which behaviour to use for different types of traversal/visitors.*/ inline void setVisitorType(VisitorType type) { _visitorType = type; } - + /** Get the VisitorType.*/ inline VisitorType getVisitorType() const { return _visitorType; } /** Set the traversal number. Typically used to denote the frame count.*/ inline void setTraversalNumber(unsigned int fn) { _traversalNumber = fn; } - + /** Get the traversal number. Typically used to denote the frame count.*/ inline unsigned int getTraversalNumber() const { return _traversalNumber; } /** Set the FrameStamp that this traversal is associated with.*/ inline void setFrameStamp(FrameStamp* fs) { _frameStamp = fs; } - + /** Get the FrameStamp that this traversal is associated with.*/ 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; } /** 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. * Typically used to force on nodes which may have * been switched off by their own Node::_nodeMask.*/ @@ -146,7 +146,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced /** Get the NodeMaskOverride mask.*/ inline Node::NodeMask getNodeMaskOverride() const { return _nodeMaskOverride; } - + /** 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. * 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; } - /** 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 NodeVisitor has been attached via setTraverseVisitor() and the new mode is not TRAVERSE_VISITOR then the attached visitor is detached. Default mode is TRAVERSE_NONE.*/ inline void setTraversalMode(TraversalMode mode) { _traversalMode = mode; } - + /** Get the traversal mode.*/ inline TraversalMode getTraversalMode() const { return _traversalMode; } /** * 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 * which points to your own objects and handles the memory addressing. */ inline void setUserData(Referenced* obj) { _userData = obj; } - + /** Get user data.*/ inline Referenced* getUserData() { return _userData.get(); } - + /** Get const user data.*/ inline const Referenced* getUserData() const { return _userData.get(); } /** 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 this method unless they handle traversal directly.*/ inline void traverse(Node& node) @@ -192,22 +192,22 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced if (_traversalMode==TRAVERSE_PARENTS) node.ascend(*this); else if (_traversalMode!=TRAVERSE_NONE) node.traverse(*this); } - + /** Method called by osg::Node::accept() method before * a call to the NodeVisitor::apply(..). The back of the list will, * 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. * Note, the user does not typically call pushNodeOnPath() as it * 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); } - + /** Method called by osg::Node::accept() method after * a call to NodeVisitor::apply(..). * Note, the user does not typically call popFromNodePath() as it * will be called automatically by the Node::accept() method.*/ 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 * to the current Node being visited.*/ 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 * to the current Node being visited.*/ const NodePath& getNodePath() const { return _nodePath; } - + /** Get the eye point in local coordinates. * 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); } @@ -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. * 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 void apply(Node& node); - + virtual void apply(Geode& node); virtual void apply(Billboard& node); - + virtual void apply(Group& node); virtual void apply(ProxyNode& node); @@ -300,23 +300,23 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced class ImageRequestHandler : public osg::Referenced { public: - + ImageRequestHandler(): Referenced(true) {} virtual double getPreLoadTime() const = 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; - + protected: virtual ~ImageRequestHandler() {} }; - + /** Set the handler for image requests.*/ void setImageRequestHandler(ImageRequestHandler* handler) { _imageRequestHandler = handler; } - + /** Get the handler for image requests.*/ ImageRequestHandler* getImageRequestHandler() { return _imageRequestHandler.get(); } @@ -329,13 +329,13 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced VisitorType _visitorType; unsigned int _traversalNumber; - + ref_ptr _frameStamp; - + TraversalMode _traversalMode; Node::NodeMask _traversalMask; Node::NodeMask _nodeMaskOverride; - + NodePath _nodePath; ref_ptr _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 { public: diff --git a/include/osg/Notify b/include/osg/Notify index b7ad579b4..9e21a8695 100644 --- a/include/osg/Notify +++ b/include/osg/Notify @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -57,7 +57,7 @@ extern OSG_EXPORT bool initNotifyLevel(); /** notify messaging function for providing fatal through to verbose * 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. * - setenv OSGNOTIFYLEVEL DEBUG (for tsh) * - 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 * to the notification stream (useful for debugging) setting ALWAYS will force * 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 * 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 * osg::notify(osg::DEBUG) << "Hello Bugs!" << std::endl; * @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_FP OSG_NOTIFY(osg::DEBUG_FP) -/** Handler processing output of notification stream. It acts as a sink to - * notification messages. It is called when notification stream needs to be +/** Handler processing output of notification stream. It acts as a sink to + * notification messages. It is called when notification stream needs to be * 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). - * 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. * 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 * widgets you must take care of thread safety on your own. * @see setNotifyHandler @@ -128,7 +128,7 @@ public: #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. * @see setNotifyHandler */ diff --git a/include/osg/Object b/include/osg/Object index 458796755..4a0e8d8fc 100644 --- a/include/osg/Object +++ b/include/osg/Object @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,8 +32,8 @@ class UserDataContainer; #define ADDQUOTES(def) _ADDQUOTES(def) /** META_Object macro define the standard clone, isSameKindAs and className methods. - * Use when subclassing from Object to make it more convenient to define - * the standard pure virtual clone, isSameKindAs and className methods + * Use when subclassing from Object to make it more convenient to define + * the standard pure virtual clone, isSameKindAs and className methods * which are required for all Object subclasses.*/ #define META_Object(library,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* 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. Based on GOF Composite, Prototype and Template Method patterns. */ @@ -106,7 +106,7 @@ class OSG_EXPORT Object : public Referenced STATIC, UNSPECIFIED }; - + /** 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, * 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.*/ inline DataVariance getDataVariance() const { return _dataVariance; } - + /** Compute the DataVariance based on an assessment of callback etc.*/ virtual void computeDataVariance() {} @@ -137,7 +137,7 @@ class OSG_EXPORT Object : public Referenced /** * 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 * 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.*/ virtual const Referenced* getUserData() const; - + /** Convinience method that casts the named UserObject to osg::TemplateValueObject and gets the value. @@ -162,7 +162,7 @@ class OSG_EXPORT Object : public Referenced template void setUserValue(const std::string& name, const T& value); - + /** Resize any per context GLObject buffers to specified size. */ 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 = new Node().*/ virtual ~Object(); - + std::string _name; DataVariance _dataVariance; @@ -261,7 +261,7 @@ T* cloneType(const T* t) return 0; } } - + } #endif diff --git a/include/osg/OccluderNode b/include/osg/OccluderNode index 5250ad1d9..40105f8cb 100644 --- a/include/osg/OccluderNode +++ b/include/osg/OccluderNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,31 +26,31 @@ namespace osg { class OSG_EXPORT OccluderNode : public Group { public : - + OccluderNode(); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ OccluderNode(const OccluderNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Node(osg, OccluderNode); - - /** Attach a ConvexPlanarOccluder to an OccluderNode.*/ + + /** Attach a ConvexPlanarOccluder to an OccluderNode.*/ void setOccluder(ConvexPlanarOccluder* occluder) { _occluder = occluder; } - + /** Get the ConvexPlanarOccluder* attached to a OccluderNode. */ 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(); } /** Overrides Group's computeBound.*/ virtual BoundingSphere computeBound() const; protected : - + virtual ~OccluderNode() {} - + ref_ptr _occluder; }; diff --git a/include/osg/OcclusionQueryNode b/include/osg/OcclusionQueryNode index 9090d459a..07285f809 100644 --- a/include/osg/OcclusionQueryNode +++ b/include/osg/OcclusionQueryNode @@ -1,14 +1,14 @@ // // 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 -// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or +// This library is open source and may be redistributed and/or modified under +// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or // (at your option) any later version. The full license is in LICENSE file // included with this distribution, and on the openscenegraph.org website. -// +// // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // OpenSceneGraph Public License for more details. // @@ -75,11 +75,11 @@ public: unsigned int getNumPixels( const osg::Camera* cam ); virtual void releaseGLObjects( osg::State* state = 0 ) const; - + static void deleteQueryObject( unsigned int contextID, GLuint handle ); static void flushDeletedQueryObjects( unsigned int contextID, double currentTime, double& availableTime ); static void discardDeletedQueryObjects( unsigned int contextID ); - + protected: typedef std::map< const osg::Camera*, TestResult > ResultMap; mutable ResultMap _results; @@ -107,8 +107,8 @@ public: virtual osg::BoundingSphere computeBound() const; virtual void releaseGLObjects( osg::State* state = 0 ) const; - - + + // When disabled, OQN doesn't perform occlusion queries, and simply // renders its children. void setQueriesEnabled( bool enable=true ); @@ -153,8 +153,8 @@ public: // For statistics gathering, e.g., by a NodeVisitor. bool getPassed() const; - - + + // These methods are public so that osgUtil::CullVisitor can access them. // Not intended for application use. virtual bool getPassed( const osg::Camera* camera, osg::NodeVisitor& nv ); diff --git a/include/osg/OperationThread b/include/osg/OperationThread index 6d3ef2c6e..c9c84cbbf 100644 --- a/include/osg/OperationThread +++ b/include/osg/OperationThread @@ -63,20 +63,20 @@ class Operation : virtual public Referenced /** Get the human readable name of the operation.*/ 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; } - /** 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; } /** if this operation is a barrier then release it.*/ virtual void release() {} - /** Do the actual task of this operation.*/ + /** Do the actual task of this operation.*/ virtual void operator () (Object*) = 0; protected: - + Operation(): Referenced(true), _keep(false) {} @@ -97,23 +97,23 @@ class OperationThread; class OSG_EXPORT OperationQueue : public Referenced { public: - + OperationQueue(); - - /** Get the next operation from the operation queue. - * Return null ref_ptr<> if no operations are left in queue. */ + + /** Get the next operation from the operation queue. + * Return null ref_ptr<> if no operations are left in queue. */ osg::ref_ptr getNextOperation(bool blockIfEmpty = false); /** Return true if the operation queue is empty. */ bool empty(); - + /** Return the num of pending operations that are sitting in the OperationQueue.*/ 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.*/ void add(Operation* operation); - + /** Remove operation from OperationQueue.*/ void remove(Operation* operation); @@ -122,18 +122,18 @@ class OSG_EXPORT OperationQueue : public Referenced /** Remove all operations from OperationQueue.*/ void removeAllOperations(); - + /** Run the operations. */ void runOperations(Object* callingObject=0); /** 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.*/ void releaseOperationsBlock(); typedef std::set OperationThreads; - + /** Get the set of OperationThreads that are sharing this OperationQueue. */ const OperationThreads& getOperationThreads() const { return _operationThreads; } @@ -142,10 +142,10 @@ class OSG_EXPORT OperationQueue : public Referenced virtual ~OperationQueue(); friend class OperationThread; - + void addOperationThread(OperationThread* thread); void removeOperationThread(OperationThread* thread); - + typedef std::list< osg::ref_ptr > Operations; OpenThreads::Mutex _operationsMutex; @@ -165,7 +165,7 @@ class OSG_EXPORT OperationThread : public Referenced, public OpenThreads::Thread void setParent(Object* parent) { _parent = parent; } Object* getParent() { 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. */ 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.*/ void add(Operation* operation); - + /** Remove operation from OperationQueue.*/ void remove(Operation* operation); @@ -192,24 +192,24 @@ class OSG_EXPORT OperationThread : public Referenced, public OpenThreads::Thread /** Remove all operations from OperationQueue.*/ void removeAllOperations(); - + /** Get the operation currently being run.*/ osg::ref_ptr getCurrentOperation() { return _currentOperation; } /** Run does the opertion thread run loop.*/ virtual void run(); - + void setDone(bool done); - + bool getDone() const { return _done; } - /** Cancel this graphics thread.*/ + /** Cancel this graphics thread.*/ virtual int cancel(); protected: - + virtual ~OperationThread(); - + observer_ptr _parent; bool _done; diff --git a/include/osg/PagedLOD b/include/osg/PagedLOD index a4d527fb8..17b2cd626 100644 --- a/include/osg/PagedLOD +++ b/include/osg/PagedLOD @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,18 +23,18 @@ namespace osg { class OSG_EXPORT PagedLOD : public LOD { public : - + PagedLOD(); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ PagedLOD(const PagedLOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Node(osg, PagedLOD); - - + + virtual void traverse(NodeVisitor& nv); - + virtual bool addChild(Node *child); 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.*/ inline const std::string& getDatabasePath() const { return _databasePath; } - + struct OSG_EXPORT PerRangeData { PerRangeData(); @@ -79,7 +79,7 @@ class OSG_EXPORT PagedLOD : public LOD }; typedef std::vector PerRangeDataList; - + void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; } const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; } unsigned int getNumFileNames() const { return _perRangeDataList.size(); } @@ -113,18 +113,18 @@ class OSG_EXPORT PagedLOD : public LOD 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. - * 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.*/ osg::ref_ptr& getDatabaseRequest(unsigned int childNo) { return _perRangeDataList[childNo]._databaseRequest; } - - /** Return the const DatabaseRequest object.*/ + + /** Return the const DatabaseRequest object.*/ const osg::ref_ptr& getDatabaseRequest(unsigned int childNo) const { return _perRangeDataList[childNo]._databaseRequest; } /** 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; } @@ -150,11 +150,11 @@ class OSG_EXPORT PagedLOD : public LOD * this allows the children to be deleted later at the caller's discretion. * Return true if children are removed, false otherwise. */ virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren); - + protected : - + virtual ~PagedLOD(); - + void expandPerRangeDataTo(unsigned int pos); ref_ptr _databaseOptions; diff --git a/include/osg/Plane b/include/osg/Plane index 4af8c8f27..bb9b03342 100644 --- a/include/osg/Plane +++ b/include/osg/Plane @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -27,7 +27,7 @@ namespace osg { /** @brief A plane class. It can be used to represent an infinite plane. - * + * * The infinite plane is described by an implicit plane equation a*x+b*y+c*z+d = 0. Though it is not mandatory that * a^2+b^2+c^2 = 1 is fulfilled in general some methods require it (@see osg::Plane::distance). */ class OSG_EXPORT Plane @@ -193,7 +193,7 @@ class OSG_EXPORT Plane inline Vec3_type getNormal() const { return Vec3_type(_fv[0],_fv[1],_fv[2]); } - + /** Calculate the distance between a point and the plane. * @remark This method only leads to real distance values if the plane's norm is 1. * @sa osg::Plane::makeUnitLength */ @@ -322,7 +322,7 @@ class OSG_EXPORT Plane } /** Transform the plane by matrix. Note, this operation carries out - * the calculation of the inverse of the matrix since a plane + * the calculation of the inverse of the matrix since a plane * must be multiplied by the inverse transposed to transform it. This * make this operation expensive. If the inverse has been already * calculated elsewhere then use transformProvidingInverse() instead. @@ -359,4 +359,4 @@ class OSG_EXPORT Plane } // end of namespace -#endif +#endif diff --git a/include/osg/Point b/include/osg/Point index e364612bb..1c5f2592d 100644 --- a/include/osg/Point +++ b/include/osg/Point @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -46,7 +46,7 @@ class OSG_EXPORT Point : public StateAttribute _maxSize(point._maxSize) {} META_StateAttribute(osg, Point, POINT); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ virtual int compare(const StateAttribute& sa) const { @@ -89,16 +89,16 @@ class OSG_EXPORT Point : public StateAttribute /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ class OSG_EXPORT Extensions : public osg::Referenced { public: Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setPointParametersSupported(bool flag) { _isPointParametersSupported=flag; } @@ -114,7 +114,7 @@ class OSG_EXPORT Point : public StateAttribute protected: ~Extensions() {} - + bool _isPointParametersSupported; bool _isPointSpriteCoordOriginSupported; @@ -127,7 +127,7 @@ class OSG_EXPORT Point : public StateAttribute GLPointParameterfvProc _glPointParameterfv; }; - + /** Returns the Extensions object for the given context. * If createIfNotInitalized is true and the Extensions object doesn't * exist, getExtensions() creates it on the given context. diff --git a/include/osg/PointSprite b/include/osg/PointSprite index 349fa816b..a127cea4b 100644 --- a/include/osg/PointSprite +++ b/include/osg/PointSprite @@ -37,7 +37,7 @@ public: PointSprite(); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - PointSprite(const PointSprite& ps,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): + PointSprite(const PointSprite& ps,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): StateAttribute(ps,copyop), _coordOriginMode(ps._coordOriginMode) {} @@ -60,18 +60,18 @@ public: virtual void apply(osg::State& state) const; static bool isPointSpriteSupported(unsigned int context); - + enum CoordOriginMode { UPPER_LEFT = GL_UPPER_LEFT, LOWER_LEFT = GL_LOWER_LEFT }; - + inline void setCoordOriginMode(CoordOriginMode mode) { _coordOriginMode = mode; } inline CoordOriginMode getCoordOriginMode() const { return _coordOriginMode; } protected: virtual ~PointSprite(); - + CoordOriginMode _coordOriginMode; }; diff --git a/include/osg/PolygonMode b/include/osg/PolygonMode index 98d549998..daa326788 100644 --- a/include/osg/PolygonMode +++ b/include/osg/PolygonMode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ namespace osg { /** State Class for setting OpenGL's polygon culling mode. -*/ +*/ class OSG_EXPORT PolygonMode : public StateAttribute { public : diff --git a/include/osg/PolygonOffset b/include/osg/PolygonOffset index 360fd0490..15ad397e9 100644 --- a/include/osg/PolygonOffset +++ b/include/osg/PolygonOffset @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -16,7 +16,7 @@ #include -#ifndef GL_POLYGON_OFFSET_LINE +#ifndef GL_POLYGON_OFFSET_LINE #define GL_POLYGON_OFFSET_LINE 0x2A02 #define GL_POLYGON_OFFSET_POINT 0x2A01 #endif @@ -66,7 +66,7 @@ class OSG_EXPORT PolygonOffset : public StateAttribute inline void setFactor(float factor) { _factor = factor; } inline float getFactor() const { return _factor; } - + inline void setUnits(float units) { _units = units; } inline float getUnits() const { return _units; } @@ -78,9 +78,9 @@ class OSG_EXPORT PolygonOffset : public StateAttribute static void setUnitsMultiplier(float multiplier); static float getUnitsMultiplier(); - + static bool areFactorAndUnitsMultipliersSet(); - + /** Checks with the OpenGL driver to try and pick multiplier appropriate for the hardware. note, requires a valid graphics context to be current. */ static void setFactorAndUnitsMultipliersUsingBestGuessForDriver(); diff --git a/include/osg/PolygonStipple b/include/osg/PolygonStipple index 5d9720566..80186987f 100644 --- a/include/osg/PolygonStipple +++ b/include/osg/PolygonStipple @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // -*- Mode: c++ -*- diff --git a/include/osg/Polytope b/include/osg/Polytope index 4fc570d1d..1e9c0c7a7 100644 --- a/include/osg/Polytope +++ b/include/osg/Polytope @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,12 +34,12 @@ class OSG_EXPORT Polytope inline Polytope() {setupMask();} - inline Polytope(const Polytope& cv) : + inline Polytope(const Polytope& cv) : _maskStack(cv._maskStack), _resultMask(cv._resultMask), _planeList(cv._planeList), _referenceVertexList(cv._referenceVertexList) {} - + inline Polytope(const PlaneList& pl) : _planeList(pl) {setupMask();} inline ~Polytope() {} @@ -55,7 +55,7 @@ class OSG_EXPORT Polytope _referenceVertexList = cv._referenceVertexList; return *this; } - + /** Create a Polytope which is a cube, centered at 0,0,0, with sides of 2 units.*/ void setToUnitFrustum(bool withNear=true, bool withFar=true) { @@ -94,7 +94,7 @@ class OSG_EXPORT Polytope _planeList.clear(); return; } - + ClippingMask selector_mask = 0x1; unsigned int numActivePlanes = 0; @@ -108,7 +108,7 @@ class OSG_EXPORT Polytope if (resultMask&selector_mask) ++numActivePlanes; selector_mask <<= 1; } - + _planeList.resize(numActivePlanes); _resultMask = 0; selector_mask = 0x1; @@ -130,8 +130,8 @@ class OSG_EXPORT Polytope } inline void set(const PlaneList& pl) { _planeList = pl; setupMask(); } - - + + inline void add(const osg::Plane& pl) { _planeList.push_back(pl); setupMask(); } /** flip/reverse the orientation of all the planes.*/ @@ -144,7 +144,7 @@ class OSG_EXPORT Polytope itr->flip(); } } - + inline bool empty() const { return _planeList.empty(); } inline PlaneList& getPlaneList() { return _planeList; } @@ -155,7 +155,7 @@ class OSG_EXPORT Polytope inline void setReferenceVertexList(VertexList& vertices) { _referenceVertexList=vertices; } inline VertexList& getReferenceVertexList() { return _referenceVertexList; } - + inline const VertexList& getReferenceVertexList() const { return _referenceVertexList; } @@ -176,12 +176,12 @@ class OSG_EXPORT Polytope inline void setResultMask(ClippingMask mask) { _resultMask=mask; } inline ClippingMask getResultMask() const { return _resultMask; } - + MaskStack& getMaskStack() { return _maskStack; } - + const MaskStack& getMaskStack() const { return _maskStack; } - - + + inline void pushCurrentMask() { _maskStack.push_back(_resultMask); @@ -196,7 +196,7 @@ class OSG_EXPORT Polytope inline bool contains(const osg::Vec3& v) const { if (!_maskStack.back()) return true; - + unsigned int selector_mask = 0x1; for(PlaneList::const_iterator itr=_planeList.begin(); itr!=_planeList.end(); @@ -229,7 +229,7 @@ class OSG_EXPORT Polytope if ((_maskStack.back()&selector_mask) && (itr->distance(v)<0.0f)) outside = true; selector_mask <<= 1; } - + if (!outside) return true; } return false; @@ -257,11 +257,11 @@ class OSG_EXPORT Polytope if (res<0) return false; // outside clipping set. else if (res>0) _resultMask ^= selector_mask; // subsequent checks against this plane not required. } - selector_mask <<= 1; + selector_mask <<= 1; } return true; } - + /** Check whether any part of a bounding box is contained within clipping set. Using a mask to determine which planes should be used for the check, and modifying the mask to turn off planes which wouldn't contribute to clipping @@ -284,7 +284,7 @@ class OSG_EXPORT Polytope if (res<0) return false; // outside clipping set. else if (res>0) _resultMask ^= selector_mask; // subsequent checks against this plane not required. } - selector_mask <<= 1; + selector_mask <<= 1; } return true; } @@ -307,7 +307,7 @@ class OSG_EXPORT Polytope if (res<1) return false; // intersects, or is below plane. _resultMask ^= selector_mask; // subsequent checks against this plane not required. } - selector_mask <<= 1; + selector_mask <<= 1; } return true; } @@ -319,7 +319,7 @@ class OSG_EXPORT Polytope _resultMask = _maskStack.back(); ClippingMask selector_mask = 0x1; - + for(PlaneList::const_iterator itr=_planeList.begin(); itr!=_planeList.end(); ++itr) @@ -330,11 +330,11 @@ class OSG_EXPORT Polytope if (res<1) return false; // intersects, or is below plane. _resultMask ^= selector_mask; // subsequent checks against this plane not required. } - selector_mask <<= 1; + selector_mask <<= 1; } return true; } - + /** Check whether the entire bounding box is contained within clipping set.*/ inline bool containsAllOf(const osg::BoundingBox& bb) { @@ -353,14 +353,14 @@ class OSG_EXPORT Polytope if (res<1) return false; // intersects, or is below plane. _resultMask ^= selector_mask; // subsequent checks against this plane not required. } - selector_mask <<= 1; + selector_mask <<= 1; } return true; } - + /** Transform the clipping set by matrix. Note, this operations carries out - * the calculation of the inverse of the matrix since a plane must + * the calculation of the inverse of the matrix since a plane must * be multiplied by the inverse transposed to transform it. This * makes this operation expensive. If the inverse has been already * calculated elsewhere then use transformProvidingInverse() instead. @@ -371,7 +371,7 @@ class OSG_EXPORT Polytope inverse.invert(matrix); transformProvidingInverse(inverse); } - + /** Transform the clipping set by provide a pre inverted matrix. * see transform for details. */ inline void transformProvidingInverse(const osg::Matrix& matrix) @@ -387,11 +387,11 @@ class OSG_EXPORT Polytope if (_resultMask&selector_mask) { itr->transformProvidingInverse(matrix); - selector_mask <<= 1; + selector_mask <<= 1; } } } - + protected: @@ -404,4 +404,4 @@ class OSG_EXPORT Polytope } // end of namespace -#endif +#endif diff --git a/include/osg/PositionAttitudeTransform b/include/osg/PositionAttitudeTransform index 001734832..61d74c6f4 100644 --- a/include/osg/PositionAttitudeTransform +++ b/include/osg/PositionAttitudeTransform @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ class OSG_EXPORT PositionAttitudeTransform : public Transform _attitude(pat._attitude), _scale(pat._scale), _pivotPoint(pat._pivotPoint) {} - + META_Node(osg, PositionAttitudeTransform); @@ -49,22 +49,22 @@ class OSG_EXPORT PositionAttitudeTransform : public Transform inline void setAttitude(const Quat& quat) { _attitude = quat; dirtyBound(); } inline const Quat& getAttitude() const { return _attitude; } - + inline void setScale(const Vec3d& scale) { _scale = scale; dirtyBound(); } inline const Vec3d& getScale() const { return _scale; } - + inline void setPivotPoint(const Vec3d& pivot) { _pivotPoint = pivot; dirtyBound(); } inline const Vec3d& getPivotPoint() const { return _pivotPoint; } - + virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const; virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; protected : - + virtual ~PositionAttitudeTransform() {} Vec3d _position; diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index 3cd4a11c3..5948a8650 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -151,7 +151,7 @@ class DrawElements; class OSG_EXPORT PrimitiveSet : public BufferData { public: - + enum Type { PrimitiveType, @@ -174,9 +174,9 @@ class OSG_EXPORT PrimitiveSet : public BufferData QUADS = GL_QUADS, QUAD_STRIP = GL_QUAD_STRIP, POLYGON = GL_POLYGON, - LINES_ADJACENCY = GL_LINES_ADJACENCY_EXT, - LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY_EXT, - TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY_EXT, + LINES_ADJACENCY = GL_LINES_ADJACENCY_EXT, + LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY_EXT, + TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY_EXT, TRIANGLE_STRIP_ADJACENCY = GL_TRIANGLE_STRIP_ADJACENCY_EXT, PATCHES = GL_PATCHES }; @@ -185,7 +185,7 @@ class OSG_EXPORT PrimitiveSet : public BufferData _primitiveType(primType), _numInstances(numInstances), _mode(mode) {} - + PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY): BufferData(prim,copyop), _primitiveType(prim._primitiveType), @@ -195,7 +195,7 @@ class OSG_EXPORT PrimitiveSet : public BufferData virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "PrimitiveSet"; } - + Type getType() const { return _primitiveType; } virtual osg::PrimitiveSet* asPrimitiveSet() { return this; } @@ -207,7 +207,7 @@ class OSG_EXPORT PrimitiveSet : public BufferData virtual DrawElements* getDrawElements() { return 0; } virtual const DrawElements* getDrawElements() const { return 0; } - + void setNumInstances(int n) { _numInstances = n; } int getNumInstances() const { return _numInstances; } @@ -215,15 +215,15 @@ class OSG_EXPORT PrimitiveSet : public BufferData GLenum getMode() const { return _mode; } virtual void draw(State& state, bool useVertexBufferObjects) const = 0; - + virtual void accept(PrimitiveFunctor& functor) const = 0; virtual void accept(PrimitiveIndexFunctor& functor) const = 0; - + virtual unsigned int index(unsigned int pos) const = 0; virtual unsigned int getNumIndices() const = 0; virtual void offsetIndices(int offset) = 0; - virtual unsigned int getNumPrimitives() const; + virtual unsigned int getNumPrimitives() const; virtual void computeRange() const {} @@ -244,7 +244,7 @@ class OSG_EXPORT DrawArrays : public PrimitiveSet PrimitiveSet(DrawArraysPrimitiveType,mode), _first(0), _count(0) {} - + DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0): PrimitiveSet(DrawArraysPrimitiveType, mode, numInstances), _first(first), @@ -256,11 +256,11 @@ class OSG_EXPORT DrawArrays : public PrimitiveSet _count(da._count) {} virtual Object* cloneType() const { return new DrawArrays(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); } + virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "DrawArrays"; } - + void set(GLenum mode,GLint first, GLsizei count) { @@ -271,15 +271,15 @@ class OSG_EXPORT DrawArrays : public PrimitiveSet void setFirst(GLint first) { _first = first; } GLint getFirst() const { return _first; } - + void setCount(GLsizei count) { _count = count; } GLsizei getCount() const { return _count; } virtual void draw(State& state, bool useVertexBufferObjects) const; - + virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; - + virtual unsigned int getNumIndices() const { return static_cast(_count); } virtual unsigned int index(unsigned int pos) const { return static_cast(_first)+pos; } virtual void offsetIndices(int offset) { _first += offset; } @@ -301,43 +301,43 @@ class OSG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorGLsizei DrawArrayLengths(GLenum mode=0): PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), _first(0) {} - + DrawArrayLengths(const DrawArrayLengths& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY): PrimitiveSet(dal,copyop), vector_type(dal), _first(dal._first) {} - DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) : + DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) : PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), vector_type(ptr,ptr+no), _first(first) {} - DrawArrayLengths(GLenum mode,GLint first, unsigned int no) : + DrawArrayLengths(GLenum mode,GLint first, unsigned int no) : PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), vector_type(no), _first(first) {} - DrawArrayLengths(GLenum mode,GLint first) : + DrawArrayLengths(GLenum mode,GLint first) : PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), vector_type(), _first(first) {} virtual Object* cloneType() const { return new DrawArrayLengths(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); } + virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "DrawArrayLengths"; } - + void setFirst(GLint first) { _first = first; } GLint getFirst() const { return _first; } - + virtual void draw(State& state, bool useVertexBufferObjects) const; - + virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; - + virtual unsigned int getNumIndices() const; virtual unsigned int index(unsigned int pos) const { return _first+pos; } virtual void offsetIndices(int offset) { _first += offset; } @@ -354,10 +354,10 @@ class OSG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorGLsizei class DrawElements : public PrimitiveSet { public: - + DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0): PrimitiveSet(primType,mode, numInstances) {} - + DrawElements(const DrawElements& copy,const CopyOp& copyop=CopyOp::SHALLOW_COPY): PrimitiveSet(copy,copyop) {} @@ -387,12 +387,12 @@ class DrawElements : public PrimitiveSet class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte { public: - + typedef VectorGLubyte vector_type; DrawElementsUByte(GLenum mode=0): DrawElements(DrawElementsUBytePrimitiveType,mode) {} - + DrawElementsUByte(const DrawElementsUByte& array, const CopyOp& copyop=CopyOp::SHALLOW_COPY): DrawElements(array,copyop), vector_type(array) {} @@ -400,19 +400,19 @@ class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte /** * \param no Number of intended elements. This will be the size of the underlying vector. */ - DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte* ptr, int numInstances=0) : + DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte* ptr, int numInstances=0) : DrawElements(DrawElementsUBytePrimitiveType,mode,numInstances), vector_type(ptr,ptr+no) {} /** * \param no Number of intended elements. This will be the size of the underlying vector. */ - DrawElementsUByte(GLenum mode, unsigned int no) : + DrawElementsUByte(GLenum mode, unsigned int no) : DrawElements(DrawElementsUBytePrimitiveType,mode), vector_type(no) {} virtual Object* cloneType() const { return new DrawElementsUByte(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); } + virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "DrawElementsUByte"; } @@ -422,18 +422,18 @@ class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte virtual bool supportsBufferObject() const { return false; } virtual void draw(State& state, bool useVertexBufferObjects) const ; - + virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; virtual unsigned int getNumIndices() const { return static_cast(size()); } virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } virtual void offsetIndices(int offset); - + virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); } virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; } - virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } - virtual void addElement(unsigned int v) { push_back(GLubyte(v)); } + virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } + virtual void addElement(unsigned int v) { push_back(GLubyte(v)); } protected: @@ -449,7 +449,7 @@ class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort DrawElementsUShort(GLenum mode=0): DrawElements(DrawElementsUShortPrimitiveType,mode) {} - + DrawElementsUShort(const DrawElementsUShort& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY): DrawElements(array,copyop), vector_type(array) {} @@ -457,24 +457,24 @@ class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort /** * \param no Number of intended elements. This will be the size of the underlying vector. */ - DrawElementsUShort(GLenum mode, unsigned int no, const GLushort* ptr, int numInstances=0) : + DrawElementsUShort(GLenum mode, unsigned int no, const GLushort* ptr, int numInstances=0) : DrawElements(DrawElementsUShortPrimitiveType,mode,numInstances), vector_type(ptr,ptr+no) {} /** * \param no Number of intended elements. This will be the size of the underlying vector. */ - DrawElementsUShort(GLenum mode, unsigned int no) : + DrawElementsUShort(GLenum mode, unsigned int no) : DrawElements(DrawElementsUShortPrimitiveType,mode), vector_type(no) {} template - DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) : + DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) : DrawElements(DrawElementsUShortPrimitiveType,mode), vector_type(first,last) {} virtual Object* cloneType() const { return new DrawElementsUShort(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); } + virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "DrawElementsUShort"; } @@ -484,7 +484,7 @@ class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort virtual bool supportsBufferObject() const { return false; } virtual void draw(State& state, bool useVertexBufferObjects) const; - + virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; @@ -510,7 +510,7 @@ class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint DrawElementsUInt(GLenum mode=0): DrawElements(DrawElementsUIntPrimitiveType,mode) {} - + DrawElementsUInt(const DrawElementsUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY): DrawElements(array,copyop), vector_type(array) {} @@ -519,24 +519,24 @@ class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. * \param no Number of intended elements. This will be the size of the underlying vector. */ - DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) : + DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) : DrawElements(DrawElementsUIntPrimitiveType,mode,numInstances), vector_type(ptr,ptr+no) {} /** * \param no Number of intended elements. This will be the size of the underlying vector. */ - DrawElementsUInt(GLenum mode, unsigned int no) : + DrawElementsUInt(GLenum mode, unsigned int no) : DrawElements(DrawElementsUIntPrimitiveType,mode), vector_type(no) {} template - DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) : + DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) : DrawElements(DrawElementsUIntPrimitiveType,mode), vector_type(first,last) {} virtual Object* cloneType() const { return new DrawElementsUInt(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); } + virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osg"; } virtual const char* className() const { return "DrawElementsUInt"; } @@ -546,7 +546,7 @@ class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint virtual bool supportsBufferObject() const { return false; } virtual void draw(State& state, bool useVertexBufferObjects) const; - + virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; diff --git a/include/osg/Projection b/include/osg/Projection index 327fe9999..4624399d6 100644 --- a/include/osg/Projection +++ b/include/osg/Projection @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,21 +37,21 @@ class OSG_EXPORT Projection : public Group /** Set the transform's matrix.*/ void setMatrix(const Matrix& mat) { _matrix = mat; } - + /** Get the transform's matrix. */ inline const Matrix& getMatrix() const { return _matrix; } /** preMult transform.*/ void preMult(const Matrix& mat) { _matrix.preMult(mat); } - + /** postMult transform.*/ void postMult(const Matrix& mat) { _matrix.postMult(mat); } - + protected : - + virtual ~Projection(); - + Matrix _matrix; }; diff --git a/include/osg/ProxyNode b/include/osg/ProxyNode index 8a54aabc9..aad2dc023 100644 --- a/include/osg/ProxyNode +++ b/include/osg/ProxyNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,22 +23,22 @@ namespace osg { class OSG_EXPORT ProxyNode : public Group { public : - + ProxyNode(); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ ProxyNode(const ProxyNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Node(osg, ProxyNode); - + typedef osg::BoundingSphere::vec_type vec_type; typedef osg::BoundingSphere::value_type value_type; virtual void traverse(NodeVisitor& nv); - + virtual bool addChild(Node *child); virtual bool addChild(Node *child, const std::string& filename); - + virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove); @@ -61,13 +61,13 @@ class OSG_EXPORT ProxyNode : public Group const std::string& getFileName(unsigned int childNo) const { return _filenameList[childNo].first; } unsigned int getNumFileNames() const { return _filenameList.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. - * 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.*/ osg::ref_ptr& getDatabaseRequest(unsigned int childNo) { return _filenameList[childNo].second; } - - /** Return the const DatabaseRequest object.*/ + + /** Return the const DatabaseRequest object.*/ const osg::ref_ptr& getDatabaseRequest(unsigned int childNo) const { return _filenameList[childNo].second; } @@ -84,7 +84,7 @@ class OSG_EXPORT ProxyNode : public Group /** Get how the center of object should be determined when computed which child is active.*/ CenterMode getCenterMode() const { return _centerMode; } - + /** Modes which control how the proxynode external reference are loaded.*/ enum LoadingExternalReferenceMode { @@ -99,25 +99,25 @@ class OSG_EXPORT ProxyNode : public Group /** Get the setted mode of loading.*/ LoadingExternalReferenceMode getLoadingExternalReferenceMode() const { return _loadingExtReference; } - /** Sets the object-space point which defines the center of the osg::ProxyNode. + /** Sets the object-space point which defines the center of the osg::ProxyNode. center is affected by any transforms in the hierarchy above the osg::ProxyNode.*/ inline void setCenter(const vec_type& center) { if (_centerMode!=UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED) { _centerMode=USER_DEFINED_CENTER; } _userDefinedCenter = center; } - + /** return the ProxyNode 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(); } - /** Set the object-space reference radius of the volume enclosed by the ProxyNode. + /** Set the object-space reference radius of the volume enclosed by the ProxyNode. * Used to determine the bounding sphere of the ProxyNode in the absence of any children.*/ inline void setRadius(value_type radius) { _radius = radius; } - + /** Get the object-space radius of the volume enclosed by the ProxyNode.*/ inline value_type getRadius() const { return _radius; } virtual BoundingSphere computeBound() const; protected : - + virtual ~ProxyNode() {} void expandFileNameListTo(unsigned int pos); @@ -128,13 +128,13 @@ class OSG_EXPORT ProxyNode : public Group FileNameDatabaseRequestList _filenameList; ref_ptr _databaseOptions; std::string _databasePath; - + LoadingExternalReferenceMode _loadingExtReference; - + CenterMode _centerMode; vec_type _userDefinedCenter; value_type _radius; - + }; } diff --git a/include/osg/Quat b/include/osg/Quat index eac627893..31e1799cc 100644 --- a/include/osg/Quat +++ b/include/osg/Quat @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -70,14 +70,14 @@ class OSG_EXPORT Quat makeRotate(angle,axis); } - inline Quat( value_type angle1, const Vec3f& axis1, + inline Quat( value_type angle1, const Vec3f& axis1, value_type angle2, const Vec3f& axis2, value_type angle3, const Vec3f& axis3) { makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); } - inline Quat( value_type angle1, const Vec3d& axis1, + inline Quat( value_type angle1, const Vec3d& axis1, value_type angle2, const Vec3d& axis2, value_type angle3, const Vec3d& axis3) { @@ -122,7 +122,7 @@ class OSG_EXPORT Quat _v[2]=z; _v[3]=w; } - + inline void set(const osg::Vec4f& v) { _v[0]=v.x(); @@ -138,15 +138,15 @@ class OSG_EXPORT Quat _v[2]=v.z(); _v[3]=v.w(); } - + void set(const Matrixf& matrix); - + void set(const Matrixd& matrix); - + void get(Matrixf& matrix) const; void get(Matrixd& matrix) const; - + inline value_type & operator [] (int i) { return _v[i]; } inline value_type operator [] (int i) const { return _v[i]; } @@ -162,23 +162,23 @@ class OSG_EXPORT Quat inline value_type w() const { return _v[3]; } /** return true if the Quat represents a zero rotation, and therefore can be ignored in computations.*/ - bool zeroRotation() const { return _v[0]==0.0 && _v[1]==0.0 && _v[2]==0.0 && _v[3]==1.0; } + bool zeroRotation() const { return _v[0]==0.0 && _v[1]==0.0 && _v[2]==0.0 && _v[3]==1.0; } - /* ------------------------------------------------------------- - BASIC ARITHMETIC METHODS + /* ------------------------------------------------------------- + BASIC ARITHMETIC METHODS Implemented in terms of Vec4s. Some Vec4 operators, e.g. operator* are not appropriate for quaternions (as mathematical objects) so they are implemented differently. - Also define methods for conjugate and the multiplicative inverse. + Also define methods for conjugate and the multiplicative inverse. ------------------------------------------------------------- */ - /// Multiply by scalar + /// Multiply by scalar inline const Quat operator * (value_type rhs) const { return Quat(_v[0]*rhs, _v[1]*rhs, _v[2]*rhs, _v[3]*rhs); } - /// Unary multiply by scalar + /// Unary multiply by scalar inline Quat& operator *= (value_type rhs) { _v[0]*=rhs; @@ -188,7 +188,7 @@ class OSG_EXPORT Quat return *this; // enable nesting } - /// Binary multiply + /// Binary multiply inline const Quat operator*(const Quat& rhs) const { return Quat( rhs._v[3]*_v[0] + rhs._v[0]*_v[3] + rhs._v[1]*_v[2] - rhs._v[2]*_v[1], @@ -197,7 +197,7 @@ class OSG_EXPORT Quat rhs._v[3]*_v[3] - rhs._v[0]*_v[0] - rhs._v[1]*_v[1] - rhs._v[2]*_v[2] ); } - /// Unary multiply + /// Unary multiply inline Quat& operator*=(const Quat& rhs) { value_type x = rhs._v[3]*_v[0] + rhs._v[0]*_v[3] + rhs._v[1]*_v[2] - rhs._v[2]*_v[1]; @@ -212,14 +212,14 @@ class OSG_EXPORT Quat return (*this); // enable nesting } - /// Divide by scalar + /// Divide by scalar inline Quat operator / (value_type rhs) const { value_type div = 1.0/rhs; return Quat(_v[0]*div, _v[1]*div, _v[2]*div, _v[3]*div); } - /// Unary divide by scalar + /// Unary divide by scalar inline Quat& operator /= (value_type rhs) { value_type div = 1.0/rhs; @@ -230,20 +230,20 @@ class OSG_EXPORT Quat return *this; } - /// Binary divide + /// Binary divide inline const Quat operator/(const Quat& denom) const { return ( (*this) * denom.inverse() ); } - /// Unary divide + /// Unary divide inline Quat& operator/=(const Quat& denom) { (*this) = (*this) * denom.inverse(); return (*this); // enable nesting } - /// Binary addition + /// Binary addition inline const Quat operator + (const Quat& rhs) const { return Quat(_v[0]+rhs._v[0], _v[1]+rhs._v[1], @@ -260,14 +260,14 @@ class OSG_EXPORT Quat return *this; // enable nesting } - /// Binary subtraction + /// Binary subtraction inline const Quat operator - (const Quat& rhs) const { return Quat(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2], _v[3]-rhs._v[3] ); } - /// Unary subtraction + /// Unary subtraction inline Quat& operator -= (const Quat& rhs) { _v[0]-=rhs._v[0]; @@ -296,9 +296,9 @@ class OSG_EXPORT Quat return _v[0]*_v[0] + _v[1]*_v[1] + _v[2]*_v[2] + _v[3]*_v[3]; } - /// Conjugate + /// Conjugate inline Quat conj () const - { + { return Quat( -_v[0], -_v[1], -_v[2], _v[3] ); } @@ -308,7 +308,7 @@ class OSG_EXPORT Quat return conj() / length2(); } - /* -------------------------------------------------------- + /* -------------------------------------------------------- METHODS RELATED TO ROTATIONS Set a quaternion which will perform a rotation of an angle around the axis given by the vector (x,y,z). @@ -318,15 +318,15 @@ class OSG_EXPORT Quat Not inlined - see the Quat.cpp file for implementation -------------------------------------------------------- */ - void makeRotate( value_type angle, + void makeRotate( value_type angle, value_type x, value_type y, value_type z ); void makeRotate ( value_type angle, const Vec3f& vec ); void makeRotate ( value_type angle, const Vec3d& vec ); - void makeRotate ( value_type angle1, const Vec3f& axis1, + void makeRotate ( value_type angle1, const Vec3f& axis1, value_type angle2, const Vec3f& axis2, 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 angle3, const Vec3d& axis3); @@ -342,7 +342,7 @@ class OSG_EXPORT Quat Watch out for the two special cases of when the vectors are co-incident or opposite in direction.*/ void makeRotate( const Vec3d& vec1, const Vec3d& vec2 ); - + void makeRotate_original( const Vec3d& vec1, const Vec3d& vec2 ); /** Return the angle and vector components represented by the quaternion.*/ @@ -357,37 +357,37 @@ class OSG_EXPORT Quat /** Spherical Linear Interpolation. As t goes from 0 to 1, the Quat object goes from "from" to "to". */ void slerp ( value_type t, const Quat& from, const Quat& to); - + /** Rotate a vector by this quaternion.*/ Vec3f operator* (const Vec3f& v) const { // nVidia SDK implementation - Vec3f uv, uuv; + Vec3f uv, uuv; Vec3f qvec(_v[0], _v[1], _v[2]); uv = qvec ^ v; - uuv = qvec ^ uv; - uv *= ( 2.0f * _v[3] ); - uuv *= 2.0f; + uuv = qvec ^ uv; + uv *= ( 2.0f * _v[3] ); + uuv *= 2.0f; return v + uv + uuv; } - + /** Rotate a vector by this quaternion.*/ Vec3d operator* (const Vec3d& v) const { // nVidia SDK implementation - Vec3d uv, uuv; + Vec3d uv, uuv; Vec3d qvec(_v[0], _v[1], _v[2]); uv = qvec ^ v; - uuv = qvec ^ uv; - uv *= ( 2.0f * _v[3] ); - uuv *= 2.0f; + uuv = qvec ^ uv; + uv *= ( 2.0f * _v[3] ); + uuv *= 2.0f; return v + uv + uuv; } - + protected: - + }; // end of class prototype } // end of namespace -#endif +#endif diff --git a/include/osg/Referenced b/include/osg/Referenced index e8e6164e6..97823af81 100644 --- a/include/osg/Referenced +++ b/include/osg/Referenced @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -45,9 +45,9 @@ class OSG_EXPORT Referenced public: - Referenced(); - - explicit Referenced(bool threadSafeRefUnref); + Referenced(); + + explicit Referenced(bool threadSafeRefUnref); Referenced(const Referenced&); @@ -74,24 +74,24 @@ class OSG_EXPORT Referenced /** Get the optional global Referenced mutex, this can be shared between all osg::Referenced.*/ static OpenThreads::Mutex* getGlobalReferencedMutex(); - /** Increment the reference count by one, indicating that + /** Increment the reference count by one, indicating that this object has another pointer which is referencing it.*/ inline int ref() const; - - /** Decrement the reference count by one, indicating that + + /** Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.*/ inline int unref() const; - - /** Decrement the reference count by one, indicating that + + /** Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. However, do - not delete it, even if ref count goes to 0. Warning, unref_nodelete() + not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will - be responsible for, one should prefer unref() over unref_nodelete() + be responsible for, one should prefer unref() over unref_nodelete() as the latter can lead to memory leaks.*/ int unref_nodelete() const; - + /** Return the number of pointers currently referencing this object. */ inline int referenceCount() const { return _refCount; } @@ -119,7 +119,7 @@ class OSG_EXPORT Referenced /** Set whether reference counting should use a mutex for thread safe reference counting.*/ static void setThreadSafeReferenceCounting(bool enableThreadSafeReferenceCounting); - + /** Get whether reference counting is active.*/ static bool getThreadSafeReferenceCounting(); @@ -132,9 +132,9 @@ class OSG_EXPORT Referenced /** Get a DeleteHandler.*/ static DeleteHandler* getDeleteHandler(); - + protected: - + virtual ~Referenced(); void signalObserversAndDelete(bool signalDelete, bool doDelete) const; @@ -146,11 +146,11 @@ class OSG_EXPORT Referenced mutable OpenThreads::Atomic _refCount; #else - + mutable OpenThreads::Mutex* _refMutex; mutable int _refCount; - + mutable void* _observerSet; #endif }; @@ -162,7 +162,7 @@ inline int Referenced::ref() const #else if (_refMutex) { - OpenThreads::ScopedLock lock(*_refMutex); + OpenThreads::ScopedLock lock(*_refMutex); return ++_refCount; } else @@ -182,7 +182,7 @@ inline int Referenced::unref() const bool needDelete = false; if (_refMutex) { - OpenThreads::ScopedLock lock(*_refMutex); + OpenThreads::ScopedLock lock(*_refMutex); newRef = --_refCount; needDelete = newRef==0; } diff --git a/include/osg/RenderInfo b/include/osg/RenderInfo index cd8846724..2c9c9c454 100644 --- a/include/osg/RenderInfo +++ b/include/osg/RenderInfo @@ -35,7 +35,7 @@ public: RenderInfo(State* state, View* view): _state(state), _view(view) {} - + RenderInfo& operator = (const RenderInfo& rhs) { _state = rhs._state; @@ -46,18 +46,18 @@ public: } unsigned int getContextID() const { return _state.valid() ? _state->getContextID() : 0; } - + void setState(State* state) { _state = state; } State* getState() { return _state.get(); } const State* getState() const { return _state.get(); } - + void setView(View* view) { _view = view; } View* getView() { return _view; } const View* getView() const { return _view; } - - void pushCamera(Camera* camera) { _cameras.push_back(camera); } + + void pushCamera(Camera* camera) { _cameras.push_back(camera); } void popCamera() { if (!_cameras.empty()) _cameras.pop_back(); } - + Camera* getCurrentCamera() { return _cameras.empty() ? 0 : _cameras.back(); } void setUserData(Referenced* userData) { _userData = userData; } diff --git a/include/osg/Scissor b/include/osg/Scissor index 41c8bcb56..e7e25e21b 100644 --- a/include/osg/Scissor +++ b/include/osg/Scissor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -18,18 +18,18 @@ namespace osg { -/** Encapsulate OpenGL glScissor. */ +/** Encapsulate OpenGL glScissor. */ class OSG_EXPORT Scissor : public StateAttribute { public : Scissor(); - + Scissor(int x,int y,int width,int height): _x(x), _y(y), _width(width), _height(height) {} - + /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Scissor(const Scissor& vp,const CopyOp& copyop=CopyOp::SHALLOW_COPY): @@ -40,7 +40,7 @@ class OSG_EXPORT Scissor : public StateAttribute _height(vp._height) {} META_StateAttribute(osg, Scissor, SCISSOR); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -53,7 +53,7 @@ class OSG_EXPORT Scissor : public StateAttribute COMPARE_StateAttribute_Parameter(_y) COMPARE_StateAttribute_Parameter(_width) COMPARE_StateAttribute_Parameter(_height) - + return 0; // passed all the above comparison macros, must be equal. } @@ -71,7 +71,7 @@ class OSG_EXPORT Scissor : public StateAttribute _width = width; _height = height; } - + void getScissor(int& x,int& y,int& width,int& height) const { x = _x; @@ -82,7 +82,7 @@ class OSG_EXPORT Scissor : public StateAttribute inline int& x() { return _x; } inline int x() const { return _x; } - + inline int& y() { return _y; } inline int y() const { return _y; } @@ -95,7 +95,7 @@ class OSG_EXPORT Scissor : public StateAttribute virtual void apply(State& state) const; protected: - + virtual ~Scissor(); int _x; diff --git a/include/osg/Sequence b/include/osg/Sequence index 0cca0c095..542b81c13 100644 --- a/include/osg/Sequence +++ b/include/osg/Sequence @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -16,9 +16,9 @@ #include -namespace osg +namespace osg { - + /** Sequence is a Group node which allows automatic, time based switching between children. */ @@ -63,21 +63,21 @@ class OSG_EXPORT Sequence : public Group /** Get time for child. */ double getTime(unsigned int frame) const; - + /** Set the time list for children. */ void setTimeList(const std::vector& timeList) { _frameTime = timeList; } - + /** Get the time list for children. */ const std::vector& getTimeList() const { return _frameTime; } - /** Set default time in seconds for new child. + /** Set default time in seconds for new child. if t<0, t=0 */ void setDefaultTime(double t) {_defaultTime = (t<0.?0.:t);} /** Get default time in seconds for new child. */ double getDefaultTime(void) const {return _defaultTime;}; - /** Set time of last frame of last loop, in seconds. + /** Set time of last frame of last loop, in seconds. if t<= 0, then ignored */ void setLastFrameTime(double t) {_lastFrameTime = (t<0.?0.:t);} @@ -93,22 +93,22 @@ class OSG_EXPORT Sequence : public Group LOOP, SWING }; - + /** Set sequence mode. */ void setLoopMode(LoopMode mode) { _loopMode = mode; _value = -1; } - + /** Get sequence mode. */ LoopMode getLoopMode() const { return _loopMode; } - + /** Set interval beginning. */ void setBegin(int begin) { _begin = begin; _value = -1; } - + /** Get interval beginning. */ int getBegin() const { return _begin; } - + /** Set interval ending. */ void setEnd(int end) { _end = end; _value = -1; } - + /** Get interval ending. */ int getEnd() const { return _end; } @@ -122,16 +122,16 @@ class OSG_EXPORT Sequence : public Group begin = _begin; end = _end; } - + /** Set speed. */ void setSpeed(float speed) { _speed = speed; } - + /** Get speed. */ float getSpeed() const { return _speed; } - + /** Set number of repeats. */ void setNumRepeats(int nreps) { _nreps = (nreps<0?-1:nreps); _nrepsRemain = _nreps; } - + /** Get number of repeats. */ int getNumRepeats() const { return _nreps; } @@ -217,7 +217,7 @@ class OSG_EXPORT Sequence : public Group // _nreps: how many times to repeat- default param is -1, repeat forever // init to 0, no repetitions - // _nrepsRemain: set to nreps and counts down every traversal, + // _nrepsRemain: set to nreps and counts down every traversal, // stopping when it gets to zero. init to 0 int _nreps, _nrepsRemain; @@ -246,7 +246,7 @@ class OSG_EXPORT Sequence : public Group bool _clearOnStop ; }; - + } #endif diff --git a/include/osg/ShadeModel b/include/osg/ShadeModel index 82b2e4032..248b26cb2 100644 --- a/include/osg/ShadeModel +++ b/include/osg/ShadeModel @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,26 +25,26 @@ namespace osg { #endif /** Class which encapsulates glShadeModel(..). -*/ +*/ class OSG_EXPORT ShadeModel : public StateAttribute { public : - + enum Mode { FLAT = GL_FLAT, SMOOTH = GL_SMOOTH }; - + ShadeModel(Mode mode=SMOOTH); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ ShadeModel(const ShadeModel& sm,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(sm,copyop), _mode(sm._mode) {} - + META_StateAttribute(osg, ShadeModel, SHADEMODEL); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ virtual int compare(const StateAttribute& sa) const { @@ -61,13 +61,13 @@ class OSG_EXPORT ShadeModel : public StateAttribute inline void setMode(Mode mode) { _mode = mode; } inline Mode getMode() const { return _mode; } - + virtual void apply(State& state) const; - + protected: - + virtual ~ShadeModel(); - + Mode _mode; }; diff --git a/include/osg/Shader b/include/osg/Shader index 5587f34a7..bc0db16bb 100644 --- a/include/osg/Shader +++ b/include/osg/Shader @@ -1,13 +1,13 @@ -/* -*-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) 2004-2005 Nathan Cournia * Copyright (C) 2008 Zebra Imaging * 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 * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -33,7 +33,7 @@ namespace osg { class Program; -/** Simple class for wrapping up the data used in OpenGL ES 2's glShaderBinary calls. +/** Simple class for wrapping up the data used in OpenGL ES 2's glShaderBinary calls. * ShaderBinary is set up with the binary data then assigned to one or more osg::Shader. */ class OSG_EXPORT ShaderBinary : public osg::Object { @@ -114,7 +114,7 @@ class OSG_EXPORT Shader : public osg::Object /** Get the Shader type as a descriptive string. */ const char* getTypename() const; - + /** Set file name for the shader source code. */ inline void setFileName(const std::string& fileName) { _shaderFileName = fileName; } @@ -131,13 +131,13 @@ class OSG_EXPORT Shader : public osg::Object /** Set the Shader using a ShaderBinary. */ - void setShaderBinary(ShaderBinary* shaderBinary) { _shaderBinary = shaderBinary; } - + void setShaderBinary(ShaderBinary* shaderBinary) { _shaderBinary = shaderBinary; } + /** Get the Shader's ShaderBinary, return NULL if none is assigned. */ - ShaderBinary* getShaderBinary() { return _shaderBinary.get(); } + ShaderBinary* getShaderBinary() { return _shaderBinary.get(); } /** Get the const Shader's ShaderBinary, return NULL if none is assigned. */ - const ShaderBinary* getShaderBinary() const { return _shaderBinary.get(); } + const ShaderBinary* getShaderBinary() const { return _shaderBinary.get(); } /** Read shader source from file and then constructor shader of specified type. @@ -177,7 +177,7 @@ class OSG_EXPORT Shader : public osg::Object /** Mark our PCSs as needing recompilation. * Also mark Programs that depend on us as needing relink */ - void dirtyShader(); + void dirtyShader(); /** If needed, compile the PCS's glShader */ void compileShader(osg::State& state) const; @@ -267,7 +267,7 @@ class OSG_EXPORT Shader : public osg::Object osg::ref_ptr _shaderBinary; CodeInjectionMap _codeInjectionMap; - + /** osg::Programs that this osg::Shader is attached to */ typedef std::set< osg::Program* > ProgramSet; ProgramSet _programSet; diff --git a/include/osg/ShaderAttribute b/include/osg/ShaderAttribute index 09d24cae7..b5c7e63be 100644 --- a/include/osg/ShaderAttribute +++ b/include/osg/ShaderAttribute @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/ShadowVolumeOccluder b/include/osg/ShadowVolumeOccluder index dfc0bcb7c..87e92b793 100644 --- a/include/osg/ShadowVolumeOccluder +++ b/include/osg/ShadowVolumeOccluder @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -27,8 +27,8 @@ class OSG_EXPORT ShadowVolumeOccluder { public: - - + + typedef std::vector HoleList; ShadowVolumeOccluder(const ShadowVolumeOccluder& svo): @@ -42,18 +42,18 @@ class OSG_EXPORT ShadowVolumeOccluder _volume(0.0f) {} - bool operator < (const ShadowVolumeOccluder& svo) const { return getVolume()>svo.getVolume(); } // not greater volume first. + bool operator < (const ShadowVolumeOccluder& svo) const { return getVolume()>svo.getVolume(); } // not greater volume first. /** compute the shadow volume occluder. */ bool computeOccluder(const NodePath& nodePath,const ConvexPlanarOccluder& occluder,CullStack& cullStack,bool createDrawables=false); - + inline void disableResultMasks(); - + inline void pushCurrentMask(); inline void popCurrentMask(); - - + + /** return true if the matrix passed in matches the projection matrix that this ShadowVolumeOccluder is * associated with.*/ bool matchProjectionMatrix(const osg::Matrix& matrix) const @@ -61,7 +61,7 @@ class OSG_EXPORT ShadowVolumeOccluder if (_projectionMatrix.valid()) return matrix==*_projectionMatrix; else return false; } - + /** Set the NodePath which describes which node in the scene graph * that this occluder is attached to. */ @@ -70,22 +70,22 @@ class OSG_EXPORT ShadowVolumeOccluder inline const NodePath& getNodePath() const { return _nodePath; } - /** get the volume of the occluder minus its holes, in eye coords, the volume is normalized by dividing by + /** get the volume of the occluder minus its holes, in eye coords, the volume is normalized by dividing by * the volume of the view frustum in eye coords.*/ float getVolume() const { return _volume; } - + /** return the occluder polytope.*/ Polytope& getOccluder() { return _occluderVolume; } - + /** return the const occluder polytope.*/ const Polytope& getOccluder() const { return _occluderVolume; } - + /** return the list of holes.*/ HoleList& getHoleList() { return _holeList; } - + /** return the const list of holes.*/ const HoleList& getHoleList() const { return _holeList; } - + /** return true if the specified vertex list is contained entirely * within this shadow occluder volume.*/ @@ -94,7 +94,7 @@ class OSG_EXPORT ShadowVolumeOccluder /** return true if the specified bounding sphere is contained entirely * within this shadow occluder volume.*/ bool contains(const BoundingSphere& bound); - + /** return true if the specified bounding box is contained entirely * within this shadow occluder volume.*/ bool contains(const BoundingBox& bound); @@ -109,7 +109,7 @@ class OSG_EXPORT ShadowVolumeOccluder itr->transformProvidingInverse(matrix); } } - + protected: @@ -169,4 +169,4 @@ inline void ShadowVolumeOccluder::popCurrentMask() } // end of namespace -#endif +#endif diff --git a/include/osg/Shape b/include/osg/Shape index 653e763b9..1e592c04c 100644 --- a/include/osg/Shape +++ b/include/osg/Shape @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,8 +29,8 @@ class ConstShapeVisitor; /** META_StateAttribute macro define the standard clone, isSameKindAs, * className and getType methods. - * Use when subclassing from Object to make it more convenient to define - * the standard pure virtual methods which are required for all Object + * Use when subclassing from Object to make it more convenient to define + * the standard pure virtual methods which are required for all Object * subclasses.*/ #define META_Shape(library,name) \ virtual osg::Object* cloneType() const { return new name(); } \ @@ -41,7 +41,7 @@ class ConstShapeVisitor; virtual void accept(osg::ShapeVisitor& sv) { sv.apply(*this); } \ virtual void accept(osg::ConstShapeVisitor& csv) const { csv.apply(*this); } -/** Base class for all shape types. +/** Base class for all shape types. * Shapes are used to either for culling and collision detection or * to define the geometric shape of procedurally generate Geometry. */ @@ -50,10 +50,10 @@ class OSG_EXPORT Shape : public Object public: Shape() {} - - Shape(const Shape& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + + Shape(const Shape& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Object(sa,copyop) {} - + /** Clone the type of an attribute, with Object* return type. Must be defined by derived classes.*/ virtual Object* cloneType() const = 0; @@ -81,7 +81,7 @@ class OSG_EXPORT Shape : public Object virtual void accept(ConstShapeVisitor&) const =0; protected: - + virtual ~Shape(); }; @@ -102,7 +102,7 @@ class CompositeShape; class OSG_EXPORT ShapeVisitor { public: - + ShapeVisitor() {} virtual ~ShapeVisitor(); @@ -124,7 +124,7 @@ class OSG_EXPORT ShapeVisitor class OSG_EXPORT ConstShapeVisitor { public: - + ConstShapeVisitor() {} virtual ~ConstShapeVisitor(); @@ -201,7 +201,7 @@ class OSG_EXPORT Box : public Shape _center(center), _halfLengths(lengthX*0.5f,lengthY*0.5f,lengthZ*0.5f) {} - Box(const Box& box,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + Box(const Box& box,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Shape(box,copyop), _center(box._center), _halfLengths(box._halfLengths), @@ -226,12 +226,12 @@ class OSG_EXPORT Box : public Shape inline void setRotation(const Quat& quat) { _rotation = quat; } inline const Quat& getRotation() const { return _rotation; } inline Matrix computeRotationMatrix() const { return Matrix(_rotation); } - inline bool zeroRotation() const { return _rotation.zeroRotation(); } + inline bool zeroRotation() const { return _rotation.zeroRotation(); } protected: - + virtual ~Box(); - + Vec3 _center; Vec3 _halfLengths; Quat _rotation; @@ -254,7 +254,7 @@ class OSG_EXPORT Cone : public Shape _radius(radius), _height(height) {} - Cone(const Cone& cone,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + Cone(const Cone& cone,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Shape(cone,copyop), _center(cone._center), _radius(cone._radius), @@ -284,15 +284,15 @@ class OSG_EXPORT Cone : public Shape inline void setRotation(const Quat& quat) { _rotation = quat; } inline const Quat& getRotation() const { return _rotation; } inline Matrix computeRotationMatrix() const { return Matrix(_rotation); } - inline bool zeroRotation() const { return _rotation.zeroRotation(); } + inline bool zeroRotation() const { return _rotation.zeroRotation(); } - inline float getBaseOffsetFactor() const { return 0.25f; } - inline float getBaseOffset() const { return -getBaseOffsetFactor()*getHeight(); } + inline float getBaseOffsetFactor() const { return 0.25f; } + inline float getBaseOffset() const { return -getBaseOffsetFactor()*getHeight(); } protected: - + virtual ~Cone(); - + Vec3 _center; float _radius; float _height; @@ -314,7 +314,7 @@ class OSG_EXPORT Cylinder : public Shape _radius(radius), _height(height) {} - Cylinder(const Cylinder& cylinder,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + Cylinder(const Cylinder& cylinder,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Shape(cylinder,copyop), _center(cylinder._center), _radius(cylinder._radius), @@ -344,10 +344,10 @@ class OSG_EXPORT Cylinder : public Shape inline void setRotation(const Quat& quat) { _rotation = quat; } inline const Quat& getRotation() const { return _rotation; } inline Matrix computeRotationMatrix() const { return Matrix(_rotation); } - bool zeroRotation() const { return _rotation.zeroRotation(); } + bool zeroRotation() const { return _rotation.zeroRotation(); } protected: - + virtual ~Cylinder(); Vec3 _center; @@ -370,7 +370,7 @@ class OSG_EXPORT Capsule : public Shape _radius(radius), _height(height) {} - Capsule(const Capsule& capsule,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + Capsule(const Capsule& capsule,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Shape(capsule,copyop), _center(capsule._center), _radius(capsule._radius), @@ -400,12 +400,12 @@ class OSG_EXPORT Capsule : public Shape inline void setRotation(const Quat& quat) { _rotation = quat; } inline const Quat& getRotation() const { return _rotation; } inline Matrix computeRotationMatrix() const { return Matrix(_rotation); } - bool zeroRotation() const { return _rotation.zeroRotation(); } + bool zeroRotation() const { return _rotation.zeroRotation(); } protected: - + virtual ~Capsule(); - + Vec3 _center; float _radius; float _height; @@ -417,14 +417,14 @@ class OSG_EXPORT InfinitePlane : public Shape, public Plane public: InfinitePlane() {} - InfinitePlane(const InfinitePlane& plane,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + InfinitePlane(const InfinitePlane& plane,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Shape(plane,copyop), Plane(plane) {} META_Shape(osg, InfinitePlane); protected: - + virtual ~InfinitePlane(); }; @@ -433,10 +433,10 @@ class OSG_EXPORT InfinitePlane : public Shape, public Plane class OSG_EXPORT TriangleMesh : public Shape { public: - + TriangleMesh() {} - TriangleMesh(const TriangleMesh& mesh,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + TriangleMesh(const TriangleMesh& mesh,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Shape(mesh,copyop), _vertices(mesh._vertices), _indices(mesh._indices) {} @@ -454,7 +454,7 @@ class OSG_EXPORT TriangleMesh : public Shape const IndexArray* getIndices() const { return _indices.get(); } protected: - + virtual ~TriangleMesh(); ref_ptr _vertices; @@ -465,27 +465,27 @@ class OSG_EXPORT TriangleMesh : public Shape class OSG_EXPORT ConvexHull : public TriangleMesh { public: - + ConvexHull() {} - ConvexHull(const ConvexHull& hull,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + ConvexHull(const ConvexHull& hull,const CopyOp& copyop=CopyOp::SHALLOW_COPY): TriangleMesh(hull,copyop) {} META_Shape(osg, TriangleMesh); protected: - + virtual ~ConvexHull(); }; class OSG_EXPORT HeightField : public Shape { public: - + HeightField(); HeightField(const HeightField& mesh,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - + META_Shape(osg, HeightField); typedef std::vector HeightList; @@ -503,7 +503,7 @@ class OSG_EXPORT HeightField : public Shape inline void setYInterval(float dy) { _dy = dy; } inline float getYInterval() const { return _dy; } - + /** Get the FloatArray height data.*/ osg::FloatArray* getFloatArray() { return _heights.get(); } @@ -515,7 +515,7 @@ class OSG_EXPORT HeightField : public Shape const HeightList& getHeightList() const { return _heights->asVector(); } /** Set the height of the skirt to render around the edge of HeightField. - * The skirt is used as a means of disguising edge boundaries between adjacent HeightField, + * The skirt is used as a means of disguising edge boundaries between adjacent HeightField, * particularly of ones with different resolutions.*/ void setSkirtHeight(float skirtHeight) { _skirtHeight = skirtHeight; } @@ -533,7 +533,7 @@ class OSG_EXPORT HeightField : public Shape inline void setRotation(const Quat& quat) { _rotation = quat; } inline const Quat& getRotation() const { return _rotation; } inline Matrix computeRotationMatrix() const { return Matrix(_rotation); } - inline bool zeroRotation() const { return _rotation.zeroRotation(); } + inline bool zeroRotation() const { return _rotation.zeroRotation(); } /* set a single height point in the height field */ inline void setHeight(unsigned int c,unsigned int r,float value) @@ -557,7 +557,7 @@ class OSG_EXPORT HeightField : public Shape { return Vec3(_origin.x()+getXInterval()*(float)c, _origin.y()+getYInterval()*(float)r, - _origin.z()+(*_heights)[c+r*_columns]); + _origin.z()+(*_heights)[c+r*_columns]); } Vec3 getNormal(unsigned int c,unsigned int r) const; @@ -565,7 +565,7 @@ class OSG_EXPORT HeightField : public Shape Vec2 getHeightDelta(unsigned int c,unsigned int r) const; protected: - + virtual ~HeightField(); unsigned int _columns,_rows; @@ -590,12 +590,12 @@ class OSG_EXPORT CompositeShape : public Shape public: - + typedef std::vector< ref_ptr > ChildList; CompositeShape() {} - CompositeShape(const CompositeShape& cs,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + CompositeShape(const CompositeShape& cs,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Shape(cs,copyop), _children(cs._children) {} @@ -626,9 +626,9 @@ class OSG_EXPORT CompositeShape : public Shape void removeChild(unsigned int i) { _children.erase(_children.begin()+i); } /** find the index number of child, if child is not found then it returns getNumChildren(), - * so should be used in similar style to STL's result!=end().*/ + * so should be used in similar style to STL's result!=end().*/ unsigned int findChildNo(Shape* shape) const - { + { for (unsigned int childNo=0;childNo<_children.size();++childNo) { if (_children[childNo]==shape) return childNo; @@ -638,7 +638,7 @@ class OSG_EXPORT CompositeShape : public Shape } protected: - + virtual ~CompositeShape(); ref_ptr _shape; diff --git a/include/osg/ShapeDrawable b/include/osg/ShapeDrawable index af3913708..9f69152a7 100644 --- a/include/osg/ShapeDrawable +++ b/include/osg/ShapeDrawable @@ -43,7 +43,7 @@ class TessellationHints : public Object _createBottom(true) {} - TessellationHints(const TessellationHints& tess, const CopyOp& copyop=CopyOp::SHALLOW_COPY): + TessellationHints(const TessellationHints& tess, const CopyOp& copyop=CopyOp::SHALLOW_COPY): Object(tess,copyop), _TessellationMode(tess._TessellationMode), _detailRatio(tess._detailRatio), diff --git a/include/osg/State b/include/osg/State index 971f8df8c..cedd52584 100644 --- a/include/osg/State +++ b/include/osg/State @@ -142,15 +142,15 @@ class OSG_EXPORT State : public Referenced, public Observer /** Set the current OpenGL context uniqueID. * The ContextID is used by classes like osg::StateAttribute's and osg::Drawable's to * help manage seperate OpenGL objects, such as display lists, vertex buffer objects - * and texture object for each graphics context. The ContextID simply acts as an index + * and texture object for each graphics context. The ContextID simply acts as an index * into arrays that these classes maintain for the purpose of storing GL object handles. - * + * * Note, osgViewer::GraphicsWindow will automatically set up the ContextID for you, * so you will rearely need to set this yourself. - * + * * The exception is when creating your own graphics context, where you should set * the ContextID uniquely for each graphics context. - * + * * Typical settings for ContextID are 0,1,2,3... up to the maximum * number of graphics contexts you have set up. By default contextID is 0. */ @@ -407,8 +407,8 @@ class OSG_EXPORT State : public Referenced, public Observer /** Attribute has been applied externally, update state to reflect this setting.*/ void haveAppliedAttribute(const StateAttribute* attribute); - /** Attribute has been applied externally, - * and therefore this attribute type has been dirtied + /** Attribute has been applied externally, + * and therefore this attribute type has been dirtied * and will need to be re-applied on next osg::State.apply(..). * note, if you have an osg::StateAttribute which you have applied externally * then use the have_applied(attribute) method as this will cause the osg::State to @@ -1182,7 +1182,7 @@ class OSG_EXPORT State : public Referenced, public Observer * false if selection failed such as when multi texturing is not supported. * note, only updates values that change.*/ inline bool setActiveTextureUnit( unsigned int unit ); - + /** Get the current texture unit.*/ unsigned int getActiveTextureUnit() const { return _currentActiveTextureUnit; } @@ -1268,8 +1268,8 @@ class OSG_EXPORT State : public Referenced, public Observer * Alternative version of getUniformLocation( unsigned int uniformNameID ) * retrofited into OSG for backward compatibility with osgCal, * after uniform ids were refactored from std::strings to GLints in OSG version 2.9.10. - * - * Drawbacks: This method is not particularly fast. It has to access mutexed static + * + * Drawbacks: This method is not particularly fast. It has to access mutexed static * map of uniform ids. So don't overuse it or your app performance will suffer. */ inline GLint getUniformLocation( const std::string & uniformName ) const { return _lastAppliedProgramObject ? _lastAppliedProgramObject->getUniformLocation(uniformName) : -1; } @@ -1338,8 +1338,8 @@ class OSG_EXPORT State : public Referenced, public Observer /** Get the number of dynamic objects that will be rendered in this graphics context this frame.*/ unsigned int getDynamicObjectCount() const { return _dynamicObjectCount; } - - /** Decrement the number of dynamic objects left to render this frame, and once the count goes to zero call the + + /** Decrement the number of dynamic objects left to render this frame, and once the count goes to zero call the * DynamicObjectRenderingCompletedCallback to inform of completion.*/ inline void decrementDynamicObjectCount() { @@ -1510,7 +1510,7 @@ class OSG_EXPORT State : public Referenced, public Observer last_applied_attribute = 0L; last_applied_shadercomponent = 0L; global_default_attribute = 0L; - + } void print(std::ostream& fout) const; @@ -1845,7 +1845,7 @@ class OSG_EXPORT State : public Referenced, public Observer ArrayDispatchers _arrayDispatchers; osg::ref_ptr _graphicsCostEstimator; - + Timer_t _startTick; Timer_t _gpuTick; GLuint64EXT _gpuTimestamp; diff --git a/include/osg/StateAttribute b/include/osg/StateAttribute index b867b774a..2b312ec66 100644 --- a/include/osg/StateAttribute +++ b/include/osg/StateAttribute @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,8 +42,8 @@ class Texture; /** META_StateAttribute macro define the standard clone, isSameKindAs, * className and getType methods. - * Use when subclassing from Object to make it more convenient to define - * the standard pure virtual methods which are required for all Object + * Use when subclassing from Object to make it more convenient to define + * the standard pure virtual methods which are required for all Object * subclasses.*/ #define META_StateAttribute(library,name,type) \ virtual osg::Object* cloneType() const { return new name(); } \ @@ -72,27 +72,27 @@ class Texture; /** Base class for state attributes. -*/ +*/ class OSG_EXPORT StateAttribute : public Object { public : - + /** GLMode is the value used in glEnable/glDisable(mode) */ typedef GLenum GLMode; /** GLModeValue is used to specify whether a mode is enabled (ON) or disabled (OFF). - * GLMoveValue is also used to specify the override behavior of modes from parent to children. + * GLMoveValue is also used to specify the override behavior of modes from parent to children. * See enum Value description for more details.*/ typedef unsigned int GLModeValue; /** Override is used to specify the override behavior of StateAttributes - * from parent to children. + * from parent to children. * See enum Value description for more details.*/ typedef unsigned int OverrideValue; /** list values which can be used to set either GLModeValues or OverrideValues. - * When using in conjunction with GLModeValues, all Values have meaning. - * When using in conjunction with StateAttribute OverrideValue only + * When using in conjunction with GLModeValues, all Values have meaning. + * When using in conjunction with StateAttribute OverrideValue only * OFF,OVERRIDE and INHERIT are meaningful. - * However, they are useful when using GLModeValue + * However, they are useful when using GLModeValue * and OverrideValue in conjunction with each other as when using * StateSet::setAttributeAndModes(..).*/ enum Values @@ -104,26 +104,26 @@ class OSG_EXPORT StateAttribute : public Object /** Overriding of GLMode's or StateAttributes is enabled, so that state below it is overridden.*/ OVERRIDE = 0x2, /** Protecting of GLMode's or StateAttributes is enabled, so that state from above cannot override this and below state.*/ - PROTECTED = 0x4, + PROTECTED = 0x4, /** means that GLMode or StateAttribute should be inherited from above.*/ INHERIT = 0x8 }; - + /** Type identifier to differentiate between different state types. */ // typedef unsigned int Type; /** Values of StateAttribute::Type used to aid identification * of different StateAttribute subclasses. Each subclass defines - * its own value in the virtual Type getType() method. When + * its own value in the virtual Type getType() method. When * extending the osg's StateAttribute's simply define your * own Type value which is unique, using the StateAttribute::Type * enum as a guide of what values to use. If your new subclass - * needs to override a standard StateAttriubte then simply use + * needs to override a standard StateAttriubte then simply use * that type's value. */ enum Type { TEXTURE, - + POLYGONMODE, POLYGONOFFSET, MATERIAL, @@ -133,7 +133,7 @@ class OSG_EXPORT StateAttribute : public Object CULLFACE, FOG, FRONTFACE, - + LIGHT, POINT, @@ -168,7 +168,7 @@ class OSG_EXPORT StateAttribute : public Object /// osgFX namespace VALIDATOR, VIEWMATRIXEXTRACTOR, - + /// osgNV namespace OSGNV_PARAMETER_BLOCK, @@ -189,19 +189,19 @@ class OSG_EXPORT StateAttribute : public Object UNIFORMBUFFERBINDING, TRANSFORMFEEDBACKBUFFERBINDING }; - + /** Simple pairing between an attribute type and the member within that attribute type group.*/ typedef std::pair TypeMemberPair; StateAttribute(); - - StateAttribute(const StateAttribute& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY): + + StateAttribute(const StateAttribute& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Object(sa,copyop), _shaderComponent(sa._shaderComponent), _updateCallback(copyop(sa._updateCallback.get())), _eventCallback(copyop(sa._eventCallback.get())) {} - + /** Clone the type of an attribute, with Object* return type. Must be defined by derived classes.*/ @@ -219,15 +219,15 @@ class OSG_EXPORT StateAttribute : public Object /** Return the name of the attribute's class type.*/ virtual const char* className() const { return "StateAttribute"; } - - + + /** Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.*/ virtual Texture* asTexture() { return 0; } - + /** Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.*/ virtual const Texture* asTexture() const { return 0; } - + /** Return the Type identifier of the attribute's class type.*/ virtual Type getType() const = 0; @@ -242,12 +242,12 @@ class OSG_EXPORT StateAttribute : public Object /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ virtual int compare(const StateAttribute& sa) const = 0; - + bool operator < (const StateAttribute& rhs) const { return compare(rhs)<0; } bool operator == (const StateAttribute& rhs) const { return compare(rhs)==0; } bool operator != (const StateAttribute& rhs) const { return compare(rhs)!=0; } - + /** A vector of osg::StateSet pointers which is used to store the parent(s) of this StateAttribute.*/ typedef std::vector ParentList; @@ -279,13 +279,13 @@ class OSG_EXPORT StateAttribute : public Object virtual void usesTextureMode(GLMode mode) = 0; }; - /** Return the modes associated with this StateAttribute.*/ + /** Return the modes associated with this StateAttribute.*/ virtual bool getModeUsage(ModeUsage&) const { // default to no GLMode's associated with use of the StateAttribute. return false; } - + /** Check the modes associated with this StateAttribute are supported by current OpenGL drivers, * and if not set the associated mode in osg::State to be black listed/invalid. * Return true if all associated modes are valid.*/ @@ -317,8 +317,8 @@ class OSG_EXPORT StateAttribute : public Object /** Get the const EventCallback.*/ const StateAttributeCallback* getEventCallback() const { return _eventCallback.get(); } - - /** apply the OpenGL state attributes. + + /** apply the OpenGL state attributes. * The render info for the current OpenGL context is passed * in to allow the StateAttribute to obtain details on the * the current context and state. @@ -338,7 +338,7 @@ class OSG_EXPORT StateAttribute : public Object protected: - + virtual ~StateAttribute() {} void addParent(osg::StateSet* object); diff --git a/include/osg/StateAttributeCallback b/include/osg/StateAttributeCallback index 947259b54..09e38ceb4 100644 --- a/include/osg/StateAttributeCallback +++ b/include/osg/StateAttributeCallback @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSG_STATEATTRIBUTECALLBACK diff --git a/include/osg/StateSet b/include/osg/StateSet index 5b4752bcd..98e791896 100644 --- a/include/osg/StateSet +++ b/include/osg/StateSet @@ -70,7 +70,7 @@ class OSG_EXPORT StateSet : public Object /** Get the parent list of this StateSet. */ 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.*/ inline ParentList getParents() { return _parents; } @@ -277,7 +277,7 @@ class OSG_EXPORT StateSet : public Object /** Set this StateSet to contain specified uniform and override flag.*/ void addUniform(Uniform* uniform, StateAttribute::OverrideValue value=StateAttribute::ON); - + /** remove uniform of specified name from StateSet.*/ void removeUniform(const std::string& name); @@ -405,7 +405,7 @@ class OSG_EXPORT StateSet : public Object /** Get the number of Objects of this StateSet which require Update traversal, * since they have an Update Callback attached to them or their children.*/ inline unsigned int getNumChildrenRequiringUpdateTraversal() const { return _numChildrenRequiringUpdateTraversal; } - + /** Run the update callbacks attached directly to this StateSet or to its children.*/ void runUpdateCallbacks(osg::NodeVisitor* nv); @@ -425,7 +425,7 @@ class OSG_EXPORT StateSet : public Object /** Get the number of Objects of this StateSet which require Event traversal, * since they have an Eevnt Callback attached to them or their children.*/ inline unsigned int getNumChildrenRequiringEventTraversal() const { return _numChildrenRequiringEventTraversal; } - + /** Run the event callbacks attached directly to this StateSet or to its children.*/ void runEventCallbacks(osg::NodeVisitor* nv); @@ -461,7 +461,7 @@ class OSG_EXPORT StateSet : public Object friend class osg::Drawable; friend class osg::Uniform; friend class osg::StateAttribute; - + ModeList _modeList; AttributeList _attributeList; @@ -502,7 +502,7 @@ class OSG_EXPORT StateSet : public Object int _binNum; std::string _binName; bool _nestRenderBins; - + ref_ptr _updateCallback; unsigned int _numChildrenRequiringUpdateTraversal; void setNumChildrenRequiringUpdateTraversal(unsigned int num); diff --git a/include/osg/Stats b/include/osg/Stats index 0a4dc4ae0..ccdc06d83 100644 --- a/include/osg/Stats +++ b/include/osg/Stats @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,20 +32,20 @@ class OSG_EXPORT Stats : public osg::Referenced Stats(const std::string& name); Stats(const std::string& name, unsigned int numberOfFrames); - + void setName(const std::string& name) { _name = name; } const std::string& getName() const { return _name; } - + void allocate(unsigned int numberOfFrames); - + unsigned int getEarliestFrameNumber() const { return _latestFrameNumber < static_cast(_attributeMapList.size()) ? 0 : _latestFrameNumber - static_cast(_attributeMapList.size()) + 1; } unsigned int getLatestFrameNumber() const { return _latestFrameNumber; } - + typedef std::map AttributeMap; typedef std::vector AttributeMapList; bool setAttribute(unsigned int frameNumber, const std::string& attributeName, double value); - + inline bool getAttribute(unsigned int frameNumber, const std::string& attributeName, double& value) const { OpenThreads::ScopedLock lock(_mutex); @@ -53,40 +53,40 @@ class OSG_EXPORT Stats : public osg::Referenced } bool getAveragedAttribute(const std::string& attributeName, double& value, bool averageInInverseSpace=false) const; - + bool getAveragedAttribute(unsigned int startFrameNumber, unsigned int endFrameNumber, const std::string& attributeName, double& value, bool averageInInverseSpace=false) const; - + inline AttributeMap& getAttributeMap(unsigned int frameNumber) { OpenThreads::ScopedLock lock(_mutex); return getAttributeMapNoMutex(frameNumber); } - + inline const AttributeMap& getAttributeMap(unsigned int frameNumber) const { OpenThreads::ScopedLock lock(_mutex); return getAttributeMapNoMutex(frameNumber); } - + typedef std::map CollectMap; - + void collectStats(const std::string& str, bool flag) { _collectMap[str] = flag; } - + inline bool collectStats(const std::string& str) const { OpenThreads::ScopedLock lock(_mutex); - - CollectMap::const_iterator itr = _collectMap.find(str); + + CollectMap::const_iterator itr = _collectMap.find(str); return (itr != _collectMap.end()) ? itr->second : false; } void report(std::ostream& out, const char* indent=0) const; void report(std::ostream& out, unsigned int frameNumber, const char* indent=0) const; - + protected: - + virtual ~Stats() {} - + bool getAttributeNoMutex(unsigned int frameNumber, const std::string& attributeName, double& value) const; AttributeMap& getAttributeMapNoMutex(unsigned int frameNumber); @@ -97,26 +97,26 @@ class OSG_EXPORT Stats : public osg::Referenced { // reject frame that are in the future if (frameNumber > _latestFrameNumber) return -1; - + // reject frames that are too early if (frameNumber < getEarliestFrameNumber()) return -1; - + if (frameNumber >= _baseFrameNumber) return frameNumber - _baseFrameNumber; else return static_cast(_attributeMapList.size()) - (_baseFrameNumber-frameNumber); } std::string _name; - + mutable OpenThreads::Mutex _mutex; - + unsigned int _baseFrameNumber; unsigned int _latestFrameNumber; - + AttributeMapList _attributeMapList; AttributeMap _invalidAttributeMap; - + CollectMap _collectMap; - + }; diff --git a/include/osg/StencilTwoSided b/include/osg/StencilTwoSided index 8e5732d10..fc33cc892 100644 --- a/include/osg/StencilTwoSided +++ b/include/osg/StencilTwoSided @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -103,7 +103,7 @@ class OSG_EXPORT StencilTwoSided : public StateAttribute DECR_WRAP = GL_DECR_WRAP }; - /** set the operations to apply when the various stencil and depth + /** set the operations to apply when the various stencil and depth * tests fail or pass. First parameter is to control the operation * when the stencil test fails. The second parameter is to control the * operation when the stencil test passes, but depth test fails. The @@ -146,7 +146,7 @@ class OSG_EXPORT StencilTwoSided : public StateAttribute public: /** 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. */ class OSG_EXPORT Extensions : public osg::Referenced diff --git a/include/osg/Switch b/include/osg/Switch index d8c0ca431..65635d22d 100644 --- a/include/osg/Switch +++ b/include/osg/Switch @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,13 +20,13 @@ namespace osg { /** Switch is a Group node that allows switching between children. * Typical uses would be for objects which might need to be rendered - * differently at different times, for instance a switch could be used + * differently at different times, for instance a switch could be used * to represent the different states of a traffic light. */ class OSG_EXPORT Switch : public Group { public : - + Switch(); @@ -40,9 +40,9 @@ class OSG_EXPORT Switch : public Group META_Node(osg, Switch); virtual void traverse(NodeVisitor& nv); - + void setNewChildDefaultValue(bool value) { _newChildDefaultValue = value; } - + bool getNewChildDefaultValue() const { return _newChildDefaultValue; } virtual bool addChild( Node *child ); @@ -61,23 +61,23 @@ class OSG_EXPORT Switch : public Group bool getValue(unsigned int pos) const; void setChildValue(const Node* child,bool value); - + bool getChildValue(const Node* child) const; /** Set all the children off (false), and set the new default child * value to off (false). */ bool setAllChildrenOff(); - + /** Set all the children on (true), and set the new default child * value to on (true). */ bool setAllChildrenOn(); - + /** Set a single child on, switch off all other children. */ bool setSingleChildOn(unsigned int pos); - + typedef std::vector ValueList; - + void setValueList(const ValueList& values) { _values=values; } const ValueList& getValueList() const { return _values; } @@ -85,7 +85,7 @@ class OSG_EXPORT Switch : public Group virtual BoundingSphere computeBound() const; protected : - + virtual ~Switch() {} // This is effectively a bit mask. diff --git a/include/osg/TexEnv b/include/osg/TexEnv index 47dd8c20d..8d24b51e0 100644 --- a/include/osg/TexEnv +++ b/include/osg/TexEnv @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ class OSG_EXPORT TexEnv : public StateAttribute }; TexEnv(Mode mode=MODULATE); - + /** Copy constructor using CopyOp to manage deep vs shallow copy. */ TexEnv(const TexEnv& texenv,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(texenv,copyop), @@ -70,11 +70,11 @@ class OSG_EXPORT TexEnv : public StateAttribute void setMode( Mode mode ) { _mode = mode; } - + Mode getMode() const { return _mode; } - + void setColor( const Vec4& color ) { _color = color; } - + Vec4& getColor() { return _color; } const Vec4& getColor() const { return _color; } diff --git a/include/osg/TexEnvCombine b/include/osg/TexEnvCombine index 47992340a..02f27837c 100644 --- a/include/osg/TexEnvCombine +++ b/include/osg/TexEnvCombine @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -63,7 +63,7 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute public : TexEnvCombine(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy. */ TexEnvCombine(const TexEnvCombine& texenv,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(texenv,copyop), @@ -140,7 +140,7 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute GLint getCombine_RGB() const { return _combine_RGB; } GLint getCombine_Alpha() const { return _combine_Alpha; } - + enum SourceParam { CONSTANT = GL_CONSTANT_ARB, @@ -156,11 +156,11 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute TEXTURE6 = GL_TEXTURE0+6, TEXTURE7 = GL_TEXTURE0+7 }; - + void setSource0_RGB(GLint sp); void setSource1_RGB(GLint sp); void setSource2_RGB(GLint sp); - + void setSource0_Alpha(GLint sp); void setSource1_Alpha(GLint sp); void setSource2_Alpha(GLint sp); @@ -168,7 +168,7 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute GLint getSource0_RGB() const { return _source0_RGB; } GLint getSource1_RGB() const { return _source1_RGB; } GLint getSource2_RGB() const { return _source2_RGB; } - + GLint getSource0_Alpha() const { return _source0_Alpha; } GLint getSource1_Alpha() const { return _source1_Alpha; } GLint getSource2_Alpha() const { return _source2_Alpha; } @@ -180,11 +180,11 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute SRC_ALPHA = GL_SRC_ALPHA, ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA }; - + void setOperand0_RGB(GLint op); void setOperand1_RGB(GLint op); void setOperand2_RGB(GLint op); - + void setOperand0_Alpha(GLint op); void setOperand1_Alpha(GLint op); void setOperand2_Alpha(GLint op); @@ -192,7 +192,7 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute GLint getOperand0_RGB() const { return _operand0_RGB; } GLint getOperand1_RGB() const { return _operand1_RGB; } GLint getOperand2_RGB() const { return _operand2_RGB; } - + GLint getOperand0_Alpha() const { return _operand0_Alpha; } GLint getOperand1_Alpha() const { return _operand1_Alpha; } GLint getOperand2_Alpha() const { return _operand2_Alpha; } @@ -245,22 +245,22 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute needsTexEnvCombiner(_source2_RGB) || needsTexEnvCombiner(_source0_Alpha) || needsTexEnvCombiner(_source1_Alpha) || - needsTexEnvCombiner(_source2_Alpha)); + needsTexEnvCombiner(_source2_Alpha)); } - - + + bool _needsTexEnvCrossbar; GLint _combine_RGB; GLint _combine_Alpha; - + GLint _source0_RGB; GLint _source1_RGB; GLint _source2_RGB; - + GLint _source0_Alpha; GLint _source1_Alpha; GLint _source2_Alpha; @@ -269,7 +269,7 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute GLint _operand0_RGB; GLint _operand1_RGB; GLint _operand2_RGB; - + GLint _operand0_Alpha; GLint _operand1_Alpha; GLint _operand2_Alpha; @@ -277,7 +277,7 @@ class OSG_EXPORT TexEnvCombine : public StateAttribute float _scale_RGB; float _scale_Alpha; - + osg::Vec4 _constantColor; }; diff --git a/include/osg/TexEnvFilter b/include/osg/TexEnvFilter index cffce29bc..38fe6d157 100644 --- a/include/osg/TexEnvFilter +++ b/include/osg/TexEnvFilter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,7 +30,7 @@ class OSG_EXPORT TexEnvFilter : public StateAttribute { public: TexEnvFilter(float lodBias = 0.0f); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ TexEnvFilter(const TexEnvFilter& texenv,const CopyOp& copyop=CopyOp::SHALLOW_COPY): StateAttribute(texenv,copyop), @@ -54,7 +54,7 @@ class OSG_EXPORT TexEnvFilter : public StateAttribute } void setLodBias( float lodBias ) { _lodBias = lodBias; } - + float getLodBias() const { return _lodBias; } virtual void apply(State& state) const; diff --git a/include/osg/TexGen b/include/osg/TexGen index 1d77e7654..cb7200687 100644 --- a/include/osg/TexGen +++ b/include/osg/TexGen @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ namespace osg { class OSG_EXPORT TexGen : public StateAttribute { public : - + TexGen(); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ @@ -55,7 +55,7 @@ class OSG_EXPORT TexGen : public StateAttribute _plane_q(texgen._plane_q) {} META_StateAttribute(osg, TexGen, TEXGEN); - + virtual bool isTextureAttribute() const { return true; } /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ @@ -86,7 +86,7 @@ class OSG_EXPORT TexGen : public StateAttribute // So commenting out the following until OSG supports 3D textures. // I plan to revamp the OpenGL state management later so will // tidy up then. Robert Osfield. Jan 2001. - + // The tidy up is now happening, but will have a think before // resolving the below parameters. @@ -118,7 +118,7 @@ class OSG_EXPORT TexGen : public StateAttribute Plane& getPlane(Coord which); const Plane& getPlane(Coord which) const; - + /** Set the tex gen planes from specified matrix. * Typical usage would be to pass in a projection * matrix to set up projective texturing. diff --git a/include/osg/TexGenNode b/include/osg/TexGenNode index 1f5cd21be..f63c4d5b7 100644 --- a/include/osg/TexGenNode +++ b/include/osg/TexGenNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,18 +31,18 @@ class OSG_EXPORT TexGenNode : public Group TexGenNode(const TexGenNode& tgb, const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Node(osg, TexGenNode); - - + + enum ReferenceFrame { RELATIVE_RF, ABSOLUTE_RF }; - + /** Set the TexGenNode's ReferenceFrame, either to be relative to its * parent reference frame. */ void setReferenceFrame(ReferenceFrame rf); - + /** Get the TexGenNode's ReferenceFrame.*/ ReferenceFrame getReferenceFrame() const { return _referenceFrame; } @@ -53,7 +53,7 @@ class OSG_EXPORT TexGenNode : public Group /** Set the TexGen. */ void setTexGen(TexGen* texgen); - + /** Get the TexGen. */ inline TexGen* getTexGen() { return _texgen.get(); } diff --git a/include/osg/TexMat b/include/osg/TexMat index 0413f3bf5..a0e5b3bde 100644 --- a/include/osg/TexMat +++ b/include/osg/TexMat @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ class OSG_EXPORT TexMat : public StateAttribute _scaleByTextureRectangleSize(texmat._scaleByTextureRectangleSize) {} META_StateAttribute(osg, TexMat, TEXMAT); - + virtual bool isTextureAttribute() const { return true; } /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ @@ -64,7 +64,7 @@ class OSG_EXPORT TexMat : public StateAttribute /** Switch on/off the post scaling of the TexMat matrix by the size of the last applied texture rectangle. * Use a TexMat alongside a TextureRectangle with this scaling applied allows one to treat a TextureRectnagles texture coordinate * range as if it were the usual non dimensional 0.0 to 1.0 range. - * Note, the TexMat matrix itself is not modified by the post scaling, its purely an operation passed to OpenGL to do the post scaling once the + * Note, the TexMat matrix itself is not modified by the post scaling, its purely an operation passed to OpenGL to do the post scaling once the * the TexMat matrix has been loaded.*/ void setScaleByTextureRectangleSize(bool flag) { _scaleByTextureRectangleSize = flag; } diff --git a/include/osg/Texture b/include/osg/Texture index 119c3cae8..e1c2554b6 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -72,7 +72,7 @@ #endif #ifndef GL_OES_compressed_ETC1_RGB8_texture - #define GL_ETC1_RGB8_OES 0x8D64 + #define GL_ETC1_RGB8_OES 0x8D64 #endif #ifndef GL_ARB_INTERNAL_TEXTURE_FORMAT @@ -164,7 +164,7 @@ #endif #ifndef GL_CLAMP - #define GL_CLAMP 0x2900 + #define GL_CLAMP 0x2900 #endif #ifndef GL_CLAMP_TO_BORDER_ARB @@ -326,7 +326,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute /** Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.*/ virtual Texture* asTexture() { return this; } - + /** Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.*/ virtual const Texture* asTexture() const { return this; } @@ -376,7 +376,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute /** Sets the border width. */ void setBorderWidth(GLint width) { _borderWidth = width; dirtyTextureParameters(); } - + GLint getBorderWidth() const { return _borderWidth; } enum FilterParameter { @@ -406,7 +406,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute * value of 1.0. Valid range is 1.0f upwards. The maximum value * depends on the graphics system. */ void setMaxAnisotropy(float anis); - + /** Gets the maximum anisotropy value. */ inline float getMaxAnisotropy() const { return _maxAnisotropy; } @@ -421,7 +421,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute * data. If enabled, and the image data is only referenced by this * Texture, apply() will delete the image data. */ inline void setUnRefImageDataAfterApply(bool flag) { _unrefImageDataAfterApply = flag; } - + /** Gets whether or not apply() unreferences image data. */ inline bool getUnRefImageDataAfterApply() const { return _unrefImageDataAfterApply; } @@ -434,7 +434,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute /** Gets whether to use client storage for the texture. */ inline bool getClientStorageHint() const { return _clientStorageHint; } - /** Sets whether to force the texture to resize images that have dimensions + /** Sets whether to force the texture to resize images that have dimensions * that are not a power of two. If enabled, NPOT images will be resized, * whether or not NPOT textures are supported by the hardware. If disabled, * NPOT images will not be resized if supported by hardware. */ @@ -481,7 +481,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute /** Gets the internal texture format. */ inline GLint getInternalFormat() const { if (_internalFormat==0) computeInternalFormat(); return _internalFormat; } - + /** Return true if the internal format is one of the compressed formats.*/ bool isCompressedInternalFormat() const; @@ -512,10 +512,10 @@ class OSG_EXPORT Texture : public osg::StateAttribute //! Unsigned integer value (see EXT_texture_integer) UNSIGNED_INTEGER = 0x4 }; - + /** Get the internal texture format type. */ inline InternalFormatType getInternalFormatType() const { return _internalFormatType; } - + class TextureObject; /** Returns a pointer to the TextureObject for the current context. */ @@ -563,7 +563,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute * See http://oss.sgi.com/projects/ogl-sample/registry/ARB/shadow.txt. */ void setShadowComparison(bool flag) { _use_shadow_comparison = flag; } bool getShadowComparison() const { return _use_shadow_comparison; } - + enum ShadowCompareFunc { NEVER = GL_NEVER, LESS = GL_LESS, @@ -593,7 +593,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute * http://oss.sgi.com/projects/ogl-sample/registry/ARB/shadow_ambient.txt. */ void setShadowAmbient(float shadow_ambient) { _shadow_ambient = shadow_ambient; } float getShadowAmbient() const { return _shadow_ambient; } - + /** Sets the texture image for the specified face. */ virtual void setImage(unsigned int face, Image* image) = 0; @@ -633,7 +633,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ class OSG_EXPORT Extensions : public osg::Referenced { public: @@ -644,7 +644,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute void setTextureFilterAnisotropicSupported(bool flag) { _isTextureFilterAnisotropicSupported=flag; } bool isTextureFilterAnisotropicSupported() const { return _isTextureFilterAnisotropicSupported; } - + void setTextureCompressionARBSupported(bool flag) { _isTextureCompressionARBSupported=flag; } bool isTextureCompressionARBSupported() const { return _isTextureCompressionARBSupported; } @@ -653,10 +653,10 @@ class OSG_EXPORT Texture : public osg::StateAttribute void setTextureCompressionPVRTC2BPPSupported(bool flag) { _isTextureCompressionPVRTC2BPPSupported=flag; } bool isTextureCompressionPVRTC2BPPSupported() const { return _isTextureCompressionPVRTC2BPPSupported; } - + void setTextureCompressionPVRTC4BPPSupported(bool flag) { _isTextureCompressionPVRTC4BPPSupported=flag; } bool isTextureCompressionPVRTC4BPPSupported() const { return _isTextureCompressionPVRTC4BPPSupported; } - + void setTextureCompressionETCSupported(bool flag) { _isTextureCompressionETCSupported=flag; } bool isTextureCompressionETCSupported() const { return _isTextureCompressionETCSupported; } @@ -698,12 +698,12 @@ class OSG_EXPORT Texture : public osg::StateAttribute bool isCompressedTexImage2DSupported() const { return _glCompressedTexImage2D!=0; } bool isCompressedTexSubImage2DSupported() const { return _glCompressedTexSubImage2D!=0; } - + bool isClientStorageSupported() const { return _isClientStorageSupported; } bool isNonPowerOfTwoTextureSupported(GLenum filter) const { - return (filter==GL_LINEAR || filter==GL_NEAREST) ? + return (filter==GL_LINEAR || filter==GL_NEAREST) ? _isNonPowerOfTwoTextureNonMipMappedSupported : _isNonPowerOfTwoTextureMipMappedSupported; } @@ -744,7 +744,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute protected: ~Extensions() {} - + typedef void (GL_APIENTRY * CompressedTexImage2DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (GL_APIENTRY * CompressedTexSubImage2DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (GL_APIENTRY * GetCompressedTexImageArbProc) (GLenum target, GLint level, GLvoid *data); @@ -785,7 +785,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute GLint _maxTextureSize; GLint _numTextureUnits; }; - + /** Gets the extension for the specified context. Creates the * Extensions object for that context if it doesn't exist. * Returns NULL if the Extensions object for the context doesn't @@ -800,7 +800,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute /** Determine whether the given internalFormat is a compressed * image format. */ static bool isCompressedInternalFormat(GLint internalFormat); - + /** Determine the size of a compressed image, given the internalFormat, * the width, the height, and the depth of the image. The block size * and the size are output parameters. */ @@ -811,7 +811,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute * texture binding. Note: Don't call this method directly unless * you're implementing a subload callback. */ void applyTexImage2D_load(State& state, GLenum target, const Image* image, GLsizei width, GLsizei height,GLsizei numMipmapLevels) const; - + /** Helper method. Subloads images into the texture, but doesn't set * or use a texture binding. Note: Don't call this method directly * unless you're implementing a subload callback. */ @@ -832,13 +832,13 @@ class OSG_EXPORT Texture : public osg::StateAttribute virtual ~Texture(); virtual void computeInternalFormat() const = 0; - + /** Computes the internal format from Image parameters. */ void computeInternalFormatWithImage(const osg::Image& image) const; /** Computes the texture dimension for the given Image. */ void computeRequiredTextureDimensions(State& state, const osg::Image& image,GLsizei& width, GLsizei& height,GLsizei& numMipmapLevels) const; - + /** Computes the internal format type. */ void computeInternalFormatType() const; diff --git a/include/osg/Texture1D b/include/osg/Texture1D index 1513c56f6..65f48d686 100644 --- a/include/osg/Texture1D +++ b/include/osg/Texture1D @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,14 +31,14 @@ class OSG_EXPORT Texture1D : public Texture { public : - + Texture1D(); Texture1D(Image* image); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Texture1D(const Texture1D& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - + META_StateAttribute(osg, Texture1D,TEXTURE); /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ @@ -91,9 +91,9 @@ class OSG_EXPORT Texture1D : public Texture virtual void load(const Texture1D& texture,State& state) const = 0; virtual void subload(const Texture1D& texture,State& state) const = 0; }; - + void setSubloadCallback(SubloadCallback* cb) { _subloadCallback = cb;; } - + SubloadCallback* getSubloadCallback() { return _subloadCallback.get(); } const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); } @@ -145,7 +145,7 @@ class OSG_EXPORT Texture1D : public Texture /** Subloaded images can have different texture and image sizes. */ mutable GLsizei _textureWidth; - + /** Number of mipmap levels created. */ mutable GLsizei _numMipmapLevels; diff --git a/include/osg/Texture2D b/include/osg/Texture2D index 7fc528c2c..199e55790 100644 --- a/include/osg/Texture2D +++ b/include/osg/Texture2D @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,14 +25,14 @@ class OSG_EXPORT Texture2D : public Texture { public : - + Texture2D(); Texture2D(Image* image); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Texture2D(const Texture2D& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - + META_StateAttribute(osg, Texture2D,TEXTURE); /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ @@ -101,9 +101,9 @@ class OSG_EXPORT Texture2D : public Texture virtual void load(const Texture2D& texture,State& state) const = 0; virtual void subload(const Texture2D& texture,State& state) const = 0; }; - + void setSubloadCallback(SubloadCallback* cb) { _subloadCallback = cb;; } - + SubloadCallback* getSubloadCallback() { return _subloadCallback.get(); } const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); } @@ -116,7 +116,7 @@ class OSG_EXPORT Texture2D : public Texture /** Gets the number of mipmap levels created. */ unsigned int getNumMipmapLevels() const { return _numMipmapLevels; } - + /** Copies pixels into a 2D texture image, as per glCopyTexImage2D. * Creates an OpenGL texture object from the current OpenGL background @@ -156,8 +156,8 @@ class OSG_EXPORT Texture2D : public Texture /** Subloaded images can have different texture and image sizes. */ mutable GLsizei _textureWidth, _textureHeight; - - /** Number of mipmap levels created. */ + + /** Number of mipmap levels created. */ mutable GLsizei _numMipmapLevels; ref_ptr _subloadCallback; diff --git a/include/osg/Texture2DArray b/include/osg/Texture2DArray index 5dbcb0605..b6ed4a6c6 100644 --- a/include/osg/Texture2DArray +++ b/include/osg/Texture2DArray @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,9 +19,9 @@ namespace osg { -/** Texture2DArray state class which encapsulates OpenGL 2D array texture functionality. +/** Texture2DArray state class which encapsulates OpenGL 2D array texture functionality. * Texture arrays were introduced with Shader Model 4.0 hardware. - * + * * A 2D texture array does contain textures sharing the same properties (e.g. size, bitdepth,...) * in a layered structure. See http://www.opengl.org/registry/specs/EXT/texture_array.txt for more info. */ @@ -29,14 +29,14 @@ class OSG_EXPORT Texture2DArray : public Texture { public : - + Texture2DArray(); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Texture2DArray(const Texture2DArray& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_StateAttribute(osg, Texture2DArray, TEXTURE); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& rhs) const; @@ -51,12 +51,12 @@ class OSG_EXPORT Texture2DArray : public Texture /** Get the const texture image for specified layer. */ virtual const Image* getImage(unsigned int layer) const; - /** Get the number of images that are assigned to the Texture. + /** Get the number of images that are assigned to the Texture. * The number is equal to the texture depth. To get the maximum possible * image/layer count, you have to use the extension subclass, since it provides * graphic context dependent information. */ - virtual unsigned int getNumImages() const { return getTextureDepth(); } + virtual unsigned int getNumImages() const { return getTextureDepth(); } /** Check how often was a certain layer in the given context modified */ inline unsigned int& getModifiedCount(unsigned int layer, unsigned int contextID) const @@ -85,15 +85,15 @@ class OSG_EXPORT Texture2DArray : public Texture virtual void load(const Texture2DArray& texture,State& state) const = 0; virtual void subload(const Texture2DArray& texture,State& state) const = 0; }; - - + + void setSubloadCallback(SubloadCallback* cb) { _subloadCallback = cb;; } - + SubloadCallback* getSubloadCallback() { return _subloadCallback.get(); } const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); } - - + + /** Set the number of mip map levels the the texture has been created with. * Should only be called within an osg::Texture::apply() and custom OpenGL texture load. @@ -101,25 +101,25 @@ class OSG_EXPORT Texture2DArray : public Texture void setNumMipmapLevels(unsigned int num) const { _numMipmapLevels=num; } /** Get the number of mip map levels the the texture has been created with. */ - unsigned int getNumMipmapLevels() const { return _numMipmapLevels; } + unsigned int getNumMipmapLevels() const { return _numMipmapLevels; } /** Copies a two-dimensional texture subimage, as per * glCopyTexSubImage3D. Updates a portion of an existing OpenGL * texture object from the current OpenGL background framebuffer * contents at position \a x, \a y with width \a width and height * \a height. Loads framebuffer data into the texture using offsets - * \a xoffset and \a yoffset. \a zoffset specifies the layer of the texture - * array to which the result is copied. + * \a xoffset and \a yoffset. \a zoffset specifies the layer of the texture + * array to which the result is copied. */ void copyTexSubImage2DArray(State& state, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height ); /** Bind the texture if already compiled. Otherwise recompile. */ virtual void apply(State& state) const; - + /** Extensions class which encapsulates the querying of extensions and - * associated function pointers, and provides convenience wrappers to + * associated function pointers, and provides convenience wrappers to * check for the extensions or use the associated functions. */ class OSG_EXPORT Extensions : public osg::Referenced @@ -128,29 +128,29 @@ class OSG_EXPORT Texture2DArray : public Texture Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setTexture2DArraySupported(bool flag) { _isTexture2DArraySupported=flag; } bool isTexture2DArraySupported() const { return _isTexture2DArraySupported; } - + void setTexture3DSupported(bool flag) { _isTexture3DSupported=flag; } bool isTexture3DSupported() const { return _isTexture3DSupported; } void setMaxLayerCount(GLint count) { _maxLayerCount = count; } GLint maxLayerCount() const { return _maxLayerCount; } - + void setMax2DSize(GLint size) { _max2DSize = size; } GLint max2DSize() const { return _max2DSize; } - + void glTexImage3D( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) const; void glTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) const; - + void glCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) const; - + bool isCompressedTexImage3DSupported() const { return _glCompressedTexImage3D!=0; } void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) const; @@ -160,10 +160,10 @@ class OSG_EXPORT Texture2DArray : public Texture protected: ~Extensions() {} - + bool _isTexture2DArraySupported; bool _isTexture3DSupported; - + GLint _maxLayerCount; GLint _max2DSize; @@ -178,13 +178,13 @@ class OSG_EXPORT Texture2DArray : public Texture CompressedTexImage3DArbProc _glCompressedTexImage3D; CompressedTexSubImage3DArbProc _glCompressedTexSubImage3D; GLCopyTexSubImageProc _glCopyTexSubImage3D; - + }; - + /** 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 '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 * only be created with the graphics context associated with ContextID. */ @@ -200,9 +200,9 @@ class OSG_EXPORT Texture2DArray : public Texture protected : virtual ~Texture2DArray(); - + bool imagesValid() const; - + virtual void computeInternalFormat() const; void allocateMipmap(State& state) const; @@ -215,8 +215,8 @@ class OSG_EXPORT Texture2DArray : public Texture // subloaded images can have different texture and image sizes. mutable GLsizei _textureWidth, _textureHeight, _textureDepth; - - // number of mip map levels the the texture has been created with, + + // number of mip map levels the the texture has been created with, mutable GLsizei _numMipmapLevels; ref_ptr _subloadCallback; diff --git a/include/osg/Texture2DMultisample b/include/osg/Texture2DMultisample index 36a393f6a..fa19deeb4 100644 --- a/include/osg/Texture2DMultisample +++ b/include/osg/Texture2DMultisample @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * Texture2DMultisample codes Copyright (C) 2010 Marcin Hajder @@ -21,7 +21,7 @@ namespace osg { - /** Texture2DMultisample state class which encapsulates OpenGL 2D multisampled texture functionality. + /** Texture2DMultisample state class which encapsulates OpenGL 2D multisampled texture functionality. * Multisampled texture were introduced with OpenGL 3.1 and extension GL_ARB_texture_multisample. * See http://www.opengl.org/registry/specs/ARB/texture_multisample.txt for more info. */ @@ -29,22 +29,22 @@ namespace osg { class OSG_EXPORT Texture2DMultisample : public Texture { public : - + Texture2DMultisample(); Texture2DMultisample(GLsizei numSamples, GLboolean fixedsamplelocations); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Texture2DMultisample(const Texture2DMultisample& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - + META_StateAttribute(osg, Texture2DMultisample,TEXTURE); /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& rhs) const; - virtual GLenum getTextureTarget() const - { - return GL_TEXTURE_2D_MULTISAMPLE; + virtual GLenum getTextureTarget() const + { + return GL_TEXTURE_2D_MULTISAMPLE; } /** Sets the texture width and height. If width or height are zero, diff --git a/include/osg/Texture3D b/include/osg/Texture3D index c8c0c88f3..005ca2015 100644 --- a/include/osg/Texture3D +++ b/include/osg/Texture3D @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,14 +29,14 @@ class OSG_EXPORT Texture3D : public Texture { public : - + Texture3D(); Texture3D(Image* image); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Texture3D(const Texture3D& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - + META_StateAttribute(osg, Texture3D,TEXTURE); /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ @@ -105,9 +105,9 @@ class OSG_EXPORT Texture3D : public Texture virtual void load(const Texture3D& texture,State& state) const = 0; virtual void subload(const Texture3D& texture,State& state) const = 0; }; - + void setSubloadCallback(SubloadCallback* cb) { _subloadCallback = cb;; } - + SubloadCallback* getSubloadCallback() { return _subloadCallback.get(); } const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); } @@ -120,7 +120,7 @@ class OSG_EXPORT Texture3D : public Texture /** Gets the number of mipmap levels created. */ unsigned int getNumMipmapLevels() const { return _numMipmapLevels; } - + /** Copies a two-dimensional texture subimage, as per * glCopyTexSubImage3D. Updates a portion of an existing OpenGL @@ -135,25 +135,25 @@ class OSG_EXPORT Texture3D : public Texture /** Bind the texture object. If the texture object hasn't already been * compiled, create the texture mipmap levels. */ virtual void apply(State& state) const; - + /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ class OSG_EXPORT Extensions : public osg::Referenced { public: Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setTexture3DSupported(bool flag) { _isTexture3DSupported=flag; } bool isTexture3DSupported() const { return _isTexture3DSupported; } - + void setTexture3DFast(bool flag) { _isTexture3DFast=flag; } bool isTexture3DFast() const { return _isTexture3DFast; } @@ -184,10 +184,10 @@ class OSG_EXPORT Texture3D : public Texture bool _isTexture3DFast; GLint _maxTexture3DSize; }; - + /** Encapsulates queries of extension availability, obtains extension * function pointers, and provides convenience wrappers for - * calling extension functions. */ + * calling extension functions. */ static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); /** Overrides Extensions objects across graphics contexts. Typically @@ -214,7 +214,7 @@ class OSG_EXPORT Texture3D : public Texture /** Subloaded images can have different texture and image sizes. */ mutable GLsizei _textureWidth, _textureHeight, _textureDepth; - + /** Number of mip map levels the the texture has been created with, */ mutable GLsizei _numMipmapLevels; diff --git a/include/osg/TextureCubeMap b/include/osg/TextureCubeMap index 566b69c70..99956bfe3 100644 --- a/include/osg/TextureCubeMap +++ b/include/osg/TextureCubeMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,14 +24,14 @@ class OSG_EXPORT TextureCubeMap : public Texture { public : - + TextureCubeMap(); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ TextureCubeMap(const TextureCubeMap& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_StateAttribute(osg, TextureCubeMap,TEXTURE); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& rhs) const; @@ -86,9 +86,9 @@ class OSG_EXPORT TextureCubeMap : public Texture virtual void load(const TextureCubeMap& texture,State& state) const = 0; virtual void subload(const TextureCubeMap& texture,State& state) const = 0; }; - + void setSubloadCallback(SubloadCallback* cb) { _subloadCallback = cb;; } - + SubloadCallback* getSubloadCallback() { return _subloadCallback.get(); } const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); } @@ -100,7 +100,7 @@ class OSG_EXPORT TextureCubeMap : public Texture void setNumMipmapLevels(unsigned int num) const { _numMipmapLevels=num; } /** Get the number of mip map levels the the texture has been created with. */ - unsigned int getNumMipmapLevels() const { return _numMipmapLevels; } + unsigned int getNumMipmapLevels() const { return _numMipmapLevels; } /** Copies a two-dimensional texture subimage, as per * glCopyTexSubImage2D. Updates a portion of an existing OpenGL @@ -116,10 +116,10 @@ class OSG_EXPORT TextureCubeMap : public Texture * texture and bind it. Subsequent apply will simple bind to texture. */ virtual void apply(State& state) const; - + /** Extensions class which encapsulates the querying of extensions and - * associated function pointers, and provides convenience wrappers to + * associated function pointers, and provides convenience wrappers to * check for the extensions or use the associated functions. */ class OSG_EXPORT Extensions : public osg::Referenced @@ -128,9 +128,9 @@ class OSG_EXPORT TextureCubeMap : public Texture Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setCubeMapSupported(bool flag) { _isCubeMapSupported=flag; } @@ -139,15 +139,15 @@ class OSG_EXPORT TextureCubeMap : public Texture protected: ~Extensions() {} - + bool _isCubeMapSupported; }; - + /** Function to call to get the extension of a specified context. * If the Extensions object for that context has not yet been created * 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 * only be created with the graphics context associated with ContextID. */ @@ -163,9 +163,9 @@ class OSG_EXPORT TextureCubeMap : public Texture protected : virtual ~TextureCubeMap(); - + bool imagesValid() const; - + virtual void computeInternalFormat() const; void allocateMipmap(State& state) const; @@ -173,8 +173,8 @@ class OSG_EXPORT TextureCubeMap : public Texture // subloaded images can have different texture and image sizes. mutable GLsizei _textureWidth, _textureHeight; - - // number of mip map levels the the texture has been created with, + + // number of mip map levels the the texture has been created with, mutable GLsizei _numMipmapLevels; ref_ptr _subloadCallback; diff --git a/include/osg/TextureRectangle b/include/osg/TextureRectangle index 104b5aef2..d6332150d 100644 --- a/include/osg/TextureRectangle +++ b/include/osg/TextureRectangle @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -117,7 +117,7 @@ class OSG_EXPORT TextureRectangle : public Texture * of two. */ void copyTexSubImage2D(State& state, int xoffset, int yoffset, int x, int y, int width, int height ); - /** On first apply (unless already compiled), create and bind the + /** On first apply (unless already compiled), create and bind the * texture, subsequent apply will simply bind to texture. */ virtual void apply(State& state) const; @@ -136,7 +136,7 @@ class OSG_EXPORT TextureRectangle : public Texture // subloaded images can have different texture and image sizes. mutable GLsizei _textureWidth, _textureHeight; - + ref_ptr _subloadCallback; typedef buffered_value ImageModifiedCount; diff --git a/include/osg/Timer b/include/osg/Timer index 984e07829..bf1c8c74f 100644 --- a/include/osg/Timer +++ b/include/osg/Timer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ class OSG_EXPORT Timer { void setStartTick(Timer_t t) { _startTick = t; } Timer_t getStartTick() const { return _startTick; } - + /** Get elapsed time in seconds.*/ inline double time_s() const { return delta_s(_startTick, tick()); } @@ -54,7 +54,7 @@ class OSG_EXPORT Timer { /** Get elapsed time in nanoseconds.*/ inline double time_n() const { return delta_n(_startTick, tick()); } - + /** Get the time in seconds between timer ticks t1 and t2.*/ inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerTick; } @@ -66,7 +66,7 @@ class OSG_EXPORT Timer { /** Get the time in nanoseconds between timer ticks t1 and t2.*/ inline double delta_n( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e9; } - + /** Get the the number of seconds per tick. */ inline double getSecondsPerTick() const { return _secsPerTick; } diff --git a/include/osg/TransferFunction b/include/osg/TransferFunction index e89c519f7..85cab77de 100644 --- a/include/osg/TransferFunction +++ b/include/osg/TransferFunction @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,14 +23,14 @@ namespace osg { /** TransferFunction is a class that provide a 1D,2D or 3D colour look up table - * that can be used on the GPU as a 1D, 2D or 3D texture. - * Typically uses include mapping heights to colours when contouring terrain, + * that can be used on the GPU as a 1D, 2D or 3D texture. + * Typically uses include mapping heights to colours when contouring terrain, * or mapping intensities to colours when volume rendering. */ class OSG_EXPORT TransferFunction : public osg::Object { public : - + TransferFunction(); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ @@ -43,9 +43,9 @@ class OSG_EXPORT TransferFunction : public osg::Object /** Get the const image that is used for passing the transfer function data to the GPU.*/ const osg::Image* getImage() const { return _image.get(); } - + protected: - + virtual ~TransferFunction(); osg::ref_ptr _image; @@ -55,17 +55,17 @@ class OSG_EXPORT TransferFunction : public osg::Object class OSG_EXPORT TransferFunction1D : public osg::TransferFunction { public: - + TransferFunction1D(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ TransferFunction1D(const TransferFunction1D& tf, const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Object(osg, TransferFunction1D) - + /** Get the minimum transfer function value.*/ float getMinimum() const { return _colorMap.empty() ? 0.0f : _colorMap.begin()->first; } - + /** Get the maximum transfer function value.*/ float getMaximum() const { return _colorMap.empty() ? 0.0f : _colorMap.rbegin()->first; } @@ -75,12 +75,12 @@ class OSG_EXPORT TransferFunction1D : public osg::TransferFunction /** Clear the whole range to just represent a single color.*/ void clear(const osg::Vec4& color = osg::Vec4(1.0f,1.0f,1.0f,1.0f)); - + /** Get pixel value from the image. */ osg::Vec4 getPixelValue(unsigned int i) const { if (_image.valid() && i(_image->s())) - { + { return *reinterpret_cast(_image->data(i)); } else @@ -96,30 +96,30 @@ class OSG_EXPORT TransferFunction1D : public osg::TransferFunction * updateImage defaults to true, and tells the setColor function to update the associate osg::Image that * tracks the color map. Pass in false as the updateImage parameter if you are setting up many values * at once to avoid recomputation of the image data, then once all setColor calls are made explictly call - * updateImage() to bring the osg::Image back into sync with the color map. */ + * updateImage() to bring the osg::Image back into sync with the color map. */ void setColor(float v, const osg::Vec4& color, bool updateImage=true); - + /** Get the color for a specified transfer function value, interpolating the value if no exact match is found.*/ osg::Vec4 getColor(float v) const; - + typedef std::map ColorMap; - + /** Get the color map that stores the mapping between the the transfer function value and the colour it maps to.*/ ColorMap& getColorMap() { return _colorMap; } - + /** Get the const color map that stores the mapping between the the transfer function value and the colour it maps to.*/ const ColorMap& getColorMap() const { return _colorMap; } /** Assign a color map and automatically update the image to make sure they are in sync.*/ void assign(const ColorMap& vcm); - + /** Manually update the associate osg::Image to represent the colors assigned in the color map.*/ void updateImage(); protected: - + ColorMap _colorMap; - + void assignToImage(float lower_v, const osg::Vec4& lower_c, float upper_v, const osg::Vec4& upper_c); }; diff --git a/include/osg/Transform b/include/osg/Transform index dccb2e45e..f8f20ce47 100644 --- a/include/osg/Transform +++ b/include/osg/Transform @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ extern OSG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath, bool igno extern OSG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath, bool ignoreCameras = true); /** Compute the matrix which transforms objects in local coords to eye coords, - * by accumulating the Transform local to world matrices along the specified node path + * by accumulating the Transform local to world matrices along the specified node path * and multiplying by the supplied initial camera modelview. */ extern OSG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameras = true); @@ -63,7 +63,7 @@ extern OSG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePa * * Note: If the transformation matrix scales the subgraph then the normals * of the underlying geometry will need to be renormalized to be unit - * vectors once more. This can be done transparently through OpenGL's + * vectors once more. This can be done transparently through OpenGL's * use of either GL_NORMALIZE and GL_RESCALE_NORMAL modes. For further * background reading see the glNormalize documentation in the OpenGL * Reference Guide (the blue book). To enable it in the OSG, you simply @@ -97,7 +97,7 @@ class OSG_EXPORT Transform : public Group ABSOLUTE_RF, ABSOLUTE_RF_INHERIT_VIEWPOINT }; - + /** Set the transform's ReferenceFrame, either to be relative to its * parent reference frame, or relative to an absolute coordinate * frame. RELATIVE_RF is the default. @@ -112,12 +112,12 @@ class OSG_EXPORT Transform : public Group * ABSOLUTE_RF_INHERIT_VIEWPOINT is the same as ABSOLUTE_RF except it * adds the ability to use the parents view points position in world coordinates * as its local viewpoint in the new coordinates frame. This is useful for - * Render to texture Cameras that wish to use the main views LOD range computation + * Render to texture Cameras that wish to use the main views LOD range computation * (which uses the viewpoint rather than the eye point) rather than use the local * eye point defined by the this Transforms' absolute view matrix. */ void setReferenceFrame(ReferenceFrame rf); - + ReferenceFrame getReferenceFrame() const { return _referenceFrame; } virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const @@ -132,7 +132,7 @@ class OSG_EXPORT Transform : public Group return true; } } - + virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const { if (_referenceFrame==RELATIVE_RF) @@ -146,7 +146,7 @@ class OSG_EXPORT Transform : public Group } } - /** Overrides Group's computeBound. + /** Overrides Group's computeBound. * There is no need to override in subclasses from osg::Transform * since this computeBound() uses the underlying matrix (calling * computeMatrix if required). @@ -154,10 +154,10 @@ class OSG_EXPORT Transform : public Group virtual BoundingSphere computeBound() const; protected : - + virtual ~Transform(); - - + + ReferenceFrame _referenceFrame; }; diff --git a/include/osg/TriangleFunctor b/include/osg/TriangleFunctor index 4b34ececb..a60af0940 100644 --- a/include/osg/TriangleFunctor +++ b/include/osg/TriangleFunctor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -63,7 +63,7 @@ public: _vertexArrayPtr = vertices; } - virtual void setVertexArray(unsigned int,const Vec4* ) + virtual void setVertexArray(unsigned int,const Vec4* ) { notify(WARN)<<"Triangle Functor does not support Vec4* vertex arrays"<operator()(_vertexArrayPtr[*iptr],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],_treatVertexDataAsTemporary); - } + } break; } case(GL_TRIANGLE_STRIP): @@ -281,14 +281,14 @@ public: // can't be converted into to triangles. break; } - } + } virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) { if (indices==0 || count==0) return; - + typedef const GLuint* IndexPointer; - + switch(mode) { case(GL_TRIANGLES): diff --git a/include/osg/TriangleIndexFunctor b/include/osg/TriangleIndexFunctor index be3a5a9a2..91926efd7 100644 --- a/include/osg/TriangleIndexFunctor +++ b/include/osg/TriangleIndexFunctor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ class TriangleIndexFunctor : public PrimitiveIndexFunctor, public T public: - virtual void setVertexArray(unsigned int,const Vec2*) + virtual void setVertexArray(unsigned int,const Vec2*) { } @@ -33,11 +33,11 @@ public: { } - virtual void setVertexArray(unsigned int,const Vec4* ) + virtual void setVertexArray(unsigned int,const Vec4* ) { } - virtual void setVertexArray(unsigned int,const Vec2d*) + virtual void setVertexArray(unsigned int,const Vec2d*) { } @@ -45,7 +45,7 @@ public: { } - virtual void setVertexArray(unsigned int,const Vec4d* ) + virtual void setVertexArray(unsigned int,const Vec4d* ) { } @@ -197,7 +197,7 @@ public: // can't be converted into to triangles. break; } - } + } virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) { @@ -205,7 +205,7 @@ public: typedef GLushort Index; typedef const Index* IndexPointer; - + switch(mode) { case(GL_TRIANGLES): @@ -265,15 +265,15 @@ public: // can't be converted into to triangles. break; } - } + } virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) { if (indices==0 || count==0) return; - + typedef GLuint Index; typedef const Index* IndexPointer; - + switch(mode) { case(GL_TRIANGLES): @@ -333,7 +333,7 @@ public: // can't be converted into to triangles. break; } - } + } GLenum _modeCache; std::vector _indexCache; diff --git a/include/osg/Uniform b/include/osg/Uniform index 1eaa0311e..30be71ad5 100644 --- a/include/osg/Uniform +++ b/include/osg/Uniform @@ -1,11 +1,11 @@ -/* -*-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) 2008 Zebra Imaging * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -184,7 +184,7 @@ class OSG_EXPORT Uniform : public Object SAMPLER_CUBE = GL_SAMPLER_CUBE, SAMPLER_1D_SHADOW = GL_SAMPLER_1D_SHADOW, SAMPLER_2D_SHADOW = GL_SAMPLER_2D_SHADOW, - + SAMPLER_1D_ARRAY = GL_SAMPLER_1D_ARRAY_EXT, SAMPLER_2D_ARRAY = GL_SAMPLER_2D_ARRAY_EXT, SAMPLER_1D_ARRAY_SHADOW = GL_SAMPLER_1D_ARRAY_SHADOW_EXT, @@ -311,7 +311,7 @@ class OSG_EXPORT Uniform : public Object /** Get the parent list of this Uniform. */ 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.*/ inline ParentList getParents() { return _parents; } @@ -482,7 +482,7 @@ class OSG_EXPORT Uniform : public Object protected: - + virtual ~Uniform(); Uniform& operator=(const Uniform&) { return *this; } @@ -509,7 +509,7 @@ class OSG_EXPORT Uniform : public Object ref_ptr _updateCallback; ref_ptr _eventCallback; - + unsigned int _modifiedCount; }; diff --git a/include/osg/UserDataContainer b/include/osg/UserDataContainer index 992b7eef0..6b1bc01fd 100644 --- a/include/osg/UserDataContainer +++ b/include/osg/UserDataContainer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -78,7 +78,7 @@ class OSG_EXPORT UserDataContainer : public osg::Object /** Get the index position of first user data object that matches specified name.*/ virtual unsigned int getUserObjectIndex(const std::string& name, unsigned int startPos=0) const = 0; - + /** Get first user data object with specified name. */ virtual Object* getUserObject(const std::string& name, unsigned int startPos=0); @@ -160,7 +160,7 @@ class OSG_EXPORT DefaultUserDataContainer : public osg::UserDataContainer - + /** Set the list of string descriptions.*/ virtual void setDescriptions(const DescriptionList& descriptions); diff --git a/include/osg/ValueObject b/include/osg/ValueObject index 04e74b76b..b65b1e331 100644 --- a/include/osg/ValueObject +++ b/include/osg/ValueObject @@ -137,7 +137,7 @@ protected: virtual ~TemplateValueObject() {} static const char* s_TemplateValueObject_className; - + T _value; }; @@ -171,10 +171,10 @@ template bool osg::Object::getUserValue(const std::string& name, T& value) const { typedef TemplateValueObject UserValueObject; - + const osg::UserDataContainer* udc = dynamic_cast(this); if (!udc) udc = _userDataContainer; - + const UserValueObject* uvo = udc ? dynamic_cast(udc->getUserObject(name)) : 0; if (uvo) { @@ -199,7 +199,7 @@ void osg::Object::setUserValue(const std::string& name, const T& value) getOrCreateUserDataContainer(); udc = _userDataContainer; } - + unsigned int i = udc->getUserObjectIndex(name); if (igetNumUserObjects()) udc->setUserObject(i, new UserValueObject(name,value)); else udc->addUserObject(new UserValueObject(name,value)); diff --git a/include/osg/Vec2 b/include/osg/Vec2 index 27d2619b4..d3cdb5993 100644 --- a/include/osg/Vec2 +++ b/include/osg/Vec2 @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/Vec2b b/include/osg/Vec2b index cbeaec157..67f6cf6a5 100644 --- a/include/osg/Vec2b +++ b/include/osg/Vec2b @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,13 +33,13 @@ class Vec2b /** Number of vector components. */ enum { num_components = 2 }; - + /** Vec member variable. */ value_type _v[2]; /** Constructor that sets all components of the vector to zero */ Vec2b() { _v[0]=0; _v[1]=0; } - + Vec2b(value_type r, value_type g) { _v[0]=r; _v[1]=g; @@ -96,7 +96,7 @@ class Vec2b inline Vec2b& operator *= (float rhs) { _v[0]=(value_type)((float)_v[0]*rhs); - _v[1]=(value_type)((float)_v[1]*rhs); + _v[1]=(value_type)((float)_v[1]*rhs); return *this; } @@ -128,7 +128,7 @@ class Vec2b inline Vec2b& operator += (const Vec2b& rhs) { _v[0] += rhs._v[0]; - _v[1] += rhs._v[1]; + _v[1] += rhs._v[1]; return *this; } @@ -142,7 +142,7 @@ class Vec2b inline Vec2b& operator -= (const Vec2b& rhs) { _v[0]-=rhs._v[0]; - _v[1]-=rhs._v[1]; + _v[1]-=rhs._v[1]; return *this; } diff --git a/include/osg/Vec2d b/include/osg/Vec2d index 9b7deb6dd..96bc48e89 100644 --- a/include/osg/Vec2d +++ b/include/osg/Vec2d @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ class Vec2d /** Number of vector components. */ enum { num_components = 2 }; - + value_type _v[2]; /** Constructor that sets all components of the vector to zero */ @@ -43,7 +43,7 @@ class Vec2d Vec2d(value_type x,value_type y) { _v[0]=x; _v[1]=y; } inline Vec2d(const Vec2f& vec) { _v[0]=vec._v[0]; _v[1]=vec._v[1]; } - + inline operator Vec2f() const { return Vec2f(static_cast(_v[0]),static_cast(_v[1]));} diff --git a/include/osg/Vec2f b/include/osg/Vec2f index 618a814d8..6fee4a331 100644 --- a/include/osg/Vec2f +++ b/include/osg/Vec2f @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,10 +34,10 @@ class Vec2f /** Number of vector components. */ enum { num_components = 2 }; - + /** Vec member variable. */ value_type _v[2]; - + /** Constructor that sets all components of the vector to zero */ Vec2f() {_v[0]=0.0; _v[1]=0.0;} @@ -170,7 +170,7 @@ class Vec2f } return( norm ); } - + }; // end of class Vec2f /** multiply by vector components. */ diff --git a/include/osg/Vec2s b/include/osg/Vec2s index 662b02c40..137cc838b 100644 --- a/include/osg/Vec2s +++ b/include/osg/Vec2s @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ class Vec2s /** Number of vector components. */ enum { num_components = 2 }; - + value_type _v[2]; /** Constructor that sets all components of the vector to zero */ @@ -93,12 +93,12 @@ class Vec2s _v[1]/=rhs; return *this; } - + inline Vec2s operator * (const Vec2s& rhs) const { return Vec2s(_v[0]*rhs._v[0], _v[1]*rhs._v[1]); } - + inline Vec2s operator + (const Vec2s& rhs) const { return Vec2s(_v[0]+rhs._v[0], _v[1]+rhs._v[1]); @@ -128,7 +128,7 @@ class Vec2s { return Vec2s (-_v[0], -_v[1]); } - + }; // end of class Vec2s diff --git a/include/osg/Vec3 b/include/osg/Vec3 index 0e6089c42..d5496fd4f 100644 --- a/include/osg/Vec3 +++ b/include/osg/Vec3 @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/Vec3b b/include/osg/Vec3b index 53d8522c8..1706e0175 100644 --- a/include/osg/Vec3b +++ b/include/osg/Vec3b @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,12 +31,12 @@ class Vec3b /** Number of vector components. */ enum { num_components = 3 }; - + value_type _v[3]; /** Constructor that sets all components of the vector to zero */ Vec3b() { _v[0]=0; _v[1]=0; _v[2]=0; } - + Vec3b(value_type r, value_type g, value_type b) { _v[0]=r; _v[1]=g; _v[2]=b; } inline bool operator == (const Vec3b& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; } diff --git a/include/osg/Vec3d b/include/osg/Vec3d index 3d2cd9b8e..140627555 100644 --- a/include/osg/Vec3d +++ b/include/osg/Vec3d @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,14 +35,14 @@ class Vec3d /** Number of vector components. */ enum { num_components = 3 }; - + value_type _v[3]; /** Constructor that sets all components of the vector to zero */ Vec3d() { _v[0]=0.0; _v[1]=0.0; _v[2]=0.0;} inline Vec3d(const Vec3f& vec) { _v[0]=vec._v[0]; _v[1]=vec._v[1]; _v[2]=vec._v[2];} - + inline operator Vec3f() const { return Vec3f(static_cast(_v[0]),static_cast(_v[1]),static_cast(_v[2]));} Vec3d(value_type x,value_type y,value_type z) { _v[0]=x; _v[1]=y; _v[2]=z; } @@ -54,7 +54,7 @@ class Vec3d } inline bool operator == (const Vec3d& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; } - + inline bool operator != (const Vec3d& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2]; } inline bool operator < (const Vec3d& v) const @@ -202,7 +202,7 @@ class Vec3d _v[0] *= inv; _v[1] *= inv; _v[2] *= inv; - } + } return( norm ); } diff --git a/include/osg/Vec3f b/include/osg/Vec3f index 6c3abf3aa..c38811132 100644 --- a/include/osg/Vec3f +++ b/include/osg/Vec3f @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ class Vec3f /** Number of vector components. */ enum { num_components = 3 }; - + value_type _v[3]; /** Constructor that sets all components of the vector to zero */ @@ -49,7 +49,7 @@ class Vec3f inline bool operator == (const Vec3f& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; } - + inline bool operator != (const Vec3f& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2]; } inline bool operator < (const Vec3f& v) const @@ -196,7 +196,7 @@ class Vec3f _v[0] *= inv; _v[1] *= inv; _v[2] *= inv; - } + } return( norm ); } diff --git a/include/osg/Vec3s b/include/osg/Vec3s index a7bc03008..a2126069a 100644 --- a/include/osg/Vec3s +++ b/include/osg/Vec3s @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,12 +25,12 @@ class Vec3s /** Number of vector components. */ enum { num_components = 3 }; - + value_type _v[3]; /** Constructor that sets all components of the vector to zero */ Vec3s() { _v[0]=0; _v[1]=0; _v[2]=0; } - + Vec3s(value_type r, value_type g, value_type b) { _v[0]=r; _v[1]=g; _v[2]=b; } inline bool operator == (const Vec3s& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; } @@ -134,7 +134,7 @@ class Vec3s { return Vec3s(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2]); } - + /** Unary vector subtract. */ inline Vec3s& operator -= (const Vec3s& rhs) { diff --git a/include/osg/Vec4 b/include/osg/Vec4 index fc3bef4b5..437e56b9c 100644 --- a/include/osg/Vec4 +++ b/include/osg/Vec4 @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/Vec4b b/include/osg/Vec4b index 4a0dee6a1..74b1261eb 100644 --- a/include/osg/Vec4b +++ b/include/osg/Vec4b @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ class Vec4b /** Number of vector components. */ enum { num_components = 4 }; - + value_type _v[4]; /** Constructor that sets all components of the vector to zero */ diff --git a/include/osg/Vec4d b/include/osg/Vec4d index c020ee4a4..b4e376b55 100644 --- a/include/osg/Vec4d +++ b/include/osg/Vec4d @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ class Vec4d /** Number of vector components. */ enum { num_components = 4 }; - + value_type _v[4]; /** Constructor that sets all components of the vector to zero */ @@ -55,9 +55,9 @@ class Vec4d _v[2]=v3[2]; _v[3]=w; } - + inline Vec4d(const Vec4f& vec) { _v[0]=vec._v[0]; _v[1]=vec._v[1]; _v[2]=vec._v[2]; _v[3]=vec._v[3];} - + inline operator Vec4f() const { return Vec4f(static_cast(_v[0]),static_cast(_v[1]),static_cast(_v[2]),static_cast(_v[3]));} diff --git a/include/osg/Vec4f b/include/osg/Vec4f index 507e3695b..21a86f124 100644 --- a/include/osg/Vec4f +++ b/include/osg/Vec4f @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,7 +33,7 @@ class Vec4f /** Number of vector components. */ enum { num_components = 4 }; - + /** Vec member variable. */ value_type _v[4]; @@ -41,7 +41,7 @@ class Vec4f /** Constructor that sets all components of the vector to zero */ Vec4f() { _v[0]=0.0f; _v[1]=0.0f; _v[2]=0.0f; _v[3]=0.0f;} - + Vec4f(value_type x, value_type y, value_type z, value_type w) { _v[0]=x; @@ -57,7 +57,7 @@ class Vec4f _v[2]=v3[2]; _v[3]=w; } - + inline bool operator == (const Vec4f& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2] && _v[3]==v._v[3]; } inline bool operator != (const Vec4f& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2] || _v[3]!=v._v[3]; } diff --git a/include/osg/Vec4s b/include/osg/Vec4s index 85cf984cb..b86b43a5c 100644 --- a/include/osg/Vec4s +++ b/include/osg/Vec4s @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ class Vec4s /** Number of vector components. */ enum { num_components = 4 }; - + /** Vec member variable. */ value_type _v[4]; diff --git a/include/osg/Vec4ub b/include/osg/Vec4ub index ea139ea35..d82d4d9bf 100644 --- a/include/osg/Vec4ub +++ b/include/osg/Vec4ub @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,10 +33,10 @@ class Vec4ub /** Number of vector components. */ enum { num_components = 4 }; - + /** Vec member variable. */ value_type _v[4]; - + /** Constructor that sets all components of the vector to zero */ Vec4ub() { _v[0]=0; _v[1]=0; _v[2]=0; _v[3]=0; } diff --git a/include/osg/VertexProgram b/include/osg/VertexProgram index 8a3cf5c3a..24a8a5762 100644 --- a/include/osg/VertexProgram +++ b/include/osg/VertexProgram @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -150,11 +150,11 @@ class OSG_EXPORT VertexProgram : public StateAttribute return _vertexProgramIDList[contextID]; } - + /** Set the vertex program using a C style string. */ - inline void setVertexProgram( const char* program ) - { - _vertexProgram = program; + inline void setVertexProgram( const char* program ) + { + _vertexProgram = program; dirtyVertexProgramObject(); } @@ -203,7 +203,7 @@ class OSG_EXPORT VertexProgram : public StateAttribute inline const MatrixList& getMatrices() const { return _matrixList; } /** Force a recompile on next apply() of associated OpenGL vertex program objects. */ - void dirtyVertexProgramObject(); + void dirtyVertexProgramObject(); /** Use deleteVertexProgramObject instead of glDeletePrograms to allow * OpenGL Vertex Program objects to cached until they can be deleted @@ -238,7 +238,7 @@ class OSG_EXPORT VertexProgram : public StateAttribute virtual void releaseGLObjects(State* state=0) const; /** 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. */ class OSG_EXPORT Extensions : public osg::Referenced @@ -247,9 +247,9 @@ class OSG_EXPORT VertexProgram : public StateAttribute Extensions(unsigned int contextID); Extensions(const Extensions& rhs); - + void lowestCommonDenominator(const Extensions& rhs); - + void setupGLExtensions(unsigned int contextID); void setVertexProgramSupported(bool flag) { _isVertexProgramSupported=flag; } @@ -258,19 +258,19 @@ class OSG_EXPORT VertexProgram : public StateAttribute void glBindProgram(GLenum target, GLuint id) const; void glGenPrograms(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; protected: ~Extensions() {} - + bool _isVertexProgramSupported; - + typedef void (GL_APIENTRY * BindProgramProc) (GLenum target, GLuint id); typedef void (GL_APIENTRY * GenProgramsProc) (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); BindProgramProc _glBindProgram; @@ -278,9 +278,9 @@ class OSG_EXPORT VertexProgram : public StateAttribute DeleteProgramsProc _glDeletePrograms; ProgramStringProc _glProgramString; ProgramLocalParameter4fvProc _glProgramLocalParameter4fv; - + }; - + /** 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 'createIfNotInitalized' flag been set to false then returns NULL. diff --git a/include/osg/View b/include/osg/View index 2636d2262..d199b8f92 100644 --- a/include/osg/View +++ b/include/osg/View @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,7 +35,7 @@ class OSG_EXPORT View : public virtual osg::Object View(const osg::View& view, const osg::CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Object(osg,View); - + /** Take all the settings, Camera and Slaves from the passed in view, leaving it empty. */ virtual void take(View& rhs); @@ -57,7 +57,7 @@ class OSG_EXPORT View : public virtual osg::Object HEADLIGHT, SKY_LIGHT }; - + /** Set the global lighting to use for this view. * Defaults to headlight. */ void setLightingMode(LightingMode lightingMode); @@ -74,22 +74,22 @@ class OSG_EXPORT View : public virtual osg::Object /** Get the const global lighting if assigned.*/ const osg::Light* getLight() const { return _light.get(); } - /** Set the master camera of the view. */ + /** Set the master camera of the view. */ void setCamera(osg::Camera* camera); - /** Get the master camera of the view. */ + /** Get the master camera of the view. */ osg::Camera* getCamera() { return _camera.get(); } - /** Get the const master camera of the view. */ + /** Get the const master camera of the view. */ const osg::Camera* getCamera() const { return _camera.get(); } - /** Set the frame stamp of the view. */ + /** Set the frame stamp of the view. */ void setFrameStamp(osg::FrameStamp* fs) { _frameStamp = fs; } - /** Get the frame stamp of the view. */ + /** Get the frame stamp of the view. */ osg::FrameStamp* getFrameStamp() { return _frameStamp.get(); } - /** Get the frame stamp of the view. */ + /** Get the frame stamp of the view. */ const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); } @@ -98,16 +98,16 @@ class OSG_EXPORT View : public virtual osg::Object { Slave(bool useMastersSceneData=true): _useMastersSceneData(useMastersSceneData) {} - + Slave(osg::Camera* camera, const osg::Matrixd& projectionOffset, const osg::Matrixd& viewOffset, bool useMastersSceneData=true): - _camera(camera), - _projectionOffset(projectionOffset), + _camera(camera), + _projectionOffset(projectionOffset), _viewOffset(viewOffset), _useMastersSceneData(useMastersSceneData) {} - + Slave(const Slave& rhs) : - _camera(rhs._camera), - _projectionOffset(rhs._projectionOffset), + _camera(rhs._camera), + _projectionOffset(rhs._projectionOffset), _viewOffset(rhs._viewOffset), _useMastersSceneData(rhs._useMastersSceneData), _updateSlaveCallback(rhs._updateSlaveCallback) {} @@ -134,7 +134,7 @@ class OSG_EXPORT View : public virtual osg::Object if (_updateSlaveCallback.valid()) _updateSlaveCallback->updateSlave(view, *this); else updateSlaveImplementation(view); } - + virtual void updateSlaveImplementation(View& view); osg::ref_ptr _camera; @@ -173,7 +173,7 @@ class OSG_EXPORT View : public virtual osg::Object osg::ref_ptr _light; osg::ref_ptr _camera; - + typedef std::vector Slaves; Slaves _slaves; diff --git a/include/osg/Viewport b/include/osg/Viewport index cfa2c1c3f..720d037b4 100644 --- a/include/osg/Viewport +++ b/include/osg/Viewport @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,7 +19,7 @@ namespace osg { -/** Encapsulate OpenGL glViewport. */ +/** Encapsulate OpenGL glViewport. */ class OSG_EXPORT Viewport : public StateAttribute { public : @@ -30,13 +30,13 @@ class OSG_EXPORT Viewport : public StateAttribute typedef double value_type; #endif Viewport(); - + Viewport(value_type x,value_type y,value_type width,value_type height): _x(x), _y(y), _width(width), _height(height) {} - + /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Viewport(const Viewport& vp,const CopyOp& copyop=CopyOp::SHALLOW_COPY): @@ -47,7 +47,7 @@ class OSG_EXPORT Viewport : public StateAttribute _height(vp._height) {} META_StateAttribute(osg, Viewport,VIEWPORT); - + /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ virtual int compare(const StateAttribute& sa) const { @@ -60,7 +60,7 @@ class OSG_EXPORT Viewport : public StateAttribute COMPARE_StateAttribute_Parameter(_y) COMPARE_StateAttribute_Parameter(_width) COMPARE_StateAttribute_Parameter(_height) - + return 0; // passed all the above comparison macros, must be equal. } @@ -72,7 +72,7 @@ class OSG_EXPORT Viewport : public StateAttribute _height = height; } -#if 0 +#if 0 void getViewport(int& x,int& y,int& width,int& height) const { x = _x; @@ -107,7 +107,7 @@ class OSG_EXPORT Viewport : public StateAttribute * If height is zero, the potential division by zero is avoided by simply returning 1.0f. */ inline double aspectRatio() const { if (_height!=0) return (double)_width/(double)_height; else return 1.0; } - + /** Compute the Window Matrix which takes projected coords into Window coordinates. * To convert local coordinates into window coordinates use v_window = v_local * MVPW matrix, * where the MVPW matrix is ModelViewMatrix * ProjectionMatrix * WindowMatrix, the latter supplied by @@ -122,7 +122,7 @@ class OSG_EXPORT Viewport : public StateAttribute virtual void apply(State& state) const; protected: - + virtual ~Viewport(); value_type _x; diff --git a/include/osg/buffered_value b/include/osg/buffered_value index d2714685d..53937f373 100644 --- a/include/osg/buffered_value +++ b/include/osg/buffered_value @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -21,12 +21,12 @@ namespace osg { /** Implements a simple buffered value for values that need to be buffered on * a per graphics context basis. -*/ +*/ template class buffered_value { public: - + inline buffered_value(): _array(DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),0) {} @@ -40,7 +40,7 @@ class buffered_value _array = rhs._array; return *this; } - + inline void setAllElementsTo(const T& t) { std::fill(_array.begin(),_array.end(),t); } inline void clear() { _array.clear(); } @@ -48,7 +48,7 @@ class buffered_value inline bool empty() const { return _array.empty(); } inline unsigned int size() const { return _array.size(); } - + inline void resize(unsigned int newSize) { _array.resize(newSize,0); } inline T& operator[] (unsigned int pos) @@ -70,7 +70,7 @@ class buffered_value } protected: - + mutable std::vector _array; }; @@ -78,7 +78,7 @@ template class buffered_object { public: - + inline buffered_object(): _array(DisplaySettings::instance()->getMaxNumberOfGraphicsContexts()) {} @@ -120,10 +120,10 @@ class buffered_object return _array[pos]; } - + protected: - + mutable std::vector _array; }; diff --git a/include/osg/fast_back_stack b/include/osg/fast_back_stack index 757dde75b..f92a5e9bd 100644 --- a/include/osg/fast_back_stack +++ b/include/osg/fast_back_stack @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,12 +25,12 @@ namespace osg { * and back() methods so is not as general purpose as stl stack implementation. * The focus of the fast_back_stack is purely to maximize the speed at which the * back can be accessed.*/ - + template class fast_back_stack { public: - + inline fast_back_stack():_value(),_stack(),_size(0) {} inline fast_back_stack(const fast_back_stack& fbs):_value(fbs._value),_stack(fbs._stack),_size(fbs._size) {} @@ -63,7 +63,7 @@ class fast_back_stack } ++_size; } - + inline void push_back(const T& value) { if (_size>0) @@ -73,7 +73,7 @@ class fast_back_stack _value = value; ++_size; } - + inline void pop_back() { if (_size>0) @@ -86,7 +86,7 @@ class fast_back_stack --_size; } // else error condition. } - + T _value; std::vector _stack; unsigned int _size; diff --git a/include/osg/io_utils b/include/osg/io_utils index be28e79ed..ee42b30b5 100644 --- a/include/osg/io_utils +++ b/include/osg/io_utils @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -182,7 +182,7 @@ inline std::istream& operator >> (std::istream& input, Vec4b& vec) { input >> vec._v[0] >> std::ws >> vec._v[1] >> std::ws - >> vec._v[2] >> std::ws + >> vec._v[2] >> std::ws >> vec._v[3]; return input; } diff --git a/include/osg/observer_ptr b/include/osg/observer_ptr index 49614d7c6..01bc71bfb 100644 --- a/include/osg/observer_ptr +++ b/include/osg/observer_ptr @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osg/ref_ptr b/include/osg/ref_ptr index 948d2f0bb..a141de64c 100644 --- a/include/osg/ref_ptr +++ b/include/osg/ref_ptr @@ -71,7 +71,7 @@ class ref_ptr bool operator != (const ref_ptr& rp) const { return (_ptr!=rp._ptr); } bool operator != (const T* ptr) const { return (_ptr!=ptr); } friend bool operator != (const T* ptr, const ref_ptr& rp) { return (ptr!=rp._ptr); } - + bool operator < (const ref_ptr& rp) const { return (_ptr * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -45,12 +45,12 @@ namespace osgAnimation _nestedCallback(nc._nestedCallback) {} META_Object(osgAnimation,Callback); - + virtual void operator()(Action* action, osgAnimation::ActionVisitor* nv) {} - - Callback* getNestedCallback() { return _nestedCallback.get(); } - void addNestedCallback(Callback* callback) - { + + Callback* getNestedCallback() { return _nestedCallback.get(); } + void addNestedCallback(Callback* callback) + { if (callback) { if (_nestedCallback.valid()) _nestedCallback->addNestedCallback(callback); @@ -60,7 +60,7 @@ namespace osgAnimation } void removeCallback(Callback* cb) - { + { if (!cb) return; @@ -78,7 +78,7 @@ namespace osgAnimation typedef std::map > FrameCallback; META_Action(osgAnimation, Action); - + Action(); Action(const Action&,const osg::CopyOp&); @@ -135,7 +135,7 @@ namespace osgAnimation Play, Stop }; - + Status _state; }; diff --git a/include/osgAnimation/ActionAnimation b/include/osgAnimation/ActionAnimation index ed4d8982e..0c3fdce1d 100644 --- a/include/osgAnimation/ActionAnimation +++ b/include/osgAnimation/ActionAnimation @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/ActionBlendIn b/include/osgAnimation/ActionBlendIn index 5789a2c51..b5702b962 100644 --- a/include/osgAnimation/ActionBlendIn +++ b/include/osgAnimation/ActionBlendIn @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/ActionBlendOut b/include/osgAnimation/ActionBlendOut index cc391739e..5a12ad9a2 100644 --- a/include/osgAnimation/ActionBlendOut +++ b/include/osgAnimation/ActionBlendOut @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/ActionCallback b/include/osgAnimation/ActionCallback index 0f589d5a9..cb5845dd6 100644 --- a/include/osgAnimation/ActionCallback +++ b/include/osgAnimation/ActionCallback @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -27,13 +27,13 @@ namespace osgAnimation public: RunAction(Action* a, int priority = 0) : _action(a), _priority(priority) {} virtual void operator()(Action* action, ActionVisitor* visitor); - + Action* getAction() const { return _action.get(); } int getPriority() const { return _priority; } protected: osg::ref_ptr _action; int _priority; - + }; } diff --git a/include/osgAnimation/ActionStripAnimation b/include/osgAnimation/ActionStripAnimation index 7ede4ae08..82f3101de 100644 --- a/include/osgAnimation/ActionStripAnimation +++ b/include/osgAnimation/ActionStripAnimation @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ namespace osgAnimation const ActionBlendIn* getBlendIn() const; const ActionBlendOut* getBlendOut() const; unsigned int getBlendOutStartFrame() const; - + unsigned int getLoop() const; void setLoop(unsigned int loop); void traverse(ActionVisitor& visitor); diff --git a/include/osgAnimation/ActionVisitor b/include/osgAnimation/ActionVisitor index cc1f542f5..18d11f269 100644 --- a/include/osgAnimation/ActionVisitor +++ b/include/osgAnimation/ActionVisitor @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/Animation b/include/osgAnimation/Animation index 655245e00..99f1ded1d 100644 --- a/include/osgAnimation/Animation +++ b/include/osgAnimation/Animation @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -47,7 +47,7 @@ namespace osgAnimation /** Those accessors let you add and remove channels * if you modify something that can change the duration * you are supposed to call computeDuration or setDuration - */ + */ ChannelList& getChannels(); const ChannelList& getChannels() const; @@ -76,7 +76,7 @@ namespace osgAnimation void setPlayMode (PlayMode mode) { _playmode = mode; } PlayMode getPlayMode() const { return _playmode; } - + void setStartTime(double time) { _startTime = time;} double getStartTime() const { return _startTime;} @@ -85,7 +85,7 @@ namespace osgAnimation double computeDurationFromChannels() const; ~Animation() {} - + double _duration; double _originalDuration; float _weight; diff --git a/include/osgAnimation/AnimationManagerBase b/include/osgAnimation/AnimationManagerBase index e043fecce..faf763d1e 100644 --- a/include/osgAnimation/AnimationManagerBase +++ b/include/osgAnimation/AnimationManagerBase @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -47,7 +47,7 @@ namespace osgAnimation /** Reset the value of targets this Operation must be done each frame */ void clearTargets(); - + LinkVisitor* getOrCreateLinkVisitor(); void setLinkVisitor(LinkVisitor*); diff --git a/include/osgAnimation/AnimationUpdateCallback b/include/osgAnimation/AnimationUpdateCallback index 9cb526773..83763beea 100644 --- a/include/osgAnimation/AnimationUpdateCallback +++ b/include/osgAnimation/AnimationUpdateCallback @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,7 +20,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class AnimationUpdateCallbackBase : public virtual osg::Object diff --git a/include/osgAnimation/BasicAnimationManager b/include/osgAnimation/BasicAnimationManager index 633e89d4a..c753f6ca8 100644 --- a/include/osgAnimation/BasicAnimationManager +++ b/include/osgAnimation/BasicAnimationManager @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -27,9 +27,9 @@ namespace osgAnimation public: META_Object(osgAnimation, BasicAnimationManager); - + BasicAnimationManager(); - BasicAnimationManager(const AnimationManagerBase& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); + BasicAnimationManager(const AnimationManagerBase& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); virtual ~BasicAnimationManager(); void update (double time); @@ -42,7 +42,7 @@ namespace osgAnimation bool isPlaying (const std::string& animationName); void stopAll(); - + protected: typedef std::map AnimationLayers; AnimationLayers _animationsPlaying; diff --git a/include/osgAnimation/Bone b/include/osgAnimation/Bone index 43e01d78c..b2debed47 100644 --- a/include/osgAnimation/Bone +++ b/include/osgAnimation/Bone @@ -1,16 +1,16 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. - * + * * Authors: * Cedric Pinson * Michael Platings @@ -22,7 +22,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { // A bone can't have more than one parent Bone, so sharing a part of Bone's hierarchy diff --git a/include/osgAnimation/BoneMapVisitor b/include/osgAnimation/BoneMapVisitor index d41538493..a9540e1a9 100644 --- a/include/osgAnimation/BoneMapVisitor +++ b/include/osgAnimation/BoneMapVisitor @@ -1,16 +1,16 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. - * + * * Authors: * Cedric Pinson */ diff --git a/include/osgAnimation/Channel b/include/osgAnimation/Channel index a3139bf0c..0b3df05f4 100644 --- a/include/osgAnimation/Channel +++ b/include/osgAnimation/Channel @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * Authors: @@ -60,7 +60,7 @@ namespace osgAnimation virtual bool createKeyframeContainerFromTargetValue() = 0; protected: - + std::string _targetName; std::string _name; }; @@ -113,7 +113,7 @@ namespace osgAnimation } virtual ~TemplateChannel() {} - virtual void update(double time, float weight, int priority) + virtual void update(double time, float weight, int priority) { // skip if weight == 0 if (weight < 1e-4) diff --git a/include/osgAnimation/CubicBezier b/include/osgAnimation/CubicBezier index 2bb514d7f..6b71838ad 100644 --- a/include/osgAnimation/CubicBezier +++ b/include/osgAnimation/CubicBezier @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/EaseMotion b/include/osgAnimation/EaseMotion index 3c55851e6..2270f950a 100644 --- a/include/osgAnimation/EaseMotion +++ b/include/osgAnimation/EaseMotion @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,25 +23,25 @@ namespace osgAnimation { - struct OutBounceFunction + struct OutBounceFunction { - inline static void getValueAt(float t, float& result) - { - if ((t) < (1/2.75)) + inline static void getValueAt(float t, float& result) + { + if ((t) < (1/2.75)) { result = 7.5625 * t * t; - } - else if (t < (2/2.75)) + } + else if (t < (2/2.75)) { t = t - (1.5/2.75); result = 7.5625* t * t + .75; } - else if (t < (2.5/2.75)) + else if (t < (2.5/2.75)) { t = t - (2.25/2.75); result = 7.5625 * t * t + .9375; } - else + else { t = t - (2.625/2.75); result = 7.5625* t * t + .984375; @@ -49,25 +49,25 @@ namespace osgAnimation } }; - struct InBounceFunction + struct InBounceFunction { - inline static void getValueAt(float t, float& result) - { + inline static void getValueAt(float t, float& result) + { OutBounceFunction::getValueAt(1-t, result); result = 1 - result; } }; - struct InOutBounceFunction + struct InOutBounceFunction { - inline static void getValueAt(float t, float& result) - { - if (t < 0.5) + inline static void getValueAt(float t, float& result) + { + if (t < 0.5) { InBounceFunction::getValueAt(t * 2, result); result *= 0.5; - } - else + } + else { OutBounceFunction::getValueAt(t * 2 - 1 , result); result = result * 0.5 + 0.5; @@ -76,30 +76,30 @@ namespace osgAnimation }; /// Linear function - struct LinearFunction + struct LinearFunction { inline static void getValueAt(float t, float& result) { result = t;} }; /// Quad function - struct OutQuadFunction + struct OutQuadFunction { inline static void getValueAt(float t, float& result) { result = - (t * (t -2.0));} }; - struct InQuadFunction + struct InQuadFunction { inline static void getValueAt(float t, float& result) { result = t*t;} }; - struct InOutQuadFunction + struct InOutQuadFunction { - inline static void getValueAt(float t, float& result) + inline static void getValueAt(float t, float& result) { t *= 2.0; - if (t < 1.0) + if (t < 1.0) result = 0.5 * t * t; - else + else { t -= 1.0; result = - 0.5 * (t * ( t - 2) - 1); @@ -108,20 +108,20 @@ namespace osgAnimation }; /// Cubic function - struct OutCubicFunction + struct OutCubicFunction { inline static void getValueAt(float t, float& result) { t = t-1.0; result = t*t*t + 1;} }; - struct InCubicFunction + struct InCubicFunction { inline static void getValueAt(float t, float& result) { result = t*t*t;} }; - struct InOutCubicFunction + struct InOutCubicFunction { - inline static void getValueAt(float t, float& result) - { + inline static void getValueAt(float t, float& result) + { t *= 2.0f; if (t < 1.0f) result = 0.5f * t * t * t; @@ -131,9 +131,9 @@ namespace osgAnimation } } }; - + /// Quart function - struct InQuartFunction + struct InQuartFunction { inline static void getValueAt(float t, float& result) { result = t*t*t*t*t;} }; @@ -145,7 +145,7 @@ namespace osgAnimation struct InOutQuartFunction { - inline static void getValueAt(float t, float& result) + inline static void getValueAt(float t, float& result) { t = t * 2.0; if ( t < 1) @@ -159,26 +159,26 @@ namespace osgAnimation }; /// Elastic function - struct OutElasticFunction + struct OutElasticFunction { - inline static void getValueAt(float t, float& result) + inline static void getValueAt(float t, float& result) { result = pow(2.0f, -10.0f * t) * sinf((t - 0.3f / 4.0f) * (2.0f * osg::PI) / 0.3f) + 1.0f; } }; - struct InElasticFunction + struct InElasticFunction { - inline static void getValueAt(float t, float& result) + inline static void getValueAt(float t, float& result) { OutElasticFunction::getValueAt(1.0f - t, result); result = 1.0f - result; } }; - struct InOutElasticFunction + struct InOutElasticFunction { - inline static void getValueAt(float t, float& result) + inline static void getValueAt(float t, float& result) { t *= 2.0f; if (t < 1.0f) @@ -243,7 +243,7 @@ namespace osgAnimation { float s = 1.70158 * 1.525f; t *= 2.0f; - if (t < 1.0f) + if (t < 1.0f) { result = 0.5f * (t * t * ((s + 1.0f) * t - s)); } @@ -317,7 +317,7 @@ namespace osgAnimation else { result = powf(2.0f, 10.0f * (t - 1.0f)); - } + } } }; @@ -348,7 +348,7 @@ namespace osgAnimation { public: typedef float value_type; - enum TimeBehaviour + enum TimeBehaviour { CLAMP, LOOP @@ -359,7 +359,7 @@ namespace osgAnimation float getTime() const { return _time; } float evaluateTime(float time) const { - switch (_behaviour) + switch (_behaviour) { case CLAMP: if (time > _duration) @@ -381,7 +381,7 @@ namespace osgAnimation { _time = evaluateTime(_time + dt); } - + void setTime(float time) { _time = evaluateTime(time);} void getValue(value_type& result) const { getValueAt(_time, result); } value_type getValue() const @@ -397,7 +397,7 @@ namespace osgAnimation result = result * _changeValue + _startValue; } value_type getValueAt(float time) const - { + { value_type result; getValueAt(evaluateTime(time), result); return result; @@ -406,7 +406,7 @@ namespace osgAnimation virtual void getValueInNormalizedRange(float t, value_type& result) const = 0; float getDuration() const { return _duration;} - protected: + protected: float _time; float _startValue; float _changeValue; @@ -431,8 +431,8 @@ namespace osgAnimation T& getSampler() { return _sampler;} const T& getSampler() const { return _sampler;} virtual void getValueInNormalizedRange(float t, value_type& result) const - { - if (!_sampler.getKeyframeContainer()) + { + if (!_sampler.getKeyframeContainer()) { result = 0; return; @@ -447,12 +447,12 @@ namespace osgAnimation { typedef std::vector > MotionList; MotionList _motions; - + MotionList& getMotionList() { return _motions; } const MotionList& getMotionList() const { return _motions; } CompositeMotion(float startValue = 0, float duration = 1, float changeValue = 1, TimeBehaviour tb = CLAMP) : Motion(startValue, duration, changeValue, tb) {} - virtual void getValueInNormalizedRange(float t, value_type& result) const + virtual void getValueInNormalizedRange(float t, value_type& result) const { if (_motions.empty()) { @@ -520,7 +520,7 @@ namespace osgAnimation typedef MathMotionTemplate OutCircMotion; typedef MathMotionTemplate InCircMotion; typedef MathMotionTemplate InOutCircMotion; - + // expo typedef MathMotionTemplate OutExpoMotion; typedef MathMotionTemplate InExpoMotion; diff --git a/include/osgAnimation/Export b/include/osgAnimation/Export index 2fe9620b0..ba26765ad 100644 --- a/include/osgAnimation/Export +++ b/include/osgAnimation/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,8 +37,8 @@ # define OSGANIMATION_EXPORT __declspec(dllimport) #endif #else - #define OSGANIMATION_EXPORT -#endif + #define OSGANIMATION_EXPORT +#endif // set up define for whether member templates are supported by VisualStudio compilers. #ifdef _MSC_VER diff --git a/include/osgAnimation/FrameAction b/include/osgAnimation/FrameAction index ae3595354..f424133b8 100644 --- a/include/osgAnimation/FrameAction +++ b/include/osgAnimation/FrameAction @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/Interpolator b/include/osgAnimation/Interpolator index b06575a50..1190e3aa4 100644 --- a/include/osgAnimation/Interpolator +++ b/include/osgAnimation/Interpolator @@ -1,16 +1,16 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. - * + * * Authors: * Cedric Pinson * Michael Platings @@ -38,7 +38,7 @@ namespace osgAnimation TemplateInterpolatorBase() : _lastKeyAccess(-1) {} void reset() { _lastKeyAccess = -1; } - int getKeyIndexFromTime(const TemplateKeyframeContainer& keys, double time) const + int getKeyIndexFromTime(const TemplateKeyframeContainer& keys, double time) const { // todo use a cache int key_size = keys.size(); @@ -52,7 +52,7 @@ namespace osgAnimation double time0 = keysVector[i].getTime(); double time1 = keysVector[i+1].getTime(); - if ( time >= time0 && time < time1 ) + if ( time >= time0 && time < time1 ) { _lastKeyAccess = i; return i; @@ -70,15 +70,15 @@ namespace osgAnimation public: TemplateStepInterpolator() {} - void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const + void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const { - - if (time >= keyframes.back().getTime()) + + if (time >= keyframes.back().getTime()) { result = keyframes.back().getValue(); return; - } - else if (time <= keyframes.front().getTime()) + } + else if (time <= keyframes.front().getTime()) { result = keyframes.front().getValue(); return; @@ -96,20 +96,20 @@ namespace osgAnimation public: TemplateLinearInterpolator() {} - void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const + void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const { - - if (time >= keyframes.back().getTime()) + + if (time >= keyframes.back().getTime()) { result = keyframes.back().getValue(); return; - } - else if (time <= keyframes.front().getTime()) + } + else if (time <= keyframes.front().getTime()) { result = keyframes.front().getValue(); return; } - + int i = this->getKeyIndexFromTime(keyframes,time); float blend = (time - keyframes[i].getTime()) / ( keyframes[i+1].getTime() - keyframes[i].getTime()); const TYPE& v1 = keyframes[i].getValue(); @@ -124,14 +124,14 @@ namespace osgAnimation { public: TemplateSphericalLinearInterpolator() {} - void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const + void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const { - if (time >= keyframes.back().getTime()) + if (time >= keyframes.back().getTime()) { result = keyframes.back().getValue(); return; } - else if (time <= keyframes.front().getTime()) + else if (time <= keyframes.front().getTime()) { result = keyframes.front().getValue(); return; @@ -152,14 +152,14 @@ namespace osgAnimation public: TemplateLinearPackedInterpolator() {} - void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const + void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const { - if (time >= keyframes.back().getTime()) + if (time >= keyframes.back().getTime()) { keyframes.back().getValue().uncompress(keyframes.mScale, keyframes.mMin, result); return; } - else if (time <= keyframes.front().getTime()) + else if (time <= keyframes.front().getTime()) { keyframes.front().getValue().uncompress(keyframes.mScale, keyframes.mMin, result); return; @@ -182,22 +182,22 @@ namespace osgAnimation public: TemplateCubicBezierInterpolator() {} - void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const + void getValue(const TemplateKeyframeContainer& keyframes, double time, TYPE& result) const { - - if (time >= keyframes.back().getTime()) + + if (time >= keyframes.back().getTime()) { result = keyframes.back().getValue().getPosition(); return; } - else if (time <= keyframes.front().getTime()) + else if (time <= keyframes.front().getTime()) { result = keyframes.front().getValue().getPosition(); return; } int i = this->getKeyIndexFromTime(keyframes,time); - + float t = (time - keyframes[i].getTime()) / ( keyframes[i+1].getTime() - keyframes[i].getTime()); float one_minus_t = 1.0-t; float one_minus_t2 = one_minus_t * one_minus_t; diff --git a/include/osgAnimation/Keyframe b/include/osgAnimation/Keyframe index 7c10640cb..f28a601f8 100644 --- a/include/osgAnimation/Keyframe +++ b/include/osgAnimation/Keyframe @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,15 +25,15 @@ #include #include -namespace osgAnimation +namespace osgAnimation { - class Keyframe + class Keyframe { public: double getTime() const { return _time; } void setTime(double time) { _time = time; } - + protected: double _time; @@ -48,8 +48,8 @@ namespace osgAnimation TemplateKeyframe () {} ~TemplateKeyframe () {} - TemplateKeyframe (double time, const T& value) - { + TemplateKeyframe (double time, const T& value) + { _time = time; _value = value; } @@ -99,9 +99,9 @@ namespace osgAnimation typedef TemplateKeyframe FloatKeyframe; typedef TemplateKeyframeContainer FloatKeyframeContainer; - + typedef TemplateKeyframe DoubleKeyframe; - typedef TemplateKeyframeContainer DoubleKeyframeContainer; + typedef TemplateKeyframeContainer DoubleKeyframeContainer; typedef TemplateKeyframe Vec2Keyframe; typedef TemplateKeyframeContainer Vec2KeyframeContainer; @@ -123,16 +123,16 @@ namespace osgAnimation typedef TemplateKeyframe FloatCubicBezierKeyframe; typedef TemplateKeyframeContainer FloatCubicBezierKeyframeContainer; - + typedef TemplateKeyframe DoubleCubicBezierKeyframe; typedef TemplateKeyframeContainer DoubleCubicBezierKeyframeContainer; - + typedef TemplateKeyframe Vec2CubicBezierKeyframe; typedef TemplateKeyframeContainer Vec2CubicBezierKeyframeContainer; - + typedef TemplateKeyframe Vec3CubicBezierKeyframe; typedef TemplateKeyframeContainer Vec3CubicBezierKeyframeContainer; - + typedef TemplateKeyframe Vec4CubicBezierKeyframe; typedef TemplateKeyframeContainer Vec4CubicBezierKeyframeContainer; diff --git a/include/osgAnimation/LinkVisitor b/include/osgAnimation/LinkVisitor index de61a229f..05f86b689 100644 --- a/include/osgAnimation/LinkVisitor +++ b/include/osgAnimation/LinkVisitor @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,7 +19,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class AnimationUpdateCallbackBase; diff --git a/include/osgAnimation/MorphGeometry b/include/osgAnimation/MorphGeometry index 2e350abca..3aea0261a 100644 --- a/include/osgAnimation/MorphGeometry +++ b/include/osgAnimation/MorphGeometry @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,19 +19,19 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class OSGANIMATION_EXPORT MorphGeometry : public osg::Geometry { - + public: - + enum Method { NORMALIZED, RELATIVE }; - + class MorphTarget { protected: @@ -71,17 +71,17 @@ namespace osgAnimation virtual const char* className() const { return "MorphGeometry"; } virtual void transformSoftwareMethod(); - + /** Set the morphing method. */ void setMethod(Method method) { _method = method; } /** Get the morphing method. */ inline Method getMethod() const { return _method; } - + /** Set flag for morphing normals. */ void setMorphNormals(bool morphNormals) { _morphNormals = morphNormals; } /** Get the flag for morphing normals. */ inline bool getMorphNormals() const { return _morphNormals; } - + /** Add a \c MorphTarget to the \c MorphGeometry. * If \c MorphTarget is not \c NULL and is not contained in the \c MorphGeometry * then increment its reference count, add it to the MorphTargets list and @@ -92,11 +92,11 @@ namespace osgAnimation * @return \c true for success; \c false otherwise. */ virtual void addMorphTarget( osg::Geometry *morphTarget, float weight = 1.0 ) { _morphTargets.push_back(MorphTarget(morphTarget, weight)); _dirty = true; } - + void setWeight(unsigned int index, float morphWeight) - { - if (index < _morphTargets.size()) - { + { + if (index < _morphTargets.size()) + { _morphTargets[index].setWeight(morphWeight); dirty(); } @@ -104,13 +104,13 @@ namespace osgAnimation /** Set the MorphGeometry dirty.*/ void dirty() { _dirty = true; } - + /** Get the list of MorphTargets.*/ const MorphTargetList& getMorphTargetList() const { return _morphTargets; } /** Get the list of MorphTargets. Warning if you modify this array you will have to call dirty() */ MorphTargetList& getMorphTargetList() { return _morphTargets; } - + /** Return the \c MorphTarget at position \c i.*/ inline const MorphTarget& getMorphTarget( unsigned int i ) const { return _morphTargets[i]; } @@ -123,19 +123,19 @@ namespace osgAnimation Method _method; MorphTargetList _morphTargets; - + std::vector _positionSource; std::vector _normalSource; - + /// Do we also morph between normals? bool _morphNormals; }; - + class OSGANIMATION_EXPORT UpdateMorph : public AnimationUpdateCallback { protected: std::map > _weightTargets; - + public: META_Object(osgAnimation, UpdateMorph); diff --git a/include/osgAnimation/RigGeometry b/include/osgAnimation/RigGeometry index ac0deea8a..3015a3a64 100644 --- a/include/osgAnimation/RigGeometry +++ b/include/osgAnimation/RigGeometry @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -21,7 +21,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class OSGANIMATION_EXPORT RigGeometry : public osg::Geometry @@ -37,15 +37,15 @@ namespace osgAnimation void setInfluenceMap(VertexInfluenceMap* vertexInfluenceMap) { _vertexInfluenceMap = vertexInfluenceMap; } const VertexInfluenceMap* getInfluenceMap() const { return _vertexInfluenceMap.get();} VertexInfluenceMap* getInfluenceMap() { return _vertexInfluenceMap.get();} - + const Skeleton* getSkeleton() const; Skeleton* getSkeleton(); // will be used by the update callback to init correctly the rig mesh void setSkeleton(Skeleton*); - + void setNeedToComputeMatrix(bool state) { _needToComputeMatrix = state;} bool getNeedToComputeMatrix() const { return _needToComputeMatrix;} - + // this build the internal database about vertex influence and bones void buildVertexInfluenceSet(); @@ -71,7 +71,7 @@ namespace osgAnimation void copyFrom(osg::Geometry& from); protected: - + osg::ref_ptr _geometry; osg::ref_ptr _rigTransformImplementation; @@ -82,12 +82,12 @@ namespace osgAnimation osg::Matrix _invMatrixFromSkeletonToGeometry; osg::observer_ptr _root; bool _needToComputeMatrix; - + struct FindNearestParentSkeleton : public osg::NodeVisitor { osg::ref_ptr _root; FindNearestParentSkeleton() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS) {} - void apply(osg::Transform& node) + void apply(osg::Transform& node) { if (_root.valid()) return; diff --git a/include/osgAnimation/RigTransform b/include/osgAnimation/RigTransform index 25edc1da6..525d1c271 100644 --- a/include/osgAnimation/RigTransform +++ b/include/osgAnimation/RigTransform @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/RigTransformHardware b/include/osgAnimation/RigTransformHardware index 53a0c8c92..54ba61520 100644 --- a/include/osgAnimation/RigTransformHardware +++ b/include/osgAnimation/RigTransformHardware @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -22,7 +22,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class RigGeometry; diff --git a/include/osgAnimation/RigTransformSoftware b/include/osgAnimation/RigTransformSoftware index 16c06c619..550940c72 100644 --- a/include/osgAnimation/RigTransformSoftware +++ b/include/osgAnimation/RigTransformSoftware @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -21,7 +21,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class RigGeometry; @@ -33,9 +33,9 @@ namespace osgAnimation RigTransformSoftware(); virtual void operator()(RigGeometry&); - - class BoneWeight + + class BoneWeight { public: BoneWeight(Bone* bone, float weight) : _bone(bone), _weight(weight) {} @@ -55,8 +55,8 @@ namespace osgAnimation public: BoneWeightList& getBones() { return _bones; } VertexList& getVertexes() { return _vertexes; } - - void resetMatrix() + + void resetMatrix() { _result.set(0, 0, 0, 0, 0, 0, 0, 0, @@ -122,7 +122,7 @@ namespace osgAnimation { // the result of matrix mult should be cached to be used for vertexes transform and normal transform and maybe other computation int size = _boneSetVertexSet.size(); - for (int i = 0; i < size; i++) + for (int i = 0; i < size; i++) { UniqBoneSetVertexSet& uniq = _boneSetVertexSet[i]; uniq.computeMatrixForVertexSet(); @@ -142,7 +142,7 @@ namespace osgAnimation template void computeNormal(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst) { int size = _boneSetVertexSet.size(); - for (int i = 0; i < size; i++) + for (int i = 0; i < size; i++) { UniqBoneSetVertexSet& uniq = _boneSetVertexSet[i]; uniq.computeMatrixForVertexSet(); @@ -150,7 +150,7 @@ namespace osgAnimation const VertexList& vertexes = uniq.getVertexes(); int vertexSize = vertexes.size(); - for (int j = 0; j < vertexSize; j++) + for (int j = 0; j < vertexSize; j++) { int idx = vertexes[j]; dst[idx] = osg::Matrix::transform3x3(src[idx],matrix); diff --git a/include/osgAnimation/Sampler b/include/osgAnimation/Sampler index 571a7d232..26730c880 100644 --- a/include/osgAnimation/Sampler +++ b/include/osgAnimation/Sampler @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * Authors: @@ -26,7 +26,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class Sampler : public osg::Referenced @@ -58,7 +58,7 @@ namespace osgAnimation KeyframeContainerType* getKeyframeContainerTyped() { return _keyframes.get();} const KeyframeContainerType* getKeyframeContainerTyped() const { return _keyframes.get();} - KeyframeContainerType* getOrCreateKeyframeContainer() + KeyframeContainerType* getOrCreateKeyframeContainer() { if (_keyframes != 0) return _keyframes.get(); @@ -73,7 +73,7 @@ namespace osgAnimation return _keyframes->front().getTime(); } - double getEndTime() const + double getEndTime() const { if (!_keyframes || _keyframes->empty()) return 0.0; @@ -132,7 +132,7 @@ namespace osgAnimation typedef TemplateSampler Vec2CubicBezierSampler; typedef TemplateSampler Vec3CubicBezierSampler; typedef TemplateSampler Vec4CubicBezierSampler; - + } #endif diff --git a/include/osgAnimation/Skeleton b/include/osgAnimation/Skeleton index cc1aa4af2..c2444da05 100644 --- a/include/osgAnimation/Skeleton +++ b/include/osgAnimation/Skeleton @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -18,7 +18,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class OSGANIMATION_EXPORT Skeleton : public osg::MatrixTransform diff --git a/include/osgAnimation/StackedMatrixElement b/include/osgAnimation/StackedMatrixElement index 7e6835d6d..a3e555239 100644 --- a/include/osgAnimation/StackedMatrixElement +++ b/include/osgAnimation/StackedMatrixElement @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/StackedQuaternionElement b/include/osgAnimation/StackedQuaternionElement index aea2a1df7..3f019e1d8 100644 --- a/include/osgAnimation/StackedQuaternionElement +++ b/include/osgAnimation/StackedQuaternionElement @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/StackedRotateAxisElement b/include/osgAnimation/StackedRotateAxisElement index 06a2278b8..615a01055 100644 --- a/include/osgAnimation/StackedRotateAxisElement +++ b/include/osgAnimation/StackedRotateAxisElement @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,7 +23,7 @@ namespace osgAnimation { - class OSGANIMATION_EXPORT StackedRotateAxisElement : public StackedTransformElement + class OSGANIMATION_EXPORT StackedRotateAxisElement : public StackedTransformElement { public: META_Object(osgAnimation, StackedRotateAxisElement); diff --git a/include/osgAnimation/StackedScaleElement b/include/osgAnimation/StackedScaleElement index 6b49c3397..080fd19eb 100644 --- a/include/osgAnimation/StackedScaleElement +++ b/include/osgAnimation/StackedScaleElement @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/StackedTransform b/include/osgAnimation/StackedTransform index 367594a64..c91a51996 100644 --- a/include/osgAnimation/StackedTransform +++ b/include/osgAnimation/StackedTransform @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/StackedTransformElement b/include/osgAnimation/StackedTransformElement index bdf441ddf..2bf89c68f 100644 --- a/include/osgAnimation/StackedTransformElement +++ b/include/osgAnimation/StackedTransformElement @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/StackedTranslateElement b/include/osgAnimation/StackedTranslateElement index bbc222d7a..0c9c47ca9 100644 --- a/include/osgAnimation/StackedTranslateElement +++ b/include/osgAnimation/StackedTranslateElement @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/StatsHandler b/include/osgAnimation/StatsHandler index 1fc26b03b..cbaa9175a 100644 --- a/include/osgAnimation/StatsHandler +++ b/include/osgAnimation/StatsHandler @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ namespace osgAnimation #if 0 struct StatAction { - + std::string _name; osg::ref_ptr _group; osg::ref_ptr _label; @@ -41,9 +41,9 @@ namespace osgAnimation #endif /** Event handler for adding on screen stats reporting to Viewers.*/ - class OSGANIMATION_EXPORT StatsHandler : public osgGA::GUIEventHandler + class OSGANIMATION_EXPORT StatsHandler : public osgGA::GUIEventHandler { - public: + public: StatsHandler(); @@ -53,10 +53,10 @@ namespace osgAnimation FRAME_RATE = 1, LAST = 2 }; - + void setKeyEventTogglesOnScreenStats(int key) { _keyEventTogglesOnScreenStats = key; } int getKeyEventTogglesOnScreenStats() const { return _keyEventTogglesOnScreenStats; } - + void setKeyEventPrintsOutStats(int key) { _keyEventPrintsOutStats = key; } int getKeyEventPrintsOutStats() const { return _keyEventPrintsOutStats; } @@ -83,11 +83,11 @@ namespace osgAnimation osg::Geometry* createFrameMarkers(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks); osg::Geometry* createTick(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numTicks); - + osg::Node* createCameraTimeStats(const std::string& font, osg::Vec3& pos, float startBlocks, bool acquireGPUStats, float characterSize, osg::Stats* viewerStats, osg::Camera* camera); void setUpScene(osgViewer::Viewer* viewer); - + int _keyEventTogglesOnScreenStats; int _keyEventPrintsOutStats; @@ -95,14 +95,14 @@ namespace osgAnimation bool _initialized; osg::ref_ptr _camera; - + osg::ref_ptr _switch; osg::ref_ptr _group; - + unsigned int _frameRateChildNum; unsigned int _numBlocks; double _blockMultiplier; - + float _statsWidth; float _statsHeight; diff --git a/include/osgAnimation/StatsVisitor b/include/osgAnimation/StatsVisitor index 8b3656265..8f3ccc59c 100644 --- a/include/osgAnimation/StatsVisitor +++ b/include/osgAnimation/StatsVisitor @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/Target b/include/osgAnimation/Target index 4303150bb..abe91a080 100644 --- a/include/osgAnimation/Target +++ b/include/osgAnimation/Target @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,7 +24,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { class Channel; @@ -32,7 +32,7 @@ namespace osgAnimation class OSGANIMATION_EXPORT Target : public osg::Referenced { public: - + Target(); virtual ~Target() {} void reset() { _weight = 0; _priorityWeight = 0; } @@ -49,7 +49,7 @@ namespace osgAnimation class TemplateTarget : public Target { public: - + TemplateTarget() : _target() {} TemplateTarget(const T& v) { setValue(v); } TemplateTarget(const TemplateTarget& v) { setValue(v.getValue()); } @@ -117,7 +117,7 @@ namespace osgAnimation } osg::Quat::value_type len2 = _target.length2(); - if ( len2 != 1.0 && len2 != 0.0) + if ( len2 != 1.0 && len2 != 0.0) _target *= 1.0/sqrt(len2); } @@ -128,7 +128,7 @@ namespace osgAnimation typedef TemplateTarget Vec2Target; typedef TemplateTarget FloatTarget; typedef TemplateTarget DoubleTarget; - + } #endif diff --git a/include/osgAnimation/Timeline b/include/osgAnimation/Timeline index e578f2430..8ce73dc85 100644 --- a/include/osgAnimation/Timeline +++ b/include/osgAnimation/Timeline @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -63,7 +63,7 @@ namespace osgAnimation virtual void addActionAt(unsigned int frame, Action* action, int priority = 0); virtual void addActionAt(double t, Action* action, int priority = 0); void addActionNow(Action* action, int priority = 0); - + void clearActions(); virtual void update(double simulationTime); @@ -90,7 +90,7 @@ namespace osgAnimation unsigned int _previousFrameEvaluated; bool _initFirstFrame; TimelineStatus _state; - + bool _collectStats; osg::ref_ptr _stats; osg::ref_ptr _statsVisitor; @@ -112,7 +112,7 @@ namespace osgAnimation void internalRemoveAction(Action* action); void internalAddAction(int priority, const FrameAction& ftl); - + }; diff --git a/include/osgAnimation/TimelineAnimationManager b/include/osgAnimation/TimelineAnimationManager index 68574ec5e..bf7d7b829 100644 --- a/include/osgAnimation/TimelineAnimationManager +++ b/include/osgAnimation/TimelineAnimationManager @@ -1,18 +1,18 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ -#ifndef OSGANIMATION_TIMELINE_ANIMATION_MANAGER +#ifndef OSGANIMATION_TIMELINE_ANIMATION_MANAGER #define OSGANIMATION_TIMELINE_ANIMATION_MANAGER 1 #include @@ -20,7 +20,7 @@ #include -namespace osgAnimation +namespace osgAnimation { class OSGANIMATION_EXPORT TimelineAnimationManager : public AnimationManagerBase diff --git a/include/osgAnimation/UpdateBone b/include/osgAnimation/UpdateBone index 916b2b912..b364ceafd 100644 --- a/include/osgAnimation/UpdateBone +++ b/include/osgAnimation/UpdateBone @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/UpdateMaterial b/include/osgAnimation/UpdateMaterial index 8d9fe6a53..a00d15098 100644 --- a/include/osgAnimation/UpdateMaterial +++ b/include/osgAnimation/UpdateMaterial @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -27,7 +27,7 @@ namespace osgAnimation { protected: osg::ref_ptr _diffuse; - + public: META_Object(osgAnimation, UpdateMaterial); diff --git a/include/osgAnimation/UpdateMatrixTransform b/include/osgAnimation/UpdateMatrixTransform index 94be6b689..b39c80680 100644 --- a/include/osgAnimation/UpdateMatrixTransform +++ b/include/osgAnimation/UpdateMatrixTransform @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgAnimation/Vec3Packed b/include/osgAnimation/Vec3Packed index 0fae8e6e5..f2587aec3 100644 --- a/include/osgAnimation/Vec3Packed +++ b/include/osgAnimation/Vec3Packed @@ -1,4 +1,4 @@ -/* -*-c++-*- +/* -*-c++-*- */ //****************************************************************************// // loader.cpp // @@ -34,7 +34,7 @@ #include #include -namespace osgAnimation +namespace osgAnimation { @@ -45,7 +45,7 @@ namespace osgAnimation Vec3Packed(uint32_t val): m32bits(val) {} Vec3Packed(): m32bits(0) {} - void uncompress(const osg::Vec3& scale, const osg::Vec3& min, osg::Vec3& result) const + void uncompress(const osg::Vec3& scale, const osg::Vec3& min, osg::Vec3& result) const { uint32_t pt[3]; pt[0] = m32bits & 0x7ff; @@ -55,8 +55,8 @@ namespace osgAnimation result[1] = scale[1] * pt[1] + min[1]; result[2] = scale[2] * pt[2] + min[2]; } - - void compress(const osg::Vec3f& src, const osg::Vec3f& min, const osg::Vec3f& scaleInv) + + void compress(const osg::Vec3f& src, const osg::Vec3f& min, const osg::Vec3f& scaleInv) { uint32_t srci[3]; srci[0] = osg::minimum(static_cast(((src[0] - min[0] )*scaleInv[0])), uint32_t(2047)); @@ -73,16 +73,16 @@ namespace osgAnimation osg::Vec3 mScale; osg::Vec3 mScaleInv; - void analyze(const std::vector& src) + void analyze(const std::vector& src) { //analyze the keys mMin.set(FLT_MAX, FLT_MAX, FLT_MAX); osg::Vec3 maxp(-FLT_MAX, -FLT_MAX, -FLT_MAX); int nb = (int)src.size(); - for(int i = 0; i < nb; i++) + for(int i = 0; i < nb; i++) { const osg::Vec3 &pos = src[i]; - for(int j = 0; j < 3; j++) + for(int j = 0; j < 3; j++) { maxp[j] = osg::maximum(pos[j],maxp[j]); mMin[j] = osg::minimum(pos[j],mMin[j]); @@ -105,7 +105,7 @@ namespace osgAnimation mScale[2] = diff[2] / 1023; } - void compress(const std::vector& src) + void compress(const std::vector& src) { mVecCompressed.resize(src.size()); // save all core keyframes diff --git a/include/osgAnimation/VertexInfluence b/include/osgAnimation/VertexInfluence index 813cddb44..c385ea1a7 100644 --- a/include/osgAnimation/VertexInfluence +++ b/include/osgAnimation/VertexInfluence @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -54,8 +54,8 @@ namespace osgAnimation { public: typedef std::vector BoneToVertexList; - - class BoneWeight + + class BoneWeight { public: BoneWeight(const std::string& name, float weight) : _boneName(name), _weight(weight) {} @@ -70,7 +70,7 @@ namespace osgAnimation typedef std::vector BoneWeightList; typedef std::map VertexIndexToBoneWeightMap; - + class UniqVertexSetToBoneSet { public: diff --git a/include/osgDB/Archive b/include/osgDB/Archive index b2a1da43e..9f69d28df 100644 --- a/include/osgDB/Archive +++ b/include/osgDB/Archive @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ class OSGDB_EXPORT Archive : public ReaderWriter { public: Archive(); - virtual ~Archive(); + virtual ~Archive(); virtual const char* libraryName() const { return "osgDB"; } diff --git a/include/osgDB/AuthenticationMap b/include/osgDB/AuthenticationMap index 4392cfbeb..5c36c07a8 100644 --- a/include/osgDB/AuthenticationMap +++ b/include/osgDB/AuthenticationMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,7 +30,7 @@ class AuthenticationDetails : public osg::Referenced { public: - /** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/ + /** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/ enum HttpAuthentication { BASIC = 1<<0, @@ -57,21 +57,21 @@ protected: class OSGDB_EXPORT AuthenticationMap : public osg::Referenced { public: - + AuthenticationMap() {} - + virtual void addAuthenticationDetails(const std::string& path, AuthenticationDetails* details); virtual const AuthenticationDetails* getAuthenticationDetails(const std::string& path) const; - + protected: - + virtual ~AuthenticationMap() {} - + typedef std::map > AuthenticationDetailsMap; AuthenticationDetailsMap _authenticationMap; - + }; } diff --git a/include/osgDB/Callbacks b/include/osgDB/Callbacks index 62d5983b8..7e0e6f27d 100644 --- a/include/osgDB/Callbacks +++ b/include/osgDB/Callbacks @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgDB/ConvertUTF b/include/osgDB/ConvertUTF index 7c3bb9c78..90f87bb2a 100644 --- a/include/osgDB/ConvertUTF +++ b/include/osgDB/ConvertUTF @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgDB/DataTypes b/include/osgDB/DataTypes index ee480ed72..bdfedead6 100644 --- a/include/osgDB/DataTypes +++ b/include/osgDB/DataTypes @@ -90,16 +90,16 @@ class ObjectProperty public: ObjectProperty( const char* name, int value=0, bool useMap=false ) : _name(name), _value(value), _mapProperty(useMap) {} - + ObjectProperty( const ObjectProperty& copy ) : _name(copy._name), _value(copy._value), _mapProperty(copy._mapProperty) {} - + ObjectProperty& proto( const char* name ) { _name = name; return *this; } - + void set( int v ) { _value = v; } int get() const { return _value; } - + std::string _name; int _value; bool _mapProperty; @@ -119,10 +119,10 @@ class ObjectMark public: ObjectMark( const char* name, int delta=0 ) : _name(name), _indentDelta(delta) {} - + ObjectMark( const ObjectMark& copy ) : _name(copy._name), _indentDelta(copy._indentDelta) {} - + std::string _name; int _indentDelta; diff --git a/include/osgDB/DatabasePager b/include/osgDB/DatabasePager index 6fa19a80e..d1daa54b2 100644 --- a/include/osgDB/DatabasePager +++ b/include/osgDB/DatabasePager @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -44,7 +44,7 @@ namespace osgDB { -/** Database paging class which manages the loading of files in a background thread, +/** Database paging class which manages the loading of files in a background thread, * and synchronizing of loaded models with the main scene graph.*/ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandler { @@ -63,11 +63,11 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** get the prototype singleton used by DatabasePager::create().*/ static osg::ref_ptr& prototype(); - + /** create a DatabasePager by cloning DatabasePager::prototype().*/ static DatabasePager* create(); - + /** Add a request to load a node file to end the the database request list.*/ virtual void requestNodeFile(const std::string& fileName, osg::NodePath& nodePath, @@ -78,27 +78,27 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** Set the priority of the database pager thread(s).*/ int setSchedulePriority(OpenThreads::Thread::ThreadPriority priority); - /** Cancel the database pager thread(s).*/ + /** Cancel the database pager thread(s).*/ virtual int cancel(); - + virtual bool isRunning() const; - + /** Clear all internally cached structures.*/ virtual void clear(); - + class OSGDB_EXPORT DatabaseThread : public osg::Referenced, public OpenThreads::Thread { public: - + enum Mode { HANDLE_ALL_REQUESTS, HANDLE_NON_HTTP, HANDLE_ONLY_HTTP }; - + DatabaseThread(DatabasePager* pager, Mode mode, const std::string& name); - + DatabaseThread(const DatabaseThread& dt, DatabasePager* pager); void setName(const std::string& name) { _name = name; } @@ -106,18 +106,18 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl void setDone(bool done) { _done.exchange(done?1:0); } bool getDone() const { return _done!=0; } - + void setActive(bool active) { _active = active; } bool getActive() const { return _active; } virtual int cancel(); - + virtual void run(); - + protected: virtual ~DatabaseThread(); - + OpenThreads::Atomic _done; volatile bool _active; DatabasePager* _pager; @@ -125,42 +125,42 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl std::string _name; }; - + void setUpThreads(unsigned int totalNumThreads=2, unsigned int numHttpThreads=1); virtual unsigned int addDatabaseThread(DatabaseThread::Mode mode, const std::string& name); DatabaseThread* getDatabaseThread(unsigned int i) { return _databaseThreads[i].get(); } - + const DatabaseThread* getDatabaseThread(unsigned int i) const { return _databaseThreads[i].get(); } unsigned int getNumDatabaseThreads() const { return _databaseThreads.size(); } - + /** Set whether the database pager thread should be paused or not.*/ void setDatabasePagerThreadPause(bool pause); - + /** Get whether the database pager thread should is paused or not.*/ bool getDatabasePagerThreadPause() const { return _databasePagerThreadPaused; } - + /** Set whether new database request calls are accepted or ignored.*/ void setAcceptNewDatabaseRequests(bool acceptNewRequests) { _acceptNewRequests = acceptNewRequests; } - + /** Get whether new database request calls are accepted or ignored.*/ bool getAcceptNewDatabaseRequests() const { return _acceptNewRequests; } - + /** Get the number of frames that are currently active.*/ int getNumFramesActive() const { return _numFramesActive; } /** Signal the database thread that the update, cull and draw has begun for a new frame. * Note, this is called by the application so that the database pager can go to sleep while the CPU is busy on the main rendering threads. */ virtual void signalBeginFrame(const osg::FrameStamp* framestamp); - + /** Signal the database thread that the update, cull and draw dispatch has completed. * Note, this is called by the application so that the database pager can go to wake back up now the main rendering threads are iddle waiting for the next frame.*/ virtual void signalEndFrame(); - - /** Find all PagedLOD nodes in a subgraph and register them with + + /** Find all PagedLOD nodes in a subgraph and register them with * the DatabasePager so it can keep track of expired nodes. * note, should be only be called from the update thread. */ virtual void registerPagedLODs(osg::Node* subgraph, unsigned int frameNumber = 0); @@ -197,7 +197,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** Set whether the removed subgraphs should be deleted in the database thread or not.*/ void setDeleteRemovedSubgraphsInDatabaseThread(bool flag) { _deleteRemovedSubgraphsInDatabaseThread = flag; } - + /** Get whether the removed subgraphs should be deleted in the database thread or not.*/ bool getDeleteRemovedSubgraphsInDatabaseThread() const { return _deleteRemovedSubgraphsInDatabaseThread; } @@ -239,7 +239,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** Return true if there are pending updates to the scene graph that require a call to updateSceneGraph(double). */ bool requiresUpdateSceneGraph() const; - + /** Merge the changes to the scene graph by calling calling removeExpiredSubgraphs then addLoadedDataToSceneGraph. * Note, must only be called from single thread update phase. */ virtual void updateSceneGraph(const osg::FrameStamp& frameStamp); @@ -249,13 +249,13 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** Report how many items are in the _dataToCompileList queue */ unsigned int getDataToCompileListSize() const { return _dataToCompileList->size(); } - + /** Report how many items are in the _dataToMergeList queue */ unsigned int getDataToMergeListSize() const { return _dataToMergeList->size(); } /** Report whether any requests are in the pager.*/ bool getRequestsInProgress() const; - + /** Get the minimum time between the first request for a tile to be loaded and the time of its merge into the main scene graph.*/ double getMinimumTimeToMergeTile() const { return _minimumTimeToMergeTile; } @@ -324,7 +324,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl double _timestampLastRequest; float _priorityLastRequest; unsigned int _numOfRequests; - + osg::observer_ptr _terrain; osg::observer_ptr _group; @@ -380,7 +380,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl virtual ~RequestQueue(); }; - + typedef std::vector< osg::ref_ptr > DatabaseThreadList; struct OSGDB_EXPORT ReadQueue : public RequestQueue @@ -415,7 +415,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl struct SortFileRequestFunctor; friend struct SortFileRequestFunctor; - + OpenThreads::Mutex _run_mutex; OpenThreads::Mutex _dr_mutex; bool _startThreadCalled; diff --git a/include/osgDB/DatabaseRevisions b/include/osgDB/DatabaseRevisions index 6127ae884..e324829eb 100644 --- a/include/osgDB/DatabaseRevisions +++ b/include/osgDB/DatabaseRevisions @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgDB/DotOsgWrapper b/include/osgDB/DotOsgWrapper index cf1bccf32..c7563caac 100644 --- a/include/osgDB/DotOsgWrapper +++ b/include/osgDB/DotOsgWrapper @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ class OSGDB_EXPORT DotOsgWrapper : public osg::Referenced typedef std::vector Associates; typedef bool (*ReadFunc)(osg::Object&,osgDB::Input&); typedef bool (*WriteFunc)(const osg::Object&,osgDB::Output&); - + enum ReadWriteMode { READ_AND_WRITE, @@ -47,7 +47,7 @@ class OSGDB_EXPORT DotOsgWrapper : public osg::Referenced ReadFunc readFunc, WriteFunc writeFunc, ReadWriteMode readWriteMode=READ_AND_WRITE); - + inline const osg::Object* getPrototype() const { return _prototype.get(); } inline const std::string& getName() const { return _name; } @@ -68,10 +68,10 @@ class OSGDB_EXPORT DotOsgWrapper : public osg::Referenced virtual ~DotOsgWrapper() {} osg::ref_ptr _prototype; - + std::string _name; Associates _associates; - + ReadFunc _readFunc; WriteFunc _writeFunc; @@ -168,4 +168,4 @@ class TemplateRegisterDotOsgWrapperProxy : public RegisterDotOsgWrapperProxy, pu } -#endif +#endif diff --git a/include/osgDB/DynamicLibrary b/include/osgDB/DynamicLibrary index 9ea73b8f6..b700f36d2 100644 --- a/include/osgDB/DynamicLibrary +++ b/include/osgDB/DynamicLibrary @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ class OSGDB_EXPORT DynamicLibrary : public osg::Referenced typedef void* HANDLE; typedef void* PROC_ADDRESS; - + /** returns a pointer to a DynamicLibrary object on successfully * opening of library returns NULL on failure. */ @@ -60,9 +60,9 @@ class OSGDB_EXPORT DynamicLibrary : public osg::Referenced DynamicLibrary(const DynamicLibrary&):osg::Referenced() {} /** disallow copy operator.*/ DynamicLibrary& operator = (const DynamicLibrary&) { return *this; } - + /** Disallow public construction so that users have to go - * through loadLibrary() above which returns NULL on + * through loadLibrary() above which returns NULL on * failure, a valid DynamicLibrary object on success. */ DynamicLibrary(const std::string& name,HANDLE handle); diff --git a/include/osgDB/Export b/include/osgDB/Export index 23b4d0b0f..398a7fcd5 100644 --- a/include/osgDB/Export +++ b/include/osgDB/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,7 +43,7 @@ \namespace osgDB -The osgDB library provides support for reading and writing scene graphs, providing a plugin framework and file utility classes. +The osgDB library provides support for reading and writing scene graphs, providing a plugin framework and file utility classes. The plugin framework in centered around the osgDB::Registry, and allows plugins which provide specific file format support to be dynamically loaded on demand. */ diff --git a/include/osgDB/ExternalFileWriter b/include/osgDB/ExternalFileWriter index 6cd0b314f..86e37b132 100644 --- a/include/osgDB/ExternalFileWriter +++ b/include/osgDB/ExternalFileWriter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgDB/FileCache b/include/osgDB/FileCache index a99b5f6c7..cb14004eb 100644 --- a/include/osgDB/FileCache +++ b/include/osgDB/FileCache @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ namespace osgDB { class OSGDB_EXPORT FileCache : public osg::Referenced { - public: + public: FileCache(const std::string& path); diff --git a/include/osgDB/FileNameUtils b/include/osgDB/FileNameUtils index 6f30620fc..0094cb6aa 100644 --- a/include/osgDB/FileNameUtils +++ b/include/osgDB/FileNameUtils @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgDB/FileUtils b/include/osgDB/FileUtils index 0276cb2f0..83758ff78 100644 --- a/include/osgDB/FileUtils +++ b/include/osgDB/FileUtils @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,7 +32,7 @@ extern OSGDB_EXPORT bool makeDirectory( const std::string &directoryPath ); /** Make a new directory for a given file. */ extern OSGDB_EXPORT bool makeDirectoryForFile( const std::string &filePath ); - + /** Get current working directory. */ extern OSGDB_EXPORT std::string getCurrentWorkingDirectory( void ); @@ -72,10 +72,10 @@ typedef std::vector DirectoryContents; extern OSGDB_EXPORT DirectoryContents getDirectoryContents(const std::string& dirName); /** Return the list of filenames that match the given filename with wildcards. - * Will only expand '*', and will not expand wildcards in directory, only in - * filename part of the given filename. - * Return value will contain path+filename so that if ever the above - * limitation (expanding wildcards in directory) is fixed, client code will + * Will only expand '*', and will not expand wildcards in directory, only in + * filename part of the given filename. + * Return value will contain path+filename so that if ever the above + * limitation (expanding wildcards in directory) is fixed, client code will * still work unchanged. */ extern OSGDB_EXPORT DirectoryContents expandWildcardsInFilename(const std::string& filename); @@ -108,12 +108,12 @@ inline void setDataFilePathList(const std::string& paths) { osgDB::Registry::ins inline FilePathList& getDataFilePathList() { return osgDB::Registry::instance()->getDataFilePathList(); } -/** Search for specified file in file system, checking the DataFilePathList for possible paths, +/** Search for specified file in file system, checking the DataFilePathList for possible paths, * returning the full path of the first valid file found, return an empty string if no string is found. */ extern OSGDB_EXPORT std::string findDataFile(const std::string& filename,CaseSensitivity caseSensitivity=CASE_SENSITIVE); -/** Search for specified file in file system, checking first the database path set in the Options structure, then the DataFilePathList for possible paths, +/** Search for specified file in file system, checking first the database path set in the Options structure, then the DataFilePathList for possible paths, * returning the full path of the first valid file found, return an empty string if no string is found. */ extern OSGDB_EXPORT std::string findDataFile(const std::string& filename,const Options* options, CaseSensitivity caseSensitivity=CASE_SENSITIVE); diff --git a/include/osgDB/ImageOptions b/include/osgDB/ImageOptions index 9bebec3a3..b54532084 100644 --- a/include/osgDB/ImageOptions +++ b/include/osgDB/ImageOptions @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -21,11 +21,11 @@ namespace osgDB { class OSGDB_EXPORT ImageOptions : public osgDB::Options { public: - + ImageOptions(); - + ImageOptions(const std::string& str); - + ImageOptions(const ImageOptions& options,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): osgDB::Options(options,copyop), _sourceImageSamplingMode(options._sourceImageSamplingMode), @@ -38,7 +38,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options _destinationPixelWindow(options._destinationPixelWindow), _destinationDataType(options._destinationDataType), _destinationPixelFormat(options._destinationPixelFormat) {} - + META_Object(osgDB,ImageOptions); @@ -58,13 +58,13 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options windowWidth = w; windowHeight = h; } - + double windowX; double windowY; double windowWidth; double windowHeight; }; - + /** PixelWindow stores the window (in exact pixels) from the overall imagery from which to extract the osg::Image*/ struct PixelWindow { @@ -73,7 +73,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options windowY(0), windowWidth(0), windowHeight(0) {} - + void set(unsigned int x, unsigned int y, unsigned int w, unsigned int h) { windowX = x; @@ -81,20 +81,20 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options windowWidth = w; windowHeight = h; } - + unsigned int windowX; unsigned int windowY; unsigned int windowWidth; unsigned int windowHeight; }; - + enum ImageWindowMode { ALL_IMAGE, RATIO_WINDOW, PIXEL_WINDOW }; - + enum ImageSamplingMode { NEAREST, @@ -110,7 +110,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options _y(0.0), _w(1.0), _h(1.0) {} - + void set(double x,double y, double w, double h) { _x = x; @@ -118,12 +118,12 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options _w = w; _h = h; } - + double _x,_y,_w,_h; }; - // source + // source ImageSamplingMode _sourceImageSamplingMode; ImageWindowMode _sourceImageWindowMode; RatioWindow _sourceRatioWindow; @@ -131,7 +131,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options // destination osg::ref_ptr _destinationImage; - + ImageWindowMode _destinationImageWindowMode; RatioWindow _destinationRatioWindow; PixelWindow _destinationPixelWindow; @@ -140,7 +140,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::Options GLenum _destinationPixelFormat; void init(); - + }; diff --git a/include/osgDB/ImagePager b/include/osgDB/ImagePager index 102ea70cc..3b4ac7376 100644 --- a/include/osgDB/ImagePager +++ b/include/osgDB/ImagePager @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,35 +31,35 @@ namespace osgDB class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler { public: - + ImagePager(); - + class OSGDB_EXPORT ImageThread : public osg::Referenced, public OpenThreads::Thread { public: - + enum Mode { HANDLE_ALL_REQUESTS, HANDLE_NON_HTTP, HANDLE_ONLY_HTTP }; - + ImageThread(ImagePager* pager, Mode mode, const std::string& name); - + ImageThread(const ImageThread& dt, ImagePager* pager); - + void setDone(bool done) { _done = done; } bool getDone() const { return _done; } virtual int cancel(); - + virtual void run(); - + protected: virtual ~ImageThread(); - + bool _done; Mode _mode; ImagePager* _pager; @@ -68,11 +68,11 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler ImageThread* getImageThread(unsigned int i) { return _imageThreads[i].get(); } - + const ImageThread* getImageThread(unsigned int i) const { return _imageThreads[i].get(); } unsigned int getNumImageThreads() const { return _imageThreads.size(); } - + void setPreLoadTime(double preLoadTime) { _preLoadTime=preLoadTime; } virtual double getPreLoadTime() const { return _preLoadTime; } @@ -84,28 +84,28 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler /** Return true if there are pending updates to the scene graph that require a call to updateSceneGraph(double). */ virtual bool requiresUpdateSceneGraph() const; - + /** Merge the changes to the scene graph. */ virtual void updateSceneGraph(const osg::FrameStamp &frameStamp); - + int cancel(); protected: - + virtual ~ImagePager(); - // forward declare + // forward declare struct RequestQueue; - + struct SortFileRequestFunctor; friend struct SortFileRequestFunctor; - + struct ImageRequest : public osg::Referenced { ImageRequest(): osg::Referenced(true), _timeToMergeBy(0.0), _attachmentIndex(-1) {} - + double _timeToMergeBy; std::string _fileName; osg::ref_ptr _loadOptions; @@ -113,58 +113,58 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler int _attachmentIndex; osg::ref_ptr _loadedImage; RequestQueue* _requestQueue; - + }; - + struct RequestQueue : public osg::Referenced { typedef std::vector< osg::ref_ptr > RequestList; void sort(); - + RequestList _requestList; OpenThreads::Mutex _requestMutex; }; - + struct ReadQueue : public RequestQueue { ReadQueue(ImagePager* pager, const std::string& name); - + void block() { _block->block(); } - + void release() { _block->release(); } - + void updateBlock() { _block->set((!_requestList.empty() || !_pager->_databasePagerThreadPaused)); } - + void clear(); - + void add(ImageRequest* imageRequest); - + void takeFirst(osg::ref_ptr& databaseRequest); - + osg::ref_ptr _block; - + ImagePager* _pager; std::string _name; }; - + OpenThreads::Mutex _run_mutex; bool _startThreadCalled; bool _done; bool _databasePagerThreadPaused; - + osg::ref_ptr _readQueue; - + typedef std::vector< osg::ref_ptr > ImageThreads; ImageThreads _imageThreads; - + osg::ref_ptr _completedQueue; - + double _preLoadTime; }; diff --git a/include/osgDB/ImageProcessor b/include/osgDB/ImageProcessor index 2536b030b..2ce823d6b 100644 --- a/include/osgDB/ImageProcessor +++ b/include/osgDB/ImageProcessor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgDB/Input b/include/osgDB/Input index 2337c15e3..230598619 100644 --- a/include/osgDB/Input +++ b/include/osgDB/Input @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -248,7 +248,7 @@ class OSGDB_EXPORT Input : public FieldReaderIterator Input(); virtual ~Input(); - + void setOptions(const Options* options) { _options = options; } const Options* getOptions() const { return _options.get(); } @@ -267,7 +267,7 @@ class OSGDB_EXPORT Input : public FieldReaderIterator virtual osg::Image* readImage(const std::string& fileName); virtual osg::Node* readNode(const std::string& fileName); virtual osg::Shader* readShader(const std::string& fileName); - + virtual osg::Object* getObjectForUniqueID(const std::string& uniqueID); virtual void registerUniqueIDForObject(const std::string& uniqueID,osg::Object* obj); @@ -293,10 +293,10 @@ class OSGDB_EXPORT Input : public FieldReaderIterator bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8); private: - + typedef std::map< std::string, osg::ref_ptr > UniqueIDToObjectMapping; UniqueIDToObjectMapping _uniqueIDToObjectMap; - + osg::ref_ptr _options; }; diff --git a/include/osgDB/InputStream b/include/osgDB/InputStream index d59abc259..f2600aeae 100644 --- a/include/osgDB/InputStream +++ b/include/osgDB/InputStream @@ -43,10 +43,10 @@ public: _field += " "; } } - + const std::string& getField() const { return _field; } const std::string& getError() const { return _error; } - + protected: std::string _field; std::string _error; @@ -57,7 +57,7 @@ class OSGDB_EXPORT InputStream public: typedef std::map< unsigned int, osg::ref_ptr > ArrayMap; typedef std::map< unsigned int, osg::ref_ptr > IdentifierMap; - + enum ReadType { READ_UNKNOWN = 0, @@ -65,14 +65,14 @@ public: READ_IMAGE, READ_OBJECT }; - + InputStream( const osgDB::Options* options ); virtual ~InputStream(); - + bool isBinary() const { return _in->isBinary(); } int getFileVersion() const { return _fileVersion; } const osgDB::Options* getOptions() const { return _options.get(); } - + // Serialization related functions InputStream& operator>>( bool& b ) { _in->readBool(b); checkStream(); return *this; } InputStream& operator>>( char& c ) { _in->readChar(c); checkStream(); return *this; } @@ -89,11 +89,11 @@ public: InputStream& operator>>( std::string& s ) { _in->readString(s); checkStream(); return *this; } InputStream& operator>>( std::istream& (*fn)(std::istream&) ) { _in->readStream(fn); checkStream(); return *this; } InputStream& operator>>( std::ios_base& (*fn)(std::ios_base&) ) { _in->readBase(fn); checkStream(); return *this; } - + InputStream& operator>>( ObjectGLenum& value ) { _in->readGLenum(value); checkStream(); return *this; } InputStream& operator>>( ObjectProperty& prop ) { _in->readProperty(prop); checkStream(); return *this; } InputStream& operator>>( ObjectMark& mark ) { _in->readMark(mark); checkStream(); return *this; } - + InputStream& operator>>( osg::Vec2b& v ); InputStream& operator>>( osg::Vec3b& v ); InputStream& operator>>( osg::Vec4b& v ); @@ -111,19 +111,19 @@ public: InputStream& operator>>( osg::Plane& p ); InputStream& operator>>( osg::Matrixf& mat ); InputStream& operator>>( osg::Matrixd& mat ); - + InputStream& operator>>( osg::Array*& a ) { a = readArray(); return *this; } InputStream& operator>>( osg::Image*& img ) { img = readImage(); return *this; } InputStream& operator>>( osg::PrimitiveSet*& p ) { p = readPrimitiveSet(); return *this; } InputStream& operator>>( osg::Object*& obj ) { obj = readObject(); return *this; } - + InputStream& operator>>( osg::ref_ptr& ptr ) { ptr = readArray(); return *this; } InputStream& operator>>( osg::ref_ptr& ptr ) { ptr = readImage(); return *this; } InputStream& operator>>( osg::ref_ptr& ptr ) { ptr = readPrimitiveSet(); return *this; } - + template InputStream& operator>>( osg::ref_ptr& ptr ) { ptr = static_cast(readObject()); return *this; } - + // Convenient methods for reading bool matchString( const std::string& str ) { return _in->matchString(str); } void advanceToCurrentEndBracket() { _in->advanceToCurrentEndBracket(); } @@ -148,25 +148,25 @@ public: ReadType start( InputIterator* ); void decompress(); - + // Schema handlers void readSchema( std::istream& fin ); void resetSchema(); - + // Exception handlers inline void throwException( const std::string& msg ); const InputException* getException() const { return _exception.get(); } - + protected: inline void checkStream(); void setWrapperSchema( const std::string& name, const std::string& properties ); - + template void readArrayImplementation( T* a, unsigned int numComponentsPerElements, unsigned int componentSizeInBytes ); - + ArrayMap _arrayMap; IdentifierMap _identifierMap; - + int _fileVersion; bool _useSchemaData; bool _forceReadingImage; diff --git a/include/osgDB/ObjectWrapper b/include/osgDB/ObjectWrapper index 1403a8d93..91f057c1d 100644 --- a/include/osgDB/ObjectWrapper +++ b/include/osgDB/ObjectWrapper @@ -47,11 +47,11 @@ class OSGDB_EXPORT ObjectWrapper : public osg::Referenced public: typedef std::vector< osg::ref_ptr > SerializerList; typedef std::vector< osg::ref_ptr > FinishedObjectReadCallbackList; - + ObjectWrapper( osg::Object* proto, const std::string& name, const std::string& associates ); void setUpdatedVersion( int ver ) { _version = ver; } - + const osg::Object* getProto() const { return _proto.get(); } const std::string& getName() const { return _name; } const StringList& getAssociates() const { return _associates; } @@ -68,7 +68,7 @@ public: void writeSchema( StringList& properties, std::vector& types ); void resetSchema() { if ( _backupSerializers.size()>0 ) _serializers = _backupSerializers; } - + protected: ObjectWrapper() : _version(0) {} virtual ~ObjectWrapper() {} diff --git a/include/osgDB/Options b/include/osgDB/Options index a216cf8c4..b6704350e 100644 --- a/include/osgDB/Options +++ b/include/osgDB/Options @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -173,7 +173,7 @@ class OSGDB_EXPORT Options : public osg::Object /** Remove a value from the PluginData */ void removePluginData(const std::string& s) const { _pluginData.erase(s); } - + /** Get number of PluginData values */ unsigned int getNumPluginData() const { return _pluginData.size(); } diff --git a/include/osgDB/Output b/include/osgDB/Output index a0b9e10e5..316d073ec 100644 --- a/include/osgDB/Output +++ b/include/osgDB/Output @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,10 +31,10 @@ class OSGDB_EXPORT Output : public osgDB::ofstream Output(); Output(const char* name); - + virtual ~Output(); - + void setOptions(const Options* options); const Options* getOptions() const { return _options.get(); } @@ -42,7 +42,7 @@ class OSGDB_EXPORT Output : public osgDB::ofstream bool getWriteOutDefaultValues() const { return _writeOutDefaultValues; } void open(const char *name); - + // comment out temporarily to avoid compilation problems, RO Jan 2002. // void open(const char *name,int mode); @@ -65,7 +65,7 @@ class OSGDB_EXPORT Output : public osgDB::ofstream void moveIn(); void moveOut(); - + virtual bool writeObject(const osg::Object& obj); virtual void writeBeginObject(const std::string& name); virtual void writeEndObject(); @@ -83,7 +83,7 @@ class OSGDB_EXPORT Output : public osgDB::ofstream RELATIVE_PATH, FILENAME_ONLY }; - + inline void setPathNameHint(const PathNameHint pnh) { _pathNameHint = pnh; } inline PathNameHint getPathNameHint() const { return _pathNameHint; } @@ -114,14 +114,14 @@ class OSGDB_EXPORT Output : public osgDB::ofstream int _indent; int _indentStep; - + int _numIndicesPerLine; typedef std::map UniqueIDToLabelMapping; UniqueIDToLabelMapping _objectToUniqueIDMap; - + std::string _filename; - + PathNameHint _pathNameHint; bool _outputTextureFiles; diff --git a/include/osgDB/OutputStream b/include/osgDB/OutputStream index 21baa0fb0..cd214eda9 100644 --- a/include/osgDB/OutputStream +++ b/include/osgDB/OutputStream @@ -41,10 +41,10 @@ public: _field += " "; } } - + const std::string& getField() const { return _field; } const std::string& getError() const { return _error; } - + protected: std::string _field; std::string _error; @@ -55,7 +55,7 @@ class OSGDB_EXPORT OutputStream public: typedef std::map ArrayMap; typedef std::map ObjectMap; - + enum WriteType { WRITE_UNKNOWN = 0, @@ -63,7 +63,7 @@ public: WRITE_IMAGE, WRITE_OBJECT }; - + enum WriteImageHint { WRITE_USE_IMAGE_HINT = 0, /*!< Use image hint, write inline data or use external */ @@ -72,17 +72,17 @@ public: WRITE_INLINE_FILE, /*!< Write the image file itself to stream */ WRITE_EXTERNAL_FILE /*!< Write Image::data() to disk and use it as external file */ }; - + OutputStream( const osgDB::Options* options ); virtual ~OutputStream(); - + bool isBinary() const { return _out->isBinary(); } const std::string& getSchemaName() const { return _schemaName; } const osgDB::Options* getOptions() const { return _options.get(); } - + void setWriteImageHint( WriteImageHint hint ) { _writeImageHint = hint; } WriteImageHint getWriteImageHint() const { return _writeImageHint; } - + // Serialization related functions OutputStream& operator<<( bool b ) { _out->writeBool(b); return *this; } OutputStream& operator<<( char c ) { _out->writeChar(c); return *this; } @@ -99,11 +99,11 @@ public: OutputStream& operator<<( const char* s ) { _out->writeString(s); return *this; } OutputStream& operator<<( std::ostream& (*fn)(std::ostream&) ) { _out->writeStream(fn); return *this; } OutputStream& operator<<( std::ios_base& (*fn)(std::ios_base&) ) { _out->writeBase(fn); return *this; } - + OutputStream& operator<<( const ObjectGLenum& value ) { _out->writeGLenum(value); return *this; } OutputStream& operator<<( const ObjectProperty& prop ) { _out->writeProperty(prop); return *this; } OutputStream& operator<<( const ObjectMark& mark ) { _out->writeMark(mark); return *this; } - + OutputStream& operator<<( const osg::Vec2b& v ); OutputStream& operator<<( const osg::Vec3b& v ); OutputStream& operator<<( const osg::Vec4b& v ); @@ -121,19 +121,19 @@ public: OutputStream& operator<<( const osg::Plane& p ); OutputStream& operator<<( const osg::Matrixf& mat ); OutputStream& operator<<( const osg::Matrixd& mat ); - + OutputStream& operator<<( const osg::Array* a ) { writeArray(a); return *this; } OutputStream& operator<<( const osg::Image* img ) { writeImage(img); return *this; } OutputStream& operator<<( const osg::PrimitiveSet* p ) { writePrimitiveSet(p); return *this; } OutputStream& operator<<( const osg::Object* obj ) { writeObject(obj); return *this; } - + OutputStream& operator<<( const osg::ref_ptr& ptr ) { writeArray(ptr.get()); return *this; } OutputStream& operator<<( const osg::ref_ptr& ptr ) { writeImage(ptr.get()); return *this; } OutputStream& operator<<( const osg::ref_ptr& ptr ) { writePrimitiveSet(ptr.get()); return *this; } - + template OutputStream& operator<<( const osg::ref_ptr& ptr ) { writeObject(ptr.get()); return *this; } - + // Convenient methods for writing void writeWrappedString( const std::string& str ) { _out->writeWrappedString(str); } void writeCharArray( const char* s, unsigned int size ) { _out->writeCharArray(s, size); } @@ -148,7 +148,7 @@ public: void writeImage( const osg::Image* img ); void writeObject( const osg::Object* obj ); void writeObjectFields( const osg::Object* obj ); - + /// set an output iterator, used directly when not using OutputStream with a traditional file releated stream. void setOutputIterator( OutputIterator* oi ) { _out = oi; } @@ -156,24 +156,24 @@ public: void start( OutputIterator* outIterator, WriteType type ); void compress( std::ostream* ostream ); - + // Schema handlers void writeSchema( std::ostream& fout ); - + // Exception handlers inline void throwException( const std::string& msg ); const OutputException* getException() const { return _exception.get(); } - + protected: template void writeArrayImplementation( const T*, int write_size, unsigned int numInRow=1 ); - + unsigned int findOrCreateArrayID( const osg::Array* array, bool& newID ); unsigned int findOrCreateObjectID( const osg::Object* obj, bool& newID ); - + ArrayMap _arrayMap; ObjectMap _objectMap; - + WriteImageHint _writeImageHint; bool _useSchemaData; std::map _inbuiltSchemaMap; diff --git a/include/osgDB/ParameterOutput b/include/osgDB/ParameterOutput index f5398b914..0653c86bd 100644 --- a/include/osgDB/ParameterOutput +++ b/include/osgDB/ParameterOutput @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -21,12 +21,12 @@ namespace osgDB { class ParameterOutput { public: - + ParameterOutput(Output& fw): _fw(fw), _numItemsPerLine(fw.getNumIndicesPerLine()), _column(0) {} - + ParameterOutput(Output& fw,int numItemsPerLine): _fw(fw), _numItemsPerLine(numItemsPerLine), @@ -51,14 +51,14 @@ class ParameterOutput _fw.indent() << "}"< void write(const T& t) { if (_column==0) _fw.indent(); _fw << t; - + ++_column; if (_column==_numItemsPerLine) { @@ -71,7 +71,7 @@ class ParameterOutput } } - + template void write(Iterator first, Iterator last) { @@ -83,7 +83,7 @@ class ParameterOutput } } - + template void writeAsInts(Iterator first, Iterator last) { @@ -95,10 +95,10 @@ class ParameterOutput } } - - + + protected: - + ParameterOutput& operator = (const ParameterOutput&) { return *this; } Output& _fw; @@ -116,15 +116,15 @@ void writeArray(Output& fw, Iterator first, Iterator last,int noItemsPerLine=0) fw.moveIn(); int column=0; - + for(Iterator itr=first; itr!=last; ++itr) { if (column==0) fw.indent(); - + fw << *itr; - + ++column; if (column==noItemsPerLine) { @@ -137,10 +137,10 @@ void writeArray(Output& fw, Iterator first, Iterator last,int noItemsPerLine=0) } } if (column!=0) fw << std::endl; - + fw.moveOut(); fw.indent()<<"}"<getOptions()); } -/** Read an osg::Image from file. +/** Read an osg::Image from file. * Return valid osg::Image on success, * return NULL on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -55,7 +55,7 @@ inline osg::Object* readObjectFile(const std::string& filename) * to read the specified file.*/ extern OSGDB_EXPORT osg::Image* readImageFile(const std::string& filename,const Options* options); -/** Read an osg::Image from file. +/** Read an osg::Image from file. * Return valid osg::Image on success, * return NULL on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -66,7 +66,7 @@ inline osg::Image* readImageFile(const std::string& filename) return readImageFile(filename,Registry::instance()->getOptions()); } -/** Read an osg::HeightField from file. +/** Read an osg::HeightField from file. * Return valid osg::HeightField on success, * return NULL on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -75,7 +75,7 @@ inline osg::Image* readImageFile(const std::string& filename) * to read the specified file.*/ extern OSGDB_EXPORT osg::HeightField* readHeightFieldFile(const std::string& filename,const Options* options); -/** Read an osg::HeightField from file. +/** Read an osg::HeightField from file. * Return valid osg::HeightField on success, * return NULL on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -86,7 +86,7 @@ inline osg::HeightField* readHeightFieldFile(const std::string& filename) return readHeightFieldFile(filename,Registry::instance()->getOptions()); } -/** Read an osg::Node from file. +/** Read an osg::Node from file. * Return valid osg::Node on success, * return NULL on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -95,7 +95,7 @@ inline osg::HeightField* readHeightFieldFile(const std::string& filename) * to read the specified file.*/ extern OSGDB_EXPORT osg::Node* readNodeFile(const std::string& filename,const Options* options); -/** Read an osg::Node from file. +/** Read an osg::Node from file. * Return valid osg::Node on success, * return NULL on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -133,7 +133,7 @@ inline osg::Node* readNodeFiles(osg::ArgumentParser& parser) return readNodeFiles(parser,Registry::instance()->getOptions()); } -/** Read an osg::Shader from file. +/** Read an osg::Shader from file. * Return valid osg::Shader on success, * return NULL on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -142,7 +142,7 @@ inline osg::Node* readNodeFiles(osg::ArgumentParser& parser) * to read the specified file.*/ extern OSGDB_EXPORT osg::Shader* readShaderFile(const std::string& filename,const Options* options); -/** Read an osg::Shader from file. +/** Read an osg::Shader from file. * Return valid osg::Shader on success, * return NULL on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -153,7 +153,7 @@ inline osg::Shader* readShaderFile(const std::string& filename) return readShaderFile(filename,Registry::instance()->getOptions()); } -/** Read an osg::Shader from file and set to specified shader type. +/** Read an osg::Shader from file and set to specified shader type. * Return valid osg::Shader on success, * return NULL on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -167,7 +167,7 @@ inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& fi return shader; } -/** Read an osg::Shader from file and set to specified shader type +/** Read an osg::Shader from file and set to specified shader type * Return valid osg::Shader on success, * return NULL on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -178,7 +178,7 @@ inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& fi return readShaderFile(type, filename,Registry::instance()->getOptions()); } -/** Read an osg::Object from file. +/** Read an osg::Object from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -187,7 +187,7 @@ inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& fi * to read the specified file.*/ extern OSGDB_EXPORT osg::ref_ptr readRefObjectFile(const std::string& filename,const Options* options); -/** Read an osg::Object from file. +/** Read an osg::Object from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -198,7 +198,7 @@ inline osg::ref_ptr readRefObjectFile(const std::string& filename) return readRefObjectFile(filename,Registry::instance()->getOptions()); } -/** Read an osg::Image from file. +/** Read an osg::Image from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -207,7 +207,7 @@ inline osg::ref_ptr readRefObjectFile(const std::string& filename) * to read the specified file.*/ extern OSGDB_EXPORT osg::ref_ptr readRefImageFile(const std::string& filename,const Options* options); -/** Read an osg::Image from file. +/** Read an osg::Image from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -218,7 +218,7 @@ inline osg::ref_ptr readRefImageFile(const std::string& filename) return readRefImageFile(filename,Registry::instance()->getOptions()); } -/** Read an osg::HeightField from file. +/** Read an osg::HeightField from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -227,7 +227,7 @@ inline osg::ref_ptr readRefImageFile(const std::string& filename) * to read the specified file.*/ extern OSGDB_EXPORT osg::ref_ptr readRefHeightFieldFile(const std::string& filename,const Options* options); -/** Read an osg::HeightField from file. +/** Read an osg::HeightField from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -238,7 +238,7 @@ inline osg::ref_ptr readRefHeightFieldFile(const std::string& return readRefHeightFieldFile(filename,Registry::instance()->getOptions()); } -/** Read an osg::Node from file. +/** Read an osg::Node from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -247,7 +247,7 @@ inline osg::ref_ptr readRefHeightFieldFile(const std::string& * to read the specified file.*/ extern OSGDB_EXPORT osg::ref_ptr readRefNodeFile(const std::string& filename,const Options* options); -/** Read an osg::Node from file. +/** Read an osg::Node from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -258,7 +258,7 @@ inline osg::ref_ptr readRefNodeFile(const std::string& filename) return readRefNodeFile(filename,Registry::instance()->getOptions()); } -/** Read an osg::Shader from file. +/** Read an osg::Shader from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -267,7 +267,7 @@ inline osg::ref_ptr readRefNodeFile(const std::string& filename) * to read the specified file.*/ extern OSGDB_EXPORT osg::ref_ptr readRefShaderFile(const std::string& filename,const Options* options); -/** Read an osg::Shader from file. +/** Read an osg::Shader from file. * Return an assigned osg::ref_ptr on success, * return an osg::ref_ptr with a NULL pointer assigned to it on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin diff --git a/include/osgDB/ReaderWriter b/include/osgDB/ReaderWriter index 43b3f8d4b..c1d07c196 100644 --- a/include/osgDB/ReaderWriter +++ b/include/osgDB/ReaderWriter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -38,11 +38,11 @@ class Options; class OSGDB_EXPORT ReaderWriter : public osg::Object { public: - - + + ReaderWriter(): osg::Object(true) {} - + ReaderWriter(const ReaderWriter& rw,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): osg::Object(rw,copyop) {} @@ -70,10 +70,10 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object { FEATURE_NONE = 0, FEATURE_READ_OBJECT = 1<<0, - FEATURE_READ_IMAGE = 1<<1, + FEATURE_READ_IMAGE = 1<<1, FEATURE_READ_HEIGHT_FIELD = 1<<2, - FEATURE_READ_NODE = 1<<3, - FEATURE_READ_SHADER = 1<<4, + FEATURE_READ_NODE = 1<<3, + FEATURE_READ_SHADER = 1<<4, FEATURE_WRITE_OBJECT = 1<<5, FEATURE_WRITE_IMAGE = 1<<6, FEATURE_WRITE_HEIGHT_FIELD = 1<<7, @@ -88,8 +88,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object FEATURE_WRITE_IMAGE | FEATURE_WRITE_HEIGHT_FIELD | FEATURE_WRITE_NODE | - FEATURE_WRITE_SHADER - }; + FEATURE_WRITE_SHADER + }; /** Return available features*/ virtual Features supportedFeatures() const; @@ -117,10 +117,10 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object ReadResult(ReadStatus status=FILE_NOT_HANDLED):_status(status) {} ReadResult(const std::string& m):_status(ERROR_IN_READING_FILE),_message(m) {} ReadResult(osg::Object* obj, ReadStatus status=FILE_LOADED):_status(status),_object(obj) {} - + ReadResult(const ReadResult& rr):_status(rr._status),_message(rr._message),_object(rr._object) {} ReadResult& operator = (const ReadResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message;_object=rr._object; return *this; } - + osg::Object* getObject(); osg::Image* getImage(); osg::HeightField* getHeightField(); @@ -154,7 +154,7 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object bool notEnoughMemory() const { return _status==INSUFFICIENT_MEMORY_TO_LOAD; } protected: - + ReadStatus _status; std::string _message; osg::ref_ptr _object; @@ -175,10 +175,10 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object WriteResult(WriteStatus status=FILE_NOT_HANDLED):_status(status) {} WriteResult(const std::string& m):_status(ERROR_IN_WRITING_FILE),_message(m) {} - + WriteResult(const WriteResult& rr):_status(rr._status),_message(rr._message) {} WriteResult& operator = (const WriteResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message; return *this; } - + std::string& message() { return _message; } const std::string& message() const { return _message; } @@ -188,7 +188,7 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object bool notHandled() const { return _status==FILE_NOT_HANDLED || _status==NOT_IMPLEMENTED; } protected: - + WriteStatus _status; std::string _message; }; diff --git a/include/osgDB/Registry b/include/osgDB/Registry index a38f5c644..a5feb89e0 100644 --- a/include/osgDB/Registry +++ b/include/osgDB/Registry @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -74,7 +74,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced - + static Registry* instance(bool erase = false); /** read the command line arguments.*/ @@ -126,10 +126,10 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** find the library in the OSG_LIBRARY_PATH and load it.*/ LoadStatus loadLibrary(const std::string& fileName); - + /** close the attached library with specified name.*/ bool closeLibrary(const std::string& fileName); - + /** close all libraries.*/ void closeAllLibraries(); @@ -141,13 +141,13 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** gets a reader/writer that handles the extension mapped to by one of * the registered mime-types. */ ReaderWriter* getReaderWriterForMimeType(const std::string& mimeType); - + /** get list of all registered ReaderWriters.*/ ReaderWriterList& getReaderWriterList() { return _rwList; } /** get const list of all registered ReaderWriters.*/ const ReaderWriterList& getReaderWriterList() const { return _rwList; } - + typedef std::vector< osg::ref_ptr > ImageProcessorList; @@ -202,7 +202,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Get the readFile callback.*/ ReadFileCallback* getReadFileCallback() { return _readFileCallback.get(); } - + /** Get the const readFile callback.*/ const ReadFileCallback* getReadFileCallback() const { return _readFileCallback.get(); } @@ -271,7 +271,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Get the writeFile callback.*/ WriteFileCallback* getWriteFileCallback() { return _writeFileCallback.get(); } - + /** Get the const writeFile callback.*/ const WriteFileCallback* getWriteFileCallback() const { return _writeFileCallback.get(); } @@ -307,7 +307,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced else return writeNodeImplementation(node,fileName,options); } ReaderWriter::WriteResult writeNodeImplementation(const osg::Node& node, const std::string& fileName,const Options* options); - + ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options) { if (options && options->getWriteFileCallback()) return options->getWriteFileCallback()->writeShader(obj,fileName,options); @@ -315,7 +315,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced else return writeShaderImplementation(obj,fileName,options); } ReaderWriter::WriteResult writeShaderImplementation(const osg::Shader& obj, const std::string& fileName,const Options* options); - + inline void _buildKdTreeIfRequired(ReaderWriter::ReadResult& result, const Options* options) { @@ -323,7 +323,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced options->getBuildKdTreesHint() == Options::BUILD_KDTREES : _buildKdTreesHint == Options::BUILD_KDTREES; - if (doKdTreeBuilder && _kdTreeBuilder.valid() && result.validNode()) + if (doKdTreeBuilder && _kdTreeBuilder.valid() && result.validNode()) { osg::ref_ptr builder = _kdTreeBuilder->clone(); result.getNode()->accept(*builder); @@ -373,18 +373,18 @@ class OSGDB_EXPORT Registry : public osg::Referenced void setCreateNodeFromImage(bool flag) { _createNodeFromImage = flag; } bool getCreateNodeFromImage() const { return _createNodeFromImage; } - + void setOptions(Options* opt) { _options = opt; } Options* getOptions() { return _options.get(); } const Options* getOptions() const { return _options.get(); } - /** initialize both the Data and Library FilePaths, by default called by the + /** initialize both the Data and Library FilePaths, by default called by the * constructor, so it should only be required if you want to force * the re-reading of environmental variables.*/ void initFilePathLists() { initDataFilePathList(); initLibraryFilePathList(); } - + /** initialize the Data FilePath by reading the OSG_FILE_PATH environmental variable.*/ void initDataFilePathList(); @@ -400,7 +400,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** get the const data file path which is used when search for data files.*/ const FilePathList& getDataFilePathList() const { return _dataFilePath; } - /** initialize the Library FilePath by reading the OSG_LIBRARY_PATH + /** initialize the Library FilePath by reading the OSG_LIBRARY_PATH * and the appropriate system environmental variables*/ void initLibraryFilePathList(); @@ -412,11 +412,11 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** get the library file path which is used when search for library (dso/dll's) files.*/ FilePathList& getLibraryFilePathList() { return _libraryFilePath; } - + /** get the const library file path which is used when search for library (dso/dll's) files.*/ const FilePathList& getLibraryFilePathList() const { return _libraryFilePath; } - /** For each object in the cache which has an reference count greater than 1 + /** For each object in the cache which has an reference count greater than 1 * (and therefore referenced by elsewhere in the application) set the time stamp * for that object in the cache to specified time. * This would typically be called once per frame by applications which are doing database paging, @@ -436,7 +436,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced double getExpiryDelay() const { return _expiryDelay; } - /** Remove all objects in the cache regardless of having external references or expiry times.*/ + /** Remove all objects in the cache regardless of having external references or expiry times.*/ void clearObjectCache(); /** Add a filename,object,timestamp triple to the Registry::ObjectCache.*/ @@ -447,27 +447,27 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Get an Object from the object cache*/ osg::Object* getFromObjectCache(const std::string& fileName); - + /** Get an ref_ptr from the object cache*/ osg::ref_ptr getRefFromObjectCache(const std::string& fileName); - + /** Add archive to archive cache so that future calls reference this archive.*/ void addToArchiveCache(const std::string& fileName, osgDB::Archive* archive); /** Remove Archive from cache.*/ void removeFromArchiveCache(const std::string& fileName); - + /** Get an Archive from the archive cache.*/ osgDB::Archive* getFromArchiveCache(const std::string& fileName); /** Get an ref_ptr from the archive cache.*/ osg::ref_ptr getRefFromArchiveCache(const std::string& fileName); - + /** Remove all archives from the archive cache.*/ void clearArchiveCache(); - + /** If State is non-zero, this function releases OpenGL objects for * the specified graphics context. Otherwise, releases OpenGL objexts * for all graphics contexts. */ @@ -481,16 +481,16 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Get the SharedStateManager, creating one if one is not already created.*/ SharedStateManager* getOrCreateSharedStateManager(); - + /** Get the SharedStateManager. Return 0 if no SharedStateManager has been assigned.*/ SharedStateManager* getSharedStateManager() { return _sharedStateManager.get(); } /** Add an Archive extension.*/ void addArchiveExtension(const std::string ext); - + /** registers a protocol */ void registerProtocol(const std::string& protocol); - + /** returns true, if named protocol is registered */ bool isProtocolRegistered(const std::string& protocol); @@ -509,11 +509,11 @@ class OSGDB_EXPORT Registry : public osg::Referenced typedef std::vector< osg::ref_ptr > DynamicLibraryList; typedef std::map< std::string, std::string> ExtensionAliasMap; - + typedef std::pair, double > ObjectTimeStampPair; typedef std::map ObjectCache; typedef std::map > ArchiveCache; - + typedef std::set RegisteredProtocolsSet; /** constructor is private, as its a singleton, preventing @@ -526,13 +526,13 @@ class OSGDB_EXPORT Registry : public osg::Referenced Options::BuildKdTreesHint _buildKdTreesHint; osg::ref_ptr _kdTreeBuilder; - + osg::ref_ptr _fileCache; - + osg::ref_ptr _authenticationMap; - + bool _createNodeFromImage; - + RegisteredProtocolsSet _registeredProtocols; public: @@ -555,9 +555,9 @@ class OSGDB_EXPORT Registry : public osg::Referenced }; protected: - + void destruct(); - + // forward declare helper classes struct ReadObjectFunctor; struct ReadImageFunctor; @@ -565,7 +565,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced struct ReadNodeFunctor; struct ReadArchiveFunctor; struct ReadShaderFunctor; - + // make helper classes friends to get round VS6.0 "issues" friend struct ReadFunctor; friend struct ReadObjectFunctor; @@ -600,7 +600,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced ArchiveCache _archiveCache; bool _openingLibrary; - + // map to alias to extensions to plugins. ExtensionAliasMap _extAliasMap; @@ -609,17 +609,17 @@ class OSGDB_EXPORT Registry : public osg::Referenced // Utility: Removes whitespace from both ends of a string. static std::string trim( const std::string& str ); - + // options to pass to reader writers. osg::ref_ptr _options; - + FilePathList _dataFilePath; FilePathList _libraryFilePath; double _expiryDelay; ObjectCache _objectCache; OpenThreads::Mutex _objectCacheMutex; - + ArchiveExtensionList _archiveExtList; @@ -656,9 +656,9 @@ class RegisterReaderWriterProxy Registry::instance()->removeReaderWriter(_rw.get()); } } - + T* get() { return _rw.get(); } - + protected: osg::ref_ptr _rw; }; diff --git a/include/osgDB/Serializer b/include/osgDB/Serializer index 67dd03e77..7b1b376f7 100644 --- a/include/osgDB/Serializer +++ b/include/osgDB/Serializer @@ -38,10 +38,10 @@ public: typedef int Value; typedef std::map StringToValue; typedef std::map ValueToString; - + IntLookup() {} unsigned int size() const { return _stringToValue.size(); } - + void add( const char* str, Value value ) { if ( _valueToString.find(value)!=_valueToString.end() ) @@ -53,7 +53,7 @@ public: _valueToString[value] = str; _stringToValue[str] = value; } - + Value getValue( const char* str ) { StringToValue::iterator itr = _stringToValue.find(str); @@ -67,7 +67,7 @@ public: } return itr->second; } - + const std::string& getString( Value value ) { ValueToString::iterator itr = _valueToString.find(value); @@ -81,7 +81,7 @@ public: } return itr->second; } - + protected: StringToValue _stringToValue; ValueToString _valueToString; @@ -92,7 +92,7 @@ class UserLookupTableProxy public: typedef void (*AddValueFunc)( IntLookup* lookup ); UserLookupTableProxy( AddValueFunc func ) { if ( func ) (*func)(&_lookup); } - + IntLookup _lookup; }; @@ -145,10 +145,10 @@ public: typedef bool (*Checker)( const C& ); typedef bool (*Reader)( InputStream&, C& ); typedef bool (*Writer)( OutputStream&, const C& ); - + UserSerializer( const char* name, Checker cf, Reader rf, Writer wf ) : BaseSerializer(), _name(name), _checker(cf), _reader(rf), _writer(wf) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -164,7 +164,7 @@ public: } return (*_reader)(is, object); } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -181,13 +181,13 @@ public: } return (*_writer)(os, object); } - + virtual const std::string& getName() const { return _name; } - + protected: std::string _name; Checker _checker; - + public: Reader _reader; Writer _writer; @@ -217,10 +217,10 @@ public: typedef TemplateSerializer

ParentType; typedef P (C::*Getter)() const; typedef void (C::*Setter)( P ); - + PropByValSerializer( const char* name, P def, Getter gf, Setter sf, bool useHex=false ) : ParentType(name, def), _getter(gf), _setter(sf), _useHex(useHex) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -240,7 +240,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -259,11 +259,11 @@ public: } return true; } - + public: Getter _getter; Setter _setter; - + protected: bool _useHex; }; @@ -276,10 +276,10 @@ public: typedef const P& CP; typedef CP (C::*Getter)() const; typedef void (C::*Setter)( CP ); - + PropByRefSerializer( const char* name, CP def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -297,7 +297,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -312,7 +312,7 @@ public: } return true; } - + public: Getter _getter; Setter _setter; @@ -325,10 +325,10 @@ public: typedef TemplateSerializer ParentType; typedef const osg::Matrix& (C::*Getter)() const; typedef void (C::*Setter)( const osg::Matrix& ); - + MatrixSerializer( const char* name, const osg::Matrix& def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -346,7 +346,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { @@ -362,7 +362,7 @@ public: } return true; } - + protected: void readMatrixImplementation( InputStream& is, osg::Matrix& matrix ) { @@ -381,7 +381,7 @@ protected: } #endif } - + public: Getter _getter; Setter _setter; @@ -394,10 +394,10 @@ public: typedef TemplateSerializer

ParentType; typedef P (C::*Getter)() const; typedef void (C::*Setter)( P ); - + GLenumSerializer( const char* name, P def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -414,7 +414,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -429,7 +429,7 @@ public: } return true; } - + public: Getter _getter; Setter _setter; @@ -442,10 +442,10 @@ public: typedef TemplateSerializer ParentType; typedef const std::string& (C::*Getter)() const; typedef void (C::*Setter)( const std::string& ); - + StringSerializer( const char* name, const std::string& def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -464,7 +464,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -481,7 +481,7 @@ public: } return true; } - + public: Getter _getter; Setter _setter; @@ -494,10 +494,10 @@ public: typedef TemplateSerializer ParentType; typedef const P* (C::*Getter)() const; typedef void (C::*Setter)( P* ); - + ObjectSerializer( const char* name, P* def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -526,7 +526,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -550,7 +550,7 @@ public: } return true; } - + public: Getter _getter; Setter _setter; @@ -563,10 +563,10 @@ public: typedef TemplateSerializer ParentType; typedef const P* (C::*Getter)() const; typedef void (C::*Setter)( P* ); - + ImageSerializer( const char* name, P* def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -595,7 +595,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -619,7 +619,7 @@ public: } return true; } - + public: Getter _getter; Setter _setter; @@ -632,19 +632,19 @@ public: typedef TemplateSerializer

ParentType; typedef P (C::*Getter)() const; typedef B (C::*Setter)( P ); - + EnumSerializer( const char* name, P def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} - + void add( const char* str, P value ) { _lookup.add(str, static_cast(value)); } - + P getValue( const char* str ) { return static_cast

(_lookup.getValue(str)); } - + const std::string& getString( P value ) { return _lookup.getString(static_cast(value)); } - + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); @@ -662,7 +662,7 @@ public: } return true; } - + virtual bool write( osgDB::OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -677,11 +677,11 @@ public: } return true; } - + public: Getter _getter; Setter _setter; - + protected: IntLookup _lookup; }; @@ -695,10 +695,10 @@ public: typedef typename P::const_iterator ConstIterator; typedef const P& (C::*Getter)() const; typedef void (C::*Setter)( const P& ); - + ListSerializer( const char* name, Getter gf, Setter sf ) : _name(name), _getter(gf), _setter(sf) {} - + virtual const std::string& getName() const { return _name; } virtual bool read( InputStream& is, osg::Object& obj ) @@ -735,7 +735,7 @@ public: } return true; } - + virtual bool write( OutputStream& os, const osg::Object& obj ) { const C& object = OBJECT_CAST(obj); @@ -763,7 +763,7 @@ public: } return true; } - + public: std::string _name; Getter _getter; @@ -809,7 +809,7 @@ public: #define ADD_UINT_SERIALIZER(PROP, DEF) \ wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned int >( \ #PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_UINT ) - + #define ADD_GLINT_SERIALIZER(PROP, DEF) \ wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, GLint >( \ #PROP, ((int)(DEF)), &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_INT ) diff --git a/include/osgDB/SharedStateManager b/include/osgDB/SharedStateManager index bfd113b11..dbae47010 100644 --- a/include/osgDB/SharedStateManager +++ b/include/osgDB/SharedStateManager @@ -1,19 +1,19 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGDB_SHAREDSTATEMANAGER #define OSGDB_SHAREDSTATEMANAGER 1 - + #include #include @@ -29,7 +29,7 @@ namespace osgDB { class OSGDB_EXPORT SharedStateManager : public osg::NodeVisitor { - public: + public: enum ShareMode { @@ -49,9 +49,9 @@ namespace osgDB { SharedStateManager(unsigned int mode = SHARE_ALL); META_NodeVisitor("osgDB","SharedStateManager") - + void setShareMode(unsigned int mode); - + unsigned int getShareMode() { return _shareMode; } // Call right after each unload and before Registry cache prune. @@ -108,7 +108,7 @@ namespace osgDB { return lhs->compare(*rhs, true) < 0; } }; - + // Lists of shared objects typedef std::set< osg::ref_ptr, CompareStateAttributes > TextureSet; TextureSet _sharedTextureList; @@ -129,7 +129,7 @@ namespace osgDB { bool _shareTexture[3]; bool _shareStateSet[3]; - // Share connection mutex + // Share connection mutex OpenThreads::Mutex *_mutex; // Mutex for doing isShared queries from other threads diff --git a/include/osgDB/StreamOperator b/include/osgDB/StreamOperator index 3169d5f25..406df4c50 100644 --- a/include/osgDB/StreamOperator +++ b/include/osgDB/StreamOperator @@ -18,13 +18,13 @@ class OSGDB_EXPORT OutputIterator : public osg::Referenced public: OutputIterator() : _out(0) {} virtual ~OutputIterator() {} - + void setStream( std::ostream* ostream ) { _out = ostream; } std::ostream* getStream() { return _out; } const std::ostream* getStream() const { return _out; } virtual bool isBinary() const = 0; - + virtual void writeBool( bool b ) = 0; virtual void writeChar( char c ) = 0; virtual void writeUChar( unsigned char c ) = 0; @@ -39,15 +39,15 @@ public: virtual void writeString( const std::string& s ) = 0; virtual void writeStream( std::ostream& (*fn)(std::ostream&) ) = 0; virtual void writeBase( std::ios_base& (*fn)(std::ios_base&) ) = 0; - + virtual void writeGLenum( const ObjectGLenum& value ) = 0; virtual void writeProperty( const ObjectProperty& prop ) = 0; virtual void writeMark( const ObjectMark& mark ) = 0; virtual void writeCharArray( const char* s, unsigned int size ) = 0; virtual void writeWrappedString( const std::string& str ) = 0; - + virtual void flush() { _out->flush(); } - + protected: // Return true if the manipulator is std::endl bool isEndl( std::ostream& (*fn)(std::ostream&) ) @@ -71,7 +71,7 @@ class OSGDB_EXPORT InputIterator : public osg::Referenced public: InputIterator() : _in(0), _inputStream(0), _byteSwap(0), _failed(false) {} virtual ~InputIterator() {} - + void setStream( std::istream* istream ) { _in = istream; } std::istream* getStream() { return _in; } const std::istream* getStream() const { return _in; } @@ -85,9 +85,9 @@ public: void checkStream() const { if (_in->rdstate()&_in->failbit) _failed = true; } bool isFailed() const { return _failed; } - + virtual bool isBinary() const = 0; - + virtual void readBool( bool& b ) = 0; virtual void readChar( char& c ) = 0; virtual void readSChar( signed char& c ) = 0; @@ -103,13 +103,13 @@ public: virtual void readString( std::string& s ) = 0; virtual void readStream( std::istream& (*fn)(std::istream&) ) = 0; virtual void readBase( std::ios_base& (*fn)(std::ios_base&) ) = 0; - + virtual void readGLenum( ObjectGLenum& value ) = 0; virtual void readProperty( ObjectProperty& prop ) = 0; virtual void readMark( ObjectMark& mark ) = 0; virtual void readCharArray( char* s, unsigned int size ) = 0; virtual void readWrappedString( std::string& str ) = 0; - + virtual bool matchString( const std::string& /*str*/ ) { return false; } virtual void advanceToCurrentEndBracket() {} diff --git a/include/osgDB/Version b/include/osgDB/Version index e6c6bf907..089c97c9d 100644 --- a/include/osgDB/Version +++ b/include/osgDB/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgDB/WriteFile b/include/osgDB/WriteFile index 2567edb4d..d6ad7b81d 100644 --- a/include/osgDB/WriteFile +++ b/include/osgDB/WriteFile @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ namespace osgDB { -/** Write an osg::Object to file. +/** Write an osg::Object to file. * Return true on success, * return false on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -34,7 +34,7 @@ namespace osgDB { * to write the specified file.*/ extern OSGDB_EXPORT bool writeObjectFile(const osg::Object& object, const std::string& filename, const Options* options ); -/** Write an osg::Object to file. +/** Write an osg::Object to file. * Return true on success, * return false on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -45,7 +45,7 @@ inline bool writeObjectFile(const osg::Object& object, const std::string& filena return writeObjectFile( object, filename, Registry::instance()->getOptions() ); } -/** Write an osg::Image to file. +/** Write an osg::Image to file. * Return true on success, * return false on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -54,7 +54,7 @@ inline bool writeObjectFile(const osg::Object& object, const std::string& filena * to write the specified file.*/ extern OSGDB_EXPORT bool writeImageFile(const osg::Image& image, const std::string& filename, const Options* options ); -/** Write an osg::Image to file. +/** Write an osg::Image to file. * Return true on success, * return false on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -65,7 +65,7 @@ inline bool writeImageFile(const osg::Image& image, const std::string& filename) return writeImageFile( image, filename, Registry::instance()->getOptions() ); } -/** Write an osg::HeightField to file. +/** Write an osg::HeightField to file. * Return true on success, * return false on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -74,7 +74,7 @@ inline bool writeImageFile(const osg::Image& image, const std::string& filename) * to write the specified file.*/ extern OSGDB_EXPORT bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename, const Options* options ); -/** Write an osg::HeightField to file. +/** Write an osg::HeightField to file. * Return true on success, * return false on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -85,7 +85,7 @@ inline bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& return writeHeightFieldFile( hf, filename, Registry::instance()->getOptions() ); } -/** Write an osg::Node to file. +/** Write an osg::Node to file. * Return true on success, * return false on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -94,7 +94,7 @@ inline bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& * to write the specified file.*/ extern OSGDB_EXPORT bool writeNodeFile(const osg::Node& node, const std::string& filename, const Options* options ); -/** Write an osg::Node to file. +/** Write an osg::Node to file. * Return true on success, * return false on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin @@ -105,7 +105,7 @@ inline bool writeNodeFile(const osg::Node& node, const std::string& filename) return writeNodeFile( node, filename, Registry::instance()->getOptions() ); } -/** Write an osg::Shader to file. +/** Write an osg::Shader to file. * Return true on success, * return false on failure. * Use the Options object to control cache operations and file search paths in osgDB::Registry. @@ -114,7 +114,7 @@ inline bool writeNodeFile(const osg::Node& node, const std::string& filename) * to write the specified file.*/ extern OSGDB_EXPORT bool writeShaderFile(const osg::Shader& shader, const std::string& filename, const Options* options ); -/** Write an osg::Shader to file. +/** Write an osg::Shader to file. * Return true on success, * return false on failure. * The osgDB::Registry is used to load the appropriate ReaderWriter plugin diff --git a/include/osgDB/XmlParser b/include/osgDB/XmlParser index 23bd68a46..e95f0e263 100644 --- a/include/osgDB/XmlParser +++ b/include/osgDB/XmlParser @@ -148,7 +148,7 @@ class OSGDB_EXPORT XmlNode : public osg::Referenced bool writeChildren(const ControlMap& controlMap, std::ostream& fout, const std::string& indent) const; bool writeProperties(const ControlMap& controlMap, std::ostream& fout) const; - + bool readAndReplaceControl(std::string& contents, Input& input); }; diff --git a/include/osgDB/fstream b/include/osgDB/fstream index 3f6b803af..b15a2ecfc 100644 --- a/include/osgDB/fstream +++ b/include/osgDB/fstream @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgFX/AnisotropicLighting b/include/osgFX/AnisotropicLighting index 50bde13aa..caff00230 100644 --- a/include/osgFX/AnisotropicLighting +++ b/include/osgFX/AnisotropicLighting @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -25,16 +25,16 @@ namespace osgFX { /** - This single-pass effect implements a sort of anisotropic + This single-pass effect implements a sort of anisotropic lighting that replaces the standard OpenGL lighting model. - The final color of vertices is not computed directly, it is - the result of a texture lookup on a user-supplied lighting - image map. A vertex program is used to compute the s and t - texture coordinates as follows: s = (N dot H) ; t = (N dot L) - where N is the vertex normal, L is the light-to-vertex vector, - H is the half-way vector. This is a good example of how you - can use the State::getInitialViewMatrix() method to retrieve - the view matrix and perform view-dependant effects without + The final color of vertices is not computed directly, it is + the result of a texture lookup on a user-supplied lighting + image map. A vertex program is used to compute the s and t + texture coordinates as follows: s = (N dot H) ; t = (N dot L) + where N is the vertex normal, L is the light-to-vertex vector, + H is the half-way vector. This is a good example of how you + can use the State::getInitialViewMatrix() method to retrieve + the view matrix and perform view-dependant effects without fakes of any kind. This effect requires the ARB_vertex_program extension. */ @@ -43,10 +43,10 @@ namespace osgFX AnisotropicLighting(); AnisotropicLighting(const AnisotropicLighting& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - META_Effect(osgFX, AnisotropicLighting, - - "Anisotropic Lighting", - + META_Effect(osgFX, AnisotropicLighting, + + "Anisotropic Lighting", + "This single-pass effect implements a sort of anisotropic " "lighting that replaces the standard OpenGL lighting model.\n" "The final color of vertices is not computed directly, it is " @@ -58,23 +58,23 @@ namespace osgFX "can use the State::getInitialViewMatrix() method to retrieve " "the view matrix and perform view-dependant effects without " "fakes of any kind.\n" - "This effect requires the ARB_vertex_program extension.", - + "This effect requires the ARB_vertex_program extension.", + "Marco Jez"); - - + + /** get the lighting map */ inline osg::Image* getLightingMap(); - + /** get the const lighting map */ inline const osg::Image* getLightingMap() const; - + /** set the lighting map */ inline void setLightingMap(osg::Image* image); /** get the OpenGL light number */ inline int getLightNumber() const; - + /** set the OpenGL light number that will be used in lighting computations */ inline void setLightNumber(int n); @@ -90,27 +90,27 @@ namespace osgFX }; // INLINE METHODS - + inline osg::Image* AnisotropicLighting::getLightingMap() { return _texture->getImage(); } - + inline const osg::Image* AnisotropicLighting::getLightingMap() const { return _texture->getImage(); } - + inline void AnisotropicLighting::setLightingMap(osg::Image* image) { _texture->setImage(image); } - + inline int AnisotropicLighting::getLightNumber() const { return _lightnum; } - + inline void AnisotropicLighting::setLightNumber(int n) { _lightnum = n; diff --git a/include/osgFX/BumpMapping b/include/osgFX/BumpMapping index b4429a881..c7819bacb 100644 --- a/include/osgFX/BumpMapping +++ b/include/osgFX/BumpMapping @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -25,16 +25,16 @@ namespace osgFX { /** - This effect makes surfaces appear bumpy. Children nodes must use two textures, - one for diffuse color and one for the normal map (which can be created - from a height map with tools like nVIDIA's normal map generator). Furthermore, - tangent-space basis vectors must be created and assigned to each Geometry; this - can be done quickly by calling BumpMapping::prepareChildren(). Note that both - diffuse and normal map textures must have corresponding UV maps defined in + This effect makes surfaces appear bumpy. Children nodes must use two textures, + one for diffuse color and one for the normal map (which can be created + from a height map with tools like nVIDIA's normal map generator). Furthermore, + tangent-space basis vectors must be created and assigned to each Geometry; this + can be done quickly by calling BumpMapping::prepareChildren(). Note that both + diffuse and normal map textures must have corresponding UV maps defined in Geometry objects. - This effect defines a preferred technique which uses ARB vertex & fragment - programs, and a fallback technique which doesn't use fragment programs. The - latter is more limited though since it can't handle ambient and specular + This effect defines a preferred technique which uses ARB vertex & fragment + programs, and a fallback technique which doesn't use fragment programs. The + latter is more limited though since it can't handle ambient and specular components. */ class OSGFX_EXPORT BumpMapping: public Effect { @@ -42,10 +42,10 @@ namespace osgFX BumpMapping(); BumpMapping(const BumpMapping& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - META_Effect(osgFX, BumpMapping, - - "Bump Mapping", - + META_Effect(osgFX, BumpMapping, + + "Bump Mapping", + "This effect makes surfaces appear bumpy. Children nodes must use two textures, " "one for diffuse color and one for the normal map (which can be created " "from a height map with tools like nVIDIA's normal map generator). Furthermore, " @@ -57,58 +57,58 @@ namespace osgFX "programs, and a fallback technique which doesn't use fragment programs. The " "latter is more limited though since it can't handle ambient and specular " "components.", - + "Marco Jez"); - - + + /** get the OpenGL light number */ inline int getLightNumber() const; - + /** set the OpenGL light number that will be used in lighting computations */ inline void setLightNumber(int n); - + /** get the texture unit that contains diffuse color texture. Default is 1 */ inline int getDiffuseTextureUnit() const; - + /** set the texture unit that contains diffuse color texture. Default is 1 */ inline void setDiffuseTextureUnit(int n); /** get the texture unit that contains normal map texture. Default is 0 */ inline int getNormalMapTextureUnit() const; - + /** set the texture unit that contains normal map texture. Default is 0 */ inline void setNormalMapTextureUnit(int n); - + /** get the diffuse color texture that overrides children's texture */ inline osg::Texture2D* getOverrideDiffuseTexture(); - + /** get the const diffuse color texture that overrides children's texture */ inline const osg::Texture2D* getOverrideDiffuseTexture() const; - + /** set the diffuse color texture that overrides children's texture */ inline void setOverrideDiffuseTexture(osg::Texture2D* texture); - + /** get the normal map texture that overrides children's texture */ inline osg::Texture2D* getOverrideNormalMapTexture(); - + /** get the const normal map texture that overrides children's texture */ inline const osg::Texture2D* getOverrideNormalMapTexture() const; /** set the normal map texture that overrides children's texture */ inline void setOverrideNormalMapTexture(osg::Texture2D* texture); - + /** prepare a Geometry for bump lighting. Tangent-space basis vectors are generated and attached to the geometry as vertex attribute arrays. */ void prepareGeometry(osg::Geometry* geo); - + /** prepare a Node for bump lighting, calling prepareGeometry() for each Geometry */ void prepareNode(osg::Node* node); - + /** prepare children for bump lighting. Actually calls prepareNode() for each child */ void prepareChildren(); - + /** set up a demo environment with predefined diffuse and normal maps, as well as texture coordinates */ void setUpDemo(); @@ -126,41 +126,41 @@ namespace osgFX osg::ref_ptr _normal_tex; }; - // INLINE METHODS - + // INLINE METHODS + inline int BumpMapping::getLightNumber() const { return _lightnum; } - + inline void BumpMapping::setLightNumber(int n) { _lightnum = n; dirtyTechniques(); } - + inline int BumpMapping::getDiffuseTextureUnit() const { return _diffuse_unit; } - + inline void BumpMapping::setDiffuseTextureUnit(int n) { _diffuse_unit = n; dirtyTechniques(); } - + inline int BumpMapping::getNormalMapTextureUnit() const { return _normal_unit; } - + inline void BumpMapping::setNormalMapTextureUnit(int n) { _normal_unit = n; dirtyTechniques(); } - + inline osg::Texture2D* BumpMapping::getOverrideDiffuseTexture() { return _diffuse_tex.get(); @@ -170,7 +170,7 @@ namespace osgFX { return _diffuse_tex.get(); } - + inline void BumpMapping::setOverrideDiffuseTexture(osg::Texture2D* texture) { _diffuse_tex = texture; @@ -186,7 +186,7 @@ namespace osgFX { return _normal_tex.get(); } - + inline void BumpMapping::setOverrideNormalMapTexture(osg::Texture2D* texture) { _normal_tex = texture; diff --git a/include/osgFX/Cartoon b/include/osgFX/Cartoon index 8d5a86ede..361a22ec0 100644 --- a/include/osgFX/Cartoon +++ b/include/osgFX/Cartoon @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -25,10 +25,10 @@ namespace osgFX { /** - This effect implements a technique called 'Cel-Shading' to produce a - cartoon-style (non photorealistic) rendering. Two passes are required: - the first one draws solid surfaces, the second one draws the outlines. - A vertex program is used to setup texture coordinates for a sharp lighting + This effect implements a technique called 'Cel-Shading' to produce a + cartoon-style (non photorealistic) rendering. Two passes are required: + the first one draws solid surfaces, the second one draws the outlines. + A vertex program is used to setup texture coordinates for a sharp lighting texture on unit 0 which is generated on-the-fly. This effect requires the ARB_vertex_program extension. */ @@ -39,11 +39,11 @@ namespace osgFX // effect class informations META_Effect( - osgFX, - Cartoon, - - "Cartoon", - + osgFX, + Cartoon, + + "Cartoon", + "This effect implements a technique called 'Cel-Shading' to produce a " "cartoon-style (non photorealistic) rendering. Two passes are required: " "the first one draws solid surfaces, the second one draws the outlines. " @@ -51,24 +51,24 @@ namespace osgFX "texture on unit 0 which is generated on-the-fly.\n" "This effect requires the ARB_vertex_program extension " "or OpenGL Shading Language.", - + "Marco Jez; OGLSL port by Mike Weiblen"); /** get the outline color */ inline const osg::Vec4& getOutlineColor() const; - + /** set the outline color */ inline void setOutlineColor(const osg::Vec4& color); - + /** get the outline line width */ inline float getOutlineLineWidth() const; - + /** set the outline line width */ inline void setOutlineLineWidth(float w); - + /** get the OpenGL light number */ inline int getLightNumber() const; - + /** set the OpenGL light number that will be used in lighting computations */ inline void setLightNumber(int n); @@ -95,22 +95,22 @@ namespace osgFX { _wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color); } - + inline float Cartoon::getOutlineLineWidth() const { return _wf_lw->getWidth(); } - + inline void Cartoon::setOutlineLineWidth(float w) { _wf_lw->setWidth(w); } - + inline int Cartoon::getLightNumber() const { return _lightnum; } - + inline void Cartoon::setLightNumber(int n) { _lightnum = n; diff --git a/include/osgFX/Effect b/include/osgFX/Effect index 092f8d9b7..205e2e852 100644 --- a/include/osgFX/Effect +++ b/include/osgFX/Effect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -50,10 +50,10 @@ namespace osgFX defined. Each technique tries to implement the effect in a different way, often using different OpenGL extensions. The active technique can be selected either manually, with selectTechnique(), or automatically, in which - case the first technique that is supported by all active rendering contexts + case the first technique that is supported by all active rendering contexts is chosen. - If you are an Effect user, then simply use it as a node group. Create an - instance of your desired effect, add it to your scene graph and call its + If you are an Effect user, then simply use it as a node group. Create an + instance of your desired effect, add it to your scene graph and call its addChild() method to add a child node as you would do with a Group. If you are an Effect developer, you will have to implement the method define_techniques() to define the different techniques that can be used @@ -74,7 +74,7 @@ namespace osgFX /** get the name of this Effect */ virtual const char *effectName() const = 0; - + /** get a brief description of this Effect*/ virtual const char *effectDescription() const = 0; @@ -86,7 +86,7 @@ namespace osgFX /** set whether the effect is enabled or not */ inline void setEnabled(bool v); - + /** optional: set effect parameters to produce a visually significant result to be used in demo applications like osgfxbrowser. Default @@ -96,7 +96,7 @@ namespace osgFX /** get the number of techniques defined for this Effect */ inline int getNumTechniques() const; - + /** get the i-th Technique */ inline Technique* getTechnique(int i); @@ -114,7 +114,7 @@ namespace osgFX inline void selectTechnique(int i = AUTO_DETECT); /** custom traversal */ - virtual void traverse(osg::NodeVisitor& nv); + virtual void traverse(osg::NodeVisitor& nv); /** default traversal */ inline void inherited_traverse(osg::NodeVisitor& nv); @@ -122,7 +122,7 @@ namespace osgFX protected: virtual ~Effect(); Effect &operator=(const Effect &) { return *this; } - + /** force rebuilding of techniques on next traversal */ inline void dirtyTechniques(); @@ -136,7 +136,7 @@ namespace osgFX this method. */ virtual bool define_techniques() = 0; - + private: friend class Validator; @@ -149,13 +149,13 @@ namespace osgFX // use int instead of bool to avoid errors mutable osg::buffered_value _tech_selected; - + int _global_sel_tech; bool _techs_defined; osg::ref_ptr _dummy_for_validation; - + void build_dummy_node(); }; @@ -170,7 +170,7 @@ namespace osgFX { _enabled = v; } - + inline int Effect::getNumTechniques() const { return static_cast(_techs.size()); @@ -200,12 +200,12 @@ namespace osgFX { _techs.push_back(tech); } - + inline void Effect::dirtyTechniques() { _techs_defined = false; } - + inline void Effect::inherited_traverse(osg::NodeVisitor& nv) { typedef osg::Group inherited; diff --git a/include/osgFX/Export b/include/osgFX/Export index 36c66d803..0268895c3 100644 --- a/include/osgFX/Export +++ b/include/osgFX/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -31,10 +31,10 @@ \namespace osgFX -The osgFX library is a NodeKit that extends the core scene graph to provide a special effects framework. +The osgFX library is a NodeKit that extends the core scene graph to provide a special effects framework. osgFX's framework allows multiple rendering techniques to be provide for each effect, thereby provide the use appropriate rendering techniques for each different class of graphics hardware, i.e. support for both modern -programmable graphics hardware and still have standard OpenGL 1.1 support as a fallback. +programmable graphics hardware and still have standard OpenGL 1.1 support as a fallback. */ #endif diff --git a/include/osgFX/MultiTextureControl b/include/osgFX/MultiTextureControl index 57c9b6031..659b1ddf9 100644 --- a/include/osgFX/MultiTextureControl +++ b/include/osgFX/MultiTextureControl @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,19 +31,19 @@ namespace osgFX MultiTextureControl(const MultiTextureControl& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Node(osgFX, MultiTextureControl); - + void setTextureWeight(unsigned int unit, float weight); float getTextureWeight(unsigned int unit) const { return (unit<_textureWeightList.size()) ? _textureWeightList[unit] : 0.0f; } - + unsigned int getNumTextureWeights() const { return _textureWeightList.size(); } - + protected: virtual ~MultiTextureControl() {} MultiTextureControl& operator = (const MultiTextureControl&) { return *this; } - + void updateStateSet(); - + typedef std::vector TextureWeightList; TextureWeightList _textureWeightList; }; diff --git a/include/osgFX/Registry b/include/osgFX/Registry index 9c57a5f06..cb532d9da 100644 --- a/include/osgFX/Registry +++ b/include/osgFX/Registry @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -57,7 +57,7 @@ namespace osgFX // INLINE METHODS - + inline const Registry::EffectMap& Registry::getEffectMap() const { diff --git a/include/osgFX/Scribe b/include/osgFX/Scribe index e38179c73..3b28285bc 100644 --- a/include/osgFX/Scribe +++ b/include/osgFX/Scribe @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -25,10 +25,10 @@ namespace osgFX { /** - This is a two-passes effect; the first pass renders the subgraph as usual - while the second pass switches to wireframe mode, sets up lighting and + This is a two-passes effect; the first pass renders the subgraph as usual + while the second pass switches to wireframe mode, sets up lighting and material to obtain a fixed (user-defined) color and then renders the subgraph. - This effect uses the PolygonOffset attribute to avoid Z-fighting, so it + This effect uses the PolygonOffset attribute to avoid Z-fighting, so it requires at least OpenGL version 1.1. */ class OSGFX_EXPORT Scribe: public Effect { @@ -38,28 +38,28 @@ namespace osgFX // effect class informations META_Effect( - osgFX, - Scribe, - - "Scribe", - + osgFX, + Scribe, + + "Scribe", + "This is a two-passes effect; the first pass renders the subgraph as usual " "while the second pass switches to wireframe mode, sets up lighting and " "material to obtain a fixed (user-defined) color and then renders the subgraph.\n" "This effect uses the PolygonOffset attribute to avoid Z-fighting, so it " "requires at least OpenGL version 1.1.", - + "Marco Jez"); /** get the wireframe color */ inline const osg::Vec4& getWireframeColor() const; - + /** set the wireframe color */ inline void setWireframeColor(const osg::Vec4& color); - + /** get the wireframe line width */ inline float getWireframeLineWidth() const; - + /** set the wireframe line width */ inline void setWireframeLineWidth(float w); @@ -85,12 +85,12 @@ namespace osgFX { _wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color); } - + inline float Scribe::getWireframeLineWidth() const { return _wf_lw->getWidth(); } - + inline void Scribe::setWireframeLineWidth(float w) { _wf_lw->setWidth(w); diff --git a/include/osgFX/SpecularHighlights b/include/osgFX/SpecularHighlights index 9dc7cdaa2..5fa820f1d 100644 --- a/include/osgFX/SpecularHighlights +++ b/include/osgFX/SpecularHighlights @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -22,12 +22,12 @@ namespace osgFX { /** - This effect applies additive specular highlights at fragment level (instead - of OpenGL's vertex-level lighting) by using a cube map and reflective texgen. - A texture matrix is computed to rotate the cube map automatically; this makes - the specular effect consistent with respect to view direction and light position. + This effect applies additive specular highlights at fragment level (instead + of OpenGL's vertex-level lighting) by using a cube map and reflective texgen. + A texture matrix is computed to rotate the cube map automatically; this makes + the specular effect consistent with respect to view direction and light position. The user can choose which light should be used to compute the texture matrix. - This effect requires the GL_ARB_texture_env_add extension and one of the cube map + This effect requires the GL_ARB_texture_env_add extension and one of the cube map extensions (GL_EXT_texture_cube_map, GL_ARB_texture_cube_map or OpenGL v1.3). */ class OSGFX_EXPORT SpecularHighlights: public Effect { @@ -35,42 +35,42 @@ namespace osgFX SpecularHighlights(); SpecularHighlights(const SpecularHighlights& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - META_Effect(osgFX, SpecularHighlights, - - "Specular Highlights", - + META_Effect(osgFX, SpecularHighlights, + + "Specular Highlights", + "This effect applies additive specular highlights at fragment level (instead " "of OpenGL's vertex-level lighting) by using a cube map and reflective texgen. " "A texture matrix is computed to rotate the cube map automatically; this makes " "the specular effect consistent with respect to view direction and light position. " "The user can choose which light should be used to compute the texture matrix.\n" "This effect requires the GL_ARB_texture_env_add extension and one of the cube map " - "extensions (GL_EXT_texture_cube_map, GL_ARB_texture_cube_map or OpenGL v1.3).", - + "extensions (GL_EXT_texture_cube_map, GL_ARB_texture_cube_map or OpenGL v1.3).", + "Marco Jez"); - - + + /** get the OpenGL light number */ inline int getLightNumber() const; - + /** set the OpenGL light number that will be used in lighting computations */ inline void setLightNumber(int n); - + /** get the texture unit number */ inline int getTextureUnit() const; - + /** set the texture unit that will be used to apply the cube map */ inline void setTextureUnit(int n); - + /** get the specular color */ inline const osg::Vec4& getSpecularColor() const; - + /** set the specular color */ inline void setSpecularColor(const osg::Vec4& color); - + /** get the specular exponent */ inline float getSpecularExponent() const; - + /** set the specular exponent */ inline void setSpecularExponent(float e); @@ -88,23 +88,23 @@ namespace osgFX }; // INLINE METHODS - + inline int SpecularHighlights::getLightNumber() const { return _lightnum; } - + inline void SpecularHighlights::setLightNumber(int n) { _lightnum = n; dirtyTechniques(); } - + inline int SpecularHighlights::getTextureUnit() const { return _unit; } - + inline void SpecularHighlights::setTextureUnit(int n) { _unit = n; @@ -115,7 +115,7 @@ namespace osgFX { return _color; } - + inline void SpecularHighlights::setSpecularColor(const osg::Vec4& color) { _color = color; @@ -126,7 +126,7 @@ namespace osgFX { return _sexp; } - + inline void SpecularHighlights::setSpecularExponent(float e) { _sexp = e; diff --git a/include/osgFX/Technique b/include/osgFX/Technique index 899e4d623..dac5fdbeb 100644 --- a/include/osgFX/Technique +++ b/include/osgFX/Technique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -26,7 +26,7 @@ #include /** - An helper macro that defines the methods techniqueName() and + An helper macro that defines the methods techniqueName() and techniqueDescription() making them return the strings passed as parameters. */ #define META_Technique(name, description) \ @@ -87,14 +87,14 @@ namespace osgFX /** get the const StateSet object associated to the i-th pass */ inline const osg::StateSet* getPassStateSet(int i) const; - /** + /** traverse children with multipass if necessary. By default this method simply calls the protected method traverse_implementation(); you can override it to change the default behavior. Don't call this method directly as it is called by osgFX::Effect */ inline virtual void traverse(osg::NodeVisitor& nv, Effect* fx); - + protected: Technique(const Technique &): osg::Referenced() {} // copying is nonsense ;) virtual ~Technique() {} @@ -105,7 +105,7 @@ namespace osgFX /** create a new pass node, add it to the technique and associate a StateSet */ void addPass(osg::StateSet* ss = 0); - + /** optional: return a node that overrides the child node on a specified pass */ inline virtual osg::Node* getOverrideChild(int) { return 0; } @@ -114,7 +114,7 @@ namespace osgFX implement this method in derived classes to add the required passes. */ virtual void define_passes() = 0; - + /** traverse children with multipass if necessary. Don't call this method directly unless you are in a customized version of traverse(). @@ -142,12 +142,12 @@ namespace osgFX { return _passes[i].get(); } - + inline void Technique::dirtyPasses() { _passes.clear(); } - + inline void Technique::traverse(osg::NodeVisitor& nv, Effect* fx) { traverse_implementation(nv, fx); diff --git a/include/osgFX/Validator b/include/osgFX/Validator index 1b38e0ee3..245042986 100644 --- a/include/osgFX/Validator +++ b/include/osgFX/Validator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgFX - Copyright (C) 2003 Marco Jez @@ -34,7 +34,7 @@ namespace osgFX */ class OSGFX_EXPORT Validator: public osg::StateAttribute { public: - + Validator(); Validator(Effect* effect); Validator(const Validator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); @@ -45,7 +45,7 @@ namespace osgFX void compileGLObjects(osg::State& state) const; inline int compare(const osg::StateAttribute& sa) const; - + inline void disable() { _effect = 0; } protected: @@ -63,7 +63,7 @@ namespace osgFX // check the types are equal and then create the rhs variable //used by the COMPARE_StateAttribute_Parameter macros below. COMPARE_StateAttribute_Types(Validator,sa) - + // compare parameters COMPARE_StateAttribute_Parameter(_effect) diff --git a/include/osgFX/Version b/include/osgFX/Version index 3437cfcfb..0cf66b2aa 100644 --- a/include/osgFX/Version +++ b/include/osgFX/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgGA/AnimationPathManipulator b/include/osgGA/AnimationPathManipulator index c01d0cfd0..4e4efabbd 100644 --- a/include/osgGA/AnimationPathManipulator +++ b/include/osgGA/AnimationPathManipulator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,16 +34,16 @@ namespace osgGA{ class OSGGA_EXPORT AnimationPathManipulator : public CameraManipulator { public: - + AnimationPathManipulator( osg::AnimationPath* animationPath=0 ); AnimationPathManipulator( const std::string& filename ); - + virtual const char* className() const { return "AnimationPath"; } void setTimeScale(double s) { _timeScale = s; } double getTimeScale() const { return _timeScale; } - + void setTimeOffset(double o) { _timeOffset = o; } double getTimeOffset() const { return _timeOffset; } @@ -58,7 +58,7 @@ class OSGGA_EXPORT AnimationPathManipulator : public CameraManipulator void setPrintOutTimingInfo(bool printOutTimingInfo) { _printOutTimingInfo=printOutTimingInfo; } bool getPrintOutTimingInfo() const { return _printOutTimingInfo; } - + /** set the position of the matrix manipulator using a 4x4 Matrix.*/ virtual void setByMatrix(const osg::Matrixd& matrix) { _matrix = matrix; } @@ -69,13 +69,13 @@ class OSGGA_EXPORT AnimationPathManipulator : public CameraManipulator virtual osg::Matrixd getMatrix() const { return _matrix; } /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/ - virtual osg::Matrixd getInverseMatrix() const { return osg::Matrixd::inverse(_matrix); } + virtual osg::Matrixd getInverseMatrix() const { return osg::Matrixd::inverse(_matrix); } void setAnimationPath( osg::AnimationPath* animationPath ) { _animationPath=animationPath; } - + osg::AnimationPath* getAnimationPath() { return _animationPath.get(); } - + const osg::AnimationPath* getAnimationPath() const { return _animationPath.get(); } bool valid() const { return _animationPath.valid(); } @@ -89,17 +89,17 @@ class OSGGA_EXPORT AnimationPathManipulator : public CameraManipulator /** Get the keyboard and mouse usage of this manipulator.*/ virtual void getUsage(osg::ApplicationUsage& usage) const; - + protected: bool _valid; - + bool _printOutTimingInfo; void handleFrame( double time ); osg::ref_ptr _animationPath; - + double _timeOffset; double _timeScale; @@ -107,11 +107,11 @@ class OSGGA_EXPORT AnimationPathManipulator : public CameraManipulator double _pauseTime; bool _isPaused; - + double _realStartOfTimedPeriod; double _animStartOfTimedPeriod; int _numOfFramesSinceStartOfTimedPeriod; - + osg::Matrixd _matrix; }; diff --git a/include/osgGA/CameraViewSwitchManipulator b/include/osgGA/CameraViewSwitchManipulator index 52f97cc75..fd6fca7dc 100644 --- a/include/osgGA/CameraViewSwitchManipulator +++ b/include/osgGA/CameraViewSwitchManipulator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ class OSGGA_EXPORT CameraViewSwitchManipulator : public CameraManipulator virtual osg::Matrixd getInverseMatrix() const; - /** Attach a node to the manipulator. + /** Attach a node to the manipulator. Automatically detaches previously attached node. setNode(NULL) detaches previously nodes. Is ignored by manipulators which do not require a reference model.*/ @@ -51,7 +51,7 @@ class OSGGA_EXPORT CameraViewSwitchManipulator : public CameraManipulator /** Return node if attached.*/ virtual osg::Node* getNode() { return _node.get();} - + /** Start/restart the manipulator.*/ virtual void init(const GUIEventAdapter& /*ea*/,GUIActionAdapter& /*aa*/) { _currentView = 0; } diff --git a/include/osgGA/EventQueue b/include/osgGA/EventQueue index 5108a5a25..0a9c2f977 100644 --- a/include/osgGA/EventQueue +++ b/include/osgGA/EventQueue @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ namespace osgGA { /** - * EventQueue implementation for collecting and adapting windowing events + * EventQueue implementation for collecting and adapting windowing events */ class OSGGA_EXPORT EventQueue : public osg::Referenced { @@ -34,7 +34,7 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced EventQueue(GUIEventAdapter::MouseYOrientation mouseYOrientation=GUIEventAdapter::Y_INCREASING_DOWNWARDS); typedef std::list< osg::ref_ptr > Events; - + /** Set events.*/ void setEvents(Events& events); @@ -79,21 +79,21 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced /** Method for adapting mouse scroll wheel events, placing this event on the back of the event queue. */ void mouseScroll(GUIEventAdapter::ScrollingMotion sm) { mouseScroll(sm,getTime()); } - + /** Method for adapting mouse scroll wheel events, placing this event on the back of the event queue, with specified time. */ void mouseScroll(GUIEventAdapter::ScrollingMotion sm, double time); - + /** Method for adapting mouse scroll wheel events, placing this event on the back of the event queue. */ void mouseScroll2D(float x, float y) { mouseScroll2D(x, y, getTime()); } /** Method for adapting mouse scroll wheel events, placing this event on the back of the event queue. */ void mouseScroll2D(float x, float y, double time); - + /** Method for adapting pen pressure events, placing this event on the back of the event queue.*/ void penPressure(float pressure) { penPressure(pressure, getTime()); } - + /** Method for adapting pen pressure events, placing this event on the back of the event queue, with specified time.*/ void penPressure(float pressure, double time); @@ -102,7 +102,7 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced /** Method for adapting pen orientation events, placing this event on the back of the event queue, with specified time.*/ void penOrientation(float tiltX, float tiltY, float rotation, double time); - + /** Method for adapting pen proximity events, placing this event on the back of the event queue.*/ void penProximity(GUIEventAdapter::TabletPointerType pt, bool isEntering) { penProximity(pt, isEntering, getTime()); } @@ -133,11 +133,11 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced /** Method for adapting mouse button pressed events, placing this event on the back of the event queue. * Button numbering is 1 for left mouse button, 2 for middle, 3 for right. */ void mouseDoubleButtonPress(float x, float y, unsigned int button) { mouseDoubleButtonPress(x, y, button, getTime()); } - + /** Method for adapting mouse button pressed events, placing this event on the back of the event queue, with specified time. * Button numbering is 1 for left mouse button, 2 for middle, 3 for right. */ void mouseDoubleButtonPress(float x, float y, unsigned int button, double time); - + /** Method for adapting mouse button release events, placing this event on the back of the event queue. * Button numbering is 1 for left mouse button, 2 for middle, 3 for right. */ @@ -160,22 +160,22 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced /** Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings, with specified time.*/ void keyRelease(int key, double time, int unmodifiedKey = 0); - + GUIEventAdapter* touchBegan(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time); GUIEventAdapter* touchBegan(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y) { return touchBegan(id, phase, x, y, getTime()); } - + GUIEventAdapter* touchMoved(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time); GUIEventAdapter* touchMoved(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y) { return touchMoved(id, phase, x, y, getTime()); } - + GUIEventAdapter* touchEnded(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, unsigned int tap_count, double time); GUIEventAdapter* touchEnded(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, unsigned int tap_count) { return touchEnded(id, phase, x, y, tap_count, getTime()); } - + /** Method for adapting close window events.*/ @@ -194,7 +194,7 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced /** Method for adapting frame events.*/ void frame(double time); - + void setStartTick(osg::Timer_t tick) { _startTick = tick; clear(); } osg::Timer_t getStartTick() const { return _startTick; } @@ -206,8 +206,8 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced /** convenience method for create an event ready to fill in. Clones the getCurrentEventState() to produce a up to date event state. */ GUIEventAdapter* createEvent(); - - + + void setCurrentEventState(GUIEventAdapter* ea) { _accumulateEventState = ea; } GUIEventAdapter* getCurrentEventState() { return _accumulateEventState.get(); } const GUIEventAdapter* getCurrentEventState() const { return _accumulateEventState.get(); } @@ -227,7 +227,7 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced /** Prevent unwanted copy operator.*/ EventQueue& operator = (const EventQueue&) { return *this; } - + osg::ref_ptr _accumulateEventState; bool _useFixedMouseInputRange; @@ -236,7 +236,7 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced mutable OpenThreads::Mutex _eventQueueMutex; Events _eventQueue; bool _firstTouchEmulatesMouse; - + }; } diff --git a/include/osgGA/EventVisitor b/include/osgGA/EventVisitor index 3e8acb219..06de662e8 100644 --- a/include/osgGA/EventVisitor +++ b/include/osgGA/EventVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ namespace osgGA { /** * Basic EventVisitor implementation for animating a scene. * This visitor traverses the scene graph, calling each nodes appCallback if - * it exists. + * it exists. */ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor { @@ -42,41 +42,41 @@ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor EventVisitor(); virtual ~EventVisitor(); - + META_NodeVisitor("osgGA","EventVisitor") - + void setActionAdapter(osgGA::GUIActionAdapter* actionAdapter) { _actionAdapter=actionAdapter; } - + osgGA::GUIActionAdapter* getActionAdapter() { return _actionAdapter; } const osgGA::GUIActionAdapter* getActionAdapter() const { return _actionAdapter; } typedef std::list< osg::ref_ptr > EventList; - + void addEvent(GUIEventAdapter* event); void removeEvent(GUIEventAdapter* event); - + void setEventHandled(bool handled) { _handled = handled; } bool getEventHandled() const { return _handled; } - + void setEvents(const EventQueue::Events& events) { _events = events; } EventQueue::Events& getEvents() { return _events; } const EventQueue::Events& getEvents() const { return _events; } - + public: - + virtual void reset(); /** During traversal each type of node calls its callbacks and its children traversed. */ virtual void apply(osg::Node& node) { handle_callbacks_and_traverse(node); } - + virtual void apply(osg::Geode& node) { handle_geode_callbacks(node); } virtual void apply(osg::Billboard& node) { handle_geode_callbacks(node); } - + virtual void apply(osg::LightSource& node) { handle_callbacks_and_traverse(node); } - + virtual void apply(osg::Group& node) { handle_callbacks_and_traverse(node); } virtual void apply(osg::Transform& node) { handle_callbacks_and_traverse(node); } virtual void apply(osg::Projection& node) { handle_callbacks_and_traverse(node); } @@ -89,7 +89,7 @@ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor /** Prevent unwanted copy operator.*/ EventVisitor& operator = (const EventVisitor&) { return *this; } - + inline void handle_callbacks(osg::StateSet* stateset) { if (stateset && stateset->requiresEventTraversal()) @@ -113,14 +113,14 @@ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor osg::NodeCallback* callback = node.getEventCallback(); if (callback) (*callback)(&node,this); - /*else if (node.getNumChildrenRequiringEventTraversal()>0)*/ + /*else if (node.getNumChildrenRequiringEventTraversal()>0)*/ traverseGeode(node); } - + inline void traverseGeode(osg::Geode& geode) { traverse((osg::Node&)geode); - + // Call the app callbacks on the drawables. for(unsigned int i=0;igetStateSet()); } } - + osgGA::GUIActionAdapter* _actionAdapter; - + osg::ref_ptr _accumulateEventState; - + bool _handled; EventQueue::Events _events; - + }; } diff --git a/include/osgGA/Export b/include/osgGA/Export index 95bc45556..0743d6795 100644 --- a/include/osgGA/Export +++ b/include/osgGA/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,8 +37,8 @@ # define OSGGA_EXPORT __declspec(dllimport) #endif #else - #define OSGGA_EXPORT -#endif + #define OSGGA_EXPORT +#endif #endif diff --git a/include/osgGA/GUIActionAdapter b/include/osgGA/GUIActionAdapter index 999ab88e8..f70e6fa71 100644 --- a/include/osgGA/GUIActionAdapter +++ b/include/osgGA/GUIActionAdapter @@ -1,18 +1,18 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGGA_GUIACTIONADAPTER -#define OSGGA_GUIACTIONADAPTER 1 +#define OSGGA_GUIACTIONADAPTER 1 #include #include @@ -34,7 +34,7 @@ GUIEventHandler issues it's request via a GUIActionAdapter, and the viewer in use should honour the request, using the GUI system in play. There is more than one way of using the GUIActionAdapter. E.g. it may be inherited -into a Viewer class, as is done with osgGLUT::Viewer. Alternatively, a simple +into a Viewer class, as is done with osgGLUT::Viewer. Alternatively, a simple subclass of GUIActionAdapter (e.g. osgQt::QtActionAdapter) may be passed to the GUIEventHandler::handle() function; once the function has returned, the viewer will then unpack the results and work out what to do to respond to the @@ -56,20 +56,20 @@ class GUIActionAdapter { public: virtual ~GUIActionAdapter() {} - + /** Provide a mechanism for getting the osg::View associated with this GUIActionAdapter. * One would use this to case view to osgViewer::View(er) if supported by the subclass.*/ virtual osg::View* asView() { return 0; } - + /** requestRedraw() requests a single redraw. */ virtual void requestRedraw() = 0; /** - requestContinousUpdate(bool) is for en/disabling a throw or idle + requestContinousUpdate(bool) is for en/disabling a throw or idle callback to be requested by a GUIEventHandler (typically a MatrixManipulator, - though other GUIEventHandler's may also provide functionality). + though other GUIEventHandler's may also provide functionality). GUI toolkits can respond to this immediately by registering an idle/timed callback, or can delay setting the callback and update at their own leisure. */ diff --git a/include/osgGA/GUIEventAdapter b/include/osgGA/GUIEventAdapter index 0c1613e94..ddba958cf 100644 --- a/include/osgGA/GUIEventAdapter +++ b/include/osgGA/GUIEventAdapter @@ -1,18 +1,18 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGGA_EVENT -#define OSGGA_EVENT 1 +#define OSGGA_EVENT 1 #include #include @@ -28,7 +28,7 @@ class OSGGA_EXPORT GUIEventAdapter : public osg::Object { public: - enum MouseButtonMask { + enum MouseButtonMask { LEFT_MOUSE_BUTTON = 1<<0, MIDDLE_MOUSE_BUTTON = 1<<1, RIGHT_MOUSE_BUTTON = 1<<2 @@ -36,7 +36,7 @@ public: enum EventType { NONE = 0, - PUSH = 1<<0, + PUSH = 1<<0, RELEASE = 1<<1, DOUBLECLICK = 1<<2, DRAG = 1<<3, @@ -208,7 +208,7 @@ public: KEY_KP_7 = 0xFFB7, KEY_KP_8 = 0xFFB8, KEY_KP_9 = 0xFFB9, - + /* * Auxiliary Functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufactures have such @@ -302,7 +302,7 @@ public: Y_INCREASING_DOWNWARDS }; - enum ScrollingMotion + enum ScrollingMotion { SCROLL_NONE, SCROLL_LEFT, @@ -312,15 +312,15 @@ public: SCROLL_2D }; - enum TabletPointerType + enum TabletPointerType { UNKNOWN = 0, PEN, PUCK, ERASER }; - - enum TouchPhase + + enum TouchPhase { TOUCH_UNKNOWN, TOUCH_BEGAN, @@ -328,54 +328,54 @@ public: TOUCH_STATIONERY, TOUCH_ENDED }; - + class TouchData : public osg::Referenced { public: struct TouchPoint { unsigned int id; TouchPhase phase; float x, y; - + unsigned int tapCount; TouchPoint() : id(0), phase(TOUCH_UNKNOWN), x(0.0f), y(0.0f), tapCount(0) {} - TouchPoint(unsigned int in_id, TouchPhase in_phase, float in_x, float in_y, unsigned int in_tap_count) - : id(in_id), + TouchPoint(unsigned int in_id, TouchPhase in_phase, float in_x, float in_y, unsigned int in_tap_count) + : id(in_id), phase(in_phase), - x(in_x), - y(in_y), - tapCount(in_tap_count) + x(in_x), + y(in_y), + tapCount(in_tap_count) { } }; - + typedef std::vector TouchSet; - + typedef TouchSet::iterator iterator; typedef TouchSet::const_iterator const_iterator; - + TouchData() : osg::Referenced() {} - + unsigned int getNumTouchPoints() const { return _touches.size(); } - + iterator begin() { return _touches.begin(); } const_iterator begin() const { return _touches.begin(); } - + iterator end() { return _touches.end(); } const_iterator end() const { return _touches.end(); } - + const TouchPoint get(unsigned int i) const { return _touches[i]; } - + protected: - + void addTouchPoint(unsigned int id, TouchPhase phase, float x, float y, unsigned int tap_count) { _touches.push_back(TouchPoint(id, phase, x, y, tap_count)); } - + TouchSet _touches; - - friend class GUIEventAdapter; + + friend class GUIEventAdapter; }; - + public: GUIEventAdapter(); @@ -383,7 +383,7 @@ public: GUIEventAdapter(const GUIEventAdapter& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); META_Object(osgGA, GUIEventAdapter); - + /** Get the accumulated event state singleton. * Typically all EventQueue will share this single GUIEventAdapter object for tracking @@ -415,7 +415,7 @@ public: void setGraphicsContext(osg::GraphicsContext* context) { _context = context; } const osg::GraphicsContext* getGraphicsContext() const { return _context.get(); } - + /** set window rectangle. */ void setWindowRectangle(int x, int y, int width, int height, bool updateMouseRange = true); @@ -441,10 +441,10 @@ public: /** set virtual key pressed. */ void setUnmodifiedKey(int key) { _unmodifiedKey = key; } - + /** get virtual key pressed. */ int getUnmodifiedKey() const { return _unmodifiedKey; } - + /** set button pressed/released.*/ void setButton(int button) { _button = button; } @@ -482,7 +482,7 @@ public: /** * return the current mouse x value normalized to the range of -1 to 1. * -1 would be the left hand side of the window. - * 0.0 would be the middle of the window. + * 0.0 would be the middle of the window. * +1 would be the right hand side of the window. */ inline float getXnormalized() const { return 2.0f*(getX()-getXmin())/(getXmax()-getXmin())-1.0f; } @@ -490,7 +490,7 @@ public: /** * return the current mouse y value normalized to the range of -1 to 1. * -1 would be the bottom of the window. - * 0.0 would be the middle of the window. + * 0.0 would be the middle of the window. * +1 would be the top of the window. */ inline float getYnormalized() const @@ -571,16 +571,16 @@ public: const osg::Matrix getPenOrientation() const; void addTouchPoint(unsigned int id, TouchPhase phase, float x, float y, unsigned int tapCount = 0); - + TouchData* getTouchData() const { return _touchData.get(); } bool isMultiTouchEvent() const { return (_touchData.valid()); } - + protected: /** Force users to create on heap, so that multiple referencing is safe.*/ virtual ~GUIEventAdapter(); - mutable bool _handled; + mutable bool _handled; EventType _eventType; double _time; @@ -621,8 +621,8 @@ public: TabletPen(const TabletPen& rhs) : pressure(rhs.pressure), tiltX(rhs.tiltX), tiltY(rhs.tiltY), rotation(rhs.rotation), tabletPointerType(rhs.tabletPointerType) {} }; TabletPen _tabletPen; - - osg::ref_ptr _touchData; + + osg::ref_ptr _touchData; }; } diff --git a/include/osgGA/GUIEventHandler b/include/osgGA/GUIEventHandler index 4dce9b72d..38d589a28 100644 --- a/include/osgGA/GUIEventHandler +++ b/include/osgGA/GUIEventHandler @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -89,7 +89,7 @@ public: /** Deprecated, Handle events, return true if handled, false otherwise. */ virtual bool handle(const GUIEventAdapter&,GUIActionAdapter&) { return false; } - + /** Convenience method that only passes on to the handle(,) method events that either haven't been * handled yet, or have been handled but haven't be set to be ignored by the IgnoreHandledEventsMask. * Note, this method is an inline method, and not appropriate for users to override, override the handle(,) @@ -108,7 +108,7 @@ public: return false; } } - + /** Get the keyboard and mouse usage of this manipulator.*/ virtual void getUsage(osg::ApplicationUsage&) const {} diff --git a/include/osgGA/MultiTouchTrackballManipulator b/include/osgGA/MultiTouchTrackballManipulator index 0e5763aac..5b8ba08e2 100644 --- a/include/osgGA/MultiTouchTrackballManipulator +++ b/include/osgGA/MultiTouchTrackballManipulator @@ -31,13 +31,13 @@ class OSGGA_EXPORT MultiTouchTrackballManipulator : public TrackballManipulator const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY ); META_Object( osgGA, MultiTouchTrackballManipulator ); - + bool handle( const GUIEventAdapter& ea, GUIActionAdapter& us ); - + protected: - + void handleMultiTouchDrag(GUIEventAdapter::TouchData* now, GUIEventAdapter::TouchData* last, const double eventTimeDelta); - + osg::ref_ptr _lastTouchData; }; diff --git a/include/osgGA/SphericalManipulator b/include/osgGA/SphericalManipulator index bc63fb287..e784b5c18 100644 --- a/include/osgGA/SphericalManipulator +++ b/include/osgGA/SphericalManipulator @@ -95,7 +95,7 @@ class OSGGA_EXPORT SphericalManipulator : public CameraManipulator double getMinimumZoomScale() const { return _minimumZoomScale; } /** set the minimum distance (as ratio) the eye point can be zoomed in towards the - center before the center is pushed forward.*/ + center before the center is pushed forward.*/ void setMinimumZoomScale(double minimumZoomScale) {_minimumZoomScale=minimumZoomScale;} @@ -159,7 +159,7 @@ class OSGGA_EXPORT SphericalManipulator : public CameraManipulator * This is used to compute the delta in translation/rotation during a thrown display update. * It allows us to match an delta in position/rotation independent of the rendering frame rate. */ - double _delta_frame_time; + double _delta_frame_time; /** The time the last frame started. * Used when _rate_sensitive is true so that we can match display update rate to rotation/translation rate. diff --git a/include/osgGA/StateSetManipulator b/include/osgGA/StateSetManipulator index db1ddcfdb..ee4aef4a4 100644 --- a/include/osgGA/StateSetManipulator +++ b/include/osgGA/StateSetManipulator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -45,17 +45,17 @@ public: /** get the attached a StateSet.*/ virtual const osg::StateSet * getStateSet() const; - + /** Handle events, return true if handled, false otherwise.*/ - virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us); + virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us); /** Get the keyboard and mouse usage of this manipulator.*/ virtual void getUsage(osg::ApplicationUsage& usage) const; - + void setMaximumNumOfTextureUnits(unsigned int i) { _maxNumOfTextureUnits = i; } unsigned int getMaximumNumOfTextureUnits() const { return _maxNumOfTextureUnits; } - + void setBackfaceEnabled(bool newbackface); bool getBackfaceEnabled() const {return _backface;}; @@ -67,7 +67,7 @@ public: void setPolygonMode(osg::PolygonMode::Mode newpolygonmode); osg::PolygonMode::Mode getPolygonMode() const; - + void cyclePolygonMode(); @@ -96,7 +96,7 @@ protected: bool _lighting; bool _texture; unsigned int _maxNumOfTextureUnits; - + int _keyEventToggleBackfaceCulling; int _keyEventToggleLighting; int _keyEventToggleTexturing; diff --git a/include/osgGA/UFOManipulator b/include/osgGA/UFOManipulator index f07eea82b..985ad8d21 100644 --- a/include/osgGA/UFOManipulator +++ b/include/osgGA/UFOManipulator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,9 +24,9 @@ \class osgGA::UFOManipulator \brief A UFO manipulator driven with keybindings. - The UFOManipulator is better suited for applications that employ + The UFOManipulator is better suited for applications that employ architectural walk-throughs, or situations where the eyepoint motion - model must move slowly, deliberately and well controlled. + model must move slowly, deliberately and well controlled. The UFO Manipulator allows the following movements with the listed Key combinations: @@ -65,7 +65,7 @@ class OSGGA_EXPORT UFOManipulator : public osgGA::CameraManipulator */ virtual const char* className() const; - /** Set the current position with a matrix + /** Set the current position with a matrix \param matrix A viewpoint matrix. */ virtual void setByMatrix( const osg::Matrixd &matrix ) ; @@ -92,7 +92,7 @@ class OSGGA_EXPORT UFOManipulator : public osgGA::CameraManipulator /** Get the root node of the subgraph this manipulator is driving the eye through */ virtual osg::Node* getNode(); - /** Computes the home position based on the extents and scale of the + /** Computes the home position based on the extents and scale of the scene graph rooted at node */ virtual void computeHomePosition(); diff --git a/include/osgGA/Version b/include/osgGA/Version index 909b96414..ddd30e8b9 100644 --- a/include/osgGA/Version +++ b/include/osgGA/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgManipulator/AntiSquish b/include/osgManipulator/AntiSquish index 802c0aeba..c81805fbd 100644 --- a/include/osgManipulator/AntiSquish +++ b/include/osgManipulator/AntiSquish @@ -47,7 +47,7 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform void setPivot(const osg::Vec3d& pvt) { _pivot = pvt; - _usePivot = true; + _usePivot = true; _dirty = true; } @@ -56,12 +56,12 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform void setPosition(const osg::Vec3d& pos) { _position = pos; - _usePosition = true; + _usePosition = true; _dirty = true; } const osg::Vec3d& getPosition() const { return _position; } - + virtual ~AntiSquish(); osg::Matrix computeUnSquishedMatrix(const osg::Matrix&, bool& flag); @@ -78,7 +78,7 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform bool _dirty; osg::Matrix _cachedLocalToWorld; -}; +}; } #endif diff --git a/include/osgManipulator/Command b/include/osgManipulator/Command index 0970d32d7..122717766 100644 --- a/include/osgManipulator/Command +++ b/include/osgManipulator/Command @@ -40,7 +40,7 @@ class OSGMANIPULATOR_EXPORT MotionCommand : public osg::Referenced { NONE, /** Click or pick start. */ - START, + START, /** Drag or pick move. */ MOVE, /** Release or pick finish. */ @@ -54,7 +54,7 @@ class OSGMANIPULATOR_EXPORT MotionCommand : public osg::Referenced /** * Gets the matrix for transforming the object being dragged. This matrix is in the - * command's coordinate systems. + * command's coordinate systems. */ virtual osg::Matrix getMotionMatrix() const = 0; @@ -79,7 +79,7 @@ class OSGMANIPULATOR_EXPORT MotionCommand : public osg::Referenced /** * Gets the matrix for transforming the command's world/object - * coordinate system to the command's local coordinate system. + * coordinate system to the command's local coordinate system. */ inline const osg::Matrix& getWorldToLocal() const { return _worldToLocal; } @@ -89,7 +89,7 @@ class OSGMANIPULATOR_EXPORT MotionCommand : public osg::Referenced protected: virtual ~MotionCommand(); - + private: osg::Matrix _localToWorld; osg::Matrix _worldToLocal; @@ -121,7 +121,7 @@ class OSGMANIPULATOR_EXPORT TranslateInLineCommand : public MotionCommand inline void setTranslation(const osg::Vec3& t) { _translation = t; } inline const osg::Vec3d& getTranslation() const { return _translation; } - virtual osg::Matrix getMotionMatrix() const + virtual osg::Matrix getMotionMatrix() const { return osg::Matrix::translate(_translation); } @@ -161,7 +161,7 @@ class OSGMANIPULATOR_EXPORT TranslateInPlaneCommand : public MotionCommand inline void setReferencePoint(const osg::Vec3d& rp) { _referencePoint = rp; } inline const osg::Vec3d& getReferencePoint() const { return _referencePoint; } - virtual osg::Matrix getMotionMatrix() const + virtual osg::Matrix getMotionMatrix() const { return osg::Matrix::translate(_translation); } @@ -203,7 +203,7 @@ class OSGMANIPULATOR_EXPORT Scale1DCommand : public MotionCommand inline void setMinScale(double min) { _minScale = min; } inline double getMinScale() const { return _minScale; } - virtual osg::Matrix getMotionMatrix() const + virtual osg::Matrix getMotionMatrix() const { return (osg::Matrix::translate(-_scaleCenter,0.0,0.0) * osg::Matrix::scale(_scale,1.0,1.0) @@ -248,7 +248,7 @@ class OSGMANIPULATOR_EXPORT Scale2DCommand : public MotionCommand inline void setMinScale(const osg::Vec2d& min) { _minScale = min; } inline const osg::Vec2d& getMinScale() const { return _minScale; } - virtual osg::Matrix getMotionMatrix() const + virtual osg::Matrix getMotionMatrix() const { return (osg::Matrix::translate(-_scaleCenter[0],0.0,-_scaleCenter[1]) * osg::Matrix::scale(_scale[0],1.0,_scale[1]) @@ -286,9 +286,9 @@ class OSGMANIPULATOR_EXPORT ScaleUniformCommand : public MotionCommand inline void setScaleCenter(const osg::Vec3d& center) { _scaleCenter = center; } inline const osg::Vec3d& getScaleCenter() const { return _scaleCenter; } - virtual osg::Matrix getMotionMatrix() const + virtual osg::Matrix getMotionMatrix() const { - return (osg::Matrix::translate(-_scaleCenter) + return (osg::Matrix::translate(-_scaleCenter) * osg::Matrix::scale(_scale,_scale,_scale) * osg::Matrix::translate(_scaleCenter)); } @@ -319,7 +319,7 @@ class OSGMANIPULATOR_EXPORT Rotate3DCommand : public MotionCommand inline void setRotation(const osg::Quat& rotation) { _rotation = rotation; } inline const osg::Quat& getRotation() const { return _rotation; } - virtual osg::Matrix getMotionMatrix() const + virtual osg::Matrix getMotionMatrix() const { return osg::Matrix::rotate(_rotation); } diff --git a/include/osgManipulator/Dragger b/include/osgManipulator/Dragger index 696db3c74..9a099692d 100644 --- a/include/osgManipulator/Dragger +++ b/include/osgManipulator/Dragger @@ -72,7 +72,7 @@ class OSGMANIPULATOR_EXPORT DraggerTransformCallback : public DraggerCallback protected: unsigned int _handleCommandMask; - + osg::observer_ptr _transform; osg::Matrix _startMotionMatrix; diff --git a/include/osgManipulator/Projector b/include/osgManipulator/Projector index 49c873722..634a9737c 100644 --- a/include/osgManipulator/Projector +++ b/include/osgManipulator/Projector @@ -35,7 +35,7 @@ class OSGMANIPULATOR_EXPORT Projector : public osg::Referenced /** * Calculates the object/world coordinates (projectedPoint) of a window - * coordinate (pointToProject) when projected onto some shape or + * coordinate (pointToProject) when projected onto some shape or * geometry (implemented in derived classes). SceneView in used for i * projecting window coordinates into object coordinates and vice versa. * Returns true on successful projection. @@ -62,7 +62,7 @@ class OSGMANIPULATOR_EXPORT Projector : public osg::Referenced * Gets the matrix for transforming the world/object coordinate * system to the command's local coordinate system. */ - inline const osg::Matrix& getWorldToLocal() const + inline const osg::Matrix& getWorldToLocal() const { if (_worldToLocalDirty) { @@ -103,8 +103,8 @@ class OSGMANIPULATOR_EXPORT LineProjector : public Projector inline osg::LineSegment::vec_type& getLineEnd() { return _line->end(); } /** - * Calculates the object coordinates (projectedPoint) of a window - * coordinate (pointToProject) when projected onto the given line. + * Calculates the object coordinates (projectedPoint) of a window + * coordinate (pointToProject) when projected onto the given line. * Returns true on successful projection. */ virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const; @@ -131,8 +131,8 @@ class OSGMANIPULATOR_EXPORT PlaneProjector : public Projector inline const osg::Plane& getPlane() const { return _plane; } /** - * Calculates the object coordinates (projectedPoint) of a window - * coordinate (pointToProject) when projected onto the given plane. + * Calculates the object coordinates (projectedPoint) of a window + * coordinate (pointToProject) when projected onto the given plane. * Returns true on successful projection. */ virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const; @@ -159,8 +159,8 @@ class OSGMANIPULATOR_EXPORT SphereProjector : public Projector inline const osg::Sphere* getSphere() const { return _sphere.get(); } /** - * Calculates the object coordinates (projectedPoint) of a window - * coordinate (pointToProject) when projected onto the given sphere. + * Calculates the object coordinates (projectedPoint) of a window + * coordinate (pointToProject) when projected onto the given sphere. * Returns true on successful projection. */ virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const; @@ -194,19 +194,19 @@ class OSGMANIPULATOR_EXPORT SpherePlaneProjector : public SphereProjector SpherePlaneProjector(osg::Sphere* sphere); /** - * Calculates the object coordinates (projectedPoint) of a window - * coordinate (pointToProject) when projected onto the given sphere. + * Calculates the object coordinates (projectedPoint) of a window + * coordinate (pointToProject) when projected onto the given sphere. * Returns true on successful projection. */ virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const; /** - * Returns true if the previous projection was on the sphere and false + * Returns true if the previous projection was on the sphere and false * if the projection was on the plane. */ bool isProjectionOnSphere() const { return _onSphere; } - osg::Quat getRotation(const osg::Vec3d& p1, bool p1OnSphere, + osg::Quat getRotation(const osg::Vec3d& p1, bool p1OnSphere, const osg::Vec3d& p2, bool p2OnSphere, float radialFactor = 0.0f) const; @@ -238,15 +238,15 @@ class OSGMANIPULATOR_EXPORT CylinderProjector : public Projector inline const osg::Cylinder* getCylinder() const { return _cylinder.get(); } /** - * Calculates the object coordinates (projectedPoint) of a window - * coordinate (pointToProject) when projected onto the given plane. + * Calculates the object coordinates (projectedPoint) of a window + * coordinate (pointToProject) when projected onto the given plane. * Returns true on successful projection. */ virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const; - + /** - * Returns true is the point is in front of the cylinder given the eye + * Returns true is the point is in front of the cylinder given the eye * direction. */ bool isPointInFront(const PointerInfo& pi, const osg::Matrix& localToWorld) const; @@ -278,8 +278,8 @@ class OSGMANIPULATOR_EXPORT CylinderPlaneProjector : public CylinderProjector CylinderPlaneProjector(osg::Cylinder* cylinder); /** - * Calculates the object coordinates (projectedPoint) of a window - * coordinate (pointToProject) when projected onto the given plane. + * Calculates the object coordinates (projectedPoint) of a window + * coordinate (pointToProject) when projected onto the given plane. * Returns true on successful projection. * \param[in] pi Incoming intersection information * \param[out] projectedPoint Point located on the given plane diff --git a/include/osgManipulator/Version b/include/osgManipulator/Version index b25effa2f..3794c53b0 100644 --- a/include/osgManipulator/Version +++ b/include/osgManipulator/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgParticle/AccelOperator b/include/osgParticle/AccelOperator index 1e2755550..46762f9d6 100644 --- a/include/osgParticle/AccelOperator +++ b/include/osgParticle/AccelOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -37,24 +37,24 @@ namespace osgParticle /// Get the acceleration vector. inline const osg::Vec3& getAcceleration() const; - + /// Set the acceleration vector. inline void setAcceleration(const osg::Vec3& v); - + /** Quickly set the acceleration vector to the gravity on earth (0, 0, -9.81). The acceleration will be multiplied by the scale parameter. */ inline void setToGravity(float scale = 1); - + /// Apply the acceleration to a particle. Do not call this method manually. inline void operate(Particle* P, double dt); - + /// Perform some initializations. Do not call this method manually. inline void beginOperate(Program *prg); protected: virtual ~AccelOperator() {} - AccelOperator &operator=(const AccelOperator &) { return *this; } + AccelOperator &operator=(const AccelOperator &) { return *this; } private: osg::Vec3 _accel; @@ -62,12 +62,12 @@ namespace osgParticle }; // INLINE FUNCTIONS - + inline AccelOperator::AccelOperator() : Operator(), _accel(0, 0, 0) { } - + inline AccelOperator::AccelOperator(const AccelOperator& copy, const osg::CopyOp& copyop) : Operator(copy, copyop), _accel(copy._accel) { @@ -82,7 +82,7 @@ namespace osgParticle { _accel = v; } - + inline void AccelOperator::setToGravity(float scale) { _accel.set(0, 0, -9.80665f * scale); @@ -92,7 +92,7 @@ namespace osgParticle { P->addVelocity(_xf_accel * dt); } - + inline void AccelOperator::beginOperate(Program *prg) { if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) { diff --git a/include/osgParticle/AngularAccelOperator b/include/osgParticle/AngularAccelOperator index 71149fc55..b1eb1dc92 100644 --- a/include/osgParticle/AngularAccelOperator +++ b/include/osgParticle/AngularAccelOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -26,7 +26,7 @@ namespace osgParticle { - /** An operator class that applies a constant angular acceleration to + /** An operator class that applies a constant angular acceleration to * the particles. */ class AngularAccelOperator: public Operator { @@ -38,19 +38,19 @@ namespace osgParticle /// Get the angular acceleration vector. inline const osg::Vec3& getAngularAcceleration() const; - + /// Set the angular acceleration vector. inline void setAngularAcceleration(const osg::Vec3& v); - + /// Apply the angular acceleration to a particle. Do not call this method manually. inline void operate(Particle* P, double dt); - + /// Perform some initializations. Do not call this method manually. inline void beginOperate(Program *prg); protected: virtual ~AngularAccelOperator() {} - AngularAccelOperator& operator=(const AngularAccelOperator& ) { return *this; } + AngularAccelOperator& operator=(const AngularAccelOperator& ) { return *this; } private: osg::Vec3 _angul_araccel; @@ -58,12 +58,12 @@ namespace osgParticle }; // INLINE FUNCTIONS - + inline AngularAccelOperator::AngularAccelOperator() : Operator(), _angul_araccel(0, 0, 0) { } - + inline AngularAccelOperator::AngularAccelOperator(const AngularAccelOperator& copy, const osg::CopyOp& copyop) : Operator(copy, copyop), _angul_araccel(copy._angul_araccel) { @@ -83,7 +83,7 @@ namespace osgParticle { P->addAngularVelocity(_xf_angul_araccel * dt); } - + inline void AngularAccelOperator::beginOperate(Program *prg) { if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) { diff --git a/include/osgParticle/AngularDampingOperator b/include/osgParticle/AngularDampingOperator index b2b61667a..ec59e848b 100644 --- a/include/osgParticle/AngularDampingOperator +++ b/include/osgParticle/AngularDampingOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -30,44 +30,44 @@ class AngularDampingOperator : public Operator public: AngularDampingOperator() : Operator(), _cutoffLow(0.0f), _cutoffHigh(FLT_MAX) {} - + AngularDampingOperator( const AngularDampingOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : Operator(copy, copyop), _damping(copy._damping), _cutoffLow(copy._cutoffLow), _cutoffHigh(copy._cutoffHigh) {} - + META_Object( osgParticle, AngularDampingOperator ); - + /// Set the damping factors void setDamping( float x, float y, float z ) { _damping.set(x, y, z); } void setDamping( const osg::Vec3& damping ) { _damping = damping; } - + /// Set the damping factors to one value void setDamping( float x ) { _damping.set(x, x, x); } - + /// Get the damping factors void getDamping( float& x, float& y, float& z ) const { x = _damping.x(); y = _damping.y(); z = _damping.z(); } - + const osg::Vec3& getDamping() const { return _damping; } - + /// Set the velocity cutoff factors void setCutoff( float low, float high ) { _cutoffLow = low; _cutoffHigh = high; } void setCutoffLow( float low ) { _cutoffLow = low; } void setCutoffHigh( float low ) { _cutoffHigh = low; } - + /// Get the velocity cutoff factors void getCutoff( float& low, float& high ) const { low = _cutoffLow; high = _cutoffHigh; } float getCutoffLow() const { return _cutoffLow; } float getCutoffHigh() const { return _cutoffHigh; } - + /// Apply the acceleration to a particle. Do not call this method manually. inline void operate( Particle* P, double dt ); - + protected: virtual ~AngularDampingOperator() {} AngularDampingOperator& operator=( const AngularDampingOperator& ) { return *this; } - + osg::Vec3 _damping; float _cutoffLow; float _cutoffHigh; diff --git a/include/osgParticle/BounceOperator b/include/osgParticle/BounceOperator index 6244520d4..682ac7c5e 100644 --- a/include/osgParticle/BounceOperator +++ b/include/osgParticle/BounceOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -31,42 +31,42 @@ public: BounceOperator() : DomainOperator(), _friction(1.0f), _resilience(0.0f), _cutoff(0.0f) {} - + BounceOperator( const BounceOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : DomainOperator(copy, copyop), _friction(copy._friction), _resilience(copy._resilience), _cutoff(copy._cutoff) {} - + META_Object( osgParticle, BounceOperator ); - + /// Set the friction void setFriction( float f ) { _friction = f; } - + /// Get the friction float getFriction() const { return _friction; } - + /// Set the resilience void setResilience( float r ) { _resilience = r; } - + /// Get the velocity cutoff factor float getResilience() const { return _resilience; } - + /// Set the velocity cutoff factor void setCutoff( float v ) { _cutoff = v; } - + /// Get the velocity cutoff factor float getCutoff() const { return _cutoff; } - + protected: virtual ~BounceOperator() {} BounceOperator& operator=( const BounceOperator& ) { return *this; } - + virtual void handleTriangle( const Domain& domain, Particle* P, double dt ); virtual void handleRectangle( const Domain& domain, Particle* P, double dt ); virtual void handlePlane( const Domain& domain, Particle* P, double dt ); virtual void handleSphere( const Domain& domain, Particle* P, double dt ); virtual void handleDisk( const Domain& domain, Particle* P, double dt ); - + float _friction; float _resilience; float _cutoff; diff --git a/include/osgParticle/BoxPlacer b/include/osgParticle/BoxPlacer index 2be046bc9..9765aabe5 100644 --- a/include/osgParticle/BoxPlacer +++ b/include/osgParticle/BoxPlacer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //Build by Zach Deedler @@ -28,48 +28,48 @@ namespace osgParticle { /** A box-shaped particle placer. - This placer sets the initial position of incoming particle by choosing a random position - within the volume of a box; this placer is defined by four parameters: a center point, - which is inherited directly from osgParticle::CenteredPlacer, and three ranges of values + This placer sets the initial position of incoming particle by choosing a random position + within the volume of a box; this placer is defined by four parameters: a center point, + which is inherited directly from osgParticle::CenteredPlacer, and three ranges of values for the valid X, Y, and Z coordinates. */ class BoxPlacer: public CenteredPlacer { public: inline BoxPlacer(); inline BoxPlacer(const BoxPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + /// Get the range of possible values along the X axis. inline const rangef& getXRange() const; - + /// Set the range of possible values along the X axis. inline void setXRange(const rangef& r); - + /// Set the range of possible values along the X axis. inline void setXRange(float r1, float r2); - + /// Get the range of possible values along the Y axis. - inline const rangef& getYRange() const; - + inline const rangef& getYRange() const; + /// Set the range of possible values along the Y axis. inline void setYRange(const rangef& r); - + /// Set the range of possible values along the Y axis. - inline void setYRange(float r1, float r2); + inline void setYRange(float r1, float r2); /// Get the range of possible values along the Z axis. - inline const rangef& getZRange() const; + inline const rangef& getZRange() const; /// Set the range of possible values along the Z axis. inline void setZRange(const rangef& r); - + /// Set the range of possible values along the Z axis. - inline void setZRange(float r1, float r2); + inline void setZRange(float r1, float r2); META_Object(osgParticle, BoxPlacer); - + /// Place a particle. Do not call it manually. inline void place(Particle* P) const; - + /// return the volume of the box inline float volume() const; @@ -78,8 +78,8 @@ namespace osgParticle protected: virtual ~BoxPlacer() {} - BoxPlacer& operator=(const BoxPlacer&) { return *this; } - + BoxPlacer& operator=(const BoxPlacer&) { return *this; } + private: rangef _x_range; rangef _y_range; @@ -87,18 +87,18 @@ namespace osgParticle }; // INLINE FUNCTIONS - + inline BoxPlacer::BoxPlacer() : CenteredPlacer(), _x_range(-1, 1), _y_range(-1, 1), _z_range(-1, 1) { } - + inline BoxPlacer::BoxPlacer(const BoxPlacer& copy, const osg::CopyOp& copyop) - : CenteredPlacer(copy, copyop), + : CenteredPlacer(copy, copyop), _x_range(copy._x_range), _y_range(copy._y_range), _z_range(copy._z_range) { } - + inline const rangef& BoxPlacer::getXRange() const { return _x_range; @@ -108,7 +108,7 @@ namespace osgParticle { _x_range = r; } - + inline void BoxPlacer::setXRange(float r1, float r2) { _x_range.minimum = r1; @@ -119,12 +119,12 @@ namespace osgParticle { return _y_range; } - + inline void BoxPlacer::setYRange(const rangef& r) { _y_range = r; } - + inline void BoxPlacer::setYRange(float r1, float r2) { _y_range.minimum = r1; @@ -140,7 +140,7 @@ namespace osgParticle { _z_range = r; } - + inline void BoxPlacer::setZRange(float r1, float r2) { _z_range.minimum = r1; @@ -150,13 +150,13 @@ namespace osgParticle inline void BoxPlacer::place(Particle* P) const { osg::Vec3 pos( - getCenter().x() + _x_range.get_random(), - getCenter().y() + _y_range.get_random(), + getCenter().x() + _x_range.get_random(), + getCenter().y() + _y_range.get_random(), getCenter().z() + _z_range.get_random()); - + P->setPosition(pos); } - + inline float BoxPlacer::volume() const { return (_x_range.maximum - _x_range.minimum) * diff --git a/include/osgParticle/CenteredPlacer b/include/osgParticle/CenteredPlacer index 0ab9604dd..8a2c27c95 100644 --- a/include/osgParticle/CenteredPlacer +++ b/include/osgParticle/CenteredPlacer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -30,49 +30,49 @@ namespace osgParticle public: inline CenteredPlacer(); inline CenteredPlacer(const CenteredPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + virtual const char* libraryName() const { return "osgParticle"; } virtual const char* className() const { return "CenteredPlacer"; } - virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj) != 0; } - + virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj) != 0; } + /// Get the center point. inline const osg::Vec3& getCenter() const; - + /// Set the center point. inline void setCenter(const osg::Vec3& v); - + /// Set the center point. inline void setCenter(float x, float y, float z); - + protected: virtual ~CenteredPlacer() {} - + private: osg::Vec3 center_; }; - + // INLINE FUNCTIONS - + inline CenteredPlacer::CenteredPlacer() : Placer(), center_(0, 0, 0) { } - + inline CenteredPlacer::CenteredPlacer(const CenteredPlacer& copy, const osg::CopyOp& copyop) : Placer(copy, copyop), center_(copy.center_) { } - + inline const osg::Vec3& CenteredPlacer::getCenter() const { return center_; } - + inline void CenteredPlacer::setCenter(const osg::Vec3& v) { center_ = v; } - + inline void CenteredPlacer::setCenter(float x, float y, float z) { center_.set(x, y, z); diff --git a/include/osgParticle/CompositePlacer b/include/osgParticle/CompositePlacer index 226835cd1..9baab8120 100644 --- a/include/osgParticle/CompositePlacer +++ b/include/osgParticle/CompositePlacer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -27,46 +27,46 @@ class CompositePlacer : public Placer { public: CompositePlacer() : Placer() {} - + CompositePlacer( const CompositePlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : Placer(copy, copyop), _placers(copy._placers) {} - + META_Object( osgParticle, CompositePlacer ); - + // Set a child placer at specific index void setPlacer( unsigned int i, Placer* p ) { if (i<_placers.size()) _placers[i] = p; else addPlacer(p); } - + /// Add a child placer void addPlacer( Placer* p ) { _placers.push_back(p); } - + /// Remove a child placer void removePlacer( unsigned int i ) { if (i<_placers.size()) _placers.erase(_placers.begin()+i); } - + /// Get a child placer Placer* getPlacer( unsigned int i ) { return _placers[i].get(); } const Placer* getPlacer( unsigned int i ) const { return _placers[i].get(); } - + /// Get number of placers unsigned int getNumPlacers() const { return _placers.size(); } - + /// Place a particle. Do not call it manually. inline void place( Particle* P ) const; - + /// return the volume of the box inline float volume() const; - + /// return the control position inline osg::Vec3 getControlPosition() const; - + protected: virtual ~CompositePlacer() {} CompositePlacer& operator=( const CompositePlacer& ) { return *this; } - + typedef std::vector< osg::ref_ptr > PlacerList; PlacerList _placers; }; diff --git a/include/osgParticle/ConnectedParticleSystem b/include/osgParticle/ConnectedParticleSystem index 5df957204..89550a6a8 100644 --- a/include/osgParticle/ConnectedParticleSystem +++ b/include/osgParticle/ConnectedParticleSystem @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,57 +19,57 @@ namespace osgParticle { - /** ConnectConnectedParticleSystem is a specialise ConnectedParticleSystem for effects + /** ConnectConnectedParticleSystem is a specialise ConnectedParticleSystem for effects * like missle trails, where the individual particles are rendered as - * single ribbon. + * single ribbon. */ class OSGPARTICLE_EXPORT ConnectedParticleSystem: public osgParticle::ParticleSystem { public: - + ConnectedParticleSystem(); ConnectedParticleSystem(const ConnectedParticleSystem& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Object(osgParticle, ConnectedParticleSystem); - + /// Create a new particle from the specified template (or the default one if ptemplate is null). virtual Particle* createParticle(const Particle* ptemplate); - + /// Reuse the i-th particle. virtual void reuseParticle(int i); - + /// Draw the connected particles as either a line or a quad strip, depending upon viewing distance. . virtual void drawImplementation(osg::RenderInfo& renderInfo) const; - + ///Get the (const) particle from where the line or quadstrip starts to be drawn const osgParticle::Particle* getStartParticle() const { return (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0; } - + ///Get the particle from where the line or quadstrip starts to be drawn osgParticle::Particle* getStartParticle() { return (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0; } - + ///Set the maximum numbers of particles to be skipped during the predraw filtering void setMaxNumberOfParticlesToSkip(unsigned int maxNumberofParticlesToSkip){_maxNumberOfParticlesToSkip = maxNumberofParticlesToSkip;} - + ///Get the maximum numbers of particles to be skipped during the predraw filtering unsigned int getMaxNumberOfParticlesToSkip(){ return _maxNumberOfParticlesToSkip;} - + protected: virtual ~ConnectedParticleSystem(); ConnectedParticleSystem& operator=(const ConnectedParticleSystem&) { return *this; } - + int _lastParticleCreated; unsigned int _maxNumberOfParticlesToSkip; - + int _startParticle; - + }; diff --git a/include/osgParticle/ConstantRateCounter b/include/osgParticle/ConstantRateCounter index 63565a9db..6ea677514 100644 --- a/include/osgParticle/ConstantRateCounter +++ b/include/osgParticle/ConstantRateCounter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ namespace osgParticle class ConstantRateCounter: public Counter { public: ConstantRateCounter(): - Counter(), + Counter(), _minimumNumberOfParticlesToCreate(0), _numberOfParticlesPerSecondToCreate(0), _carryOver(0) @@ -33,19 +33,19 @@ namespace osgParticle } ConstantRateCounter(const ConstantRateCounter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY): - Counter(copy, copyop), + Counter(copy, copyop), _minimumNumberOfParticlesToCreate(copy._minimumNumberOfParticlesToCreate), _numberOfParticlesPerSecondToCreate(copy._numberOfParticlesPerSecondToCreate), _carryOver(copy._carryOver) { } - - + + META_Object(osgParticle, ConstantRateCounter); - + void setMinimumNumberOfParticlesToCreate(int minNumToCreate) { _minimumNumberOfParticlesToCreate = minNumToCreate; } int getMinimumNumberOfParticlesToCreate() const { return _minimumNumberOfParticlesToCreate; } - + void setNumberOfParticlesPerSecondToCreate(double numPerSecond) { _numberOfParticlesPerSecondToCreate = numPerSecond; } double getNumberOfParticlesPerSecondToCreate() const { return _numberOfParticlesPerSecondToCreate; } @@ -62,15 +62,15 @@ namespace osgParticle } return osg::maximum(_minimumNumberOfParticlesToCreate, i); } - + protected: virtual ~ConstantRateCounter() {} - + int _minimumNumberOfParticlesToCreate; double _numberOfParticlesPerSecondToCreate; mutable double _carryOver; }; - + } diff --git a/include/osgParticle/Counter b/include/osgParticle/Counter index 36fc9e7ec..071ebc708 100644 --- a/include/osgParticle/Counter +++ b/include/osgParticle/Counter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -36,14 +36,14 @@ namespace osgParticle ~Counter() {} Counter &operator=(const Counter &) { return *this; } }; - + // INLINE FUNCTIONS - + inline Counter::Counter() : osg::Object() { } - + inline Counter::Counter(const Counter& copy, const osg::CopyOp& copyop) : osg::Object(copy, copyop) { diff --git a/include/osgParticle/DampingOperator b/include/osgParticle/DampingOperator index 38bca8ba7..747631456 100644 --- a/include/osgParticle/DampingOperator +++ b/include/osgParticle/DampingOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -30,44 +30,44 @@ class DampingOperator : public Operator public: DampingOperator() : Operator(), _cutoffLow(0.0f), _cutoffHigh(FLT_MAX) { _damping.set(1.0f, 1.0f, 1.0f); } - + DampingOperator( const DampingOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : Operator(copy, copyop), _damping(copy._damping), _cutoffLow(copy._cutoffLow), _cutoffHigh(copy._cutoffHigh) {} - + META_Object( osgParticle, DampingOperator ); - + /// Set the damping factors void setDamping( float x, float y, float z ) { _damping.set(x, y, z); } void setDamping( const osg::Vec3& damping ) { _damping = damping; } - + /// Set the damping factors to one value void setDamping( float x ) { _damping.set(x, x, x); } - + /// Get the damping factors void getDamping( float& x, float& y, float& z ) const { x = _damping.x(); y = _damping.y(); z = _damping.z(); } - + const osg::Vec3& getDamping() const { return _damping; } - + /// Set the velocity cutoff factors void setCutoff( float low, float high ) { _cutoffLow = low; _cutoffHigh = high; } void setCutoffLow( float low ) { _cutoffLow = low; } void setCutoffHigh( float low ) { _cutoffHigh = low; } - + /// Get the velocity cutoff factors void getCutoff( float& low, float& high ) const { low = _cutoffLow; high = _cutoffHigh; } float getCutoffLow() const { return _cutoffLow; } float getCutoffHigh() const { return _cutoffHigh; } - + /// Apply the acceleration to a particle. Do not call this method manually. inline void operate( Particle* P, double dt ); - + protected: virtual ~DampingOperator() {} DampingOperator& operator=( const DampingOperator& ) { return *this; } - + osg::Vec3 _damping; float _cutoffLow; float _cutoffHigh; diff --git a/include/osgParticle/DomainOperator b/include/osgParticle/DomainOperator index f7c9e087b..9c58c42fb 100644 --- a/include/osgParticle/DomainOperator +++ b/include/osgParticle/DomainOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -44,7 +44,7 @@ public: BOX_DOMAIN, DISK_DOMAIN }; - + Domain( Type t ) : r1(0.0f), r2(0.0f), type(t) {} osg::Plane plane; osg::Vec3 v1; @@ -56,70 +56,70 @@ public: float r2; Type type; }; - + DomainOperator() : Operator() {} - + DomainOperator( const DomainOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : Operator(copy, copyop), _domains(copy._domains), _backupDomains(copy._backupDomains) {} - + META_Object( osgParticle, DomainOperator ); - + /// Add a point domain inline void addPointDomain( const osg::Vec3& p ); - + /// Add a line segment domain inline void addLineSegmentDomain( const osg::Vec3& v1, const osg::Vec3& v2 ); - + /// Add a triangle domain inline void addTriangleDomain( const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3 ); - + /// Add a rectangle domain inline void addRectangleDomain( const osg::Vec3& corner, const osg::Vec3& w, const osg::Vec3& h ); - + /// Add a plane domain inline void addPlaneDomain( const osg::Plane& plane ); - + /// Add a sphere domain inline void addSphereDomain( const osg::Vec3& c, float r ); - + /// Add a box domain inline void addBoxDomain( const osg::Vec3& min, const osg::Vec3& max ); - + /// Add a disk domain inline void addDiskDomain( const osg::Vec3& c, const osg::Vec3& n, float r1, float r2=0.0f ); - + /// Add a domain object directly, used by the .osg wrappers and serializers. void addDomain( const Domain& domain ) { _domains.push_back(domain); } - + /// Get a domain object directly, used by the .osg wrappers and serializers. const Domain& getDomain( unsigned int i ) const { return _domains[i]; } - + /// Remove a domain at specific index void removeDomain( unsigned int i ) { if (i<_domains.size()) _domains.erase(_domains.begin() + i); } - + /// Remove all existing domains void removeAllDomains() { _domains.clear(); } - + /// Get number of domains unsigned int getNumDomains() const { return _domains.size(); } - + /// Apply the acceleration to a particle. Do not call this method manually. void operate( Particle* P, double dt ); - + /// Perform some initializations. Do not call this method manually. void beginOperate( Program* prg ); - + /// Perform some post-operations. Do not call this method manually. void endOperate(); - + protected: virtual ~DomainOperator() {} DomainOperator& operator=( const DomainOperator& ) { return *this; } - + virtual void handlePoint( const Domain& domain, Particle* P, double dt ) { ignore("Point"); } virtual void handleLineSegment( const Domain& domain, Particle* P, double dt ) { ignore("LineSegment"); } virtual void handleTriangle( const Domain& domain, Particle* P, double dt ) { ignore("Triangle"); } @@ -128,10 +128,10 @@ protected: virtual void handleSphere( const Domain& domain, Particle* P, double dt ) { ignore("Sphere"); } virtual void handleBox( const Domain& domain, Particle* P, double dt ) { ignore("Box"); } virtual void handleDisk( const Domain& domain, Particle* P, double dt ) { ignore("Disk"); } - + inline void computeNewBasis( const osg::Vec3&, const osg::Vec3&, osg::Vec3&, osg::Vec3& ); inline void ignore( const std::string& func ); - + std::vector _domains; std::vector _backupDomains; }; @@ -217,7 +217,7 @@ inline void DomainOperator::computeNewBasis( const osg::Vec3& u, const osg::Vec3 float det = w.z()*u.x()*v.y() - w.z()*u.y()*v.x() - u.z()*w.x()*v.y() - u.x()*v.z()*w.y() + v.z()*w.x()*u.y() + u.z()*v.x()*w.y(); det = 1.0f / det; - + s1.set( v.y()*w.z() - v.z()*w.y(), v.z()*w.x() - v.x()*w.z(), v.x()*w.y() - v.y()*w.x() ); s1 = s1 * det; s2.set( u.y()*w.z() - u.z()*w.y(), u.z()*w.x() - u.x()*w.z(), u.x()*w.y() - u.y()*w.x() ); diff --git a/include/osgParticle/Emitter b/include/osgParticle/Emitter index 4c8340457..a433e6832 100644 --- a/include/osgParticle/Emitter +++ b/include/osgParticle/Emitter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -41,16 +41,16 @@ namespace osgParticle virtual const char* className() const { return "Emitter"; } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj) != 0; } virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } } - + /// Get the particle template. inline const Particle& getParticleTemplate() const; - + /// Set the particle template (particle is copied). inline void setParticleTemplate(const Particle& p); - + /// Return whether the particle system's default template should be used. inline bool getUseDefaultTemplate() const; - + /** Set whether the default particle template should be used. When this flag is true, the particle template is ignored, and the particle system's default template is used instead. @@ -60,11 +60,11 @@ namespace osgParticle protected: virtual ~Emitter() {} Emitter& operator=(const Emitter&) { return *this; } - + inline void process(double dt); - + virtual void emitParticles(double dt) = 0; - + bool _usedeftemp; Particle _ptemp; }; diff --git a/include/osgParticle/ExplosionDebrisEffect b/include/osgParticle/ExplosionDebrisEffect index 521b84792..919d1509b 100644 --- a/include/osgParticle/ExplosionDebrisEffect +++ b/include/osgParticle/ExplosionDebrisEffect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,19 +24,19 @@ namespace osgParticle class OSGPARTICLE_EXPORT ExplosionDebrisEffect : public ParticleEffect { public: - + explicit ExplosionDebrisEffect(bool automaticSetup=true); ExplosionDebrisEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f); - + ExplosionDebrisEffect(const ExplosionDebrisEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Node(osgParticle,ExplosionDebrisEffect); - + virtual void setDefaults(); virtual void setUpEmitterAndProgram(); - + virtual Emitter* getEmitter() { return _emitter.get(); } virtual const Emitter* getEmitter() const { return _emitter.get(); } diff --git a/include/osgParticle/ExplosionEffect b/include/osgParticle/ExplosionEffect index 39ce0838f..ce9dbcc94 100644 --- a/include/osgParticle/ExplosionEffect +++ b/include/osgParticle/ExplosionEffect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,15 +24,15 @@ namespace osgParticle class OSGPARTICLE_EXPORT ExplosionEffect : public ParticleEffect { public: - + explicit ExplosionEffect(bool automaticSetup=true); ExplosionEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f); - + ExplosionEffect(const ExplosionEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Node(osgParticle,ExplosionEffect); - + virtual void setDefaults(); virtual void setUpEmitterAndProgram(); @@ -42,7 +42,7 @@ namespace osgParticle virtual Program* getProgram() { return _program.get(); } virtual const Program* getProgram() const { return _program.get(); } - + protected: virtual ~ExplosionEffect() {} diff --git a/include/osgParticle/ExplosionOperator b/include/osgParticle/ExplosionOperator index b781fc6d3..f6f29bee9 100644 --- a/include/osgParticle/ExplosionOperator +++ b/include/osgParticle/ExplosionOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -34,55 +34,55 @@ public: _magnitude(1.0f), _epsilon(1e-3), _sigma(1.0f), _inexp(0.0f), _outexp(0.0f) {} - + ExplosionOperator( const ExplosionOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : Operator(copy, copyop), _center(copy._center), _radius(copy._radius), _magnitude(copy._magnitude), _epsilon(copy._epsilon), _sigma(copy._sigma), _inexp(copy._inexp), _outexp(copy._outexp) {} - + META_Object( osgParticle, ExplosionOperator ); - + /// Set the center of shock wave void setCenter( const osg::Vec3& c ) { _center = c; } - + /// Get the center of shock wave const osg::Vec3& getCenter() const { return _center; } - + /// Set the radius of wave peak void setRadius( float r ) { _radius = r; } - + /// Get the radius of wave peak float getRadius() const { return _radius; } - + /// Set the acceleration scale void setMagnitude( float mag ) { _magnitude = mag; } - + /// Get the acceleration scale float getMagnitude() const { return _magnitude; } - + /// Set the acceleration epsilon void setEpsilon( float eps ) { _epsilon = eps; } - + /// Get the acceleration epsilon float getEpsilon() const { return _epsilon; } - + /// Set broadness of the strength of the wave void setSigma( float s ) { _sigma = s; } - + /// Get broadness of the strength of the wave float getSigma() const { return _sigma; } - + /// Apply the acceleration to a particle. Do not call this method manually. inline void operate( Particle* P, double dt ); - + /// Perform some initializations. Do not call this method manually. inline void beginOperate( Program* prg ); - + protected: virtual ~ExplosionOperator() {} ExplosionOperator& operator=( const ExplosionOperator& ) { return *this; } - + osg::Vec3 _center; osg::Vec3 _xf_center; float _radius; @@ -115,7 +115,7 @@ inline void ExplosionOperator::beginOperate( Program* prg ) { _xf_center = _center; } - + float oneOverSigma = (_sigma!=0.0f ? (1.0f / _sigma) : 1.0f); _inexp = -0.5f * oneOverSigma * oneOverSigma; _outexp = oneOverSigma / sqrt(osg::PI * 2.0f); diff --git a/include/osgParticle/Export b/include/osgParticle/Export index c910514c6..37989eb19 100644 --- a/include/osgParticle/Export +++ b/include/osgParticle/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -39,7 +39,7 @@ #else # define OSGPARTICLE_EXPORT #endif - + /** \namespace osgParticle diff --git a/include/osgParticle/FireEffect b/include/osgParticle/FireEffect index 852eeb297..bca429735 100644 --- a/include/osgParticle/FireEffect +++ b/include/osgParticle/FireEffect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,17 +24,17 @@ namespace osgParticle class OSGPARTICLE_EXPORT FireEffect : public ParticleEffect { public: - + explicit FireEffect(bool automaticSetup=true); - + FireEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f); - + FireEffect(const FireEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Node(osgParticle,FireEffect); - + virtual void setDefaults(); - + virtual void setUpEmitterAndProgram(); virtual Emitter* getEmitter() { return _emitter.get(); } @@ -42,9 +42,9 @@ namespace osgParticle virtual Program* getProgram() { return _program.get(); } virtual const Program* getProgram() const { return _program.get(); } - + protected: - + virtual ~FireEffect() {} osg::ref_ptr _emitter; diff --git a/include/osgParticle/FluidFrictionOperator b/include/osgParticle/FluidFrictionOperator index 27b66ee59..8e4bdf139 100644 --- a/include/osgParticle/FluidFrictionOperator +++ b/include/osgParticle/FluidFrictionOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -25,62 +25,62 @@ namespace osgParticle { - class Particle; + class Particle; /** An operator that simulates the friction of a fluid. By using this operator you can let the particles move in a fluid of a given density and viscosity. There are two functions to quickly setup the parameters for pure water - and air. You can decide whether to compute the forces using the particle's physical + and air. You can decide whether to compute the forces using the particle's physical radius or another value, by calling the setOverrideRadius() method. */ class OSGPARTICLE_EXPORT FluidFrictionOperator: public Operator { public: - + FluidFrictionOperator(); FluidFrictionOperator(const FluidFrictionOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + META_Object(osgParticle, FluidFrictionOperator); - + /// Set the density of the fluid. inline void setFluidDensity(float d); /// Get the density of the fluid. inline float getFluidDensity() const; - + /// Set the viscosity of the fluid. inline void setFluidViscosity(float v); - + /// Get the viscosity of the fluid. inline float getFluidViscosity() const; - + /// Set the wind vector. inline void setWind(const osg::Vec3& wind) { _wind = wind; } - + /// Get the wind vector. inline const osg::Vec3& getWind() const { return _wind; } - + /// Set the overriden radius value (pass 0 if you want to use particle's radius). inline void setOverrideRadius(float r); /// Get the overriden radius value. - inline float getOverrideRadius() const; - + inline float getOverrideRadius() const; + /// Set the fluid parameters as for air (20°C temperature). inline void setFluidToAir(); - + /// Set the fluid parameters as for pure water (20°C temperature). inline void setFluidToWater(); - + /// Apply the friction forces to a particle. Do not call this method manually. void operate(Particle* P, double dt); - + /// Perform some initializations. Do not call this method manually. inline void beginOperate(Program* prg); - + protected: virtual ~FluidFrictionOperator() {} FluidFrictionOperator &operator=(const FluidFrictionOperator &) { return *this; } - + private: float _coeff_A; float _coeff_B; @@ -90,9 +90,9 @@ namespace osgParticle osg::Vec3 _wind; Program* _current_program; }; - + // INLINE FUNCTIONS - + inline float FluidFrictionOperator::getFluidDensity() const { return _density; @@ -102,7 +102,7 @@ namespace osgParticle { return _viscosity; } - + inline void FluidFrictionOperator::setFluidDensity(float d) { _density = d; @@ -114,7 +114,7 @@ namespace osgParticle _viscosity = v; _coeff_A = 6 * osg::PI * _viscosity; } - + inline void FluidFrictionOperator::setFluidToAir() { setFluidViscosity(1.8e-5f); @@ -126,17 +126,17 @@ namespace osgParticle setFluidViscosity(1.002e-3f); setFluidDensity(1.0f); } - + inline float FluidFrictionOperator::getOverrideRadius() const { return _ovr_rad; } - + inline void FluidFrictionOperator::setOverrideRadius(float r) { _ovr_rad = r; } - + inline void FluidFrictionOperator::beginOperate(Program* prg) { _current_program = prg; diff --git a/include/osgParticle/FluidProgram b/include/osgParticle/FluidProgram index 53b6a5bf5..08d223ec2 100644 --- a/include/osgParticle/FluidProgram +++ b/include/osgParticle/FluidProgram @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,24 +26,24 @@ namespace osgParticle { /** A program class for performing operations on particles using a sequence of operators. - To use a FluidProgram you have to create some Operator objects and + To use a FluidProgram you have to create some Operator objects and add them to the program. All operators will be applied to each particle in the same order they've been added to the program. - */ + */ class OSGPARTICLE_EXPORT FluidProgram: public Program { public: FluidProgram(); FluidProgram(const FluidProgram& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + META_Node(osgParticle,FluidProgram); - + /// Set the viscosity of the fluid. inline void setFluidViscosity(float v) { _viscosity = v; _viscosityCoefficient = 6 * osg::PI * _viscosity; } - + /// Get the viscosity of the fluid. inline float getFluidViscosity() const { return _viscosity; } @@ -56,17 +56,17 @@ namespace osgParticle /// Get the density of the fluid. inline float getFluidDensity() const { return _density; } - - + + /// Set the wind vector. inline void setWind(const osg::Vec3& wind) { _wind = wind; } - + /// Get the wind vector. inline const osg::Vec3& getWind() const { return _wind; } - + /// Set the acceleration vector. inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; } - + /// Get the acceleration vector. inline const osg::Vec3& getAcceleration() const { return _acceleration; } @@ -82,7 +82,7 @@ namespace osgParticle setFluidDensity(1.2929f); setFluidViscosity(1.8e-5f); } - + /// Set the fluid parameters as for pure water (20°C temperature). inline void setFluidToWater() { @@ -90,13 +90,13 @@ namespace osgParticle setFluidDensity(1.0f); setFluidViscosity(1.002e-3f); } - + protected: virtual ~FluidProgram() {} FluidProgram& operator=(const FluidProgram&) { return *this; } - + virtual void execute(double dt); osg::Vec3 _acceleration; @@ -107,7 +107,7 @@ namespace osgParticle float _viscosityCoefficient; float _densityCoefficient; }; - + } diff --git a/include/osgParticle/ForceOperator b/include/osgParticle/ForceOperator index 3daba27f5..06db43021 100644 --- a/include/osgParticle/ForceOperator +++ b/include/osgParticle/ForceOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -34,57 +34,57 @@ namespace osgParticle public: inline ForceOperator(); inline ForceOperator(const ForceOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + META_Object(osgParticle, ForceOperator); - + /// Get the force vector. inline const osg::Vec3& getForce() const; - + /// Set the force vector. inline void setForce(const osg::Vec3& f); - + /// Apply the force to a particle. Do not call this method manually. inline void operate(Particle* P, double dt); - + /// Perform some initialization. Do not call this method manually. inline void beginOperate(Program *prg); - + protected: virtual ~ForceOperator() {}; - ForceOperator& operator=(const ForceOperator&) { return *this; } - + ForceOperator& operator=(const ForceOperator&) { return *this; } + private: osg::Vec3 _force; osg::Vec3 _xf_force; }; - + // INLINE FUNCTIONS - + inline ForceOperator::ForceOperator() : Operator(), _force(0, 0, 0) - { + { } - + inline ForceOperator::ForceOperator(const ForceOperator& copy, const osg::CopyOp& copyop) : Operator(copy, copyop), _force(copy._force) { } - + inline const osg::Vec3& ForceOperator::getForce() const { return _force; } - + inline void ForceOperator::setForce(const osg::Vec3& v) { _force = v; } - + inline void ForceOperator::operate(Particle* P, double dt) { P->addVelocity(_xf_force * (P->getMassInv() * dt)); } - + inline void ForceOperator::beginOperate(Program *prg) { if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) { diff --git a/include/osgParticle/Interpolator b/include/osgParticle/Interpolator index bebb0fb98..36f6da24c 100644 --- a/include/osgParticle/Interpolator +++ b/include/osgParticle/Interpolator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -31,17 +31,17 @@ namespace osgParticle public: Interpolator() : osg::Object() {} - + Interpolator(const Interpolator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) : osg::Object(copy, copyop) {} - + virtual const char* libraryName() const { return "osgParticle"; } virtual const char* className() const { return "Interpolator"; } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj) != 0; } - + /// Interpolate between floats. Must be overriden in descendant classes. - virtual float interpolate(float t, float y1, float y2) const = 0; - + virtual float interpolate(float t, float y1, float y2) const = 0; + /// Interpolate between 2-dimensional vectors. Default behavior is to interpolate each component separately. virtual osg::Vec2 interpolate(float t, const osg::Vec2& y1, const osg::Vec2& y2) const { @@ -60,7 +60,7 @@ namespace osgParticle interpolate(t, y1.z(), y2.z()) ); } - + /// Interpolate between 4-dimensional vectors. Default behavior is to interpolate each component separately. virtual osg::Vec4 interpolate(float t, const osg::Vec4& y1, const osg::Vec4& y2) const { @@ -71,13 +71,13 @@ namespace osgParticle interpolate(t, y1.w(), y2.w()) ); } - + template ValueType interpolate(float t, const range& r) const { return interpolate(t, r.minimum, r.maximum); } - + protected: virtual ~Interpolator() {} }; diff --git a/include/osgParticle/LinearInterpolator b/include/osgParticle/LinearInterpolator index 83fb9987f..c44e26356 100644 --- a/include/osgParticle/LinearInterpolator +++ b/include/osgParticle/LinearInterpolator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -31,17 +31,17 @@ namespace osgParticle public: LinearInterpolator() : Interpolator() {} - + LinearInterpolator(const LinearInterpolator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) : Interpolator(copy, copyop) {} - + META_Object(osgParticle, LinearInterpolator); - + virtual float interpolate(float t, float y1, float y2) const { return y1 + (y2 - y1) * t; } - + protected: virtual ~LinearInterpolator() {} }; diff --git a/include/osgParticle/ModularEmitter b/include/osgParticle/ModularEmitter index a9584f782..98dab01e3 100644 --- a/include/osgParticle/ModularEmitter +++ b/include/osgParticle/ModularEmitter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -36,8 +36,8 @@ namespace osgParticle /** An emitter class that holds three objects to control the creation of particles. These objects are a counter, a placer and a shooter. - The counter controls the number of particles to be emitted at each frame; - the placer must initialize the particle's position vector, while the shooter initializes + The counter controls the number of particles to be emitted at each frame; + the placer must initialize the particle's position vector, while the shooter initializes its velocity vector. You can use the predefined counter/placer/shooter classes, or you can create your own. */ @@ -45,18 +45,18 @@ namespace osgParticle public: ModularEmitter(); ModularEmitter(const ModularEmitter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + META_Node(osgParticle,ModularEmitter); - + /// Get the counter object. inline Counter* getCounter(); - + /// Get the const Counter object. inline const Counter* getCounter() const; - + /// Set the Counter object. inline void setCounter(Counter* c); - + /// Get the ratio between number of particle to create in compensation for movement of the emitter inline float getNumParticlesToCreateMovementCompensationRatio() const; @@ -66,43 +66,43 @@ namespace osgParticle /// Get the Placer object. inline Placer* getPlacer(); - - /// Get the const Placer object. + + /// Get the const Placer object. inline const Placer* getPlacer() const; - + /// Set the Placer object. inline void setPlacer(Placer* p); - + /// Get the Shooter object. inline Shooter *getShooter(); - + /// Get the const Shooter object. inline const Shooter *getShooter() const; - + /// Set the Shooter object. - inline void setShooter(Shooter *s); + inline void setShooter(Shooter *s); protected: virtual ~ModularEmitter() {} ModularEmitter &operator=(const ModularEmitter &) { return *this; } - + virtual void emitParticles(double dt); - + private: - + float _numParticleToCreateMovementCompensationRatio; osg::ref_ptr _counter; osg::ref_ptr _placer; osg::ref_ptr _shooter; }; - + // INLINE FUNCTIONS - + inline Counter* ModularEmitter::getCounter() { return _counter.get(); } - + inline const Counter* ModularEmitter::getCounter() const { return _counter.get(); @@ -152,7 +152,7 @@ namespace osgParticle { _shooter = s; } - + } #endif diff --git a/include/osgParticle/ModularProgram b/include/osgParticle/ModularProgram index 537fcc6e2..9f72ea1ad 100644 --- a/include/osgParticle/ModularProgram +++ b/include/osgParticle/ModularProgram @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -28,46 +28,46 @@ namespace osgParticle { /** A program class for performing operations on particles using a sequence of operators. - To use a ModularProgram you have to create some Operator objects and + To use a ModularProgram you have to create some Operator objects and add them to the program. All operators will be applied to each particle in the same order they've been added to the program. - */ + */ class OSGPARTICLE_EXPORT ModularProgram: public Program { public: ModularProgram(); ModularProgram(const ModularProgram& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + META_Node(osgParticle,ModularProgram); - + /// Get the number of operators. inline int numOperators() const; - - /// Add an operator to the list. + + /// Add an operator to the list. inline void addOperator(Operator* o); - + /// Get a pointer to an operator in the list. inline Operator* getOperator(int i); - + /// Get a const pointer to an operator in the list. inline const Operator* getOperator(int i) const; - + /// Remove an operator from the list. - inline void removeOperator(int i); - + inline void removeOperator(int i); + protected: virtual ~ModularProgram() {} ModularProgram& operator=(const ModularProgram&) { return *this; } - + void execute(double dt); - + private: typedef std::vector > Operator_vector; Operator_vector _operators; }; - + // INLINE FUNCTIONS - + inline int ModularProgram::numOperators() const { return static_cast(_operators.size()); @@ -92,7 +92,7 @@ namespace osgParticle { _operators.erase(_operators.begin()+i); } - + } diff --git a/include/osgParticle/MultiSegmentPlacer b/include/osgParticle/MultiSegmentPlacer index 19e103319..1c733ef45 100644 --- a/include/osgParticle/MultiSegmentPlacer +++ b/include/osgParticle/MultiSegmentPlacer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -42,50 +42,50 @@ namespace osgParticle { /// Get the number of vertices which define the segments. inline int numVertices() const; - + /// Get a vertex. inline const osg::Vec3& getVertex(int i) const; - + /// Set a vertex. inline void setVertex(int i, const osg::Vec3& v); - + /// Set a vertex. inline void setVertex(int i, float x, float y, float z); - + /// Add a vertex. inline void addVertex(const osg::Vec3& v); - + /// Add a vertex. inline void addVertex(float x, float y, float z); - + /// Remove a vertex. inline void removeVertex(int i); - + /// Place a partice. Called automatically by ModularEmitter, do not call this method manually. void place(Particle* P) const; /// return the length of the multi-segment inline float volume() const; - + /// return the control position inline osg::Vec3 getControlPosition() const; protected: virtual ~MultiSegmentPlacer() {} - MultiSegmentPlacer& operator=(const MultiSegmentPlacer&) { return *this; } + MultiSegmentPlacer& operator=(const MultiSegmentPlacer&) { return *this; } private: typedef std::pair Vertex_data; typedef std::vector Vertex_vector; - + Vertex_vector _vx; float _total_length; - + void recompute_length(); }; // INLINE FUNCTIONS - + inline int MultiSegmentPlacer::numVertices() const { @@ -111,12 +111,12 @@ namespace osgParticle { inline void MultiSegmentPlacer::addVertex(const osg::Vec3& v) { - float l = 0; + float l = 0; if (_vx.size() > 0) { l = (v - _vx.back().first).length(); - } + } _total_length += l; - _vx.push_back(std::make_pair(v, _total_length)); + _vx.push_back(std::make_pair(v, _total_length)); } inline void MultiSegmentPlacer::addVertex(float x, float y, float z) @@ -129,12 +129,12 @@ namespace osgParticle { _vx.erase(_vx.begin()+i); recompute_length(); } - + inline float MultiSegmentPlacer::volume() const { return _total_length; } - + inline osg::Vec3 MultiSegmentPlacer::getControlPosition() const { return _vx.empty() ? osg::Vec3(0.0f,0.0f,0.0f) : _vx[0].first; diff --git a/include/osgParticle/Operator b/include/osgParticle/Operator index 2bd08bee5..bd9e65228 100644 --- a/include/osgParticle/Operator +++ b/include/osgParticle/Operator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -27,12 +27,12 @@ namespace osgParticle // forward declaration to avoid including the whole header file class Particle; - /** An abstract base class used by ModularProgram to perform operations on particles before they are updated. + /** An abstract base class used by ModularProgram to perform operations on particles before they are updated. To implement a new operator, derive from this class and override the operate() method. You should also override the beginOperate() method to query the calling program for the reference frame used, and initialize the right transformations if needed. */ - class Operator: public osg::Object { + class Operator: public osg::Object { public: inline Operator(); inline Operator(const Operator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); @@ -40,13 +40,13 @@ namespace osgParticle virtual const char* libraryName() const { return "osgParticle"; } virtual const char* className() const { return "Operator"; } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj) != 0; } - + /// Get whether this operator is enabled. inline bool isEnabled() const; - + /// Enable or disable this operator. inline void setEnabled(bool v); - + /** Do something on all emitted particles. This method is called by ModularProgram objects to perform some operations on the particles. By default, it will call the operate() method for each particle. @@ -61,49 +61,49 @@ namespace osgParticle if (P->isAlive() && isEnabled()) operate(P, dt); } } - - /** Do something on a particle. + + /** Do something on a particle. You must override it in descendant classes. Common operations consist of modifying the particle's velocity vector. The dt parameter is - the time elapsed from last operation. + the time elapsed from last operation. */ virtual void operate(Particle* P, double dt) = 0; - + /** Do something before processing particles via the operate() method. Overriding this method could be necessary to query the calling Program object for the current reference frame. If the reference frame is RELATIVE_RF, then your class should prepare itself to do all operations in local coordinates. */ virtual void beginOperate(Program *) {} - + /// Do something after all particles have been processed. virtual void endOperate() {} protected: virtual ~Operator() {} Operator &operator=(const Operator &) { return *this; } - + private: - bool _enabled; + bool _enabled; }; - + // INLINE FUNCTIONS - + inline Operator::Operator() : osg::Object(), _enabled(true) { } - + inline Operator::Operator(const Operator& copy, const osg::CopyOp& copyop) : osg::Object(copy, copyop), _enabled(copy._enabled) { } - - inline bool Operator::isEnabled() const + + inline bool Operator::isEnabled() const { return _enabled; } - + inline void Operator::setEnabled(bool v) { _enabled = v; diff --git a/include/osgParticle/OrbitOperator b/include/osgParticle/OrbitOperator index 67a6dcf9d..be2bbfd47 100644 --- a/include/osgParticle/OrbitOperator +++ b/include/osgParticle/OrbitOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -32,48 +32,48 @@ public: OrbitOperator() : Operator(), _magnitude(1.0f), _epsilon(1e-3), _maxRadius(FLT_MAX) {} - + OrbitOperator( const OrbitOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : Operator(copy, copyop), _center(copy._center), _magnitude(copy._magnitude), _epsilon(copy._epsilon), _maxRadius(copy._maxRadius) {} - + META_Object( osgParticle, OrbitOperator ); - + /// Set the center of orbit void setCenter( const osg::Vec3& c ) { _center = c; } - + /// Get the center of orbit const osg::Vec3& getCenter() const { return _center; } - + /// Set the acceleration scale void setMagnitude( float mag ) { _magnitude = mag; } - + /// Get the acceleration scale float getMagnitude() const { return _magnitude; } - + /// Set the acceleration epsilon void setEpsilon( float eps ) { _epsilon = eps; } - + /// Get the acceleration epsilon float getEpsilon() const { return _epsilon; } - + /// Set max radius between the center and the particle void setMaxRadius( float max ) { _maxRadius = max; } - + /// Get max radius between the center and the particle float getMaxRadius() const { return _maxRadius; } - + /// Apply the acceleration to a particle. Do not call this method manually. inline void operate( Particle* P, double dt ); - + /// Perform some initializations. Do not call this method manually. inline void beginOperate( Program* prg ); - + protected: virtual ~OrbitOperator() {} OrbitOperator& operator=( const OrbitOperator& ) { return *this; } - + osg::Vec3 _center; osg::Vec3 _xf_center; float _magnitude; diff --git a/include/osgParticle/Particle b/include/osgParticle/Particle index e5a6f9a52..0464ccf47 100644 --- a/include/osgParticle/Particle +++ b/include/osgParticle/Particle @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -40,7 +40,7 @@ namespace osgParticle Particles can either live forever (lifeTime < 0), or die after a specified time (lifeTime >= 0). For each property which is defined as a range of values, a "current" value will be evaluated at each frame by interpolating the min - and max values so that curr_value = min when t == 0, and + and max values so that curr_value = min when t == 0, and curr_value = max when t == lifeTime. You may customize the interpolator objects to achieve any kind of transition. If you want the particle to live forever, set its lifetime to any value <= 0; @@ -50,7 +50,7 @@ namespace osgParticle class OSGPARTICLE_EXPORT Particle { friend class ParticleSystem; public: - + enum { INVALID_INDEX = -1 @@ -65,42 +65,42 @@ namespace osgParticle QUAD, // uses GL_QUADS as primitive QUAD_TRIANGLESTRIP, // uses GL_TRI_angleSTRIP as primitive, but each particle needs a glBegin/glEnd pair HEXAGON, // may save some filling time, but uses more triangles - LINE, // uses GL_LINES to draw line segments that point to the direction of motion + LINE, // uses GL_LINES to draw line segments that point to the direction of motion USER // uses a user-defined drawable as primitive }; - + Particle(); /// Get the shape of the particle. inline Shape getShape() const; - + /// Set the shape of the particle. inline void setShape(Shape s); /// Get whether the particle is still alive. inline bool isAlive() const; - + /// Get the life time of the particle (in seconds). inline double getLifeTime() const; - + /// Get the age of the particle (in seconds). inline double getAge() const; - + /// Get the minimum and maximum values for polygon size. inline const rangef& getSizeRange() const; - + /// Get the minimum and maximum values for alpha. inline const rangef& getAlphaRange() const; - + /// Get the minimum and maximum values for color. inline const rangev4& getColorRange() const; - + /// Get the interpolator for computing the size of polygons. inline const Interpolator* getSizeInterpolator() const; - + /// Get the interpolator for computing alpha values. inline const Interpolator* getAlphaInterpolator() const; - + /// Get the interpolator for computing color values. inline const Interpolator* getColorInterpolator() const; @@ -108,42 +108,42 @@ namespace osgParticle For built-in operators to work correctly, lengths must be expressed in meters. */ inline float getRadius() const; - + /** Get the mass of the particle. For built-in operators to work correctly, remember that the mass is expressed in kg. */ inline float getMass() const; - + /// Get 1 / getMass(). inline float getMassInv() const; - + /// Get the position vector. inline const osg::Vec3& getPosition() const; - + /** Get the velocity vector. For built-in operators to work correctly, remember that velocity components are expressed in meters per second. */ - inline const osg::Vec3& getVelocity() const; - + inline const osg::Vec3& getVelocity() const; + /// Get the previous position (the position before last update). inline const osg::Vec3& getPreviousPosition() const; /// Get the angle vector. inline const osg::Vec3& getAngle() const; - + /// Get the rotational velocity vector. inline const osg::Vec3& getAngularVelocity() const; - + /// Get the previous angle vector. inline const osg::Vec3& getPreviousAngle() const; - + /// Get the current color inline const osg::Vec4& getCurrentColor() const { return _current_color; } /// Get the current alpha inline float getCurrentAlpha() const { return _current_alpha; } - + /// Get the s texture coordinate of the bottom left of the particle inline float getSTexCoord() const { return _s_coord; } @@ -152,37 +152,37 @@ namespace osgParticle /// Get width of texture tile inline int getTileS() const; - + /// Get height of texture tile inline int getTileT() const; - + /// Get number of texture tiles inline int getNumTiles() const { return _end_tile - _start_tile + 1; } - + /** Kill the particle on next update - NOTE: after calling this function, the isAlive() method will still + NOTE: after calling this function, the isAlive() method will still return true until the particle is updated again. */ inline void kill(); - + /// Set the life time of the particle. inline void setLifeTime(double t); - + /// Set the minimum and maximum values for polygon size. inline void setSizeRange(const rangef& r); - + /// Set the minimum and maximum values for alpha. inline void setAlphaRange(const rangef& r); - + /// Set the minimum and maximum values for color. inline void setColorRange(const rangev4& r); - + /// Set the interpolator for computing size values. inline void setSizeInterpolator(Interpolator* ri); - - /// Set the interpolator for computing alpha values. + + /// Set the interpolator for computing alpha values. inline void setAlphaInterpolator(Interpolator* ai); - + /// Set the interpolator for computing color values. inline void setColorInterpolator(Interpolator* ci); @@ -190,24 +190,24 @@ namespace osgParticle For built-in operators to work correctly, lengths must be expressed in meters. */ inline void setRadius(float r); - + /** Set the mass of the particle. For built-in operators to work correctly, remember that the mass is expressed in kg. */ inline void setMass(float m); - - /// Set the position vector. + + /// Set the position vector. inline void setPosition(const osg::Vec3& p); - + /** Set the velocity vector. For built-in operators to work correctly, remember that velocity components are expressed in meters per second. */ inline void setVelocity(const osg::Vec3& v); - + /// Add a vector to the velocity vector. inline void addVelocity(const osg::Vec3& dv); - + /// Transform position and velocity vectors by a matrix. inline void transformPositionVelocity(const osg::Matrix& xform); @@ -216,19 +216,19 @@ namespace osgParticle /// Set the angle vector. inline void setAngle(const osg::Vec3& a); - + /** - Set the angular velocity vector. + Set the angular velocity vector. Components x, y and z are angles of rotation around the respective axis (in radians). */ inline void setAngularVelocity(const osg::Vec3& v); - + /// Add a vector to the angular velocity vector. inline void addAngularVelocity(const osg::Vec3& dv); - + /// Transform angle and angularVelocity vectors by a matrix. inline void transformAngleVelocity(const osg::Matrix& xform); - + /** Update the particle (don't call this method manually). This method is called automatically by ParticleSystem::update(); it updates the graphical properties of the particle for the current time, @@ -239,19 +239,19 @@ namespace osgParticle /// Perform some pre-rendering tasks. Called automatically by particle systems. inline void beginRender(osg::GLBeginEndAdapter* gl) const; - + /// Render the particle. Called automatically by particle systems. void render(osg::GLBeginEndAdapter* gl, const osg::Vec3& xpos, const osg::Vec3& px, const osg::Vec3& py, float scale = 1.0f) const; - + /// Render the particle with user-defined drawable void render(osg::RenderInfo& renderInfo, const osg::Vec3& xpos, const osg::Vec3& xrot) const; - + /// Perform some post-rendering tasks. Called automatically by particle systems. inline void endRender(osg::GLBeginEndAdapter* gl) const; - + /// Get the current (interpolated) polygon size. Valid only after the first call to update(). inline float getCurrentSize() const; - + /// Specify how the particle texture is tiled. /// All tiles in the given range are sequentially displayed during the lifetime /// of the particle. When no range is given, all tiles are displayed during the lifetime. @@ -271,19 +271,19 @@ namespace osgParticle /// Get the const next particle inline int getNextParticle() const { return _nextParticle; } - + /// Set the depth of the particle inline void setDepth(double d) { _depth = d; } - + /// Get the depth of the particle inline double getDepth() const { return _depth; } - + /// Set the user-defined particle drawable inline void setDrawable(osg::Drawable* d) { _drawable = d; } - + /// Get the user-defined particle drawable inline osg::Drawable* getDrawable() const { return _drawable.get(); } - + /// Sorting operator bool operator<(const Particle &P) const { return _depth < P._depth; } @@ -291,7 +291,7 @@ namespace osgParticle void setUpTexCoordsAsPartOfConnectedParticleSystem(ParticleSystem* ps); protected: - + Shape _shape; rangef _sr; @@ -316,14 +316,14 @@ namespace osgParticle osg::Vec3 _angle; osg::Vec3 _angul_arvel; - double _t0; + double _t0; float _alive; float _current_size; float _current_alpha; osg::Vec3 _base_prop; // [0] _alive [1] _current_size [2] _current_alpha osg::Vec4 _current_color; - + float _s_tile; float _t_tile; int _start_tile; @@ -331,14 +331,14 @@ namespace osgParticle int _cur_tile; float _s_coord; float _t_coord; - + // previous and next Particles are only used in ConnectedParticleSystems int _previousParticle; int _nextParticle; - + // the depth of the particle is used only when sorting is enabled double _depth; - + // the particle drawable is used only when USER shape is enabled osg::ref_ptr _drawable; }; @@ -364,17 +364,17 @@ namespace osgParticle { return _lifeTime; } - + inline double Particle::getAge() const { return _t0; } - + inline float Particle::getRadius() const { return _radius; } - + inline void Particle::setRadius(float r) { _radius = r; @@ -419,7 +419,7 @@ namespace osgParticle { return _velocity; } - + inline const osg::Vec3& Particle::getPreviousPosition() const { return _prev_pos; @@ -429,17 +429,17 @@ namespace osgParticle { return _angle; } - + inline const osg::Vec3& Particle::getAngularVelocity() const { return _angul_arvel; } - + inline const osg::Vec3& Particle::getPreviousAngle() const { return _prev_angle; } - + inline int Particle::getTileS() const { return (_s_tile>0.0f) ? static_cast(1.0f / _s_tile) : 1; @@ -449,7 +449,7 @@ namespace osgParticle { return (_t_tile>0.0f) ? static_cast(1.0f / _t_tile) : 1; } - + inline void Particle::kill() { _mustdie = true; @@ -510,7 +510,7 @@ namespace osgParticle _position = xform.preMult(_position); _velocity = osg::Matrix::transform3x3(_velocity, xform); } - + inline void Particle::transformPositionVelocity(const osg::Matrix& xform1, const osg::Matrix& xform2, float r) { osg::Vec3 position1 = xform1.preMult(_position); @@ -521,50 +521,50 @@ namespace osgParticle _position = position1*r + position2*one_minus_r; _velocity = velocity1*r + velocity2*one_minus_r; } - + inline void Particle::setAngle(const osg::Vec3& a) { _angle = a; } - + inline void Particle::setAngularVelocity(const osg::Vec3& v) { _angul_arvel = v; } - + inline void Particle::addAngularVelocity(const osg::Vec3& dv) { _angul_arvel += dv; } - + inline void Particle::transformAngleVelocity(const osg::Matrix& xform) { // this should be optimized! - + osg::Vec3 a1 = _angle + _angul_arvel; - + _angle = xform.preMult(_angle); a1 = xform.preMult(a1); - + _angul_arvel = a1 - _angle; } - + inline float Particle::getMass() const { return _mass; } - + inline float Particle::getMassInv() const { return _massinv; } - + inline void Particle::setMass(float m) { _mass = m; _massinv = 1 / m; } - + inline void Particle::beginRender(osg::GLBeginEndAdapter* gl) const { switch (_shape) @@ -610,7 +610,7 @@ namespace osgParticle { _s_tile = (sTile>0) ? 1.0f / static_cast(sTile) : 1.0f; _t_tile = (tTile>0) ? 1.0f / static_cast(tTile) : 1.0f; - + if(startTile == -1) { _start_tile = 0; diff --git a/include/osgParticle/ParticleEffect b/include/osgParticle/ParticleEffect index a96ec45c0..f6df65739 100644 --- a/include/osgParticle/ParticleEffect +++ b/include/osgParticle/ParticleEffect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,7 +23,7 @@ namespace osgParticle class OSGPARTICLE_EXPORT ParticleEffect : public osg::Group { public: - + explicit ParticleEffect(bool automaticSetup=true): _automaticSetup(automaticSetup), _useLocalParticleSystem(true), @@ -33,7 +33,7 @@ namespace osgParticle _emitterDuration(1.0), _wind(0.0f,0.0f,0.0f) {} - + ParticleEffect(const ParticleEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); @@ -62,7 +62,7 @@ namespace osgParticle void setIntensity(float intensity); float getIntensity() const { return _intensity; } - + void setStartTime(double startTime); double getStartTime() const { return _startTime; } @@ -75,7 +75,7 @@ namespace osgParticle void setWind(const osg::Vec3& wind); const osg::Vec3& getWind() const { return _wind; } - /// Get whether all particles are dead + /// Get whether all particles are dead bool areAllParticlesDead() const { return _particleSystem.valid()?_particleSystem->areAllParticlesDead():true; } virtual Emitter* getEmitter() = 0; @@ -83,7 +83,7 @@ namespace osgParticle virtual Program* getProgram() = 0; virtual const Program* getProgram() const = 0; - + void setParticleSystem(ParticleSystem* ps); inline ParticleSystem* getParticleSystem() { return _particleSystem.get(); } inline const ParticleSystem* getParticleSystem() const { return _particleSystem.get(); } @@ -95,14 +95,14 @@ namespace osgParticle virtual void buildEffect(); protected: - + virtual ~ParticleEffect() {} - + bool _automaticSetup; osg::ref_ptr _particleSystem; - bool _useLocalParticleSystem; + bool _useLocalParticleSystem; std::string _textureFileName; Particle _defaultParticleTemplate; osg::Vec3 _position; diff --git a/include/osgParticle/ParticleProcessor b/include/osgParticle/ParticleProcessor index 85fa7bd99..58f0cd7b6 100644 --- a/include/osgParticle/ParticleProcessor +++ b/include/osgParticle/ParticleProcessor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -37,117 +37,117 @@ namespace osgParticle */ class OSGPARTICLE_EXPORT ParticleProcessor: public osg::Node { public: - + enum ReferenceFrame { RELATIVE_RF, ABSOLUTE_RF }; - + ParticleProcessor(); ParticleProcessor(const ParticleProcessor& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); virtual const char* libraryName() const { return "osgParticle"; } virtual const char* className() const { return "ParticleProcessor"; } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj) != 0; } - 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(); } } + /// Get the reference frame. inline ReferenceFrame getReferenceFrame() const; - + /// Set the reference frame. inline void setReferenceFrame(ReferenceFrame rf); - + /// Get whether this processor is enabled or not. bool getEnabled() const { return _enabled; } inline bool isEnabled() const; - + /// Set whether this processor is enabled or not. inline void setEnabled(bool v); - + /// Get a pointer to the destination particle system. inline ParticleSystem* getParticleSystem(); - + /// Get a const pointer to the destination particle system. inline const ParticleSystem* getParticleSystem() const; - + /// Set the destination particle system. inline void setParticleSystem(ParticleSystem* ps); - + /// Set the endless flag of this processor. inline void setEndless(bool type); - + /// Check whether this processor is endless. bool getEndless() const { return _endless; } inline bool isEndless() const; - + /// Set the lifetime of this processor. inline void setLifeTime(double t); - + /// Get the lifetime of this processor. inline double getLifeTime() const; - + /// Set the start time of this processor. inline void setStartTime(double t); - + /// Get the start time of this processor. inline double getStartTime() const; /// Set the current time of this processor. inline void setCurrentTime(double t); - + /// Get the current time of this processor. inline double getCurrentTime() const; - + /// Set the reset time of this processor. A value of 0 disables reset. inline void setResetTime(double t); - + /// Get the reset time of this processor. inline double getResetTime() const; - + /** Check whether the processor is alive with respect to start time and - life duration. Note that this method may return true even if the + life duration. Note that this method may return true even if the processor has been disabled by calling setEnabled(false). To test whether the processor is actually processing particles or not, you should evaluate (isEnabled() && isAlive()). */ inline bool isAlive() const; - + void traverse(osg::NodeVisitor& nv); /// Get the current local-to-world transformation matrix (valid only during cull traversal). inline const osg::Matrix& getLocalToWorldMatrix(); - + /// Get the current world-to-local transformation matrix (valid only during cull traversal). inline const osg::Matrix& getWorldToLocalMatrix(); - + /// Get the previous local-to-world transformation matrix (valid only during cull traversal). inline const osg::Matrix& getPreviousLocalToWorldMatrix(); - + /// Get the previous world-to-local transformation matrix (valid only during cull traversal). inline const osg::Matrix& getPreviousWorldToLocalMatrix(); /// Transform a point from local to world coordinates (valid only during cull traversal). inline osg::Vec3 transformLocalToWorld(const osg::Vec3& P); - + /// Transform a vector from local to world coordinates, discarding translation (valid only during cull traversal). inline osg::Vec3 rotateLocalToWorld(const osg::Vec3& P); - + /// Transform a point from world to local coordinates (valid only during cull traversal). inline osg::Vec3 transformWorldToLocal(const osg::Vec3& P); - + /// Transform a vector from world to local coordinates, discarding translation (valid only during cull traversal). inline osg::Vec3 rotateWorldToLocal(const osg::Vec3& P); - virtual osg::BoundingSphere computeBound() const; + virtual osg::BoundingSphere computeBound() const; protected: virtual ~ParticleProcessor() {} ParticleProcessor& operator=(const ParticleProcessor&) { return *this; } - + virtual void process(double dt) = 0; - + private: ReferenceFrame _rf; bool _enabled; @@ -162,36 +162,36 @@ namespace osgParticle osg::Matrix _previous_ltw_matrix; osg::Matrix _previous_wtl_matrix; osg::NodeVisitor* _current_nodevisitor; - + bool _endless; - + double _lifeTime; double _startTime; double _currentTime; double _resetTime; - - //added- 1/17/06- bgandere@nps.edu + + //added- 1/17/06- bgandere@nps.edu //a var to keep from doing multiple updates unsigned int _frameNumber; }; - + // INLINE FUNCTIONS - + inline ParticleProcessor::ReferenceFrame ParticleProcessor::getReferenceFrame() const { return _rf; } - + inline void ParticleProcessor::setReferenceFrame(ReferenceFrame rf) { _rf = rf; } - + inline bool ParticleProcessor::isEnabled() const { return _enabled; } - + inline void ParticleProcessor::setEnabled(bool v) { _enabled = v; @@ -200,7 +200,7 @@ namespace osgParticle _currentTime = 0; } } - + inline ParticleSystem* ParticleProcessor::getParticleSystem() { return _ps.get(); @@ -210,17 +210,17 @@ namespace osgParticle { return _ps.get(); } - + inline void ParticleProcessor::setParticleSystem(ParticleSystem* ps) { _ps = ps; } - + inline void ParticleProcessor::setEndless(bool type) { _endless = type; } - + inline bool ParticleProcessor::isEndless() const { return _endless; @@ -230,17 +230,17 @@ namespace osgParticle { _lifeTime = t; } - + inline double ParticleProcessor::getLifeTime() const { return _lifeTime; } - + inline void ParticleProcessor::setStartTime(double t) { _startTime = t; } - + inline double ParticleProcessor::getStartTime() const { return _startTime; @@ -249,23 +249,23 @@ namespace osgParticle { _currentTime = t; } - + inline double ParticleProcessor::getCurrentTime() const { return _currentTime; } - + inline void ParticleProcessor::setResetTime(double t) { _resetTime = t; } - + inline double ParticleProcessor::getResetTime() const { return _resetTime; } - inline const osg::Matrix& ParticleProcessor::getLocalToWorldMatrix() + inline const osg::Matrix& ParticleProcessor::getLocalToWorldMatrix() { if (_need_ltw_matrix) { _previous_ltw_matrix = _ltw_matrix; @@ -280,7 +280,7 @@ namespace osgParticle return _ltw_matrix; } - inline const osg::Matrix& ParticleProcessor::getWorldToLocalMatrix() + inline const osg::Matrix& ParticleProcessor::getWorldToLocalMatrix() { if (_need_wtl_matrix) { _previous_wtl_matrix = _wtl_matrix; @@ -294,7 +294,7 @@ namespace osgParticle } return _wtl_matrix; } - + inline const osg::Matrix& ParticleProcessor::getPreviousLocalToWorldMatrix() { if (_need_ltw_matrix) getLocalToWorldMatrix(); @@ -311,7 +311,7 @@ namespace osgParticle { return getLocalToWorldMatrix().preMult(P); } - + inline osg::Vec3 ParticleProcessor::transformWorldToLocal(const osg::Vec3& P) { return getWorldToLocalMatrix().preMult(P); @@ -319,16 +319,16 @@ namespace osgParticle inline osg::Vec3 ParticleProcessor::rotateLocalToWorld(const osg::Vec3& P) { - return getLocalToWorldMatrix().preMult(P) - + return getLocalToWorldMatrix().preMult(P) - getLocalToWorldMatrix().preMult(osg::Vec3(0, 0, 0)); } - + inline osg::Vec3 ParticleProcessor::rotateWorldToLocal(const osg::Vec3& P) { return getWorldToLocalMatrix().preMult(P) - getWorldToLocalMatrix().preMult(osg::Vec3(0, 0, 0)); } - + inline bool ParticleProcessor::isAlive() const { return _currentTime < (_lifeTime + _startTime); diff --git a/include/osgParticle/ParticleSystem b/include/osgParticle/ParticleSystem index c4886ef14..d32c75007 100644 --- a/include/osgParticle/ParticleSystem +++ b/include/osgParticle/ParticleSystem @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -53,7 +53,7 @@ namespace osgParticle */ class OSGPARTICLE_EXPORT ParticleSystem: public osg::Drawable { public: - + enum Alignment { BILLBOARD, FIXED @@ -63,25 +63,25 @@ namespace osgParticle ParticleSystem(const ParticleSystem& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Object(osgParticle, ParticleSystem); - + /// Get the alignment type of particles. inline Alignment getParticleAlignment() const; - + /// Set the alignment type of particles. inline void setParticleAlignment(Alignment a); - + /// Get the X-axis alignment vector. inline const osg::Vec3& getAlignVectorX() const; - + /// Set the X-axis alignment vector. inline void setAlignVectorX(const osg::Vec3& v); /// Get the Y-axis alignment vector. inline const osg::Vec3& getAlignVectorY() const; - + /// Set the Y-axis alignment vector. inline void setAlignVectorY(const osg::Vec3& v); - + /// Set the alignment vectors. inline void setAlignVectors(const osg::Vec3& X, const osg::Vec3& Y); @@ -102,8 +102,8 @@ namespace osgParticle /// Get the default bounding box - inline const osg::BoundingBox& getDefaultBoundingBox() const; - + inline const osg::BoundingBox& getDefaultBoundingBox() const; + /** Set the default bounding box. The default bounding box is used when a real bounding box cannot be computed, for example because no particles has been updated yet. @@ -112,7 +112,7 @@ namespace osgParticle /// Return true if we use vertex arrays for rendering particles. bool getUseVertexArray() const { return _useVertexArray; } - + /** Set to use vertex arrays for rendering particles. Lots of variables will be omitted: particles' shape, alive or not, visibility distance, and so on, so the rendering result is not as good as we wish (although it's fast than using glBegin/glEnd). @@ -120,19 +120,19 @@ namespace osgParticle This method is called automatically by setDefaultAttributesUsingShaders(). */ void setUseVertexArray(bool v) { _useVertexArray = v; } - + /// Return true if shaders are required. bool getUseShaders() const { return _useShaders; } - + /** Set to use GLSL shaders for rendering particles. Particles' parameters will be used as shader attribute arrays, and necessary variables, including the visibility distance, texture, etc, will be used and updated as uniforms. */ void setUseShaders(bool v) { _useShaders = v; _dirty_uniforms = true; } - + /// Get the double pass rendering flag. inline bool getDoublePassRendering() const; - + /** Set the double pass rendering flag. Double pass rendering avoids overdraw problems between particle systems and other opaque objects. If you can render all the particle systems after @@ -141,11 +141,11 @@ namespace osgParticle system will fall into a transparent bin. */ inline void setDoublePassRendering(bool v); - + /// Return true if the particle system is frozen. bool getFrozen() const { return _frozen; } inline bool isFrozen() const; - + /** Set or reset the frozen state. When the particle system is frozen, emitters and programs won't do anything on it. */ @@ -153,86 +153,86 @@ namespace osgParticle /// Get the number of allocated particles (alive + dead). inline int numParticles() const; - + /// Get the number of dead particles. inline int numDeadParticles() const; - /// Get whether all particles are dead + /// Get whether all particles are dead inline bool areAllParticlesDead() const { return numDeadParticles()==numParticles(); } - + /// Get a pointer to the i-th particle. inline Particle* getParticle(int i); - + /// Get a const pointer to the i-th particle. inline const Particle* getParticle(int i) const; - + /// Create a new particle from the specified template (or the default one if ptemplate is null). inline virtual Particle* createParticle(const Particle* ptemplate); - + /// Destroy the i-th particle. inline virtual void destroyParticle(int i); - + /// Reuse the i-th particle. inline virtual void reuseParticle(int i) { _deadparts.push(&(_particles[i])); } /// Get the last frame number. inline unsigned int getLastFrameNumber() const; - + /// Get the unique delta time for emitters and updaters to use inline double& getDeltaTime( double currentTime ); /// Get a reference to the default particle template. inline Particle& getDefaultParticleTemplate(); - + /// Get a const reference to the default particle template. inline const Particle& getDefaultParticleTemplate() const; /// Set the default particle template (particle is copied). inline void setDefaultParticleTemplate(const Particle& p); - + /// Get whether the particle system can freeze when culled inline bool getFreezeOnCull() const; - + /// Set whether the particle system can freeze when culled (default is true) inline void setFreezeOnCull(bool v); - + /** A useful method to set the most common StateAttribute's in one call. If texturefile is empty, then texturing is turned off. */ void setDefaultAttributes(const std::string& texturefile = "", bool emissive_particles = true, bool lighting = false, int texture_unit = 0); - + /** A useful method to set the most common StateAttribute and use GLSL shaders to draw particles. At present, when enabling shaders in the particle system, user-defined shapes will not be usable. If texturefile is empty, then texturing is turned off. */ void setDefaultAttributesUsingShaders(const std::string& texturefile = "", bool emissive_particles = true, int texture_unit = 0); - + /// (EXPERIMENTAL) Get the level of detail. inline int getLevelOfDetail() const; - + /** (EXPERIMENTAL) Set the level of detail. The total number of particles is divided by the detail value to get the actual number of particles to be drawn. This value must be greater than zero. */ inline void setLevelOfDetail(int v); - + enum SortMode { NO_SORT, SORT_FRONT_TO_BACK, SORT_BACK_TO_FRONT }; - + /// Get the sort mode. inline SortMode getSortMode() const; - + /** Set the sort mode. It will force resorting the particle list by the Z direction of the view coordinates. This can be used for the purpose of transparent rendering or setVisibilityDistance(). */ inline void setSortMode(SortMode mode); - + /// Get the visibility distance. inline double getVisibilityDistance() const; - + /** Set the visibility distance which allows the particles to be rendered only when depth is inside the distance. When using shaders, it can work well directly; otherwise the sort mode should also be set to pre-compute depth. */ @@ -244,7 +244,7 @@ namespace osgParticle virtual void drawImplementation(osg::RenderInfo& renderInfo) const; virtual osg::BoundingBox computeBound() const; - + #ifdef OSGPARTICLE_USE_ReadWriteMutex typedef OpenThreads::ReadWriteMutex ReadWriterMutex; typedef OpenThreads::ScopedReadLock ScopedReadLock; @@ -272,18 +272,18 @@ namespace osgParticle Particle_vector _particles; Death_stack _deadparts; - + osg::BoundingBox _def_bbox; - + Alignment _alignment; osg::Vec3 _align_X_axis; osg::Vec3 _align_Y_axis; ParticleScaleReferenceFrame _particleScaleReferenceFrame; - + bool _useVertexArray; bool _useShaders; bool _dirty_uniforms; - + bool _doublepass; bool _frozen; @@ -297,36 +297,36 @@ namespace osgParticle mutable unsigned int _last_frame; mutable bool _dirty_dt; bool _freeze_on_cull; - + double _t0; double _dt; - + int _detail; SortMode _sortMode; double _visibilityDistance; - + mutable int _draw_count; - + mutable ReadWriterMutex _readWriteMutex; }; - + // INLINE FUNCTIONS - + inline ParticleSystem::Alignment ParticleSystem::getParticleAlignment() const { return _alignment; } - + inline void ParticleSystem::setParticleAlignment(Alignment a) { _alignment = a; } - + inline const osg::Vec3& ParticleSystem::getAlignVectorX() const { return _align_X_axis; } - + inline void ParticleSystem::setAlignVectorX(const osg::Vec3& v) { _align_X_axis = v; @@ -336,12 +336,12 @@ namespace osgParticle { return _align_Y_axis; } - + inline void ParticleSystem::setAlignVectorY(const osg::Vec3& v) { _align_Y_axis = v; } - + inline void ParticleSystem::setAlignVectors(const osg::Vec3& X, const osg::Vec3& Y) { _align_X_axis = X; @@ -352,17 +352,17 @@ namespace osgParticle { return _frozen; } - + inline void ParticleSystem::setFrozen(bool v) { _frozen = v; } - + inline const osg::BoundingBox& ParticleSystem::getDefaultBoundingBox() const { return _def_bbox; } - + inline void ParticleSystem::setDefaultBoundingBox(const osg::BoundingBox& bbox) { _def_bbox = bbox; @@ -402,19 +402,19 @@ namespace osgParticle { _particles[i].kill(); } - + inline unsigned int ParticleSystem::getLastFrameNumber() const { return _last_frame; } - + inline double& ParticleSystem::getDeltaTime( double currentTime ) { if ( _dirty_dt ) { _dt = currentTime - _t0; if ( _dt<0.0 ) _dt = 0.0; - + _t0 = currentTime; _dirty_dt = false; } @@ -435,7 +435,7 @@ namespace osgParticle if (p.y() + r > _bmax.y()) _bmax.y() = p.y() + r; if (p.z() + r > _bmax.z()) _bmax.z() = p.z() + r; } - if (!_bounds_computed) + if (!_bounds_computed) _bounds_computed = true; } @@ -453,51 +453,51 @@ namespace osgParticle { _def_ptemp = p; } - + inline bool ParticleSystem::getFreezeOnCull() const { return _freeze_on_cull; } - + inline void ParticleSystem::setFreezeOnCull(bool v) { _freeze_on_cull = v; } - + inline int ParticleSystem::getLevelOfDetail() const { return _detail; } - + inline void ParticleSystem::setLevelOfDetail(int v) { if (v < 1) v = 1; _detail = v; } - + inline ParticleSystem::SortMode ParticleSystem::getSortMode() const { return _sortMode; } - + inline void ParticleSystem::setSortMode(SortMode mode) { _sortMode = mode; } - + inline double ParticleSystem::getVisibilityDistance() const { return _visibilityDistance; } - + inline void ParticleSystem::setVisibilityDistance(double distance) { _visibilityDistance = distance; if (_useShaders) _dirty_uniforms = true; } - - // I'm not sure this function should be inlined... - + + // I'm not sure this function should be inlined... + inline Particle* ParticleSystem::createParticle(const Particle* ptemplate) { // is there any dead particle? diff --git a/include/osgParticle/ParticleSystemUpdater b/include/osgParticle/ParticleSystemUpdater index d80e99861..d22930816 100644 --- a/include/osgParticle/ParticleSystemUpdater +++ b/include/osgParticle/ParticleSystemUpdater @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -40,9 +40,9 @@ namespace osgParticle public: ParticleSystemUpdater(); ParticleSystemUpdater(const ParticleSystemUpdater& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + META_Node(osgParticle,ParticleSystemUpdater); - + /// Add a particle system to the list. virtual bool addParticleSystem(ParticleSystem* ps); @@ -51,7 +51,7 @@ namespace osgParticle /// Remove a particle system(s) from the list (by index). virtual bool removeParticleSystem(unsigned int i, unsigned int numParticleSystemsToRemove=1); - + /// Replace ParticleSystem with another ParticleSystem. virtual bool replaceParticleSystem(ParticleSystem* origPS, ParticleSystem* newPS); @@ -63,7 +63,7 @@ namespace osgParticle /// Get a particle system from the list. inline ParticleSystem* getParticleSystem(unsigned int i); - + /// Get a particle system from the list. inline const ParticleSystem* getParticleSystem(unsigned int i) const; @@ -72,33 +72,33 @@ namespace osgParticle /// get index number of ParticleSystem. inline unsigned int getParticleSystemIndex( const ParticleSystem* ps ) const; - + virtual void traverse(osg::NodeVisitor& nv); - - virtual osg::BoundingSphere computeBound() const; + + virtual osg::BoundingSphere computeBound() const; protected: virtual ~ParticleSystemUpdater() {} ParticleSystemUpdater &operator=(const ParticleSystemUpdater &) { return *this; } - + private: typedef std::vector > ParticleSystem_Vector; - + ParticleSystem_Vector _psv; double _t0; - + //added 1/17/06- bgandere@nps.edu //a var to keep from doing multiple updates per frame unsigned int _frameNumber; }; - + // INLINE FUNCTIONS - + inline unsigned int ParticleSystemUpdater::getNumParticleSystems() const { return static_cast(_psv.size()); } - + inline ParticleSystem* ParticleSystemUpdater::getParticleSystem(unsigned int i) { return _psv[i].get(); diff --git a/include/osgParticle/Placer b/include/osgParticle/Placer index 662f64667..c92a227f7 100644 --- a/include/osgParticle/Placer +++ b/include/osgParticle/Placer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -39,7 +39,7 @@ namespace osgParticle /// Place a particle. Must be implemented in descendant classes. virtual void place(Particle* P) const = 0; - + /// Volume of the placer. Can be implemented in descendant classes. virtual float volume() const { return 1.0f; } @@ -50,14 +50,14 @@ namespace osgParticle ~Placer() {} Placer& operator=(const Placer& ) { return *this; } }; - + // INLINE FUNCTIONS - + inline Placer::Placer() : osg::Object() { } - + inline Placer::Placer(const Placer& copy, const osg::CopyOp& copyop) : osg::Object(copy, copyop) { diff --git a/include/osgParticle/PointPlacer b/include/osgParticle/PointPlacer index 33e30fa90..71db4a5a8 100644 --- a/include/osgParticle/PointPlacer +++ b/include/osgParticle/PointPlacer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -34,8 +34,8 @@ namespace osgParticle inline PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Object(osgParticle, PointPlacer); - - /** Place a particle. + + /** Place a particle. This method is called automatically by ModularEmitter and should not be called manually. */ @@ -46,16 +46,16 @@ namespace osgParticle protected: virtual ~PointPlacer() {} - PointPlacer& operator=(const PointPlacer&) { return *this; } + PointPlacer& operator=(const PointPlacer&) { return *this; } }; // INLINE FUNCTIONS - + inline PointPlacer::PointPlacer() : CenteredPlacer() { } - + inline PointPlacer::PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop) : CenteredPlacer(copy, copyop) { diff --git a/include/osgParticle/PrecipitationEffect b/include/osgParticle/PrecipitationEffect index dc698826d..1f713f4ab 100644 --- a/include/osgParticle/PrecipitationEffect +++ b/include/osgParticle/PrecipitationEffect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,7 +28,7 @@ namespace osgParticle class OSGPARTICLE_EXPORT PrecipitationEffect : public osg::Node { public: - + PrecipitationEffect(); PrecipitationEffect(const PrecipitationEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); @@ -38,54 +38,54 @@ namespace osgParticle virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } } virtual void traverse(osg::NodeVisitor& nv); - - + + /** Set all the parameters to create an rain effect of specified intensity.*/ void rain(float intensity); - + /** Set all the parameters to create an snow effect of specified intensity.*/ void snow(float intensity); - + void setMaximumParticleDensity(float density) { if (_maximumParticleDensity==density) return; _maximumParticleDensity = density; _dirty = true;} float getMaximumParticleDensity() const { return _maximumParticleDensity; } void setWind(const osg::Vec3& wind) { _wind = wind; } const osg::Vec3& getWind() const { return _wind; } - + void setPosition(const osg::Vec3& position) { _origin = position; } const osg::Vec3& getPosition() const { return _origin; } - + void setCellSize(const osg::Vec3& cellSize) { if (_cellSize==cellSize) return; _cellSize = cellSize; _dirty = true; } const osg::Vec3& getCellSize() const { return _cellSize; } - + void setParticleSpeed(float particleSpeed) { if (_particleSpeed==particleSpeed) return; _particleSpeed = particleSpeed; _dirty = true; } float getParticleSpeed() const { return _particleSpeed; } void setParticleSize(float particleSize) { if (_particleSize==particleSize) return; _particleSize = particleSize; _dirty = true;} float getParticleSize() const { return _particleSize; } - + void setParticleColor(const osg::Vec4& color) { if (_particleColor==color) return; _particleColor = color; _dirty = true;} const osg::Vec4& getParticleColor() const { return _particleColor; } - + void setNearTransition(float nearTransition) { _nearTransition = nearTransition; } float getNearTransition() const { return _nearTransition; } void setFarTransition(float farTransition) { _farTransition = farTransition; } float getFarTransition() const { return _farTransition; } - + void setUseFarLineSegments(bool useFarLineSegments) { _useFarLineSegments = useFarLineSegments; } bool getUseFarLineSegments() const { return _useFarLineSegments; } void setFog(osg::Fog* fog) { _fog = fog; } osg::Fog* getFog() { return _fog.get(); } const osg::Fog* getFog() const { return _fog.get(); } - + osg::Geometry* getQuadGeometry() { return _quadGeometry.get(); } osg::StateSet* getQuadStateSet() { return _quadStateSet.get(); } - + osg::Geometry* getLineGeometry() { return _lineGeometry.get(); } osg::StateSet* getLineStateSet() { return _lineStateSet.get(); } - + osg::Geometry* getPointGeometry() { return _pointGeometry.get(); } osg::StateSet* getPointStateSet() { return _pointStateSet.get(); } @@ -110,10 +110,10 @@ namespace osgParticle void setGeometry(osg::Geometry* geom) { _geometry = geom; } osg::Geometry* getGeometry() { return _geometry.get(); } const osg::Geometry* getGeometry() const { return _geometry.get(); } - + void setDrawType(GLenum type) { _drawType = type; } GLenum getDrawType() const { return _drawType; } - + void setNumberOfVertices(unsigned int numVertices) { _numberOfVertices = numVertices; } unsigned int getNumberOfVertices() const { return _numberOfVertices; } @@ -139,14 +139,14 @@ namespace osgParticle int j; int k; }; - + struct DepthMatrixStartTime { inline bool operator < (const DepthMatrixStartTime& rhs) const { return depth < rhs.depth; } - + float depth; float startTime; osg::Matrix modelview; @@ -154,11 +154,11 @@ namespace osgParticle typedef std::map< Cell, DepthMatrixStartTime > CellMatrixMap; - struct LessFunctor + struct LessFunctor { inline bool operator () (const CellMatrixMap::value_type* lhs,const CellMatrixMap::value_type* rhs) const { - return (*lhs).second<(*rhs).second; + return (*lhs).second<(*rhs).second; } }; @@ -182,25 +182,25 @@ namespace osgParticle mutable CellMatrixMap _currentCellMatrixMap; mutable CellMatrixMap _previousCellMatrixMap; - + GLenum _drawType; unsigned int _numberOfVertices; }; protected: - + virtual ~PrecipitationEffect() {} - + void compileGLObjects(osg::RenderInfo& renderInfo) const; void update(); - - void createGeometry(unsigned int numParticles, - osg::Geometry* quad_geometry, + + void createGeometry(unsigned int numParticles, + osg::Geometry* quad_geometry, osg::Geometry* line_geometry, osg::Geometry* point_geometry); - + void setUpGeometries(unsigned int numParticles); @@ -210,7 +210,7 @@ namespace osgParticle osg::ref_ptr _linePrecipitationDrawable; osg::ref_ptr _pointPrecipitationDrawable; }; - + void cull(PrecipitationDrawableSet& pds, osgUtil::CullVisitor* cv) const; bool build(const osg::Vec3 eyeLocal, int i, int j, int k, float startTime, PrecipitationDrawableSet& pds, osg::Polytope& frustum, osgUtil::CullVisitor* cv) const; @@ -236,7 +236,7 @@ namespace osgParticle OpenThreads::Mutex _mutex; ViewDrawableMap _viewDrawableMap; - + osg::ref_ptr _quadGeometry; osg::ref_ptr _quadStateSet; diff --git a/include/osgParticle/Program b/include/osgParticle/Program index a5bfe267e..855575e91 100644 --- a/include/osgParticle/Program +++ b/include/osgParticle/Program @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -26,10 +26,10 @@ namespace osgParticle { - /** An abstract ParticleProcessor descendant for modifying particles "on the fly" + /** An abstract ParticleProcessor descendant for modifying particles "on the fly" during the cull traversal. - Descendants of this class must implement the execute() method, which should iterate - through all particles in the linked particle system and modify them somehow + Descendants of this class must implement the execute() method, which should iterate + through all particles in the linked particle system and modify them somehow (usually updating their velocity vector). */ class OSGPARTICLE_EXPORT Program: public ParticleProcessor @@ -49,7 +49,7 @@ namespace osgParticle /// Implementation of ParticleProcessor::process(). Do not call this method by yourself. inline void process(double dt); - + /// Execute the program on the particle system. Must be overriden in descendant classes. virtual void execute(double dt) = 0; @@ -62,7 +62,7 @@ namespace osgParticle { execute(dt); } - + } #endif diff --git a/include/osgParticle/RadialShooter b/include/osgParticle/RadialShooter index 8ae1e5011..146c2a108 100644 --- a/include/osgParticle/RadialShooter +++ b/include/osgParticle/RadialShooter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -42,37 +42,37 @@ namespace osgParticle /// Get the range of possible values for theta angle. inline const rangef& getThetaRange() const; - + /// Set the range of possible values for theta angle. inline void setThetaRange(const rangef& r); - + /// Set the range of possible values for theta angle. inline void setThetaRange(float r1, float r2); - + /// Get the range of possible values for phi angle. inline const rangef& getPhiRange() const; - + /// Set the range of possible values for phi angle. inline void setPhiRange(const rangef& r); - + /// Set the range of possible values for phi angle. inline void setPhiRange(float r1, float r2); - + /// Get the range of possible values for initial speed of particles. - inline const rangef& getInitialSpeedRange() const; - + inline const rangef& getInitialSpeedRange() const; + /// Set the range of possible values for initial speed of particles. inline void setInitialSpeedRange(const rangef& r); - + /// Set the range of possible values for initial speed of particles. inline void setInitialSpeedRange(float r1, float r2); /// Get the range of possible values for initial rotational speed of particles. - inline const rangev3& getInitialRotationalSpeedRange() const; - + inline const rangev3& getInitialRotationalSpeedRange() const; + /// Set the range of possible values for initial rotational speed of particles. inline void setInitialRotationalSpeedRange(const rangev3& r); - + /// Set the range of possible values for initial rotational speed of particles. inline void setInitialRotationalSpeedRange(const osg::Vec3& r1, const osg::Vec3& r2); @@ -93,23 +93,23 @@ namespace osgParticle // INLINE FUNCTIONS inline RadialShooter::RadialShooter() - : Shooter(), - _theta_range(0, 0.5f*osg::PI_4), - _phi_range(0, 2*osg::PI), + : Shooter(), + _theta_range(0, 0.5f*osg::PI_4), + _phi_range(0, 2*osg::PI), _speed_range(10, 10), _rot_speed_range(osg::Vec3(0,0,0), osg::Vec3(0,0,0)) { } inline RadialShooter::RadialShooter(const RadialShooter& copy, const osg::CopyOp& copyop) - : Shooter(copy, copyop), - _theta_range(copy._theta_range), - _phi_range(copy._phi_range), + : Shooter(copy, copyop), + _theta_range(copy._theta_range), + _phi_range(copy._phi_range), _speed_range(copy._speed_range), _rot_speed_range(copy._rot_speed_range) { } - + inline const rangef& RadialShooter::getThetaRange() const { return _theta_range; @@ -180,13 +180,13 @@ namespace osgParticle float phi = _phi_range.get_random(); float speed = _speed_range.get_random(); osg::Vec3 rot_speed = _rot_speed_range.get_random(); - + P->setVelocity(osg::Vec3( speed * sinf(theta) * cosf(phi), speed * sinf(theta) * sinf(phi), speed * cosf(theta) )); - + P->setAngularVelocity(rot_speed); } diff --git a/include/osgParticle/RandomRateCounter b/include/osgParticle/RandomRateCounter index f4d4d0946..3c4462bac 100644 --- a/include/osgParticle/RandomRateCounter +++ b/include/osgParticle/RandomRateCounter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -27,30 +27,30 @@ namespace osgParticle public: inline RandomRateCounter(); inline RandomRateCounter(const RandomRateCounter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + META_Object(osgParticle, RandomRateCounter); - + /// Return the number of particles to be created in this frame inline int numParticlesToCreate(double dt) const; - + protected: virtual ~RandomRateCounter() {} - + mutable float _np; }; - + // INLINE FUNCTIONS - + inline RandomRateCounter::RandomRateCounter() : VariableRateCounter(), _np(0) { } - + inline RandomRateCounter::RandomRateCounter(const RandomRateCounter& copy, const osg::CopyOp& copyop) : VariableRateCounter(copy, copyop), _np(copy._np) { } - + inline int RandomRateCounter::numParticlesToCreate(double dt) const { // compute the number of new particles, clamping it to 1 second of particles at the maximum rate diff --git a/include/osgParticle/SectorPlacer b/include/osgParticle/SectorPlacer index ae852e784..c5a9fd851 100644 --- a/include/osgParticle/SectorPlacer +++ b/include/osgParticle/SectorPlacer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -28,66 +28,66 @@ namespace osgParticle { /** A sector-shaped particle placer. - This placer sets the initial position of incoming particle by choosing a random position - within a circular sector; this sector is defined by three parameters: a center point, - which is inherited directly from osgParticle::CenteredPlacer, a range of values - for radius, and a range of values for the central angle (sometimes called phi). + This placer sets the initial position of incoming particle by choosing a random position + within a circular sector; this sector is defined by three parameters: a center point, + which is inherited directly from osgParticle::CenteredPlacer, a range of values + for radius, and a range of values for the central angle (sometimes called phi). */ class SectorPlacer: public CenteredPlacer { public: inline SectorPlacer(); inline SectorPlacer(const SectorPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + /// Get the range of possible values for radius. inline const rangef& getRadiusRange() const; - + /// Set the range of possible values for radius. inline void setRadiusRange(const rangef& r); - + /// Set the range of possible values for radius. inline void setRadiusRange(float r1, float r2); - + /// Get the range of possible values for the central angle. - inline const rangef& getPhiRange() const; - + inline const rangef& getPhiRange() const; + /// Set the range of possible values for the central angle. inline void setPhiRange(const rangef& r); - + /// Set the range of possible values for the central angle. - inline void setPhiRange(float r1, float r2); + inline void setPhiRange(float r1, float r2); META_Object(osgParticle, SectorPlacer); - + /// Place a particle. Do not call it manually. inline void place(Particle* P) const; /// return the area of the sector inline float volume() const; - + /// return the control position inline osg::Vec3 getControlPosition() const; protected: virtual ~SectorPlacer() {} - SectorPlacer& operator=(const SectorPlacer&) { return *this; } - + SectorPlacer& operator=(const SectorPlacer&) { return *this; } + private: rangef _rad_range; rangef _phi_range; }; // INLINE FUNCTIONS - + inline SectorPlacer::SectorPlacer() : CenteredPlacer(), _rad_range(0, 1), _phi_range(0, osg::PI*2) { } - + inline SectorPlacer::SectorPlacer(const SectorPlacer& copy, const osg::CopyOp& copyop) : CenteredPlacer(copy, copyop), _rad_range(copy._rad_range), _phi_range(copy._phi_range) { } - + inline const rangef& SectorPlacer::getRadiusRange() const { return _rad_range; @@ -102,18 +102,18 @@ namespace osgParticle { _rad_range = r; } - + inline void SectorPlacer::setRadiusRange(float r1, float r2) { _rad_range.minimum = r1; _rad_range.maximum = r2; } - + inline void SectorPlacer::setPhiRange(const rangef& r) { _phi_range = r; } - + inline void SectorPlacer::setPhiRange(float r1, float r2) { _phi_range.minimum = r1; @@ -124,15 +124,15 @@ namespace osgParticle { float rad = _rad_range.get_random_sqrtf(); float phi = _phi_range.get_random(); - + osg::Vec3 pos( - getCenter().x() + rad * cosf(phi), - getCenter().y() + rad * sinf(phi), + getCenter().x() + rad * cosf(phi), + getCenter().y() + rad * sinf(phi), getCenter().z()); - + P->setPosition(pos); } - + inline float SectorPlacer::volume() const { return 0.5f * (_phi_range.maximum - _phi_range.minimum) * diff --git a/include/osgParticle/SegmentPlacer b/include/osgParticle/SegmentPlacer index 22a5e1be6..a008ff6dc 100644 --- a/include/osgParticle/SegmentPlacer +++ b/include/osgParticle/SegmentPlacer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -38,37 +38,37 @@ namespace osgParticle { /// get vertex A. inline const osg::Vec3& getVertexA() const; - + /// Set vertex A of the segment as a vector. inline void setVertexA(const osg::Vec3& v); - + /// Set vertex A of the segment as three floats. inline void setVertexA(float x, float y, float z); - + /// get vertex B. inline const osg::Vec3& getVertexB() const; - + /// Set vertex B of the segment as a vector. inline void setVertexB(const osg::Vec3& v); - + /// Set vertex B of the segment as three floats. inline void setVertexB(float x, float y, float z); - + /// Set both vertices. inline void setSegment(const osg::Vec3& A, const osg::Vec3& B); - + /// Place a particle. This method is called by ModularEmitter, do not call it manually. inline void place(Particle* P) const; /// return the length of the segment inline float volume() const; - + /// return the control position inline osg::Vec3 getControlPosition() const; protected: virtual ~SegmentPlacer() {} - SegmentPlacer& operator=(const SegmentPlacer&) { return *this; } + SegmentPlacer& operator=(const SegmentPlacer&) { return *this; } private: osg::Vec3 _vertexA; @@ -76,12 +76,12 @@ namespace osgParticle { }; // INLINE FUNCTIONS - + inline SegmentPlacer::SegmentPlacer() : Placer(), _vertexA(-1, 0, 0), _vertexB(1, 0, 0) { } - + inline SegmentPlacer::SegmentPlacer(const SegmentPlacer& copy, const osg::CopyOp& copyop) : Placer(copy, copyop), _vertexA(copy._vertexA), _vertexB(copy._vertexB) { @@ -107,22 +107,22 @@ namespace osgParticle { { P->setPosition(rangev3(_vertexA, _vertexB).get_random()); } - + inline float SegmentPlacer::volume() const { return (_vertexB - _vertexA).length(); } - + inline void SegmentPlacer::setVertexA(const osg::Vec3& v) { _vertexA = v; } - + inline void SegmentPlacer::setVertexA(float x, float y, float z) { _vertexA.set(x, y, z); } - + inline void SegmentPlacer::setVertexB(const osg::Vec3& v) { _vertexB = v; @@ -131,8 +131,8 @@ namespace osgParticle { inline void SegmentPlacer::setVertexB(float x, float y, float z) { _vertexB.set(x, y, z); - } - + } + inline osg::Vec3 SegmentPlacer::getControlPosition() const { return (_vertexA+_vertexB)*0.5f; diff --git a/include/osgParticle/Shooter b/include/osgParticle/Shooter index 47b4f125c..a7aeb6971 100644 --- a/include/osgParticle/Shooter +++ b/include/osgParticle/Shooter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -23,7 +23,7 @@ namespace osgParticle class Particle; - /** An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed. + /** An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed. Descendants of this class must override the shoot() method. */ class Shooter: public osg::Object @@ -46,14 +46,14 @@ namespace osgParticle virtual ~Shooter() {} Shooter &operator=(const Shooter &) { return *this; } }; - + // INLINE FUNCTIONS - + inline Shooter::Shooter() : osg::Object() { } - + inline Shooter::Shooter(const Shooter& copy, const osg::CopyOp& copyop) : osg::Object(copy, copyop) { diff --git a/include/osgParticle/SinkOperator b/include/osgParticle/SinkOperator index 21b62ebb7..372731ad6 100644 --- a/include/osgParticle/SinkOperator +++ b/include/osgParticle/SinkOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -30,36 +30,36 @@ class OSGPARTICLE_EXPORT SinkOperator : public DomainOperator public: enum SinkTarget { SINK_POSITION, SINK_VELOCITY, SINK_ANGULAR_VELOCITY }; enum SinkStrategy { SINK_INSIDE, SINK_OUTSIDE }; - + SinkOperator() : DomainOperator(), _sinkTarget(SINK_POSITION), _sinkStrategy(SINK_INSIDE) {} - + SinkOperator( const SinkOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) : DomainOperator(copy, copyop), _sinkTarget(copy._sinkTarget), _sinkStrategy(copy._sinkStrategy) {} - + META_Object( osgParticle, SinkOperator ); - + /// Set the sink strategy void setSinkTarget( SinkTarget so ) { _sinkTarget = so; } - + /// Get the sink strategy SinkTarget getSinkTarget() const { return _sinkTarget; } - + /// Set the sink strategy void setSinkStrategy( SinkStrategy ss ) { _sinkStrategy = ss; } - + /// Get the sink strategy SinkStrategy getSinkStrategy() const { return _sinkStrategy; } - + /// Perform some initializations. Do not call this method manually. void beginOperate( Program* prg ); - + protected: virtual ~SinkOperator() {} SinkOperator& operator=( const SinkOperator& ) { return *this; } - + virtual void handlePoint( const Domain& domain, Particle* P, double dt ); virtual void handleLineSegment( const Domain& domain, Particle* P, double dt ); virtual void handleTriangle( const Domain& domain, Particle* P, double dt ); @@ -68,10 +68,10 @@ protected: virtual void handleSphere( const Domain& domain, Particle* P, double dt ); virtual void handleBox( const Domain& domain, Particle* P, double dt ); virtual void handleDisk( const Domain& domain, Particle* P, double dt ); - + inline const osg::Vec3& getValue( Particle* P ); inline void kill( Particle* P, bool insideDomain ); - + SinkTarget _sinkTarget; SinkStrategy _sinkStrategy; }; diff --git a/include/osgParticle/SmokeEffect b/include/osgParticle/SmokeEffect index 5a4ba23a2..4da62743b 100644 --- a/include/osgParticle/SmokeEffect +++ b/include/osgParticle/SmokeEffect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,15 +24,15 @@ namespace osgParticle class OSGPARTICLE_EXPORT SmokeEffect : public ParticleEffect { public: - + explicit SmokeEffect(bool automaticSetup=true); - + SmokeEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f); - + SmokeEffect(const SmokeEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Node(osgParticle,SmokeEffect); - + virtual void setDefaults(); virtual void setUpEmitterAndProgram(); @@ -42,11 +42,11 @@ namespace osgParticle virtual Program* getProgram() { return _program.get(); } virtual const Program* getProgram() const { return _program.get(); } - + protected: virtual ~SmokeEffect() {} - + osg::ref_ptr _emitter; osg::ref_ptr _program; diff --git a/include/osgParticle/SmokeTrailEffect b/include/osgParticle/SmokeTrailEffect index a0f1e7034..2c01434b6 100644 --- a/include/osgParticle/SmokeTrailEffect +++ b/include/osgParticle/SmokeTrailEffect @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,15 +24,15 @@ namespace osgParticle class OSGPARTICLE_EXPORT SmokeTrailEffect : public ParticleEffect { public: - + explicit SmokeTrailEffect(bool automaticSetup=true); - + SmokeTrailEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f); - + SmokeTrailEffect(const SmokeTrailEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); META_Node(osgParticle,SmokeTrailEffect); - + virtual void setDefaults(); virtual void setUpEmitterAndProgram(); @@ -42,11 +42,11 @@ namespace osgParticle virtual Program* getProgram() { return _program.get(); } virtual const Program* getProgram() const { return _program.get(); } - + protected: virtual ~SmokeTrailEffect() {} - + osg::ref_ptr _emitter; osg::ref_ptr _program; diff --git a/include/osgParticle/VariableRateCounter b/include/osgParticle/VariableRateCounter index 92d59df7a..6b974973d 100644 --- a/include/osgParticle/VariableRateCounter +++ b/include/osgParticle/VariableRateCounter @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -28,39 +28,39 @@ namespace osgParticle public: inline VariableRateCounter(); inline VariableRateCounter(const VariableRateCounter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); - + virtual const char* libraryName() const { return "osgParticle"; } virtual const char* className() const { return "VariableRateCounter"; } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj) != 0; } - + inline const rangef& getRateRange() const; inline void setRateRange(const rangef& r); inline void setRateRange(float minrange, float maxrange); - + protected: virtual ~VariableRateCounter() {} - + private: rangef _rate_range; }; - + // INLINE FUNCTIONS - + inline VariableRateCounter::VariableRateCounter() : Counter(), _rate_range(1, 1) { } - + inline VariableRateCounter::VariableRateCounter(const VariableRateCounter& copy, const osg::CopyOp& copyop) : Counter(copy, copyop), _rate_range(copy._rate_range) { } - + inline const rangef &VariableRateCounter::getRateRange() const { return _rate_range; } - + inline void VariableRateCounter::setRateRange(const rangef& r) { _rate_range = r; diff --git a/include/osgParticle/Version b/include/osgParticle/Version index 5fbe4ccee..0fdbd0e87 100644 --- a/include/osgParticle/Version +++ b/include/osgParticle/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez diff --git a/include/osgParticle/range b/include/osgParticle/range index 2984a9abf..367b33e6f 100644 --- a/include/osgParticle/range +++ b/include/osgParticle/range @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez @@ -30,23 +30,23 @@ namespace osgParticle /** A simple struct template useful to store ranges of values as min/max pairs. This struct template helps storing min/max ranges for values of any kind; class ValueType is - the type of values to be stored, and it must support operations ValueType + ValueType, ValueType - ValueType, + the type of values to be stored, and it must support operations ValueType + ValueType, ValueType - ValueType, and ValueType * float, otherwise the geValueTyperandom() method will not compile. - This struct could be extended to customize the random number generator (now it uses only + This struct could be extended to customize the random number generator (now it uses only std::rand()). */ template struct range { - + /// Lower bound. ValueType minimum; - + /// Higher bound. ValueType maximum; /// Construct the object by calling default constructors for min and max. range() : minimum(ValueType()), maximum(ValueType()) {} - + /// Construct and initialize min and max directly. range(const ValueType& mn, const ValueType& mx) : minimum(mn), maximum(mx) {} @@ -64,7 +64,7 @@ namespace osgParticle { return minimum + (maximum - minimum) * sqrtf( static_cast(rand()) / static_cast(RAND_MAX) ); } - + ValueType mid() const { return (minimum+maximum)*0.5f; @@ -74,13 +74,13 @@ namespace osgParticle /// Range of floats. typedef range rangef; - + /// Range of osg::Vec2s. typedef range rangev2; - + /// Range of osg::Vec3s. typedef range rangev3; - + /// Range of osg::Vec4s. typedef range rangev4; diff --git a/include/osgPresentation/AnimationMaterial b/include/osgPresentation/AnimationMaterial index b9e44bf7a..dbf0a72d8 100644 --- a/include/osgPresentation/AnimationMaterial +++ b/include/osgPresentation/AnimationMaterial @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -31,7 +31,7 @@ namespace osgPresentation { class OSGPRESENTATION_EXPORT AnimationMaterial : public virtual osg::Object { public: - + AnimationMaterial():_loopMode(LOOP) {} AnimationMaterial(const AnimationMaterial& ap, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): @@ -42,45 +42,45 @@ class OSGPRESENTATION_EXPORT AnimationMaterial : public virtual osg::Object META_Object(osg,AnimationMaterial); - /** get the transformation matrix for a point in time.*/ + /** get the transformation matrix for a point in time.*/ bool getMaterial(double time,osg::Material& material) const; void insert(double time,osg::Material* material); - + 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 getPeriod() const { return getLastTime()-getFirstTime();} - + enum LoopMode { SWING, LOOP, NO_LOOPING }; - + void setLoopMode(LoopMode lm) { _loopMode = lm; } - + LoopMode getLoopMode() const { return _loopMode; } typedef std::map > TimeControlPointMap; - + TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; } - + const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; } - + /** read the anumation path from a flat ascii file stream.*/ void read(std::istream& in); /** write the anumation path to a flat ascii file stream.*/ void write(std::ostream& out) const; - + bool requiresBlending() const; protected: - + virtual ~AnimationMaterial() {} - + void interpolate(osg::Material& material, float r, const osg::Material& lhs,const osg::Material& rhs) const; TimeControlPointMap _timeControlPointMap; @@ -100,7 +100,7 @@ class OSGPRESENTATION_EXPORT AnimationMaterialCallback : public osg::NodeCallbac _latestTime(0.0), _pause(false), _pauseTime(0.0) {} - + AnimationMaterialCallback(const AnimationMaterialCallback& apc,const osg::CopyOp& copyop): osg::NodeCallback(apc,copyop), @@ -113,7 +113,7 @@ class OSGPRESENTATION_EXPORT AnimationMaterialCallback : public osg::NodeCallbac _pause(apc._pause), _pauseTime(apc._pauseTime) {} - + META_Object(osg,AnimationMaterialCallback); AnimationMaterialCallback(AnimationMaterial* ap,double timeOffset=0.0f,double timeMultiplier=1.0f): @@ -125,16 +125,16 @@ class OSGPRESENTATION_EXPORT AnimationMaterialCallback : public osg::NodeCallbac _latestTime(0.0), _pause(false), _pauseTime(0.0) {} - + void setAnimationMaterial(AnimationMaterial* path) { _animationMaterial = path; } AnimationMaterial* getAnimationMaterial() { return _animationMaterial.get(); } const AnimationMaterial* getAnimationMaterial() const { return _animationMaterial.get(); } - + void setTimeOffset(double offset) { _timeOffset = offset; } double getTimeOffset() const { return _timeOffset; } - + void setTimeMultiplier(double multiplier) { _timeMultiplier = multiplier; } double getTimeMultiplier() const { return _timeMultiplier; } @@ -148,7 +148,7 @@ class OSGPRESENTATION_EXPORT AnimationMaterialCallback : public osg::NodeCallbac /** implements the callback*/ virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); - + void update(osg::Node& node); public: @@ -163,7 +163,7 @@ class OSGPRESENTATION_EXPORT AnimationMaterialCallback : public osg::NodeCallbac double _pauseTime; protected: - + ~AnimationMaterialCallback(){} }; diff --git a/include/osgPresentation/CompileSlideCallback b/include/osgPresentation/CompileSlideCallback index 707b0b0f2..83c69c45d 100644 --- a/include/osgPresentation/CompileSlideCallback +++ b/include/osgPresentation/CompileSlideCallback @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -31,9 +31,9 @@ class OSGPRESENTATION_EXPORT CompileSlideCallback : public osg::Camera::DrawCall void needCompile(osg::Node* node) { _needCompile=true; _sceneToCompile = node; } protected: - + virtual ~CompileSlideCallback() {} - + mutable bool _needCompile; mutable unsigned int _frameNumber; osg::ref_ptr _sceneToCompile; diff --git a/include/osgPresentation/Export b/include/osgPresentation/Export index 2e2d5910c..9a9374fbd 100644 --- a/include/osgPresentation/Export +++ b/include/osgPresentation/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ # endif #else # define OSGPRESENTATION_EXPORT -#endif +#endif /** diff --git a/include/osgPresentation/PickEventHandler b/include/osgPresentation/PickEventHandler index 028ab9ee2..feed2195f 100644 --- a/include/osgPresentation/PickEventHandler +++ b/include/osgPresentation/PickEventHandler @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -30,37 +30,37 @@ class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler PickEventHandler(osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0); PickEventHandler(const std::string& str, osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0); PickEventHandler(const osgPresentation::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0); - + void setOperation(osgPresentation::Operation operation) { _operation = operation; } osgPresentation::Operation getOperation() const { return _operation; } - + void setCommand(const std::string& str) { _command = str; } const std::string& getCommand() const { return _command; } - + void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; } const osgPresentation::KeyPosition& getKeyPosition() const { return _keyPos; } - + void setRelativeJump(int slideDelta, int layerDelta); void setAbsoluteJump(int slideNum, int layerNum); - + bool getRelativeJump() const { return _relativeJump; } int getSlideNum() const { return _slideNum; } int getLayerNum() const { return _layerNum; } - + bool requiresJump() const { return _relativeJump ? (_slideNum!=0 || _layerNum!=0) : true; } virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv); - + virtual void accept(osgGA::GUIEventHandlerVisitor& v); - + virtual void getUsage(osg::ApplicationUsage& usage) const; - + void doOperation(); - + std::string _command; osgPresentation::KeyPosition _keyPos; osgPresentation::Operation _operation; - + bool _relativeJump; int _slideNum; int _layerNum; diff --git a/include/osgPresentation/SlideEventHandler b/include/osgPresentation/SlideEventHandler index 0f45af319..f220165a0 100644 --- a/include/osgPresentation/SlideEventHandler +++ b/include/osgPresentation/SlideEventHandler @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -162,14 +162,14 @@ class OSGPRESENTATION_EXPORT ActiveOperators public: ActiveOperators(); ~ActiveOperators(); - + void collect(osg::Node* incommingNode, osg::NodeVisitor::TraversalMode tm = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); void process(); - + void setPause(bool pause); bool getPause() const { return _pause; } - + void reset(); typedef std::set< osg::ref_ptr, dereference_less > OperatorList; @@ -196,9 +196,9 @@ class OSGPRESENTATION_EXPORT SlideEventHandler : public osgGA::GUIEventHandler public: SlideEventHandler(osgViewer::Viewer* viewer=0); - + static SlideEventHandler* instance(); - + META_Object(osgslideshowApp,SlideEventHandler); void set(osg::Node* model); @@ -209,9 +209,9 @@ public: virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&); - + virtual void getUsage(osg::ApplicationUsage& usage) const; - + osgViewer::Viewer* getViewer() { return _viewer.get(); } enum WhichPosition @@ -224,7 +224,7 @@ public: void releaseSlide(unsigned int slideNum); unsigned int getNumSlides(); - + int getActiveSlide() const { return _activeSlide; } int getActiveLayer() const { return _activeLayer; } @@ -239,15 +239,15 @@ public: bool nextLayer(); bool previousLayer(); - + bool home(); void setAutoSteppingActive(bool flag = true) { _autoSteppingActive = flag; } bool getAutoSteppingActive() const { return _autoSteppingActive; } - + void setTimeDelayBetweenSlides(double dt) { _timePerSlide = dt; } double getTimeDelayBetweenSlides() const { return _timePerSlide; } - + double getDuration(const osg::Node* node) const; double getCurrentTimeDelayBetweenSlides() const; @@ -266,7 +266,7 @@ public: void setRequestReload(bool flag); bool getRequestReload() const { return _requestReload; } - + protected: ~SlideEventHandler() {} @@ -276,13 +276,13 @@ protected: void updateAlpha(bool, bool, float x, float y); void updateLight(float x, float y); - + osg::observer_ptr _viewer; - + osg::observer_ptr _showSwitch; int _activePresentation; - + osg::observer_ptr _presentationSwitch; int _activeSlide; @@ -296,11 +296,11 @@ protected: bool _loopPresentation; bool _pause; bool _hold; - + bool _updateLightActive; bool _updateOpacityActive; float _previousX, _previousY; - + bool _cursorOn; bool _releaseAndCompileOnEachNewSlide; @@ -310,18 +310,18 @@ protected: osg::Timer_t _tickAtLastSlideOrLayerChange; float _timeDelayOnNewSlideWithMovies; - + double _minimumTimeBetweenKeyPresses; double _timeLastKeyPresses; - + ActiveOperators _activeOperators; - + osg::ref_ptr _compileSlideCallback; bool _requestReload; void updateOperators(); - + }; } diff --git a/include/osgPresentation/SlideShowConstructor b/include/osgPresentation/SlideShowConstructor index fe142955a..87d513a09 100644 --- a/include/osgPresentation/SlideShowConstructor +++ b/include/osgPresentation/SlideShowConstructor @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -74,17 +74,17 @@ class OSGPRESENTATION_EXPORT SlideShowConstructor { public: - + enum CoordinateFrame { SLIDE, MODEL }; - + LayerAttributes* getOrCreateLayerAttributes(osg::Node* node); - + void setDuration(osg::Node* node,double duration) { getOrCreateLayerAttributes(node)->setDuration(duration); } - + void addKey(osg::Node* node,const KeyPosition& kp) { getOrCreateLayerAttributes(node)->addKey(kp); @@ -102,13 +102,13 @@ public: void addPresentationKey(const KeyPosition& kp) { - if (!_presentationSwitch) createPresentation(); + if (!_presentationSwitch) createPresentation(); if (_presentationSwitch.valid()) addKey( _presentationSwitch.get(), kp); } void addPresentationRunString(const std::string& runString) { - if (!_presentationSwitch) createPresentation(); + if (!_presentationSwitch) createPresentation(); if (_presentationSwitch.valid()) addRunString( _presentationSwitch.get(),runString); } @@ -117,13 +117,13 @@ public: if (!_slide) addSlide(); if (_slide.valid()) addKey(_slide.get(),kp); } - + void addSlideRunString(const std::string& runString) { if (!_slide) addSlide(); if (_slide.valid()) addRunString(_slide.get(),runString); } - + void setSlideJump(bool relativeJump, int switchNum, int layerNum) { if (!_slide) addSlide(); @@ -141,7 +141,7 @@ public: if (!_currentLayer) addLayer(); if (_currentLayer.valid()) addRunString(_currentLayer.get(),runString); } - + void setLayerJump(bool relativeJump, int switchNum, int layerNum) { @@ -223,7 +223,7 @@ public: struct ModelData { ModelData() {} - + std::string effect; std::string options; }; @@ -317,24 +317,24 @@ public: SlideShowConstructor(osgDB::Options* options); void createPresentation(); - + void setBackgroundColor(const osg::Vec4& color, bool updateClearNode); const osg::Vec4& getBackgroundColor() const { return _backgroundColor; } - + void setTextColor(const osg::Vec4& color); const osg::Vec4& getTextColor() const { return _textFontDataDefault.color; } - + void setPresentationName(const std::string& name); - + void setPresentationAspectRatio(float aspectRatio); void setPresentationAspectRatio(const std::string& str); - + void setPresentationDuration(double duration); void addSlide(); - + void selectSlide(int slideNum); @@ -347,17 +347,17 @@ public: void setSlideBackgrondHUD(bool hud) { _slideBackgroundAsHUD = hud; } void setSlideBackground(const std::string& name) { _slideBackgroundImageFileName = name; } - + void setSlideDuration(double duration); void addLayer(bool inheritPreviousLayers=true, bool defineAsBaseLayer=false); - + void selectLayer(int layerNum); - + void setLayerDuration(double duration); - + // title settings FontData& getTitleFontData() { return _titleFontData; } FontData& getTitleFontDataDefault() { return _titleFontDataDefault; } @@ -368,7 +368,7 @@ public: // text settings FontData& getTextFontData() { return _textFontData; } FontData& getTextFontDataDefault() { return _textFontDataDefault; } - + PositionData& getTextPositionData() { return _textPositionData; } PositionData& getTextPositionDataDefault() { return _textPositionDataDefault; } @@ -388,11 +388,11 @@ public: void layerClickEventOperation(const KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0); void addToCurrentLayer(osg::Node* subgraph); - + void addBullet(const std::string& bullet, PositionData& positionData, FontData& fontData); - + void addParagraph(const std::string& paragraph, PositionData& positionData, FontData& fontData); - + void addImage(const std::string& filename,const PositionData& positionData, const ImageData& imageData); void addStereoImagePair(const std::string& filenameLeft, const ImageData& imageDataLeft, const std::string& filenameRight,const ImageData& imageDataRight, const PositionData& positionData); @@ -406,17 +406,17 @@ public: void addModel(osg::Node* subgraph, const PositionData& positionData, const ModelData& modelData); void addModel(const std::string& filename, const PositionData& positionData, const ModelData& modelData); - + void addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData); osg::Group* takePresentation() { return _root.release(); } - + osg::Group* getPresentation() { return _root.get(); } osg::Switch* getPresentationSwitch() { return _presentationSwitch.get(); } osg::Switch* getCurrentSlide() { return _slide.get(); } - + osg::Group* getCurrentLayer() { return _currentLayer.get(); } void setLoopPresentation(bool loop) { _loopPresentation = loop; } @@ -438,15 +438,15 @@ protected: osg::Vec3 computePositionInModelCoords(const PositionData& positionData) const; void updatePositionFromInModelCoords(const osg::Vec3& vertex, PositionData& positionData) const; - + osg::Vec3 convertSlideToModel(const osg::Vec3& position) const; osg::Vec3 convertModelToSlide(const osg::Vec3& position) const; osg::AnimationPathCallback* getAnimationPathCallback(const PositionData& positionData); - + osg::Node* attachMaterialAnimation(osg::Node* model, const PositionData& positionData); bool attachTexMat(osg::StateSet* stateset, const ImageData& imageData, float s, float t, bool textureRectangle); - + osg::StateSet* createTransformStateSet() { osg::StateSet* stateset = new osg::StateSet; @@ -469,7 +469,7 @@ protected: unsigned int _rightEyeMask; osg::ref_ptr _hudSettings; - + // title settings FontData _titleFontData; FontData _titleFontDataDefault; @@ -480,7 +480,7 @@ protected: // text settings FontData _textFontData; FontData _textFontDataDefault; - + PositionData _textPositionData; PositionData _textPositionDataDefault; @@ -501,24 +501,24 @@ protected: osg::ref_ptr _root; osg::ref_ptr _presentationSwitch; - + osg::ref_ptr _slideClearNode; osg::ref_ptr _slide; std::string _slideTitle; std::string _slideBackgroundImageFileName; bool _slideBackgroundAsHUD; - + osg::ref_ptr _previousLayer; osg::ref_ptr _currentLayer; - + osg::ref_ptr _filePathData; - + osg::ref_ptr _layerToApplyEventCallbackTo; osg::ref_ptr _currentEventCallbackToApply; std::string findFileAndRecordPath(const std::string& filename); - + void recordOptionsFilePath(const osgDB::Options* options); }; diff --git a/include/osgQt/Export b/include/osgQt/Export index 92e8b01c4..41efb3c45 100644 --- a/include/osgQt/Export +++ b/include/osgQt/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -38,7 +38,7 @@ #endif #else #define OSGQT_EXPORT -#endif +#endif #endif diff --git a/include/osgQt/GraphicsWindowQt b/include/osgQt/GraphicsWindowQt index df997656b..029c04569 100644 --- a/include/osgQt/GraphicsWindowQt +++ b/include/osgQt/GraphicsWindowQt @@ -97,10 +97,10 @@ protected: { _deferredEventQueue.enqueue(eventType); _eventCompressor.insert(eventType); - } + } } void processDeferredEvents(); - + friend class GraphicsWindowQt; GraphicsWindowQt* _gw; @@ -130,7 +130,7 @@ public: inline GLWidget* getGraphWidget() { return _widget; } /// deprecated inline const GLWidget* getGraphWidget() const { return _widget; } - + struct WindowData : public osg::Referenced { WindowData( GLWidget* widget = NULL, QWidget* parent = NULL ): _widget(widget), _parent(parent) {} @@ -164,7 +164,7 @@ public: virtual bool releaseContextImplementation(); virtual void swapBuffersImplementation(); virtual void runOperations(); - + virtual void requestWarpPointer( float x, float y ); protected: diff --git a/include/osgQt/QFontImplementation b/include/osgQt/QFontImplementation index f9408808b..1fc362564 100644 --- a/include/osgQt/QFontImplementation +++ b/include/osgQt/QFontImplementation @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 2009-2010 Mathias Froehlich * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef QFontImplementation_H @@ -31,13 +31,13 @@ public: virtual std::string getFileName() const; virtual bool supportsMultipleFontResolutions() const { return true; } - + virtual osgText::Glyph* getGlyph(const osgText::FontResolution& fontRes, unsigned int charcode); - + virtual osgText::Glyph3D* getGlyph3D(unsigned int charcode) { return 0; } - + virtual osg::Vec2 getKerning(unsigned int leftcharcode, unsigned int rightcharcode, osgText::KerningType kerningType); - + virtual bool hasVertical() const; protected: diff --git a/include/osgQt/QWidgetImage b/include/osgQt/QWidgetImage index 0217e7551..c98f390fe 100644 --- a/include/osgQt/QWidgetImage +++ b/include/osgQt/QWidgetImage @@ -34,7 +34,7 @@ class OSGQT_EXPORT QWidgetImage : public osg::Image void render(); - /// Overridden scaleImage used to catch cases where the image is + /// Overridden scaleImage used to catch cases where the image is /// fullscreen and the window is resized. virtual void scaleImage(int s,int t,int r, GLenum newDataType); diff --git a/include/osgShadow/ConvexPolyhedron b/include/osgShadow/ConvexPolyhedron index 5e0ebf129..73fa1811f 100644 --- a/include/osgShadow/ConvexPolyhedron +++ b/include/osgShadow/ConvexPolyhedron @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -25,8 +25,8 @@ // Class based on CustomPolytope defined and used in osgSim::OverlayNode.cpp. // Honors should go to Robert Osfield for writing such useful piece of code. // First incarnations of my ConvexPolyhedron were derived from CustomPolytope. -// Later I made a number of modifications aimed at improving convex hull -// precision of intersection & extrusion operations and ended up with code +// Later I made a number of modifications aimed at improving convex hull +// precision of intersection & extrusion operations and ended up with code // so mixed that I decided to rewrite it as separate class. //////////////////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ class OSGSHADOW_EXPORT ConvexPolyhedron bool mergeFaces ( const Face & face0, const Face & face1, Face & face ); - void mergeCoplanarFaces( const double & plane_normal_dot_tolerance = 0.0, + void mergeCoplanarFaces( const double & plane_normal_dot_tolerance = 0.0, const double & plane_distance_tolerance = 0.0 ); void removeDuplicateVertices( void ); @@ -75,7 +75,7 @@ class OSGSHADOW_EXPORT ConvexPolyhedron static int pointsColinear ( const osg::Vec3d & va, const osg::Vec3d & vb, const osg::Vec3d & vc, - const double & edge_normal_dot_tolerance = 0.0, + const double & edge_normal_dot_tolerance = 0.0, const double & null_edge_length_tolerance = 0.0 ); static int isFacePolygonConvex( Face & face, bool ignoreCollinearVertices = true ); diff --git a/include/osgShadow/DebugShadowMap b/include/osgShadow/DebugShadowMap index 992de2be6..8f4dc15fb 100644 --- a/include/osgShadow/DebugShadowMap +++ b/include/osgShadow/DebugShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -29,16 +29,16 @@ namespace osgShadow { /** Class used as a layer for debuging resources used by derived xxxShadowMap classes. -As designed by its base ViewDepndentShadowTechnique, DebugShadowMap serves mainly as container of +As designed by its base ViewDepndentShadowTechnique, DebugShadowMap serves mainly as container of DebugShadowMap::ViewData objects. Most of the debuging support work is done by these objects. -DebugShadowMap technique only initializes them in initViewDependentData method. +DebugShadowMap technique only initializes them in initViewDependentData method. Debuging outputs present: Shadow maps (pseudo colored to improve readability) Shadow and related volumes (represented as convex polyhedra) */ -class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique +class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique { public : @@ -46,7 +46,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique All classes stemming from ViewDependentShadowTechnique follow the same pattern. They are always based on some underlying level base Technique and they always - derive their ViewData from ViewData structure defined in underlying base Technique. + derive their ViewData from ViewData structure defined in underlying base Technique. I use some typedefs to make these inheritance patterns easier to declare/define. */ @@ -98,14 +98,14 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique struct OSGSHADOW_EXPORT ViewData: public BaseClass::ViewData { - /** - Texture used as ShadowMap - initialized by derived classes. - But it has to be defined now since DebugShadowMap::ViewData methods use it + /** + Texture used as ShadowMap - initialized by derived classes. + But it has to be defined now since DebugShadowMap::ViewData methods use it */ osg::ref_ptr< osg::Texture > _texture; - /** + /** Camera used to render ShadowMap - initialized by derived classes. - But it has to be defined now since DebugShadowMap::ViewData methods use it + But it has to be defined now since DebugShadowMap::ViewData methods use it */ osg::ref_ptr< osg::Camera > _camera; @@ -145,7 +145,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique std::map< std::string, osg::Polytope > _polytopeMap; std::map< std::string, osg::BoundingBox > _boundingBoxMap; - osg::ref_ptr _cameraDebugHUD; + osg::ref_ptr _cameraDebugHUD; bool getDebugDraw() { return *_doDebugDrawPtr; } std::string * getDebugDump() { return _debugDumpPtr; } @@ -158,12 +158,12 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique virtual void cullDebugGeometry( ); - virtual void updateDebugGeometry( const osg::Camera * screenCam, + virtual void updateDebugGeometry( const osg::Camera * screenCam, const osg::Camera * shadowCam ); void setDebugPolytope( const char * name, const ConvexPolyhedron & polytope = *(ConvexPolyhedron*)( NULL ), - osg::Vec4 colorOutline = osg::Vec4(0,0,0,0), + osg::Vec4 colorOutline = osg::Vec4(0,0,0,0), osg::Vec4 colorInside = osg::Vec4(0,0,0,0) ); bool DebugBoundingBox( const osg::BoundingBox & bb, const char * name = "" ); @@ -171,9 +171,9 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique bool DebugMatrix( const osg::Matrix & m, const char * name = "" ); static osg::Vec3d computeShadowTexelToPixelError - ( const osg::Matrix & mvpwView, + ( const osg::Matrix & mvpwView, const osg::Matrix & mvpwShadow, - const osg::Vec3d & vWorld, + const osg::Vec3d & vWorld, const osg::Vec3d & vDelta = osg::Vec3d( 0.01,0.01,0.01 ) ); static void displayShadowTexelToPixelErrors diff --git a/include/osgShadow/Export b/include/osgShadow/Export index 7e1175dbb..6aeb7e09e 100644 --- a/include/osgShadow/Export +++ b/include/osgShadow/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,7 +37,7 @@ # endif #else # define OSGSHADOW_EXPORT -#endif +#endif /** diff --git a/include/osgShadow/LightSpacePerspectiveShadowMap b/include/osgShadow/LightSpacePerspectiveShadowMap index 4b6fc7d56..405da730e 100644 --- a/include/osgShadow/LightSpacePerspectiveShadowMap +++ b/include/osgShadow/LightSpacePerspectiveShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -31,7 +31,7 @@ namespace osgShadow { class LispSM; -class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapAlgorithm +class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapAlgorithm { public: LightSpacePerspectiveShadowMapAlgorithm(); @@ -39,14 +39,14 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapAlgorithm void operator() ( const osgShadow::ConvexPolyhedron* hullShadowedView, - const osg::Camera* cameraMain, + const osg::Camera* cameraMain, osg::Camera* cameraShadow ) const; protected: LispSM * lispsm; }; -// Optimized for draw traversal shadow bounds +// Optimized for draw traversal shadow bounds class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapDB: public ProjectionShadowMap< MinimalDrawBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm > { public: @@ -60,7 +60,7 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapDB: public ProjectionShadow /** Classic OSG cloning constructor */ LightSpacePerspectiveShadowMapDB( - const LightSpacePerspectiveShadowMapDB& copy, + const LightSpacePerspectiveShadowMapDB& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop) { } @@ -69,21 +69,21 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapDB: public ProjectionShadow META_Object( osgShadow, LightSpacePerspectiveShadowMapDB ); }; -// Optimized for cull traversal shadow bounds +// Optimized for cull traversal shadow bounds class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapCB: public ProjectionShadowMap< MinimalCullBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm > { public: /** Convenient typedef used in definition of ViewData struct and methods */ typedef ProjectionShadowMap< MinimalCullBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm > BaseClass; - /** Classic OSG constructor */ + /** Classic OSG constructor */ LightSpacePerspectiveShadowMapCB() { } /** Classic OSG cloning constructor */ LightSpacePerspectiveShadowMapCB( - const LightSpacePerspectiveShadowMapCB& copy, + const LightSpacePerspectiveShadowMapCB& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop) { } @@ -92,7 +92,7 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapCB: public ProjectionShadow META_Object( osgShadow, LightSpacePerspectiveShadowMapCB ); }; -// Optimized for view frustum bounds +// Optimized for view frustum bounds class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapVB: public ProjectionShadowMap< MinimalShadowMap, LightSpacePerspectiveShadowMapAlgorithm > { public: @@ -106,7 +106,7 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapVB: public ProjectionShadow /** Classic OSG cloning constructor */ LightSpacePerspectiveShadowMapVB( - const LightSpacePerspectiveShadowMapVB& copy, + const LightSpacePerspectiveShadowMapVB& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop) { } diff --git a/include/osgShadow/MinimalCullBoundsShadowMap b/include/osgShadow/MinimalCullBoundsShadowMap index a00ad756f..5b2c0867c 100644 --- a/include/osgShadow/MinimalCullBoundsShadowMap +++ b/include/osgShadow/MinimalCullBoundsShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -35,7 +35,7 @@ class OSGSHADOW_EXPORT MinimalCullBoundsShadowMap /** Classic OSG cloning constructor */ MinimalCullBoundsShadowMap( - const MinimalCullBoundsShadowMap& mcbsm, + const MinimalCullBoundsShadowMap& mcbsm, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); /** Declaration of standard OSG object methods */ diff --git a/include/osgShadow/MinimalDrawBoundsShadowMap b/include/osgShadow/MinimalDrawBoundsShadowMap index b889729fb..2c85b3498 100644 --- a/include/osgShadow/MinimalDrawBoundsShadowMap +++ b/include/osgShadow/MinimalDrawBoundsShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -23,7 +23,7 @@ namespace osgShadow { class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap - : public MinimalShadowMap + : public MinimalShadowMap { public : /** Convenient typedef used in definition of ViewData struct and methods */ @@ -34,9 +34,9 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap /** Classic OSG constructor */ MinimalDrawBoundsShadowMap(); - /** Classic OSG cloning constructor */ + /** Classic OSG cloning constructor */ MinimalDrawBoundsShadowMap( - const MinimalDrawBoundsShadowMap& mdbsm, + const MinimalDrawBoundsShadowMap& mdbsm, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); /** Declaration of standard OSG object methods */ @@ -59,7 +59,7 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap { _projection = projection; } osg::RefMatrix * getShadowCameraProjectionMatrixPtr( void ) - { return _projection.get(); } + { return _projection.get(); } virtual void init( ThisClass * st, osgUtil::CullVisitor * cv ); @@ -100,7 +100,7 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap struct CameraCullCallback: public osg::NodeCallback { - CameraCullCallback(ViewData * vd, osg::NodeCallback * nc): _vd(vd), _nc(nc) + CameraCullCallback(ViewData * vd, osg::NodeCallback * nc): _vd(vd), _nc(nc) { } @@ -110,7 +110,7 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap if( _nc.valid() ) _nc->operator()(node,nv); - else + else traverse(node,nv); if( cv ) diff --git a/include/osgShadow/MinimalShadowMap b/include/osgShadow/MinimalShadowMap index fe43de129..6efac78e4 100644 --- a/include/osgShadow/MinimalShadowMap +++ b/include/osgShadow/MinimalShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -21,7 +21,7 @@ namespace osgShadow { -class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap +class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap { public : /** Convenient typedef used in definition of ViewData struct and methods */ @@ -34,7 +34,7 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap /** Classic OSG cloning constructor */ MinimalShadowMap( - const MinimalShadowMap& msm, + const MinimalShadowMap& msm, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); /** Declaration of standard OSG object methods */ @@ -69,7 +69,7 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap ( ShadowReceivingCoarseBoundAccuracy accuracy ) { _shadowReceivingCoarseBoundAccuracy = accuracy; } - ShadowReceivingCoarseBoundAccuracy + ShadowReceivingCoarseBoundAccuracy getShadowReceivingCoarseBoundAccuracy() const { return _shadowReceivingCoarseBoundAccuracy; } @@ -77,25 +77,25 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap /** Classic protected OSG destructor */ virtual ~MinimalShadowMap(void); - protected: + protected: // Matrix modellingSpaceToWorld and its inverse // are used to define Modelling Space where shadowed scene drawables // have minimal (smallest possible extent) bounding boxes. - // Computing visible shadow range in this space + // Computing visible shadow range in this space // allows for optimal use of ShadowMap resolution. // By default it is set to identity ie computations are in world space. - // But it should be set to ElipsoidModel::localToWorld + // But it should be set to ElipsoidModel::localToWorld // when scene objects are put on earth ellipsoid surface. - // Other scenarios are also possible for example when models are + // Other scenarios are also possible for example when models are // built in XZY space which would require identity matrix with swapped colums osg::Matrix _modellingSpaceToWorld; float _maxFarPlane; - float _minLightMargin; - ShadowReceivingCoarseBoundAccuracy _shadowReceivingCoarseBoundAccuracy; + float _minLightMargin; + ShadowReceivingCoarseBoundAccuracy _shadowReceivingCoarseBoundAccuracy; struct OSGSHADOW_EXPORT ViewData: public BaseClass::ViewData { @@ -115,7 +115,7 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap virtual void cullShadowReceivingScene( ); - virtual void aimShadowCastingCamera( + virtual void aimShadowCastingCamera( const osg::BoundingSphere &bounds, const osg::Light *light, const osg::Vec4 &worldLightPos, @@ -131,13 +131,13 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap virtual void frameShadowCastingCamera ( const osg::Camera* cameraMain, osg::Camera* cameraShadow, int pass = 1 ); - void cutScenePolytope( const osg::Matrix & matrix, + void cutScenePolytope( const osg::Matrix & matrix, const osg::Matrix & inverse, - const osg::BoundingBox &bb = + const osg::BoundingBox &bb = osg::BoundingBox(-1,-1,-1,1,1,1) ); osg::BoundingBox computeScenePolytopeBounds - ( const osg::Matrix & m = *(osg::Matrix*)(NULL) ); + ( const osg::Matrix & m = *(osg::Matrix*)(NULL) ); // Utility methods for adjusting projection matrices diff --git a/include/osgShadow/OccluderGeometry b/include/osgShadow/OccluderGeometry index 4d308a90a..c81ae5f08 100644 --- a/include/osgShadow/OccluderGeometry +++ b/include/osgShadow/OccluderGeometry @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ class ShadowVolumeGeometry; /** OccluderGeometry provides a sepecialised geometry representation of objects in scene that occlude light and therefore cast shadows. * OccluderGeometry supports the computation of silhouette edges and shadow volume geometries, as well as use as geometry that one can rendering * into a shadow map or end caps for the ZP+ algorithm. OccluderGeometry may be of the same resolution as an underlying geometry that it - * represents, or can be of lower resolution and combine manager seperate geometries together into a single shadow casting object. + * represents, or can be of lower resolution and combine manager seperate geometries together into a single shadow casting object. * OccluderGeometry may be attached as UserData to Nodes or to Drawables. */ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable { @@ -37,24 +37,24 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable OccluderGeometry(); OccluderGeometry(const OccluderGeometry& oc, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + virtual Object* cloneType() const { return new OccluderGeometry(); } virtual Object* clone(const osg::CopyOp& copyop) const { return new OccluderGeometry(*this,copyop); } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* libraryName() const { return "osgShadow"; } virtual const char* className() const { return "OccluderGeometry"; } - + /** Compute an occluder geometry containing all the geometry in specified subgraph.*/ void computeOccluderGeometry(osg::Node* subgraph, osg::Matrix* matrix=0, float sampleRatio=1.0f); - + /** Compute an occluder geometry containing the geometry in specified drawable.*/ void computeOccluderGeometry(osg::Drawable* drawable, osg::Matrix* matrix=0, float sampleRatio=1.0f); - + /** Compute ShadowVolumeGeometry. */ void computeShadowVolumeGeometry(const osg::Vec4& lightpos, ShadowVolumeGeometry& svg) const; - + /** Set the bounding polytope of the OccluderGeometry.*/ void setBoundingPolytope(const osg::Polytope& polytope) { _boundingPolytope = polytope; } @@ -67,7 +67,7 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable /** Render the occluder geometry. */ virtual void drawImplementation(osg::RenderInfo& renderInfo) const; - + /** Compute the bounding box around occluder geometry.*/ virtual osg::BoundingBox computeBound() const; @@ -81,7 +81,7 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable protected : virtual ~OccluderGeometry() {} - + struct Edge { Edge(): @@ -103,14 +103,14 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable _p2 = p1; } } - + inline bool operator < (const Edge& rhs) const { if (_p1 < rhs._p1) return true; if (_p1 > rhs._p1) return false; return (_p2 < rhs._p2); } - + bool addTriangle(unsigned int tri) const { if (_t1<0) @@ -126,15 +126,15 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable // argg more than two triangles assigned return false; } - + bool boundaryEdge() const { return _t2<0; } - + unsigned int _p1; unsigned int _p2; - + mutable int _t1; mutable int _t2; - + mutable osg::Vec3 _normal; }; @@ -143,12 +143,12 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable inline bool isLightPointSilhouetteEdge(const osg::Vec3& lightpos, const Edge& edge) const { if (edge.boundaryEdge()) return true; - + float offset = 0.0f; osg::Vec3 delta(lightpos-_vertices[edge._p1]); delta.normalize(); - + float n1 = delta * _triangleNormals[edge._t1] + offset; float n2 = delta * _triangleNormals[edge._t2] + offset; @@ -158,16 +158,16 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable n2 = cos(acosf(n2) + angle_offset); if (n1==0.0f && n2==0.0f) return false; - - return n1*n2 <= 0.0f; + + return n1*n2 <= 0.0f; } inline bool isLightDirectionSilhouetteEdge(const osg::Vec3& lightdirection, const Edge& edge) const { if (edge.boundaryEdge()) return true; - + float offset = 0.0f; - + float n1 = lightdirection * _triangleNormals[edge._t1] + offset; float n2 = lightdirection * _triangleNormals[edge._t2] + offset; @@ -177,17 +177,17 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable n2 = cos(acosf(n2) + angle_offset); if (n1==0.0f && n2==0.0f) return false; - - return n1*n2 <= 0.0f; + + return n1*n2 <= 0.0f; } - + void setUpInternalStructures(); - + void removeDuplicateVertices(); void removeNullTriangles(); void computeNormals(); void buildEdgeMaps(); - + void computeLightDirectionSilhouetteEdges(const osg::Vec3& lightdirection, UIntList& silhouetteIndices) const; void computeLightPositionSilhouetteEdges(const osg::Vec3& lightpos, UIntList& silhouetteIndices) const; @@ -197,7 +197,7 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable Vec3List _normals; Vec3List _triangleNormals; UIntList _triangleIndices; - + EdgeList _edges; }; @@ -207,7 +207,7 @@ class OSGSHADOW_EXPORT ShadowVolumeGeometry : public osg::Drawable ShadowVolumeGeometry(); ShadowVolumeGeometry(const ShadowVolumeGeometry& oc, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + virtual Object* cloneType() const { return new ShadowVolumeGeometry(); } virtual Object* clone(const osg::CopyOp& copyop) const { return new ShadowVolumeGeometry(*this,copyop); } virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } @@ -220,25 +220,25 @@ class OSGSHADOW_EXPORT ShadowVolumeGeometry : public osg::Drawable STENCIL_TWO_PASS, STENCIL_TWO_SIDED }; - + void setDrawMode(DrawMode mode) { _drawMode = mode; } DrawMode getDrawMode() const { return _drawMode; } typedef std::vector Vec3List; typedef std::vector UIntList; - + void setVertices(const Vec3List& vertices) { _vertices = vertices; } Vec3List& getVertices() { return _vertices; } const Vec3List& getVertices() const { return _vertices; } - + void setNormals(const Vec3List& normals) { _normals = normals; } Vec3List& getNormals() { return _normals; } const Vec3List& getNormals() const { return _normals; } - + /** Render the occluder geometry. */ virtual void drawImplementation(osg::RenderInfo& renderInfo) const; - + /** Compute the bounding box around occluder geometry.*/ virtual osg::BoundingBox computeBound() const; diff --git a/include/osgShadow/ParallelSplitShadowMap b/include/osgShadow/ParallelSplitShadowMap index accde8789..631a9adac 100644 --- a/include/osgShadow/ParallelSplitShadowMap +++ b/include/osgShadow/ParallelSplitShadowMap @@ -68,7 +68,7 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique /** Set the texture resolution */ inline void setTextureResolution(unsigned int resolution) { _resolution = resolution; } - + /** Get the texture resolution */ inline unsigned int getTextureResolution() const { return _resolution; } @@ -86,7 +86,7 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique /** Set min near distance for splits */ inline void setMinNearDistanceForSplits(double nd){ _split_min_near_dist=nd; } - + /** Get min near distance for splits */ inline double getMinNearDistanceForSplits() const { return _split_min_near_dist; } @@ -95,13 +95,13 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique * and simulated. just this user passed light, it needs to be a directional light. */ inline void setUserLight(osg::Light* light) { _userLight = light; } - + /** get the user defined light for shadow simulation */ inline const osg::Light* getUserLight() const { return _userLight.get(); } /** Set the values for the ambient bias the shader will use.*/ void setAmbientBias(const osg::Vec2& ambientBias ); - + /** Get the values for the ambient bias the shader will use.*/ const osg::Vec2& getAmbientBias() const { return _ambientBias; } @@ -129,7 +129,7 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique /** set split calculation mode */ inline void setSplitCalculationMode(SplitCalcMode scm=SPLIT_EXP) { _SplitCalcMode = scm; } - + /** get split calculation mode */ inline SplitCalcMode getSplitCalculationMode() const { return _SplitCalcMode; } diff --git a/include/osgShadow/ProjectionShadowMap b/include/osgShadow/ProjectionShadowMap index 612a8a431..927dd33fd 100644 --- a/include/osgShadow/ProjectionShadowMap +++ b/include/osgShadow/ProjectionShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -37,7 +37,7 @@ class OSGSHADOW_EXPORT ProjectionShadowMap : public MinimalBoundsBaseClass /** Classic OSG cloning constructor */ ProjectionShadowMap( - const ProjectionShadowMap& copy, + const ProjectionShadowMap& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop) { } @@ -45,20 +45,20 @@ class OSGSHADOW_EXPORT ProjectionShadowMap : public MinimalBoundsBaseClass /** Declaration of standard OSG object methods */ META_Object( osgShadow, ProjectionShadowMap ); - protected: + protected: /** Classic protected OSG destructor */ virtual ~ProjectionShadowMap(void) { } - struct OSGSHADOW_EXPORT ViewData: public BaseClass::ViewData, + struct OSGSHADOW_EXPORT ViewData: public BaseClass::ViewData, public ShadowProjectionAlgorithmClass - { + { #if 0 - virtual void init( ThisClass * st, osgUtil::CullVisitor * cv ); + virtual void init( ThisClass * st, osgUtil::CullVisitor * cv ); { - BaseClass::ViewData::init( st, cv ); + BaseClass::ViewData::init( st, cv ); } #endif diff --git a/include/osgShadow/ShadowMap b/include/osgShadow/ShadowMap index 5b809ff3e..9b16e97c6 100644 --- a/include/osgShadow/ShadowMap +++ b/include/osgShadow/ShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,9 +30,9 @@ class OSGSHADOW_EXPORT ShadowMap : public ShadowTechnique ShadowMap(); ShadowMap(const ShadowMap& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgShadow, ShadowMap); - + /** Set the texture unit that the shadow texture will be applied on.*/ void setTextureUnit(unsigned int unit); @@ -67,22 +67,22 @@ class OSGSHADOW_EXPORT ShadowMap : public ShadowTechnique /** Add a shader to internal list, will be used instead of the default ones */ inline void addShader(osg::Shader* shader) { _shaderList.push_back(shader); } - + /** Reset internal shader list */ inline void clearShaderList() { _shaderList.clear(); } /** initialize the ShadowedScene and local cached data structures.*/ virtual void init(); - + /** run the update traversal of the ShadowedScene and update any loca chached data structures.*/ virtual void update(osg::NodeVisitor& nv); - + /** run the cull traversal of the ShadowedScene and set up the rendering for this ShadowTechnique.*/ virtual void cull(osgUtil::CullVisitor& cv); - + /** Clean scene graph from any shadow technique specific nodes, state and drawables.*/ virtual void cleanSceneGraph(); - + // debug methods osg::ref_ptr makeDebugHUD(); @@ -94,7 +94,7 @@ class OSGSHADOW_EXPORT ShadowMap : public ShadowTechnique virtual void createUniforms(); virtual void createShaders(); - + // forward declare, interface and implementation provided in ShadowMap.cpp class DrawableDrawWithDepthShadowComparisonOffCallback; diff --git a/include/osgShadow/ShadowSettings b/include/osgShadow/ShadowSettings index f0be97d5a..e2a928205 100644 --- a/include/osgShadow/ShadowSettings +++ b/include/osgShadow/ShadowSettings @@ -37,7 +37,7 @@ class OSGSHADOW_EXPORT ShadowSettings : public osg::Object void setBaseShadowTextureUnit(unsigned int unit) { _baseShadowTextureUnit = unit; } unsigned int getBaseShadowTextureUnit() const { return _baseShadowTextureUnit; } - /** Set whether to use osg::StateAttribute::OVERRIDE for the shadow map texture. + /** Set whether to use osg::StateAttribute::OVERRIDE for the shadow map texture. * Enabling override will force the shadow map texture to override any texture set on the shadow maps texture unit.*/ void setUseOverrideForShadowMapTexture(bool useOverride) { _useShadowMapTextureOverride = useOverride; } @@ -72,7 +72,7 @@ class OSGSHADOW_EXPORT ShadowSettings : public osg::Object void setPerspectiveShadowMapCutOffAngle(double angle) { _perspectiveShadowMapCutOffAngle = angle; } double getPerspectiveShadowMapCutOffAngle() const { return _perspectiveShadowMapCutOffAngle; } - + void setNumShadowMapsPerLight(unsigned int numShadowMaps) { _numShadowMapsPerLight = numShadowMaps; } unsigned int getNumShadowMapsPerLight() const { return _numShadowMapsPerLight; } @@ -84,7 +84,7 @@ class OSGSHADOW_EXPORT ShadowSettings : public osg::Object void setMultipleShadowMapHint(MultipleShadowMapHint hint) { _multipleShadowMapHint = hint; } MultipleShadowMapHint getMultipleShadowMapHint() const { return _multipleShadowMapHint; } - + enum ShaderHint { @@ -95,10 +95,10 @@ class OSGSHADOW_EXPORT ShadowSettings : public osg::Object void setShaderHint(ShaderHint shaderHint) { _shaderHint = shaderHint; } ShaderHint getShaderHint() const { return _shaderHint; } - + void setDebugDraw(bool debugDraw) { _debugDraw = debugDraw; } bool getDebugDraw() const { return _debugDraw; } - + protected: virtual ~ShadowSettings(); @@ -114,7 +114,7 @@ class OSGSHADOW_EXPORT ShadowSettings : public osg::Object unsigned int _numShadowMapsPerLight; MultipleShadowMapHint _multipleShadowMapHint; - + ShaderHint _shaderHint; bool _debugDraw; diff --git a/include/osgShadow/ShadowTechnique b/include/osgShadow/ShadowTechnique index 10fdc38f9..f9b323090 100644 --- a/include/osgShadow/ShadowTechnique +++ b/include/osgShadow/ShadowTechnique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,27 +34,27 @@ class OSGSHADOW_EXPORT ShadowTechnique : public osg::Object ShadowTechnique(); ShadowTechnique(const ShadowTechnique& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgShadow, ShadowTechnique); ShadowedScene* getShadowedScene() { return _shadowedScene; } const ShadowedScene* getShadowedScene() const { return _shadowedScene; } - + /** initialize the ShadowedScene and local cached data structures.*/ virtual void init(); - + /** run the update traversal of the ShadowedScene and update any local cached data structures.*/ virtual void update(osg::NodeVisitor& nv); - + /** run the cull traversal of the ShadowedScene and set up the rendering for this ShadowTechnique.*/ virtual void cull(osgUtil::CullVisitor& cv); - + /** Clean scene graph from any shadow technique specific nodes, state and drawables.*/ virtual void cleanSceneGraph(); virtual void traverse(osg::NodeVisitor& nv); - + /** Dirty so that cached data structures are updated.*/ virtual void dirty() { _dirty = true; } @@ -76,12 +76,12 @@ class OSGSHADOW_EXPORT ShadowTechnique : public osg::Object osg::Vec3 computeOrthogonalVector(const osg::Vec3& direction) const; virtual ~ShadowTechnique(); - + friend class ShadowedScene; - + ShadowedScene* _shadowedScene; bool _dirty; - + }; } diff --git a/include/osgShadow/ShadowTexture b/include/osgShadow/ShadowTexture index 2588a29fa..b7938033d 100644 --- a/include/osgShadow/ShadowTexture +++ b/include/osgShadow/ShadowTexture @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,28 +28,28 @@ class OSGSHADOW_EXPORT ShadowTexture : public ShadowTechnique ShadowTexture(); ShadowTexture(const ShadowTexture& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgShadow, ShadowTexture); - + /** Set the texture unit that the shadow texture will be applied on.*/ void setTextureUnit(unsigned int unit); /** Get the texture unit that the shadow texture will be applied on.*/ unsigned int getTextureUnit() const { return _textureUnit; } - - + + /** initialize the ShadowedScene and local cached data structures.*/ virtual void init(); - + /** run the update traversal of the ShadowedScene and update any loca chached data structures.*/ virtual void update(osg::NodeVisitor& nv); - + /** run the cull traversal of the ShadowedScene and set up the rendering for this ShadowTechnique.*/ virtual void cull(osgUtil::CullVisitor& cv); - + /** Clean scene graph from any shadow technique specific nodes, state and drawables.*/ virtual void cleanSceneGraph(); - + protected : diff --git a/include/osgShadow/ShadowVolume b/include/osgShadow/ShadowVolume index d6c7ed779..73cb04e33 100644 --- a/include/osgShadow/ShadowVolume +++ b/include/osgShadow/ShadowVolume @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,9 +30,9 @@ class OSGSHADOW_EXPORT ShadowVolume : public ShadowTechnique ShadowVolume(); ShadowVolume(const ShadowVolume& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgShadow, ShadowVolume); - + void setDrawMode(osgShadow::ShadowVolumeGeometry::DrawMode drawMode); osgShadow::ShadowVolumeGeometry::DrawMode getDrawMode() const { return _drawMode; } @@ -42,31 +42,31 @@ class OSGSHADOW_EXPORT ShadowVolume : public ShadowTechnique /** initialize the ShadowedScene and local cached data structures.*/ virtual void init(); - + /** run the update traversal of the ShadowedScene and update any loca chached data structures.*/ virtual void update(osg::NodeVisitor& nv); - + /** run the cull traversal of the ShadowedScene and set up the rendering for this ShadowTechnique.*/ virtual void cull(osgUtil::CullVisitor& cv); - + /** Clean scene graph from any shadow technique specific nodes, state and drawables.*/ virtual void cleanSceneGraph(); - + protected : virtual ~ShadowVolume(); - + osgShadow::ShadowVolumeGeometry::DrawMode _drawMode; bool _dynamicShadowVolumes; osg::ref_ptr _occluder; - + OpenThreads::Mutex _shadowVolumeMutex; osg::ref_ptr _shadowVolume; - + osg::Vec4 _lightpos; - + osg::ref_ptr _ambientLight; osg::ref_ptr _diffuseLight; diff --git a/include/osgShadow/ShadowedScene b/include/osgShadow/ShadowedScene index 194976490..9a70f752e 100644 --- a/include/osgShadow/ShadowedScene +++ b/include/osgShadow/ShadowedScene @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,21 +28,21 @@ namespace osgShadow { class OSGSHADOW_EXPORT ShadowedScene : public osg::Group { public: - + ShadowedScene(ShadowTechnique* st=0); ShadowedScene(const ShadowedScene& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Node(osgShadow, ShadowedScene); - + virtual void traverse(osg::NodeVisitor& nv); - + void setReceivesShadowTraversalMask(unsigned int mask) { _receivesShadowTraversalMask = mask; } unsigned int getReceivesShadowTraversalMask() const { return _receivesShadowTraversalMask; } - + void setCastsShadowTraversalMask(unsigned int mask) { _castsShadowTraversalMask = mask; } unsigned int getCastsShadowTraversalMask() const { return _castsShadowTraversalMask; } - + void setShadowSettings(ShadowSettings* ss); ShadowSettings* getShadowSettings() { return _shadowSettings.get(); } const ShadowSettings* getShadowSettings() const { return _shadowSettings.get(); } @@ -54,9 +54,9 @@ class OSGSHADOW_EXPORT ShadowedScene : public osg::Group /** Clean scene graph from any shadow technique specific nodes, state and drawables.*/ void cleanSceneGraph(); - /** Dirty any cache data structures held in the attached ShadowTechnqiue.*/ + /** Dirty any cache data structures held in the attached ShadowTechnqiue.*/ void dirty(); - + /** Resize any per context GLObject buffers to specified size. */ virtual void resizeGLObjectBuffers(unsigned int maxSize); @@ -74,7 +74,7 @@ protected: osg::ref_ptr _shadowSettings; osg::ref_ptr _shadowTechnique; - + }; } diff --git a/include/osgShadow/SoftShadowMap b/include/osgShadow/SoftShadowMap index cbceb915f..0a2315a9f 100644 --- a/include/osgShadow/SoftShadowMap +++ b/include/osgShadow/SoftShadowMap @@ -58,32 +58,32 @@ class OSGSHADOW_EXPORT SoftShadowMap : public ShadowMap unsigned int getJitterTextureUnit() const { return _jitterTextureUnit; } - /** Add a small bias to the z-value, this can reduce - * shadow acne problem. + /** Add a small bias to the z-value, this can reduce + * shadow acne problem. * This is the same as calling setPolygonOffset(osg::Vec2(bias,0)); - * Suitable values are 0-0.005 + * Suitable values are 0-0.005 * Default is 0. */ void setBias(float bias) { setPolygonOffset(osg::Vec2(bias,0)); } - + /** Return the bias value */ float getBias() const { return getPolygonOffset().x(); } protected: virtual ~SoftShadowMap(void) {}; - + /** Create the managed Uniforms */ void createUniforms(); void createShaders(); void initJittering(osg::StateSet *ss); - + osg::ref_ptr _softnessWidthUniform; osg::ref_ptr _jitteringScaleUniform; float _softnessWidth; float _jitteringScale; unsigned int _jitterTextureUnit; - + }; diff --git a/include/osgShadow/StandardShadowMap b/include/osgShadow/StandardShadowMap index 336472de2..edf38ee5a 100644 --- a/include/osgShadow/StandardShadowMap +++ b/include/osgShadow/StandardShadowMap @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -27,13 +27,13 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap /** Convenient typedef used in definition of ViewData struct and methods */ typedef StandardShadowMap ThisClass; /** Convenient typedef used in definition of ViewData struct and methods */ - typedef DebugShadowMap BaseClass; + typedef DebugShadowMap BaseClass; /** Classic OSG constructor */ StandardShadowMap(); /** Classic OSG cloning constructor */ - StandardShadowMap(const StandardShadowMap& ssm, + StandardShadowMap(const StandardShadowMap& ssm, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); /** Declaration of standard OSG object methods */ @@ -53,24 +53,24 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap // Texture Indices are changed by search and replace on shader source // Carefully order these calls when changing both base and shadow indices - // In worst case when intend to swap indices - // one will have to call these methods more than once - // with one extra pass to change index to unused value to avoid + // In worst case when intend to swap indices + // one will have to call these methods more than once + // with one extra pass to change index to unused value to avoid // unwanted superfluous replace: // // Example: Imagine we want to swap base(0) and shadow(1) indices: // We have to do an extra step to make sure both do not end up as 1 - // + // // // initialy change base to something else than 1 - // setBaseTextureCoordIndex( 100 ); + // setBaseTextureCoordIndex( 100 ); // // now search and replace all gl_TexCord[1] to gl_TexCord[0] // setShadowTextureCoordIndex( 0 ); // // finally change base from 100 to 0 - // setBaseTextureCoordIndex( 1 ); + // setBaseTextureCoordIndex( 1 ); void setBaseTextureCoordIndex( unsigned int index ) { updateTextureCoordIndices( _baseTextureCoordIndex, index ); - _baseTextureCoordIndex = index; } + _baseTextureCoordIndex = index; } unsigned int getBaseTextureCoordIndex( void ) const { return _baseTextureCoordIndex; } @@ -96,14 +96,14 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap osg::Light* getLight( void ) { return _light.get(); } - + const osg::Light* getLight( void ) const { return _light.get(); } - osg::Shader * getShadowVertexShader() + osg::Shader * getShadowVertexShader() { return _shadowVertexShader.get(); } - osg::Shader * getShadowFragmentShader() + osg::Shader * getShadowFragmentShader() { return _shadowFragmentShader.get(); } osg::Shader * getMainVertexShader( ) @@ -115,10 +115,10 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap void setShadowVertexShader( osg::Shader * shader ) { _shadowVertexShader = shader; } - void setShadowFragmentShader( osg::Shader * shader ) + void setShadowFragmentShader( osg::Shader * shader ) { _shadowFragmentShader = shader; } - void setMainVertexShader( osg::Shader * shader ) + void setMainVertexShader( osg::Shader * shader ) { _mainVertexShader = shader; } void setMainFragmentShader( osg::Shader * shader ) @@ -167,11 +167,11 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap virtual void cull( ); - virtual void aimShadowCastingCamera( + virtual void aimShadowCastingCamera( const osg::BoundingSphere &bounds, const osg::Light *light, const osg::Vec4 &worldLightPos, - const osg::Vec3 &worldLightDir, + const osg::Vec3 &worldLightDir, const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) ); virtual void cullShadowReceivingScene( ); @@ -185,11 +185,11 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap virtual void aimShadowCastingCamera( const osg::Light *light, const osg::Vec4 &worldLightPos, - const osg::Vec3 &worldLightDir, + const osg::Vec3 &worldLightDir, const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) ); }; - + friend struct ViewData; META_ViewDependentShadowTechniqueData( ThisClass, ThisClass::ViewData ) diff --git a/include/osgShadow/Version b/include/osgShadow/Version index bf39078dc..2910d51f4 100644 --- a/include/osgShadow/Version +++ b/include/osgShadow/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgShadow/ViewDependentShadowMap b/include/osgShadow/ViewDependentShadowMap index 2f3f3c9c0..a9f5e717a 100644 --- a/include/osgShadow/ViewDependentShadowMap +++ b/include/osgShadow/ViewDependentShadowMap @@ -61,10 +61,10 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique osg::Matrixd projectionMatrix; osg::Matrixd modelViewMatrix; - + typedef std::vector Vertices; Vertices corners; - + typedef std::vector Indices; typedef std::vector Faces; Faces faces; @@ -81,15 +81,15 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique // forward declare class ViewDependentData; - + struct OSGSHADOW_EXPORT LightData : public osg::Referenced { LightData(ViewDependentData* vdd); virtual void setLightData(osg::RefMatrix* lm, const osg::Light* l, const osg::Matrixd& modelViewMatrix); - + ViewDependentData* _viewDependentData; - + osg::ref_ptr lightMatrix; osg::ref_ptr light; @@ -101,7 +101,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique typedef std::vector ActiveTextureUnits; ActiveTextureUnits textureUnits; }; - + typedef std::list< osg::ref_ptr > LightDataList; struct OSGSHADOW_EXPORT ShadowData : public osg::Referenced @@ -111,7 +111,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique virtual void releaseGLObjects(osg::State* = 0) const; ViewDependentData* _viewDependentData; - + unsigned int _textureUnit; osg::ref_ptr _texture; osg::ref_ptr _texgen; @@ -119,7 +119,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique }; typedef std::list< osg::ref_ptr > ShadowDataList; - + class OSGSHADOW_EXPORT ViewDependentData : public osg::Referenced { @@ -133,7 +133,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique ShadowDataList& getShadowDataList() { return _shadowDataList; } osg::StateSet* getStateSet() { return _stateset.get(); } - + virtual void releaseGLObjects(osg::State* = 0) const; protected: @@ -162,7 +162,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique virtual bool computeShadowCameraSettings(Frustum& frustum, LightData& positionedLight, osg::Matrixd& projectionMatrix, osg::Matrixd& viewMatrix); virtual bool adjustPerspectiveShadowMapCameraSettings(osgUtil::RenderStage* renderStage, Frustum& frustum, LightData& positionedLight, osg::Camera* camera); - + virtual bool assignTexGenSettings(osgUtil::CullVisitor* cv, osg::Camera* camera, unsigned int textureUnit, osg::TexGen* texgen); virtual void cullShadowReceivingScene(osgUtil::CullVisitor* cv) const; @@ -185,7 +185,7 @@ protected: osg::ref_ptr _polygonOffset; osg::ref_ptr _fallbackBaseTexture; osg::ref_ptr _fallbackShadowMapTexture; - + typedef std::vector< osg::ref_ptr > Uniforms; Uniforms _uniforms; osg::ref_ptr _program; diff --git a/include/osgShadow/ViewDependentShadowTechnique b/include/osgShadow/ViewDependentShadowTechnique index 8c7b86960..6be80fecb 100644 --- a/include/osgShadow/ViewDependentShadowTechnique +++ b/include/osgShadow/ViewDependentShadowTechnique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -24,9 +24,9 @@ namespace osgShadow { /** META_ViewDependentShadowTechniqueData macro defines initViewDependentData - method used by derived shadow techniques to initialize their specific - ViewData objects. initViewDependentData will be called from - ViewDependentShadowTechnique base class to init derived class + method used by derived shadow techniques to initialize their specific + ViewData objects. initViewDependentData will be called from + ViewDependentShadowTechnique base class to init derived class */ #define META_ViewDependentShadowTechniqueData( ShadowTechnique, TechniqueData )\ virtual ViewDependentShadowTechnique::ViewData * initViewDependentData \ @@ -39,82 +39,82 @@ virtual ViewDependentShadowTechnique::ViewData * initViewDependentData \ } /** - ViewDependentShadowTechnique is a base class for all - View Dependent Shadow techniques. It defines fundamental object structure + ViewDependentShadowTechnique is a base class for all + View Dependent Shadow techniques. It defines fundamental object structure and methods to manage separate shadow resources for each view of the scene. - By view we understand osg::View or SceneView instance and their associated - Camera. Typical osg application has one or more such views. View Dependent + By view we understand osg::View or SceneView instance and their associated + Camera. Typical osg application has one or more such views. View Dependent Shadow techniques manage shadow generation for them. - View Dependent Shadow techniques are used to optimize shadow algorithms for - part of the scene seen on the view. If rest of the scene is behind view - frustum, there is no sense in computing shadows for it. Since in practice we - often use 3d databases extending far beyond current camera frustum View - Dependent Shadow approach may produce much better shadows. + View Dependent Shadow techniques are used to optimize shadow algorithms for + part of the scene seen on the view. If rest of the scene is behind view + frustum, there is no sense in computing shadows for it. Since in practice we + often use 3d databases extending far beyond current camera frustum View + Dependent Shadow approach may produce much better shadows. - The other goal is to provide framework for thread safe rendering of + The other goal is to provide framework for thread safe rendering of the shadows. It allows to use shadows with different OSG threading models. Conceptually ViewDependentShadowTechnique is similar to osgSim::OverlayNode. - Its a container class for number of ViewData (or ViewData derived) objects - doing actual shadow work for each of the scene views. + Its a container class for number of ViewData (or ViewData derived) objects + doing actual shadow work for each of the scene views. - But ViewDependentShadowTechnique is intended as foundation layer for all + But ViewDependentShadowTechnique is intended as foundation layer for all derived classes so in some way it extends osgSim::OverlayNode approach a bit. HOW IT WORKS: ViewDependendentShadowTechnique is derived from osgShadow::ShadowTechnique and as such overrides virtual methods of osgShadow::ShadowTechnique. - But most of the shadow dirty work is done by ViewData objects, + But most of the shadow dirty work is done by ViewData objects, ViewDependendentShadowTechnique::cull is the only osgShadow::ShadowTechnique method where ViewDependendentShadowTechnique does something significant: - What ViewDependentShadowTechnique::cull( CullVisitor & cv ) does ? - It identifies View. CullVisitor ptr is used as View identificator. - In practice we do not check and interpret what are actual Views and SceneViews - set up by application. We focus on Camera and CullVisitors as a identificators - of views. We can safely do this because each such view will have associated + What ViewDependentShadowTechnique::cull( CullVisitor & cv ) does ? + It identifies View. CullVisitor ptr is used as View identificator. + In practice we do not check and interpret what are actual Views and SceneViews + set up by application. We focus on Camera and CullVisitors as a identificators + of views. We can safely do this because each such view will have associated unique CullVisitor used to cull the scene in every frame. - - Based on CullVisitor ptr passed to cull method, associated Technique::ViewData - object is created (if neccessary) and then seleced. Then control is passed to - this ViewData object. So, each view has its associated unique ViewData - (or derived) object performing dirty work of shadow resources management and + + Based on CullVisitor ptr passed to cull method, associated Technique::ViewData + object is created (if neccessary) and then seleced. Then control is passed to + this ViewData object. So, each view has its associated unique ViewData + (or derived) object performing dirty work of shadow resources management and shadow generation for the view. - To support creation of classes derived from ViewDependentShadowTechnique it - was neccessary to provide mechanism to override ViewData and allow for - initialization of new derived ViewData objects. Creation and initialization + To support creation of classes derived from ViewDependentShadowTechnique it + was neccessary to provide mechanism to override ViewData and allow for + initialization of new derived ViewData objects. Creation and initialization is performed when ViewDependendentShadowTechnique::cull gets called with - CullVistor ptr which does not yet have associated ViewData object. When it - happens, virtual initViewDependentData method is called to give - derived techniques a chance to allocate and iniitalize its specific - resources as new ViewData derived instance. In practice initViewDependentData + CullVistor ptr which does not yet have associated ViewData object. When it + happens, virtual initViewDependentData method is called to give + derived techniques a chance to allocate and iniitalize its specific + resources as new ViewData derived instance. In practice initViewDependentData in derived techniques should look the same as in base class so as a convenience it was defined as META_ViewDependentShadowTechnique macro. Derived techniques use this macro to override initViewDependentData method for their usage. - After ViewData derived object is construted and selected, control is passed - to this object by call to virtual ViewData::cull method. The rest of work - is the done by this object. ViewDependentShadowTechnique::ViewData is intended - as a base class so it does nothing. In practice the rest of dirty work will + After ViewData derived object is construted and selected, control is passed + to this object by call to virtual ViewData::cull method. The rest of work + is the done by this object. ViewDependentShadowTechnique::ViewData is intended + as a base class so it does nothing. In practice the rest of dirty work will do new ViewData classes implemented in derived techniques. */ class OSGSHADOW_EXPORT ViewDependentShadowTechnique - : public osgShadow::ShadowTechnique + : public osgShadow::ShadowTechnique { public: /** - osgShadow::ShadowTechnique equivalent methods for view dependent techniques + osgShadow::ShadowTechnique equivalent methods for view dependent techniques */ /** Classic OSG constructor */ ViewDependentShadowTechnique( void ); /** Classic OSG cloning constructor */ - ViewDependentShadowTechnique( - const ViewDependentShadowTechnique& vdst, + ViewDependentShadowTechnique( + const ViewDependentShadowTechnique& vdst, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ); @@ -143,8 +143,8 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique /** Classic protected OSG destructor */ ~ViewDependentShadowTechnique( void ); - /** - Base container class for view dependent shadow resources. + /** + Base container class for view dependent shadow resources. Techniques based on ViewDependentShadowTechnique will usually define similar struct and derive it from ViewData to contain their specufic resources. */ @@ -159,13 +159,13 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique ( ViewDependentShadowTechnique *st, osgUtil::CullVisitor *cv ); /** - Method called by ViewDependentShadowTechnique to allow ViewData + Method called by ViewDependentShadowTechnique to allow ViewData do the hard work computing shadows for its associated view */ virtual void cull(); - /** - Dirty is called by parent ViewDependentShadowTechnique to force + /** + Dirty is called by parent ViewDependentShadowTechnique to force update of resources after some of them were modified in parent technique */ virtual void dirty( bool flag ); @@ -176,30 +176,30 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique ViewData(): _dirty( true ), _cv( NULL ), _st( NULL ) { }; /** - Mutex used to guard _dirty flag from override in case when parent technique calls + Mutex used to guard _dirty flag from override in case when parent technique calls dirty() simultaneously with ViewData while it is updating resources inside init method. */ OpenThreads::Mutex _mutex; /** - Dirty flag tells this instance to update its resources + Dirty flag tells this instance to update its resources */ bool _dirty; - /** - View's CullVisitor associated with this ViewData instance + /** + View's CullVisitor associated with this ViewData instance */ osg::observer_ptr< osgUtil::CullVisitor > _cv; /** - Parent ViewDependentShadowTechnique + Parent ViewDependentShadowTechnique */ osg::observer_ptr< ViewDependentShadowTechnique > _st; }; - /** - Map of view dependent data per view cull visitor (CVs are used as indices) + /** + Map of view dependent data per view cull visitor (CVs are used as indices) ViewDependentShadowTechnique uses this map to find VieData for each cull vitior */ @@ -220,8 +220,8 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique /** Define view dependent data for the cull visitor */ virtual void setViewDependentData( osgUtil::CullVisitor * cv, ViewDependentShadowTechnique::ViewData * data ); - /** - Declare standard initViewDependentData method. + /** + Declare standard initViewDependentData method. */ META_ViewDependentShadowTechniqueData( ViewDependentShadowTechnique, ViewData ) }; diff --git a/include/osgSim/BlinkSequence b/include/osgSim/BlinkSequence index 6cf75ab51..85b3c5738 100644 --- a/include/osgSim/BlinkSequence +++ b/include/osgSim/BlinkSequence @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ class OSGSIM_EXPORT SequenceGroup : public osg::Object SequenceGroup(double baseTime); META_Object(osgSim,SequenceGroup); - + inline void setBaseTime( double t ) { _baseTime = t; } inline double getBaseTime() const { return _baseTime; } @@ -80,7 +80,7 @@ class OSGSIM_EXPORT BlinkSequence : public osg::Object /** set the phase shift of the blink sequence, this would be used to shift a sequence within a sequence group.*/ inline void setPhaseShift(double ps) { _phaseShift = ps; } - /** get the pahse shift.*/ + /** get the pahse shift.*/ inline double getPhaseShift() const { return _phaseShift; } /** compute the local time clamped to this BlinkSequences period, and accounting for the phase shift and sequence group.*/ @@ -88,14 +88,14 @@ class OSGSIM_EXPORT BlinkSequence : public osg::Object /** compute the color for the time interval sepecifed. Averages the colors if the length is greater than the current pulse.*/ inline osg::Vec4 color(double time,double length) const; - + protected: typedef std::pair IntervalColor; typedef std::vector PulseData; - + double _pulsePeriod; double _phaseShift; PulseData _pulseData; @@ -145,7 +145,7 @@ inline osg::Vec4 BlinkSequence::color(double time,double length) const if (itr==_pulseData.end()) itr = _pulseData.begin(); } - // if time interval fits inside the current pulse + // if time interval fits inside the current pulse // then simply return this pulses color value. if (lt+length<=itr->first) { @@ -174,7 +174,7 @@ inline osg::Vec4 BlinkSequence::color(double time,double length) const // add remaining part of the final pulse. color += itr->second*len; - // normalise the time waited color. + // normalise the time waited color. color /= length; return color; diff --git a/include/osgSim/ColorRange b/include/osgSim/ColorRange index b1e8c5ca9..0f9fd2fa4 100644 --- a/include/osgSim/ColorRange +++ b/include/osgSim/ColorRange @@ -41,13 +41,13 @@ public: /** Constructor for a ColorRange @param min minimum scalar value @param max maximum scalar value - @param colors optional range of colors, + @param colors optional range of colors, */ ColorRange(float min, float max, const std::vector& colors); /** Set the range of colors. */ void setColors(const std::vector& colors); - + /** Get the range of colors */ const std::vector& getColors() const { return _colors; } diff --git a/include/osgSim/DOFTransform b/include/osgSim/DOFTransform index 6f4cb3e8f..ece565cc8 100644 --- a/include/osgSim/DOFTransform +++ b/include/osgSim/DOFTransform @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgSim/ElevationSlice b/include/osgSim/ElevationSlice index d433e6a7c..0d634a75b 100644 --- a/include/osgSim/ElevationSlice +++ b/include/osgSim/ElevationSlice @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,34 +33,34 @@ class OSGSIM_EXPORT ElevationSlice { public : - + ElevationSlice(); - - /** Set the start point of the slice.*/ + + /** Set the start point of the slice.*/ void setStartPoint(const osg::Vec3d& startPoint) { _startPoint = startPoint; } - /** Get the start point of the slice.*/ + /** Get the start point of the slice.*/ const osg::Vec3d& getStartPoint() const { return _startPoint; } - - /** Set the end point of the slice.*/ + + /** Set the end point of the slice.*/ void setEndPoint(const osg::Vec3d& endPoint) { _endPoint = endPoint; } - /** Get the end point of the slice.*/ + /** Get the end point of the slice.*/ const osg::Vec3d& getEndPoint() const { return _endPoint; } - + typedef std::vector Vec3dList; - + /** Get the intersections in the form of a vector of Vec3d. */ const Vec3dList& getIntersections() const { return _intersections; } typedef std::pair DistanceHeight; typedef std::vector DistanceHeightList; - + /** Get the intersections in the form a vector of pair representing distance along the slice and height. */ const DistanceHeightList& getDistanceHeightIntersections() const { return _distanceHeightIntersections; } - - + + /** Compute the intersections with the specified scene graph, the results are stored in vectors of Vec3d. * Note, if the topmost node is a CoordinateSystemNode then the input points are assumed to be geocentric, * with the up vector defined by the EllipsoidModel attached to the CoordinateSystemNode. @@ -69,8 +69,8 @@ class OSGSIM_EXPORT ElevationSlice /** Compute the vertical distance between the specified scene graph and a single HAT point.*/ static Vec3dList computeElevationSlice(osg::Node* scene, const osg::Vec3d& startPoint, const osg::Vec3d& endPoint, osg::Node::NodeMask traversalMask=0xffffffff); - - + + /** Clear the database cache.*/ void clearDatabaseCache() { if (_dcrc.valid()) _dcrc->clearDatabaseCache(); } @@ -83,13 +83,13 @@ class OSGSIM_EXPORT ElevationSlice DatabaseCacheReadCallback* getDatabaseCacheReadCallback() { return _dcrc.get(); } protected : - - + + osg::Vec3d _startPoint; osg::Vec3d _endPoint; Vec3dList _intersections; DistanceHeightList _distanceHeightIntersections; - + osg::ref_ptr _dcrc; osgUtil::IntersectionVisitor _intersectionVisitor; diff --git a/include/osgSim/Export b/include/osgSim/Export index a6e8e967c..973230788 100644 --- a/include/osgSim/Export +++ b/include/osgSim/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ # endif #else # define OSGSIM_EXPORT -#endif +#endif /* Define NULL pointer value */ diff --git a/include/osgSim/GeographicLocation b/include/osgSim/GeographicLocation index e0b9c5269..e53dd2119 100644 --- a/include/osgSim/GeographicLocation +++ b/include/osgSim/GeographicLocation @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgSim/HeightAboveTerrain b/include/osgSim/HeightAboveTerrain index b7f1d22c2..9d0dfbbcb 100644 --- a/include/osgSim/HeightAboveTerrain +++ b/include/osgSim/HeightAboveTerrain @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,19 +33,19 @@ class OSGSIM_EXPORT HeightAboveTerrain { public : - + HeightAboveTerrain(); - - + + /** Clear the internal HAT List so it contains no height above terrain tests.*/ void clear(); - + /** Add a height above terrain test point in the CoordinateFrame.*/ unsigned int addPoint(const osg::Vec3d& point); /** Get the number of height above terrain tests.*/ unsigned int getNumPoints() const { return _HATList.size(); } - + /** Set the source point of single height above terrain test.*/ void setPoint(unsigned int i, const osg::Vec3d& point) { _HATList[i]._point = point; } @@ -53,7 +53,7 @@ class OSGSIM_EXPORT HeightAboveTerrain const osg::Vec3d& getPoint(unsigned int i) const { return _HATList[i]._point; } /** Get the intersection height for a single height above terrain test. - * Note, you must call computeIntersections(..) before you can query the HeightAboveTerrain. + * Note, you must call computeIntersections(..) before you can query the HeightAboveTerrain. * If no intersections are found then height returned will be the height above mean sea level. */ double getHeightAboveTerrain(unsigned int i) const { return _HATList[i]._hat; } @@ -63,7 +63,7 @@ class OSGSIM_EXPORT HeightAboveTerrain /** Get the lowest height that the should be tested for.*/ double getLowestHeight() const { return _lowestHeight; } - + /** Compute the HAT intersections with the specified scene graph. * The results are all stored in the form of a single height above terrain value per HAT test. * Note, if the topmost node is a CoordinateSystemNode then the input points are assumed to be geocentric, @@ -73,8 +73,8 @@ class OSGSIM_EXPORT HeightAboveTerrain /** Compute the vertical distance between the specified scene graph and a single HAT point. */ static double computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, osg::Node::NodeMask traversalMask=0xffffffff); - - + + /** Clear the database cache.*/ void clearDatabaseCache() { if (_dcrc.valid()) _dcrc->clearDatabaseCache(); } @@ -85,26 +85,26 @@ class OSGSIM_EXPORT HeightAboveTerrain /** Get the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs.*/ DatabaseCacheReadCallback* getDatabaseCacheReadCallback() { return _dcrc.get(); } - + protected : - + struct HAT { HAT(const osg::Vec3d& point): _point(point), _hat(0.0) {} - + osg::Vec3d _point; double _hat; }; - + typedef std::vector HATList; - + double _lowestHeight; HATList _HATList; - + osg::ref_ptr _dcrc; osgUtil::IntersectionVisitor _intersectionVisitor; diff --git a/include/osgSim/Impostor b/include/osgSim/Impostor index 854500f14..c6eb0ed2b 100644 --- a/include/osgSim/Impostor +++ b/include/osgSim/Impostor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,19 +23,19 @@ namespace osgSim { -/** Impostor - is a form of Level Of Detail group node which allows both switching +/** Impostor - is a form of Level Of Detail group node which allows both switching * between children depending on distance from eye point and image caching. - * - * The principle behind Imposters is that they cache an image of real geometry and then the image is drawn + * + * The principle behind Imposters is that they cache an image of real geometry and then the image is drawn * in subsequent frames instead of the real geometry. It's a bit like a * Billboard *but* is updated at runtime and w.r.t view point. By drawing * just the texture mapped quad you can cut down scene complexity and * improve performance. - * + * * For more details have a look at: - * + * * http://grail.cs.washington.edu/projects/hic/ - * + * * The OSG doesn't implement exactly the same technique as above, but its * should be a good starting place. The OSG's impostors are much less * intrusive since you don't need to restructure your whole scene to use @@ -47,8 +47,8 @@ namespace osgSim { * the Impostor's image caching should cut in. The osg::CullVisitor * automatically handles all the setting of pre-rendering stages to * calculate the required ImpostorSprites (which encapsulates the image - * cache and quad), and updates them as the view point changes. If you - * use osg::SceneView/CullVisitor all the complexity of supporting + * cache and quad), and updates them as the view point changes. If you + * use osg::SceneView/CullVisitor all the complexity of supporting * Impostor will be nicely hidden away. * * TODO: @@ -69,9 +69,9 @@ class OSGSIM_EXPORT Impostor : public osg::LOD Impostor(const Impostor& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): osg::LOD(es,copyop), _impostorThreshold(es._impostorThreshold) {} - + META_Node(osgSim, Impostor); - + virtual void traverse(osg::NodeVisitor& nv); typedef std::vector< osg::ref_ptr > ImpostorSpriteList; @@ -81,7 +81,7 @@ class OSGSIM_EXPORT Impostor : public osg::LOD * otherwise the LOD children as chosen as per a standard LOD node. */ inline void setImpostorThreshold(float distance) { _impostorThreshold = distance; } - + /* Get the Impostor threshold distance. */ inline float getImpostorThreshold() const { return _impostorThreshold; } @@ -92,7 +92,7 @@ class OSGSIM_EXPORT Impostor : public osg::LOD /** Find the ImposterSprite which fits the current eye point best. */ ImpostorSprite* findBestImpostorSprite(unsigned int contextID, const osg::Vec3& currLocalEyePoint) const; - + /** Add an ImpostorSprite to the Impostor. */ void addImpostorSprite(unsigned int contextID, ImpostorSprite* is); @@ -103,13 +103,13 @@ class OSGSIM_EXPORT Impostor : public osg::LOD inline const ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) const { return _impostorSpriteListBuffer[contexID]; } virtual osg::BoundingSphere computeBound() const; - + protected : virtual ~Impostor() {} mutable osg::buffered_object _impostorSpriteListBuffer; - + ImpostorSprite* createImpostorSprite(osgUtil::CullVisitor* cv); float _impostorThreshold; diff --git a/include/osgSim/ImpostorSprite b/include/osgSim/ImpostorSprite index 03f3426bc..d086c7a62 100644 --- a/include/osgSim/ImpostorSprite +++ b/include/osgSim/ImpostorSprite @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -44,7 +44,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable /** Clone an object of the same type as an ImpostorSprite. */ virtual osg::Object* cloneType() const { return new ImpostorSprite(); } - /** Clone on ImpostorSprite just returns a clone of type, + /** Clone on ImpostorSprite just returns a clone of type, * since it is not appropriate to share data of an ImpostorSprite. */ virtual osg::Object* clone(const osg::CopyOp&) const { return new ImpostorSprite(); } @@ -52,7 +52,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable virtual const char* libraryName() const { return "osgSim"; } virtual const char* className() const { return "ImpostorSprite"; } - /** Set the parent, which must be an Impostor. + /** Set the parent, which must be an Impostor. * Unlike conventional Drawables, ImpostorSprites can only ever have * one parent. */ @@ -69,19 +69,19 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable /** Get the eye point for when the ImpostorSprite was snapped. */ inline const osg::Vec3& getStoredLocalEyePoint() const { return _storedLocalEyePoint; } - + /** Set the frame number for when the ImpostorSprite was last used in rendering. */ inline void setLastFrameUsed(unsigned int frameNumber) { _lastFrameUsed = frameNumber; } - + /** Get the frame number for when the ImpostorSprite was last used in rendering. */ inline unsigned int getLastFrameUsed() const { return _lastFrameUsed; } - + /** Get the coordinates of the corners of the quad. * Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left. */ inline osg::Vec3* getCoords() { return _coords; } - + /** Get the const coordinates of the corners of the quad. */ inline const osg::Vec3* getCoords() const { return _coords; } @@ -91,7 +91,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable * Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left. */ inline osg::Vec2* getTexCoords() { return _texcoords; } - + /** Get the const texture coordinates of the corners of the quad. */ inline const osg::Vec2* getTexCoords() const { return _texcoords; } @@ -108,7 +108,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable * Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left. */ inline osg::Vec3* getControlCoords() { return _controlcoords; } - + /** Get the const control coordinates of the corners of the quad. */ inline const osg::Vec3* getControlCoords() const { return _controlcoords; } @@ -121,7 +121,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable void setTexture(osg::Texture2D* tex,int s,int t); osg::Texture2D* getTexture() { return _texture; } const osg::Texture2D* getTexture() const { return _texture; } - + int s() const { return _s; } int t() const { return _t; } @@ -150,7 +150,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable osg::Vec4 _color; virtual osg::BoundingBox computeBound() const; - + /** Set the camera node to use for pre rendering the impostor sprite's texture.*/ void setCamera(osg::Camera* camera) { _camera = camera; } @@ -170,7 +170,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable Impostor* _parent; friend class osgSim::ImpostorSpriteManager; - + // camera node for doing the pre rendering. osg::ref_ptr _camera; @@ -179,45 +179,45 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable ImpostorSpriteManager* _ism; ImpostorSprite* _previous; ImpostorSprite* _next; - + unsigned int _lastFrameUsed; osg::Vec3 _storedLocalEyePoint; - + osg::Vec3 _coords[4]; osg::Vec2 _texcoords[4]; osg::Vec3 _controlcoords[4]; - + osg::Texture2D* _texture; int _s; int _t; - - + + }; /** Helper class for managing the reuse of ImpostorSprite resources. */ class OSGSIM_EXPORT ImpostorSpriteManager : public osg::Referenced { public: - + ImpostorSpriteManager(); - + bool empty() const { return _first==0; } ImpostorSprite* first() { return _first; } - + ImpostorSprite* last() { return _last; } - + void push_back(ImpostorSprite* is); - + void remove(ImpostorSprite* is); - + ImpostorSprite* createOrReuseImpostorSprite(int s,int t,unsigned int frameNumber); osg::StateSet* createOrReuseStateSet(); void reset(); - + protected: @@ -228,7 +228,7 @@ class OSGSIM_EXPORT ImpostorSpriteManager : public osg::Referenced ImpostorSprite* _first; ImpostorSprite* _last; - + typedef std::vector< osg::ref_ptr > StateSetList; StateSetList _stateSetList; unsigned int _reuseStateSetIndex; diff --git a/include/osgSim/InsertImpostorsVisitor b/include/osgSim/InsertImpostorsVisitor index 2fb4c5c5a..6f9e6461b 100644 --- a/include/osgSim/InsertImpostorsVisitor +++ b/include/osgSim/InsertImpostorsVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,7 +28,7 @@ class OSGSIM_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor /** Default to traversing all children. */ InsertImpostorsVisitor(); - + META_NodeVisitor("osgSim","InsertImpostorsVisitor") void setImpostorThresholdRatio(float ratio) { _impostorThresholdRatio = ratio; } @@ -37,7 +37,7 @@ class OSGSIM_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor void setMaximumNumberOfNestedImpostors(unsigned int num) { _maximumNumNestedImpostors = num; } unsigned int getMaximumNumberOfNestedImpostors() const { return _maximumNumNestedImpostors; } - /** Empty visitor, make it ready for next traversal. */ + /** Empty visitor, make it ready for next traversal. */ void reset(); virtual void apply(osg::Node& node); @@ -48,14 +48,14 @@ class OSGSIM_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor /* Insert the required impostors into the scene graph. */ void insertImpostors(); - + protected: - + typedef std::vector< osg::Group* > GroupList; typedef std::vector< osg::LOD* > LODList; - + GroupList _groupList; - LODList _lodList; + LODList _lodList; float _impostorThresholdRatio; unsigned int _maximumNumNestedImpostors; diff --git a/include/osgSim/LightPoint b/include/osgSim/LightPoint index a140e8c9e..f1d162100 100644 --- a/include/osgSim/LightPoint +++ b/include/osgSim/LightPoint @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,12 +34,12 @@ class OSGSIM_EXPORT LightPoint ADDITIVE, BLENDED }; - + LightPoint(); - + LightPoint(const osg::Vec3& position, const osg::Vec4& color); - + LightPoint(bool on, const osg::Vec3& position, const osg::Vec4& color, @@ -48,10 +48,10 @@ class OSGSIM_EXPORT LightPoint Sector* sector=0, BlinkSequence* blinkSequence=0, BlendingMode blendingMode=BLENDED); - + LightPoint(const LightPoint& lp); - + LightPoint& operator = (const LightPoint& lp); diff --git a/include/osgSim/LightPointNode b/include/osgSim/LightPointNode index f4f59f089..ca7cb8804 100644 --- a/include/osgSim/LightPointNode +++ b/include/osgSim/LightPointNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,7 +37,7 @@ class OSGSIM_EXPORT LightPointNode : public osg::Node typedef std::vector< LightPoint > LightPointList; LightPointNode(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ LightPointNode(const LightPointNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); @@ -50,14 +50,14 @@ class OSGSIM_EXPORT LightPointNode : public osg::Node unsigned int addLightPoint(const LightPoint& lp); - + void removeLightPoint(unsigned int pos); LightPoint& getLightPoint(unsigned int pos) { return _lightPointList[pos]; } const LightPoint& getLightPoint(unsigned int pos) const { return _lightPointList[pos]; } - + void setLightPointList(const LightPointList& lpl) { _lightPointList=lpl; } @@ -67,17 +67,17 @@ class OSGSIM_EXPORT LightPointNode : public osg::Node void setMinPixelSize(float minPixelSize) { _minPixelSize = minPixelSize; } - + float getMinPixelSize() const { return _minPixelSize; } void setMaxPixelSize(float maxPixelSize) { _maxPixelSize = maxPixelSize; } - + float getMaxPixelSize() const { return _maxPixelSize; } void setMaxVisibleDistance2(float maxVisibleDistance2) { _maxVisibleDistance2 = maxVisibleDistance2; } - + float getMaxVisibleDistance2() const { return _maxVisibleDistance2; } - + void setLightPointSystem( osgSim::LightPointSystem* lps) { _lightSystem = lps; } osgSim::LightPointSystem* getLightPointSystem() { return _lightSystem.get(); } @@ -94,7 +94,7 @@ class OSGSIM_EXPORT LightPointNode : public osg::Node ~LightPointNode() {} // used to cache the bouding box of the lightpoints as a tighter - // view frustum check. + // view frustum check. mutable osg::BoundingBox _bbox; LightPointList _lightPointList; @@ -103,8 +103,8 @@ class OSGSIM_EXPORT LightPointNode : public osg::Node float _maxPixelSize; float _maxVisibleDistance2; - osg::ref_ptr _lightSystem; - + osg::ref_ptr _lightSystem; + bool _pointSprites; }; diff --git a/include/osgSim/LightPointSystem b/include/osgSim/LightPointSystem index 32c2b499c..92bfbf494 100644 --- a/include/osgSim/LightPointSystem +++ b/include/osgSim/LightPointSystem @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -38,7 +38,7 @@ class LightPointSystem : public osg::Object { } META_Object( osgSim, LightPointSystem ); - + typedef enum { ANIMATION_ON, ANIMATION_OFF, diff --git a/include/osgSim/LineOfSight b/include/osgSim/LineOfSight index 5f4f5e319..c64a4123d 100644 --- a/include/osgSim/LineOfSight +++ b/include/osgSim/LineOfSight @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,27 +24,27 @@ class OSGSIM_EXPORT DatabaseCacheReadCallback : public osgUtil::IntersectionVisi { public: DatabaseCacheReadCallback(); - + void setMaximumNumOfFilesToCache(unsigned int maxNumFilesToCache) { _maxNumFilesToCache = maxNumFilesToCache; } unsigned int getMaximumNumOfFilesToCache() const { return _maxNumFilesToCache; } - + void clearDatabaseCache(); - + void pruneUnusedDatabaseCache(); virtual osg::Node* readNodeFile(const std::string& filename); - + protected: - + typedef std::map > FileNameSceneMap; - + unsigned int _maxNumFilesToCache; OpenThreads::Mutex _mutex; FileNameSceneMap _filenameSceneMap; }; /** Helper class for setting up and acquiring line of sight intersections with terrain. - * By default assigns a osgSim::DatabaseCacheReadCallback that enables automatic loading + * By default assigns a osgSim::DatabaseCacheReadCallback that enables automatic loading * of external PagedLOD tiles to ensure that the highest level of detail is used in intersections. * This automatic loading of tiles is done by the intersection traversal that is done within * the computeIntersections(..) method, so can result in long intersection times when external @@ -54,18 +54,18 @@ class OSGSIM_EXPORT DatabaseCacheReadCallback : public osgUtil::IntersectionVisi class OSGSIM_EXPORT LineOfSight { public : - + LineOfSight(); /** Clear the internal LOS List so it contains no line of sight tests.*/ void clear(); - + /** Add a line of sight test, consisting of start and end point. Returns the index number of the newly adding LOS test.*/ unsigned int addLOS(const osg::Vec3d& start, const osg::Vec3d& end); - + /** Get the number of line of sight tests.*/ unsigned int getNumLOS() const { return _LOSList.size(); } - + /** Set the start point of single line of sight test.*/ void setStartPoint(unsigned int i, const osg::Vec3d& start) { _LOSList[i]._start = start; } @@ -77,7 +77,7 @@ class OSGSIM_EXPORT LineOfSight /** Get the end point of single line of sight test.*/ const osg::Vec3d& getEndPoint(unsigned int i) const { return _LOSList[i]._end; } - + typedef std::vector Intersections; /** Get the intersection points for a single line of sight test.*/ @@ -89,8 +89,8 @@ class OSGSIM_EXPORT LineOfSight /** Compute the intersection between the specified scene graph and a single LOS start,end pair. Returns an IntersectionList, of all the points intersected.*/ static Intersections computeIntersections(osg::Node* scene, const osg::Vec3d& start, const osg::Vec3d& end, osg::Node::NodeMask traversalMask=0xffffffff); - - + + /** Clear the database cache.*/ void clearDatabaseCache() { if (_dcrc.valid()) _dcrc->clearDatabaseCache(); } @@ -101,24 +101,24 @@ class OSGSIM_EXPORT LineOfSight /** Get the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs.*/ DatabaseCacheReadCallback* getDatabaseCacheReadCallback() { return _dcrc.get(); } - + protected : - + struct LOS { LOS(const osg::Vec3d& start, const osg::Vec3d& end): _start(start), _end(end) {} - - + + osg::Vec3d _start; osg::Vec3d _end; Intersections _intersections; }; - + typedef std::vector LOSList; LOSList _LOSList; - + osg::ref_ptr _dcrc; osgUtil::IntersectionVisitor _intersectionVisitor; diff --git a/include/osgSim/MultiSwitch b/include/osgSim/MultiSwitch index 7501e5d75..63c873363 100644 --- a/include/osgSim/MultiSwitch +++ b/include/osgSim/MultiSwitch @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ namespace osgSim { class OSGSIM_EXPORT MultiSwitch : public osg::Group { public : - + MultiSwitch(); @@ -35,9 +35,9 @@ class OSGSIM_EXPORT MultiSwitch : public osg::Group META_Node(osgSim, MultiSwitch); virtual void traverse(osg::NodeVisitor& nv); - + void setNewChildDefaultValue(bool value) { _newChildDefaultValue = value; } - + bool getNewChildDefaultValue() const { return _newChildDefaultValue; } virtual bool addChild( osg::Node *child ); @@ -51,28 +51,28 @@ class OSGSIM_EXPORT MultiSwitch : public osg::Group bool getValue(unsigned int switchSet, unsigned int pos) const; void setChildValue(const osg::Node* child,unsigned int switchSet, bool value); - + bool getChildValue(const osg::Node* child,unsigned int switchSet) const; /** Set all the children off (false), and set the new default child value to off (false).*/ bool setAllChildrenOff(unsigned int switchSet); - + /** Set all the children on (true), and set the new default child value to on (true).*/ bool setAllChildrenOn(unsigned int switchSet); - + /** Set a single child to be on, MultiSwitch off all other children.*/ bool setSingleChildOn(unsigned int switchSet, unsigned int pos); - + /** Set which of the available switch set lists to use.*/ void setActiveSwitchSet(unsigned int switchSet) { _activeSwitchSet = switchSet; } - + /** Get which of the available switch set lists to use.*/ unsigned int getActiveSwitchSet() const { return _activeSwitchSet; } typedef std::vector ValueList; typedef std::vector SwitchSetList; typedef std::vector SwitchSetNameList; - + /** Set the compile set of different values.*/ void setSwitchSetList(const SwitchSetList& switchSetList); @@ -90,9 +90,9 @@ class OSGSIM_EXPORT MultiSwitch : public osg::Group const std::string& getValueName(unsigned int switchSet) const { return _valueNames[switchSet]; } protected : - + virtual ~MultiSwitch() {} - + void expandToEncompassSwitchSet(unsigned int switchSet); // this is effectively a list of bit mask. diff --git a/include/osgSim/ObjectRecordData b/include/osgSim/ObjectRecordData index c28e3b663..ea4c923b2 100644 --- a/include/osgSim/ObjectRecordData +++ b/include/osgSim/ObjectRecordData @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgSim/OverlayNode b/include/osgSim/OverlayNode index a133795dc..ff13fe3b8 100644 --- a/include/osgSim/OverlayNode +++ b/include/osgSim/OverlayNode @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,9 +42,9 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group OverlayNode(OverlayTechnique technique=OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY); OverlayNode(const OverlayNode& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Node(osgSim, OverlayNode); - + virtual void traverse(osg::NodeVisitor& nv); @@ -56,17 +56,17 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group /** Set the overlay subgraph which will be rendered to texture.*/ void setOverlaySubgraph(osg::Node* node); - + /** Get the overlay subgraph which will be rendered to texture.*/ osg::Node* getOverlaySubgraph() { return _overlaySubgraph.get(); } /** Get the const overlay subgraph which will be render to texture.*/ const osg::Node* getOverlaySubgraph() const { return _overlaySubgraph.get(); } - + /** Inform the OverlayNode that the overlay texture needs to be updated.*/ void dirtyOverlayTexture(); - + /** Set whether the OverlayNode should update the overlay texture on every frame.*/ void setContinuousUpdate(bool update) { _continuousUpdate = update; } @@ -91,7 +91,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group /** Set the TexEnv mode used to combine the overlay texture with the base color/texture of the OverlayNode's decorate subgraph.*/ void setTexEnvMode(GLenum mode); - + /** Get the TexEnv mode used to combine the overlay texture with the base color/texture of the OverlayNode's decorate subgraph.*/ GLenum getTexEnvMode() const { return _texEnvMode; } @@ -100,14 +100,14 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group /** Get the texture unit that the texture should be assigned to.*/ unsigned int getOverlayTextureUnit() const { return _textureUnit; } - + /** Set the texture size hint. The size hint is used to request a texture of specified size.*/ void setOverlayTextureSizeHint(unsigned int size); /** Get the texture size hint.*/ unsigned int getOverlayTextureSizeHint() const { return _textureSizeHint; } - - + + /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ virtual void setThreadSafeRefUnref(bool threadSafe); @@ -122,12 +122,12 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group protected : virtual ~OverlayNode() {} - + void init(); void init_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(); void init_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(); void init_VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY(); - + void traverse_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVisitor& nv); void traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVisitor& nv); void traverse_VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY(osg::NodeVisitor& nv); @@ -136,7 +136,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group void updateMainSubgraphStateSet(); typedef osg::buffered_value< int > TextureObjectValidList; - + mutable TextureObjectValidList _textureObjectValidList; OverlayTechnique _overlayTechnique; @@ -147,7 +147,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group osg::ref_ptr _overlayStateSet; osg::ref_ptr _mainStateSet; - + // texture to render to, and to read from. GLenum _texEnvMode; unsigned int _textureUnit; @@ -157,7 +157,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group bool _continuousUpdate; double _overlayBaseHeight; bool _updateCamera; - + osg::Camera::RenderTargetImplementation _renderTargetImpl; struct OverlayData : public osg::Referenced @@ -176,18 +176,18 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group osg::ref_ptr _geode; osg::ref_ptr _mainSubgraphProgram; - + osg::ref_ptr _y0; osg::ref_ptr _lightingEnabled; }; - + typedef std::map > OverlayDataMap; - + OpenThreads::Mutex _overlayDataMapMutex; OverlayDataMap _overlayDataMap; - + OverlayNode::OverlayData* getOverlayData(osgUtil::CullVisitor* cv); - + }; } diff --git a/include/osgSim/ScalarBar b/include/osgSim/ScalarBar index 8b90f0487..6d25d27e5 100644 --- a/include/osgSim/ScalarBar +++ b/include/osgSim/ScalarBar @@ -182,7 +182,7 @@ public: /** Set the position of scalar bar's lower left corner.*/ void setPosition(const osg::Vec3& pos); - + /** Get the position of scalar bar.*/ const osg::Vec3& getPosition() const { return _position; } diff --git a/include/osgSim/Sector b/include/osgSim/Sector index 58735ddda..bbc50bc5b 100644 --- a/include/osgSim/Sector +++ b/include/osgSim/Sector @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,16 +28,16 @@ namespace osgSim { class Sector : public osg::Object { public: - + Sector() {} - + Sector(const Sector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY): osg::Object(copy,copyop) {} virtual const char *libraryName() const { return "osgSim"; } virtual const char *className() const { return "Sector"; } virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; } - + virtual float operator() (const osg::Vec3& /*eyeLocal*/) const = 0; protected: @@ -54,7 +54,7 @@ class OSGSIM_EXPORT AzimRange _sinAzim(0.0f), _cosAngle(-1.0f), _cosFadeAngle(-1.0f) {} - + void setAzimuthRange(float minAzimuth,float maxAzimuth,float fadeAngle=0.0f); void getAzimuthRange(float& minAzimuth, float& maxAzimuth, float& fadeAngle) const; @@ -80,16 +80,16 @@ class OSGSIM_EXPORT AzimRange class OSGSIM_EXPORT ElevationRange { public: - - + + ElevationRange(): _cosMinElevation(-1.0f), _cosMinFadeElevation(-1.0f), _cosMaxElevation(1.0), _cosMaxFadeElevation(1.0) {} - + void setElevationRange(float minElevation,float maxElevation,float fadeAngle=0.0f); - + float getMinElevation() const; float getMaxElevation() const; @@ -114,7 +114,7 @@ class OSGSIM_EXPORT ElevationRange } return 1.0f; // fully in sector } - + protected: float _cosMinElevation; @@ -126,11 +126,11 @@ class OSGSIM_EXPORT ElevationRange class OSGSIM_EXPORT AzimSector : public Sector, public AzimRange { public: - + AzimSector(): Sector(), AzimRange() {} - + AzimSector(const AzimSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY): Sector(copy,copyop), AzimRange(copy) {} @@ -150,22 +150,22 @@ class OSGSIM_EXPORT AzimSector : public Sector, public AzimRange class OSGSIM_EXPORT ElevationSector : public Sector, public ElevationRange { public: - - + + ElevationSector(): Sector(), ElevationRange() {} - + ElevationSector(const ElevationSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY): Sector(copy,copyop), ElevationRange(copy) {} - + ElevationSector(float minElevation,float maxElevation,float fadeAngle=0.0f); - + META_Object(osgSim,ElevationSector); virtual float operator() (const osg::Vec3& eyeLocal) const; - + protected: virtual ~ElevationSector() {} @@ -175,12 +175,12 @@ class OSGSIM_EXPORT ElevationSector : public Sector, public ElevationRange class OSGSIM_EXPORT AzimElevationSector : public Sector, public AzimRange, public ElevationRange { public: - + AzimElevationSector(): Sector(), AzimRange(), ElevationRange() {} - + AzimElevationSector(const AzimElevationSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY): Sector(copy,copyop), AzimRange(copy), @@ -201,7 +201,7 @@ class OSGSIM_EXPORT AzimElevationSector : public Sector, public AzimRange, publi class OSGSIM_EXPORT ConeSector : public Sector { public: - + ConeSector(): Sector(), _axis(0.0f,0.0f,1.0f), @@ -219,13 +219,13 @@ class OSGSIM_EXPORT ConeSector : public Sector META_Object(osgSim,ConeSector); void setAxis(const osg::Vec3& axis); - + const osg::Vec3& getAxis() const; void setAngle(float angle,float fadeangle=0.0f); - + float getAngle() const; - + float getFadeAngle() const; virtual float operator() (const osg::Vec3& eyeLocal) const; @@ -233,7 +233,7 @@ class OSGSIM_EXPORT ConeSector : public Sector protected: virtual ~ConeSector() {} - + osg::Vec3 _axis; float _cosAngle; float _cosAngleFade; @@ -248,7 +248,7 @@ class OSGSIM_EXPORT ConeSector : public Sector class OSGSIM_EXPORT DirectionalSector : public Sector { public: - + DirectionalSector(): Sector(), _direction(0.0f, 0.0f, 1.0f), @@ -273,23 +273,23 @@ class OSGSIM_EXPORT DirectionalSector : public Sector META_Object(osgSim,DirectionalSector); void setDirection(const osg::Vec3& direction); - + const osg::Vec3& getDirection() const; void setHorizLobeAngle(float angle); - + float getHorizLobeAngle() const; - + void setLobeRollAngle(float angle); - + float getLobeRollAngle() const; - + void setVertLobeAngle(float angle); - + float getVertLobeAngle() const; - + void setFadeAngle(float angle); - + float getFadeAngle() const; virtual float operator() (const osg::Vec3& eyeLocal) const; @@ -299,7 +299,7 @@ class OSGSIM_EXPORT DirectionalSector : public Sector protected: virtual ~DirectionalSector() {} - + osg::Vec3 _direction ; float _rollAngle ; osg::Matrix _local_to_LP ; diff --git a/include/osgSim/ShapeAttribute b/include/osgSim/ShapeAttribute index 87caa7df7..cb9ae29c2 100644 --- a/include/osgSim/ShapeAttribute +++ b/include/osgSim/ShapeAttribute @@ -25,7 +25,7 @@ namespace osgSim class OSGSIM_EXPORT ShapeAttribute { public: - /// ShapeAttribute data type. + /// ShapeAttribute data type. enum Type { UNKNOWN, @@ -33,21 +33,21 @@ class OSGSIM_EXPORT ShapeAttribute DOUBLE, STRING }; - + ShapeAttribute(); ShapeAttribute(const char * name); ShapeAttribute(const char * name, int value); ShapeAttribute(const char * name, double value); - + /** Note, ShapeAttribute takes a copy of both name and value, the calling code should manage its own clean up of the original strings.*/ ShapeAttribute(const char * name, const char * value); - + ShapeAttribute(const ShapeAttribute & sa); - + ~ShapeAttribute(); - + ShapeAttribute& operator = (const ShapeAttribute& sa); - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ int compare(const osgSim::ShapeAttribute& sa) const; @@ -63,7 +63,7 @@ class OSGSIM_EXPORT ShapeAttribute /// Get the attribute data type. const Type getType() const { return _type; } - + /// Get the attribute data as an int. int getInt() const { return _integer; } @@ -72,7 +72,7 @@ class OSGSIM_EXPORT ShapeAttribute /// Get the attribute data as a string. const char * getString() const { return _string; } - + /// Set an integer attribute data. void setValue(int value) { free(); _type = INTEGER; _integer = value; } @@ -82,15 +82,15 @@ class OSGSIM_EXPORT ShapeAttribute /// Set a string attribute data. void setValue(const char * value); - + private: - + void free(); void copy(const ShapeAttribute& sa); - + std::string _name; Type _type; - + union { int _integer; @@ -103,11 +103,11 @@ class OSGSIM_EXPORT ShapeAttributeList : public osg::Object, public osg::MixinVe { public: META_Object(osgSim, ShapeAttributeList) - + ShapeAttributeList(): Object() {} - + /** Copy constructor, optional CopyOp object can be used to control * shallow vs deep copying of dynamic data.*/ ShapeAttributeList(const ShapeAttributeList& sal,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): @@ -115,10 +115,10 @@ class OSGSIM_EXPORT ShapeAttributeList : public osg::Object, public osg::MixinVe osg::MixinVector(sal) { } - + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ virtual int compare(const osgSim::ShapeAttributeList& sal) const; - + protected: virtual ~ShapeAttributeList() {} }; diff --git a/include/osgSim/SphereSegment b/include/osgSim/SphereSegment index 1b0313cdf..d41f41f0e 100644 --- a/include/osgSim/SphereSegment +++ b/include/osgSim/SphereSegment @@ -227,10 +227,10 @@ public: void setAllColors(const osg::Vec4& c); META_Node(osgSim, SphereSegment); - + /** A list of vertex arrays representing a list of lines.*/ typedef std::vector< osg::ref_ptr > LineList; - + /** Compute the interesection lines between subgraph and this sphere segment. * The matrix is the transform that takes the subgraph into the same coordiante frame as the sphere segment. * The resulting intersections are in the coordinate frame of the sphere segment. */ diff --git a/include/osgSim/Version b/include/osgSim/Version index c4ad87252..1204bc6b5 100644 --- a/include/osgSim/Version +++ b/include/osgSim/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgSim/VisibilityGroup b/include/osgSim/VisibilityGroup index f6a28d549..8a9e0df19 100644 --- a/include/osgSim/VisibilityGroup +++ b/include/osgSim/VisibilityGroup @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,7 +30,7 @@ namespace osgSim { class OSGSIM_EXPORT VisibilityGroup : public osg::Group { public : - + VisibilityGroup(); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ @@ -62,7 +62,7 @@ class OSGSIM_EXPORT VisibilityGroup : public osg::Group /** Get the length of the intersection segment.*/ float getSegmentLength() const { return _segmentLength; } - + protected : virtual ~VisibilityGroup() {} diff --git a/include/osgTerrain/Export b/include/osgTerrain/Export index 45c8a2159..9dc77a1d8 100644 --- a/include/osgTerrain/Export +++ b/include/osgTerrain/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,13 +37,13 @@ # endif #else # define OSGTERRAIN_EXPORT -#endif +#endif /** \namespace osgTerrain -The osgTerrain library is a NodeKit that provides geospecifc terrain rendering support. +The osgTerrain library is a NodeKit that provides geospecifc terrain rendering support. */ #endif diff --git a/include/osgTerrain/GeometryTechnique b/include/osgTerrain/GeometryTechnique index d455ec2f7..fdb0df455 100644 --- a/include/osgTerrain/GeometryTechnique +++ b/include/osgTerrain/GeometryTechnique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,14 +31,14 @@ class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ GeometryTechnique(const GeometryTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, GeometryTechnique); - + virtual void init(int dirtyMask, bool assumeMultiThreaded); - + virtual Locator* computeMasterLocator(); - - + + virtual void update(osgUtil::UpdateVisitor* nv); virtual void cull(osgUtil::CullVisitor* nv); @@ -50,21 +50,21 @@ class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique void setFilterBias(float filterBias); float getFilterBias() const { return _filterBias; } - + void setFilterWidth(float filterWidth); float getFilterWidth() const { return _filterWidth; } void setFilterMatrix(const osg::Matrix3& matrix); osg::Matrix3& getFilterMatrix() { return _filterMatrix; } const osg::Matrix3& getFilterMatrix() const { return _filterMatrix; } - + enum FilterType { GAUSSIAN, SMOOTH, SHARPEN }; - + void setFilterMatrixAs(FilterType filterType); /** If State is non-zero, this function releases any associated OpenGL objects for diff --git a/include/osgTerrain/Layer b/include/osgTerrain/Layer index d37d11ec2..5307017cf 100644 --- a/include/osgTerrain/Layer +++ b/include/osgTerrain/Layer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -41,9 +41,9 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ Layer(const Layer&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, Layer); - + /** Set the name of this layer. */ void setSetName(const std::string& setname) { setName(setname); } @@ -62,7 +62,7 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object void setLocator(Locator* locator) { _locator = locator; } Locator* getLocator() { return _locator.get(); } const Locator* getLocator() const { return _locator.get(); } - + void setMinLevel(unsigned int minLevel) { _minLevel = minLevel; } unsigned int getMinLevel() const { return _minLevel; } @@ -87,7 +87,7 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object void setDefaultValue(const osg::Vec4& value) { _defaultValue = value; } const osg::Vec4& getDefaultValue() const { return _defaultValue; } - + /** Set the minification texture filter to use when a texture is associated with this layer.*/ void setMinFilter(osg::Texture::FilterMode filter) { _minFilter = filter; } @@ -104,10 +104,10 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object - /** Return image associated with layer if supported. */ + /** Return image associated with layer if supported. */ virtual osg::Image* getImage() { return 0; } - /** Return const image associated with layer if supported. */ + /** Return const image associated with layer if supported. */ virtual const osg::Image* getImage() const { return 0; } @@ -167,7 +167,7 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object j = (unsigned int)(ndc_y); ir = ndc_x - double(i); jr = ndc_y - double(j); - } + } /** * Calculate the interpolated layer value at the given normalized coordinates. @@ -184,35 +184,35 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object value = 0.0f; double div = 0.0f; float v,r; - + r = (1.0f-ir)*(1.0f-jr); - if (r>0.0 && getValue(i,j,v)) + if (r>0.0 && getValue(i,j,v)) { value += v*r; div += r; } - + r = (ir)*(1.0f-jr); - if (r>0.0 && getValue(i+1,j,v)) + if (r>0.0 && getValue(i+1,j,v)) { value += v*r; div += r; } - + r = (ir)*(jr); - if (r>0.0 && getValue(i+1,j+1,v)) + if (r>0.0 && getValue(i+1,j+1,v)) { value += v*r; div += r; } - + r = (1.0f-ir)*(jr); - if (r>0.0 && getValue(i,j+1,v)) + if (r>0.0 && getValue(i,j+1,v)) { value += v*r; div += r; } - + if (div != 0.0) { value /= div; @@ -304,7 +304,7 @@ class OSGTERRAIN_EXPORT ImageLayer : public Layer /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ ImageLayer(const ImageLayer& imageLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, ImageLayer); void setFileName(const std::string& filename) { _filename = filename; if (_image.valid()) _image->setFileName(filename); } @@ -314,7 +314,7 @@ class OSGTERRAIN_EXPORT ImageLayer : public Layer void setImage(osg::Image* image); - /** Return image associated with layer. */ + /** Return image associated with layer. */ virtual osg::Image* getImage() { return _image.get(); } /** Return const image associated with layer. */ @@ -348,7 +348,7 @@ class OSGTERRAIN_EXPORT ContourLayer : public Layer /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ ContourLayer(const ContourLayer& tfLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, ContourLayer); virtual bool transform(float offset, float scale); @@ -357,7 +357,7 @@ class OSGTERRAIN_EXPORT ContourLayer : public Layer osg::TransferFunction1D* getTransferFunction() { return _tf.get(); } const osg::TransferFunction1D* getTransferFunction() const { return _tf.get(); } - /** Return image associated with layer. */ + /** Return image associated with layer. */ virtual osg::Image* getImage() { return _tf.valid() ? _tf->getImage() : 0; } /** Return const image associated with layer. */ @@ -392,7 +392,7 @@ class OSGTERRAIN_EXPORT HeightFieldLayer : public Layer /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ HeightFieldLayer(const HeightFieldLayer& hfLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, HeightFieldLayer); void setFileName(const std::string& filename) { _filename = filename; } @@ -434,10 +434,10 @@ class OSGTERRAIN_EXPORT ProxyLayer : public Layer /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ ProxyLayer(const ProxyLayer& proxyLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, ProxyLayer); - - /** Return image associated with layer if supported. */ + + /** Return image associated with layer if supported. */ virtual osg::Image* getImage() { return _implementation.valid() ? _implementation->getImage() : 0; @@ -451,7 +451,7 @@ class OSGTERRAIN_EXPORT ProxyLayer : public Layer /** Set the implementation layer that does the actual work.*/ void setImplementation(Layer* layer) { _implementation = layer; } - + /** Get the implementation layer that does the actual work.*/ Layer* getImplementation() { return _implementation.get(); } @@ -463,7 +463,7 @@ class OSGTERRAIN_EXPORT ProxyLayer : public Layer virtual unsigned int getNumColumns() const; virtual unsigned int getNumRows() const; - + virtual bool transform(float offset, float scale); virtual bool getValue(unsigned int i, unsigned int j, float& value) const; @@ -480,7 +480,7 @@ class OSGTERRAIN_EXPORT ProxyLayer : public Layer protected: virtual ~ProxyLayer(); - + osg::ref_ptr _implementation; @@ -494,7 +494,7 @@ class OSGTERRAIN_EXPORT CompositeLayer : public Layer /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ CompositeLayer(const CompositeLayer& compositeLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, CompositeLayer); void clear(); @@ -521,11 +521,11 @@ class OSGTERRAIN_EXPORT CompositeLayer : public Layer void addLayer(const std::string& compoundname); void addLayer(const std::string& setname, const std::string& filename); - + void addLayer(Layer* layer) { _layers.push_back(CompoundNameLayer(layer->getName(),layer->getFileName(),layer)); } void removeLayer(unsigned int i) { _layers.erase(_layers.begin()+i); } - + unsigned int getNumLayers() const { return _layers.size(); } protected: @@ -535,7 +535,7 @@ class OSGTERRAIN_EXPORT CompositeLayer : public Layer struct CompoundNameLayer { CompoundNameLayer() {} - + CompoundNameLayer(const CompoundNameLayer& cnl): setname(cnl.setname), filename(cnl.filename), @@ -549,7 +549,7 @@ class OSGTERRAIN_EXPORT CompositeLayer : public Layer CompoundNameLayer& operator = (const CompoundNameLayer& cnl) { if (&cnl==this) return *this; - + setname = cnl.setname; filename = cnl.filename; layer = cnl.layer; @@ -560,9 +560,9 @@ class OSGTERRAIN_EXPORT CompositeLayer : public Layer std::string filename; osg::ref_ptr layer; }; - + typedef std::vector< CompoundNameLayer > Layers; - + Layers _layers; }; @@ -575,32 +575,32 @@ class OSGTERRAIN_EXPORT SwitchLayer : public CompositeLayer /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ SwitchLayer(const SwitchLayer& switchLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, SwitchLayer); - + void setActiveLayer(int i) { _activeLayer = i; } int getActiveLayer() const { return _activeLayer; } - /** Return image associated with layer if supported. */ + /** Return image associated with layer if supported. */ virtual osg::Image* getImage() { - if (_activeLayer < 0) return 0; + if (_activeLayer < 0) return 0; if (_activeLayer >= static_cast(getNumLayers())) return 0; - return _layers[_activeLayer].layer->getImage(); + return _layers[_activeLayer].layer->getImage(); } /** Return const image associated with layer if supported. */ virtual const osg::Image* getImage() const { - if (_activeLayer < 0) return 0; + if (_activeLayer < 0) return 0; if (_activeLayer >= static_cast(getNumLayers())) return 0; - return _layers[_activeLayer].layer->getImage(); + return _layers[_activeLayer].layer->getImage(); } protected: virtual ~SwitchLayer() {} - + int _activeLayer; }; diff --git a/include/osgTerrain/Locator b/include/osgTerrain/Locator index 263dfa9cb..16f654647 100644 --- a/include/osgTerrain/Locator +++ b/include/osgTerrain/Locator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,7 +30,7 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ Locator(const Locator&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgTerrain, Locator); /** CoordinateSystemType provides the classification of the type coordinate system represented.*/ @@ -55,23 +55,23 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object /** Set the coordinate system format string. Typical values would be WKT, PROJ4, USGS etc.*/ void setFormat(const std::string& format) { _format = format; } - + /** Get the coordinate system format string.*/ const std::string& getFormat() const { return _format; } /** Set the CoordinateSystem reference string, should be stored in a form consistent with the Format.*/ void setCoordinateSystem(const std::string& cs) { _cs = cs; } - + /** Get the CoordinateSystem reference string.*/ 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. */ void setEllipsoidModel(osg::EllipsoidModel* ellipsode) { _ellipsoidModel = ellipsode; } - + /** Get the EllipsoidModel.*/ osg::EllipsoidModel* getEllipsoidModel() { return _ellipsoidModel.get(); } - + /** Get the const EllipsoidModel.*/ const osg::EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); } @@ -85,14 +85,14 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object /** Set the extents of the local coords.*/ void setTransformAsExtents(double minX, double minY, double maxX, double maxY); - + virtual bool orientationOpenGL() const; virtual bool convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const; virtual bool convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const; - static bool convertLocalCoordBetween(const Locator& source, const osg::Vec3d& sourceNDC, + static bool convertLocalCoordBetween(const Locator& source, const osg::Vec3d& sourceNDC, const Locator& destination, osg::Vec3d& destinationNDC) { osg::Vec3d model; @@ -100,19 +100,19 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object if (!destination.convertModelToLocal(model, destinationNDC)) return false; return true; } - + bool computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::Vec3d& topRight) const; - + void setDefinedInFile(bool flag) { _definedInFile = flag; } bool getDefinedInFile() const { return _definedInFile; } - + void setTransformScaledByResolution(bool scaledByResolution) { _transformScaledByResolution = scaledByResolution; } bool getTransformScaledByResolution() const { return _transformScaledByResolution; } protected: virtual ~Locator(); - + CoordinateSystemType _coordinateSystemType; std::string _format; @@ -121,7 +121,7 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object osg::Matrixd _transform; osg::Matrixd _inverse; - + bool _definedInFile; bool _transformScaledByResolution; diff --git a/include/osgTerrain/Terrain b/include/osgTerrain/Terrain index c7b3275ea..230cf9b2c 100644 --- a/include/osgTerrain/Terrain +++ b/include/osgTerrain/Terrain @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,7 +28,7 @@ class OSGTERRAIN_EXPORT Terrain : public osg::CoordinateSystemNode public: Terrain(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ Terrain(const Terrain&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); @@ -78,13 +78,13 @@ class OSGTERRAIN_EXPORT Terrain : public osg::CoordinateSystemNode /** Get the const TerrainTile for a given TileID.*/ const TerrainTile* getTile(const TileID& tileID) const; - + /** Set the TerrainTechnique prototype from which TerrainTiles can clone the techniques from.*/ void setTerrainTechniquePrototype(TerrainTechnique* technique) { _terrainTechnique = technique; } /** Get the TerrainTechnique prototype */ TerrainTechnique* getTerrainTechniquePrototype() { return _terrainTechnique.get(); } - + /** Get the const TerrainTechnique protype*/ const TerrainTechnique* getTerrainTechniquePrototype() const { return _terrainTechnique.get(); } @@ -94,9 +94,9 @@ class OSGTERRAIN_EXPORT Terrain : public osg::CoordinateSystemNode protected: virtual ~Terrain(); - + friend class TerrainTile; - + void dirtyRegisteredTiles(int dirtyMask = TerrainTile::ALL_DIRTY); void registerTerrainTile(TerrainTile* tile); diff --git a/include/osgTerrain/TerrainTechnique b/include/osgTerrain/TerrainTechnique index 1b0d701cf..8c3d789bd 100644 --- a/include/osgTerrain/TerrainTechnique +++ b/include/osgTerrain/TerrainTechnique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgTerrain/TerrainTile b/include/osgTerrain/TerrainTile index 3e8d1ea99..aedd56b16 100644 --- a/include/osgTerrain/TerrainTile +++ b/include/osgTerrain/TerrainTile @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,17 +30,17 @@ class Terrain; class OSGTERRAIN_EXPORT TileID { public: - + TileID(); TileID(int in_level, int in_x, int in_y); - - bool operator == (const TileID& rhs) const + + bool operator == (const TileID& rhs) const { return (level==rhs.level) && (x==rhs.x) && (y==rhs.y); } - bool operator != (const TileID& rhs) const + bool operator != (const TileID& rhs) const { return (level!=rhs.level) || (x!=rhs.x) || (y!=rhs.y); } @@ -53,7 +53,7 @@ class OSGTERRAIN_EXPORT TileID if (x>rhs.x) return false; return y=0; } int level; @@ -89,22 +89,22 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group /** Get the const Terrain that this Terrain tile is a member of.*/ const Terrain* getTerrain() const { return _terrain; } - + /** Set the TileID (layer, x,y) of the TerrainTile. - * The TileID is used so it can be located by its neighbours + * The TileID is used so it can be located by its neighbours * via the enclosing Terrain node that manages a map of TileID to TerraiTiles.*/ void setTileID(const TileID& tileID); - + /** Get the TileID (layer, x,y) of the TerrainTile.*/ const TileID& getTileID() const { return _tileID; } - + /** Set the TerrainTechnique*/ void setTerrainTechnique(TerrainTechnique* terrainTechnique); /** Get the TerrainTechnique*/ TerrainTechnique* getTerrainTechnique() { return _terrainTechnique.get(); } - + /** Get the const TerrainTechnique*/ const TerrainTechnique* getTerrainTechnique() const { return _terrainTechnique.get(); } @@ -140,8 +140,8 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group /** Get the number of colour layers.*/ unsigned int getNumColorLayers() const { return _colorLayers.size(); } - - + + /** Set hint to whether the TerrainTechnique should create per vertex normals for lighting purposes.*/ void setRequiresNormals(bool flag) { _requiresNormals = flag; } @@ -259,7 +259,7 @@ class OSGTERRAIN_EXPORT WhiteListTileLoadedCallback : public TerrainTile::TileLo WhiteListTileLoadedCallback(); void allow(const std::string& setname) { _setWhiteList.insert(setname); } - + void setMinimumNumOfLayers(unsigned int numLayers) { _minumumNumberOfLayers = numLayers; } unsigned int getMinimumNumOfLayers() const { return _minumumNumberOfLayers; } @@ -275,11 +275,11 @@ class OSGTERRAIN_EXPORT WhiteListTileLoadedCallback : public TerrainTile::TileLo virtual bool deferExternalLayerLoading() const; virtual void loaded(osgTerrain::TerrainTile* tile, const osgDB::ReaderWriter::Options* options) const; - + protected: virtual ~WhiteListTileLoadedCallback(); - + typedef std::set SetWhiteList; SetWhiteList _setWhiteList; unsigned int _minumumNumberOfLayers; diff --git a/include/osgTerrain/ValidDataOperator b/include/osgTerrain/ValidDataOperator index b6ea98922..3a0be30c6 100644 --- a/include/osgTerrain/ValidDataOperator +++ b/include/osgTerrain/ValidDataOperator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,7 +35,7 @@ struct ValidRange : public ValidDataOperator ValidRange(float minValue, float maxValue): _minValue(minValue), _maxValue(maxValue) {} - + void setRange(float minValue, float maxValue) { _minValue = minValue; @@ -58,12 +58,12 @@ struct NoDataValue : public ValidDataOperator { NoDataValue(float value): _value(value) {} - + void setNoDataValue(float value) { _value = value; } float getValue() const { return _value; } virtual bool operator() (float value) const { return value!=_value; } - + float _value; }; diff --git a/include/osgTerrain/Version b/include/osgTerrain/Version index e9a89d71f..8fc391e82 100644 --- a/include/osgTerrain/Version +++ b/include/osgTerrain/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgText/Export b/include/osgText/Export index b92b6870f..06ecf3f84 100644 --- a/include/osgText/Export +++ b/include/osgText/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,7 +37,7 @@ # endif #else # define OSGTEXT_EXPORT -#endif +#endif /** diff --git a/include/osgText/FadeText b/include/osgText/FadeText index 5eebfc8b6..f3dc87be7 100644 --- a/include/osgText/FadeText +++ b/include/osgText/FadeText @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,17 +43,17 @@ protected: virtual ~FadeText() {} void init(); - + struct FadeTextUpdateCallback; friend struct FadeTextUpdateCallback; typedef std::map ViewBlendColourMap; - + ViewBlendColourMap& getViewBlendColourMap() { return _viewBlendColourMap; } const ViewBlendColourMap& getViewBlendColourMap() const { return _viewBlendColourMap; } float _fadeSpeed; - + mutable ViewBlendColourMap _viewBlendColourMap; }; diff --git a/include/osgText/Font b/include/osgText/Font index 90af2cb36..01c284d54 100644 --- a/include/osgText/Font +++ b/include/osgText/Font @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ namespace osgText { class Font; /** Read a font from specified file. The filename may contain a path. - * It will search for the font file in the following places in this order: + * It will search for the font file in the following places in this order: * - In the current directory * - All paths defined in OSG_FILE_PATH or OSGFILEPATH environment variable * - Filename with path stripped: In the current directory @@ -43,7 +43,7 @@ class Font; * - Other OS: In /usr/share/fonts/ttf * - Other OS: In /usr/share/fonts/ttf/western * - Other OS: In /usr/share/fonts/ttf/decoratives - * + * * If the given file could not be found, the path part will be stripped and * the file will be searched again in the OS specific directories. */ @@ -90,7 +90,7 @@ public: osg::StateSet* getStateSet() { return _stateset.get(); } const osg::StateSet* getStateSet() const { return _stateset.get(); } - + /** Get a kerning (adjustment of spacing of two adjacent character) for specified charcodes, w.r.t the current font size hint.*/ virtual osg::Vec2 getKerning(unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType); @@ -110,13 +110,13 @@ public: /** Set the margin around each glyph, * to ensure that texture filtering doesn't bleed adjacent glyph's into each other. - * Default margin is 1 texels.*/ + * Default margin is 1 texels.*/ void setGlyphImageMargin(unsigned int margin); unsigned int getGlyphImageMargin() const; /** Set the margin ratio around each glyph, relative to the glyph's size. * to ensure that texture filtering doesn't bleed adjacent glyph's into each other. - * Default margin is 0.05.*/ + * Default margin is 0.05.*/ void setGlyphImageMarginRatio(float margin); float getGlyphImageMarginRatio() const; @@ -124,7 +124,7 @@ public: /** Set the size of texture to create to store the glyph images when rendering. * Note, this doesn't affect already created Texture Glhph's.*/ void setTextureSizeHint(unsigned int width,unsigned int height); - + unsigned int getTextureWidthHint() const; unsigned int getTextureHeightHint() const; @@ -132,7 +132,7 @@ public: * Note, this doesn't affect already created Texture Glhph's.*/ void setMinFilterHint(osg::Texture::FilterMode mode); osg::Texture::FilterMode getMinFilterHint() const; - + /** Set the magnification texture filter to use when creating the texture to store the glyph images when rendering. * Note, this doesn't affect already created Texture Glhph's.*/ void setMagFilterHint(osg::Texture::FilterMode mode); @@ -164,10 +164,10 @@ public: virtual void releaseGLObjects(osg::State* state=0) const; typedef OpenThreads::Mutex FontMutex; - + typedef std::vector< osg::ref_ptr > GlyphTextureList; GlyphTextureList& getGlyphTextureList() { return _glyphTextureList; } - + protected: virtual ~Font(); @@ -196,28 +196,28 @@ protected: float _marginRatio; unsigned int _textureWidthHint; - unsigned int _textureHeightHint; + unsigned int _textureHeightHint; osg::Texture::FilterMode _minFilterHint; osg::Texture::FilterMode _magFilterHint; unsigned int _depth; unsigned int _numCurveSamples; - + osg::ref_ptr _implementation; - + // declare the nested classes. public: class FontImplementation : public osg::Referenced { public: - + FontImplementation(): osg::Referenced(true), _facade(0) {} - + virtual std::string getFileName() const = 0; virtual bool supportsMultipleFontResolutions() const = 0; diff --git a/include/osgText/Glyph b/include/osgText/Glyph index 67fe77a92..b84f4a499 100644 --- a/include/osgText/Glyph +++ b/include/osgText/Glyph @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -265,7 +265,7 @@ public: /** create an image that maps all the associated Glyph's onto a single image, that is equivilant to what will be downloaded to the texture.*/ osg::Image* createImage(); - + protected: virtual ~GlyphTexture(); diff --git a/include/osgText/KerningType b/include/osgText/KerningType index 110df4063..2ebe65675 100644 --- a/include/osgText/KerningType +++ b/include/osgText/KerningType @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgText/String b/include/osgText/String index 313d23bfe..3fb51e4ae 100644 --- a/include/osgText/String +++ b/include/osgText/String @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -74,7 +74,7 @@ class OSGTEXT_EXPORT String : public VectorUInt void set(const std::string& str); - /** Set the text using a wchar_t string, + /** Set the text using a wchar_t string, * which is converted to an internal TextString.*/ void set(const wchar_t* text); diff --git a/include/osgText/Text b/include/osgText/Text index 15b1c2f1a..89a67ff75 100644 --- a/include/osgText/Text +++ b/include/osgText/Text @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -73,20 +73,20 @@ public: enum BackdropImplementation { - /* POLYGON_OFFSET: - * This uses glPolygonOffset to draw the text multiple times to - * create the drop-shadow and outline effects. glPolygonOffset + /* POLYGON_OFFSET: + * This uses glPolygonOffset to draw the text multiple times to + * create the drop-shadow and outline effects. glPolygonOffset * is used to prevent z-fighting of the overlapping text. * This probably should have been the best option, but all the ATI * cards we have encountered so far have serious problems with this. * We see little white holes/artifacts in the rendered glyph textures * which move around depending on the viewing angle. For moving text, * the moving holes give an extremely unpleasant flickering effect. - * Pumping up the "units" parameter in glPolygonOffset can minimize + * Pumping up the "units" parameter in glPolygonOffset can minimize * this problem, but two other bad side-effects occur if you do this. * First, high values will cause problems with clipping, particularly * when there are objects behind the text. The drop-shadows or outline - * may be culled because their computed offset is behind the object or + * may be culled because their computed offset is behind the object or * z-far plane. Second, there is an additional problem associated with * the Z-slope. High values can make large chunks of the backdrop * suddenly disappear. This can be reduced by the "factor" parameter. @@ -95,24 +95,24 @@ public: * So there is no perfect solution. With units, you trade off the 'holes' * for the large-section clipping. * Experimentally, we have found units values from 150-512 to be tolerable - * to acceptable with respect to the 'holes'. A factor of .1 seems to + * to acceptable with respect to the 'holes'. A factor of .1 seems to * bring down the large clipping problem without creating a new z-fighting * problem. - * (You can experiment with these numbers by playing with the + * (You can experiment with these numbers by playing with the * osg:PolygonOffset multipliers which this backend tries to respect.) * - * If ATI ever fixes their cards/drivers, then this might become the + * If ATI ever fixes their cards/drivers, then this might become the * best option.*/ POLYGON_OFFSET = 0, - + /* NO_DEPTH_BUFFER * Instead of using glPolygonOffset to prevent z-fighting, this mode * just disables the depth buffer when rendering the text. This allows - * the text to be rendered without any z-fighting. The downside to this - * mode is that render order begins to matter and the text will not - * necessarily correctly appear above or behind other objects in the + * the text to be rendered without any z-fighting. The downside to this + * mode is that render order begins to matter and the text will not + * necessarily correctly appear above or behind other objects in the * scene based on depth values. - * This mode is best for text that only needs to be ontop and + * This mode is best for text that only needs to be ontop and * not obscured by any objects.*/ NO_DEPTH_BUFFER, @@ -120,26 +120,26 @@ public: * This mode is inspired by Paul Martz's OpenGL FAQ, item 13.050. * This uses glDepthRange as a substitute for glPolygonOffset. * Strangely, experiments on ATI cards seem to produce cleaner results - * than when using glPolygonOffset. The trade-off for this is that the + * than when using glPolygonOffset. The trade-off for this is that the * backdrop still may be placed too far back and might be culled by objects * directly behind the object or by the far z-plane. If ATI ever fixes - * the glPolygonOffset problem, polygon offset is probably a slightly - * better solution because you can use smaller offsets. But with the + * the glPolygonOffset problem, polygon offset is probably a slightly + * better solution because you can use smaller offsets. But with the * current ATI problem, this option may be preferable.*/ DEPTH_RANGE, /* STENCIL_BUFFER * (Assuming the backend is written correctly,) the Stencil Buffer is * the most "correct" and reliable way of producing backdrop text. - * The stencil buffer is a multipass system that allows writing to the + * The stencil buffer is a multipass system that allows writing to the * same z-values without needing to resort to offsets. This implementation * should not have any of the problems associated with the 3 previous - * implementations. But the trade-off for this mode is that without - * hardware acceleration for the stencil buffer, rendering will be - * extremely slow. (There is also potentially more overhead for this - * algorithm so it could be slower than the other implementations. + * implementations. But the trade-off for this mode is that without + * hardware acceleration for the stencil buffer, rendering will be + * extremely slow. (There is also potentially more overhead for this + * algorithm so it could be slower than the other implementations. * Benchmarking would be required to determine if the speed differences - * are significant on your particular hardware.) This mode is best for - * when quality is important and stencil buffer hardware acceleration + * are significant on your particular hardware.) This mode is best for + * when quality is important and stencil buffer hardware acceleration * is available.*/ STENCIL_BUFFER, @@ -155,17 +155,17 @@ public: }; /** - * BackdropType gives you a background shadow text behind your regular - * text. This helps give text extra contrast which can be useful when - * placing text against noisy backgrounds. + * BackdropType gives you a background shadow text behind your regular + * text. This helps give text extra contrast which can be useful when + * placing text against noisy backgrounds. * The color of the background shadow text is specified by setBackdropColor(). - * DROP_SHADOW_BOTTOM_RIGHT will draw backdrop text to the right and down of + * DROP_SHADOW_BOTTOM_RIGHT will draw backdrop text to the right and down of * the normal text. Other DROW_SHADOW_* modes do the same for their repective directions. * OUTLINE will draw backdrop text so that it appears the text has an outline * or border around the normal text. This mode is particularly useful against - * really noisy backgrounds that may put text on top of things that have - * all types of colors which you don't have control over. - * Some real world examples of this general technique in use that I know of + * really noisy backgrounds that may put text on top of things that have + * all types of colors which you don't have control over. + * Some real world examples of this general technique in use that I know of * are Google Earth, Sid Meier's Pirates (2004 Remake), and Star Control 2 (PC 1993). * The default is NONE. */ @@ -173,8 +173,8 @@ public: BackdropType getBackdropType() const { return _backdropType; } - /** - * Sets the amount text is offset to create the backdrop/shadow effect. + /** + * Sets the amount text is offset to create the backdrop/shadow effect. * Set the value too high and for example, in OUTLINE mode you will get a "Brady Bunch" * effect where you see duplicates of the text in a 3x3 grid. * Set the value too small and you won't see anything. @@ -185,7 +185,7 @@ public: * to your specific font and display characteristics). * Note that the text bounding boxes are updated to include backdrop offsets. * However, other metric information such as getCharacterHeight() are unaffected - * by this. This means that individual glyph spacing (kerning?) are unchanged + * by this. This means that individual glyph spacing (kerning?) are unchanged * even when this mode is used. * The default is 0.07 (7% offset). */ @@ -213,7 +213,7 @@ public: * Unfortunately, at this time, there is no "perfect" rendering solution * so this function is provided to let you 'pick your poison'. Each * implementation has trade-offs. See BackdropImplementation enum - * docs for details.*/ + * docs for details.*/ void setBackdropImplementation(BackdropImplementation implementation); BackdropImplementation getBackdropImplementation() const { return _backdropImplementation; } @@ -229,17 +229,17 @@ public: /** * This sets different types of text coloring modes. - * When the coloring mode is not set to SOLID, the + * When the coloring mode is not set to SOLID, the * colors specified in setColorGradientCorners() determine * the colors for the text. * When the gradient mode is OVERALL, the coloring scheme * attempts to approximate the effect as if the entire text box/region * were a single polygon and you had applied colors to each of the four * corners with GL_SMOOTH enabled. In this mode, OpenGL interpolates - * the colors across the polygon, and this is what OVERALL tries to - * emulate. This can be used to give nice embellishments on things + * the colors across the polygon, and this is what OVERALL tries to + * emulate. This can be used to give nice embellishments on things * like logos and names. - * PER_CHARACTER is similar to OVERALL except that it applies the + * PER_CHARACTER is similar to OVERALL except that it applies the * color interpolation to the four corners of each character instead * of across the overall text box. * The default is SOLID (a.k.a. off). @@ -250,7 +250,7 @@ public: /** * Used only for gradient mode, let's you specify the colors of the 4 corners. - * If ColorGradients are off, these values are ignored (and the value from setColor() + * If ColorGradients are off, these values are ignored (and the value from setColor() * is the only one that is relevant. */ void setColorGradientCorners(const osg::Vec4& topLeft, const osg::Vec4& bottomLeft, const osg::Vec4& bottomRight, const osg::Vec4& topRight); @@ -261,7 +261,7 @@ public: const osg::Vec4& getColorGradientTopRight() const { return _colorGradientTopRight; } - + /** Draw the text.*/ virtual void drawImplementation(osg::RenderInfo& renderInfo) const; @@ -340,7 +340,7 @@ public: return &itGlyphQuad->second; } - const TextureGlyphQuadMap& getTextureGlyphQuadMap() const + const TextureGlyphQuadMap& getTextureGlyphQuadMap() const { return _textureGlyphQuadMap; } @@ -354,20 +354,20 @@ protected: const Font* getActiveFont() const; String::iterator computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last); - + // members which have public access. // iternal map used for rendering. Set up by the computeGlyphRepresentation() method. mutable TextureGlyphQuadMap _textureGlyphQuadMap; - + void computeGlyphRepresentation(); // internal caches of the positioning of the text. - + bool computeAverageGlyphWidthAndHeight(float& avg_width, float& avg_height) const; - + virtual void computePositions(unsigned int contextID) const; - + void computeBackdropPositions(unsigned int contextID) const; void computeBackdropBoundingBox() const; void computeBoundingBoxMargin() const; @@ -385,7 +385,7 @@ protected: void renderWithDepthRange(osg::State& state, const osg::Vec4& colorMultiplier) const; void renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMultiplier) const; void renderWithDelayedDepthWrites(osg::State& state, const osg::Vec4& colorMultiplier) const; - + bool _enableDepthWrites; BackdropType _backdropType; diff --git a/include/osgText/TextBase b/include/osgText/TextBase index b063c5129..a8ae93ad4 100644 --- a/include/osgText/TextBase +++ b/include/osgText/TextBase @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -66,18 +66,18 @@ public: Style* getOrCreateStyle() { if (!_style) _style = new Style; return _style.get(); } /** Set the Font reference width and height resolution in texels. - * Note, the size may not be supported by current font, + * Note, the size may not be supported by current font, * the closest supported font size will be selected.*/ void setFontResolution(unsigned int width, unsigned int height); unsigned int getFontWidth() const { return _fontSize.first; } unsigned int getFontHeight() const { return _fontSize.second; } - - + + /** Set the text using a osgText::String.*/ void setText(const String& text); - /** Set the text using a std::string, + /** Set the text using a std::string, * which is converted to an internal TextString.*/ void setText(const std::string& text); @@ -85,19 +85,19 @@ public: * The encoding parameter specificies which Unicode encodeding is used in the std::string. */ void setText(const std::string& text,String::Encoding encoding); - /** Set the text using a wchar_t string, + /** Set the text using a wchar_t string, * which is converted to an internal TextString.*/ void setText(const wchar_t* text); - - /** Get the text string. + + /** Get the text string. * Note, if you modify the string you must call Text::update() for * the internal glyph reprentation to be updated.*/ String& getText() { return _text; } /** Get the const text string.*/ const String& getText() const { return _text; } - - /** update internal glyph respresentation used for rendering, + + /** update internal glyph respresentation used for rendering, * and bounding volume.*/ void update() { computeGlyphRepresentation(); } @@ -120,32 +120,32 @@ public: /** Set how the CharacterSize value relates to the final rendered character.*/ void setCharacterSizeMode(CharacterSizeMode mode) { _characterSizeMode = mode; } - + /** Get the CharacterSizeMode.*/ CharacterSizeMode getCharacterSizeMode() const { return _characterSizeMode; } /** Set the maximum width of the text box. * With horizontal layouts any characters which do not fit are wrapped around. - * 0 or negative values indicate that no maximum width is set, lines can be as long as + * 0 or negative values indicate that no maximum width is set, lines can be as long as * they need be to fit thre required text*/ void setMaximumWidth(float maximumWidth); - + /** Get the maximim width of the text box.*/ float getMaximumWidth() const { return _maximumWidth; } /** Set the maximum height of the text box. * With horizontal layouts any characters which do not fit are wrapped around. - * 0 or negative values indicate that no maximum height is set, lines can be as long as + * 0 or negative values indicate that no maximum height is set, lines can be as long as * they need be to fit the required text*/ void setMaximumHeight(float maximumHeight); - + /** Get the maximum height of the text box.*/ float getMaximumHeight() const { return _maximumHeight; } /** Set the line spacing of the text box, given as a percentage of - * the character height. The default value is 0 for backward - * compatibility. For longer paragraphs of text, a value of at + * the character height. The default value is 0 for backward + * compatibility. For longer paragraphs of text, a value of at * least 25% (i.e. set line spacing to 0.25) is recommended. */ void setLineSpacing(float lineSpacing); @@ -156,10 +156,10 @@ public: /** Set the position of text.*/ void setPosition(const osg::Vec3& pos); - + /** Get the position of text.*/ const osg::Vec3& getPosition() const { return _position; } - + enum AlignmentType { @@ -174,19 +174,19 @@ public: RIGHT_TOP, RIGHT_CENTER, RIGHT_BOTTOM, - + LEFT_BASE_LINE, CENTER_BASE_LINE, RIGHT_BASE_LINE, - + LEFT_BOTTOM_BASE_LINE, CENTER_BOTTOM_BASE_LINE, RIGHT_BOTTOM_BASE_LINE, - + BASE_LINE = LEFT_BASE_LINE /// default. - + }; - + void setAlignment(AlignmentType alignment); AlignmentType getAlignment() const { return _alignment; } @@ -205,7 +205,7 @@ public: void setAxisAlignment(AxisAlignment axis); AxisAlignment getAxisAlignment() const { return _axisAlignment; } - + void setRotation(const osg::Quat& quat); const osg::Quat& getRotation() const { return _rotation; } @@ -218,9 +218,9 @@ public: RIGHT_TO_LEFT, VERTICAL }; - + void setLayout(Layout layout); - + Layout getLayout() const { return _layout; } @@ -233,18 +233,18 @@ public: }; void setDrawMode(unsigned int mode); - + unsigned int getDrawMode() const { return _drawMode; } void setBoundingBoxMargin(float margin); - + float getBoundingBoxMargin() const { return _textBBMargin; } void setBoundingBoxColor(const osg::Vec4& color){ _textBBColor = color; } - + const osg::Vec4& getBoundingBoxColor() const { return _textBBColor; } - + void setKerningType(KerningType kerningType) { _kerningType = kerningType; } KerningType getKerningType() const { return _kerningType; } @@ -263,7 +263,7 @@ public: * for all graphics contexts. */ virtual void releaseGLObjects(osg::State* state=0) const; - + virtual osg::BoundingBox computeBound() const; protected: @@ -277,8 +277,8 @@ protected: virtual void computePositions(unsigned int contextID) const = 0; virtual void computeGlyphRepresentation() = 0; - - + + // members which have public access. osg::Vec4 _color; osg::ref_ptr _font; @@ -303,17 +303,17 @@ protected: KerningType _kerningType; unsigned int _lineCount; - + // internal caches of the positioning of the text. - + struct AutoTransformCache - { + { AutoTransformCache(): _traversalNumber(-1), _width(0), _height(0) {} - + int _traversalNumber; int _width; int _height; @@ -322,7 +322,7 @@ protected: osg::Matrix _projection; osg::Matrix _matrix; }; - + mutable osg::buffered_object _autoTransformCache; mutable osg::Vec3 _offset; mutable osg::Vec3 _normal; @@ -333,4 +333,4 @@ protected: #endif - + diff --git a/include/osgText/Version b/include/osgText/Version index 02fbcda4a..1c338bc80 100644 --- a/include/osgText/Version +++ b/include/osgText/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgUtil/ConvertVec b/include/osgUtil/ConvertVec index 15f65740b..39c20be65 100644 --- a/include/osgUtil/ConvertVec +++ b/include/osgUtil/ConvertVec @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -16,8 +16,8 @@ namespace osgUtil { -template struct ConvertVec { @@ -31,9 +31,9 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()), - static_cast(in.y())); + { + out.set(static_cast(in.x()), + static_cast(in.y())); } }; @@ -41,10 +41,10 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()), - static_cast(in.y()), - static_cast(0.0)); + { + out.set(static_cast(in.x()), + static_cast(in.y()), + static_cast(0.0)); } }; @@ -52,11 +52,11 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()), - static_cast(in.y()), - static_cast(0.0), - static_cast(1.0)); + { + out.set(static_cast(in.x()), + static_cast(in.y()), + static_cast(0.0), + static_cast(1.0)); } }; @@ -68,9 +68,9 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()), - static_cast(in.y())); + { + out.set(static_cast(in.x()), + static_cast(in.y())); } }; @@ -78,10 +78,10 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()), - static_cast(in.y()), - static_cast(in.z())); + { + out.set(static_cast(in.x()), + static_cast(in.y()), + static_cast(in.z())); } }; @@ -89,11 +89,11 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()), - static_cast(in.y()), - static_cast(in.z()), - static_cast(1.0)); + { + out.set(static_cast(in.x()), + static_cast(in.y()), + static_cast(in.z()), + static_cast(1.0)); } }; @@ -105,9 +105,9 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()/in.w()), - static_cast(in.y()/in.w())); + { + out.set(static_cast(in.x()/in.w()), + static_cast(in.y()/in.w())); } }; @@ -115,10 +115,10 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()/in.w()), - static_cast(in.y()/in.w()), - static_cast(in.z()/in.w())); + { + out.set(static_cast(in.x()/in.w()), + static_cast(in.y()/in.w()), + static_cast(in.z()/in.w())); } }; @@ -126,11 +126,11 @@ template struct ConvertVec { static void convert(InType & in, OutType & out) - { - out.set(static_cast(in.x()), - static_cast(in.y()), - static_cast(in.z()), - static_cast(in.w())); + { + out.set(static_cast(in.x()), + static_cast(in.y()), + static_cast(in.z()), + static_cast(in.w())); } }; diff --git a/include/osgUtil/CubeMapGenerator b/include/osgUtil/CubeMapGenerator index 67641821b..b621f1938 100644 --- a/include/osgUtil/CubeMapGenerator +++ b/include/osgUtil/CubeMapGenerator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGUTIL_CUBEMAPGENERATOR_ @@ -28,7 +28,7 @@ namespace osgUtil { - /** This is the base class for cube map generators. + /** This is the base class for cube map generators. It exposes the necessary interface to access the six generated images; descendants should only override the compute_color() method. */ @@ -40,8 +40,8 @@ namespace osgUtil inline osg::Image *getImage(osg::TextureCubeMap::Face face); inline const osg::Image *getImage(osg::TextureCubeMap::Face face) const; - /** Generate the six cube images. - If use_osg_system is true, then the OSG's coordinate system is used instead + /** Generate the six cube images. + If use_osg_system is true, then the OSG's coordinate system is used instead of the default OpenGL one. */ void generateMap(bool use_osg_system = true); @@ -51,9 +51,9 @@ namespace osgUtil CubeMapGenerator &operator=(const CubeMapGenerator &) { return *this; } inline void set_pixel(int index, int c, int r, const osg::Vec4 &color); - inline static osg::Vec4 vector_to_color(const osg::Vec3 &vec); + inline static osg::Vec4 vector_to_color(const osg::Vec3 &vec); - /** Override this method to define how colors are computed. + /** Override this method to define how colors are computed. The parameter R is the reflection vector, pointing from the center of the cube. The return value should be the RGBA color associated with that reflection ray. */ @@ -63,7 +63,7 @@ namespace osgUtil int texture_size_; typedef std::vector > Image_list; - Image_list images_; + Image_list images_; }; // INLINE METHODS @@ -76,7 +76,7 @@ namespace osgUtil case osg::TextureCubeMap::POSITIVE_Y: return images_[2].get(); case osg::TextureCubeMap::NEGATIVE_Y: return images_[3].get(); case osg::TextureCubeMap::POSITIVE_Z: return images_[4].get(); - case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); + case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); default: return 0; } } @@ -89,7 +89,7 @@ namespace osgUtil case osg::TextureCubeMap::POSITIVE_Y: return images_[2].get(); case osg::TextureCubeMap::NEGATIVE_Y: return images_[3].get(); case osg::TextureCubeMap::POSITIVE_Z: return images_[4].get(); - case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); + case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); default: return 0; } } @@ -101,7 +101,7 @@ namespace osgUtil *(i->data(c, r)+0) = static_cast(osg::clampBetween(color.x(),0.0f,1.0f) * 255); *(i->data(c, r)+1) = static_cast(osg::clampBetween(color.y(),0.0f,1.0f) * 255); *(i->data(c, r)+2) = static_cast(osg::clampBetween(color.z(),0.0f,1.0f) * 255); - *(i->data(c, r)+3) = static_cast(osg::clampBetween(color.w(),0.0f,1.0f) * 255); + *(i->data(c, r)+3) = static_cast(osg::clampBetween(color.w(),0.0f,1.0f) * 255); } else { osg::notify(osg::WARN) << "Warning: CubeMapGenerator::set_pixel(): invalid image index\n"; } diff --git a/include/osgUtil/CullVisitor b/include/osgUtil/CullVisitor index 240a54485..e9dd2a468 100644 --- a/include/osgUtil/CullVisitor +++ b/include/osgUtil/CullVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,17 +43,17 @@ namespace osgUtil { * opaque osg::Drawables into a depth sorted transparent bin and a state * sorted opaque bin. The opaque bin is rendered first, and then the * transparent bin is rendered in order from the furthest osg::Drawable - * from the eye to the one nearest the eye. + * from the eye to the one nearest the eye. */ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStack { public: - + typedef osg::Matrix::value_type value_type; - + CullVisitor(); - + /// Copy constructor that does a shallow copy. CullVisitor(const CullVisitor&); @@ -64,7 +64,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac /** get the prototype singleton used by CullVisitor::create().*/ static osg::ref_ptr& prototype(); - + /** create a CullVisitor by cloning CullVisitor::prototype().*/ static CullVisitor* create(); @@ -130,7 +130,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac ++_numberOfEncloseOverrideRenderBinDetails; } } - + /** Pop the top state set and hence associated state group. * Move the current state group to the parent of the popped * state group. @@ -156,7 +156,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac } _currentStateGraph = _currentStateGraph->_parent; } - + inline void setStateGraph(StateGraph* rg) { _rootStateGraph = rg; @@ -206,7 +206,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac void setCalculatedNearPlane(value_type value) { _computed_znear = value; } inline value_type getCalculatedNearPlane() const { return _computed_znear; } - + void setCalculatedFarPlane(value_type value) { _computed_zfar = value; } inline value_type getCalculatedFarPlane() const { return _computed_zfar; } @@ -216,9 +216,9 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::BoundingBox& bb); bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable, bool isBillboard=false); - + void updateCalculatedNearFar(const osg::Vec3& pos); - + /** Add a drawable to current render graph.*/ inline void addDrawable(osg::Drawable* drawable,osg::RefMatrix* matrix); @@ -233,13 +233,13 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac /** compute near plane based on the polgon intersection of primtives in near plane candidate list of drawables. - * Note, you have to set ComputeNearFarMode to COMPUTE_NEAR_FAR_USING_PRIMITIVES to be able to near plane candidate drawables to be recorded by the cull traversal. */ + * Note, you have to set ComputeNearFarMode to COMPUTE_NEAR_FAR_USING_PRIMITIVES to be able to near plane candidate drawables to be recorded by the cull traversal. */ void computeNearPlane(); /** Re-implement CullStack's popProjectionMatrix() adding clamping of the projection matrix to * the computed near and far.*/ virtual void popProjectionMatrix(); - + /** CullVisitor's default clamping of the projection float matrix to computed near and far values. * Note, do not call this method directly, use clampProjectionMatrix(..) instead, unless you want to bypass the callback.*/ @@ -265,7 +265,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac zfar = zf; return true; } - else + else return false; } @@ -286,10 +286,10 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac zfar = zf; return true; } - else + else return false; } - + void setState(osg::State* state) { _renderInfo.setState(state); } osg::State* getState() { return _renderInfo.getState(); } @@ -305,7 +305,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac /** Prevent unwanted copy operator.*/ CullVisitor& operator = (const CullVisitor&) { return *this; } - + inline void handle_cull_callbacks_and_traverse(osg::Node& node) { osg::NodeCallback* callback = node.getCullCallback(); @@ -323,7 +323,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac osg::ref_ptr _rootStateGraph; StateGraph* _currentStateGraph; - osg::ref_ptr _rootRenderStage; + osg::ref_ptr _rootRenderStage; RenderBin* _currentRenderBin; std::vector _renderBinStack; @@ -331,14 +331,14 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac value_type _computed_znear; value_type _computed_zfar; - - + + typedef std::vector< osg::ref_ptr > RenderLeafList; RenderLeafList _reuseRenderLeafList; unsigned int _currentReuseRenderLeafIndex; - + inline RenderLeaf* createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth=0.0f); - + unsigned int _numberOfEncloseOverrideRenderBinDetails; osg::RenderInfo _renderInfo; @@ -350,13 +350,13 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac _drawable(0) { } - + void set(const osg::Matrix& matrix, const osg::Drawable* drawable, const osg::Polytope& frustum) { _matrix = matrix; _drawable = drawable; if (!_planes.empty()) _planes.clear(); - + // create a new list of planes from the active walls of the frustum. osg::Polytope::ClippingMask result_mask = frustum.getResultMask(); osg::Polytope::ClippingMask selector_mask = 0x1; @@ -365,15 +365,15 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac ++itr) { if (result_mask&selector_mask) _planes.push_back(*itr); - selector_mask <<= 1; + selector_mask <<= 1; } } - + MatrixPlanesDrawables(const MatrixPlanesDrawables& mpd): _matrix(mpd._matrix), _drawable(mpd._drawable), _planes(mpd._planes) {} - + MatrixPlanesDrawables& operator = (const MatrixPlanesDrawables& mpd) { _matrix = mpd._matrix; @@ -381,12 +381,12 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac _planes = mpd._planes; return *this; } - + osg::Matrix _matrix; const osg::Drawable* _drawable; osg::Polytope::PlaneList _planes; }; - + typedef std::multimap DistanceMatrixDrawableMap; DistanceMatrixDrawableMap _nearPlaneCandidateMap; DistanceMatrixDrawableMap _farPlaneCandidateMap; @@ -436,7 +436,7 @@ inline void CullVisitor::addPositionedTextureAttribute(unsigned int textureUnit, inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth) { // Skips any already reused renderleaf. - while (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size() && + while (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size() && _reuseRenderLeafList[_currentReuseRenderLeafIndex]->referenceCount()>1) { osg::notify(osg::NOTICE)<<"Warning:createOrReuseRenderLeaf() skipping multiply refrenced entry."<< std::endl; diff --git a/include/osgUtil/DelaunayTriangulator b/include/osgUtil/DelaunayTriangulator index 62153f9f3..9e50dd829 100644 --- a/include/osgUtil/DelaunayTriangulator +++ b/include/osgUtil/DelaunayTriangulator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ #include -namespace osgUtil +namespace osgUtil { /** DelaunayTriangulator: Utility class that triangulates an irregular network of sample points. @@ -43,7 +43,7 @@ class OSGUTIL_EXPORT DelaunayConstraint: public osg::Geometry { public: DelaunayConstraint() { } - /** Each primitiveset is a list of vertices which may be closed by joining up to its start + /** Each primitiveset is a list of vertices which may be closed by joining up to its start * to make a loop. Constraints should be simple lines, not crossing themselves. * Constraints which cross other constraints can cause difficulties - see the example * for methods of dealing with them. */ @@ -56,9 +56,9 @@ public: /** Get the filling primitive. One: * triangulate must have bneen called and - * two: triangle list is filled when + * two: triangle list is filled when * DelaunayTriangulator::removeInternalTriangles is called. - * These return the triangles removed from the delaunay triangulation by + * These return the triangles removed from the delaunay triangulation by * DelaunayTriangulator::removeInternalTriangles. */ inline const osg::DrawElementsUInt *getTriangles() const { return prim_tris_.get(); } @@ -81,7 +81,7 @@ public: /** remove from line the vertices that are inside dco */ void removeVerticesInside(const DelaunayConstraint *dco); - + /** return winding number as a float of loop around testpoint; may use multiple loops * does not reject points on the edge or very very close to the edge */ float windingNumber(const osg::Vec3 &testpoint) const ; @@ -150,7 +150,7 @@ public: /** Get the generated primitive (call triangulate() first). */ inline osg::DrawElementsUInt *getTriangles() { return prim_tris_.get(); } - + /** remove the triangles internal to the constraint loops. * (Line strips cannot remove any internal triangles). */ void removeInternalTriangles(DelaunayConstraint *constraint); diff --git a/include/osgUtil/DisplayRequirementsVisitor b/include/osgUtil/DisplayRequirementsVisitor index 5648822c9..cbd590780 100644 --- a/include/osgUtil/DisplayRequirementsVisitor +++ b/include/osgUtil/DisplayRequirementsVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,25 +35,25 @@ class OSGUTIL_EXPORT DisplayRequirementsVisitor : public osg::NodeVisitor * requiresRGB and requiresDepthBuffer to true and with * alpha and stencil off.*/ DisplayRequirementsVisitor(); - + META_NodeVisitor("osgUtil","DisplayRequirementsVisitor") /** Set the DisplaySettings. */ inline void setDisplaySettings(osg::DisplaySettings* ds) { _ds = ds; } - + /** Get the DisplaySettings */ inline const osg::DisplaySettings* getDisplaySettings() const { return _ds.get(); } - + virtual void applyStateSet(osg::StateSet& stateset); virtual void apply(osg::Node& node); virtual void apply(osg::Geode& geode); - + protected: - + osg::ref_ptr _ds; - + }; } diff --git a/include/osgUtil/DrawElementTypeSimplifier b/include/osgUtil/DrawElementTypeSimplifier index 974772f85..752def10d 100644 --- a/include/osgUtil/DrawElementTypeSimplifier +++ b/include/osgUtil/DrawElementTypeSimplifier @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGUTIL_DRAWELEMENTTYPESIMPLIFIER @@ -31,7 +31,7 @@ class OSGUTIL_EXPORT DrawElementTypeSimplifier class OSGUTIL_EXPORT DrawElementTypeSimplifierVisitor : public osg::NodeVisitor { public: - + META_NodeVisitor("osgUtil","DrawElementTypeSimplifierVisitor"); void apply(osg::Geode& node); diff --git a/include/osgUtil/EdgeCollector b/include/osgUtil/EdgeCollector index 0dda05d1b..1a79114fb 100644 --- a/include/osgUtil/EdgeCollector +++ b/include/osgUtil/EdgeCollector @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -62,14 +62,14 @@ namespace osgUtil { class OSGUTIL_EXPORT EdgeCollector { public: - + struct Triangle; struct Edge; struct Edgeloop; struct Point; typedef std::list > IndexArrayList; - + ~EdgeCollector(); void setGeometry(osg::Geometry* geometry); @@ -89,7 +89,7 @@ public: struct OSGUTIL_EXPORT Point : public osg::Referenced { Point(): _protected(false), _index(0) {} - + bool _protected; unsigned int _index; @@ -100,7 +100,7 @@ public: void clear() { _triangles.clear(); } bool operator < ( const Point& rhs) const { return _vertex < rhs._vertex; } - + bool isBoundaryPoint() const; }; @@ -110,99 +110,99 @@ public: osg::ref_ptr _p1; osg::ref_ptr _p2; - + osg::ref_ptr _op1; osg::ref_ptr _op2; - + TriangleSet _triangles; - + bool operator < ( const Edge& rhs) const; - + bool operator == ( const Edge& rhs) const; bool operator != ( const Edge& rhs) const; - + void setOrderedPoints(Point* p1, Point* p2); - + void addTriangle(Triangle* triangle) { _triangles.insert(triangle); } - + bool isBoundaryEdge() const { return _triangles.size()<=1; } - + bool isAdjacentToBoundary() const { return isBoundaryEdge() || _p1->isBoundaryPoint() || _p2->isBoundaryPoint(); } - + bool endConnected(const Edge& rhs) const { return (_op2 == rhs._op1); } - + bool beginConnected(const Edge& rhs) const { return (_op1 == rhs._op2); } }; struct OSGUTIL_EXPORT Triangle : public osg::Referenced { Triangle() {} - + void clear(); bool operator < (const Triangle& rhs) const; void setOrderedPoints(Point* p1, Point* p2, Point* p3); - + float distance(const osg::Vec3& vertex) const { return _plane.distance(vertex); } - + bool isBoundaryTriangle() const { return (_e1->isBoundaryEdge() || _e2->isBoundaryEdge() || _e3->isBoundaryEdge()); } - + osg::ref_ptr _p1; osg::ref_ptr _p2; osg::ref_ptr _p3; - + osg::ref_ptr _op1; osg::ref_ptr _op2; osg::ref_ptr _op3; - + osg::ref_ptr _e1; osg::ref_ptr _e2; osg::ref_ptr _e3; - - osg::Plane _plane; + + osg::Plane _plane; }; struct OSGUTIL_EXPORT Edgeloop : public osg::Referenced { typedef std::vector > EdgeList; - + bool isClosed() { return (_edgeList.back()->endConnected(*_edgeList.front().get())); } - + osg::UIntArray * toIndexArray() const; - + EdgeList _edgeList; }; - + Triangle* addTriangle(unsigned int p1, unsigned int p2, unsigned int p3); Triangle* addTriangle(Point* p1, Point* p2, Point* p3); Edge* addEdge(Triangle* triangle, Point* p1, Point* p2); - + Point* addPoint(Triangle* triangle, unsigned int p1) { return addPoint(triangle,_originalPointList[p1].get()); } Point* addPoint(Triangle* triangle, Point* point); - + void getBoundaryEdgeList(EdgeList & el); bool extractBoundaryEdgeloop(EdgeList & el, Edgeloop & edgeloop); bool extractBoundaryEdgeloopList(EdgeList & el, EdgeloopList & edgeloopList); - + void getEdgeloopIndexList(IndexArrayList & ial); - + //protected: - + osg::Geometry* _geometry; - + EdgeSet _edgeSet; TriangleSet _triangleSet; PointSet _pointSet; PointList _originalPointList; - + }; } // end of osgUtil namespace diff --git a/include/osgUtil/Export b/include/osgUtil/Export index 215db78d2..7ad137e57 100644 --- a/include/osgUtil/Export +++ b/include/osgUtil/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,8 +37,8 @@ # define OSGUTIL_EXPORT __declspec(dllimport) #endif #else - #define OSGUTIL_EXPORT -#endif + #define OSGUTIL_EXPORT +#endif /** diff --git a/include/osgUtil/GLObjectsVisitor b/include/osgUtil/GLObjectsVisitor index ae6a8533e..751b45657 100644 --- a/include/osgUtil/GLObjectsVisitor +++ b/include/osgUtil/GLObjectsVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,7 +23,7 @@ namespace osgUtil { -/** Visitor for traversing scene graph and setting each osg::Drawable's _useDisplayList flag, +/** Visitor for traversing scene graph and setting each osg::Drawable's _useDisplayList flag, * with option to immediately compile osg::Drawable OpenGL Display lists and * osg::StateAttribute's. */ @@ -44,38 +44,38 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor SWITCH_OFF_VERTEX_BUFFER_OBJECTS = 0x80, CHECK_BLACK_LISTED_MODES = 0x100 }; - + typedef unsigned int Mode; /** Construct a GLObjectsVisitor to traverse all children, operating on - * node according to specified mode, such as to compile or release - * display list/texture objects etc. Default mode is to compile + * node according to specified mode, such as to compile or release + * display list/texture objects etc. Default mode is to compile * GL objects. */ - GLObjectsVisitor(Mode mode=COMPILE_DISPLAY_LISTS|COMPILE_STATE_ATTRIBUTES|CHECK_BLACK_LISTED_MODES); - + GLObjectsVisitor(Mode mode=COMPILE_DISPLAY_LISTS|COMPILE_STATE_ATTRIBUTES|CHECK_BLACK_LISTED_MODES); + META_NodeVisitor("osg","GLObjectsVisitor") - + virtual void reset() { _drawablesAppliedSet.clear(); _stateSetAppliedSet.clear(); } - + /** Set the operational mode of what operations to do on the scene graph.*/ void setMode(Mode mode) { _mode = mode; } /** Get the operational mode.*/ Mode getMode() const { return _mode; } - + /** Set the State to use during traversal. */ void setState(osg::State* state) { _renderInfo.setState(state); } - + osg::State* getState() { return _renderInfo.getState(); @@ -85,7 +85,7 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor { _renderInfo = renderInfo; } - + osg::RenderInfo& getRenderInfo() { return _renderInfo; @@ -93,8 +93,8 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor /** Simply traverse using standard NodeVisitor traverse method.*/ virtual void apply(osg::Node& node); - - /** For each Geode visited set the display list usage according to the + + /** For each Geode visited set the display list usage according to the * _displayListMode. */ virtual void apply(osg::Geode& node); @@ -124,9 +124,9 @@ class OSGUTIL_EXPORT GLObjectsOperation : public osg::GraphicsOperation GLObjectsOperation(osg::Node* subgraph, GLObjectsVisitor::Mode mode = GLObjectsVisitor::COMPILE_DISPLAY_LISTS|GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES|GLObjectsVisitor::CHECK_BLACK_LISTED_MODES); virtual void operator () (osg::GraphicsContext* context); - + protected: - + osg::ref_ptr _subgraph; GLObjectsVisitor::Mode _mode; }; diff --git a/include/osgUtil/HalfWayMapGenerator b/include/osgUtil/HalfWayMapGenerator index 3fe4db749..5b247b3f3 100644 --- a/include/osgUtil/HalfWayMapGenerator +++ b/include/osgUtil/HalfWayMapGenerator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGUTIL_HALFWAYMAPGENERATOR_ @@ -20,9 +20,9 @@ namespace osgUtil { - /** This cube map generator produces an Half-way vector map, useful for + /** This cube map generator produces an Half-way vector map, useful for * hardware-based specular lighting effects. - * It computes: C = normalize(R - L), where C is the resulting color, + * It computes: C = normalize(R - L), where C is the resulting color, * R is the reflection vector and L is the light direction. */ class OSGUTIL_EXPORT HalfWayMapGenerator: public CubeMapGenerator { diff --git a/include/osgUtil/HighlightMapGenerator b/include/osgUtil/HighlightMapGenerator index 1c0758848..5354d6c09 100644 --- a/include/osgUtil/HighlightMapGenerator +++ b/include/osgUtil/HighlightMapGenerator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGUTIL_HIGHLIGHTMAPGENERATOR_ @@ -20,17 +20,17 @@ namespace osgUtil { - /** This cube map generator produces a specular highlight map. - * The vector-color association is: C = (R dot (-L)) ^ n, where C is the - * resulting color, R is the reflection vector, L is the light direction + /** This cube map generator produces a specular highlight map. + * The vector-color association is: C = (R dot (-L)) ^ n, where C is the + * resulting color, R is the reflection vector, L is the light direction * and n is the specular exponent. */ class OSGUTIL_EXPORT HighlightMapGenerator: public CubeMapGenerator { public: HighlightMapGenerator( - const osg::Vec3 &light_direction, - const osg::Vec4 &light_color, - float specular_exponent, + const osg::Vec3 &light_direction, + const osg::Vec4 &light_color, + float specular_exponent, int texture_size = 64); HighlightMapGenerator(const HighlightMapGenerator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); diff --git a/include/osgUtil/IncrementalCompileOperation b/include/osgUtil/IncrementalCompileOperation index 96f77319b..6325272f5 100644 --- a/include/osgUtil/IncrementalCompileOperation +++ b/include/osgUtil/IncrementalCompileOperation @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -72,17 +72,17 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation * time to set aside the faster databases will be paged in but with increased chance of frame drops, * the lower the amount of time the set aside the slower databases will paged it but with better * chance of avoid any frame drops. The default values are chosen to achieve the later when running - * on a modern mid to high end PC. + * on a modern mid to high end PC. * The way to compute the amount of available time use a scheme such as : - * availableTime = maximum(1.0/targetFrameRate - timeTakenDuringUpdateCullAndDraw, minimumTimeAvailableForGLCompileAndDeletePerFrame). + * availableTime = maximum(1.0/targetFrameRate - timeTakenDuringUpdateCullAndDraw, minimumTimeAvailableForGLCompileAndDeletePerFrame). */ void setTargetFrameRate(double tfr) { _targetFrameRate = tfr; } /** Get the target frame rate that the IncrementalCompileOperation should assume.*/ double getTargetFrameRate() const { return _targetFrameRate; } - + /** Set the minimum amount of time (in seconds) that should be made available for compiling and delete OpenGL objects per frame. - * Default value is 0.001 (1 millisecond). + * Default value is 0.001 (1 millisecond). * For usage see notes in setTargetFrameRate.*/ void setMinimumTimeAvailableForGLCompileAndDeletePerFrame(double ta) { _minimumTimeAvailableForGLCompileAndDeletePerFrame = ta; } @@ -175,7 +175,7 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation double allocatedTime; osg::ElapsedTime timer; }; - + struct CompileOp : public osg::Referenced { /** return an estimate for how many seconds the compile will take.*/ @@ -230,7 +230,7 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation class CompileSet; - + struct CompileCompletedCallback : public virtual osg::Referenced { /// return true if the callback assumes responsibility for merging any associated subgraphs with the main scene graph diff --git a/include/osgUtil/IntersectVisitor b/include/osgUtil/IntersectVisitor index f2f3929d1..2c826d3de 100644 --- a/include/osgUtil/IntersectVisitor +++ b/include/osgUtil/IntersectVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,16 +30,16 @@ namespace osgUtil { class OSGUTIL_EXPORT Hit -{ +{ /** Deprecated */ public: Hit(); Hit(const Hit& hit); ~Hit(); - + Hit& operator = (const Hit& hit); - + typedef std::vector VecIndexList; bool operator < (const Hit& hit) const @@ -48,11 +48,11 @@ class OSGUTIL_EXPORT Hit if (hit._originalLineSegment<_originalLineSegment) return false; return _ratio _originalLineSegment; osg::ref_ptr _localLineSegment; @@ -79,7 +79,7 @@ class OSGUTIL_EXPORT Hit osg::ref_ptr _drawable; osg::ref_ptr _matrix; osg::ref_ptr _inverse; - + VecIndexList _vecIndexList; int _primitiveIndex; osg::Vec3 _intersectPoint; @@ -100,7 +100,7 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor META_NodeVisitor("osgUtil","IntersectVisitor") void reset(); - + /** Add a line segment to use for intersection testing during scene traversal. * Note, a maximum of 32 line segments can be added to a IntersectVistor, * adding more than this will result in warning being emitted to the console @@ -113,7 +113,7 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor HitList& getHitList(const osg::LineSegment* seg) { return _segHitList[seg]; } int getNumHits(const osg::LineSegment* seg) { return _segHitList[seg].size(); } - + LineSegmentHitListMap& getSegHitList() { return _segHitList; } bool hits(); @@ -123,7 +123,7 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor USE_HIGHEST_LEVEL_OF_DETAIL, USE_SEGMENT_START_POINT_AS_EYE_POINT_FOR_LOD_LEVEL_SELECTION }; - + void setLODSelectionMode(LODSelectionMode mode) { _lodSelectionMode = mode; } LODSelectionMode getLODSelectionMode() const { return _lodSelectionMode; } @@ -190,11 +190,11 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor void leaveNode(); typedef std::vector > IntersectStateStack; - + IntersectStateStack _intersectStateStack; LineSegmentHitListMap _segHitList; - + LODSelectionMode _lodSelectionMode; osg::Vec3 _pseudoEyePoint; }; @@ -213,7 +213,7 @@ class OSGUTIL_EXPORT PickVisitor : public osgUtil::IntersectVisitor void apply(osg::Camera& camera); protected: - + float _mx; float _my; diff --git a/include/osgUtil/MeshOptimizers b/include/osgUtil/MeshOptimizers index b78a2e372..9ff9a63b4 100644 --- a/include/osgUtil/MeshOptimizers +++ b/include/osgUtil/MeshOptimizers @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgUtil/OperationArrayFunctor b/include/osgUtil/OperationArrayFunctor index 740c1bf8e..8d77a57d0 100644 --- a/include/osgUtil/OperationArrayFunctor +++ b/include/osgUtil/OperationArrayFunctor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -27,7 +27,7 @@ template class OperationArrayFunctor : public osg::ArrayVisitor, public T { public: - + virtual void apply(osg::Array&) {} // virtual void apply(osg::ByteArray& array) { T::process(array); } // virtual void apply(osg::ShortArray& array) { T::process(array); } @@ -60,26 +60,26 @@ class OperationArrayFunctor : public osg::ArrayVisitor, public T struct AddRangeOperator { template - void process(ArrayType & array) - { + void process(ArrayType & array) + { typedef typename ArrayType::ElementDataType ElementDataType; - + ElementDataType convertedVector; osgUtil::ConvertVec::convert(_vector, convertedVector); - + typename ArrayType::iterator it = array.begin(); std::advance(it, _begin); - + typename ArrayType::iterator end = it; std::advance(end, _count); - + for (; it < end; ++it) (*it) += convertedVector; } unsigned int _begin; unsigned int _count; - + osg::Vec3d _vector; }; typedef OperationArrayFunctor AddRangeFunctor; @@ -87,26 +87,26 @@ typedef OperationArrayFunctor AddRangeFunctor; struct MultiplyRangeOperator { template - void process(ArrayType & array) - { + void process(ArrayType & array) + { typedef typename ArrayType::ElementDataType ElementDataType; - + ElementDataType convertedVector; osgUtil::ConvertVec::convert(_vector, convertedVector); - + typename ArrayType::iterator it = array.begin(); std::advance(it, _begin); - + typename ArrayType::iterator end = it; std::advance(end, _count); - + for (; it < end; ++it) (*it) *= convertedVector; } unsigned int _begin; unsigned int _count; - + osg::Vec3d _vector; }; typedef OperationArrayFunctor MultiplyRangeFunctor; diff --git a/include/osgUtil/Optimizer b/include/osgUtil/Optimizer index 931f65e6c..9f7759cb7 100644 --- a/include/osgUtil/Optimizer +++ b/include/osgUtil/Optimizer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -44,7 +44,7 @@ class OSGUTIL_EXPORT BaseOptimizerVisitor : public osg::NodeVisitor inline bool isOperationPermissibleForObject(const osg::StateSet* object) const; inline bool isOperationPermissibleForObject(const osg::StateAttribute* object) const; - inline bool isOperationPermissibleForObject(const osg::Drawable* object) const; + inline bool isOperationPermissibleForObject(const osg::Drawable* object) const; inline bool isOperationPermissibleForObject(const osg::Node* object) const; protected: @@ -56,7 +56,7 @@ class OSGUTIL_EXPORT BaseOptimizerVisitor : public osg::NodeVisitor /** Traverses scene graph to improve efficiency. See OptimizationOptions. * For example of usage see examples/osgimpostor or osgviewer. */ - + class OSGUTIL_EXPORT Optimizer { @@ -117,7 +117,7 @@ class OSGUTIL_EXPORT Optimizer /** Reset internal data to initial state - the getPermissibleOptionsMap is cleared.*/ void reset(); - + /** Traverse the node and its subgraph with a series of optimization * visitors, specified by the OptimizationOptions.*/ void optimize(osg::Node* node); @@ -127,38 +127,38 @@ class OSGUTIL_EXPORT Optimizer virtual void optimize(osg::Node* node, unsigned int options); - /** Callback for customizing what operations are permitted on objects in the scene graph.*/ + /** Callback for customizing what operations are permitted on objects in the scene graph.*/ struct IsOperationPermissibleForObjectCallback : public osg::Referenced { virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::StateSet* stateset,unsigned int option) const { return optimizer->isOperationPermissibleForObjectImplementation(stateset,option); } - + virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::StateAttribute* attribute,unsigned int option) const { return optimizer->isOperationPermissibleForObjectImplementation(attribute,option); } - + virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::Drawable* drawable,unsigned int option) const { return optimizer->isOperationPermissibleForObjectImplementation(drawable,option); } - + virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::Node* node,unsigned int option) const { return optimizer->isOperationPermissibleForObjectImplementation(node,option); } - + }; - - /** Set the callback for customizing what operations are permitted on objects in the scene graph.*/ + + /** Set the callback for customizing what operations are permitted on objects in the scene graph.*/ void setIsOperationPermissibleForObjectCallback(IsOperationPermissibleForObjectCallback* callback) { _isOperationPermissibleForObjectCallback=callback; } - /** Get the callback for customizing what operations are permitted on objects in the scene graph.*/ + /** Get the callback for customizing what operations are permitted on objects in the scene graph.*/ IsOperationPermissibleForObjectCallback* getIsOperationPermissibleForObjectCallback() { return _isOperationPermissibleForObjectCallback.get(); } - /** Get the callback for customizing what operations are permitted on objects in the scene graph.*/ + /** Get the callback for customizing what operations are permitted on objects in the scene graph.*/ const IsOperationPermissibleForObjectCallback* getIsOperationPermissibleForObjectCallback() const { return _isOperationPermissibleForObjectCallback.get(); } @@ -166,7 +166,7 @@ class OSGUTIL_EXPORT Optimizer { _permissibleOptimizationsMap[object] = options; } - + inline unsigned int getPermissibleOptimizationsForObject(const osg::Object* object) const { PermissibleOptimizationsMap::const_iterator itr = _permissibleOptimizationsMap.find(object); @@ -179,39 +179,39 @@ class OSGUTIL_EXPORT Optimizer { if (_isOperationPermissibleForObjectCallback.valid()) return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option); - else - return isOperationPermissibleForObjectImplementation(object,option); + else + return isOperationPermissibleForObjectImplementation(object,option); } inline bool isOperationPermissibleForObject(const osg::StateAttribute* object, unsigned int option) const { if (_isOperationPermissibleForObjectCallback.valid()) return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option); - else - return isOperationPermissibleForObjectImplementation(object,option); + else + return isOperationPermissibleForObjectImplementation(object,option); } inline bool isOperationPermissibleForObject(const osg::Drawable* object, unsigned int option) const { if (_isOperationPermissibleForObjectCallback.valid()) return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option); - else - return isOperationPermissibleForObjectImplementation(object,option); + else + return isOperationPermissibleForObjectImplementation(object,option); } inline bool isOperationPermissibleForObject(const osg::Node* object, unsigned int option) const { if (_isOperationPermissibleForObjectCallback.valid()) return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option); - else - return isOperationPermissibleForObjectImplementation(object,option); + else + return isOperationPermissibleForObjectImplementation(object,option); } bool isOperationPermissibleForObjectImplementation(const osg::StateSet* stateset, unsigned int option) const { return (option & getPermissibleOptimizationsForObject(stateset))!=0; } - + bool isOperationPermissibleForObjectImplementation(const osg::StateAttribute* attribute, unsigned int option) const { return (option & getPermissibleOptimizationsForObject(attribute))!=0; @@ -245,21 +245,21 @@ class OSGUTIL_EXPORT Optimizer return (option & getPermissibleOptimizationsForObject(node))!=0; } - + protected: osg::ref_ptr _isOperationPermissibleForObjectCallback; typedef std::map PermissibleOptimizationsMap; - PermissibleOptimizationsMap _permissibleOptimizationsMap; - + PermissibleOptimizationsMap _permissibleOptimizationsMap; + public: /** Flatten Static Transform nodes by applying their transform to the - * geometry on the leaves of the scene graph, then removing the + * geometry on the leaves of the scene graph, then removing the * now redundant transforms. Static transformed Subgraphs that have multiple * parental paths above them are not flattened, if you require this then - * the subgraphs have to be duplicated - for this use the + * the subgraphs have to be duplicated - for this use the * FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor. */ class OSGUTIL_EXPORT FlattenStaticTransformsVisitor : public BaseOptimizerVisitor { @@ -284,7 +284,7 @@ class OSGUTIL_EXPORT Optimizer typedef std::set BillboardSet; typedef std::set NodeSet; typedef std::set TransformSet; - + TransformStack _transformStack; NodeSet _excludedNodeSet; DrawableSet _drawableSet; @@ -298,7 +298,7 @@ class OSGUTIL_EXPORT Optimizer * but with the difference that any subgraphs that are shared between different transforms * of duplicated and flatten individually. This results in more static transforms * being removed, but also means that more data is generated, and as a result may - * not always be the most appropriate flatten visitor to use.*/ + * not always be the most appropriate flatten visitor to use.*/ class OSGUTIL_EXPORT FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor : public BaseOptimizerVisitor { public: @@ -324,7 +324,7 @@ class OSGUTIL_EXPORT Optimizer }; - /** Combine Static Transform nodes that sit above one another.*/ + /** Combine Static Transform nodes that sit above one another.*/ class OSGUTIL_EXPORT CombineStaticTransformsVisitor : public BaseOptimizerVisitor { public: @@ -356,7 +356,7 @@ class OSGUTIL_EXPORT Optimizer virtual void apply(osg::Geode& geode); virtual void apply(osg::Group& group); - + void removeEmptyNodes(); }; @@ -371,12 +371,12 @@ class OSGUTIL_EXPORT Optimizer RemoveRedundantNodesVisitor(Optimizer* optimizer=0): BaseOptimizerVisitor(optimizer, REMOVE_REDUNDANT_NODES) {} - + virtual void apply(osg::Group& group); virtual void apply(osg::Transform& transform); - + bool isOperationPermissible(osg::Node& node); - + void removeRedundantNodes(); }; @@ -391,9 +391,9 @@ class OSGUTIL_EXPORT Optimizer RemoveLoadedProxyNodesVisitor(Optimizer* optimizer=0): BaseOptimizerVisitor(optimizer, REMOVE_LOADED_PROXY_NODES) {} - + virtual void apply(osg::ProxyNode& group); - + void removeRedundantNodes(); }; @@ -430,7 +430,7 @@ class OSGUTIL_EXPORT Optimizer void combineLODs(); }; - + /** Optimize State in the scene graph by removing duplicate state, * replacing it with shared instances, both for StateAttributes, * and whole StateSets.*/ @@ -450,7 +450,7 @@ class OSGUTIL_EXPORT Optimizer _optimize[osg::Object::UNSPECIFIED] = combineUnspecifiedState; } - /** empty visitor, make it ready for next traversal.*/ + /** empty visitor, make it ready for next traversal.*/ virtual void reset(); virtual void apply(osg::Node& node); @@ -462,7 +462,7 @@ class OSGUTIL_EXPORT Optimizer protected: void addStateSet(osg::StateSet* stateset,osg::Object* obj); - + inline bool optimize(osg::Object::DataVariance variance) { return _optimize[variance]; @@ -473,7 +473,7 @@ class OSGUTIL_EXPORT Optimizer // note, one element for DYNAMIC, STATIC and UNSPECIFIED bool _optimize[3]; - + StateSetMap _statesets; }; @@ -509,9 +509,9 @@ class OSGUTIL_EXPORT Optimizer virtual void apply(osg::Geode& geode) { checkGeode(geode); } void checkGeode(osg::Geode& geode); - + }; - + class OSGUTIL_EXPORT MakeFastGeometryVisitor : public BaseOptimizerVisitor { public: @@ -523,9 +523,9 @@ class OSGUTIL_EXPORT Optimizer virtual void apply(osg::Geode& geode) { checkGeode(geode); } void checkGeode(osg::Geode& geode); - - }; - + + }; + class OSGUTIL_EXPORT MergeGeometryVisitor : public BaseOptimizerVisitor { public: @@ -539,7 +539,7 @@ class OSGUTIL_EXPORT Optimizer { _targetMaximumNumberOfVertices = num; } - + unsigned int getTargetMaximumNumberOfVertices() const { return _targetMaximumNumberOfVertices; @@ -573,15 +573,15 @@ class OSGUTIL_EXPORT Optimizer SpatializeGroupsVisitor(Optimizer* optimizer=0): BaseOptimizerVisitor(optimizer, SPATIALIZE_GROUPS) {} - + virtual void apply(osg::Group& group); virtual void apply(osg::Geode& geode); - + bool divide(unsigned int maxNumTreesPerCell=8); - + bool divide(osg::Group* group, unsigned int maxNumTreesPerCell); bool divide(osg::Geode* geode, unsigned int maxNumTreesPerCell); - + typedef std::set GroupsToDivideList; GroupsToDivideList _groupsToDivideList; @@ -596,14 +596,14 @@ class OSGUTIL_EXPORT Optimizer CopySharedSubgraphsVisitor(Optimizer* optimizer=0): BaseOptimizerVisitor(optimizer, COPY_SHARED_NODES) {} - + virtual void apply(osg::Node& node); void copySharedNodes(); - + typedef std::set SharedNodeList; SharedNodeList _sharedNodeList; - + }; @@ -620,7 +620,7 @@ class OSGUTIL_EXPORT Optimizer _changeAutoUnRef(changeAutoUnRef), _valueAutoUnRef(valueAutoUnRef), _changeClientImageStorage(changeClientImageStorage), _valueClientImageStorage(valueClientImageStorage), _changeAnisotropy(changeAnisotropy), _valueAnisotropy(valueAnisotropy) {} - + virtual void apply(osg::Geode& node); virtual void apply(osg::Node& node); @@ -633,7 +633,7 @@ class OSGUTIL_EXPORT Optimizer float _valueAnisotropy; }; - + /** Flatten MatrixTransform/Billboard pairs.*/ class OSGUTIL_EXPORT FlattenBillboardVisitor : public BaseOptimizerVisitor { @@ -648,59 +648,59 @@ class OSGUTIL_EXPORT Optimizer virtual void apply(osg::Billboard& billboard); - void process(); + void process(); BillboardNodePathMap _billboards; }; - + /** Texture Atlas Builder creates a set of textures/images which each contain multiple images. * Texture Atlas' are used to make it possible to use much wider batching of data. */ class OSGUTIL_EXPORT TextureAtlasBuilder { public: TextureAtlasBuilder(); - + void reset(); - + void setMaximumAtlasSize(int width, int height); int getMaximumAtlasWidth() const { return _maximumAtlasWidth; } int getMaximumAtlasHeight() const { return _maximumAtlasHeight; } - + void setMargin(int margin); int getMargin() const { return _margin; } void addSource(const osg::Image* image); void addSource(const osg::Texture2D* texture); - + unsigned int getNumSources() const { return _sourceList.size(); } const osg::Image* getSourceImage(unsigned int i) { return _sourceList[i]->_image.get(); } const osg::Texture2D* getSourceTexture(unsigned int i) { return _sourceList[i]->_texture.get(); } - + void buildAtlas(); osg::Image* getImageAtlas(unsigned int i); osg::Texture2D* getTextureAtlas(unsigned int i); osg::Matrix getTextureMatrix(unsigned int i); - + osg::Image* getImageAtlas(const osg::Image* image); osg::Texture2D* getTextureAtlas(const osg::Image* image); osg::Matrix getTextureMatrix(const osg::Image* image); - + osg::Image* getImageAtlas(const osg::Texture2D* textue); osg::Texture2D* getTextureAtlas(const osg::Texture2D* texture); osg::Matrix getTextureMatrix(const osg::Texture2D* texture); - + protected: - + int _maximumAtlasWidth; int _maximumAtlasHeight; int _margin; - + // forward declare class Atlas; - + class Source : public osg::Referenced { public: @@ -712,20 +712,20 @@ class OSGUTIL_EXPORT Optimizer Source(const osg::Texture2D* texture): _x(0),_y(0),_atlas(0),_texture(texture) { if (texture) _image = texture->getImage(); } - + int _x; int _y; Atlas* _atlas; osg::ref_ptr _image; osg::ref_ptr _texture; - + bool suitableForAtlas(int maximumAtlasWidth, int maximumAtlasHeight, int margin); osg::Matrix computeTextureMatrix() const; - - + + protected: - + virtual ~Source() {} }; @@ -743,16 +743,16 @@ class OSGUTIL_EXPORT Optimizer _width(0), _height(0), _indexFirstOfRow(0){} - + int _maximumAtlasWidth; int _maximumAtlasHeight; int _margin; osg::ref_ptr _texture; osg::ref_ptr _image; - + SourceList _sourceList; - + int _x; int _y; int _width; @@ -768,13 +768,13 @@ class OSGUTIL_EXPORT Optimizer bool addSource(Source* source); void clampToNearestPowerOfTwoSize(); void copySources(); - + protected: virtual ~Atlas() {} }; - + typedef std::vector< osg::ref_ptr > AtlasList; - + Source* getSource(const osg::Image* image); Source* getSource(const osg::Texture2D* texture); @@ -791,8 +791,8 @@ class OSGUTIL_EXPORT Optimizer void completeRow(unsigned int indexAtlas); }; - - /** Optimize texture usage in the scene graph by combining textures into texture atlas + + /** Optimize texture usage in the scene graph by combining textures into texture atlas * Use of texture atlas cuts down on the number of seperate states in the scene, reducing * state changes and improving the chances of use larger batches of geomertry.*/ class OSGUTIL_EXPORT TextureAtlasVisitor : public BaseOptimizerVisitor @@ -806,7 +806,7 @@ class OSGUTIL_EXPORT Optimizer TextureAtlasBuilder& getTextureAtlasBuilder() { return _builder; } - /** empty visitor, make it ready for next traversal.*/ + /** empty visitor, make it ready for next traversal.*/ virtual void reset(); virtual void apply(osg::Node& node); @@ -850,7 +850,7 @@ class OSGUTIL_EXPORT Optimizer protected: void applyStateSet(osg::StateSet& stateset); - + void applyDrawable(osg::Drawable& drawable); }; @@ -858,22 +858,22 @@ class OSGUTIL_EXPORT Optimizer inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::StateSet* object) const { - return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; + return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; } inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::StateAttribute* object) const { - return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; + return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; } inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::Drawable* object) const { - return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; + return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; } inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::Node* object) const { - return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; + return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true; } } diff --git a/include/osgUtil/PerlinNoise b/include/osgUtil/PerlinNoise index 71e83f59f..056a77eb0 100644 --- a/include/osgUtil/PerlinNoise +++ b/include/osgUtil/PerlinNoise @@ -41,7 +41,7 @@ class OSGUTIL_EXPORT PerlinNoise public: PerlinNoise(); - + void SetNoiseFrequency(int frequency); double noise1(double arg); @@ -62,13 +62,13 @@ public: osg::Image* create3DNoiseImage(int texSize); osg::Texture3D* create3DNoiseTexture(int texSize ); - + protected: - + void initNoise(void); enum { MAXB = 0x100 }; - + int p[MAXB + MAXB + 2]; double g3[MAXB + MAXB + 2][3]; double g2[MAXB + MAXB + 2][2]; @@ -77,7 +77,7 @@ protected: int start; int B; int BM; - + }; inline osg::Image* create3DNoiseImage(int texSize) diff --git a/include/osgUtil/PositionalStateContainer b/include/osgUtil/PositionalStateContainer index e5256dfd6..a24497253 100644 --- a/include/osgUtil/PositionalStateContainer +++ b/include/osgUtil/PositionalStateContainer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ namespace osgUtil { class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object { public: - + PositionalStateContainer(); virtual osg::Object* cloneType() const { return new PositionalStateContainer(); } @@ -39,7 +39,7 @@ class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object virtual const char* className() const { return "PositionalStateContainer"; } virtual void reset(); - + typedef std::pair< osg::ref_ptr , osg::ref_ptr > AttrMatrixPair; typedef std::vector< AttrMatrixPair > AttrMatrixList; typedef std::map< unsigned int, AttrMatrixList > TexUnitAttrMatrixListMap; @@ -59,14 +59,14 @@ class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object } virtual void draw(osg::State& state,RenderLeaf*& previous, const osg::Matrix* postMultMatrix = 0); - + public: - + AttrMatrixList _attrList; TexUnitAttrMatrixListMap _texAttrListMap; - + protected: - + virtual ~PositionalStateContainer(); }; diff --git a/include/osgUtil/PrintVisitor b/include/osgUtil/PrintVisitor index ebd5831e8..81a9daf4b 100644 --- a/include/osgUtil/PrintVisitor +++ b/include/osgUtil/PrintVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -39,7 +39,7 @@ class OSGUTIL_EXPORT PrintVisitor : public osg::NodeVisitor void leave() { _indent -= _step; } protected: - + PrintVisitor& operator = (const PrintVisitor&) { return *this; } std::ostream& _out; diff --git a/include/osgUtil/ReflectionMapGenerator b/include/osgUtil/ReflectionMapGenerator index 2573701b1..593a28edf 100644 --- a/include/osgUtil/ReflectionMapGenerator +++ b/include/osgUtil/ReflectionMapGenerator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGUTIL_REFLECTIONMAPGENERATOR_ @@ -18,7 +18,7 @@ namespace osgUtil { - /** This is the most simple cube map generator. It performs a direct association + /** This is the most simple cube map generator. It performs a direct association between reflection vector and RGBA color (C = R). */ class ReflectionMapGenerator: public CubeMapGenerator { diff --git a/include/osgUtil/RenderBin b/include/osgUtil/RenderBin index 5d6181d6d..f19961c7e 100644 --- a/include/osgUtil/RenderBin +++ b/include/osgUtil/RenderBin @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,8 +25,8 @@ namespace osgUtil { class RenderStage; class Statistics; /** - * RenderBin base class. Renderbin contains geometries to be rendered as a group, - * renderbins are rendered once each. They can improve efficiency or + * RenderBin base class. Renderbin contains geometries to be rendered as a group, + * renderbins are rendered once each. They can improve efficiency or * use different rendering algorithms. * A renderBin can contain further renderBins producing a tree hierarchy of renderBins. */ @@ -34,9 +34,9 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object { public: - typedef std::vector RenderLeafList; + typedef std::vector RenderLeafList; typedef std::vector StateGraphList; - typedef std::map< int, osg::ref_ptr > RenderBinList; + typedef std::map< int, osg::ref_ptr > RenderBinList; enum SortMode { @@ -116,7 +116,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object virtual void sortBackToFront(); virtual void sortTraversalOrder(); - struct SortCallback : public osg::Referenced + struct SortCallback : public osg::Referenced { virtual void sortImplementation(RenderBin*) = 0; }; @@ -131,7 +131,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object virtual void drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous); - struct DrawCallback : public osg::Referenced + struct DrawCallback : public osg::Referenced { virtual void drawImplementation(RenderBin* bin,osg::RenderInfo& renderInfo,RenderLeaf*& previous) = 0; }; @@ -156,7 +156,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object protected: virtual ~RenderBin(); - + int _binNum; RenderBin* _parent; RenderStage* _stage; @@ -164,7 +164,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object StateGraphList _stateGraphList; RenderLeafList _renderLeafList; - bool _sorted; + bool _sorted; SortMode _sortMode; osg::ref_ptr _sortCallback; @@ -178,4 +178,4 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object #endif - + diff --git a/include/osgUtil/RenderLeaf b/include/osgUtil/RenderLeaf index 0a6f42841..b1d36fb03 100644 --- a/include/osgUtil/RenderLeaf +++ b/include/osgUtil/RenderLeaf @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,7 +33,7 @@ class StateGraph; class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced { public: - + inline RenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f, unsigned int traversalNumber=0): osg::Referenced(false), @@ -47,7 +47,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced _dynamic = (drawable->getDataVariance()==osg::Object::DYNAMIC); } - + inline void set(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f, unsigned int traversalNumber=0) { _parent = 0; @@ -58,7 +58,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced _dynamic = (drawable->getDataVariance()==osg::Object::DYNAMIC); _traversalNumber = traversalNumber; } - + inline void reset() { _parent = 0; @@ -69,16 +69,16 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced _dynamic = false; _traversalNumber = 0; } - + virtual void render(osg::RenderInfo& renderInfo,RenderLeaf* previous); - + /// Allow StateGraph to change the RenderLeaf's _parent. friend class osgUtil::StateGraph; public: - - - + + + StateGraph* _parent; #ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR @@ -87,7 +87,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced #else osg::Drawable* _drawable; const osg::Drawable* getDrawable() const { return _drawable; } -#endif +#endif osg::ref_ptr _projection; osg::ref_ptr _modelview; float _depth; diff --git a/include/osgUtil/RenderStage b/include/osgUtil/RenderStage index 2fd86c61a..96e538d88 100644 --- a/include/osgUtil/RenderStage +++ b/include/osgUtil/RenderStage @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,21 +37,21 @@ namespace osgUtil { class OSGUTIL_EXPORT RenderStage : public RenderBin { public: - + RenderStage(); RenderStage(SortMode mode); - + RenderStage(const RenderStage& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + virtual osg::Object* cloneType() const { return new RenderStage(); } virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RenderStage(*this,copyop); } // note only implements a clone of type. virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=0L; } virtual const char* className() const { return "RenderStage"; } virtual void reset(); - - + + /** Set the draw buffer used at the start of each frame draw. */ void setDrawBuffer(GLenum buffer, bool applyMask = true ) { _drawBuffer = buffer; setDrawBufferApplyMask( applyMask ); } @@ -87,10 +87,10 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin /** Get the viewport. */ osg::Viewport* getViewport() { return _viewport.get(); } - + /** Set the initial view matrix.*/ void setInitialViewMatrix(const osg::RefMatrix* matrix) { _initialViewMatrix = matrix; } - + /** Get the initial view matrix.*/ const osg::RefMatrix* getInitialViewMatrix() { return _initialViewMatrix.get(); } @@ -107,34 +107,34 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin const osg::ColorMask* getColorMask() const { return _colorMask.get(); } - /** Set the clear color used in glClearColor(..). + /** Set the clear color used in glClearColor(..). * glClearColor is only called if mask & GL_COLOR_BUFFER_BIT is true*/ void setClearColor(const osg::Vec4& color) { _clearColor=color; } - + /** Get the clear color.*/ const osg::Vec4& getClearColor() const { return _clearColor; } - - /** Set the clear accum used in glClearAccum(..). + + /** Set the clear accum used in glClearAccum(..). * glClearAcumm is only called if mask & GL_ACCUM_BUFFER_BIT is true. */ void setClearAccum(const osg::Vec4& color) { _clearAccum=color; } - + /** Get the clear accum.*/ const osg::Vec4& getClearAccum() const { return _clearAccum; } - + /** Set the clear depth used in glClearDepth(..). Defaults to 1.0 * glClearDepth is only called if mask & GL_DEPTH_BUFFER_BIT is true. */ void setClearDepth(double depth) { _clearDepth=depth; } - + /** Get the clear depth.*/ double getClearDepth() const { return _clearDepth; } /** Set the clear stencil value used in glClearStencil(). Defaults to 0; * glClearStencil is only called if mask & GL_STENCIL_BUFFER_BIT is true*/ void setClearStencil(int stencil) { _clearStencil=stencil; } - + /** Get the clear color.*/ int getClearStencil() const { return _clearStencil; } - + void setCamera(osg::Camera* camera) { if (_camera!=camera) { _camera = camera; _cameraRequiresSetUp = true; } } osg::Camera* getCamera() { return _camera; } @@ -142,16 +142,16 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin void setCameraRequiresSetUp(bool flag) { _cameraRequiresSetUp = flag; } bool getCameraRequiresSetUp() const { return _cameraRequiresSetUp; } - + /** Attempt the set the RenderStage from the Camera settings.*/ void runCameraSetUp(osg::RenderInfo& renderInfo); - + void setTexture(osg::Texture* texture, unsigned int level = 0, unsigned int face=0) { _texture = texture; _level = level; _face = face; } osg::Texture* getTexture() { return _texture.get(); } - + void setImage(osg::Image* image) { _image = image; } osg::Image* getImage() { return _image.get(); } - + void setImageReadPixelFormat(GLenum format) { _imageReadPixelFormat = format; } GLenum getImageReadPixelFormat() const { return _imageReadPixelFormat; } @@ -205,7 +205,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin { getPositionalStateContainer()->addPositionedAttribute(matrix,attr); } - + virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr) { getPositionalStateContainer()->addPositionedTextureAttribute(textureUnit, matrix,attr); @@ -214,13 +214,13 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin void copyTexture(osg::RenderInfo& renderInfo); virtual void sort(); - + virtual void drawPreRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous); virtual void draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous); virtual void drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, bool& doCopyTexture); - + virtual void drawPostRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous); virtual void drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous); @@ -229,12 +229,12 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin void addToDependencyList(RenderStage* rs) { addPreRenderStage(rs); } void addPreRenderStage(RenderStage* rs, int order = 0); - + void addPostRenderStage(RenderStage* rs, int order = 0); /** Extract stats for current draw list. */ - bool getStats(Statistics& stats) const; - + bool getStats(Statistics& stats) const; + /** Compute the number of dynamic RenderLeaves.*/ virtual unsigned int computeNumberOfDynamicRenderLeaves() const; @@ -275,7 +275,7 @@ protected: // viewport x,y,width,height. osg::ref_ptr _viewport; osg::ref_ptr _initialViewMatrix; - + GLenum _drawBuffer; bool _drawBufferApplyMask; GLenum _readBuffer; @@ -289,7 +289,7 @@ protected: bool _cameraRequiresSetUp; osg::Camera* _camera; - + osg::ref_ptr _texture; unsigned int _level; unsigned int _face; @@ -297,9 +297,9 @@ protected: osg::ref_ptr _image; GLenum _imageReadPixelFormat; GLenum _imageReadPixelDataType; - + std::map< osg::Camera::BufferComponent, Attachment> _bufferAttachmentMap; - + osg::ref_ptr _fbo; osg::ref_ptr _resolveFbo; osg::ref_ptr _graphicsContext; diff --git a/include/osgUtil/ReversePrimitiveFunctor b/include/osgUtil/ReversePrimitiveFunctor index cc65c68ae..a7f0978ad 100644 --- a/include/osgUtil/ReversePrimitiveFunctor +++ b/include/osgUtil/ReversePrimitiveFunctor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,34 +24,34 @@ namespace osgUtil { class OSGUTIL_EXPORT ReversePrimitiveFunctor : public osg::PrimitiveIndexFunctor { public: - + virtual ~ReversePrimitiveFunctor() {} - + osg::PrimitiveSet * getReversedPrimitiveSet() { return _reversedPrimitiveSet.get(); } - + virtual void setVertexArray(unsigned int , const osg::Vec2* ) {} virtual void setVertexArray(unsigned int , const osg::Vec3* ) {} virtual void setVertexArray(unsigned int , const osg::Vec4* ) {} virtual void setVertexArray(unsigned int , const osg::Vec2d* ) {} virtual void setVertexArray(unsigned int , const osg::Vec3d* ) {} virtual void setVertexArray(unsigned int , const osg::Vec4d* ) {} - + virtual void drawArrays(GLenum mode,GLint first,GLsizei count); virtual void drawElements(GLenum mode,GLsizei count, const GLubyte* indices); virtual void drawElements(GLenum mode,GLsizei count, const GLushort* indices); virtual void drawElements(GLenum mode,GLsizei count, const GLuint* indices); - - + + /// Mimics the OpenGL \c glBegin() function. virtual void begin(GLenum mode); virtual void vertex(unsigned int /*pos*/); virtual void end(); - - + + osg::ref_ptr _reversedPrimitiveSet; - + private: - + bool _running; }; diff --git a/include/osgUtil/SceneGraphBuilder b/include/osgUtil/SceneGraphBuilder index 2518ff53a..87b34f6ce 100644 --- a/include/osgUtil/SceneGraphBuilder +++ b/include/osgUtil/SceneGraphBuilder @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder SceneGraphBuilder(); - // + // // OpenGL 1.0 style building methods // void PushMatrix(); @@ -42,7 +42,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder void Translated(GLdouble x, GLdouble y, GLdouble z); void Scaled(GLdouble x, GLdouble y, GLdouble z); void Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); - + void BlendFunc(GLenum srcFactor, GLenum dstFactor); void CullFace(GLenum mode); void DepthFunc(GLenum mode); @@ -54,10 +54,10 @@ class OSGUTIL_EXPORT SceneGraphBuilder void PolygonOffset(GLfloat factor, GLfloat units); void PolygonStipple(const GLubyte* mask); void ShadeModel(GLenum mode); - + void Enable(GLenum mode); void Disable(GLenum mode); - + void Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); void Color4fv(GLfloat* c) { Color4f(c[0], c[1], c[2], c[3]); } @@ -120,27 +120,27 @@ class OSGUTIL_EXPORT SceneGraphBuilder osg::Node* takeScene(); protected: - + typedef std::vector Matrices; void matrixChanged(); void addAttribute(osg::StateAttribute* attribute); - void addMode(GLenum mode, bool enabled); + void addMode(GLenum mode, bool enabled); void addTextureAttribute(unsigned int unit, osg::StateAttribute* attribute); - void addTextureMode(unsigned int unit, GLenum mode, bool enabled); + void addTextureMode(unsigned int unit, GLenum mode, bool enabled); void addShape(osg::Shape* shape); void addDrawable(osg::Drawable* drawable); void newGeometry(); - + void allocateGeometry(); void completeGeometry(); - + void allocateStateSet(); - + Matrices _matrixStack; osg::ref_ptr _stateset; bool _statesetAssigned; - + bool _normalSet; osg::Vec3f _normal; @@ -155,7 +155,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder osg::ref_ptr _normals; osg::ref_ptr _colors; osg::ref_ptr _texCoords; - + struct QuadricState { QuadricState(): @@ -177,7 +177,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder osg::ref_ptr _geode; osg::ref_ptr _transform; osg::ref_ptr _group; - + }; diff --git a/include/osgUtil/SceneView b/include/osgUtil/SceneView index 26346b26d..90eecd90b 100644 --- a/include/osgUtil/SceneView +++ b/include/osgUtil/SceneView @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -51,7 +51,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings SKY_LIGHT = 0x2, COMPILE_GLOBJECTS_AT_INIT = 0x4, STANDARD_SETTINGS = HEADLIGHT | - COMPILE_GLOBJECTS_AT_INIT + COMPILE_GLOBJECTS_AT_INIT }; /* Set defaults. */ @@ -75,7 +75,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings * an osg::Scene but can be any osg::Node type. */ void setSceneData(osg::Node* node); - + /** Get the scene data to view. The data will typically be * an osg::Scene but can be any osg::Node type. */ @@ -85,7 +85,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings * an osg::Scene but can be any osg::Node type. */ const osg::Node* getSceneData(unsigned int childNo=0) const { return (_camera->getNumChildren()>childNo) ? _camera->getChild(childNo) : 0; } - + /** Get the number of scene data subgraphs added to the SceneView's camera.*/ unsigned int getNumSceneData() const { return _camera->getNumChildren(); } @@ -101,10 +101,10 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Get the const viewport. */ const osg::Viewport* getViewport() const { return (_camera->getViewport()!=0) ? _camera->getViewport() : 0; } - + /** Set the DisplaySettings. */ inline void setDisplaySettings(osg::DisplaySettings* vs) { _displaySettings = vs; } - + /** Get the const DisplaySettings */ inline const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); } @@ -118,12 +118,12 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Get the color used in glClearColor.*/ const osg::Vec4& getClearColor() const { return _camera->getClearColor(); } - - - /** Manually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/ + + + /** Manually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/ void setRedrawInterlacedStereoStencilMask(bool flag) { _redrawInterlacedStereoStencilMask = flag; } - /** Get the redraw interlaced stereo stencil mask request flag.*/ + /** Get the redraw interlaced stereo stencil mask request flag.*/ bool getRedrawInterlacedStereoStencilMask() const { return _redrawInterlacedStereoStencilMask; } @@ -138,7 +138,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings void setLocalStateSet(osg::StateSet* state) { _localStateSet = state; } osg::StateSet* getLocalStateSet() { return _localStateSet.get(); } const osg::StateSet* getLocalStateSet() const { return _localStateSet.get(); } - + enum ActiveUniforms { FRAME_NUMBER_UNIFORM = 1, @@ -158,14 +158,14 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings ALL_UNIFORMS = 0x7FFFFFFF }; - /** Set the uniforms that SceneView should set set up on each frame.*/ + /** Set the uniforms that SceneView should set set up on each frame.*/ void setActiveUniforms(int activeUniforms) { _activeUniforms = activeUniforms; } /** Get the uniforms that SceneView should set set up on each frame.*/ int getActiveUniforms() const { return _activeUniforms; } void updateUniforms(); - + typedef Options LightingMode; @@ -175,11 +175,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings void setLight(osg::Light* light) { _light = light; } osg::Light* getLight() { return _light.get(); } const osg::Light* getLight() const { return _light.get(); } - + void setState(osg::State* state) { _renderInfo.setState(state); } osg::State* getState() { return _renderInfo.getState(); } const osg::State* getState() const { return _renderInfo.getState(); } - + void setView(osg::View* view) { _camera->setView(view); } osg::View* getView() { return _camera->getView(); } const osg::View* getView() const { return _camera->getView(); } @@ -187,7 +187,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings void setRenderInfo(osg::RenderInfo& renderInfo) { _renderInfo = renderInfo; } osg::RenderInfo& getRenderInfo() { return _renderInfo; } const osg::RenderInfo& getRenderInfo() const { return _renderInfo; } - + /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ @@ -221,7 +221,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Get the const projection matrix.*/ const osg::Matrixd& getProjectionMatrix() const { return _camera->getProjectionMatrix(); } - /** Get the orthographic settings of the orthographic projection matrix. + /** Get the orthographic settings of the orthographic projection matrix. * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ bool getProjectionMatrixAsOrtho(double& left, double& right, double& bottom, double& top, @@ -234,7 +234,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings double& zNear, double& zFar) const; /** Get the frustum setting of a symmetric perspective projection matrix. - * Returns false if matrix is not a perspective matrix, where parameter values are undefined. + * Returns false if matrix is not a perspective matrix, where parameter values are undefined. * Note, if matrix is not a symmetric perspective matrix then the shear will be lost. * Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. * In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/ @@ -244,7 +244,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ inline void setViewMatrix(const osg::Matrixf& matrix) { _camera->setViewMatrix(matrix); } - + /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ inline void setViewMatrix(const osg::Matrixd& matrix) { _camera->setViewMatrix(matrix); } @@ -262,7 +262,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings - + void setInitVisitor(osg::NodeVisitor* av) { _initVisitor = av; } osg::NodeVisitor* getInitVisitor() { return _initVisitor.get(); } const osg::NodeVisitor* getInitVisitor() const { return _initVisitor.get(); } @@ -284,7 +284,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings void setCullVisitorRight(osgUtil::CullVisitor* cv) { _cullVisitorRight = cv; } osgUtil::CullVisitor* getCullVisitorRight() { return _cullVisitorRight.get(); } const osgUtil::CullVisitor* getCullVisitorRight() const { return _cullVisitorRight.get(); } - + void setCollectOccludersVisitor(osg::CollectOccludersVisitor* cov) { _collectOccludersVisitor = cov; } osg::CollectOccludersVisitor* getCollectOccludersVisitor() { return _collectOccludersVisitor.get(); } const osg::CollectOccludersVisitor* getCollectOccludersVisitor() const { return _collectOccludersVisitor.get(); } @@ -354,7 +354,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Set whether the draw method should call renderer->prioritizeTexture.*/ void setPrioritizeTextures(bool pt) { _prioritizeTextures = pt; } - + /** Get whether the draw method should call renderer->prioritizeTexture.*/ bool getPrioritizeTextures() const { return _prioritizeTextures; } @@ -367,7 +367,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings virtual osg::Matrixd computeRightEyeProjection(const osg::Matrixd& projection) const = 0; virtual osg::Matrixd computeRightEyeView(const osg::Matrixd& view) const = 0; }; - + void setComputeStereoMatricesCallback(ComputeStereoMatricesCallback* callback) { _computeStereoMatricesCallback=callback; } ComputeStereoMatricesCallback* getComputeStereoMatricesCallback() { return _computeStereoMatricesCallback.get(); } const ComputeStereoMatricesCallback* getComputeStereoMatricesCallback() const { return _computeStereoMatricesCallback.get(); } @@ -419,7 +419,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings if (_computeStereoMatricesCallback.valid()) return _computeStereoMatricesCallback->computeLeftEyeView(view); else return computeLeftEyeViewImplementation(view); } - + inline osg::Matrixd computeRightEyeProjection(const osg::Matrixd& projection) const { if (_computeStereoMatricesCallback.valid()) return _computeStereoMatricesCallback->computeRightEyeProjection(projection); @@ -462,10 +462,10 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Do draw traversal of draw bins generated by cull traversal.*/ virtual void draw(); - + /** Compute the number of dynamic objects that will be held in the rendering backend */ unsigned int getDynamicObjectCount() const { return _dynamicObjectCount; } - + /** Release all OpenGL objects from the scene graph, such as texture objects, display lists, etc. * These released scene graphs are placed in the respective delete GLObjects cache, and * then need to be deleted in OpenGL by SceneView::flushAllDeleteGLObjects(). */ @@ -476,7 +476,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Flush deleted OpenGL objects, such as texture objects, display lists, etc., within the specified available time.*/ virtual void flushDeletedGLObjects(double& availableTime); - + /** Extract stats for current draw list. */ bool getStats(Statistics& primStats); @@ -490,7 +490,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings /** Do cull traversal of attached scene graph using Cull NodeVisitor. Return true if computeNearFar has been done during the cull traversal.*/ virtual bool cullStage(const osg::Matrixd& projection,const osg::Matrixd& modelview,osgUtil::CullVisitor* cullVisitor, osgUtil::StateGraph* rendergraph, osgUtil::RenderStage* renderStage, osg::Viewport *viewport); - + void computeLeftEyeViewport(const osg::Viewport *viewport); void computeRightEyeViewport(const osg::Viewport *viewport); @@ -500,7 +500,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings osg::ref_ptr _localStateSet; osg::RenderInfo _renderInfo; - + bool _initCalled; osg::ref_ptr _initVisitor; osg::ref_ptr _updateVisitor; @@ -521,37 +521,37 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings osg::ref_ptr _viewportRight; osg::ref_ptr _collectOccludersVisitor; - + osg::ref_ptr _frameStamp; - + osg::observer_ptr _camera; osg::ref_ptr _cameraWithOwnership; - + osg::ref_ptr _globalStateSet; osg::ref_ptr _light; osg::ref_ptr _displaySettings; - + osg::ref_ptr _secondaryStateSet; FusionDistanceMode _fusionDistanceMode; float _fusionDistanceValue; LightingMode _lightingMode; - + bool _prioritizeTextures; - + bool _automaticFlush; bool _requiresFlush; - - int _activeUniforms; + + int _activeUniforms; double _previousFrameTime; double _previousSimulationTime; - + bool _redrawInterlacedStereoStencilMask; int _interlacedStereoStencilWidth; int _interlacedStereoStencilHeight; - unsigned int _dynamicObjectCount; + unsigned int _dynamicObjectCount; }; } diff --git a/include/osgUtil/ShaderGen b/include/osgUtil/ShaderGen index 29067bd02..9beb717c3 100644 --- a/include/osgUtil/ShaderGen +++ b/include/osgUtil/ShaderGen @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgUtil/Simplifier b/include/osgUtil/Simplifier index d1e58b081..05a555608 100644 --- a/include/osgUtil/Simplifier +++ b/include/osgUtil/Simplifier @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -50,7 +50,7 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor void setSmoothing(bool on) { _smoothing = on; } bool getSmoothing() const { return _smoothing; } - + class ContinueSimplificationCallback : public osg::Referenced { public: @@ -59,16 +59,16 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor { return simplifier.continueSimplificationImplementation(nextError, numOriginalPrimitives, numRemainingPrimitives); } - + protected: virtual ~ContinueSimplificationCallback() {} }; - + void setContinueSimplificationCallback(ContinueSimplificationCallback* cb) { _continueSimplificationCallback = cb; } ContinueSimplificationCallback* getContinueSimplificationCallback() { return _continueSimplificationCallback.get(); } const ContinueSimplificationCallback* getContinueSimplificationCallback() const { return _continueSimplificationCallback.get(); } - - + + bool continueSimplification(float nextError, unsigned int numOriginalPrimitives, unsigned int numRemainingPrimitives) const { if (_continueSimplificationCallback.valid()) return _continueSimplificationCallback->continueSimplification(*this, nextError, numOriginalPrimitives, numRemainingPrimitives); @@ -96,7 +96,7 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor /** simply the geometry.*/ void simplify(osg::Geometry& geometry); - + typedef std::vector IndexList; /// a list of point indices /** simply the geometry, whilst protecting key points from being modified.*/ @@ -104,15 +104,15 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor protected: - + double _sampleRatio; double _maximumError; double _maximumLength; bool _triStrip; bool _smoothing; - + osg::ref_ptr _continueSimplificationCallback; - + }; diff --git a/include/osgUtil/SmoothingVisitor b/include/osgUtil/SmoothingVisitor index b792b7964..7afeda8ca 100644 --- a/include/osgUtil/SmoothingVisitor +++ b/include/osgUtil/SmoothingVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,7 +32,7 @@ class OSGUTIL_EXPORT SmoothingVisitor : public osg::NodeVisitor /// default to traversing all children. SmoothingVisitor(); virtual ~SmoothingVisitor(); - + /// smooth geoset by creating per vertex normals. static void smooth(osg::Geometry& geoset, double creaseAngle=osg::PI); diff --git a/include/osgUtil/StateGraph b/include/osgUtil/StateGraph index df9454f73..da070c8de 100644 --- a/include/osgUtil/StateGraph +++ b/include/osgUtil/StateGraph @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -41,7 +41,7 @@ struct LessDepthSortFunctor class OSGUTIL_EXPORT StateGraph : public osg::Referenced { public: - + typedef std::map< const osg::StateSet*, osg::ref_ptr > ChildList; typedef std::vector< osg::ref_ptr > LeafList; @@ -57,10 +57,10 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced int _depth; ChildList _children; LeafList _leaves; - + mutable float _averageDistance; mutable float _minimumDistance; - + osg::ref_ptr _userData; bool _dynamic; @@ -88,15 +88,15 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced _dynamic(false) { if (_parent) _depth = _parent->_depth + 1; - + if (_parent && _parent->_dynamic) _dynamic = true; else _dynamic = stateset->getDataVariance()==osg::Object::DYNAMIC; } - + ~StateGraph() {} - + StateGraph* cloneType() const { return new StateGraph; } - + void setUserData(osg::Referenced* obj) { _userData = obj; } osg::Referenced* getUserData() { return _userData.get(); } const osg::Referenced* getUserData() const { return _userData.get(); } @@ -114,7 +114,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced { return _leaves.empty() && _children.empty(); } - + inline bool leaves_empty() const { return _leaves.empty(); @@ -133,11 +133,11 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced _averageDistance += (*itr)->_depth; } _averageDistance /= (float)_leaves.size(); - + } return _averageDistance; } - + inline float getMinimumDistance() const { if (_minimumDistance==FLT_MAX && !_leaves.empty()) @@ -151,7 +151,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced { if ((*itr)->_depth<_minimumDistance) _minimumDistance=(*itr)->_depth; } - + } return _minimumDistance; } @@ -170,14 +170,14 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced /** Recursively prune the StateGraph of empty children.*/ void prune(); - - + + inline StateGraph* find_or_insert(const osg::StateSet* stateset) { // search for the appropriate state group, return it if found. ChildList::iterator itr = _children.find(stateset); if (itr!=_children.end()) return itr->second.get(); - + // create a state group and insert it into the children list // then return the state group. StateGraph* sg = new StateGraph(this,stateset); @@ -209,7 +209,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced std::vector return_path; // need to pop back root render graph. - do + do { return_path.push_back(sg_new); sg_new = sg_new->_parent; @@ -224,20 +224,20 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced } return; } - + // first handle the typical case which is two state groups // are neighbours. if (sg_curr->_parent==sg_new->_parent) { - + // state has changed so need to pop old state. if (sg_curr->getStateSet()) state.popStateSet(); // and push new state. if (sg_new->getStateSet()) state.pushStateSet(sg_new->getStateSet()); return; } - + // need to pop back up to the same depth as the new state group. while (sg_curr->_depth>sg_new->_depth) @@ -245,7 +245,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced if (sg_curr->getStateSet()) state.popStateSet(); sg_curr = sg_curr->_parent; } - + // use return path to trace back steps to sg_new. std::vector return_path; @@ -255,7 +255,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced return_path.push_back(sg_new); sg_new = sg_new->_parent; } - + // now pop back up both parent paths until they agree. // DRT - 10/22/02 @@ -269,7 +269,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced return_path.push_back(sg_new); sg_new = sg_new->_parent; } - + for(std::vector::reverse_iterator itr=return_path.rbegin(); itr!=return_path.rend(); ++itr) @@ -288,9 +288,9 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced if (sg_curr->getStateSet()) state.popStateSet(); sg_curr = sg_curr->_parent; } - + } - + inline static int numToPop(StateGraph* sg_curr) { int numToPop = 0; @@ -300,7 +300,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced if (sg_curr->getStateSet()) ++numToPop; sg_curr = sg_curr->_parent; } - + return numToPop; } diff --git a/include/osgUtil/TangentSpaceGenerator b/include/osgUtil/TangentSpaceGenerator index 20ccdce33..67b3fb9b5 100644 --- a/include/osgUtil/TangentSpaceGenerator +++ b/include/osgUtil/TangentSpaceGenerator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgUtil/Tessellator b/include/osgUtil/Tessellator index bcac405b8..2b004269d 100644 --- a/include/osgUtil/Tessellator +++ b/include/osgUtil/Tessellator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ namespace osgUtil { class OSGUTIL_EXPORT Tessellator : public osg::Referenced { public: - + Tessellator(); ~Tessellator(); @@ -71,7 +71,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced /** Change the contours lists of the geometry into tessellated primitives (the * list of primitives in the original geometry is stored in the Tessellator for - * possible re-use. + * possible re-use. * The name remains retessellatePolygons although it now handles trifans, strips, quads etc. * as well as Polygons so as to not break old codes relying on this function name. */ void retessellatePolygons(osg::Geometry &cxgeom); @@ -79,7 +79,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced /** Define the normal to the tessellated polygon - this provides a hint how to * tessellate the contours; see gluTessNormal in red book or man pages. * GWM July 2005. Can improve teselation - * "For example, if you know that all polygons lie in the x-y plane, + * "For example, if you know that all polygons lie in the x-y plane, * call gluTessNormal(tess, 0.0, 0.0, 1.0) before rendering any polygons." */ void setTessellationNormal(const osg::Vec3 norm) { tessNormal=norm;} @@ -89,15 +89,15 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced struct Prim : public osg::Referenced { Prim(GLenum mode):_mode(mode) {} - + typedef std::vector VecList; GLenum _mode; VecList _vertices; }; - + virtual void beginTessellation(); - + void beginContour(); /** Add a vertex to the current contour, see gluTessVertex for details. @@ -112,11 +112,11 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced void endTessellation(); typedef std::vector< osg::ref_ptr > PrimList; - - PrimList& getPrimList() { return _primList; } - + + PrimList& getPrimList() { return _primList; } + void reset(); - + protected: /** remove unused parts of the array, eg for when retessellating @@ -125,7 +125,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced void reduceArray(osg::Array * cold, const unsigned int nnu); void collectTessellation(osg::Geometry &cxgeom, unsigned int originalIndex); - + typedef std::map VertexPtrToIndexMap; void addContour(GLenum mode, unsigned int first, unsigned int last, osg::Vec3Array* vertices); void addContour(osg::PrimitiveSet* primitive, osg::Vec3Array* vertices); @@ -137,7 +137,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced void end(); void error(GLenum errorCode); - + static void CALLBACK beginCallback(GLenum which, void* userData); static void CALLBACK vertexCallback(GLvoid *data, void* userData); static void CALLBACK combineCallback(GLdouble coords[3], void* vertex_data[4], @@ -145,8 +145,8 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced void* useData); static void CALLBACK endCallback(void* userData); static void CALLBACK errorCallback(GLenum errorCode, void* userData); - - + + struct Vec3d { double _v[3]; @@ -155,7 +155,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced struct NewVertex { - + NewVertex(): _vpos(0), _f1(0), @@ -166,7 +166,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced _v3(0), _f4(0), _v4(0) {} - + NewVertex(const NewVertex& nv): _vpos(nv._vpos), _f1(nv._f1), @@ -194,7 +194,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced _v4(v4) {} osg::Vec3 *_vpos; // added gwm Jan 2004 the vertex coords s.t. NewVertex can be used in a std::vector - + float _f1; osg::Vec3* _v1; @@ -206,11 +206,11 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced float _f4; osg::Vec3* _v4; - + }; - + //change NewVertexList from std::map NewVertexList; - // because this has undefined order of insertion for new vertices. + // because this has undefined order of insertion for new vertices. // which occasionally corrupted the texture mapping. typedef std::vector NewVertexList; typedef std::vector Vec3dList; @@ -223,7 +223,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced GLenum _errorCode; /** winding rule, which parts will become solid */ - WindingType _wtype; + WindingType _wtype; /** tessellation rule, which parts will become solid */ TessellationType _ttype; diff --git a/include/osgUtil/TransformAttributeFunctor b/include/osgUtil/TransformAttributeFunctor index 0c04ad87f..fcb165898 100644 --- a/include/osgUtil/TransformAttributeFunctor +++ b/include/osgUtil/TransformAttributeFunctor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,10 +26,10 @@ namespace osgUtil { class OSGUTIL_EXPORT TransformAttributeFunctor : public osg::Drawable::AttributeFunctor { public: - + /** Construct a functor to transform a drawable's vertex and normal attributes by specified matrix.*/ TransformAttributeFunctor(const osg::Matrix& m); - + virtual ~TransformAttributeFunctor(); /** Do the work of transforming vertex and normal attributes. */ diff --git a/include/osgUtil/TransformCallback b/include/osgUtil/TransformCallback index c416fdab9..9ae5616be 100644 --- a/include/osgUtil/TransformCallback +++ b/include/osgUtil/TransformCallback @@ -1,16 +1,16 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ -//C++ header +//C++ header #ifndef OSGUTIL_TRANSFORMCALLBACK #define OSGUTIL_TRANSFORMCALLBACK 1 @@ -35,7 +35,7 @@ class OSGUTIL_EXPORT TransformCallback : public osg::NodeCallback virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); protected: - + float _angular_velocity; osg::Vec3 _pivot; osg::Vec3 _axis; diff --git a/include/osgUtil/TriStripVisitor b/include/osgUtil/TriStripVisitor index 9ace77dd1..c3048477f 100644 --- a/include/osgUtil/TriStripVisitor +++ b/include/osgUtil/TriStripVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,8 +32,8 @@ class OSGUTIL_EXPORT TriStripVisitor : public BaseOptimizerVisitor public: /// default to traversing all children. - TriStripVisitor(Optimizer* optimizer=0) : - BaseOptimizerVisitor( optimizer, Optimizer::TRISTRIP_GEOMETRY), + TriStripVisitor(Optimizer* optimizer=0) : + BaseOptimizerVisitor( optimizer, Optimizer::TRISTRIP_GEOMETRY), _cacheSize( 16 ), _minStripSize( 2 ), _generateFourPointPrimitivesQuads ( false) @@ -55,29 +55,29 @@ class OSGUTIL_EXPORT TriStripVisitor : public BaseOptimizerVisitor { _cacheSize = size; } - + inline unsigned int getCacheSize() const { return _cacheSize; } - + inline void setMinStripSize( unsigned int size ) { _minStripSize = size; } - + inline unsigned int getMinStripSize() const { return _minStripSize; } - - + + void setGenerateFourPointPrimitivesQuads(bool flag) { _generateFourPointPrimitivesQuads = flag; } bool getGenerateFourPointPrimitivesQuads() const { return _generateFourPointPrimitivesQuads; } - + private: - + typedef std::set GeometryList; unsigned int _cacheSize; diff --git a/include/osgUtil/UpdateVisitor b/include/osgUtil/UpdateVisitor index eb2cffd18..5d60fcf4c 100644 --- a/include/osgUtil/UpdateVisitor +++ b/include/osgUtil/UpdateVisitor @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,7 +32,7 @@ namespace osgUtil { /** * Basic UpdateVisitor implementation for animating a scene. * This visitor traverses the scene graph, calling each nodes appCallback if - * it exists. + * it exists. */ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor { @@ -47,12 +47,12 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor /** During traversal each type of node calls its callbacks and its children traversed. */ virtual void apply(osg::Node& node) { handle_callbacks_and_traverse(node); } - + virtual void apply(osg::Geode& node) { handle_geode_callbacks(node); } virtual void apply(osg::Billboard& node) { handle_geode_callbacks(node); } - + virtual void apply(osg::LightSource& node) { handle_callbacks_and_traverse(node); } - + virtual void apply(osg::Group& node) { handle_callbacks_and_traverse(node); } virtual void apply(osg::Transform& node) { handle_callbacks_and_traverse(node); } virtual void apply(osg::Projection& node) { handle_callbacks_and_traverse(node); } @@ -68,7 +68,7 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor /** Prevent unwanted copy operator.*/ UpdateVisitor& operator = (const UpdateVisitor&) { return *this; } - + inline void handle_callbacks(osg::StateSet* stateset) { if (stateset && stateset->requiresUpdateTraversal()) @@ -76,7 +76,7 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor stateset->runUpdateCallbacks(this); } } - + inline void handle_callbacks_and_traverse(osg::Node& node) { handle_callbacks(node.getStateSet()); @@ -98,14 +98,14 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor { osg::Drawable::UpdateCallback* callback = geode.getDrawable(i)->getUpdateCallback(); if (callback) callback->update(this,geode.getDrawable(i)); - + handle_callbacks(geode.getDrawable(i)->getStateSet()); } - + // should we traverse just in case a subclass of Geode adds children?? Won't for now as // Geode's arn't designed to have children. // traverse(geode); - } + } }; } diff --git a/include/osgUtil/Version b/include/osgUtil/Version index 9d924bc0c..decf5bef0 100644 --- a/include/osgUtil/Version +++ b/include/osgUtil/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgViewer/CompositeViewer b/include/osgViewer/CompositeViewer index 2f0978ca7..e9cc6f6fc 100644 --- a/include/osgViewer/CompositeViewer +++ b/include/osgViewer/CompositeViewer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgViewer/Export b/include/osgViewer/Export index 494c8073a..3ae30ba84 100644 --- a/include/osgViewer/Export +++ b/include/osgViewer/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,8 +37,8 @@ # define OSGVIEWER_EXPORT __declspec(dllimport) #endif #else - #define OSGVIEWER_EXPORT -#endif + #define OSGVIEWER_EXPORT +#endif #endif @@ -47,7 +47,7 @@ \namespace osgViewer -The osgViewer library provides high level viewer functionality designed to make it easier to write a range of different types of viewers, +The osgViewer library provides high level viewer functionality designed to make it easier to write a range of different types of viewers, from viewers embedded in existing windows via SimpleViewer, through to highly scalable and flexible Viewer and Composite classes. A set of event handlers add functionality to these viewers so that you can rapidly compose the viewer functionality tailored to your needs. Finally the viewer classes can be adapted to work with a range of different window toolkit API's via GraphicsWindow implementations, diff --git a/include/osgViewer/Renderer b/include/osgViewer/Renderer index d423fa30a..46b75846e 100644 --- a/include/osgViewer/Renderer +++ b/include/osgViewer/Renderer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ class OSGVIEWER_EXPORT OpenGLQuerySupport : public osg::Referenced virtual void checkQuery(osg::Stats* stats, osg::State* state, osg::Timer_t startTick) = 0; - + virtual void beginQuery(unsigned int frameNumber, osg::State* state) = 0; virtual void endQuery(osg::State* state) = 0; virtual void initialize(osg::State* state, osg::Timer_t startTick); @@ -59,16 +59,16 @@ class OSGVIEWER_EXPORT Renderer : public osg::GraphicsOperation virtual void cull_draw(); virtual void compile(); - + void setCompileOnNextDraw(bool flag) { _compileOnNextDraw = flag; } bool getCompileOnNextDraw() const { return _compileOnNextDraw; } virtual void operator () (osg::Object* object); - + virtual void operator () (osg::GraphicsContext* context); virtual void release(); - + /** Force update of state associated with cameras. */ void setCameraRequiresSetUp(bool flag); bool getCameraRequiresSetUp() const; @@ -77,14 +77,14 @@ class OSGVIEWER_EXPORT Renderer : public osg::GraphicsOperation void initialize(osg::State* state); virtual ~Renderer(); - virtual void updateSceneView(osgUtil::SceneView* sceneView); + virtual void updateSceneView(osgUtil::SceneView* sceneView); osg::observer_ptr _camera; - + bool _done; bool _graphicsThreadDoesCull; bool _compileOnNextDraw; - + osg::ref_ptr _sceneView[2]; struct OSGVIEWER_EXPORT ThreadSafeQueue @@ -94,7 +94,7 @@ class OSGVIEWER_EXPORT Renderer : public osg::GraphicsOperation typedef std::list SceneViewList; SceneViewList _queue; bool _isReleased; - + ThreadSafeQueue(); ~ThreadSafeQueue(); diff --git a/include/osgViewer/Scene b/include/osgViewer/Scene index ad4cf3c8a..d6f4cba6a 100644 --- a/include/osgViewer/Scene +++ b/include/osgViewer/Scene @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -60,9 +60,9 @@ class OSGVIEWER_EXPORT Scene : public osg::Referenced /** Get the Scene object that has the specified node assigned to it. * or return a new Scene if no Scene has yet been assigned the specified node.*/ static Scene* getOrCreateScene(osg::Node* node); - + friend class View; - + osg::ref_ptr _sceneData; osg::ref_ptr _databasePager; diff --git a/include/osgViewer/Version b/include/osgViewer/Version index f64dcb81d..983296ee7 100644 --- a/include/osgViewer/Version +++ b/include/osgViewer/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgViewer/View b/include/osgViewer/View index 67d575b85..1c52f8cf9 100644 --- a/include/osgViewer/View +++ b/include/osgViewer/View @@ -49,7 +49,7 @@ struct OSGVIEWER_EXPORT DepthPartitionSettings : public osg::Referenced double _zFar; }; - + /** View holds a single view on a scene, this view may be composed of one or more slave cameras.*/ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter { diff --git a/include/osgViewer/Viewer b/include/osgViewer/Viewer index 998e24921..83eb68eb3 100644 --- a/include/osgViewer/Viewer +++ b/include/osgViewer/Viewer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -54,7 +54,7 @@ class OSGVIEWER_EXPORT Viewer : public ViewerBase, public osgViewer::View /** read the viewer configuration from a configuration file.*/ virtual bool readConfiguration(const std::string& filename); - + /** Get whether at least of one of this viewers windows are realized.*/ virtual bool isRealized() const; @@ -114,13 +114,13 @@ class OSGVIEWER_EXPORT Viewer : public ViewerBase, public osgViewer::View protected: - + void constructorInit(); - + virtual void viewerInit() { init(); } osg::observer_ptr _cameraWithFocus; - + }; diff --git a/include/osgViewer/ViewerBase b/include/osgViewer/ViewerBase index 4f631380e..966d31fc7 100644 --- a/include/osgViewer/ViewerBase +++ b/include/osgViewer/ViewerBase @@ -106,13 +106,13 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object /** Get the end barrier position.*/ BarrierPosition getEndBarrierPosition() const { return _endBarrierPosition; } - + /** Set the end barrier operation. \c op may be one of GL_FLUSH, GL_FINISH, * or NO_OPERATION. NO_OPERATION is the default. Per BarrierOperation::operator()(), * a glFlush() command, glFinish() command, or no additional OpenGL command will be * issued before entering the end barrier. */ void setEndBarrierOperation(osg::BarrierOperation::PreBlockOp op); - + /** Get the end barrier operation. */ osg::BarrierOperation::PreBlockOp getEndBarrierOperation() const { return _endBarrierOperation; } diff --git a/include/osgViewer/ViewerEventHandlers b/include/osgViewer/ViewerEventHandlers index 51ffd9d64..023a9f838 100644 --- a/include/osgViewer/ViewerEventHandlers +++ b/include/osgViewer/ViewerEventHandlers @@ -108,25 +108,25 @@ class OSGVIEWER_EXPORT StatsHandler : public osgGA::GUIEventHandler /** Get the keyboard and mouse usage of this manipulator.*/ virtual void getUsage(osg::ApplicationUsage& usage) const; - /** This allows the user to register additional stats lines that will + /** This allows the user to register additional stats lines that will be added to the graph. The stats for these will be gotten from the - viewer (viewer->getViewerStats()). The stats can be displayed in + viewer (viewer->getViewerStats()). The stats can be displayed in either or all of the following ways: - A numeric time beside the stat name - Requires that an elapsed time be recorded in the viewer's stats + Requires that an elapsed time be recorded in the viewer's stats for the "timeTakenName". - A bar in the top bar graph - Requires that two times (relative to the viewer's start tick) be - recorded in the viewer's stats for the "beginTimeName" and + Requires that two times (relative to the viewer's start tick) be + recorded in the viewer's stats for the "beginTimeName" and "endTimeName". - A line in the bottom graph - Requires that an elapsed time be recorded in the viewer's stats + Requires that an elapsed time be recorded in the viewer's stats for the "timeTakenName" and that the value be used as an average. - If you don't want a numeric value and a line in the bottom line - graph for your value, pass the empty string for timeTakenName. If - you don't want a bar in the graph, pass the empty string for + If you don't want a numeric value and a line in the bottom line + graph for your value, pass the empty string for timeTakenName. If + you don't want a bar in the graph, pass the empty string for beginTimeName and endTimeName. @param label The label to be displayed to identify the line in the stats. @@ -140,8 +140,8 @@ class OSGVIEWER_EXPORT StatsHandler : public osgGA::GUIEventHandler @param endTimeName The name to be queried in the viewer stats for the end time for the top bar graph. @param maxValue The value to use as maximum in the bottom line graph. Stats will be clamped between 0 and that value, and it will be the highest visible value in the graph. */ - void addUserStatsLine(const std::string& label, const osg::Vec4& textColor, const osg::Vec4& barColor, - const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, + void addUserStatsLine(const std::string& label, const osg::Vec4& textColor, const osg::Vec4& barColor, + const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, const std::string& beginTimeName, const std::string& endTimeName, float maxValue); void removeUserStatsLine(const std::string& label); @@ -159,9 +159,9 @@ protected: osg::Geometry* createTick(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numTicks); - void createTimeStatsLine(const std::string& lineLabel, osg::Vec3 pos, - const osg::Vec4& textColor, const osg::Vec4& barColor, osg::Stats* viewerStats, osg::Stats* stats, - const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, + void createTimeStatsLine(const std::string& lineLabel, osg::Vec3 pos, + const osg::Vec4& textColor, const osg::Vec4& barColor, osg::Stats* viewerStats, osg::Stats* stats, + const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, const std::string& beginTimeName, const std::string& endTimeName); void createCameraTimeStats(osg::Vec3& pos, bool acquireGPUStats, osg::Stats* viewerStats, osg::Camera* camera); @@ -215,11 +215,11 @@ protected: std::string endTimeName; float maxValue; - UserStatsLine(const std::string& label_, const osg::Vec4& textColor_, const osg::Vec4& barColor_, - const std::string& timeTakenName_, float multiplier_, bool average_, bool averageInInverseSpace_, + UserStatsLine(const std::string& label_, const osg::Vec4& textColor_, const osg::Vec4& barColor_, + const std::string& timeTakenName_, float multiplier_, bool average_, bool averageInInverseSpace_, const std::string& beginTimeName_, const std::string& endTimeName_, float maxValue_) - : label(label_), textColor(textColor_), barColor(barColor_), - timeTakenName(timeTakenName_), multiplier(multiplier_), average(average_), averageInInverseSpace(averageInInverseSpace_), + : label(label_), textColor(textColor_), barColor(barColor_), + timeTakenName(timeTakenName_), multiplier(multiplier_), average(average_), averageInInverseSpace(averageInInverseSpace_), beginTimeName(beginTimeName_), endTimeName(endTimeName_), maxValue(maxValue_) { } diff --git a/include/osgVolume/Export b/include/osgVolume/Export index bdb75a79e..660ed86c5 100644 --- a/include/osgVolume/Export +++ b/include/osgVolume/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,7 +37,7 @@ # endif #else # define OSGVOLUME_EXPORT -#endif +#endif /** diff --git a/include/osgVolume/FixedFunctionTechnique b/include/osgVolume/FixedFunctionTechnique index 5e1c77e4b..1a7d1455e 100644 --- a/include/osgVolume/FixedFunctionTechnique +++ b/include/osgVolume/FixedFunctionTechnique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ class OSGVOLUME_EXPORT FixedFunctionTechnique : public VolumeTechnique /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ FixedFunctionTechnique(const FixedFunctionTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgVolume, FixedFunctionTechnique); virtual void init(); @@ -34,11 +34,11 @@ class OSGVOLUME_EXPORT FixedFunctionTechnique : public VolumeTechnique virtual void update(osgUtil::UpdateVisitor* nv); virtual void cull(osgUtil::CullVisitor* nv); - + void setNumSlices(unsigned int numSlices); unsigned int getNumSlices() const { return _numSlices; } - + /** Clean scene graph from any terrain technique specific nodes.*/ virtual void cleanSceneGraph(); @@ -47,11 +47,11 @@ class OSGVOLUME_EXPORT FixedFunctionTechnique : public VolumeTechnique virtual void traverse(osg::NodeVisitor& nv); protected: - + virtual ~FixedFunctionTechnique(); - + osg::ref_ptr _node; - + unsigned int _numSlices; }; diff --git a/include/osgVolume/Layer b/include/osgVolume/Layer index cc9a04e64..c3fd08d4a 100644 --- a/include/osgVolume/Layer +++ b/include/osgVolume/Layer @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgVolume/Locator b/include/osgVolume/Locator index 87d546440..2b5a2b61f 100644 --- a/include/osgVolume/Locator +++ b/include/osgVolume/Locator @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ namespace osgVolume { class OSGVOLUME_EXPORT Locator : public osg::Object { public: - + Locator() {} Locator(const osg::Matrixd& transform) { setTransform(transform); } @@ -35,7 +35,7 @@ class OSGVOLUME_EXPORT Locator : public osg::Object Locator(const Locator& locator,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): osg::Object(locator, copyop), _transform(locator._transform) {} - + META_Object(osgVolume, Locator); /** Set the transformation from local coordinates to model coordinates.*/ @@ -52,7 +52,7 @@ class OSGVOLUME_EXPORT Locator : public osg::Object virtual bool convertModelToLocal(const osg::Vec3d& /*world*/, osg::Vec3d& /*local*/) const; - static bool convertLocalCoordBetween(const Locator& source, const osg::Vec3d& sourceNDC, + static bool convertLocalCoordBetween(const Locator& source, const osg::Vec3d& sourceNDC, const Locator& destination, osg::Vec3d& destinationNDC) { osg::Vec3d model; @@ -60,7 +60,7 @@ class OSGVOLUME_EXPORT Locator : public osg::Object if (!destination.convertModelToLocal(model, destinationNDC)) return false; return true; } - + bool computeLocalBounds(osg::Vec3d& bottomLeft, osg::Vec3d& topRight) const; bool computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::Vec3d& topRight) const; diff --git a/include/osgVolume/RayTracedTechnique b/include/osgVolume/RayTracedTechnique index fa2a42848..5491aa03d 100644 --- a/include/osgVolume/RayTracedTechnique +++ b/include/osgVolume/RayTracedTechnique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,7 +26,7 @@ class OSGVOLUME_EXPORT RayTracedTechnique : public VolumeTechnique RayTracedTechnique(); RayTracedTechnique(const RayTracedTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgVolume, RayTracedTechnique); virtual void init(); @@ -42,7 +42,7 @@ class OSGVOLUME_EXPORT RayTracedTechnique : public VolumeTechnique virtual void traverse(osg::NodeVisitor& nv); protected: - + virtual ~RayTracedTechnique(); osg::ref_ptr _transform; diff --git a/include/osgVolume/Version b/include/osgVolume/Version index ab10b9718..e047bd158 100644 --- a/include/osgVolume/Version +++ b/include/osgVolume/Version @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgVolume/Volume b/include/osgVolume/Volume index f578e2399..7dc5d7819 100644 --- a/include/osgVolume/Volume +++ b/include/osgVolume/Volume @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,27 +28,27 @@ class OSGVOLUME_EXPORT Volume : public osg::Group public: Volume(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ Volume(const Volume&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); META_Node(osgVolume, Volume); virtual void traverse(osg::NodeVisitor& nv); - + /** Get the VolumeTile for a given VolumeTileID.*/ VolumeTile* getVolumeTile(const TileID& tileID); /** Get the const VolumeTile for a given VolumeTileID.*/ const VolumeTile* getVolumeTile(const TileID& tileID) const; - + /** Set the VolumeTechnique prototype that nested VolumeTile should clone if they haven't already been assigned a volume rendering technique. */ void setVolumeTechniquePrototype(VolumeTechnique* volumeTechnique) { _volumeTechnique = volumeTechnique; } /** Get the VolumeTechnique prototype. */ VolumeTechnique* getVolumeTechniquePrototype() { return _volumeTechnique.get(); } - + /** Get the const VolumeTechnique prototype. */ const VolumeTechnique* getVolumeTechniquePrototype() const { return _volumeTechnique.get(); } @@ -56,9 +56,9 @@ class OSGVOLUME_EXPORT Volume : public osg::Group protected: virtual ~Volume(); - + friend class VolumeTile; - + void dirtyRegisteredVolumeTiles(); void registerVolumeTile(VolumeTile* tile); @@ -70,7 +70,7 @@ class OSGVOLUME_EXPORT Volume : public osg::Group mutable OpenThreads::Mutex _mutex; VolumeTileSet _volumeTileSet; VolumeTileMap _volumeTileMap; - + osg::ref_ptr _volumeTechnique; }; diff --git a/include/osgVolume/VolumeTechnique b/include/osgVolume/VolumeTechnique index 640e2e961..814ae7abe 100644 --- a/include/osgVolume/VolumeTechnique +++ b/include/osgVolume/VolumeTechnique @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,7 +33,7 @@ class OSGVOLUME_EXPORT VolumeTechnique : public osg::Object /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ VolumeTechnique(const VolumeTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(osgVolume, VolumeTechnique); VolumeTile* getVolumeTile() { return _volumeTile; } @@ -52,11 +52,11 @@ class OSGVOLUME_EXPORT VolumeTechnique : public osg::Object virtual void traverse(osg::NodeVisitor& nv); protected: - + void setDirty(bool dirty); virtual ~VolumeTechnique(); - + friend class osgVolume::VolumeTile; VolumeTile* _volumeTile; diff --git a/include/osgVolume/VolumeTile b/include/osgVolume/VolumeTile index 88666d211..b2e8f4099 100644 --- a/include/osgVolume/VolumeTile +++ b/include/osgVolume/VolumeTile @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,17 +29,17 @@ class Volume; class OSGVOLUME_EXPORT TileID { public: - + TileID(); TileID(int in_level, int in_x, int in_y, int in_z); - - bool operator == (const TileID& rhs) const + + bool operator == (const TileID& rhs) const { return (level==rhs.level) && (x==rhs.x) && (y==rhs.y) && (z==rhs.z); } - bool operator != (const TileID& rhs) const + bool operator != (const TileID& rhs) const { return (level!=rhs.level) || (x!=rhs.x) || (y!=rhs.y) || (z!=rhs.z); } @@ -54,7 +54,7 @@ class OSGVOLUME_EXPORT TileID if (y>rhs.y) return false; return z=0; } int level; @@ -71,7 +71,7 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group public: VolumeTile(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ VolumeTile(const VolumeTile&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); @@ -92,16 +92,16 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group /** Get the const Volume that this Volume tile is a member of.*/ const Volume* getVolume() const { return _volume; } - + /** Set the TileID (layer, x,y,z) of the VolumeTile. - * The TileID is used so it can be located by its neighbours + * The TileID is used so it can be located by its neighbours * via the enclosing Volume node that manages a map of TileID to VolumeTiles.*/ void setTileID(const TileID& tileID); - + /** Get the TileID (layer, x,y,z) of the VolumeTile.*/ const TileID& getTileID() const { return _tileID; } - - + + void setLocator(Locator* locator) { _locator = locator; } Locator* getLocator() { return _locator.get(); } const Locator* getLocator() const { return _locator.get(); } @@ -118,7 +118,7 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group /** Get the VolumeTechnique that will be used to render this tile. */ VolumeTechnique* getVolumeTechnique() { return _volumeTechnique.get(); } - + /** Get the const VolumeTechnique that will be used to render this tile. */ const VolumeTechnique* getVolumeTechnique() const { return _volumeTechnique.get(); } @@ -139,15 +139,15 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group friend class Volume; Volume* _volume; - + bool _dirty; bool _hasBeenTraversal; - + TileID _tileID; osg::ref_ptr _volumeTechnique; - osg::ref_ptr _locator; + osg::ref_ptr _locator; osg::ref_ptr _layer; }; diff --git a/include/osgWidget/Box b/include/osgWidget/Box index 553a98a69..ffbcf8446 100644 --- a/include/osgWidget/Box +++ b/include/osgWidget/Box @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,7 +23,7 @@ namespace osgWidget { //! The Box object is a Window subclass that can be configured to uniformly (or //! non-uniformly) position it's children either vertically or horizontally. It //! is the most basic Window implementation, though there is some difficulty when -//! positioning children such that each child object ends up pixel-aligned. +//! positioning children such that each child object ends up pixel-aligned. class OSGWIDGET_EXPORT Box: public Window { public: @@ -35,7 +35,7 @@ class OSGWIDGET_EXPORT Box: public Window }; META_Object(osgWidget, Box); - + //! The main constructor; takes the string name, the BoxType orientation, and a //! boolean indicating whether or not all of the Box regions should be uniformly //! sized. diff --git a/include/osgWidget/Browser b/include/osgWidget/Browser index 7f747db58..d40bed9c1 100644 --- a/include/osgWidget/Browser +++ b/include/osgWidget/Browser @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,24 +24,24 @@ class BrowserImage; class OSGWIDGET_EXPORT BrowserManager : public osg::Object { public: - + static osg::ref_ptr& instance(); - + virtual void init(const std::string& application); void setApplication(const std::string& application) { _application = application; } const std::string& getApplication() const { return _application; } virtual BrowserImage* createBrowserImage(const std::string& url, int width, int height); - + protected: BrowserManager(); BrowserManager(const BrowserManager& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): osg::Object(rhs,copyop) {} - + virtual ~BrowserManager(); - + META_Object(osgWidget,BrowserManager); std::string _application; @@ -53,15 +53,15 @@ class OSGWIDGET_EXPORT BrowserManager : public osg::Object class BrowserImage : public osg::Image { public: - + BrowserImage() {} - + virtual void navigateTo(const std::string& url) = 0; protected: - + virtual ~BrowserImage() {} - + }; @@ -69,11 +69,11 @@ class BrowserImage : public osg::Image class OSGWIDGET_EXPORT Browser : public osg::Geode { public: - + Browser() {} Browser(const std::string& url, const GeometryHints& hints = GeometryHints()); - + bool assign(BrowserImage* browserImage, const GeometryHints& hints = GeometryHints()); bool open(const std::string& url, const GeometryHints& hints = GeometryHints()); @@ -81,7 +81,7 @@ class OSGWIDGET_EXPORT Browser : public osg::Geode void navigateTo(const std::string& url); protected: - + osg::ref_ptr _browserImage; }; diff --git a/include/osgWidget/Canvas b/include/osgWidget/Canvas index a447f5e1f..4dd47297c 100644 --- a/include/osgWidget/Canvas +++ b/include/osgWidget/Canvas @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/EventInterface b/include/osgWidget/EventInterface index ab5784d6e..80e275689 100644 --- a/include/osgWidget/EventInterface +++ b/include/osgWidget/EventInterface @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/Export b/include/osgWidget/Export index 5ef464b97..dbd35d126 100644 --- a/include/osgWidget/Export +++ b/include/osgWidget/Export @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ # endif #else # define OSGWIDGET_EXPORT -#endif +#endif /** diff --git a/include/osgWidget/Frame b/include/osgWidget/Frame index b33c79a83..ad8d3509c 100644 --- a/include/osgWidget/Frame +++ b/include/osgWidget/Frame @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -58,7 +58,7 @@ take a look at this URL, or any of the example themes: class OSGWIDGET_EXPORT Frame: public Table { public: - + enum CornerType { CORNER_LOWER_LEFT, @@ -112,7 +112,7 @@ class OSGWIDGET_EXPORT Frame: public Table _corner = corner; _name = cornerTypeToString(corner); } - + protected: CornerType _corner; @@ -145,9 +145,9 @@ class OSGWIDGET_EXPORT Frame: public Table _border = border; _name = borderTypeToString(border); } - + protected: - + BorderType _border; }; @@ -242,7 +242,7 @@ class OSGWIDGET_EXPORT Frame: public Table } protected: - + Widget* _getCorner (CornerType) const; Widget* _getBorder (BorderType) const; diff --git a/include/osgWidget/Lua b/include/osgWidget/Lua index 678d81787..2abf0deff 100644 --- a/include/osgWidget/Lua +++ b/include/osgWidget/Lua @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/PdfReader b/include/osgWidget/PdfReader index 763bb0979..bb4826783 100644 --- a/include/osgWidget/PdfReader +++ b/include/osgWidget/PdfReader @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,7 +43,7 @@ struct GeometryHints GeometryHints(const osg::Vec3& pos, const osg::Vec3& wVec, - const osg::Vec3& hVec, + const osg::Vec3& hVec, const osg::Vec4& bColor, AspectRatioPolicy asp=RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO, unsigned int wRes=1024, @@ -73,7 +73,7 @@ struct GeometryHints class PdfImage : public osg::Image { public: - + PdfImage(): _backgroundColor(1.0f,1.0f,1.0f,1.0f), _pageNum(0), @@ -95,7 +95,7 @@ class PdfImage : public osg::Image } bool next() - { + { return page(_pageNum+1); } diff --git a/include/osgWidget/Python b/include/osgWidget/Python index a5a457986..1e8548baa 100644 --- a/include/osgWidget/Python +++ b/include/osgWidget/Python @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/ScriptEngine b/include/osgWidget/ScriptEngine index 12b8cd20f..ccc9cbd95 100644 --- a/include/osgWidget/ScriptEngine +++ b/include/osgWidget/ScriptEngine @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/StyleInterface b/include/osgWidget/StyleInterface index ed5136860..995defcba 100644 --- a/include/osgWidget/StyleInterface +++ b/include/osgWidget/StyleInterface @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/StyleManager b/include/osgWidget/StyleManager index a64eaf3bb..824d28fe9 100644 --- a/include/osgWidget/StyleManager +++ b/include/osgWidget/StyleManager @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -117,9 +117,9 @@ class OSGWIDGET_EXPORT StyleManager: public osg::Object bool inc = false; - while(!r.eof()) + while(!r.eof()) { - if(_styles[style]->applyStyle(t, r)) + if(_styles[style]->applyStyle(t, r)) inc = true; else r.advanceOverCurrentFieldOrBlock(); @@ -173,7 +173,7 @@ class OSGWIDGET_EXPORT StyleManager: public osg::Object if(!obj) { - warn() + warn() << "Cannot coerce object into osg::Object in StyleManager:::applyStyle" << std::endl ; diff --git a/include/osgWidget/Table b/include/osgWidget/Table index 4642f3e35..5f99f543e 100644 --- a/include/osgWidget/Table +++ b/include/osgWidget/Table @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -56,7 +56,7 @@ class OSGWIDGET_EXPORT Table: public Window } protected: - + unsigned int _rows; unsigned int _cols; unsigned int _lastRowAdd; diff --git a/include/osgWidget/Types b/include/osgWidget/Types index 53273f29a..ecb121023 100644 --- a/include/osgWidget/Types +++ b/include/osgWidget/Types @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/UIObjectParent b/include/osgWidget/UIObjectParent index 3d553d54f..ee72e0bbf 100644 --- a/include/osgWidget/UIObjectParent +++ b/include/osgWidget/UIObjectParent @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/include/osgWidget/Util b/include/osgWidget/Util index 3919147b3..694cdd229 100644 --- a/include/osgWidget/Util +++ b/include/osgWidget/Util @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ namespace osgWidget { inline std::ostream& _notify(osg::NotifySeverity ns = osg::INFO) { std::ostream& n = osg::notify(ns); - + return n << "osgWidget: "; } diff --git a/include/osgWidget/ViewerEventHandlers b/include/osgWidget/ViewerEventHandlers index 53bb4fe28..73fa3b19f 100644 --- a/include/osgWidget/ViewerEventHandlers +++ b/include/osgWidget/ViewerEventHandlers @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -60,7 +60,7 @@ class OSGWIDGET_EXPORT MouseHandler: public osgGA::GUIEventHandler }; // This handles the forwarding of keypress events. -class OSGWIDGET_EXPORT KeyboardHandler: public osgGA::GUIEventHandler +class OSGWIDGET_EXPORT KeyboardHandler: public osgGA::GUIEventHandler { public: @@ -93,7 +93,7 @@ class OSGWIDGET_EXPORT ResizeHandler: public osgGA::GUIEventHandler ); protected: - + osg::observer_ptr _wm; osg::observer_ptr _camera; }; @@ -114,7 +114,7 @@ class OSGWIDGET_EXPORT CameraSwitchHandler: public osgGA::GUIEventHandler ); protected: - + osg::observer_ptr _wm; osg::observer_ptr _camera; osg::ref_ptr _oldNode; diff --git a/include/osgWidget/VncClient b/include/osgWidget/VncClient index bb9f9129c..b438ae4ed 100644 --- a/include/osgWidget/VncClient +++ b/include/osgWidget/VncClient @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,17 +24,17 @@ namespace osgWidget { class VncImage : public osg::Image { public: - + VncImage() {} - + virtual bool connect(const std::string& hostname) = 0; virtual void close() = 0; protected: - + virtual ~VncImage() {} - + }; @@ -42,19 +42,19 @@ class VncImage : public osg::Image class OSGWIDGET_EXPORT VncClient : public osg::Geode { public: - + VncClient() {} VncClient(const std::string& hostname, const GeometryHints& hints = GeometryHints()); - + bool assign(VncImage* vncImage, const GeometryHints& hints = GeometryHints()); - + bool connect(const std::string& hostname, const GeometryHints& hints = GeometryHints()); void close(); protected: - + osg::ref_ptr _vncImage; }; diff --git a/include/osgWidget/Widget b/include/osgWidget/Widget index b541200a2..a4be6861c 100644 --- a/include/osgWidget/Widget +++ b/include/osgWidget/Widget @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -69,7 +69,7 @@ public: enum CoordinateMode { CM_ABSOLUTE, CM_RELATIVE - }; + }; Widget (const std::string& = "", point_type = 0.0f, point_type = 0.0f); @@ -454,7 +454,7 @@ public: friend class Window; - // TODO: Because of the current class design, I don't think it's possible to + // TODO: Because of the current class design, I don't think it's possible to // have a ref_ptr here. :( Window* _parent; @@ -533,7 +533,7 @@ struct NotifyWidget: public Widget { return false; } - bool mouseEnter(double, double, const WindowManager*) { + bool mouseEnter(double, double, const WindowManager*) { osg::notify(osg::NOTICE) << _name << " > mouseEnter called" << std::endl; return false; @@ -609,7 +609,7 @@ struct NullWidget: public Widget { return true; } - bool mouseEnter(double, double, const WindowManager*) { + bool mouseEnter(double, double, const WindowManager*) { return true; } diff --git a/include/osgWidget/Window b/include/osgWidget/Window index bd6a20abb..8e843233a 100644 --- a/include/osgWidget/Window +++ b/include/osgWidget/Window @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -96,7 +96,7 @@ class OSGWIDGET_EXPORT Window: // If you only want to display a portion of a Window (such as when it is embedded), // you will need to set the VisibilityMode to WM_PARTIAL. Otherwise, the entire // Window is visible by default. The final enum, VM_ENTIRE, says that no Scissoring - // should take place at all, and is useful in cases where you want to properly + // should take place at all, and is useful in cases where you want to properly // scale or rotate Windows. enum VisibilityMode { VM_FULL, @@ -211,7 +211,7 @@ class OSGWIDGET_EXPORT Window: return _wm; } - Window* getParent() { + Window* getParent() { return _parent; } @@ -416,7 +416,7 @@ class OSGWIDGET_EXPORT Window: } typedef point_type (Widget::*Getter)() const; - + protected: typedef std::less Less; @@ -493,7 +493,7 @@ class OSGWIDGET_EXPORT Window: // I WARNED YOU! If you try and understand what this does your head will // explode! But let me say a few things: in MSVC you can't add to an iterator // such that the add will cause it to increment past the end of the container. - // This appears to be safe in GCC, where it will just return the last + // This appears to be safe in GCC, where it will just return the last // item therein, but causes an assertion error in other compilers. I'm not // sure if there is a cleaner remedy for this, so what we do for now is keep a // count variable called "c" that makes sure our iterator's opterator+() diff --git a/include/osgWidget/WindowManager b/include/osgWidget/WindowManager index 3a77c2a69..49b5e6eeb 100644 --- a/include/osgWidget/WindowManager +++ b/include/osgWidget/WindowManager @@ -279,7 +279,7 @@ class OSGWIDGET_EXPORT WindowManager: public osg::Switch, public UIObjectParent< // can be compared to osgGA::GUIEventAdapter::{KeySymbol,KeyModMask}. bool keyDown (int, int); bool keyUp (int, int); - + osgViewer::View* getView() { return _view; } const osgViewer::View* getView() const { return _view; } diff --git a/src/osg/AlphaFunc.cpp b/src/osg/AlphaFunc.cpp index a7a91c96a..0cdd898d6 100644 --- a/src/osg/AlphaFunc.cpp +++ b/src/osg/AlphaFunc.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osg/AnimationPath.cpp b/src/osg/AnimationPath.cpp index 2cef14998..f3be8aa2e 100644 --- a/src/osg/AnimationPath.cpp +++ b/src/osg/AnimationPath.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -27,7 +27,7 @@ void AnimationPath::insert(double time,const ControlPoint& controlPoint) bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const { if (_timeControlPointMap.empty()) return false; - + switch(_loopMode) { case(SWING): @@ -35,7 +35,7 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro double modulated_time = (time - getFirstTime())/(getPeriod()*2.0); double fraction_part = modulated_time - floor(modulated_time); if (fraction_part>0.5) fraction_part = 1.0-fraction_part; - + time = getFirstTime()+(fraction_part*2.0) * getPeriod(); break; } @@ -50,8 +50,8 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro // no need to modulate the time. break; } - - + + TimeControlPointMap::const_iterator second = _timeControlPointMap.lower_bound(time); if (second==_timeControlPointMap.begin()) @@ -61,8 +61,8 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro else if (second!=_timeControlPointMap.end()) { TimeControlPointMap::const_iterator first = second; - --first; - + --first; + // we have both a lower bound and the next item. // delta_time = second.time - first.time @@ -75,7 +75,7 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro controlPoint.interpolate((time - first->first)/delta_time, first->second, second->second); - } + } } else // (second==_timeControlPointMap.end()) { @@ -138,13 +138,13 @@ AnimationPathCallback::AnimationPathCallback(const osg::Vec3d& pivot,const osg:: double time2 = osg::PI*1.0/angularVelocity; double time3 = osg::PI*1.5/angularVelocity; double time4 = osg::PI*2.0/angularVelocity; - + osg::Quat rotation0(0.0, axis); osg::Quat rotation1(osg::PI*0.5, axis); osg::Quat rotation2(osg::PI*1.0, axis); osg::Quat rotation3(osg::PI*1.5, axis); - - + + _animationPath->insert(time0,osg::AnimationPath::ControlPoint(pivot,rotation0)); _animationPath->insert(time1,osg::AnimationPath::ControlPoint(pivot,rotation1)); _animationPath->insert(time2,osg::AnimationPath::ControlPoint(pivot,rotation2)); @@ -168,10 +168,10 @@ class AnimationPathCallbackVisitor : public NodeVisitor _cp.getInverse(matrix); else _cp.getMatrix(matrix); - + camera.setViewMatrix(osg::Matrix::translate(-_pivotPoint)*matrix); } - + virtual void apply(CameraView& cv) { @@ -182,7 +182,7 @@ class AnimationPathCallbackVisitor : public NodeVisitor cv.setPosition(matrix.getTrans()); cv.setAttitude(_cp.getRotation().inverse()); cv.setFocalLength(1.0f/_cp.getScale().x()); - + } else { @@ -199,10 +199,10 @@ class AnimationPathCallbackVisitor : public NodeVisitor _cp.getInverse(matrix); else _cp.getMatrix(matrix); - + mt.setMatrix(osg::Matrix::translate(-_pivotPoint)*matrix); } - + virtual void apply(PositionAttitudeTransform& pat) { if (_useInverseMatrix) @@ -213,7 +213,7 @@ class AnimationPathCallbackVisitor : public NodeVisitor pat.setAttitude(_cp.getRotation().inverse()); pat.setScale(osg::Vec3(1.0f/_cp.getScale().x(),1.0f/_cp.getScale().y(),1.0f/_cp.getScale().z())); pat.setPivotPoint(_pivotPoint); - + } else { @@ -223,16 +223,16 @@ class AnimationPathCallbackVisitor : public NodeVisitor pat.setPivotPoint(_pivotPoint); } } - + AnimationPath::ControlPoint _cp; osg::Vec3d _pivotPoint; - bool _useInverseMatrix; + bool _useInverseMatrix; }; void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv) { - if (_animationPath.valid() && - nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR && + if (_animationPath.valid() && + nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR && nv->getFrameStamp()) { double time = nv->getFrameStamp()->getSimulationTime(); @@ -245,7 +245,7 @@ void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv) update(*node); } } - + // must call any nested node callbacks and continue subgraph traversal. NodeCallback::traverse(node,nv); } @@ -283,7 +283,7 @@ void AnimationPathCallback::setPause(bool pause) { return; } - + _pause = pause; if (_firstTime==DBL_MAX) return; diff --git a/src/osg/ApplicationUsage.cpp b/src/osg/ApplicationUsage.cpp index 25dfbdf69..b32bb9022 100644 --- a/src/osg/ApplicationUsage.cpp +++ b/src/osg/ApplicationUsage.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -100,7 +100,7 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u unsigned int explanationWidth = fullWidth-explanationPos; std::string line; - + for(citr=um.begin(); citr!=um.end(); ++citr) @@ -135,7 +135,7 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u currentEndPos = 0; } } - + const std::string& explanation = citr->second; std::string::size_type pos = 0; std::string::size_type offset = 0; @@ -175,7 +175,7 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u ++extraSkip; firstInLine = true; } - else if (slashn_pos==pos+width) + else if (slashn_pos==pos+width) { ++extraSkip; firstInLine = true; @@ -186,8 +186,8 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u { // now reduce width until we get a space or a return // so that we ensure that whole words are printed. - while (width>0 && - explanation[pos+width]!=' ' && + while (width>0 && + explanation[pos+width]!=' ' && explanation[pos+width]!='\n') --width; if (width==0) @@ -238,7 +238,7 @@ void ApplicationUsage::write(std::ostream& output, unsigned int type, unsigned i write(output,getCommandLineOptions(),widthOfOutput,showDefaults,getCommandLineOptionsDefaults()); needspace = true; } - + if ((type&ENVIRONMENTAL_VARIABLE) && !getEnvironmentalVariables().empty()) { if (needspace) output << std::endl; @@ -274,10 +274,10 @@ void ApplicationUsage::writeEnvironmentSettings(std::ostream& output) if (len == std::string::npos) len = citr->first.size(); maxNumCharsInOptions = maximum( maxNumCharsInOptions,static_cast(len)); } - + unsigned int optionPos = 2; std::string line; - + for(citr=getEnvironmentalVariables().begin(); citr!=getEnvironmentalVariables().end(); ++citr) diff --git a/src/osg/ArgumentParser.cpp b/src/osg/ArgumentParser.cpp index 475caec52..58d010b37 100644 --- a/src/osg/ArgumentParser.cpp +++ b/src/osg/ArgumentParser.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -57,7 +57,7 @@ bool ArgumentParser::isNumber(const char* str) int noZeroToNine = 0; const char* ptr = str; - + // check if could be a hex number. if (strncmp(ptr,"0x",2)==0) { @@ -67,17 +67,17 @@ bool ArgumentParser::isNumber(const char* str) while ( *ptr!=0 && ((*ptr>='0' && *ptr<='9') || - (*ptr>='a' && *ptr<='f') || + (*ptr>='a' && *ptr<='f') || (*ptr>='A' && *ptr<='F')) ) { ++ptr; } - + // got to end of string without failure, therefore must be a hex integer. if (*ptr==0) return true; } - + ptr = str; // check if a float or an int. @@ -136,7 +136,7 @@ bool ArgumentParser::isNumber(const char* str) if (couldBeFloat && noZeroToNine>0) return true; return false; - + } bool ArgumentParser::Parameter::valid(const char* str) const @@ -186,12 +186,12 @@ ArgumentParser::ArgumentParser(int* argc,char **argv): _usage(ApplicationUsage::instance()) { #ifdef __APPLE__ - //On OSX, any -psn arguments need to be removed because they will + //On OSX, any -psn arguments need to be removed because they will // confuse the application. -psn plus a concatenated argument are // passed by the finder to application bundles for(int pos=1;posargc();++pos) { - if (std::string(_argv[pos]).compare(0, 4, std::string("-psn")) == 0) + if (std::string(_argv[pos]).compare(0, 4, std::string("-psn")) == 0) { remove(pos, 1); } @@ -215,7 +215,7 @@ std::string ArgumentParser::getApplicationName() const return ""; } - + bool ArgumentParser::isOption(int pos) const { return pos<*_argc && isOption(_argv[pos]); @@ -263,7 +263,7 @@ bool ArgumentParser::containsOptions() const void ArgumentParser::remove(int pos,int num) { if (num==0) return; - + for(;pos+num<*_argc;++pos) { _argv[pos]=_argv[pos+num]; @@ -594,7 +594,7 @@ void ArgumentParser::reportError(const std::string& message,ErrorSeverity severi void ArgumentParser::reportRemainingOptionsAsUnrecognized(ErrorSeverity severity) { std::set options; - if (_usage.valid()) + if (_usage.valid()) { // parse the usage options to get all the option that the application can potential handle. for(ApplicationUsage::UsageMap::const_iterator itr=_usage->getCommandLineOptions().begin(); @@ -605,25 +605,25 @@ void ArgumentParser::reportRemainingOptionsAsUnrecognized(ErrorSeverity severity std::string::size_type prevpos = 0, pos = 0; while ((pos=option.find(' ',prevpos))!=std::string::npos) { - if (option[prevpos]=='-') + if (option[prevpos]=='-') { options.insert(std::string(option,prevpos,pos-prevpos)); } prevpos=pos+1; } - if (option[prevpos]=='-') + if (option[prevpos]=='-') { options.insert(std::string(option,prevpos,std::string::npos)); } } - + } for(int pos=1;posaddCommandLineOption("-h or --help","Display command line parameters"); getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available"); diff --git a/src/osg/Array.cpp b/src/osg/Array.cpp index 4658797f6..b738e7284 100644 --- a/src/osg/Array.cpp +++ b/src/osg/Array.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/ArrayDispatchers.cpp b/src/osg/ArrayDispatchers.cpp index f04c1d28d..087b069aa 100644 --- a/src/osg/ArrayDispatchers.cpp +++ b/src/osg/ArrayDispatchers.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -518,7 +518,7 @@ void ArrayDispatchers::assignTexCoordDispatchers(unsigned int unit) #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) Drawable::Extensions* extensions = Drawable::getExtensions(_state->getContextID(),true); #endif - + for(unsigned int i=_texCoordDispatchers.size(); i<=unit; ++i) { _texCoordDispatchers.push_back(new AttributeDispatchMap(_glBeginEndAdapter)); diff --git a/src/osg/AudioStream.cpp b/src/osg/AudioStream.cpp index bdf69a142..56f7e5369 100644 --- a/src/osg/AudioStream.cpp +++ b/src/osg/AudioStream.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osg/AutoTransform.cpp b/src/osg/AutoTransform.cpp index f489d3157..e39c1cb62 100644 --- a/src/osg/AutoTransform.cpp +++ b/src/osg/AutoTransform.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -58,13 +58,13 @@ AutoTransform::AutoTransform(const AutoTransform& pat,const CopyOp& copyop): _cachedMode(pat._cachedMode), _side(pat._side) { -// setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); +// setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } void AutoTransform::setAutoRotateMode(AutoRotateMode mode) -{ - _autoRotateMode = mode; - _firstTimeToInitEyePoint = true; +{ + _autoRotateMode = mode; + _firstTimeToInitEyePoint = true; _cachedMode = CACHE_DIRTY; updateCache(); } @@ -93,23 +93,23 @@ void AutoTransform::updateCache() else _cachedMode = ROTATE_TO_AXIS; } else _cachedMode = _autoRotateMode; - + _side = _axis^_normal; - _side.normalize(); + _side.normalize(); } void AutoTransform::setScale(const Vec3d& scale) { - _scale = scale; + _scale = scale; if (_scale.x()<_minimumScale) _scale.x() = _minimumScale; if (_scale.y()<_minimumScale) _scale.y() = _minimumScale; if (_scale.z()<_minimumScale) _scale.z() = _minimumScale; - + if (_scale.x()>_maximumScale) _scale.x() = _maximumScale; if (_scale.y()>_maximumScale) _scale.y() = _maximumScale; if (_scale.z()>_maximumScale) _scale.z() = _maximumScale; - - _matrixDirty=true; + + _matrixDirty=true; dirtyBound(); } @@ -117,7 +117,7 @@ void AutoTransform::setScale(const Vec3d& scale) bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { if (_matrixDirty) computeMatrix(); - + if (_referenceFrame==RELATIVE_RF) { matrix.preMult(_cachedMatrix); @@ -155,18 +155,18 @@ bool AutoTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const void AutoTransform::computeMatrix() const { if (!_matrixDirty) return; - + _cachedMatrix.makeRotate(_rotation); _cachedMatrix.postMultTranslate(_position); _cachedMatrix.preMultScale(_scale); _cachedMatrix.preMultTranslate(-_pivotPoint); - + _matrixDirty = false; } void AutoTransform::accept(NodeVisitor& nv) { - if (nv.validNodeMask(*this)) + if (nv.validNodeMask(*this)) { // if app traversal update the frame count. if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR) @@ -190,8 +190,8 @@ void AutoTransform::accept(NodeVisitor& nv) height = viewport->height(); } - osg::Vec3d eyePoint = cs->getEyeLocal(); - osg::Vec3d localUp = cs->getUpLocal(); + osg::Vec3d eyePoint = cs->getEyeLocal(); + osg::Vec3d localUp = cs->getUpLocal(); osg::Vec3d position = getPosition(); const osg::Matrix& projection = *(cs->getProjectionMatrix()); @@ -215,30 +215,30 @@ void AutoTransform::accept(NodeVisitor& nv) { doUpdate = true; } - else if (projection != _previousProjection) + else if (projection != _previousProjection) { doUpdate = true; - } - else if (position != _previousPosition) - { - doUpdate = true; - } + } + else if (position != _previousPosition) + { + doUpdate = true; + } } _firstTimeToInitEyePoint = false; if (doUpdate) - { + { if (getAutoScaleToScreen()) { double size = 1.0/cs->pixelSize(getPosition(),0.48f); if (_autoScaleTransitionWidthRatio>0.0) - { + { if (_minimumScale>0.0) { double j = _minimumScale; - double i = (_maximumScalep) size = _maximumScale; else if (size>m) size = a + b*size + c*(size*size); - } + } } - + setScale(size); } @@ -275,7 +275,7 @@ void AutoTransform::accept(NodeVisitor& nv) osg::Quat rotation; osg::Vec3d scale; osg::Quat so; - + cs->getModelViewMatrix()->decompose( translation, rotation, scale, so ); setRotation(rotation.inverse()); @@ -350,7 +350,7 @@ void AutoTransform::accept(NodeVisitor& nv) } break; } - case(ROTATE_TO_AXIS): // need to implement + case(ROTATE_TO_AXIS): // need to implement { float ev_side = ev*_side; float ev_normal = ev*_normal; diff --git a/src/osg/Billboard.cpp b/src/osg/Billboard.cpp index 8bebadab3..1c5fbf967 100644 --- a/src/osg/Billboard.cpp +++ b/src/osg/Billboard.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -94,12 +94,12 @@ void Billboard::updateCache() { if(_axis==Vec3(0.0f, 0.0, 1.0f) && _normal==Vec3(0.0f, -1.0f, 0.0f)) _cachedMode = POINT_ROT_WORLD_Z_AXIS; else _cachedMode = _mode; - + } else _cachedMode = _mode; - + _side = _axis^_normal; - _side.normalize(); + _side.normalize(); } bool Billboard::addDrawable(Drawable *gset) @@ -215,7 +215,7 @@ bool Billboard::computeMatrix(Matrix& modelview, const Vec3& eye_local, const Ve } break; } - case(AXIAL_ROT): // need to implement + case(AXIAL_ROT): // need to implement { float ev_side = ev*_side; float ev_normal = ev*_normal; diff --git a/src/osg/BlendColor.cpp b/src/osg/BlendColor.cpp index 06625b903..2b0a52148 100644 --- a/src/osg/BlendColor.cpp +++ b/src/osg/BlendColor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -35,12 +35,12 @@ BlendColor::~BlendColor() void BlendColor::apply(State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - + const Extensions* extensions = getExtensions(contextID,true); - + if (!extensions->isBlendColorSupported()) { OSG_WARN<<"Warning: BlendColor::apply(..) failed, BlendColor is not support by OpenGL driver."< @@ -44,12 +44,12 @@ BlendEquation::~BlendEquation() void BlendEquation::apply(State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - + const Extensions* extensions = getExtensions(contextID,true); - + if (!extensions->isBlendEquationSupported()) { OSG_WARN<<"Warning: BlendEquation::apply(..) failed, BlendEquation is not support by OpenGL driver."<= 0; _isBlendEquationSeparateSupported = bultInSupport || - isGLExtensionSupported(contextID, "GL_EXT_blend_equation_separate") || + isGLExtensionSupported(contextID, "GL_EXT_blend_equation_separate") || strncmp((const char*)glGetString(GL_VERSION), "2.0", 3) >= 0; _isSGIXMinMaxSupported = isGLExtensionSupported(contextID, "GL_SGIX_blend_alpha_minmax"); diff --git a/src/osg/BlendFunc.cpp b/src/osg/BlendFunc.cpp index c28628695..5c8c905fd 100644 --- a/src/osg/BlendFunc.cpp +++ b/src/osg/BlendFunc.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -50,7 +50,7 @@ void BlendFunc::apply(State& state) const if (_source_factor != _source_factor_alpha || _destination_factor != _destination_factor_alpha) { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); diff --git a/src/osg/BufferIndexBinding.cpp b/src/osg/BufferIndexBinding.cpp index f4b1fa4d9..a3200f5e4 100644 --- a/src/osg/BufferIndexBinding.cpp +++ b/src/osg/BufferIndexBinding.cpp @@ -1,14 +1,14 @@ /* -*-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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osg/BufferObject.cpp b/src/osg/BufferObject.cpp index 9d2389e94..47ae81c7e 100644 --- a/src/osg/BufferObject.cpp +++ b/src/osg/BufferObject.cpp @@ -206,7 +206,7 @@ void GLBufferObject::compileBuffer() const osg::Image* image = entry.dataSource->asImage(); if (image && !(image->isDataContiguous())) - { + { unsigned int offset = entry.offset; for(osg::Image::DataIterator img_itr(image); img_itr.valid(); ++img_itr) { @@ -216,7 +216,7 @@ void GLBufferObject::compileBuffer() } } else - { + { _extensions->glBufferSubData(_profile._target, (GLintptrARB)entry.offset, (GLsizeiptrARB)entry.dataSize, entry.dataSource->getDataPointer()); } @@ -665,7 +665,7 @@ void GLBufferObjectSet::flushDeletedGLBufferObjects(double currentTime, double& OSG_INFO<<"Plenty of space in GLBufferObject pool"< diff --git a/src/osg/ClampColor.cpp b/src/osg/ClampColor.cpp index 178ab4193..4b4783d83 100644 --- a/src/osg/ClampColor.cpp +++ b/src/osg/ClampColor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -40,12 +40,12 @@ ClampColor::~ClampColor() void ClampColor::apply(State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - + const Extensions* extensions = getExtensions(contextID,true); - + if (!extensions->isClampColorSupported()) { OSG_WARN<<"Warning: ClampColor::apply(..) failed, ClampColor is not support by OpenGL driver."< diff --git a/src/osg/ClipNode.cpp b/src/osg/ClipNode.cpp index 4646bba5b..370cd235d 100644 --- a/src/osg/ClipNode.cpp +++ b/src/osg/ClipNode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -73,7 +73,7 @@ void ClipNode::createClipBox(const BoundingBox& bb,unsigned int clipPlaneNumberB _stateset->setAssociatedModes(_planes.back().get(), _value); } -// Add a ClipPlane to a ClipNode. Return true if plane is added, +// Add a ClipPlane to a ClipNode. Return true if plane is added, // return false if plane already exists in ClipNode, or clipplane is false. bool ClipNode::addClipPlane(ClipPlane* clipplane) { @@ -93,7 +93,7 @@ bool ClipNode::addClipPlane(ClipPlane* clipplane) } } -// Remove ClipPlane from a ClipNode. Return true if plane is removed, +// Remove ClipPlane from a ClipNode. Return true if plane is removed, // return false if plane does not exists in ClipNode. bool ClipNode::removeClipPlane(ClipPlane* clipplane) { @@ -113,7 +113,7 @@ bool ClipNode::removeClipPlane(ClipPlane* clipplane) } } -// Remove ClipPlane, at specified index, from a ClipNode. Return true if plane is removed, +// Remove ClipPlane, at specified index, from a ClipNode. Return true if plane is removed, // return false if plane does not exists in ClipNode. bool ClipNode::removeClipPlane(unsigned int pos) { diff --git a/src/osg/ClipPlane.cpp b/src/osg/ClipPlane.cpp index b68f6b841..daf7c7a93 100644 --- a/src/osg/ClipPlane.cpp +++ b/src/osg/ClipPlane.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -54,7 +54,7 @@ void ClipPlane::setClipPlaneNum(unsigned int num) osg::StateSet* stateset = *itr; stateset->removeAttribute(this); } - + // assign the clip plane number _clipPlaneNum = num; diff --git a/src/osg/ClusterCullingCallback.cpp b/src/osg/ClusterCullingCallback.cpp index cff257e6a..b0fbe76c6 100644 --- a/src/osg/ClusterCullingCallback.cpp +++ b/src/osg/ClusterCullingCallback.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -63,18 +63,18 @@ struct ComputeAveragesFunctor if (normal.normalize()!=0.0f) { _normal += normal; - } + } _center += v1; _center += v2; _center += v3; - + ++_num; } - + osg::Vec3 center() { return _center / (double)(3*_num); } osg::Vec3 normal() { _normal.normalize(); return _normal; } - + unsigned int _num; Vec3d _center; Vec3d _normal; @@ -86,7 +86,7 @@ struct ComputeDeviationFunctor ComputeDeviationFunctor(): _deviation(1.0), _radius2(0.0) {} - + void set(const osg::Vec3& center,const osg::Vec3& normal) { _center = center; @@ -117,27 +117,27 @@ void ClusterCullingCallback::computeFrom(const osg::Drawable* drawable) { TriangleFunctor caf; drawable->accept(caf); - + _controlPoint = caf.center(); _normal = caf.normal(); - + TriangleFunctor cdf; cdf.set(_controlPoint,_normal); drawable->accept(cdf); - + // OSG_NOTICE<<"ClusterCullingCallback::computeFrom() _controlPoint="<<_controlPoint< diff --git a/src/osg/ConvexPlanarPolygon.cpp b/src/osg/ConvexPlanarPolygon.cpp index ec7cf09ae..7ddd7c613 100644 --- a/src/osg/ConvexPlanarPolygon.cpp +++ b/src/osg/ConvexPlanarPolygon.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/CoordinateSystemNode.cpp b/src/osg/CoordinateSystemNode.cpp index 343238066..411521eb5 100644 --- a/src/osg/CoordinateSystemNode.cpp +++ b/src/osg/CoordinateSystemNode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -47,8 +47,8 @@ CoordinateFrame CoordinateSystemNode::computeLocalCoordinateFrame(const Vec3d& p if (_ellipsoidModel.valid()) { Matrixd localToWorld; - - double latitude, longitude, height; + + double latitude, longitude, height; _ellipsoidModel->convertXYZToLatLongHeight(position.x(),position.y(),position.z(),latitude, longitude, height); _ellipsoidModel->computeLocalToWorldTransformFromLatLongHeight(latitude, longitude, 0.0f, localToWorld); diff --git a/src/osg/CopyOp.cpp b/src/osg/CopyOp.cpp index 77b0040a2..6a5a360b5 100644 --- a/src/osg/CopyOp.cpp +++ b/src/osg/CopyOp.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -29,7 +29,7 @@ TYPE* CopyOp::operator() (const TYPE* obj) const \ return osg::clone(obj, *this); \ else \ return const_cast(obj); \ -} +} COPY_OP( Object, DEEP_COPY_OBJECTS ) COPY_OP( Node, DEEP_COPY_NODES ) @@ -57,7 +57,7 @@ StateAttribute* CopyOp::operator() (const StateAttribute* attr) const { return operator()(textbase); } - else + else { return osg::clone(attr, *this); } @@ -76,7 +76,7 @@ NodeCallback* CopyOp::operator() (const NodeCallback* nc) const first->setNestedCallback(0); nc = nc->getNestedCallback(); - while (nc) + while (nc) { osg::NodeCallback* ucb = osg::clone(nc, *this); if (ucb) diff --git a/src/osg/CullFace.cpp b/src/osg/CullFace.cpp index 45a8c618b..6516296fc 100644 --- a/src/osg/CullFace.cpp +++ b/src/osg/CullFace.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/CullSettings.cpp b/src/osg/CullSettings.cpp index 2865c7756..370191787 100644 --- a/src/osg/CullSettings.cpp +++ b/src/osg/CullSettings.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -64,7 +64,7 @@ void CullSettings::setCullSettings(const CullSettings& rhs) _impostorActive = rhs._impostorActive; _depthSortImpostorSprites = rhs._depthSortImpostorSprites; _impostorPixelErrorThreshold = rhs._impostorPixelErrorThreshold; - _numFramesToKeepImpostorSprites = rhs._numFramesToKeepImpostorSprites; + _numFramesToKeepImpostorSprites = rhs._numFramesToKeepImpostorSprites; _cullMask = rhs._cullMask; _cullMaskLeft = rhs._cullMaskLeft; @@ -98,7 +98,7 @@ void CullSettings::readEnvironmentalVariables() OSG_INFO<<"CullSettings::readEnvironmentalVariables()"< @@ -28,7 +28,7 @@ CullStack::CullStack() _index_modelviewCullingStack = 0; _back_modelviewCullingStack = 0; - + _referenceViewPoints.push_back(osg::Vec3(0.0f,0.0f,0.0f)); } @@ -43,7 +43,7 @@ CullStack::CullStack(const CullStack& cs): _index_modelviewCullingStack = 0; _back_modelviewCullingStack = 0; - + _referenceViewPoints.push_back(osg::Vec3(0.0f,0.0f,0.0f)); } @@ -65,7 +65,7 @@ void CullStack::reset() _referenceViewPoints.clear(); _referenceViewPoints.push_back(osg::Vec3(0.0f,0.0f,0.0f)); - + _eyePointStack.clear(); _viewPointStack.clear(); @@ -78,13 +78,13 @@ void CullStack::reset() _back_modelviewCullingStack = 0; osg::Vec3 lookVector(0.0,0.0,-1.0); - + _bbCornerFar = (lookVector.x()>=0?1:0) | (lookVector.y()>=0?2:0) | (lookVector.z()>=0?4:0); _bbCornerNear = (~_bbCornerFar)&7; - + _currentReuseMatrixIndex=0; } @@ -93,31 +93,31 @@ void CullStack::pushCullingSet() { _MVPW_Stack.push_back(0L); - if (_index_modelviewCullingStack==0) + if (_index_modelviewCullingStack==0) { if (_modelviewCullingStack.empty()) _modelviewCullingStack.push_back(CullingSet()); _modelviewCullingStack[_index_modelviewCullingStack++].set(_projectionCullingStack.back()); } - else + else { - + const osg::Viewport& W = *_viewportStack.back(); const osg::Matrix& P = *_projectionStack.back(); const osg::Matrix& M = *_modelviewStack.back(); osg::Vec4 pixelSizeVector = CullingSet::computePixelSizeVector(W,P,M); - - if (_index_modelviewCullingStack>=_modelviewCullingStack.size()) + + if (_index_modelviewCullingStack>=_modelviewCullingStack.size()) { _modelviewCullingStack.push_back(CullingSet()); } - + _modelviewCullingStack[_index_modelviewCullingStack++].set(_projectionCullingStack.back(),*_modelviewStack.back(),pixelSizeVector); - + } - + _back_modelviewCullingStack = &_modelviewCullingStack[_index_modelviewCullingStack-1]; // const osg::Polytope& polytope = _modelviewCullingStack.back()->getFrustum(); @@ -136,7 +136,7 @@ void CullStack::pushCullingSet() void CullStack::popCullingSet() { _MVPW_Stack.pop_back(); - + --_index_modelviewCullingStack; if (_index_modelviewCullingStack>0) _back_modelviewCullingStack = &_modelviewCullingStack[_index_modelviewCullingStack-1]; @@ -157,20 +157,20 @@ void CullStack::popViewport() void CullStack::pushProjectionMatrix(RefMatrix* matrix) { _projectionStack.push_back(matrix); - + _projectionCullingStack.push_back(osg::CullingSet()); osg::CullingSet& cullingSet = _projectionCullingStack.back(); - + // set up view frustum. cullingSet.getFrustum().setToUnitFrustum(((_cullingMode&NEAR_PLANE_CULLING)!=0),((_cullingMode&FAR_PLANE_CULLING)!=0)); cullingSet.getFrustum().transformProvidingInverse(*matrix); - + // set the culling mask ( There should be a more elegant way!) Nikolaus H. cullingSet.setCullingMask(_cullingMode); // set the small feature culling. cullingSet.setSmallFeatureCullingPixelSize(_smallFeatureCullingPixelSize); - + // set up the relevant occluders which a related to this projection. for(ShadowVolumeOccluderList::iterator itr=_occluderList.begin(); itr!=_occluderList.end(); @@ -183,8 +183,8 @@ void CullStack::pushProjectionMatrix(RefMatrix* matrix) cullingSet.addOccluder(*itr); } } - - + + // need to recompute frustum volume. _frustumVolume = -1.0f; @@ -210,13 +210,13 @@ void CullStack::pushModelViewMatrix(RefMatrix* matrix, Transform::ReferenceFrame osg::RefMatrix* originalModelView = _modelviewStack.empty() ? 0 : _modelviewStack.back().get(); _modelviewStack.push_back(matrix); - + pushCullingSet(); - + osg::Matrix inv; inv.invert(*matrix); - + switch(referenceFrame) { case(Transform::RELATIVE_RF): @@ -232,7 +232,7 @@ void CullStack::pushModelViewMatrix(RefMatrix* matrix, Transform::ReferenceFrame case(Transform::ABSOLUTE_RF_INHERIT_VIEWPOINT): { _eyePointStack.push_back(inv.getTrans()); - + osg::Vec3 referenceViewPoint = getReferenceViewPoint(); if (originalModelView) { @@ -249,20 +249,20 @@ void CullStack::pushModelViewMatrix(RefMatrix* matrix, Transform::ReferenceFrame } - osg::Vec3 lookVector = getLookVectorLocal(); - + osg::Vec3 lookVector = getLookVectorLocal(); + _bbCornerFar = (lookVector.x()>=0?1:0) | (lookVector.y()>=0?2:0) | (lookVector.z()>=0?4:0); _bbCornerNear = (~_bbCornerFar)&7; - + } void CullStack::popModelViewMatrix() { _modelviewStack.pop_back(); - + _eyePointStack.pop_back(); _referenceViewPoints.pop_back(); _viewPointStack.pop_back(); @@ -299,5 +299,5 @@ void CullStack::computeFrustumVolume() _frustumVolume = computeVolume(f1,f2,f3,b1,b2,b3)+ computeVolume(f2,f3,f4,b1,b3,b4); - + } diff --git a/src/osg/CullingSet.cpp b/src/osg/CullingSet.cpp index 5ab7f79b4..e868ab05e 100644 --- a/src/osg/CullingSet.cpp +++ b/src/osg/CullingSet.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -36,7 +36,7 @@ void CullingSet::disableAndPushOccludersCurrentMask(NodePath& nodePath) { //std::cout<<" ++ disabling occluder "<disableResultMasks(); itr->pushCurrentMask(); @@ -57,7 +57,7 @@ void CullingSet::popOccludersCurrentMask(NodePath& nodePath) { //std::cout<<" popping occluder "<popCurrentMask(); } diff --git a/src/osg/DeleteHandler.cpp b/src/osg/DeleteHandler.cpp index 9c4b1e9d8..318588e9a 100644 --- a/src/osg/DeleteHandler.cpp +++ b/src/osg/DeleteHandler.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -48,7 +48,7 @@ void DeleteHandler::flush() deletionList.push_back(itr->second); - itr->second = 0; + itr->second = 0; } _objectsToDelete.erase( _objectsToDelete.begin(), itr); @@ -82,7 +82,7 @@ void DeleteHandler::flushAll() ++itr) { deletionList.push_back(itr->second); - itr->second = 0; + itr->second = 0; } _objectsToDelete.erase( _objectsToDelete.begin(), _objectsToDelete.end()); diff --git a/src/osg/Depth.cpp b/src/osg/Depth.cpp index c295929c6..32b09cdad 100644 --- a/src/osg/Depth.cpp +++ b/src/osg/Depth.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/DisplaySettings.cpp b/src/osg/DisplaySettings.cpp index c8ed6b4ce..04ddf97ec 100644 --- a/src/osg/DisplaySettings.cpp +++ b/src/osg/DisplaySettings.cpp @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -38,7 +38,7 @@ DisplaySettings::~DisplaySettings() { } - + DisplaySettings& DisplaySettings::operator = (const DisplaySettings& vs) { if (this==&vs) return *this; @@ -61,7 +61,7 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs) _splitStereoVerticalEyeMapping = vs._splitStereoVerticalEyeMapping; _splitStereoVerticalSeparation = vs._splitStereoVerticalSeparation; - + _splitStereoAutoAdjustAspectRatio = vs._splitStereoAutoAdjustAspectRatio; _doubleBuffer = vs._doubleBuffer; @@ -76,13 +76,13 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs) _maxNumOfGraphicsContexts = vs._maxNumOfGraphicsContexts; _numMultiSamples = vs._numMultiSamples; - + _compileContextsHint = vs._compileContextsHint; _serializeDrawDispatch = vs._serializeDrawDispatch; - + _numDatabaseThreadsHint = vs._numDatabaseThreadsHint; _numHttpDatabaseThreadsHint = vs._numHttpDatabaseThreadsHint; - + _application = vs._application; _maxTexturePoolSize = vs._maxTexturePoolSize; @@ -100,13 +100,13 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs) void DisplaySettings::merge(const DisplaySettings& vs) { if (_stereo || vs._stereo) _stereo = true; - + // need to think what to do about merging the stereo mode. - + if (_doubleBuffer || vs._doubleBuffer) _doubleBuffer = true; if (_RGB || vs._RGB) _RGB = true; if (_depthBuffer || vs._depthBuffer) _depthBuffer = true; - + if (vs._minimumNumberAlphaBits>_minimumNumberAlphaBits) _minimumNumberAlphaBits = vs._minimumNumberAlphaBits; if (vs._minimumNumberStencilBits>_minimumNumberStencilBits) _minimumNumberStencilBits = vs._minimumNumberStencilBits; if (vs._numMultiSamples>_numMultiSamples) _numMultiSamples = vs._numMultiSamples; @@ -122,7 +122,7 @@ void DisplaySettings::merge(const DisplaySettings& vs) if (vs._maxTexturePoolSize>_maxTexturePoolSize) _maxTexturePoolSize = vs._maxTexturePoolSize; if (vs._maxBufferObjectPoolSize>_maxBufferObjectPoolSize) _maxBufferObjectPoolSize = vs._maxBufferObjectPoolSize; - // these are bit masks so merging them is like logical or + // these are bit masks so merging them is like logical or _implicitBufferAttachmentRenderMask |= vs._implicitBufferAttachmentRenderMask; _implicitBufferAttachmentResolveMask |= vs._implicitBufferAttachmentResolveMask; @@ -159,7 +159,7 @@ void DisplaySettings::setDefaults() _minimumNumberAccumGreenBits = 0; _minimumNumberAccumBlueBits = 0; _minimumNumberAccumAlphaBits = 0; - + _maxNumOfGraphicsContexts = 32; _numMultiSamples = 0; @@ -167,7 +167,7 @@ void DisplaySettings::setDefaults() // switch on anti-aliasing by default, just in case we have an Onyx :-) _numMultiSamples = 4; #endif - + _compileContextsHint = false; _serializeDrawDispatch = true; @@ -291,7 +291,7 @@ static ApplicationUsageProxy DisplaySetting_e26(ApplicationUsage::ENVIRONMENTAL_ void DisplaySettings::readEnvironmentalVariables() { const char* ptr = 0; - + if ((ptr = getenv("OSG_DISPLAY_TYPE")) != 0) { if (strcmp(ptr,"MONITOR")==0) @@ -314,7 +314,7 @@ void DisplaySettings::readEnvironmentalVariables() _displayType = HEAD_MOUNTED_DISPLAY; } } - + if( (ptr = getenv("OSG_STEREO_MODE")) != 0) { if (strcmp(ptr,"QUAD_BUFFER")==0) @@ -419,7 +419,7 @@ void DisplaySettings::readEnvironmentalVariables() _splitStereoVerticalEyeMapping = LEFT_EYE_BOTTOM_VIEWPORT; } } - + if( (ptr = getenv("OSG_SPLIT_STEREO_AUTO_ADJUST_ASPECT_RATIO")) != 0) { if (strcmp(ptr,"OFF")==0) @@ -455,7 +455,7 @@ void DisplaySettings::readEnvironmentalVariables() _compileContextsHint = true; } } - + if( (ptr = getenv("OSG_SERIALIZE_DRAW_DISPATCH")) != 0) { if (strcmp(ptr,"OFF")==0) @@ -623,7 +623,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments) { _RGB = true; _minimumNumberAlphaBits = 1; - } + } while (arguments.read("--stencil")) { @@ -668,7 +668,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments) "--implicit-buffer-attachment-resolve-mask", }; - int * mask[] = { + int * mask[] = { &_implicitBufferAttachmentRenderMask, &_implicitBufferAttachmentResolveMask, }; diff --git a/src/osg/DrawPixels.cpp b/src/osg/DrawPixels.cpp index 8c94b4500..6b335b808 100644 --- a/src/osg/DrawPixels.cpp +++ b/src/osg/DrawPixels.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -18,12 +18,12 @@ DrawPixels::DrawPixels() { // turn off display lists right now, just incase we want to modify the projection matrix along the way. setSupportsDisplayList(false); - + _position.set(0.0f,0.0f,0.0f); - + _useSubImage = false; _offsetX = 0; - _offsetY = 0; + _offsetY = 0; _width = 0; _height = 0; } @@ -33,7 +33,7 @@ DrawPixels::DrawPixels(const DrawPixels& drawimage,const CopyOp& copyop): _position(drawimage._position), _image(drawimage._image), _useSubImage(drawimage._useSubImage), - _offsetX(drawimage._offsetX), + _offsetX(drawimage._offsetX), _offsetY(drawimage._offsetY), _width(drawimage._width), _height(drawimage._height) @@ -55,7 +55,7 @@ void DrawPixels::setSubImageDimensions(unsigned int offsetX,unsigned int offsetY { _useSubImage = true; _offsetX = offsetX; - _offsetY = offsetY; + _offsetY = offsetY; _width = width; _height = height; } @@ -63,7 +63,7 @@ void DrawPixels::setSubImageDimensions(unsigned int offsetX,unsigned int offsetY void DrawPixels::getSubImageDimensions(unsigned int& offsetX,unsigned int& offsetY,unsigned int& width,unsigned int& height) const { offsetX = _offsetX; - offsetY = _offsetY; + offsetY = _offsetY; width = _width; height = _height; } @@ -82,7 +82,7 @@ BoundingBox DrawPixels::computeBound() const { diagonal = sqrtf(_image->s()*_image->s()+_image->t()*_image->t()); } - + bbox.expandBy(_position-osg::Vec3(diagonal,diagonal,diagonal)); bbox.expandBy(_position+osg::Vec3(diagonal,diagonal,diagonal)); return bbox; diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 302c821eb..6714dc62e 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -36,7 +36,7 @@ unsigned int Drawable::s_numberDrawablesReusedLastInLastFrame = 0; unsigned int Drawable::s_numberNewDrawablesInLastFrame = 0; unsigned int Drawable::s_numberDeletedDrawablesInLastFrame = 0; -// static cache of deleted display lists which can only +// static cache of deleted display lists which can only // by completely deleted once the appropriate OpenGL context // is set. Used osg::Drawable::deleteDisplayList(..) and flushDeletedDisplayLists(..) below. typedef std::multimap DisplayListMap; @@ -56,7 +56,7 @@ GLuint Drawable::generateDisplayList(unsigned int contextID, unsigned int sizeHi ++s_numberNewDrawablesInLastFrame; return glGenLists( 1 ); } - else + else { DisplayListMap::iterator itr = dll.lower_bound(sizeHint); if (itr!=dll.end()) @@ -64,12 +64,12 @@ GLuint Drawable::generateDisplayList(unsigned int contextID, unsigned int sizeHi // OSG_NOTICE<<"Reusing a display list of size = "<first<<" for requested size = "<second; dll.erase(itr); - + return globj; - } + } else { // OSG_NOTICE<<"Creating a new display list of size = "<second,1); } - dll.clear(); + dll.clear(); #else OSG_NOTICE<<"Warning: Drawable::deleteDisplayList(..) - not supported."< lock(s_mutex_deletedDisplayListCache); DisplayListMap& dll = s_deletedDisplayListCache[contextID]; - dll.clear(); + dll.clear(); } void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availableTime) @@ -178,7 +178,7 @@ void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availabl if (noDeleted+dll.size() != prev_size) { OSG_WARN<<"Error in delete"<removeParent(this); if (_stateset->requiresUpdateTraversal()) --delta_update; if (_stateset->requiresEventTraversal()) --delta_event; } - + // set the stateset. _stateset = stateset; - + // add this node to the new stateset to the parent list. if (_stateset.valid()) { @@ -344,7 +344,7 @@ void Drawable::setStateSet(osg::StateSet* stateset) if (_stateset->requiresUpdateTraversal()) ++delta_update; if (_stateset->requiresEventTraversal()) ++delta_event; } - + // only inform parents if change occurs and drawable doesn't already have an update callback if (delta_update!=0 && !_updateCallback) @@ -381,7 +381,7 @@ void Drawable::setNumChildrenRequiringUpdateTraversal(unsigned int num) // _numChildrenRequiringUpdateTraversal so no need to inform them. if (!_updateCallback && !_parents.empty()) { - // need to pass on changes to parents. + // need to pass on changes to parents. int delta = 0; if (_numChildrenRequiringUpdateTraversal>0) --delta; if (num>0) ++delta; @@ -393,16 +393,16 @@ void Drawable::setNumChildrenRequiringUpdateTraversal(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenRequiringUpdateTraversal( (*itr)->getNumChildrenRequiringUpdateTraversal()+delta ); } } } - + // finally update this objects value. _numChildrenRequiringUpdateTraversal=num; - + } @@ -416,7 +416,7 @@ void Drawable::setNumChildrenRequiringEventTraversal(unsigned int num) // _numChildrenRequiringEventTraversal so no need to inform them. if (!_eventCallback && !_parents.empty()) { - // need to pass on changes to parents. + // need to pass on changes to parents. int delta = 0; if (_numChildrenRequiringEventTraversal>0) --delta; if (num>0) ++delta; @@ -428,16 +428,16 @@ void Drawable::setNumChildrenRequiringEventTraversal(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenRequiringEventTraversal( (*itr)->getNumChildrenRequiringEventTraversal()+delta ); } } } - + // finally Event this objects value. _numChildrenRequiringEventTraversal=num; - + } osg::StateSet* Drawable::getOrCreateStateSet() @@ -468,7 +468,7 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const if (!_useDisplayList) return; #ifdef OSG_GL_DISPLAYLISTS_AVAILABLE - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. unsigned int contextID = renderInfo.getContextID(); @@ -477,7 +477,7 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const // call the globj if already set otherwise compile and execute. if( globj != 0 ) - { + { glDeleteLists( globj, 1 ); } @@ -486,7 +486,7 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const if (_drawCallback.valid()) _drawCallback->drawImplementation(renderInfo,this); - else + else drawImplementation(renderInfo); glEndList(); @@ -521,10 +521,10 @@ void Drawable::releaseGLObjects(State* state) const if (_drawCallback.valid()) _drawCallback->releaseGLObjects(state); if (!_useDisplayList) return; - + if (state) { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. unsigned int contextID = state->getContextID(); @@ -536,7 +536,7 @@ void Drawable::releaseGLObjects(State* state) const { Drawable::deleteDisplayList(contextID,globj, getGLObjectSizeHint()); globj = 0; - } + } } else { @@ -561,7 +561,7 @@ void Drawable::setSupportsDisplayList(bool flag) _useDisplayList = false; } } - + // set with new value. _supportsDisplayList=flag; #else @@ -580,13 +580,13 @@ void Drawable::setUseDisplayList(bool flag) { dirtyDisplayList(); } - + if (_supportsDisplayList) { - + // set with new value. _useDisplayList = flag; - + } else // does not support display lists. { @@ -594,7 +594,7 @@ void Drawable::setUseDisplayList(bool flag) { OSG_WARN<<"Warning: attempt to setUseDisplayList(true) on a drawable with does not support display lists."<requiresUpdateTraversal())) { for(ParentList::iterator itr=_parents.begin(); @@ -664,13 +664,13 @@ void Drawable::setUpdateCallback(UpdateCallback* ac) void Drawable::setEventCallback(EventCallback* ac) { if (_eventCallback==ac) return; - + int delta = 0; if (_eventCallback.valid()) --delta; if (ac) ++delta; _eventCallback = ac; - + if (delta!=0 && !(_stateset.valid() && _stateset->requiresEventTraversal())) { for(ParentList::iterator itr=_parents.begin(); @@ -687,10 +687,10 @@ struct ComputeBound : public PrimitiveFunctor ComputeBound() { _vertices2f = 0; - _vertices3f = 0; + _vertices3f = 0; _vertices4f = 0; - _vertices2d = 0; - _vertices3d = 0; + _vertices2d = 0; + _vertices3d = 0; _vertices4d = 0; } @@ -775,14 +775,14 @@ struct ComputeBound : public PrimitiveFunctor virtual void vertex(double x,double y,double z) { _bb.expandBy(x,y,z); } virtual void vertex(double x,double y,double z,double w) { if (w!=0.0f) _bb.expandBy(x/w,y/w,z/w); } virtual void end() {} - + const Vec2* _vertices2f; const Vec3* _vertices3f; const Vec4* _vertices4f; const Vec2d* _vertices2d; const Vec3d* _vertices3d; const Vec4d* _vertices4d; - BoundingBox _bb; + BoundingBox _bb; }; BoundingBox Drawable::computeBound() const @@ -792,12 +792,12 @@ BoundingBox Drawable::computeBound() const Drawable* non_const_this = const_cast(this); non_const_this->accept(cb); -#if 0 +#if 0 OSG_NOTICE<<"computeBound() "< @@ -51,7 +51,7 @@ void Fog::apply(State& state) const glFogf( GL_FOG_START, _start ); glFogf( GL_FOG_END, _end ); glFogfv( GL_FOG_COLOR, (GLfloat*)_color.ptr() ); - + static bool fogCoordExtensionSupported = osg::isGLExtensionSupported(state.getContextID(),"GL_EXT_fog_coord"); if (fogCoordExtensionSupported) { diff --git a/src/osg/FragmentProgram.cpp b/src/osg/FragmentProgram.cpp index bf2a7344a..17a1462eb 100644 --- a/src/osg/FragmentProgram.cpp +++ b/src/osg/FragmentProgram.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -23,7 +23,7 @@ using namespace osg; -// static cache of deleted fragment programs which can only +// static cache of deleted fragment programs which can only // by completely deleted once the appropriate OpenGL context // is set. typedef std::list FragmentProgramObjectList; @@ -69,7 +69,7 @@ void FragmentProgram::flushDeletedFragmentProgramObjects(unsigned int contextID, elapsedTime = timer.delta_s(start_tick,timer.tick()); } } - + availableTime -= elapsedTime; } @@ -91,13 +91,13 @@ FragmentProgram::FragmentProgram(const FragmentProgram& vp,const CopyOp& copyop) { _fragmentProgram = vp._fragmentProgram; - for( LocalParamList::const_iterator itr = vp._programLocalParameters.begin(); + for( LocalParamList::const_iterator itr = vp._programLocalParameters.begin(); itr != vp._programLocalParameters.end(); ++itr ) { _programLocalParameters[itr->first] = itr->second; } - for( MatrixList::const_iterator mitr = vp._matrixList.begin(); + for( MatrixList::const_iterator mitr = vp._matrixList.begin(); mitr != vp._matrixList.end(); ++mitr ) { _matrixList[mitr->first] = mitr->second; @@ -278,7 +278,7 @@ void FragmentProgram::Extensions::glBindProgram(GLenum target, GLuint id) const else { OSG_WARN<<"Error: glBindProgram not supported by OpenGL driver"<glGenRenderbuffers(1, &objectID); - if (objectID == 0) + if (objectID == 0) return 0; dirty = 1; } @@ -335,7 +335,7 @@ struct FrameBufferAttachment::Pimpl TEXTURE2DARRAY, TEXTURE2DMULTISAMPLE }; - + TargetType targetType; ref_ptr renderbufferTarget; ref_ptr textureTarget; @@ -426,7 +426,7 @@ FrameBufferAttachment::FrameBufferAttachment(TextureRectangle* target) FrameBufferAttachment::FrameBufferAttachment(Camera::Attachment& attachment) { osg::Texture* texture = attachment._texture.get(); - + if (texture) { osg::Texture1D* texture1D = dynamic_cast(texture); @@ -461,7 +461,7 @@ FrameBufferAttachment::FrameBufferAttachment(Camera::Attachment& attachment) _ximpl->zoffset = attachment._face; return; } - + osg::Texture2DArray* texture2DArray = dynamic_cast(texture); if (texture2DArray) { @@ -556,9 +556,9 @@ void FrameBufferAttachment::createRequiredTexturesAndApplyGenerateMipMap(State & return; Texture::FilterMode minFilter = _ximpl->textureTarget->getFilter(Texture::MIN_FILTER); - if (minFilter==Texture::LINEAR_MIPMAP_LINEAR || - minFilter==Texture::LINEAR_MIPMAP_NEAREST || - minFilter==Texture::NEAREST_MIPMAP_LINEAR || + if (minFilter==Texture::LINEAR_MIPMAP_LINEAR || + minFilter==Texture::LINEAR_MIPMAP_NEAREST || + minFilter==Texture::NEAREST_MIPMAP_LINEAR || minFilter==Texture::NEAREST_MIPMAP_NEAREST) { state.setActiveTextureUnit(0); @@ -586,7 +586,7 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen if (!tobj || tobj->id() == 0) return; } - + switch (_ximpl->targetType) { default: @@ -858,8 +858,8 @@ void FrameBufferObject::apply(State &state, BindTarget target) const if (_unsupported[contextID]) return; - - + + FBOExtensions* ext = FBOExtensions::instance(contextID,true); if (!ext->isSupported()) { @@ -892,7 +892,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const if (dirtyAttachmentList) { - // the set of of attachments appears to be thread sensitive, it shouldn't be because + // the set of of attachments appears to be thread sensitive, it shouldn't be because // OpenGL FBO handles osg::FrameBufferObject has are multi-buffered... // so as a temporary fix will stick in a mutex to ensure that only one thread passes through here // at one time. @@ -907,8 +907,8 @@ void FrameBufferObject::apply(State &state, BindTarget target) const } } - - + + ext->glBindFramebuffer(target, fboID); // enable drawing buffers to render the result to fbo @@ -936,7 +936,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const } else { - OSG_WARN << + OSG_WARN << "Warning: FrameBufferObject: could not attach PACKED_DEPTH_STENCIL_BUFFER, " "EXT_packed_depth_stencil is not supported !" << std::endl; } @@ -946,7 +946,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const fa.attach(state, target, convertBufferComponentToGLenum(i->first), ext); break; } - } + } dirtyAttachmentList = 0; } diff --git a/src/osg/FrameStamp.cpp b/src/osg/FrameStamp.cpp index a6ddb41c2..5e74067b2 100644 --- a/src/osg/FrameStamp.cpp +++ b/src/osg/FrameStamp.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -36,7 +36,7 @@ FrameStamp::FrameStamp(const FrameStamp& fs):Referenced(true) _frameNumber = fs._frameNumber; _referenceTime = fs._referenceTime; _simulationTime = fs._simulationTime; - + tm_sec = fs.tm_sec; /* Seconds. [0-60] (1 leap second) */ tm_min = fs.tm_min; /* Minutes. [0-59] */ tm_hour = fs.tm_hour; /* Hours. [0-23] */ @@ -59,7 +59,7 @@ FrameStamp& FrameStamp::operator = (const FrameStamp& fs) _frameNumber = fs._frameNumber; _referenceTime = fs._referenceTime; _simulationTime = fs._simulationTime; - + tm_sec = fs.tm_sec; /* Seconds. [0-60] (1 leap second) */ tm_min = fs.tm_min; /* Minutes. [0-59] */ tm_hour = fs.tm_hour; /* Hours. [0-23] */ diff --git a/src/osg/FrontFace.cpp b/src/osg/FrontFace.cpp index 124832a49..2b63aba14 100644 --- a/src/osg/FrontFace.cpp +++ b/src/osg/FrontFace.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/GL2Extensions.cpp b/src/osg/GL2Extensions.cpp index 1a34111d7..1aa8de9cb 100644 --- a/src/osg/GL2Extensions.cpp +++ b/src/osg/GL2Extensions.cpp @@ -1,12 +1,12 @@ -/* -*-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) 2004-2005 Nathan Cournia * Copyright (C) 2008 Zebra Imaging * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -516,12 +516,12 @@ void GL2Extensions::setupGL2Extensions(unsigned int contextID) return; } - + _glVersion = findAsciiToFloat( version ); _glslLanguageVersion = 0.0f; - + bool shadersBuiltIn = OSG_GLES2_FEATURES || OSG_GL3_FEATURES; - + _isShaderObjectsSupported = shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_shader_objects"); _isVertexShaderSupported = shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_vertex_shader"); _isFragmentShaderSupported = shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_fragment_shader"); @@ -531,7 +531,7 @@ void GL2Extensions::setupGL2Extensions(unsigned int contextID) _areTessellationShadersSupported = osg::isGLExtensionSupported(contextID, "GL_ARB_tessellation_shader"); _isUniformBufferObjectSupported = osg::isGLExtensionSupported(contextID,"GL_ARB_uniform_buffer_object"); _isGetProgramBinarySupported = osg::isGLExtensionSupported(contextID,"GL_ARB_get_program_binary"); - + if( isGlslSupported() ) { // If glGetString raises an error, assume initial release "1.00" diff --git a/src/osg/GLBeginEndAdapter.cpp b/src/osg/GLBeginEndAdapter.cpp index fc835d413..ae6ca8f3d 100644 --- a/src/osg/GLBeginEndAdapter.cpp +++ b/src/osg/GLBeginEndAdapter.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -284,7 +284,7 @@ void GLBeginEndAdapter::End() _state->applyDisablingOfVertexAttributes(); - if (_primitiveMode==GL_QUADS) + if (_primitiveMode==GL_QUADS) { _state->drawQuads(0, _vertices->size()); } diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index 52ddf9383..371081140 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -81,7 +81,7 @@ bool osg::isExtensionInExtensionString(const char *extension, const char *extens } if (*startOfWord && strcmp(extension, startOfWord) == 0) return true; - + return false; } @@ -97,9 +97,9 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex // first check to see if GL version number of recent enough. bool result = requiredGLVersion <= osg::getGLVersionNumber(); - + if (!result) - { + { // if not already set up, initialize all the per graphic context values. if (!s_glInitializedList[contextID]) { @@ -187,7 +187,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex } if (wglextensions) - { + { const char* startOfWord = wglextensions; const char* endOfWord; while ((endOfWord = strchr(startOfWord, ' '))) @@ -213,7 +213,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex // true if extension found in extensionSet. result = extensionSet.find(extension)!=extensionSet.end(); } - + // now see if extension is in the extension disabled list bool extensionDisabled = false; if (result) @@ -222,13 +222,13 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex const std::string& disableString = getGLExtensionDisableString(); if (!disableString.empty()) { - + std::string::size_type pos=0; while ( pos!=std::string::npos && (pos=disableString.find(extension,pos))!=std::string::npos ) { std::string::size_type previousColon = disableString.find_last_of(':',pos); std::string::size_type previousSemiColon = disableString.find_last_of(';',pos); - + std::string renderer = ""; if (previousColon!=std::string::npos) { @@ -238,7 +238,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex if (!renderer.empty()) { - + // remove leading spaces if they exist. std::string::size_type leadingSpaces = renderer.find_first_not_of(' '); if (leadingSpaces==std::string::npos) renderer = ""; // nothing but spaces @@ -249,20 +249,20 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex if (trailingSpaces!=std::string::npos) renderer.erase(trailingSpaces+1,std::string::npos); } - + if (renderer.empty()) { extensionDisabled = true; break; } - + if (rendererString.find(renderer)!=std::string::npos) { extensionDisabled = true; break; - + } - + // move the position in the disable string along so that the same extension is found multiple times ++pos; } diff --git a/src/osg/GLObjects.cpp b/src/osg/GLObjects.cpp index 2090e8a23..195e682c3 100644 --- a/src/osg/GLObjects.cpp +++ b/src/osg/GLObjects.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/GLStaticLibrary.cpp b/src/osg/GLStaticLibrary.cpp index 72cae0739..1822360a3 100644 --- a/src/osg/GLStaticLibrary.cpp +++ b/src/osg/GLStaticLibrary.cpp @@ -1,12 +1,12 @@ -/* -*-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) 2004-2005 Nathan Cournia * Copyright (C) 2008 Zebra Imaging * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/src/osg/Geode.cpp b/src/osg/Geode.cpp index 132506476..4b740e8b4 100644 --- a/src/osg/Geode.cpp +++ b/src/osg/Geode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -53,22 +53,22 @@ bool Geode::addDrawable( Drawable *drawable ) { // note ref_ptr<> automatically handles incrementing drawable's reference count. _drawables.push_back(drawable); - + // register as parent of drawable. drawable->addParent(this); - + if (drawable->requiresUpdateTraversal()) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } - + if (drawable->requiresEventTraversal()) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()+1); } - dirtyBound(); - + dirtyBound(); + return true; } else return false; @@ -109,14 +109,14 @@ bool Geode::removeDrawables(unsigned int pos,unsigned int numDrawablesToRemove) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-updateCallbackRemoved); } - + if (eventCallbackRemoved) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-eventCallbackRemoved); } dirtyBound(); - + return true; } else return false; @@ -138,7 +138,7 @@ bool Geode::setDrawable( unsigned int i, Drawable* newDrawable ) { if (i<_drawables.size() && newDrawable) { - + Drawable* origDrawable = _drawables[i].get(); int deltaUpdate = 0; @@ -160,7 +160,7 @@ bool Geode::setDrawable( unsigned int i, Drawable* newDrawable ) // remove from origDrawable's parent list. origDrawable->removeParent(this); - + // note ref_ptr<> automatically handles decrementing origGset's reference count, // and incrementing newGset's reference count. _drawables[i] = newDrawable; @@ -170,7 +170,7 @@ bool Geode::setDrawable( unsigned int i, Drawable* newDrawable ) dirtyBound(); - + return true; } else return false; @@ -212,7 +212,7 @@ void Geode::compileDrawables(RenderInfo& renderInfo) void Geode::setThreadSafeRefUnref(bool threadSafe) { Node::setThreadSafeRefUnref(threadSafe); - + for(DrawableList::const_iterator itr=_drawables.begin(); itr!=_drawables.end(); ++itr) diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 213179e04..0e54e8812 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -92,14 +92,14 @@ Geometry::Geometry(const Geometry& geometry,const CopyOp& copyop): setUseVertexBufferObjects(true); } } - + } Geometry::~Geometry() { // do dirty here to keep the getGLObjectSizeHint() estimate on the ball dirtyDisplayList(); - + // no need to delete, all automatically handled by ref_ptr :-) } @@ -118,9 +118,9 @@ bool Geometry::empty() const void Geometry::setVertexArray(Array* array) { - _vertexData.array = array; - computeFastPathsUsed(); - dirtyDisplayList(); + _vertexData.array = array; + computeFastPathsUsed(); + dirtyDisplayList(); dirtyBound(); if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array); @@ -128,17 +128,17 @@ void Geometry::setVertexArray(Array* array) void Geometry::setVertexIndices(IndexArray* array) { - _vertexData.indices = array; - computeFastPathsUsed(); - dirtyDisplayList(); + _vertexData.indices = array; + computeFastPathsUsed(); + dirtyDisplayList(); dirtyBound(); } void Geometry::setVertexData(const ArrayData& arrayData) { - _vertexData = arrayData; - computeFastPathsUsed(); - dirtyDisplayList(); + _vertexData = arrayData; + computeFastPathsUsed(); + dirtyDisplayList(); dirtyBound(); if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get()); @@ -146,9 +146,9 @@ void Geometry::setVertexData(const ArrayData& arrayData) void Geometry::setNormalArray(Array* array) { - _normalData.array = array; - if (!_normalData.array.valid()) _normalData.binding=BIND_OFF; - computeFastPathsUsed(); + _normalData.array = array; + if (!_normalData.array.valid()) _normalData.binding=BIND_OFF; + computeFastPathsUsed(); dirtyDisplayList(); if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array); @@ -156,15 +156,15 @@ void Geometry::setNormalArray(Array* array) void Geometry::setNormalIndices(IndexArray* array) { - _normalData.indices = array; - computeFastPathsUsed(); - dirtyDisplayList(); + _normalData.indices = array; + computeFastPathsUsed(); + dirtyDisplayList(); } void Geometry::setNormalData(const ArrayData& arrayData) { - _normalData = arrayData; - computeFastPathsUsed(); + _normalData = arrayData; + computeFastPathsUsed(); dirtyDisplayList(); if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get()); @@ -173,8 +173,8 @@ void Geometry::setNormalData(const ArrayData& arrayData) void Geometry::setColorArray(Array* array) { _colorData.array = array; - if (!_colorData.array.valid()) _colorData.binding=BIND_OFF; - computeFastPathsUsed(); + if (!_colorData.array.valid()) _colorData.binding=BIND_OFF; + computeFastPathsUsed(); dirtyDisplayList(); if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array); @@ -182,15 +182,15 @@ void Geometry::setColorArray(Array* array) void Geometry::setColorIndices(IndexArray* array) { - _colorData.indices = array; - computeFastPathsUsed(); - dirtyDisplayList(); + _colorData.indices = array; + computeFastPathsUsed(); + dirtyDisplayList(); } void Geometry::setColorData(const ArrayData& arrayData) { - _colorData = arrayData; - computeFastPathsUsed(); + _colorData = arrayData; + computeFastPathsUsed(); dirtyDisplayList(); if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get()); @@ -199,9 +199,9 @@ void Geometry::setColorData(const ArrayData& arrayData) void Geometry::setSecondaryColorArray(Array* array) { - _secondaryColorData.array = array; - if (!_secondaryColorData.array.valid()) _secondaryColorData.binding=BIND_OFF; - computeFastPathsUsed(); + _secondaryColorData.array = array; + if (!_secondaryColorData.array.valid()) _secondaryColorData.binding=BIND_OFF; + computeFastPathsUsed(); dirtyDisplayList(); if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array); @@ -209,15 +209,15 @@ void Geometry::setSecondaryColorArray(Array* array) void Geometry::setSecondaryColorIndices(IndexArray* array) { - _secondaryColorData.indices = array; - computeFastPathsUsed(); + _secondaryColorData.indices = array; + computeFastPathsUsed(); dirtyDisplayList(); } void Geometry::setSecondaryColorData(const ArrayData& arrayData) { - _secondaryColorData = arrayData; - computeFastPathsUsed(); + _secondaryColorData = arrayData; + computeFastPathsUsed(); dirtyDisplayList(); if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get()); @@ -225,37 +225,37 @@ void Geometry::setSecondaryColorData(const ArrayData& arrayData) void Geometry::setFogCoordArray(Array* array) { - _fogCoordData.array = array; - if (!_fogCoordData.array.valid()) _fogCoordData.binding=BIND_OFF; - computeFastPathsUsed(); - dirtyDisplayList(); + _fogCoordData.array = array; + if (!_fogCoordData.array.valid()) _fogCoordData.binding=BIND_OFF; + computeFastPathsUsed(); + dirtyDisplayList(); if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array); } void Geometry::setFogCoordIndices(IndexArray* array) { - _fogCoordData.indices = array; - computeFastPathsUsed(); + _fogCoordData.indices = array; + computeFastPathsUsed(); dirtyDisplayList(); } void Geometry::setFogCoordData(const ArrayData& arrayData) { - _fogCoordData = arrayData; - computeFastPathsUsed(); + _fogCoordData = arrayData; + computeFastPathsUsed(); dirtyDisplayList(); if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get()); } -void Geometry::setNormalBinding(AttributeBinding ab) +void Geometry::setNormalBinding(AttributeBinding ab) { if (_normalData.binding == ab) return; - + _normalData.binding = ab; computeFastPathsUsed(); - dirtyDisplayList(); + dirtyDisplayList(); } void Geometry::setColorBinding(AttributeBinding ab) @@ -264,7 +264,7 @@ void Geometry::setColorBinding(AttributeBinding ab) _colorData.binding = ab; computeFastPathsUsed(); - dirtyDisplayList(); + dirtyDisplayList(); } void Geometry::setSecondaryColorBinding(AttributeBinding ab) @@ -273,7 +273,7 @@ void Geometry::setSecondaryColorBinding(AttributeBinding ab) _secondaryColorData.binding = ab; computeFastPathsUsed(); - dirtyDisplayList(); + dirtyDisplayList(); } void Geometry::setFogCoordBinding(AttributeBinding ab) @@ -282,14 +282,14 @@ void Geometry::setFogCoordBinding(AttributeBinding ab) _fogCoordData.binding = ab; computeFastPathsUsed(); - dirtyDisplayList(); + dirtyDisplayList(); } void Geometry::setTexCoordData(unsigned int unit,const ArrayData& arrayData) { if (_texCoordList.size()<=unit) _texCoordList.resize(unit+1); - + _texCoordList[unit] = arrayData; if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get()); @@ -299,7 +299,7 @@ Geometry::ArrayData& Geometry::getTexCoordData(unsigned int unit) { if (_texCoordList.size()<=unit) _texCoordList.resize(unit+1); - + return _texCoordList[unit]; } @@ -307,7 +307,7 @@ const Geometry::ArrayData& Geometry::getTexCoordData(unsigned int unit) const { if (_texCoordList.size()<=unit) return s_InvalidArrayData; - + return _texCoordList[unit]; } @@ -362,9 +362,9 @@ void Geometry::setVertexAttribData(unsigned int index, const Geometry::ArrayData { if (_vertexAttribList.size()<=index) _vertexAttribList.resize(index+1); - + _vertexAttribList[index] = attrData; - + computeFastPathsUsed(); dirtyDisplayList(); @@ -375,7 +375,7 @@ Geometry::ArrayData& Geometry::getVertexAttribData(unsigned int index) { if (_vertexAttribList.size()<=index) _vertexAttribList.resize(index+1); - + return _vertexAttribList[index]; } @@ -383,7 +383,7 @@ const Geometry::ArrayData& Geometry::getVertexAttribData(unsigned int index) con { if (_vertexAttribList.size()<=_vertexAttribList.size()) return s_InvalidArrayData; - + return _vertexAttribList[index]; } @@ -505,7 +505,7 @@ bool Geometry::insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset) { return addPrimitiveSet(primitiveset); } - + } OSG_WARN<<"Warning: invalid index i or primitiveset passed to osg::Geometry::insertPrimitiveSet(i,primitiveset), ignoring call."<getNumElements()>0 && - idxArray && idxArray->getNumElements()>0 ) + idxArray && idxArray->getNumElements()>0 ) { _fastPath = false; break; @@ -611,15 +611,15 @@ bool Geometry::computeFastPathsUsed() { if (texcoordData.indices->getNumElements()>0) { - _fastPath = false; + _fastPath = false; break; } } } } - + _supportsVertexBufferObjects = _fastPath; - + //_supportsVertexBufferObjects = false; //_useVertexBufferObjects = false; @@ -655,7 +655,7 @@ unsigned int Geometry::getGLObjectSizeHint() const for( index = 0; index < _vertexAttribList.size(); ++index ) { const Array* array = _vertexAttribList[index].array.get(); - if (array) totalSize += array->getTotalDataSize(); + if (array) totalSize += array->getTotalDataSize(); } } @@ -676,13 +676,13 @@ unsigned int Geometry::getGLObjectSizeHint() const bool Geometry::getArrayList(ArrayList& arrayList) const { unsigned int startSize = arrayList.size(); - + if (_vertexData.array.valid()) arrayList.push_back(_vertexData.array.get()); if (_normalData.array.valid()) arrayList.push_back(_normalData.array.get()); if (_colorData.array.valid()) arrayList.push_back(_colorData.array.get()); if (_secondaryColorData.array.valid()) arrayList.push_back(_secondaryColorData.array.get()); if (_fogCoordData.array.valid()) arrayList.push_back(_fogCoordData.array.get()); - + for(unsigned int unit=0;unit<_texCoordList.size();++unit) { Array* array = _texCoordList[unit].array.get(); @@ -701,7 +701,7 @@ bool Geometry::getArrayList(ArrayList& arrayList) const bool Geometry::getDrawElementsList(DrawElementsList& drawElementsList) const { unsigned int startSize = drawElementsList.size(); - + for(PrimitiveSetList::const_iterator itr = _primitives.begin(); itr != _primitives.end(); ++itr) @@ -709,7 +709,7 @@ bool Geometry::getDrawElementsList(DrawElementsList& drawElementsList) const osg::DrawElements* de = (*itr)->getDrawElements(); if (de) drawElementsList.push_back(de); } - + return drawElementsList.size()!=startSize; } @@ -773,13 +773,13 @@ osg::ElementBufferObject* Geometry::getOrCreateElementBufferObject() void Geometry::setUseVertexBufferObjects(bool flag) { // flag = true; - + // OSG_NOTICE<<"Geometry::setUseVertexBufferObjects("< vbo; ArrayList::iterator vitr; @@ -818,10 +818,10 @@ void Geometry::setUseVertexBufferObjects(bool flag) } } - if (!drawElementsList.empty()) + if (!drawElementsList.empty()) { ElementBufferObjectList eboList; - + osg::ref_ptr ebo; DrawElementsList::iterator deitr; @@ -1006,7 +1006,7 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const return; } #endif - + if (_internalOptimizedGeometry.valid()) { _internalOptimizedGeometry->drawImplementation(renderInfo); @@ -1017,7 +1017,7 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const bool checkForGLErrors = state.getCheckForGLErrors()==osg::State::ONCE_PER_ATTRIBUTE; if (checkForGLErrors) state.checkGLErrors("start of Geometry::drawImplementation()"); - + bool useFastPath = areFastPathsUsed(); // useFastPath = false; @@ -1284,11 +1284,11 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const class AttributeFunctorArrayVisitor : public ArrayVisitor { public: - + AttributeFunctorArrayVisitor(Drawable::AttributeFunctor& af): _af(af), _type(0) {} - + virtual ~AttributeFunctorArrayVisitor() {} virtual void apply(ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } @@ -1306,8 +1306,8 @@ class AttributeFunctorArrayVisitor : public ArrayVisitor virtual void apply(Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } virtual void apply(Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } virtual void apply(Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } - - + + inline void applyArray(Drawable::AttributeType type,Array* array) { if (array) @@ -1317,8 +1317,8 @@ class AttributeFunctorArrayVisitor : public ArrayVisitor } } - protected: - + protected: + AttributeFunctorArrayVisitor& operator = (const AttributeFunctorArrayVisitor&) { return *this; } Drawable::AttributeFunctor& _af; Drawable::AttributeType _type; @@ -1342,7 +1342,7 @@ void Geometry::accept(AttributeFunctor& af) afav.applyArray(COLORS,_colorData.array.get()); afav.applyArray(SECONDARY_COLORS,_secondaryColorData.array.get()); afav.applyArray(FOG_COORDS,_fogCoordData.array.get()); - + for(unsigned unit=0;unit<_texCoordList.size();++unit) { afav.applyArray((AttributeType)(TEXTURE_COORDS_0+unit),_texCoordList[unit].array.get()); @@ -1357,11 +1357,11 @@ void Geometry::accept(AttributeFunctor& af) class ConstAttributeFunctorArrayVisitor : public ConstArrayVisitor { public: - + ConstAttributeFunctorArrayVisitor(Drawable::ConstAttributeFunctor& af): _af(af), _type(0) {} - + virtual ~ConstAttributeFunctorArrayVisitor() {} virtual void apply(const ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } @@ -1379,8 +1379,8 @@ class ConstAttributeFunctorArrayVisitor : public ConstArrayVisitor virtual void apply(const Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } virtual void apply(const Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } virtual void apply(const Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); } - - + + inline void applyArray(Drawable::AttributeType type,const Array* array) { if (array) @@ -1389,7 +1389,7 @@ class ConstAttributeFunctorArrayVisitor : public ConstArrayVisitor array->accept(*this); } } - + protected: ConstAttributeFunctorArrayVisitor& operator = (const ConstAttributeFunctorArrayVisitor&) { return *this; } @@ -1401,7 +1401,7 @@ protected: void Geometry::accept(ConstAttributeFunctor& af) const { ConstAttributeFunctorArrayVisitor afav(af); - + if (_vertexData.array.valid()) { afav.applyArray(VERTICES,_vertexData.array.get()); @@ -1446,29 +1446,29 @@ void Geometry::accept(PrimitiveFunctor& functor) const { switch(vertices->getType()) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; default: OSG_WARN<<"Warning: Geometry::accept(PrimitiveFunctor&) cannot handle Vertex Array type"<getType()<getType(); switch(type) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): vec2Array = static_cast(vertices->getDataPointer()); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): vec3Array = static_cast(vertices->getDataPointer()); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): vec4Array = static_cast(vertices->getDataPointer()); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): vec2dArray = static_cast(vertices->getDataPointer()); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): vec3dArray = static_cast(vertices->getDataPointer()); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): vec4dArray = static_cast(vertices->getDataPointer()); break; default: @@ -1530,22 +1530,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const { switch(type) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): functor.vertex(vec2Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): functor.vertex(vec3Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): functor.vertex(vec4Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]); break; default: @@ -1573,22 +1573,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const { switch(type) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): functor.vertex(vec2Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): functor.vertex(vec3Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): functor.vertex(vec4Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]); break; default: @@ -1615,22 +1615,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const unsigned int vindex=*primItr; switch(type) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): functor.vertex(vec2Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): functor.vertex(vec3Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): functor.vertex(vec4Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]); break; default: @@ -1653,22 +1653,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const unsigned int vindex=*primItr; switch(type) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): functor.vertex(vec2Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): functor.vertex(vec3Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): functor.vertex(vec4Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]); break; default: @@ -1691,22 +1691,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const unsigned int vindex=*primItr; switch(type) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): functor.vertex(vec2Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): functor.vertex(vec3Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): functor.vertex(vec4Array[_vertexData.indices->index(vindex)]); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]); break; default: @@ -1743,22 +1743,22 @@ void Geometry::accept(PrimitiveIndexFunctor& functor) const switch(vertices->getType()) { - case(Array::Vec2ArrayType): + case(Array::Vec2ArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec3ArrayType): + case(Array::Vec3ArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec4ArrayType): + case(Array::Vec4ArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec2dArrayType): + case(Array::Vec2dArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec3dArrayType): + case(Array::Vec3dArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; - case(Array::Vec4dArrayType): + case(Array::Vec4dArrayType): functor.setVertexArray(vertices->getNumElements(),static_cast(vertices->getDataPointer())); break; default: @@ -1797,7 +1797,7 @@ void Geometry::accept(PrimitiveIndexFunctor& functor) const { functor.vertex(indices->index(vindex)); } - + functor.end(); break; } @@ -1818,7 +1818,7 @@ void Geometry::accept(PrimitiveIndexFunctor& functor) const functor.vertex(indices->index(vindex)); ++vindex; } - + functor.end(); } @@ -1887,7 +1887,7 @@ unsigned int _computeNumberOfPrimitives(const osg::Geometry& geom) { unsigned int totalNumberOfPrimitives = 0; - + for(Geometry::PrimitiveSetList::const_iterator itr=geom.getPrimitiveSetList().begin(); itr!=geom.getPrimitiveSetList().end(); ++itr) @@ -1958,10 +1958,10 @@ bool _verifyBindings(const osg::Geometry& geom, const A& arrayData) { unsigned int numVertices = geom.getVertexIndices()?geom.getVertexIndices()->getNumElements(): geom.getVertexArray()?geom.getVertexArray()->getNumElements():0; - if (numElements!=numVertices) return false; + if (numElements!=numVertices) return false; break; } - } + } return true; } @@ -1976,7 +1976,7 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry { // correct binding if not correct. if (arrayData.binding!=osg::Geometry::BIND_OFF) - { + { out<<"Warning: in osg::Geometry::computeCorrectBindingsAndArraySizes() "<getNumElements(): geom.getVertexArray()?geom.getVertexArray()->getNumElements():0; - + if ( numVertices==0 ) { if (arrayData.binding!=osg::Geometry::BIND_OFF) @@ -2013,7 +2013,7 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry <<" reseting "< @@ -2167,7 +2167,7 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor // if source array type and target array type are equal but arrays arn't equal if (_targetArray && _targetArray->getType()==array.getType() && _targetArray!=(osg::Array*)(&array)) { - // reuse exisiting target array + // reuse exisiting target array newArray = static_cast(_targetArray); if (newArray->size()!=indices.size()) { @@ -2190,9 +2190,9 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor } // Create when one of the arrays isn't one of the predefined templated classes. The - // template parameter is the type of the array that will get created. This is always - // one of the predefined classes. We could call clone to get one of the same type as - // the input array, but the interface of the osg::Array class doesn't include a way + // template parameter is the type of the array that will get created. This is always + // one of the predefined classes. We could call clone to get one of the same type as + // the input array, but the interface of the osg::Array class doesn't include a way // to set an element. template osg::Array* create_noinline(const osg::Array& array, const osg::IndexArray& indices) @@ -2215,7 +2215,7 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor osg::Array* create_noinline(const osg::Array& array, const osg::IndexArray& indices) { - switch (array.getType()) + switch (array.getType()) { case(osg::Array::ByteArrayType): return create_noinline(array,indices); case(osg::Array::ShortArrayType): return create_noinline(array,indices); @@ -2239,9 +2239,9 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor template osg::Array* create(const TA& array, const osg::IndexArray& indices) { - // We know that indices.getType returned the same thing as TI, but - // we need to determine whether it is really an instance of TI, or - // perhaps another subclass of osg::Array that contains the same + // We know that indices.getType returned the same thing as TI, but + // we need to determine whether it is really an instance of TI, or + // perhaps another subclass of osg::Array that contains the same // type of data. const TI* ba(dynamic_cast(&indices)); if (ba != NULL) { @@ -2265,7 +2265,7 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor case(osg::Array::UIntArrayType): return create(array, _indices); default: return create_noinline(array, _indices); } - + } // applys for the predefined classes go through 1-arg create to do indexing @@ -2311,7 +2311,7 @@ bool Geometry::suitableForOptimization() const { if (getTexCoordIndices(ti)) hasIndices = true; } - + for(unsigned int vi=0;viaccept(eia); target.setTexCoordArray(ti,eia._targetArray); target.setTexCoordIndices(ti,0); } - else if (getTexCoordArray(ti)) + else if (getTexCoordArray(ti)) { if (!copyToSelf) target.setTexCoordArray(ti,getTexCoordArray(ti)); } } - + for(unsigned int vi=0;vi<_vertexAttribList.size();++vi) { ArrayData& arrayData = _vertexAttribList[vi]; @@ -2433,7 +2433,7 @@ void Geometry::copyToAndOptimize(Geometry& target) bool Geometry::containsSharedArrays() const { unsigned int numSharedArrays = 0; - + if (getVertexArray() && getVertexArray()->referenceCount()>1) ++numSharedArrays; if (getNormalArray() && getNormalArray()->referenceCount()>1) ++numSharedArrays; if (getColorArray() && getColorArray()->referenceCount()>1) ++numSharedArrays; @@ -2444,7 +2444,7 @@ bool Geometry::containsSharedArrays() const { if (getTexCoordArray(ti) && getTexCoordArray(ti)->referenceCount()>1) ++numSharedArrays; } - + for(unsigned int vi=0;vi<_vertexAttribList.size();++vi) { const ArrayData& arrayData = _vertexAttribList[vi]; @@ -2474,7 +2474,7 @@ void Geometry::duplicateSharedArrays() setTexCoordArray(ti, osg::clone(getTexCoordArray(ti),osg::CopyOp::DEEP_COPY_ARRAYS)); } } - + for(unsigned int vi=0;vi<_vertexAttribList.size();++vi) { ArrayData& arrayData = _vertexAttribList[vi]; diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index cf2a07d22..2e6580f0e 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -40,7 +40,7 @@ using namespace osg; // Use a static reference pointer to hold the window system interface. // Wrap this within a function, in order to control the order in which -// the static pointer's constructor is executed. +// the static pointer's constructor is executed. static ref_ptr &windowingSystemInterfaceRef() { @@ -72,11 +72,11 @@ GraphicsContext* GraphicsContext::createGraphicsContext(Traits* traits) { // catch any undefined values. if (traits) traits->setUndefinedScreenDetailsToDefaultScreen(); - + return wsref->createGraphicsContext(traits); } else - return 0; + return 0; } GraphicsContext::ScreenIdentifier::ScreenIdentifier(): @@ -112,9 +112,9 @@ void GraphicsContext::ScreenIdentifier::setScreenIdentifier(const std::string& d { std::string::size_type colon = displayName.find_last_of(':'); std::string::size_type point = displayName.find_last_of('.'); - - if (point!=std::string::npos && - colon==std::string::npos && + + if (point!=std::string::npos && + colon==std::string::npos && point < colon) point = std::string::npos; if (colon==std::string::npos) @@ -125,7 +125,7 @@ void GraphicsContext::ScreenIdentifier::setScreenIdentifier(const std::string& d { hostName = displayName.substr(0,colon); } - + std::string::size_type startOfDisplayNum = (colon==std::string::npos) ? 0 : colon+1; std::string::size_type endOfDisplayNum = (point==std::string::npos) ? displayName.size() : point; @@ -147,7 +147,7 @@ void GraphicsContext::ScreenIdentifier::setScreenIdentifier(const std::string& d screenNum = -1; } -#if 0 +#if 0 OSG_NOTICE<<" hostName ["<getGLContextVersion(); glContextFlags = ds->getGLContextFlags(); glContextProfileMask = ds->getGLContextProfileMask(); @@ -237,7 +237,7 @@ public: _numContexts(0) {} unsigned int _numContexts; - + void incrementUsageCount() { ++_numContexts; } void decrementUsageCount() @@ -249,11 +249,11 @@ public: if (_numContexts <= 1 && _compileContext.valid()) { OSG_INFO<<"resetting compileContext "<<_compileContext.get()<<" refCount "<<_compileContext->referenceCount()< _compileContext; }; @@ -267,7 +267,7 @@ static GraphicsContext::GraphicsContexts s_registeredContexts; unsigned int GraphicsContext::createNewContextID() { OpenThreads::ScopedLock lock(s_contextIDMapMutex); - + // first check to see if we can reuse contextID; for(ContextIDMap::iterator itr = s_contextIDMap.begin(); itr != s_contextIDMap.end(); @@ -287,15 +287,15 @@ unsigned int GraphicsContext::createNewContextID() unsigned int contextID = s_contextIDMap.size(); s_contextIDMap[contextID]._numContexts = 1; - + OSG_INFO<<"GraphicsContext::createNewContextID() creating contextID="<setMaxNumberOfGraphicsContexts( contextID + 1 ); - return contextID; + return contextID; } unsigned int GraphicsContext::getMaxContextID() @@ -315,7 +315,7 @@ unsigned int GraphicsContext::getMaxContextID() void GraphicsContext::incrementContextIDUsageCount(unsigned int contextID) { OpenThreads::ScopedLock lock(s_contextIDMapMutex); - + s_contextIDMap[contextID].incrementUsageCount(); OSG_INFO<<"GraphicsContext::incrementContextIDUsageCount("< lock(s_contextIDMapMutex); if (s_contextIDMap[contextID]._compileContext.valid()) return s_contextIDMap[contextID]._compileContext.get(); } - + GraphicsContext::GraphicsContexts contexts = GraphicsContext::getRegisteredGraphicsContexts(contextID); if (contexts.empty()) return 0; - + GraphicsContext* src_gc = contexts.front(); const osg::GraphicsContext::Traits* src_traits = src_gc->getTraits(); @@ -422,7 +422,7 @@ GraphicsContext* GraphicsContext::getOrCreateCompileContext(unsigned int context osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits); if (gc.valid() && gc->realize()) - { + { OpenThreads::ScopedLock lock(s_contextIDMapMutex); s_contextIDMap[contextID]._compileContext = gc; OSG_NOTICE<<" succeeded GraphicsContext::createCompileContext."< lock(s_contextIDMapMutex); if (s_contextIDMap[_state->getContextID()]._numContexts>1) sharedContextExists = true; } - // release all the OpenGL objects in the scene graphs associated with this + // release all the OpenGL objects in the scene graphs associated with this for(Cameras::iterator itr = _cameras.begin(); itr != _cameras.end(); ++itr) @@ -575,11 +575,11 @@ void GraphicsContext::close(bool callCloseImplementation) OSG_INFO<<"makeCurrent did not succeed, could not do flush/deletion of OpenGL objects."<getContextID()); - + _state = 0; } } @@ -603,14 +603,14 @@ bool GraphicsContext::makeCurrent() _threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread(); bool result = makeCurrentImplementation(); - + if (result) { // initialize extension process, not only initializes on first - // call, will be a non-op on subsequent calls. + // call, will be a non-op on subsequent calls. getState()->initializeExtensionProcs(); } - + return result; } @@ -623,19 +623,19 @@ bool GraphicsContext::makeContextCurrent(GraphicsContext* readContext) _threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread(); // initialize extension process, not only initializes on first - // call, will be a non-op on subsequent calls. + // call, will be a non-op on subsequent calls. getState()->initializeExtensionProcs(); } - + return result; } bool GraphicsContext::releaseContext() { bool result = releaseContextImplementation(); - + _threadOfLastMakeCurrent = (OpenThreads::Thread*)(-1); - + return result; } @@ -646,7 +646,7 @@ void GraphicsContext::swapBuffers() swapBuffersCallbackOrImplemenation(); clear(); } - else if (_graphicsThread.valid() && + else if (_graphicsThread.valid() && _threadOfLastMakeCurrent == _graphicsThread.get()) { _graphicsThread->add(new SwapBuffersOperation); @@ -669,9 +669,9 @@ void GraphicsContext::createGraphicsThread() void GraphicsContext::setGraphicsThread(GraphicsThread* gt) { - if (_graphicsThread==gt) return; + if (_graphicsThread==gt) return; - if (_graphicsThread.valid()) + if (_graphicsThread.valid()) { // need to kill the thread in some way... _graphicsThread->cancel(); @@ -679,8 +679,8 @@ void GraphicsContext::setGraphicsThread(GraphicsThread* gt) } _graphicsThread = gt; - - if (_graphicsThread.valid()) + + if (_graphicsThread.valid()) { _graphicsThread->setParent(this); } @@ -722,7 +722,7 @@ void GraphicsContext::remove(Operation* operation) void GraphicsContext::remove(const std::string& name) { OSG_INFO<<"Doing remove named operation"< lock(_operationsMutex); @@ -768,7 +768,7 @@ void GraphicsContext::runOperations() CameraVector camerasCopy; std::copy(_cameras.begin(), _cameras.end(), std::back_inserter(camerasCopy)); std::sort(camerasCopy.begin(), camerasCopy.end(), CameraRenderOrderSortOp()); - + for(CameraVector::iterator itr = camerasCopy.begin(); itr != camerasCopy.end(); ++itr) @@ -799,7 +799,7 @@ void GraphicsContext::runOperations() ++itr; } } - + if (_currentOperation.valid()) { // OSG_INFO<<"Doing op "<<_currentOperation->getName()<<" "< lock(_operationsMutex); _currentOperation = 0; } @@ -831,9 +831,9 @@ void GraphicsContext::removeCamera(osg::Camera* camera) NodeSet nodes; for(unsigned int i=0; igetNumChildren(); ++i) { - nodes.insert(camera->getChild(i)); + nodes.insert(camera->getChild(i)); } - + for(Cameras::iterator citr = _cameras.begin(); citr != _cameras.end(); ++citr) @@ -846,9 +846,9 @@ void GraphicsContext::removeCamera(osg::Camera* camera) NodeSet::iterator nitr = nodes.find(otherCamera->getChild(i)); if (nitr != nodes.end()) nodes.erase(nitr); } - } + } } - + // now release the GLobjects associated with these non shared nodes for(NodeSet::iterator nitr = nodes.begin(); nitr != nodes.end(); @@ -873,21 +873,21 @@ void GraphicsContext::resizedImplementation(int x, int y, int width, int height) std::set processedViewports; if (!_traits) return; - + double widthChangeRatio = double(width) / double(_traits->width); double heigtChangeRatio = double(height) / double(_traits->height); - double aspectRatioChange = widthChangeRatio / heigtChangeRatio; - + double aspectRatioChange = widthChangeRatio / heigtChangeRatio; + for(Cameras::iterator itr = _cameras.begin(); itr != _cameras.end(); ++itr) { Camera* camera = (*itr); - + // resize doesn't affect Cameras set up with FBO's. if (camera->getRenderTargetImplementation()==osg::Camera::FRAME_BUFFER_OBJECT) continue; - + Viewport* viewport = camera->getViewport(); if (viewport) { diff --git a/src/osg/GraphicsThread.cpp b/src/osg/GraphicsThread.cpp index 3ea29aa5b..d07854385 100644 --- a/src/osg/GraphicsThread.cpp +++ b/src/osg/GraphicsThread.cpp @@ -22,26 +22,26 @@ using namespace OpenThreads; GraphicsThread::GraphicsThread() { -} +} void GraphicsThread::run() { // make the graphics context current. GraphicsContext* graphicsContext = dynamic_cast(_parent.get()); if (graphicsContext) - { + { graphicsContext->makeCurrent(); - + graphicsContext->getState()->initializeExtensionProcs(); } OperationThread::run(); // release operations before the thread stops working. - _operationQueue->releaseAllOperations(); + _operationQueue->releaseAllOperations(); if (graphicsContext) - { + { graphicsContext->releaseContext(); } @@ -52,7 +52,7 @@ void GraphicsOperation::operator () (Object* object) osg::GraphicsContext* context = dynamic_cast(object); if (context) operator() (context); } - + void SwapBuffersOperation::operator () (GraphicsContext* context) { context->swapBuffersCallbackOrImplemenation(); @@ -71,7 +71,7 @@ void BarrierOperation::operator () (Object* /*object*/) if (_preBlockOp==GL_FLUSH) glFlush(); else if (_preBlockOp==GL_FINISH) glFinish(); } - + block(); } @@ -85,13 +85,13 @@ void ReleaseContext_Block_MakeCurrentOperation::operator () (GraphicsContext* co { // release the graphics context. context->releaseContext(); - - // reset the block so that it the next call to block() + + // reset the block so that it the next call to block() reset(); - + // block this thread, until the block is released externally. block(); - + // re acquire the graphics context. context->makeCurrent(); } diff --git a/src/osg/Group.cpp b/src/osg/Group.cpp index 5436bb862..36606dda1 100644 --- a/src/osg/Group.cpp +++ b/src/osg/Group.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -72,15 +72,15 @@ bool Group::addChild( Node *child ) bool Group::insertChild( unsigned int index, Node *child ) { if (!child) return false; - -#if ENSURE_CHILD_IS_UNIQUE + +#if ENSURE_CHILD_IS_UNIQUE if (containsNode(child)) { OSG_WARN<<"Adding non unique child to osg::Group, ignoring call"< automatically handles incrementing child's reference count. @@ -95,7 +95,7 @@ bool Group::insertChild( unsigned int index, Node *child ) // register as parent of child. child->addParent(this); - + // tell any subclasses that a child has been inserted so that they can update themselves. childInserted(index); @@ -185,7 +185,7 @@ bool Group::removeChildren(unsigned int pos,unsigned int numChildrenToRemove) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-updateCallbackRemoved); } - + if (eventCallbackRemoved) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-eventCallbackRemoved); @@ -195,14 +195,14 @@ bool Group::removeChildren(unsigned int pos,unsigned int numChildrenToRemove) { setNumChildrenWithCullingDisabled(getNumChildrenWithCullingDisabled()-numChildrenWithCullingDisabledRemoved); } - + if (numChildrenWithOccludersRemoved) { setNumChildrenWithOccluderNodes(getNumChildrenWithOccluderNodes()-numChildrenWithOccludersRemoved); } - + dirtyBound(); - + return true; } else return false; @@ -226,9 +226,9 @@ bool Group::setChild( unsigned int i, Node* newNode ) { if (i<_children.size() && newNode) { - + ref_ptr origNode = _children[i]; - + // first remove for origNode's parent list. origNode->removeParent(this); @@ -297,7 +297,7 @@ bool Group::setChild( unsigned int i, Node* newNode ) { ++delta_numChildrenWithCullingDisabled; } - + if (delta_numChildrenWithCullingDisabled!=0) { setNumChildrenWithCullingDisabled( @@ -318,7 +318,7 @@ bool Group::setChild( unsigned int i, Node* newNode ) { ++delta_numChildrenWithOccluderNodes; } - + if (delta_numChildrenWithOccluderNodes!=0) { setNumChildrenWithOccluderNodes( @@ -335,7 +335,7 @@ bool Group::setChild( unsigned int i, Node* newNode ) BoundingSphere Group::computeBound() const { BoundingSphere bsphere; - if (_children.empty()) + if (_children.empty()) { return bsphere; } @@ -358,7 +358,7 @@ BoundingSphere Group::computeBound() const } } - if (!bb.valid()) + if (!bb.valid()) { return bsphere; } diff --git a/src/osg/Hint.cpp b/src/osg/Hint.cpp index c5f1ccf4d..9de9c8d0e 100644 --- a/src/osg/Hint.cpp +++ b/src/osg/Hint.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -50,7 +50,7 @@ void Hint::setTarget(GLenum target) osg::StateSet* stateset = *itr; stateset->removeAttribute(this); } - + // assign the hint target _target = target; diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 2a2a037cc..16837ad0c 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -111,7 +111,7 @@ void Image::DataIterator::operator ++ () { // advance to next row ++_rowNum; - + if (_rowNum>=_image->t()) { // moved over end of current image so move to next @@ -127,7 +127,7 @@ void Image::DataIterator::operator ++ () } } } - + assign(); } @@ -140,7 +140,7 @@ void Image::DataIterator::assign() _currentSize = 0; return; } - + //OSG_NOTICE<<"DataIterator::assign B"<isDataContiguous()) @@ -153,7 +153,7 @@ void Image::DataIterator::assign() return; } - + //OSG_NOTICE<<"DataIterator::assign C"<isMipmap()) @@ -167,16 +167,16 @@ void Image::DataIterator::assign() return; } const unsigned char* ptr = _image->getMipmapData(_mipmapNum); - + int rowLength = _image->getRowLength()>>_mipmapNum; if (rowLength==0) rowLength = 1; - + int imageHeight = _image->t()>>_mipmapNum; if (imageHeight==0) imageHeight = 1; - + unsigned int rowWidthInBytes = Image::computeRowWidthInBytes(rowLength,_image->getPixelFormat(),_image->getDataType(),_image->getPacking()); unsigned int imageSizeInBytes = rowWidthInBytes*imageHeight; - + _currentPtr = ptr + rowWidthInBytes*_rowNum + imageSizeInBytes*_imageNum; _currentSize = rowWidthInBytes; } @@ -215,7 +215,7 @@ Image::Image() _allocationMode(USE_NEW_DELETE), _data(0L) { - setDataVariance(STATIC); + setDataVariance(STATIC); } Image::Image(const Image& image,const CopyOp& copyop): @@ -287,7 +287,7 @@ int Image::compare(const Image& rhs) const if ((_data || rhs._data) && (_data == rhs._data)) return 0; // slowest comparison at the bottom! - COMPARE_StateAttribute_Parameter(getFileName()) + COMPARE_StateAttribute_Parameter(getFileName()) return 0; } @@ -322,7 +322,7 @@ bool Image::isPackedType(GLenum type) case(GL_UNSIGNED_INT_10_10_10_2): case(GL_UNSIGNED_INT_2_10_10_10_REV): return true; default: return false; - } + } } @@ -369,7 +369,7 @@ GLenum Image::computePixelFormat(GLenum format) case(GL_INTENSITY8UI_EXT): case(GL_INTENSITY16UI_EXT): case(GL_INTENSITY32UI_EXT): - OSG_WARN<<"Image::computePixelFormat("<0) mipMapData.push_back(total_size); - + glGetTexLevelParameteriv(textureMode, i, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(textureMode, i, GL_TEXTURE_HEIGHT, &height); glGetTexLevelParameteriv(textureMode, i, GL_TEXTURE_DEPTH, &depth); - + unsigned int level_size = computeRowWidthInBytes(width,internalformat,type,packing)*height*depth; total_size += level_size; } - - + + unsigned char* data = new unsigned char[total_size]; if (!data) { OSG_WARN<<"Warning: Image::readImageFromCurrentTexture(..) out of memory, now image read."<maxTextureSize) new_s = maxTextureSize; if (new_t>maxTextureSize) new_t = maxTextureSize; - + if (new_s!=_s || new_t!=_t) { if (!_fileName.empty()) { OSG_NOTICE << "Scaling image '"<<_fileName<<"' from ("<<_s<<","<<_t<<") to ("< +template bool _findLowerAlphaValueInRow(unsigned int num, T* data,T value, unsigned int delta) { for(unsigned int i=0;i +template bool _maskedFindLowerAlphaValueInRow(unsigned int num, T* data,T value, T mask, unsigned int delta) { for(unsigned int i=0;i +#include Geode* osg::createGeodeForImage(osg::Image* image,float s,float t) @@ -1704,7 +1704,7 @@ Geode* osg::createGeodeForImage(osg::Image* image,float s,float t) } } -template +template Vec4 _readColor(GLenum pixelFormat, T* data,float scale) { switch(pixelFormat) diff --git a/src/osg/ImageSequence.cpp b/src/osg/ImageSequence.cpp index 7fb73c76e..ffc9ab15b 100644 --- a/src/osg/ImageSequence.cpp +++ b/src/osg/ImageSequence.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,10 +30,10 @@ ImageSequence::ImageSequence() _mode = PRE_LOAD_ALL_IMAGES; _length = 1.0; _timePerImage = 1.0; - + _seekTime = 0.0; _seekTimeSet = false; - + _previousAppliedImageIndex = -1; } @@ -89,7 +89,7 @@ void ImageSequence::setLength(double length) OSG_NOTICE<<"ImageSequence::setLength("< lock(_mutex); return pos<_fileNames.size() ? _fileNames[pos] : std::string(); } - + void ImageSequence::addImageFile(const std::string& fileName) { OpenThreads::ScopedLock lock(_mutex); @@ -129,7 +129,7 @@ void ImageSequence::setImage(unsigned int pos, osg::Image* image) OSG_INFO<<"ImageSequence::setImage("<getFileName()<<")"<=_images.size()) _images.resize(pos+1); - + _images[pos] = image; // prune from file requested list. @@ -159,7 +159,7 @@ void ImageSequence::addImage(osg::Image* image) _images.push_back(image); computeTimePerImage(); - + if (data()==0) { setImageToChild(_images.front().get()); @@ -189,7 +189,7 @@ void ImageSequence::applyLoopingMode() int ImageSequence::imageIndex(double time) { - if (getLoopingMode()==LOOPING) + if (getLoopingMode()==LOOPING) { double positionRatio = time/_length; time = (positionRatio - floor(positionRatio))*_length; @@ -204,7 +204,7 @@ int ImageSequence::imageIndex(double time) void ImageSequence::update(osg::NodeVisitor* nv) { OpenThreads::ScopedLock lock(_mutex); - + osg::NodeVisitor::ImageRequestHandler* irh = nv->getImageRequestHandler(); const osg::FrameStamp* fs = nv->getFrameStamp(); @@ -214,13 +214,13 @@ void ImageSequence::update(osg::NodeVisitor* nv) { _referenceTime = fs->getSimulationTime(); } - + bool looping = getLoopingMode()==LOOPING; double time = (fs->getSimulationTime() - _referenceTime)*_timeMultiplier; - + if (_seekTimeSet || _status==PAUSED || _status==INVALID) { - time = _seekTime; + time = _seekTime; _referenceTime = fs->getSimulationTime() - time/_timeMultiplier; } else @@ -242,13 +242,13 @@ void ImageSequence::update(osg::NodeVisitor* nv) } } } - + _seekTime = time; _seekTimeSet = false; bool pruneOldImages = false; - - + + switch(_mode) { case(PRE_LOAD_ALL_IMAGES): @@ -264,7 +264,7 @@ void ImageSequence::update(osg::NodeVisitor* nv) _images.push_back(image); } } - + irh = 0; break; } @@ -294,22 +294,22 @@ void ImageSequence::update(osg::NodeVisitor* nv) --index; } } - + if (index>=0) { // OSG_NOTICE<<"at time "<getPixelFormat(), srcImage->getDataType(), srcImage->data(src_s,src_t+row,src_r+slice), readOp); - + // pass readOp's _colour array contents over to writeOp (note this is just a pointer swap). writeOp._colours.swap(readOp._colours); - + modifyRow(width, destImage->getPixelFormat(), destImage->getDataType(), destImage->data(dest_s, dest_t+row,dest_r+slice), writeOp); // return readOp's _colour array contents back to its rightful owner. writeOp._colours.swap(readOp._colours); } } - + return false; } @@ -327,8 +327,8 @@ struct SetToColourOperator SetToColourOperator(const osg::Vec4& colour): _colour(colour) {} - inline void luminance(float& l) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; } - inline void alpha(float& a) const { a = _colour.a(); } + inline void luminance(float& l) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; } + inline void alpha(float& a) const { a = _colour.a(); } inline void luminance_alpha(float& l,float& a) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; a = _colour.a(); } inline void rgb(float& r,float& g,float& b) const { r = _colour.r(); g = _colour.g(); b = _colour.b(); } inline void rgba(float& r,float& g,float& b,float& a) const { r = _colour.r(); g = _colour.g(); b = _colour.b(); a = _colour.a(); } @@ -341,7 +341,7 @@ bool clearImageToColor(osg::Image* image, const osg::Vec4& colour) if (!image) return false; modifyImage(image, SetToColourOperator(colour)); - + return true; } @@ -478,7 +478,7 @@ osg::Image* createImage3D(const ImageList& imageList, pixelFormat==GL_BGR || pixelFormat==GL_BGRA) { - + int num_s = minimum(image->s(), image_3d->s()); int num_t = minimum(image->t(), image_3d->t()); int num_r = minimum(image->r(), (image_3d->r() - curr_dest_r)); @@ -492,7 +492,7 @@ osg::Image* createImage3D(const ImageList& imageList, curr_dest_r += num_r; } } - + return image_3d.release(); } @@ -506,7 +506,7 @@ struct ModulateAlphaByLuminanceOperator inline void rgb(float&,float&,float&) const {} inline void rgba(float& r,float& g,float& b,float& a) const { float l = (r+g+b)*0.3333333; a *= l;} }; - + osg::Image* createImage3DWithAlpha(const ImageList& imageList, int s_maximumImageSize, int t_maximumImageSize, @@ -522,7 +522,7 @@ osg::Image* createImage3DWithAlpha(const ImageList& imageList, desiredPixelFormat = GL_RGBA; modulateAlphaByLuminance = true; } - + osg::ref_ptr image = createImage3D(imageList, desiredPixelFormat, s_maximumImageSize, diff --git a/src/osg/KdTree.cpp b/src/osg/KdTree.cpp index 92b4d316e..484155bea 100644 --- a/src/osg/KdTree.cpp +++ b/src/osg/KdTree.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -69,7 +69,7 @@ struct TriangleIndicesCollector const osg::Vec3& v0 = (*(_buildKdTree->_kdTree.getVertices()))[p0]; const osg::Vec3& v1 = (*(_buildKdTree->_kdTree.getVertices()))[p1]; const osg::Vec3& v2 = (*(_buildKdTree->_kdTree.getVertices()))[p2]; - + // discard degenerate points if (v0==v1 || v1==v2 || v1==v2) { @@ -78,7 +78,7 @@ struct TriangleIndicesCollector } unsigned int i = _buildKdTree->_kdTree.addTriangle(KdTree::Triangle(p0,p1,p2)); - + osg::BoundingBox bb; bb.expandBy(v0); bb.expandBy(v1); @@ -86,9 +86,9 @@ struct TriangleIndicesCollector _buildKdTree->_centers.push_back(bb.center()); _buildKdTree->_primitiveIndices.push_back(i); - + } - + BuildKdTree* _buildKdTree; }; @@ -100,27 +100,27 @@ struct TriangleIndicesCollector bool BuildKdTree::build(KdTree::BuildOptions& options, osg::Geometry* geometry) { - -#ifdef VERBOSE_OUTPUT + +#ifdef VERBOSE_OUTPUT OSG_NOTICE<<"osg::KDTreeBuilder::createKDTree()"<(geometry->getVertexArray()); if (!vertices) return false; - + if (vertices->size() <= options._targetNumTrianglesPerLeaf) return false; _bb = geometry->getBound(); _kdTree.setVertices(vertices); - + unsigned int estimatedSize = (unsigned int)(2.0*float(vertices->size())/float(options._targetNumTrianglesPerLeaf)); -#ifdef VERBOSE_OUTPUT +#ifdef VERBOSE_OUTPUT OSG_NOTICE<<"kdTree->_kdNodes.reserve()="<size(); @@ -144,22 +144,22 @@ bool BuildKdTree::build(KdTree::BuildOptions& options, osg::Geometry* geometry) osg::BoundingBox bb = _bb; nodeNum = divide(options, bb, nodeNum, 0); - + // now reorder the triangle list so that it's in order as per the primitiveIndex list. KdTree::TriangleList triangleList(_kdTree.getTriangles().size()); for(unsigned int i=0; i<_primitiveIndices.size(); ++i) { triangleList[i] = _kdTree.getTriangle(_primitiveIndices[i]); } - + _kdTree.getTriangles().swap(triangleList); - - -#ifdef VERBOSE_OUTPUT + + +#ifdef VERBOSE_OUTPUT OSG_NOTICE<<"Root nodeNum="<(node.second)>options._targetNumTrianglesPerLeaf); - + if (!needToDivide) { if (node.first<0) { int istart = -node.first-1; int iend = istart+node.second-1; - + // leaf is done, now compute bound on it. node.bb.init(); for(int i=istart; i<=iend; ++i) @@ -228,7 +228,7 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int node.bb.expandBy(v0); node.bb.expandBy(v1); node.bb.expandBy(v2); - + } if (node.bb.valid()) @@ -241,8 +241,8 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int node.bb._max.y() += epsilon; node.bb._max.z() += epsilon; } - -#ifdef VERBOSE_OUTPUT + +#ifdef VERBOSE_OUTPUT if (!node.bb.valid()) { OSG_NOTICE<<"After reset "<mid)) { --right; } - + while(leftmid)) { --right; } if (left resize could // have invalidate the previous node ref. KdTree::KdNode& newNodeRef = _kdTree.getNode(nodeIndex); - + newNodeRef.first = leftChildIndex; - newNodeRef.second = rightChildIndex; + newNodeRef.second = rightChildIndex; insitueDivision = true; @@ -416,9 +416,9 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int { OSG_NOTICE<<"NOT expecting to get here"<esplison) { float u = (P*T); if (u<0.0 || u>det) continue; - + osg::Vec3 Q = T ^ E1; float v = (Q*_d); if (v<0.0 || v>det) continue; - + if ((u+v)> det) continue; - float inv_det = 1.0f/det; - float t = (Q*E2)*inv_det; + float inv_det = 1.0f/det; + float t = (Q*E2)*inv_det; if (t<0.0 || t>_length) continue; u *= inv_det; @@ -526,7 +526,7 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls, r0 = 1.0f-u-v; r1 = u; - r2 = v; + r2 = v; r = t * _inverse_length; } else if (det<-esplison) @@ -534,15 +534,15 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls, float u = (P*T); if (u>0.0 || u0.0 || v_length) continue; u *= inv_det; @@ -561,7 +561,7 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls, osg::Vec3 in = v0*r0 + v1*r1 + v2*r2; osg::Vec3 normal = E1^E2; normal.normalize(); - + #if 1 _intersections.push_back(KdTree::LineSegmentIntersection()); KdTree::LineSegmentIntersection& intersection = _intersections.back(); @@ -704,7 +704,7 @@ bool IntersectKdTree::intersectAndClip(osg::Vec3& s, osg::Vec3& e, const osg::Bo // clip e to zMax. e = s+_d_invZ*(bb.zMax()-s.z()); } - } + } else { if (s.z()asGeometry(); if (geom) @@ -819,6 +819,6 @@ void KdTreeBuilder::apply(osg::Geode& geode) { geom->setShape(kdTree.get()); } - } + } } } diff --git a/src/osg/LOD.cpp b/src/osg/LOD.cpp index a3362ebcd..679164b78 100644 --- a/src/osg/LOD.cpp +++ b/src/osg/LOD.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -66,12 +66,12 @@ void LOD::traverse(NodeVisitor& nv) } } } - + unsigned int numChildren = _children.size(); if (_rangeList.size()accept(nv); @@ -109,7 +109,7 @@ bool LOD::addChild( Node *child ) if (Group::addChild(child)) { - if (_children.size()>_rangeList.size()) + if (_children.size()>_rangeList.size()) { float maxRange = !_rangeList.empty() ? _rangeList.back().second : 0.0f; diff --git a/src/osg/Light.cpp b/src/osg/Light.cpp index 14488c45b..29ff236c2 100644 --- a/src/osg/Light.cpp +++ b/src/osg/Light.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -58,7 +58,7 @@ void Light::init( void ) // OSG_DEBUG << "_quadratic_attenuation "<<_quadratic_attenuation<removeAttribute(this); } - + // assign the hint target _lightnum = num; diff --git a/src/osg/LightModel.cpp b/src/osg/LightModel.cpp index 0765ed5ec..41c4accb2 100644 --- a/src/osg/LightModel.cpp +++ b/src/osg/LightModel.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -70,7 +70,7 @@ void LightModel::apply(State&) const glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR); } } - + #ifndef OSG_GLES1_AVAILABLE glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,_localViewer); #endif diff --git a/src/osg/LightSource.cpp b/src/osg/LightSource.cpp index d12d84bb4..ad10ae7aa 100644 --- a/src/osg/LightSource.cpp +++ b/src/osg/LightSource.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -61,7 +61,7 @@ void LightSource::setLocalStateSetModes(StateAttribute::GLModeValue value) BoundingSphere LightSource::computeBound() const { BoundingSphere bsphere(Group::computeBound()); - + if (_light.valid() && _referenceFrame==RELATIVE_RF) { const Vec4& pos = _light->getPosition(); diff --git a/src/osg/LineSegment.cpp b/src/osg/LineSegment.cpp index f4408edd1..feb675d6d 100644 --- a/src/osg/LineSegment.cpp +++ b/src/osg/LineSegment.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -208,9 +208,9 @@ bool LineSegment::intersect(const BoundingSphere& bs,float& r1,float& r2) const // check for zero length segment. if (a==0.0) { - // check if start point outside sphere radius + // check if start point outside sphere radius if (c>0.0) return false; - + // length segment within radius of bounding sphere but zero length // so return true, and set the ratio so the start point is the one // to be used. @@ -254,9 +254,9 @@ bool LineSegment::intersect(const BoundingSphere& bs,double& r1,double& r2) cons // check for zero length segment. if (a==0.0) { - // check if start point outside sphere radius + // check if start point outside sphere radius if (c>0.0) return false; - + // length segment within radius of bounding sphere but zero length // so return true, and set the ratio so the start point is the one // to be used. diff --git a/src/osg/LineStipple.cpp b/src/osg/LineStipple.cpp index 98cab97c9..de3462498 100644 --- a/src/osg/LineStipple.cpp +++ b/src/osg/LineStipple.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -32,7 +32,7 @@ void LineStipple::setFactor(GLint factor) { _factor = factor; } - + void LineStipple::setPattern(GLushort pattern) { _pattern = pattern; diff --git a/src/osg/LineWidth.cpp b/src/osg/LineWidth.cpp index d3d36832d..e9fe3eeec 100644 --- a/src/osg/LineWidth.cpp +++ b/src/osg/LineWidth.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/LogicOp.cpp b/src/osg/LogicOp.cpp index f55d258eb..9a4a59f77 100644 --- a/src/osg/LogicOp.cpp +++ b/src/osg/LogicOp.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/Material.cpp b/src/osg/Material.cpp index 962fa3f3d..318d783df 100644 --- a/src/osg/Material.cpp +++ b/src/osg/Material.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -49,7 +49,7 @@ Material::~Material() Material& Material:: operator = (const Material& rhs) { if (&rhs==this) return *this; - + _colorMode= rhs._colorMode; _ambientFrontAndBack= rhs._ambientFrontAndBack; _ambientFront= rhs._ambientFront; @@ -66,7 +66,7 @@ Material& Material:: operator = (const Material& rhs) _shininessFrontAndBack= rhs._shininessFrontAndBack; _shininessFront= rhs._shininessFront; _shininessBack= rhs._shininessBack; - + return *this; } @@ -265,7 +265,7 @@ const Vec4& Material::getEmission(Face face) const void Material::setShininess(Face face, float shininess ) { clampBetweenRange(shininess,0.0f,128.0f,"Material::setShininess()"); - + switch(face) { case(FRONT): @@ -327,7 +327,7 @@ void Material::setTransparency(Face face,float transparency) _specularBack[3] = 1.0f-transparency; _emissionBack[3] = 1.0f-transparency; } -} +} void Material::setAlpha(Face face,float alpha) { diff --git a/src/osg/Math.cpp b/src/osg/Math.cpp index 117ef8e5e..3aaba343f 100644 --- a/src/osg/Math.cpp +++ b/src/osg/Math.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,7 +32,7 @@ double osg::asciiToDouble(const char* str) while ( *ptr!=0 && ((*ptr>='0' && *ptr<='9') || - (*ptr>='a' && *ptr<='f') || + (*ptr>='a' && *ptr<='f') || (*ptr>='A' && *ptr<='F')) ) { @@ -41,24 +41,24 @@ double osg::asciiToDouble(const char* str) else if (*ptr>='A' && *ptr<='F') value = value*16.0 + double(*ptr-'A'+10); ++ptr; } - + // OSG_NOTICE<<"Read "< @@ -24,7 +24,7 @@ MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp& _matrix(transform._matrix), _inverse(transform._inverse), _inverseDirty(transform._inverseDirty) -{ +{ } MatrixTransform::MatrixTransform(const Matrix& mat ) diff --git a/src/osg/Matrix_implementation.cpp b/src/osg/Matrix_implementation.cpp index cdfea54aa..adf9d8a4e 100644 --- a/src/osg/Matrix_implementation.cpp +++ b/src/osg/Matrix_implementation.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -87,44 +87,44 @@ void Matrix_implementation::setRotate(const Quat& q) { rlength2 = 2.0; } - + // Source: Gamasutra, Rotating Objects Using Quaternions // //http://www.gamasutra.com/features/19980703/quaternions_01.htm - + double wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; - + // calculate coefficients x2 = rlength2*QX; y2 = rlength2*QY; z2 = rlength2*QZ; - + xx = QX * x2; xy = QX * y2; xz = QX * z2; - + yy = QY * y2; yz = QY * z2; zz = QZ * z2; - + wx = QW * x2; wy = QW * y2; wz = QW * z2; - + // Note. Gamasutra gets the matrix assignments inverted, resulting - // in left-handed rotations, which is contrary to OpenGL and OSG's + // in left-handed rotations, which is contrary to OpenGL and OSG's // methodology. The matrix assignment has been altered in the next // few lines of code to do the right thing. // Don Burns - Oct 13, 2001 _mat[0][0] = 1.0 - (yy + zz); _mat[1][0] = xy - wz; _mat[2][0] = xz + wy; - - + + _mat[0][1] = xy + wz; _mat[1][1] = 1.0 - (xx + zz); _mat[2][1] = yz - wx; - + _mat[0][2] = xz - wy; _mat[1][2] = yz + wx; _mat[2][2] = 1.0 - (xx + yy); @@ -171,29 +171,29 @@ Quat Matrix_implementation::getRotate() const { /* perform instant calculation */ QW = tq[0]; - QX = _mat[1][2]-_mat[2][1]; - QY = _mat[2][0]-_mat[0][2]; - QZ = _mat[0][1]-_mat[1][0]; + QX = _mat[1][2]-_mat[2][1]; + QY = _mat[2][0]-_mat[0][2]; + QZ = _mat[0][1]-_mat[1][0]; } else if (j==1) { - QW = _mat[1][2]-_mat[2][1]; + QW = _mat[1][2]-_mat[2][1]; QX = tq[1]; - QY = _mat[0][1]+_mat[1][0]; - QZ = _mat[2][0]+_mat[0][2]; + QY = _mat[0][1]+_mat[1][0]; + QZ = _mat[2][0]+_mat[0][2]; } else if (j==2) { - QW = _mat[2][0]-_mat[0][2]; - QX = _mat[0][1]+_mat[1][0]; + QW = _mat[2][0]-_mat[0][2]; + QX = _mat[0][1]+_mat[1][0]; QY = tq[2]; - QZ = _mat[1][2]+_mat[2][1]; + QZ = _mat[1][2]+_mat[2][1]; } else /* if (j==3) */ { - QW = _mat[0][1]-_mat[1][0]; - QX = _mat[2][0]+_mat[0][2]; - QY = _mat[1][2]+_mat[2][1]; + QW = _mat[0][1]-_mat[1][0]; + QX = _mat[2][0]+_mat[0][2]; + QY = _mat[1][2]+_mat[2][1]; QZ = tq[3]; } @@ -408,7 +408,7 @@ void Matrix_implementation::makeRotate( value_type angle, const Vec3d& axis ) setRotate(quat); } -void Matrix_implementation::makeRotate( value_type angle, value_type x, value_type y, value_type z ) +void Matrix_implementation::makeRotate( value_type angle, value_type x, value_type y, value_type z ) { makeIdentity(); @@ -424,34 +424,34 @@ void Matrix_implementation::makeRotate( const Quat& quat ) setRotate(quat); } -void Matrix_implementation::makeRotate( value_type angle1, const Vec3f& axis1, +void Matrix_implementation::makeRotate( value_type angle1, const Vec3f& axis1, value_type angle2, const Vec3f& axis2, value_type angle3, const Vec3f& axis3) { makeIdentity(); Quat quat; - quat.makeRotate(angle1, axis1, + quat.makeRotate(angle1, axis1, angle2, axis2, angle3, axis3); setRotate(quat); } -void Matrix_implementation::makeRotate( value_type angle1, const Vec3d& axis1, +void Matrix_implementation::makeRotate( value_type angle1, const Vec3d& axis1, value_type angle2, const Vec3d& axis2, value_type angle3, const Vec3d& axis3) { makeIdentity(); Quat quat; - quat.makeRotate(angle1, axis1, + quat.makeRotate(angle1, axis1, angle2, axis2, angle3, axis3); setRotate(quat); } void Matrix_implementation::mult( const Matrix_implementation& lhs, const Matrix_implementation& rhs ) -{ +{ if (&lhs==this) { postMult(rhs); @@ -530,7 +530,7 @@ void Matrix_implementation::orthoNormalize(const Matrix_implementation& rhs) value_type x_colMag = (rhs._mat[0][0] * rhs._mat[0][0]) + (rhs._mat[1][0] * rhs._mat[1][0]) + (rhs._mat[2][0] * rhs._mat[2][0]); value_type y_colMag = (rhs._mat[0][1] * rhs._mat[0][1]) + (rhs._mat[1][1] * rhs._mat[1][1]) + (rhs._mat[2][1] * rhs._mat[2][1]); value_type z_colMag = (rhs._mat[0][2] * rhs._mat[0][2]) + (rhs._mat[1][2] * rhs._mat[1][2]) + (rhs._mat[2][2] * rhs._mat[2][2]); - + if(!equivalent((double)x_colMag, 1.0) && !equivalent((double)x_colMag, 0.0)) { x_colMag = sqrt(x_colMag); @@ -657,7 +657,7 @@ bool Matrix_implementation::invert_4x3( const Matrix_implementation& mat ) if( osg::square(d-1.0) > 1.0e-6 ) // Involves perspective, so we must { // compute the full inverse - + Matrix_implementation TPinv; _mat[3][0] = _mat[3][1] = _mat[3][2] = 0.0; @@ -831,15 +831,15 @@ bool Matrix_implementation::getOrtho(Matrix_implementation::value_type& left, Ma zNear = (_mat[3][2]+1.0) / _mat[2][2]; zFar = (_mat[3][2]-1.0) / _mat[2][2]; - + left = -(1.0+_mat[3][0]) / _mat[0][0]; right = (1.0-_mat[3][0]) / _mat[0][0]; bottom = -(1.0+_mat[3][1]) / _mat[1][1]; top = (1.0-_mat[3][1]) / _mat[1][1]; - + return true; -} +} bool Matrix_implementation::getOrtho(Matrix_implementation::other_value_type& left, Matrix_implementation::other_value_type& right, Matrix_implementation::other_value_type& bottom, Matrix_implementation::other_value_type& top, @@ -894,12 +894,12 @@ bool Matrix_implementation::getFrustum(Matrix_implementation::value_type& left, top = temp_near * (1.0+_mat[2][1]) / _mat[1][1]; bottom = temp_near * (_mat[2][1]-1.0) / _mat[1][1]; - + zNear = temp_near; zFar = temp_far; return true; -} +} bool Matrix_implementation::getFrustum(Matrix_implementation::other_value_type& left, Matrix_implementation::other_value_type& right, Matrix_implementation::other_value_type& bottom, Matrix_implementation::other_value_type& top, diff --git a/src/osg/Matrixd.cpp b/src/osg/Matrixd.cpp index 87c9bae13..16c08e53e 100644 --- a/src/osg/Matrixd.cpp +++ b/src/osg/Matrixd.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osg/Matrixf.cpp b/src/osg/Matrixf.cpp index 13b879151..4a8c97502 100644 --- a/src/osg/Matrixf.cpp +++ b/src/osg/Matrixf.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osg/Multisample.cpp b/src/osg/Multisample.cpp index d0fcc1566..799cff488 100644 --- a/src/osg/Multisample.cpp +++ b/src/osg/Multisample.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -17,7 +17,7 @@ #include using namespace osg; - + Multisample::Multisample() : _mode(DONT_CARE) { @@ -31,12 +31,12 @@ Multisample::~Multisample() void Multisample::apply(State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - + const Extensions* extensions = getExtensions(contextID,true); - + if (!extensions->isMultisampleSupported()) { OSG_WARN<<"Warning: Multisample::apply(..) failed, Multisample is not support by OpenGL driver."<removeParent(this); if (_stateset->requiresUpdateTraversal()) --delta_update; if (_stateset->requiresEventTraversal()) --delta_event; } - + // set the stateset. _stateset = stateset; - + // add this node to the new stateset to the parent list. if (_stateset.valid()) { @@ -151,7 +151,7 @@ void Node::setStateSet(osg::StateSet* stateset) if (_stateset->requiresUpdateTraversal()) ++delta_update; if (_stateset->requiresEventTraversal()) ++delta_event; } - + if (delta_update!=0) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+delta_update); @@ -180,9 +180,9 @@ MatrixList Node::getWorldMatrices(const osg::Node* haltTraversalAtNode) const { CollectParentPaths cpp(haltTraversalAtNode); const_cast(this)->accept(cpp); - + MatrixList matrices; - + for(NodePathList::iterator itr = cpp._nodePaths.begin(); itr != cpp._nodePaths.end(); ++itr) @@ -197,7 +197,7 @@ MatrixList Node::getWorldMatrices(const osg::Node* haltTraversalAtNode) const matrices.push_back(osg::computeLocalToWorld(nodePath)); } } - + return matrices; } @@ -205,7 +205,7 @@ void Node::setUpdateCallback(NodeCallback* nc) { // if no changes just return. if (_updateCallback==nc) return; - + // updated callback has been changed, will need to update // both _updateCallback and possibly the numChildrenRequiringAppTraversal // if the number of callbacks changes. @@ -228,7 +228,7 @@ void Node::setUpdateCallback(NodeCallback* nc) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenRequiringUpdateTraversal( (*itr)->getNumChildrenRequiringUpdateTraversal()+delta ); } @@ -251,8 +251,8 @@ void Node::setNumChildrenRequiringUpdateTraversal(unsigned int num) // _numChildrenRequiringUpdateTraversal so no need to inform them. if (!_updateCallback && !_parents.empty()) { - - // need to pass on changes to parents. + + // need to pass on changes to parents. int delta = 0; if (_numChildrenRequiringUpdateTraversal>0) --delta; if (num>0) ++delta; @@ -264,7 +264,7 @@ void Node::setNumChildrenRequiringUpdateTraversal(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenRequiringUpdateTraversal( (*itr)->getNumChildrenRequiringUpdateTraversal()+delta ); @@ -272,10 +272,10 @@ void Node::setNumChildrenRequiringUpdateTraversal(unsigned int num) } } - + // finally update this objects value. _numChildrenRequiringUpdateTraversal=num; - + } @@ -283,7 +283,7 @@ void Node::setEventCallback(NodeCallback* nc) { // if no changes just return. if (_eventCallback==nc) return; - + // event callback has been changed, will need to Event // both _EventCallback and possibly the numChildrenRequiringAppTraversal // if the number of callbacks changes. @@ -306,7 +306,7 @@ void Node::setEventCallback(NodeCallback* nc) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenRequiringEventTraversal( (*itr)->getNumChildrenRequiringEventTraversal()+delta ); } @@ -329,8 +329,8 @@ void Node::setNumChildrenRequiringEventTraversal(unsigned int num) // _numChildrenRequiringEventTraversal so no need to inform them. if (!_eventCallback && !_parents.empty()) { - - // need to pass on changes to parents. + + // need to pass on changes to parents. int delta = 0; if (_numChildrenRequiringEventTraversal>0) --delta; if (num>0) ++delta; @@ -342,7 +342,7 @@ void Node::setNumChildrenRequiringEventTraversal(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenRequiringEventTraversal( (*itr)->getNumChildrenRequiringEventTraversal()+delta ); @@ -350,17 +350,17 @@ void Node::setNumChildrenRequiringEventTraversal(unsigned int num) } } - + // finally Event this objects value. _numChildrenRequiringEventTraversal=num; - + } void Node::setCullingActive(bool active) { // if no changes just return. if (_cullingActive == active) return; - + // culling active has been changed, will need to update // both _cullActive and possibly the parents numChildrenWithCullingDisabled // if culling disabled changes. @@ -382,7 +382,7 @@ void Node::setCullingActive(bool active) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenWithCullingDisabled( (*itr)->getNumChildrenWithCullingDisabled()+delta ); } @@ -404,8 +404,8 @@ void Node::setNumChildrenWithCullingDisabled(unsigned int num) // _numChildrenWithCullingDisabled so no need to inform them. if (_cullingActive && !_parents.empty()) { - - // need to pass on changes to parents. + + // need to pass on changes to parents. int delta = 0; if (_numChildrenWithCullingDisabled>0) --delta; if (num>0) ++delta; @@ -417,7 +417,7 @@ void Node::setNumChildrenWithCullingDisabled(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenWithCullingDisabled( (*itr)->getNumChildrenWithCullingDisabled()+delta ); @@ -425,7 +425,7 @@ void Node::setNumChildrenWithCullingDisabled(unsigned int num) } } - + // finally update this objects value. _numChildrenWithCullingDisabled=num; } @@ -441,8 +441,8 @@ void Node::setNumChildrenWithOccluderNodes(unsigned int num) // _numChildrenWithOccluderNodes so no need to inform them. if (!dynamic_cast(this) && !_parents.empty()) { - - // need to pass on changes to parents. + + // need to pass on changes to parents. int delta = 0; if (_numChildrenWithOccluderNodes>0) --delta; if (num>0) ++delta; @@ -454,7 +454,7 @@ void Node::setNumChildrenWithOccluderNodes(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { (*itr)->setNumChildrenWithOccluderNodes( (*itr)->getNumChildrenWithOccluderNodes()+delta ); @@ -462,10 +462,10 @@ void Node::setNumChildrenWithOccluderNodes(unsigned int num) } } - + // finally update this objects value. _numChildrenWithOccluderNodes=num; - + } bool Node::containsOccluderNodes() const @@ -544,7 +544,7 @@ void Node::dirtyBound() void Node::setThreadSafeRefUnref(bool threadSafe) { Object::setThreadSafeRefUnref(threadSafe); - + if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe); if (_updateCallback.valid()) _updateCallback->setThreadSafeRefUnref(threadSafe); if (_eventCallback.valid()) _eventCallback->setThreadSafeRefUnref(threadSafe); diff --git a/src/osg/NodeCallback.cpp b/src/osg/NodeCallback.cpp index dc3d3b3ab..8c59416a3 100644 --- a/src/osg/NodeCallback.cpp +++ b/src/osg/NodeCallback.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -20,4 +20,4 @@ void NodeCallback::traverse(Node* node,NodeVisitor* nv) { if (_nestedCallback.valid()) (*_nestedCallback)(node,nv); else nv->traverse(*node); -} +} diff --git a/src/osg/NodeTrackerCallback.cpp b/src/osg/NodeTrackerCallback.cpp index 3930d3cdf..565a5a9ac 100644 --- a/src/osg/NodeTrackerCallback.cpp +++ b/src/osg/NodeTrackerCallback.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,13 +43,13 @@ class ApplyMatrixVisitor : public NodeVisitor { mt.setMatrix(_matrix); } - + virtual void apply(PositionAttitudeTransform& pat) { pat.setPosition(_matrix.getTrans()); pat.setAttitude(_matrix.getRotate()); } - + osg::Matrix _matrix; }; diff --git a/src/osg/NodeVisitor.cpp b/src/osg/NodeVisitor.cpp index 085dc2cec..191c827ec 100644 --- a/src/osg/NodeVisitor.cpp +++ b/src/osg/NodeVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -152,7 +152,7 @@ void NodeVisitor::apply(Sequence& node) } void NodeVisitor::apply(LOD& node) -{ +{ apply(static_cast(node)); } @@ -172,6 +172,6 @@ void NodeVisitor::apply(OccluderNode& node) } void NodeVisitor::apply(OcclusionQueryNode& node) -{ +{ apply(static_cast(node)); } diff --git a/src/osg/Notify.cpp b/src/osg/Notify.cpp index fda36c4ee..4629bf54a 100644 --- a/src/osg/Notify.cpp +++ b/src/osg/Notify.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -39,7 +39,7 @@ public: NullStream(): std::ostream(new NullStreamBuffer) { _buffer = dynamic_cast(rdbuf()); } - + ~NullStream() { rdbuf(0); @@ -97,7 +97,7 @@ public: { return _buffer->getCurrentSeverity(); } - + ~NotifyStream() { rdbuf(0); @@ -153,7 +153,7 @@ bool osg::initNotifyLevel() g_NullStream = &s_NullStream; g_NotifyStream = &s_NotifyStream; - + // g_NotifyLevel // ============= @@ -183,7 +183,7 @@ bool osg::initNotifyLevel() else if(stringOSGNOTIFYLEVEL.find("DEBUG")!=std::string::npos) g_NotifyLevel=osg::DEBUG_INFO; else if(stringOSGNOTIFYLEVEL.find("INFO")!=std::string::npos) g_NotifyLevel=osg::INFO; else std::cout << "Warning: invalid OSG_NOTIFY_LEVEL set ("< @@ -20,7 +20,7 @@ namespace osg // // Object // -Object::Object(const Object& obj,const CopyOp& copyop): +Object::Object(const Object& obj,const CopyOp& copyop): Referenced(), _name(obj._name), _dataVariance(obj._dataVariance), @@ -54,11 +54,11 @@ void Object::setThreadSafeRefUnref(bool threadSafe) void Object::setUserDataContainer(osg::UserDataContainer* udc) { if (_userDataContainer == udc) return; - + if (_userDataContainer) _userDataContainer->unref(); - + _userDataContainer = udc; - + if (_userDataContainer) _userDataContainer->ref(); } @@ -71,7 +71,7 @@ osg::UserDataContainer* Object::getOrCreateUserDataContainer() void Object::setUserData(Referenced* obj) { if (getUserData()==obj) return; - + getOrCreateUserDataContainer()->setUserData(obj); } diff --git a/src/osg/OccluderNode.cpp b/src/osg/OccluderNode.cpp index a7f2d4f43..9d31ce156 100644 --- a/src/osg/OccluderNode.cpp +++ b/src/osg/OccluderNode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -27,7 +27,7 @@ OccluderNode::OccluderNode(const OccluderNode& node,const CopyOp& copyop): BoundingSphere OccluderNode::computeBound() const { BoundingSphere bsphere(Group::computeBound()); - + if (getOccluder()) { BoundingBox bb; diff --git a/src/osg/OcclusionQueryNode.cpp b/src/osg/OcclusionQueryNode.cpp index 5df6f6a69..d44f38c87 100644 --- a/src/osg/OcclusionQueryNode.cpp +++ b/src/osg/OcclusionQueryNode.cpp @@ -1,14 +1,14 @@ // // 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 -// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or +// This library is open source and may be redistributed and/or modified under +// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or // (at your option) any later version. The full license is in LICENSE file // included with this distribution, and on the openscenegraph.org website. -// +// // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // OpenSceneGraph Public License for more details. // @@ -244,7 +244,7 @@ struct ClearQueriesCallback : public osg::Camera::DrawCallback }; -// static cache of deleted query objects which can only +// static cache of deleted query objects which can only // be completely deleted once the appropriate OpenGL context // is set. typedef std::list< GLuint > QueryObjectList; @@ -439,7 +439,7 @@ QueryGeometry::flushDeletedQueryObjects( unsigned int contextID, double /*curren elapsedTime = timer.delta_s(start_tick,timer.tick()); } } - + availableTime -= elapsedTime; } diff --git a/src/osg/OperationThread.cpp b/src/osg/OperationThread.cpp index 5835928d9..25a84aabc 100644 --- a/src/osg/OperationThread.cpp +++ b/src/osg/OperationThread.cpp @@ -55,17 +55,17 @@ OperationQueue::~OperationQueue() { } -bool OperationQueue::empty() -{ +bool OperationQueue::empty() +{ OpenThreads::ScopedLock lock(_operationsMutex); - return _operations.empty(); + return _operations.empty(); } unsigned int OperationQueue::getNumOperationsInQueue() { OpenThreads::ScopedLock lock(_operationsMutex); - return static_cast(_operations.size()); + return static_cast(_operations.size()); } ref_ptr OperationQueue::getNextOperation(bool blockIfEmpty) @@ -76,15 +76,15 @@ ref_ptr OperationQueue::getNextOperation(bool blockIfEmpty) } OpenThreads::ScopedLock lock(_operationsMutex); - + if (_operations.empty()) return osg::ref_ptr(); - + if (_currentOperationIterator == _operations.end()) { // iterator at end of operations so reset to beginning. _currentOperationIterator = _operations.begin(); } - + ref_ptr currentOperation = *_currentOperationIterator; if (!currentOperation->getKeep()) @@ -139,11 +139,11 @@ void OperationQueue::remove(Operation* operation) if ((*itr)==operation) { bool needToResetCurrentIterator = (_currentOperationIterator == itr); - + itr = _operations.erase(itr); - + if (needToResetCurrentIterator) _currentOperationIterator = itr; - + } else ++itr; } @@ -152,7 +152,7 @@ void OperationQueue::remove(Operation* operation) void OperationQueue::remove(const std::string& name) { OSG_INFO<<"Doing remove named operation"< lock(_operationsMutex); @@ -160,12 +160,12 @@ void OperationQueue::remove(const std::string& name) for(Operations::iterator itr = _operations.begin(); itr!=_operations.end();) { - if ((*itr)->getName()==name) + if ((*itr)->getName()==name) { bool needToResetCurrentIterator = (_currentOperationIterator == itr); - + itr = _operations.erase(itr); - + if (needToResetCurrentIterator) _currentOperationIterator = itr; } else ++itr; @@ -182,9 +182,9 @@ void OperationQueue::removeAllOperations() OSG_INFO<<"Doing remove all operations"< lock(_operationsMutex); - + _operations.clear(); - + // reset current operator. _currentOperationIterator = _operations.begin(); @@ -200,7 +200,7 @@ void OperationQueue::runOperations(Object* callingObject) // reset current operation iterator to beginning if at end. if (_currentOperationIterator==_operations.end()) _currentOperationIterator = _operations.begin(); - + for(; _currentOperationIterator != _operations.end(); ) @@ -215,7 +215,7 @@ void OperationQueue::runOperations(Object* callingObject) { ++_currentOperationIterator; } - + // OSG_INFO<<"Doing op "<<_currentOperation->getName()<<" "<release(); } - + void OperationQueue::releaseAllOperations() { OpenThreads::ScopedLock lock(_operationsMutex); - + for(Operations::iterator itr = _operations.begin(); itr!=_operations.end(); ++itr) @@ -300,7 +300,7 @@ void OperationThread::setDone(bool done) if (done) { OSG_INFO<<"set done "< lock(_threadMutex); if (_currentOperation.valid()) @@ -321,7 +321,7 @@ int OperationThread::cancel() int result = 0; if( isRunning() ) { - + _done = true; OSG_INFO<<" Doing cancel "< lock(_threadMutex); - if (_operationQueue.valid()) + if (_operationQueue.valid()) { _operationQueue->releaseOperationsBlock(); //_operationQueue->releaseAllOperations(); @@ -337,7 +337,7 @@ int OperationThread::cancel() if (_currentOperation.valid()) _currentOperation->release(); } - + // then wait for the the thread to stop running. while(isRunning()) { @@ -346,7 +346,7 @@ int OperationThread::cancel() { OpenThreads::ScopedLock lock(_threadMutex); - if (_operationQueue.valid()) + if (_operationQueue.valid()) { _operationQueue->releaseOperationsBlock(); // _operationQueue->releaseAllOperations(); @@ -403,7 +403,7 @@ void OperationThread::run() // OSG_NOTICE<<"In thread loop "< operation; ref_ptr operationQueue; - + { OpenThreads::ScopedLock lock(_threadMutex); operationQueue = _operationQueue; @@ -425,7 +425,7 @@ void OperationThread::run() // call the graphics operation. (*operation)(_parent.get()); - { + { OpenThreads::ScopedLock lock(_threadMutex); _currentOperation = 0; } @@ -433,12 +433,12 @@ void OperationThread::run() if (firstTime) { - // do a yield to get round a peculiar thread hang when testCancel() is called + // do a yield to get round a peculiar thread hang when testCancel() is called // in certain circumstances - of which there is no particular pattern. YieldCurrentThread(); firstTime = false; } - + // OSG_NOTICE<<"operations.size()="<<_operations.size()<<" done="<<_done<<" testCancel()"<getFrameNumber()); } @@ -298,7 +298,7 @@ bool PagedLOD::removeExpiredChildren(double expiryTime, unsigned int expiryFrame if (!_perRangeDataList[cindex]._filename.empty() && _perRangeDataList[cindex]._timeStamp + _perRangeDataList[cindex]._minExpiryTime < expiryTime && _perRangeDataList[cindex]._frameNumber + _perRangeDataList[cindex]._minExpiryFrames < expiryFrame) - { + { osg::Node* nodeToRemove = _children[cindex].get(); removedChildren.push_back(nodeToRemove); return Group::removeChildren(cindex,1); diff --git a/src/osg/Point.cpp b/src/osg/Point.cpp index a70e4e955..2e984cabf 100644 --- a/src/osg/Point.cpp +++ b/src/osg/Point.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -145,7 +145,7 @@ void Point::Extensions::setupGLExtensions(unsigned int contextID) isGLExtensionSupported(contextID,"GL_ARB_point_parameters") || isGLExtensionSupported(contextID,"GL_EXT_point_parameters") || isGLExtensionSupported(contextID,"GL_SGIS_point_parameters"); - + _isPointSpriteCoordOriginSupported = OSG_GL3_FEATURES || strncmp((const char*)glGetString(GL_VERSION),"2.0",3)>=0; setGLExtensionFuncPtr(_glPointParameteri, "glPointParameteri", "glPointParameteriARB"); diff --git a/src/osg/PointSprite.cpp b/src/osg/PointSprite.cpp index 68d71c282..2d53f61e9 100644 --- a/src/osg/PointSprite.cpp +++ b/src/osg/PointSprite.cpp @@ -10,7 +10,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ - + #include #include #include diff --git a/src/osg/PolygonMode.cpp b/src/osg/PolygonMode.cpp index bcb9bf0d2..238c2eaf2 100644 --- a/src/osg/PolygonMode.cpp +++ b/src/osg/PolygonMode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -48,7 +48,7 @@ void PolygonMode::setMode(Face face,Mode mode) _modeFront = mode; _modeBack = mode; break; - } + } } PolygonMode::Mode PolygonMode::getMode(Face face) const @@ -61,7 +61,7 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const return _modeBack; case(FRONT_AND_BACK): return _modeFront; - } + } OSG_WARN<<"Warning : invalid Face passed to PolygonMode::getMode(Face face)"< @@ -92,6 +92,6 @@ void PolygonOffset::apply(State&) const { if (!s_MultiplerSet) setFactorAndUnitsMultipliersUsingBestGuessForDriver(); - glPolygonOffset(_factor * s_FactorMultipler, + glPolygonOffset(_factor * s_FactorMultipler, _units * s_UnitsMultipler); } diff --git a/src/osg/PolygonStipple.cpp b/src/osg/PolygonStipple.cpp index 8442cba34..f56e03d86 100644 --- a/src/osg/PolygonStipple.cpp +++ b/src/osg/PolygonStipple.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -73,7 +73,7 @@ int PolygonStipple::compare(const StateAttribute& sa) const return 0; // passed all the above comparison macros, must be equal. } - + void PolygonStipple::setMask(const GLubyte* givenMask) { std::copy(givenMask,givenMask+128,_mask); diff --git a/src/osg/PositionAttitudeTransform.cpp b/src/osg/PositionAttitudeTransform.cpp index 1be9ed8c4..26979a856 100644 --- a/src/osg/PositionAttitudeTransform.cpp +++ b/src/osg/PositionAttitudeTransform.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/PrimitiveSet.cpp b/src/osg/PrimitiveSet.cpp index 09b981e2b..834d39d11 100644 --- a/src/osg/PrimitiveSet.cpp +++ b/src/osg/PrimitiveSet.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -30,17 +30,17 @@ unsigned int PrimitiveSet::getNumPrimitives() const case(TRIANGLE_STRIP): case(TRIANGLE_FAN): case(QUAD_STRIP): - case(PATCHES): + case(PATCHES): case(POLYGON): return 1; } return 0; } -void DrawArrays::draw(State& state, bool) const +void DrawArrays::draw(State& state, bool) const { -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) +#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) GLenum mode = _mode; - if (_mode==GL_QUADS) + if (_mode==GL_QUADS) { state.drawQuads(_first, _count, _numInstances); return; @@ -94,8 +94,8 @@ unsigned int DrawArrayLengths::getNumPrimitives() const void DrawArrayLengths::draw(State& state, bool) const { GLenum mode = _mode; - #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) - if (_mode==GL_QUADS) + #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) + if (_mode==GL_QUADS) { GLint first = _first; for(vector_type::const_iterator itr=begin(); @@ -105,7 +105,7 @@ void DrawArrayLengths::draw(State& state, bool) const state.drawQuads(first, *itr, _numInstances); first += *itr; } - + return; } if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN; @@ -164,10 +164,10 @@ DrawElementsUByte::~DrawElementsUByte() releaseGLObjects(); } -void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const +void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const { GLenum mode = _mode; - #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) + #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN; if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP; #endif @@ -187,7 +187,7 @@ void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const else glDrawElements(mode, size(), GL_UNSIGNED_BYTE, &front()); } } - else + else { if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_BYTE, &front(), _numInstances); else glDrawElements(mode, size(), GL_UNSIGNED_BYTE, &front()); @@ -220,10 +220,10 @@ DrawElementsUShort::~DrawElementsUShort() releaseGLObjects(); } -void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const +void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const { GLenum mode = _mode; - #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) + #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN; if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP; #endif @@ -243,7 +243,7 @@ void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, &front()); } } - else + else { if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, &front(), _numInstances); else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, &front()); @@ -276,10 +276,10 @@ DrawElementsUInt::~DrawElementsUInt() releaseGLObjects(); } -void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const +void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const { GLenum mode = _mode; - #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) + #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN; if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP; #endif @@ -299,7 +299,7 @@ void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const else glDrawElements(mode, size(), GL_UNSIGNED_INT, &front()); } } - else + else { if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_INT, &front(), _numInstances); else glDrawElements(mode, size(), GL_UNSIGNED_INT, &front()); diff --git a/src/osg/Program.cpp b/src/osg/Program.cpp index 8cb978f35..2277ccd6a 100644 --- a/src/osg/Program.cpp +++ b/src/osg/Program.cpp @@ -1,13 +1,13 @@ -/* -*-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) 2004-2005 Nathan Cournia * Copyright (C) 2008 Zebra Imaging * 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 * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -183,7 +183,7 @@ int Program::compare(const osg::StateAttribute& sa) const // check the types are equal and then create the rhs variable // used by the COMPARE_StateAttribute_Parameter macros below. COMPARE_StateAttribute_Types(Program,sa) - + if( _shaderList.size() < rhs._shaderList.size() ) return -1; if( rhs._shaderList.size() < _shaderList.size() ) return 1; @@ -272,7 +272,7 @@ void Program::releaseGLObjects(osg::State* state) const { unsigned int contextID = state->getContextID(); _pcpList[contextID] = 0; - } + } } bool Program::addShader( Shader* shader ) @@ -389,7 +389,7 @@ GLint Program::getParameter( GLenum pname ) const case GL_GEOMETRY_VERTICES_OUT_EXT: return _geometryVerticesOut; case GL_GEOMETRY_INPUT_TYPE_EXT: return _geometryInputType; case GL_GEOMETRY_OUTPUT_TYPE_EXT: return _geometryOutputType; - case GL_PATCH_VERTICES: return _patchVertices; + case GL_PATCH_VERTICES: return _patchVertices; } OSG_WARN << "getParameter invalid param " << pname << std::endl; return 0; @@ -651,10 +651,10 @@ void Program::PerContextProgram::linkProgram(osg::State& state) std::string infoLog; if( getInfoLog(infoLog) ) { - OSG_WARN << "Program \""<< _program->getName() << "\" " + OSG_WARN << "Program \""<< _program->getName() << "\" " "infolog:\n" << infoLog << std::endl; } - + return; } else @@ -745,7 +745,7 @@ void Program::PerContextProgram::linkProgram(osg::State& state) } GLint loc = _extensions->glGetUniformLocation( _glProgramHandle, name ); - + if( loc != -1 ) { _uniformInfoMap[Uniform::getNameID(reinterpret_cast(name))] = ActiveVarInfo(loc,type,size); @@ -776,7 +776,7 @@ void Program::PerContextProgram::linkProgram(osg::State& state) i, maxLen, 0, &size, &type, name ); GLint loc = _extensions->glGetAttribLocation( _glProgramHandle, name ); - + if( loc != -1 ) { _attribInfoMap[reinterpret_cast(name)] = ActiveVarInfo(loc,type,size); @@ -810,7 +810,7 @@ bool Program::PerContextProgram::validateProgram() OSG_WARN << "infolog:\n" << infoLog << std::endl; OSG_WARN << std::endl; - + return false; } diff --git a/src/osg/Projection.cpp b/src/osg/Projection.cpp index 5ebbe58f7..bfaf757fd 100644 --- a/src/osg/Projection.cpp +++ b/src/osg/Projection.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -21,7 +21,7 @@ Projection::Projection() Projection::Projection(const Projection& projection,const CopyOp& copyop): Group(projection,copyop), _matrix(projection._matrix) -{ +{ } Projection::Projection(const Matrix& mat ) diff --git a/src/osg/ProxyNode.cpp b/src/osg/ProxyNode.cpp index 57904256e..28c93c6bd 100644 --- a/src/osg/ProxyNode.cpp +++ b/src/osg/ProxyNode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -17,12 +17,12 @@ using namespace osg; -ProxyNode::ProxyNode() : +ProxyNode::ProxyNode() : _loadingExtReference(LOAD_IMMEDIATELY), _centerMode(USER_DEFINED_CENTER), _radius(-1) { -} +} ProxyNode::ProxyNode(const ProxyNode& proxynode,const CopyOp& copyop): Group(proxynode,copyop), diff --git a/src/osg/Quat.cpp b/src/osg/Quat.cpp index 2a851079c..7c1f3ee61 100644 --- a/src/osg/Quat.cpp +++ b/src/osg/Quat.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -81,16 +81,16 @@ void Quat::makeRotate( value_type angle, const Vec3d& vec ) } -void Quat::makeRotate ( value_type angle1, const Vec3f& axis1, +void Quat::makeRotate ( value_type angle1, const Vec3f& axis1, value_type angle2, const Vec3f& axis2, value_type angle3, const Vec3f& axis3) { makeRotate(angle1,Vec3d(axis1), angle2,Vec3d(axis2), angle3,Vec3d(axis3)); -} +} -void Quat::makeRotate ( value_type angle1, const Vec3d& axis1, +void Quat::makeRotate ( value_type angle1, const Vec3d& axis1, value_type angle2, const Vec3d& axis2, value_type angle3, const Vec3d& axis3) { @@ -99,7 +99,7 @@ void Quat::makeRotate ( value_type angle1, const Vec3d& axis1, Quat q3; q3.makeRotate(angle3,axis3); *this = q1*q2*q3; -} +} void Quat::makeRotate( const Vec3f& from, const Vec3f& to ) @@ -109,14 +109,14 @@ void Quat::makeRotate( const Vec3f& from, const Vec3f& to ) /** Make a rotation Quat which will rotate vec1 to vec2 -This routine uses only fast geometric transforms, without costly acos/sin computations. +This routine uses only fast geometric transforms, without costly acos/sin computations. It's exact, fast, and with less degenerate cases than the acos/sin method. -For an explanation of the math used, you may see for example: +For an explanation of the math used, you may see for example: http://logiciels.cnes.fr/MARMOTTES/marmottes-mathematique.pdf -@note This is the rotation with shortest angle, which is the one equivalent to the -acos/sin transform method. Other rotations exists, for example to additionally keep +@note This is the rotation with shortest angle, which is the one equivalent to the +acos/sin transform method. Other rotations exists, for example to additionally keep a local horizontal attitude. @author Nicolas Brodu @@ -124,7 +124,7 @@ a local horizontal attitude. void Quat::makeRotate( const Vec3d& from, const Vec3d& to ) { - // This routine takes any vector as argument but normalized + // This routine takes any vector as argument but normalized // vectors are necessary, if only for computing the dot product. // Too bad the API is that generic, it leads to performance loss. // Even in the case the 2 vectors are not normalized but same length, @@ -133,7 +133,7 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to ) // So, we have to test... in the hope of saving at least a sqrt Vec3d sourceVector = from; Vec3d targetVector = to; - + value_type fromLen2 = from.length2(); value_type fromLen; // normalize only when necessary, epsilon test @@ -141,7 +141,7 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to ) fromLen = sqrt(fromLen2); sourceVector /= fromLen; } else fromLen = 1.0; - + value_type toLen2 = to.length2(); // normalize only when necessary, epsilon test if ((toLen2 < 1.0-1e-7) || (toLen2 > 1.0+1e-7)) { @@ -149,26 +149,26 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to ) // re-use fromLen for case of mapping 2 vectors of the same length if ((toLen2 > fromLen2-1e-7) && (toLen2 < fromLen2+1e-7)) { toLen = fromLen; - } + } else toLen = sqrt(toLen2); targetVector /= toLen; } - + // Now let's get into the real stuff // Use "dot product plus one" as test as it can be re-used later on double dotProdPlus1 = 1.0 + sourceVector * targetVector; - + // Check for degenerate case of full u-turn. Use epsilon for detection if (dotProdPlus1 < 1e-7) { - + // Get an orthogonal vector of the given vector // in a plane with maximum vector coordinates. // Then use it as quaternion axis with pi angle // Trick is to realize one value at least is >0.6 for a normalized vector. if (fabs(sourceVector.x()) < 0.6) { const double norm = sqrt(1.0 - sourceVector.x() * sourceVector.x()); - _v[0] = 0.0; + _v[0] = 0.0; _v[1] = sourceVector.z() / norm; _v[2] = -sourceVector.y() / norm; _v[3] = 0.0; @@ -186,7 +186,7 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to ) _v[3] = 0.0; } } - + else { // Find the shortest angle quaternion that transforms normalized vectors // into one other. Formula is still valid when vectors are colinear @@ -211,14 +211,14 @@ void Quat::makeRotate_original( const Vec3d& from, const Vec3d& to ) value_type length1 = from.length(); value_type length2 = to.length(); - + // dot product vec1*vec2 value_type cosangle = from*to/(length1*length2); if ( fabs(cosangle - 1) < epsilon ) { OSG_INFO<<"*** Quat::makeRotate(from,to) with near co-linear vectors, epsilon= "< @@ -87,7 +87,7 @@ OpenThreads::Mutex* Referenced::getGlobalReferencedMutex() return s_ReferencedGlobalMutext.get(); } -// helper class for forcing the global mutex to be constructed when the library is loaded. +// helper class for forcing the global mutex to be constructed when the library is loaded. struct InitGlobalMutexes { InitGlobalMutexes() @@ -158,7 +158,7 @@ Referenced::Referenced(): #endif _refMutex = new OpenThreads::Mutex; #endif - + #ifdef DEBUG_OBJECT_ALLOCATION_DESTRUCTION { OpenThreads::ScopedLock lock(getNumObjectMutex()); diff --git a/src/osg/Scissor.cpp b/src/osg/Scissor.cpp index e22321953..ac9aac4f1 100644 --- a/src/osg/Scissor.cpp +++ b/src/osg/Scissor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/Sequence.cpp b/src/osg/Sequence.cpp index a46b27096..8b5460096 100644 --- a/src/osg/Sequence.cpp +++ b/src/osg/Sequence.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -39,7 +39,7 @@ Sequence::Sequence() : _mode(STOP), _sync(false), _clearOnStop(false) - + { setNumChildrenRequiringUpdateTraversal(1); } @@ -66,7 +66,7 @@ Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) : _sync(seq._sync), _clearOnStop(seq._clearOnStop) { - setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } bool Sequence::addChild( Node *child) @@ -115,8 +115,8 @@ bool Sequence::removeChild( Node *child ) bool Sequence::removeChildren(unsigned int pos,unsigned int numChildrenToRemove) { if (pos<_frameTime.size()) - _frameTime.erase(_frameTime.begin()+pos, - osg::minimum(_frameTime.begin()+(pos+numChildrenToRemove), + _frameTime.erase(_frameTime.begin()+pos, + osg::minimum(_frameTime.begin()+(pos+numChildrenToRemove), _frameTime.end()) ); _resetTotalTime = true; return Group::removeChildren(pos,numChildrenToRemove); @@ -140,7 +140,7 @@ void Sequence::setTime(unsigned int frame, double t) _frameTime.push_back(t); } } - + } // returns a frame time of -1 if frame is out of range @@ -178,7 +178,7 @@ void Sequence::setMode(SequenceMode mode) { int ubegin, uend; - switch (mode) + switch (mode) { case START: // restarts sequence from beginning @@ -222,11 +222,11 @@ void Sequence::traverse(NodeVisitor& nv) } - if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR && + if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR && _mode == START && !_frameTime.empty() && getNumChildren()!=0) { - + // if begin or end < 0, make it last frame int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin); int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end); @@ -278,8 +278,8 @@ void Sequence::traverse(NodeVisitor& nv) } else { - if ( (_loopMode == LOOP) && - ( (_step>0 && _value!=_send) || + if ( (_loopMode == LOOP) && + ( (_step>0 && _value!=_send) || (_step<0 && _value!=_sbegin))) { _mode = STOP; @@ -293,7 +293,7 @@ void Sequence::traverse(NodeVisitor& nv) } } - + // update local variables _update(); @@ -306,12 +306,12 @@ void Sequence::traverse(NodeVisitor& nv) { // case 2 or case 3 // most of the time it's just the next frame in the sequence int nextValue = _getNextValue(); - if (!_sync || + if (!_sync || ((_now - _start) <= (_frameTime[_value]+_frameTime[nextValue])*osg::absolute(_speed)) ) { _start += _frameTime[_value]*osg::absolute(_speed); // repeat or change directions? - if ( (_step>0 && nextValue==_send) || + if ( (_step>0 && nextValue==_send) || (_step<0 && nextValue==_sbegin)) { if (_nreps>0) @@ -330,23 +330,23 @@ void Sequence::traverse(NodeVisitor& nv) // elapsed time from start of the frame double deltaT = _now - _start; - + // factors _speed into account double adjTotalTime = _totalTime*osg::absolute(_speed); - + // how many laps? int loops = (int)(deltaT/adjTotalTime); - - + + // adjust reps & quick check to see if done becuase reps used up - + if (_nreps>0) { if (_loopMode == LOOP) _nrepsRemain -= loops; else _nrepsRemain -= 2*loops; - + if (_nrepsRemain<=0) { _nrepsRemain = 0; @@ -354,17 +354,17 @@ void Sequence::traverse(NodeVisitor& nv) OSG_WARN << "stopping because elapsed time greater or equal to time remaining to repeat the sequence\n"; } } - + // deduct off time for laps- _value shouldn't change as it's modulo the total time double jumpStart = ((double)loops * adjTotalTime); - + // step through frames one at a time until caught up while (deltaT-jumpStart > _frameTime[_value]*osg::absolute(_speed)) { jumpStart += _frameTime[_value]*osg::absolute(_speed ); _value = _getNextValue(); } - + // set start time _start += jumpStart; } @@ -398,7 +398,7 @@ int Sequence::_getNextValue() // if begin or end < 0, make it last frame int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin); int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end); - + int _sbegin = osg::minimum(_ubegin,_uend); int _send = osg::maximum(_ubegin,_uend); @@ -422,7 +422,7 @@ int Sequence::_getNextValue() { v+=vs; } - + return v; } else // SWING @@ -444,7 +444,7 @@ void Sequence::_update() // if begin or end < 0, make it last frame int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin); int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end); - + int _sbegin = osg::minimum(_ubegin,_uend); int _send = osg::maximum(_ubegin,_uend); @@ -454,14 +454,14 @@ void Sequence::_update() _value = (_begin < 0 ? (int)_frameTime.size()-1: _begin); _resetTotalTime = true; } - + // if _start<0, new or restarted if (_start<0) { _start = _now; _resetTotalTime = true; } - + // need to calculate time of a complete sequence? // time is different depending on loop mode if (_resetTotalTime) @@ -490,5 +490,5 @@ void Sequence::_update() _resetTotalTime = false; } - + } diff --git a/src/osg/ShadeModel.cpp b/src/osg/ShadeModel.cpp index ec1c7f09d..3195b5769 100644 --- a/src/osg/ShadeModel.cpp +++ b/src/osg/ShadeModel.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/Shader.cpp b/src/osg/Shader.cpp index 0a90cf054..f1da48a12 100644 --- a/src/osg/Shader.cpp +++ b/src/osg/Shader.cpp @@ -1,13 +1,13 @@ -/* -*-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) 2004-2005 Nathan Cournia * Copyright (C) 2008 Zebra Imaging * 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 * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -473,7 +473,7 @@ void Shader::PerContextShader::requestCompile() _isCompiled = false; } -namespace +namespace { std::string insertLineNumbers(const std::string& source) { @@ -531,7 +531,7 @@ void Shader::PerContextShader::compileShader(osg::State& state) return; } } - + if (_shader->getShaderSource().empty()) { OSG_WARN<<"Warning: No suitable shader of supported format by GLES driver found in shader binary, unable to compile shader."< @@ -66,19 +66,19 @@ unsigned int clip(const Plane& plane,const PointList& in, PointList& out,unsigne for(unsigned int i=0;i=0.0f) { out.push_back(in[i]); - - + + if (distance[i_1]<0.0f) { unsigned int mask = (in[i].first & in[i_1].first) | planeMask; float r = distance[i_1]/(distance[i_1]-distance[i]); out.push_back(Point(mask,in[i].second*r+in[i_1].second*(1.0f-r))); } - + } else if (distance[i_1]>0.0f) { @@ -87,7 +87,7 @@ unsigned int clip(const Plane& plane,const PointList& in, PointList& out,unsigne out.push_back(Point(mask,in[i].second*r+in[i_1].second*(1.0f-r))); } } - + return out.size(); } @@ -97,7 +97,7 @@ unsigned int clip(const Polytope::PlaneList& planeList,const VertexList& vin,Poi { PointList in; copyVertexListToPointList(vin,in); - + unsigned int planeMask = 0x1; for(Polytope::PlaneList::const_iterator itr=planeList.begin(); itr!=planeList.end(); @@ -190,33 +190,33 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex // take a reference to the projection matrix. _projectionMatrix = &P; - + // initialize the volume _volume = 0.0f; - + // compute the inverse of the projection matrix. Matrix invP; invP.invert(P); - + float volumeview = cullStack.getFrustumVolume(); - + // compute the transformation matrix which takes form local coords into clip space. Matrix MVP(MV*P); - + // for the occluder polygon and each of the holes do // first transform occluder polygon into clipspace by multiple it by c[i] = v[i]*(MV*P) // then push to coords to far plane by setting its coord to c[i].z = -1. // then transform far plane polygon back into projection space, by p[i]*inv(P) // compute orientation of front plane, if normal.z()<0 then facing away from eye pont, so reverse the polygons, or simply invert planes. // compute volume (quality) betwen front polygon in projection space and back polygon in projection space. - - + + const VertexList& vertices_in = occluder.getOccluder().getVertexList(); - + PointList points; - + if (clip(cullingset.getFrustum().getPlaneList(),vertices_in,points)>=3) { // compute the points on the far plane. @@ -225,7 +225,7 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex transform(points,farPoints,MVP); pushToFarPlane(farPoints); transform(farPoints,invP); - + // move the occlude points into projection space. transform(points,MV); @@ -241,16 +241,16 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex computePlanes(points,farPoints,_occluderVolume.getPlaneList()); _occluderVolume.setupMask(); - + // if the front face is pointing away from the eye point flip the whole polytope. if (occludePlane[3]>0.0f) { _occluderVolume.flip(); } - + _volume = computePolytopeVolume(points,farPoints)/volumeview; - + for(ConvexPlanarOccluder::HoleList::const_iterator hitr=occluder.getHoleList().begin(); hitr!=occluder.getHoleList().end(); ++hitr) @@ -292,7 +292,7 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex // remove the hole's volume from the occluder volume. _volume -= computePolytopeVolume(points,farPoints)/volumeview; } - + } //std::cout << "final volume = "<<_volume< @@ -71,7 +71,7 @@ HeightField::HeightField(): _heights = new osg::FloatArray; } -HeightField::HeightField(const HeightField& mesh,const CopyOp& copyop): +HeightField::HeightField(const HeightField& mesh,const CopyOp& copyop): Shape(mesh,copyop), _columns(mesh._columns), _rows(mesh._rows), @@ -99,7 +99,7 @@ void HeightField::allocate(unsigned int numColumns,unsigned int numRows) _rows=numRows; } -Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const +Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const { // four point normal generation. float dz_dx; @@ -115,7 +115,7 @@ Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const { dz_dx = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r))/getXInterval(); } - + float dz_dy; if (r==0) { @@ -129,10 +129,10 @@ Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const { dz_dy = 0.5f*(getHeight(c,r+1)-getHeight(c,r-1))/getYInterval(); } - + Vec3 normal(-dz_dx,-dz_dy,1.0f); normal.normalize(); - + return normal; } @@ -152,7 +152,7 @@ Vec2 HeightField::getHeightDelta(unsigned int c,unsigned int r) const { heightDelta.x() = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r)); } - + if (r==0) { heightDelta.y() = (getHeight(c,r+1)-getHeight(c,r)); diff --git a/src/osg/ShapeDrawable.cpp b/src/osg/ShapeDrawable.cpp index 9129eb612..4ec446571 100644 --- a/src/osg/ShapeDrawable.cpp +++ b/src/osg/ShapeDrawable.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -29,7 +29,7 @@ const unsigned int MIN_NUM_SEGMENTS = 5; class DrawShapeVisitor : public ConstShapeVisitor { public: - + DrawShapeVisitor(State& state,const TessellationHints* hints): _state(state), _hints(hints) @@ -39,9 +39,9 @@ class DrawShapeVisitor : public ConstShapeVisitor { OSG_NOTICE<<"Warning: TessellationHints ignored in present osg::ShapeDrawable implementation."<getCreateFrontFace() : true; bool drawBackFace = _hints ? _hints->getCreateBackFace() : false; - + // The only difference between the font & back face loops is that the // normals are inverted and the order of the vertex pairs is reversed. - // The code is mostly duplicated in order to hoist the back/front face + // The code is mostly duplicated in order to hoist the back/front face // test out of the loop for efficiency GLBeginEndAdapter& gl = _state.getGLBeginEndAdapter(); @@ -104,26 +104,26 @@ void DrawShapeVisitor::drawCylinderBody(unsigned int numSegments, float radius, { float c = cosf(angle); float s = sinf(angle); - + gl.Normal3f(c,s,0.0f); - + gl.TexCoord2f(texCoord,1.0f); gl.Vertex3f(c*r,s*r,topz); - + gl.TexCoord2f(texCoord,0.0f); gl.Vertex3f(c*r,s*r,basez); } - + // do last point by hand to ensure no round off errors. gl.Normal3f(1.0f,0.0f,0.0f); - + gl.TexCoord2f(1.0f,1.0f); gl.Vertex3f(r,0.0f,topz); - + gl.TexCoord2f(1.0f,0.0f); gl.Vertex3f(r,0.0f,basez); } - + if (drawBackFace) { for(unsigned int bodyi=0; bodyigetNumElements();++i) @@ -1327,7 +1327,7 @@ void ComputeBoundShapeVisitor::apply(const CompositeShape& group) class PrimitiveShapeVisitor : public ConstShapeVisitor { public: - + PrimitiveShapeVisitor(PrimitiveFunctor& functor,const TessellationHints* hints): _functor(functor), _hints(hints) {} @@ -1362,15 +1362,15 @@ class PrimitiveShapeVisitor : public ConstShapeVisitor void PrimitiveShapeVisitor::createCylinderBody(unsigned int numSegments, float radius, float height, const osg::Matrix& matrix) { const float angleDelta = 2.0f*osg::PI/(float)numSegments; - + const float r = radius; const float h = height; - + float basez = -h*0.5f; float topz = h*0.5f; - + float angle = 0.0f; - + _functor.begin(GL_QUAD_STRIP); for(unsigned int bodyi=0; @@ -1387,7 +1387,7 @@ void PrimitiveShapeVisitor::createCylinderBody(unsigned int numSegments, float r // do last point by hand to ensure no round off errors. _functor.vertex(osg::Vec3(r,0.0f,topz) * matrix); _functor.vertex(osg::Vec3(r,0.0f,basez) * matrix); - + _functor.end(); } @@ -1433,20 +1433,20 @@ void PrimitiveShapeVisitor::createHalfSphere(unsigned int numSegments, unsigned _functor.vertex(osg::Vec3(c*rBase,s*rBase,zBase+zOffset) * matrix); } - + // do last point by hand to ensure no round off errors. _functor.vertex(osg::Vec3(rTop,0.0f,zTop+zOffset) * matrix); - _functor.vertex(osg::Vec3(rBase,0.0f,zBase+zOffset) * matrix); + _functor.vertex(osg::Vec3(rBase,0.0f,zBase+zOffset) * matrix); _functor.end(); - - + + lBase=lTop; rBase=rTop; zBase=zTop; vBase=vTop; } - + } @@ -1558,7 +1558,7 @@ void PrimitiveShapeVisitor::apply(const Box& box) { Matrix matrix = box.computeRotationMatrix(); matrix.setTrans(box.getCenter()); - + base_1 = base_1*matrix; base_2 = base_2*matrix; base_3 = base_3*matrix; @@ -1843,7 +1843,7 @@ void PrimitiveShapeVisitor::apply(const TriangleMesh& mesh) { const Vec3Array* vertices = mesh.getVertices(); const IndexArray* indices = mesh.getIndices(); - + if (vertices && indices) { _functor.begin(GL_TRIANGLES); @@ -1869,7 +1869,7 @@ void PrimitiveShapeVisitor::apply(const ConvexHull& hull) void PrimitiveShapeVisitor::apply(const HeightField& field) { if (field.getNumColumns()==0 || field.getNumRows()==0) return; - + Matrix matrix = field.computeRotationMatrix(); matrix.setTrans(field.getOrigin()); @@ -1947,9 +1947,9 @@ void ShapeDrawable::setColor(const Vec4& color) void ShapeDrawable::setTessellationHints(TessellationHints* hints) { - if (_tessellationHints!=hints) + if (_tessellationHints!=hints) { - _tessellationHints = hints; + _tessellationHints = hints; dirtyDisplayList(); } } @@ -1962,9 +1962,9 @@ void ShapeDrawable::drawImplementation(RenderInfo& renderInfo) const if (_shape.valid()) { gl.Color4fv(_color.ptr()); - + DrawShapeVisitor dsv(state,_tessellationHints.get()); - + _shape->accept(dsv); } } diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 3328929af..7e2fa5f0c 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -57,11 +57,11 @@ State::State(): #if !defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) _useModelViewAndProjectionUniforms = true; _useVertexAttributeAliasing = true; - #else + #else _useModelViewAndProjectionUniforms = false; _useVertexAttributeAliasing = false; #endif - + _modelViewMatrixUniform = new Uniform(Uniform::FLOAT_MAT4,"osg_ModelViewMatrix"); _projectionMatrixUniform = new Uniform(Uniform::FLOAT_MAT4,"osg_ProjectionMatrix"); _modelViewProjectionMatrixUniform = new Uniform(Uniform::FLOAT_MAT4,"osg_ModelViewProjectionMatrix"); @@ -109,7 +109,7 @@ State::State(): } } - _abortRenderingPtr = NULL; + _abortRenderingPtr = NULL; _checkGLErrors = ONCE_PER_FRAME; @@ -134,7 +134,7 @@ State::State(): _isVertexBufferObjectSupportResolved = false; _isVertexBufferObjectSupported = false; - + _lastAppliedProgramObject = 0; _extensionProcsInitialized = false; @@ -186,7 +186,7 @@ void State::objectDeleted(void* object) { const Program::PerContextProgram* ppcp = reinterpret_cast(object); AppliedProgramObjectSet::iterator itr = _appliedProgramObjectSet.find(ppcp); - if (itr != _appliedProgramObjectSet.end()) + if (itr != _appliedProgramObjectSet.end()) { // OSG_NOTICE<<"Removing _appliedProgramObjectSet entry "<resetAppliedUniforms(); (*apitr)->removeObserver(this); } - + _appliedProgramObjectSet.clear(); - - + + // what about uniforms??? need to clear them too... // go through all active Unfirom's, setting to change to force update, // the idea is to leave only the global defaults left. @@ -332,7 +332,7 @@ void State::pushStateSet(const StateSet* dstate) pushModeList(_modeMap,dstate->getModeList()); - // iterator through texture modes. + // iterator through texture modes. unsigned int unit; const StateSet::TextureModeList& ds_textureModeList = dstate->getTextureModeList(); for(unit=0;unitgetModeList()); - // iterator through texture modes. + // iterator through texture modes. unsigned int unit; const StateSet::TextureModeList& ds_textureModeList = dstate->getTextureModeList(); for(unit=0;unitgetUniformList()); } - + // remove the top draw state from the stack. _stateStateStack.pop_back(); } @@ -409,7 +409,7 @@ void State::popStateSet() void State::insertStateSet(unsigned int pos,const StateSet* dstate) { StateSetStack tempStack; - + // first pop the StateSet above the position we need to insert at while (_stateStateStack.size()>pos) { @@ -419,7 +419,7 @@ void State::insertStateSet(unsigned int pos,const StateSet* dstate) // push our new stateset pushStateSet(dstate); - + // push back the original ones for(StateSetStack::reverse_iterator itr = tempStack.rbegin(); itr != tempStack.rend(); @@ -437,7 +437,7 @@ void State::removeStateSet(unsigned int pos) OSG_NOTICE<<"Warning: State::removeStateSet("<pos) @@ -446,7 +446,7 @@ void State::removeStateSet(unsigned int pos) popStateSet(); } - // remove the intended StateSet as well + // remove the intended StateSet as well popStateSet(); // push back the original ones that were above the remove StateSet @@ -462,7 +462,7 @@ void State::captureCurrentState(StateSet& stateset) const { // empty the stateset first. stateset.clear(); - + for(ModeMap::const_iterator mitr=_modeMap.begin(); mitr!=_modeMap.end(); ++mitr) @@ -473,7 +473,7 @@ void State::captureCurrentState(StateSet& stateset) const { stateset.setMode(mitr->first,ms.valueVec.back()); } - } + } for(AttributeMap::const_iterator aitr=_attributeMap.begin(); aitr!=_attributeMap.end(); @@ -484,7 +484,7 @@ void State::captureCurrentState(StateSet& stateset) const { stateset.setAttribute(const_cast(as.attributeVec.back().first)); } - } + } } @@ -570,7 +570,7 @@ void State::apply() // go through all active StateAttribute's, applying where appropriate. applyAttributeMap(_attributeMap); - + unsigned int unit; unsigned int unitMax = maximum(_textureModeMapList.size(),_textureAttributeMapList.size()); for(unit=0;unitsecond; ms.last_applied_value = !ms.last_applied_value; - ms.changed = true; + ms.changed = true; - } + } for(TextureModeMapList::iterator tmmItr=_textureModeMapList.begin(); tmmItr!=_textureModeMapList.end(); @@ -795,9 +795,9 @@ void State::dirtyAllModes() { ModeStack& ms = mitr->second; ms.last_applied_value = !ms.last_applied_value; - ms.changed = true; + ms.changed = true; - } + } } } @@ -811,7 +811,7 @@ void State::dirtyAllAttributes() as.last_applied_attribute = 0; as.changed = true; } - + for(TextureAttributeMapList::iterator tamItr=_textureAttributeMapList.begin(); tamItr!=_textureAttributeMapList.end(); @@ -1031,7 +1031,7 @@ void State::setSecondaryColorPointer( GLint size, GLenum type, /** wrapper around glEnableVertexAttribArrayARB(index);glVertexAttribPointerARB(..); * note, only updates values that change.*/ void State::setVertexAttribPointer( unsigned int index, - GLint size, GLenum type, GLboolean normalized, + GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) { if (_glVertexAttribPointer) @@ -1057,7 +1057,7 @@ void State::setVertexAttribPointer( unsigned int index, eap._lazy_disable = false; eap._dirty = false; } -} +} /** wrapper around DisableVertexAttribArrayARB(index); * note, only updates values that change.*/ @@ -1076,7 +1076,7 @@ void State::disableVertexAttribPointer( unsigned int index ) _glDisableVertexAttribArray( index ); } } -} +} void State::disableVertexAttribPointersAboveAndIncluding( unsigned int index ) { @@ -1287,7 +1287,7 @@ bool State::convertVertexShaderSourceToOsgBuiltIns(std::string& source) const OSG_INFO<<"State::convertShaderSourceToOsgBuiltIns()"< lock(getRefMutex()); - + _parents.push_back(object); } void StateAttribute::removeParent(osg::StateSet* object) { OpenThreads::ScopedPointerLock lock(getRefMutex()); - + ParentList::iterator pitr = std::find(_parents.begin(),_parents.end(),object); if (pitr!=_parents.end()) _parents.erase(pitr); } @@ -46,13 +46,13 @@ void StateAttribute::setUpdateCallback(StateAttributeCallback* uc) OSG_INFO<<"StateAttribute::Setting Update callbacks"< @@ -38,7 +38,7 @@ using namespace osg; -// local class to help porting from OSG0.8.x to 0.9.x +// local class to help porting from OSG0.8.x to 0.9.x class TextureGLModeSet { @@ -60,7 +60,7 @@ class TextureGLModeSet _textureModeSet.insert(GL_TEXTURE_GEN_S); _textureModeSet.insert(GL_TEXTURE_GEN_T); } - + bool isTextureMode(StateAttribute::GLMode mode) const { return _textureModeSet.find(mode)!=_textureModeSet.end(); @@ -69,7 +69,7 @@ class TextureGLModeSet protected: std::set _textureModeSet; - + }; static TextureGLModeSet& getTextureGLModeSet() @@ -88,7 +88,7 @@ StateSet::StateSet(): _nestRenderBins(true) { _renderingHint = DEFAULT_BIN; - + _numChildrenRequiringUpdateTraversal = 0; _numChildrenRequiringEventTraversal = 0; @@ -113,17 +113,17 @@ StateSet::StateSet(const StateSet& rhs,const CopyOp& copyop):Object(rhs,copyop), attr->addParent(this); } } - + // copy texture related modes. _textureModeList = rhs._textureModeList; - + // set up the size of the texture attribute list. _textureAttributeList.resize(rhs._textureAttributeList.size()); - + // copy the contents across. for(unsigned int i=0;iaddParent(this); } } - + _renderingHint = rhs._renderingHint; _binMode = rhs._binMode; @@ -191,7 +191,7 @@ void StateSet::computeDataVariance() itr!=_attributeList.end(); ++itr) { - if (itr->second.first->getDataVariance()==UNSPECIFIED && + if (itr->second.first->getDataVariance()==UNSPECIFIED && (itr->second.first->getUpdateCallback() || itr->second.first->getEventCallback())) { itr->second.first->setDataVariance(DYNAMIC); @@ -208,7 +208,7 @@ void StateSet::computeDataVariance() itr!=attributeList.end(); ++itr) { - if (itr->second.first->getDataVariance()==UNSPECIFIED && + if (itr->second.first->getDataVariance()==UNSPECIFIED && (itr->second.first->getUpdateCallback() || itr->second.first->getEventCallback())) { itr->second.first->setDataVariance(DYNAMIC); @@ -224,7 +224,7 @@ void StateSet::computeDataVariance() uitr != _uniformList.end(); ++uitr) { - if (uitr->second.first->getDataVariance()==UNSPECIFIED && + if (uitr->second.first->getDataVariance()==UNSPECIFIED && (uitr->second.first->getUpdateCallback() || uitr->second.first->getEventCallback())) { uitr->second.first->setDataVariance(DYNAMIC); @@ -273,7 +273,7 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const if (_textureAttributeList.size()rhs._textureAttributeList.size()) return 1; - + for(unsigned int ai=0;ai<_textureAttributeList.size();++ai) { const AttributeList& rhs_attributeList = _textureAttributeList[ai]; @@ -324,7 +324,7 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const } } - + // now check the rest of the non texture attributes if (compareAttributeContents) { @@ -370,8 +370,8 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const } else if (rhs_attr_itr == rhs._attributeList.end()) return 1; } - - // we've got here so attributes must be equal... + + // we've got here so attributes must be equal... if (_textureModeList.size() rhs._binMode ) return 1; - + if ( _binMode != INHERIT_RENDERBIN_DETAILS ) { if ( _binNum < rhs._binNum ) return -1; @@ -526,7 +526,7 @@ int StateSet::compareAttributeContents(const AttributeList& lhs,const AttributeL } void StateSet::setGlobalDefaults() -{ +{ _renderingHint = DEFAULT_BIN; setRenderBinToInherit(); @@ -542,7 +542,7 @@ void StateSet::setGlobalDefaults() Material *material = new Material; material->setColorMode(Material::AMBIENT_AND_DIFFUSE); setAttributeAndModes(material,StateAttribute::ON); - + #endif } @@ -561,10 +561,10 @@ void StateSet::clear() { itr->second.first->removeParent(this); } - + _modeList.clear(); _attributeList.clear(); - + // remove self from as texture attributes parent for(unsigned int i=0;i<_textureAttributeList.size();++i) @@ -595,7 +595,7 @@ void StateSet::clear() void StateSet::merge(const StateSet& rhs) { - // merge the modes of rhs into this, + // merge the modes of rhs into this, // this overrides rhs if OVERRIDE defined in this. for(ModeList::const_iterator rhs_mitr = rhs._modeList.begin(); rhs_mitr != rhs._modeList.end(); @@ -604,9 +604,9 @@ void StateSet::merge(const StateSet& rhs) ModeList::iterator lhs_mitr = _modeList.find(rhs_mitr->first); if (lhs_mitr!=_modeList.end()) { - // take the rhs mode unless the lhs is override and the rhs is not protected + // take the rhs mode unless the lhs is override and the rhs is not protected if (!(lhs_mitr->second & StateAttribute::OVERRIDE ) || - (rhs_mitr->second & StateAttribute::PROTECTED)) + (rhs_mitr->second & StateAttribute::PROTECTED)) { // override isn't on in rhs, so override it with incoming // value. @@ -620,7 +620,7 @@ void StateSet::merge(const StateSet& rhs) } } - // merge the attributes of rhs into this, + // merge the attributes of rhs into this, // this overrides rhs if OVERRIDE defined in this. for(AttributeList::const_iterator rhs_aitr = rhs._attributeList.begin(); rhs_aitr != rhs._attributeList.end(); @@ -629,7 +629,7 @@ void StateSet::merge(const StateSet& rhs) AttributeList::iterator lhs_aitr = _attributeList.find(rhs_aitr->first); if (lhs_aitr!=_attributeList.end()) { - // take the rhs attribute unless the lhs is override and the rhs is not protected + // take the rhs attribute unless the lhs is override and the rhs is not protected if (!(lhs_aitr->second.second & StateAttribute::OVERRIDE) || (rhs_aitr->second.second & StateAttribute::PROTECTED)) { @@ -667,7 +667,7 @@ void StateSet::merge(const StateSet& rhs) { ModeList& lhs_modeList = _textureModeList[mi]; const ModeList& rhs_modeList = rhs._textureModeList[mi]; - // merge the modes of rhs into this, + // merge the modes of rhs into this, // this overrides rhs if OVERRIDE defined in this. for(ModeList::const_iterator rhs_mitr = rhs_modeList.begin(); rhs_mitr != rhs_modeList.end(); @@ -676,9 +676,9 @@ void StateSet::merge(const StateSet& rhs) ModeList::iterator lhs_mitr = lhs_modeList.find(rhs_mitr->first); if (lhs_mitr!=lhs_modeList.end()) { - // take the rhs mode unless the lhs is override and the rhs is not protected + // take the rhs mode unless the lhs is override and the rhs is not protected if (!(lhs_mitr->second & StateAttribute::OVERRIDE) || - (rhs_mitr->second & StateAttribute::PROTECTED)) + (rhs_mitr->second & StateAttribute::PROTECTED)) { // override isn't on in rhs, so override it with incoming // value. @@ -692,14 +692,14 @@ void StateSet::merge(const StateSet& rhs) } } } - + if (_textureAttributeList.size()first); if (lhs_aitr!=lhs_attributeList.end()) { - // take the rhs attribute unless the lhs is override and the rhs is not protected + // take the rhs attribute unless the lhs is override and the rhs is not protected if (!(lhs_aitr->second.second & StateAttribute::OVERRIDE) || - (rhs_aitr->second.second & StateAttribute::PROTECTED)) + (rhs_aitr->second.second & StateAttribute::PROTECTED)) { // override isn't on in rhs, so override it with incoming // value. - + if (lhs_aitr->second.first!=rhs_aitr->second.first) { lhs_aitr->second.first->removeParent(this); @@ -735,7 +735,7 @@ void StateSet::merge(const StateSet& rhs) } } - // merge the uniforms of rhs into this, + // merge the uniforms of rhs into this, // this overrides rhs if OVERRIDE defined in this. for(UniformList::const_iterator rhs_uitr = rhs._uniformList.begin(); rhs_uitr != rhs._uniformList.end(); @@ -744,9 +744,9 @@ void StateSet::merge(const StateSet& rhs) UniformList::iterator lhs_uitr = _uniformList.find(rhs_uitr->first); if (lhs_uitr!=_uniformList.end()) { - // take the rhs uniform unless the lhs is override and the rhs is not protected + // take the rhs uniform unless the lhs is override and the rhs is not protected if (!(lhs_uitr->second.second & StateAttribute::OVERRIDE) || - (rhs_uitr->second.second & StateAttribute::PROTECTED)) + (rhs_uitr->second.second & StateAttribute::PROTECTED)) { // override isn't on in rhs, so override it with incoming // value. @@ -860,7 +860,7 @@ void StateSet::setAttribute(StateAttribute *attribute, StateAttribute::OverrideV setTextureAttribute(0,attribute,value); } - } + } } void StateSet::setAttributeAndModes(StateAttribute *attribute, StateAttribute::GLModeValue value) @@ -872,7 +872,7 @@ void StateSet::setAttributeAndModes(StateAttribute *attribute, StateAttribute::G if (value&StateAttribute::INHERIT) { removeAttribute(attribute->getType()); - } + } else { setAttribute(_attributeList,attribute,value); @@ -895,12 +895,12 @@ void StateSet::removeAttribute(StateAttribute::Type type, unsigned int member) AttributeList::iterator itr = _attributeList.find(StateAttribute::TypeMemberPair(type,member)); if (itr!=_attributeList.end()) { - if (itr->second.first->getUpdateCallback()) + if (itr->second.first->getUpdateCallback()) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } - if (itr->second.first->getEventCallback()) + if (itr->second.first->getEventCallback()) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-1); } @@ -914,18 +914,18 @@ void StateSet::removeAttribute(StateAttribute::Type type, unsigned int member) void StateSet::removeAttribute(StateAttribute* attribute) { if (!attribute) return; - + AttributeList::iterator itr = _attributeList.find(attribute->getTypeMemberPair()); if (itr!=_attributeList.end()) { if (itr->second.first != attribute) return; - - if (itr->second.first->getUpdateCallback()) + + if (itr->second.first->getUpdateCallback()) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } - if (itr->second.first->getEventCallback()) + if (itr->second.first->getEventCallback()) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-1); } @@ -958,7 +958,7 @@ void StateSet::addUniform(Uniform* uniform, StateAttribute::OverrideValue value) { int delta_update = 0; int delta_event = 0; - + UniformList::iterator itr=_uniformList.find(uniform->getName()); if (itr==_uniformList.end()) { @@ -966,15 +966,15 @@ void StateSet::addUniform(Uniform* uniform, StateAttribute::OverrideValue value) RefUniformPair& up = _uniformList[uniform->getName()]; up.first = uniform; up.second = value&(StateAttribute::OVERRIDE|StateAttribute::PROTECTED); - + uniform->addParent(this); - - if (uniform->getUpdateCallback()) + + if (uniform->getUpdateCallback()) { delta_update = 1; } - if (uniform->getEventCallback()) + if (uniform->getEventCallback()) { delta_event = 1; } @@ -991,7 +991,7 @@ void StateSet::addUniform(Uniform* uniform, StateAttribute::OverrideValue value) itr->second.first->removeParent(this); if (itr->second.first->getUpdateCallback()) --delta_update; if (itr->second.first->getEventCallback()) --delta_event; - + uniform->addParent(this); itr->second.first = uniform; if (itr->second.first->getUpdateCallback()) ++delta_update; @@ -1001,12 +1001,12 @@ void StateSet::addUniform(Uniform* uniform, StateAttribute::OverrideValue value) } } - if (delta_update!=0) + if (delta_update!=0) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+delta_update); } - if (delta_event!=0) + if (delta_event!=0) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()+delta_event); } @@ -1019,12 +1019,12 @@ void StateSet::removeUniform(const std::string& name) UniformList::iterator itr = _uniformList.find(name); if (itr!=_uniformList.end()) { - if (itr->second.first->getUpdateCallback()) + if (itr->second.first->getUpdateCallback()) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } - if (itr->second.first->getEventCallback()) + if (itr->second.first->getEventCallback()) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-1); } @@ -1038,18 +1038,18 @@ void StateSet::removeUniform(const std::string& name) void StateSet::removeUniform(Uniform* uniform) { if (!uniform) return; - + UniformList::iterator itr = _uniformList.find(uniform->getName()); if (itr!=_uniformList.end()) { if (itr->second.first != uniform) return; - if (itr->second.first->getUpdateCallback()) + if (itr->second.first->getUpdateCallback()) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } - if (itr->second.first->getEventCallback()) + if (itr->second.first->getEventCallback()) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-1); } @@ -1070,17 +1070,17 @@ Uniform* StateSet::getOrCreateUniform(const std::string& name, Uniform::Type typ { // for look for an appropriate uniform. UniformList::iterator itr = _uniformList.find(name); - if (itr!=_uniformList.end() && + if (itr!=_uniformList.end() && itr->second.first->getType()==type) { return itr->second.first.get(); } // no uniform found matching name so create it.. - + Uniform* uniform = new Uniform(type,name,numElements); addUniform(uniform); - + return uniform; } @@ -1173,7 +1173,7 @@ void StateSet::setTextureAttributeAndModes(unsigned int unit,StateAttribute *att { if (attribute) { - + if (attribute->isTextureAttribute()) { if (value&StateAttribute::INHERIT) @@ -1209,12 +1209,12 @@ void StateSet::removeTextureAttribute(unsigned int unit,StateAttribute::Type typ setAssociatedTextureModes(unit,itr->second.first.get(),StateAttribute::INHERIT); } - if (itr->second.first->getUpdateCallback()) + if (itr->second.first->getUpdateCallback()) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } - if (itr->second.first->getEventCallback()) + if (itr->second.first->getEventCallback()) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-1); } @@ -1238,12 +1238,12 @@ void StateSet::removeTextureAttribute(unsigned int unit, StateAttribute* attribu setAssociatedTextureModes(unit,itr->second.first.get(),StateAttribute::INHERIT); - if (itr->second.first->getUpdateCallback()) + if (itr->second.first->getUpdateCallback()) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } - if (itr->second.first->getEventCallback()) + if (itr->second.first->getEventCallback()) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-1); } @@ -1474,21 +1474,21 @@ class SetAssociateModesHelper : public StateAttribute::ModeUsage _stateset(stateset), _value(value), _unit(unit) {} - + virtual ~SetAssociateModesHelper() {} - + virtual void usesMode(StateAttribute::GLMode mode) { _stateset->setMode(mode,_value); } - + virtual void usesTextureMode(StateAttribute::GLMode mode) { _stateset->setTextureMode(_unit,mode,_value); } - - - + + + StateSet* _stateset; StateAttribute::GLModeValue _value; unsigned int _unit; @@ -1500,21 +1500,21 @@ class RemoveAssociateModesHelper : public StateAttribute::ModeUsage RemoveAssociateModesHelper(StateSet* stateset, unsigned int unit=0): _stateset(stateset), _unit(unit) {} - + virtual ~RemoveAssociateModesHelper() {} - + virtual void usesMode(StateAttribute::GLMode mode) { _stateset->removeMode(mode); } - + virtual void usesTextureMode(StateAttribute::GLMode mode) { _stateset->removeTextureMode(_unit, mode); } - - - + + + StateSet* _stateset; unsigned int _unit; }; @@ -1549,20 +1549,20 @@ void StateSet::setAttribute(AttributeList& attributeList,StateAttribute *attribu { int delta_update = 0; int delta_event = 0; - + AttributeList::iterator itr=attributeList.find(attribute->getTypeMemberPair()); if (itr==attributeList.end()) { // new entry. attributeList[attribute->getTypeMemberPair()] = RefAttributePair(attribute,value&(StateAttribute::OVERRIDE|StateAttribute::PROTECTED)); attribute->addParent(this); - - if (attribute->getUpdateCallback()) + + if (attribute->getUpdateCallback()) { delta_update = 1; } - if (attribute->getEventCallback()) + if (attribute->getEventCallback()) { delta_event = 1; } @@ -1589,12 +1589,12 @@ void StateSet::setAttribute(AttributeList& attributeList,StateAttribute *attribu } } - if (delta_update!=0) + if (delta_update!=0) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+delta_update); } - if (delta_event!=0) + if (delta_event!=0) { setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()+delta_event); } @@ -1643,13 +1643,13 @@ void StateSet::setUpdateCallback(Callback* ac) //OSG_INFO<<"Setting StateSet callbacks"<(*itr); - if (drawable) + if (drawable) { //drawable->setNumChildrenRequiringUpdateTraversal(drawable->getNumChildrenRequiringUpdateTraversal()+delta); } - else + else { osg::Node* node = dynamic_cast(*itr); - if (node) + if (node) { node->setNumChildrenRequiringUpdateTraversal(node->getNumChildrenRequiringUpdateTraversal()+delta); } @@ -1723,13 +1723,13 @@ void StateSet::runUpdateCallbacks(osg::NodeVisitor* nv) void StateSet::setEventCallback(Callback* ac) { if (_eventCallback==ac) return; - + int delta = 0; if (_eventCallback.valid()) --delta; if (ac) ++delta; _eventCallback = ac; - + if (delta!=0 && _numChildrenRequiringEventTraversal==0) { for(ParentList::iterator itr=_parents.begin(); @@ -1737,14 +1737,14 @@ void StateSet::setEventCallback(Callback* ac) ++itr) { osg::Drawable* drawable = dynamic_cast(*itr); - if (drawable) + if (drawable) { //drawable->setNumChildrenRequiringUpdateTraversal(drawable->getNumChildrenRequiringUpdateTraversal()+delta); } - else + else { osg::Node* node = dynamic_cast(*itr); - if (node) + if (node) { node->setNumChildrenRequiringEventTraversal(node->getNumChildrenRequiringEventTraversal()+delta); } @@ -1804,8 +1804,8 @@ void StateSet::setNumChildrenRequiringUpdateTraversal(unsigned int num) // _numChildrenRequiringUpdateTraversal so no need to inform them. if (!_updateCallback && !_parents.empty()) { - - // need to pass on changes to parents. + + // need to pass on changes to parents. int delta = 0; if (_numChildrenRequiringUpdateTraversal>0) --delta; if (num>0) ++delta; @@ -1817,16 +1817,16 @@ void StateSet::setNumChildrenRequiringUpdateTraversal(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { osg::Drawable* drawable = dynamic_cast(*itr); - if (drawable) + if (drawable) { drawable->setNumChildrenRequiringUpdateTraversal(drawable->getNumChildrenRequiringUpdateTraversal()+delta); } - else + else { osg::Node* node = dynamic_cast(*itr); - if (node) + if (node) { node->setNumChildrenRequiringUpdateTraversal(node->getNumChildrenRequiringUpdateTraversal()+delta); } @@ -1834,7 +1834,7 @@ void StateSet::setNumChildrenRequiringUpdateTraversal(unsigned int num) } } } - + // finally update this objects value. _numChildrenRequiringUpdateTraversal=num; } @@ -1849,8 +1849,8 @@ void StateSet::setNumChildrenRequiringEventTraversal(unsigned int num) // _numChildrenRequiringEventTraversal so no need to inform them. if (!_eventCallback && !_parents.empty()) { - - // need to pass on changes to parents. + + // need to pass on changes to parents. int delta = 0; if (_numChildrenRequiringEventTraversal>0) --delta; if (num>0) ++delta; @@ -1862,16 +1862,16 @@ void StateSet::setNumChildrenRequiringEventTraversal(unsigned int num) for(ParentList::iterator itr =_parents.begin(); itr != _parents.end(); ++itr) - { + { osg::Drawable* drawable = dynamic_cast(*itr); - if (drawable) + if (drawable) { drawable->setNumChildrenRequiringEventTraversal(drawable->getNumChildrenRequiringEventTraversal()+delta); } - else + else { osg::Node* node = dynamic_cast(*itr); - if (node) + if (node) { node->setNumChildrenRequiringEventTraversal(node->getNumChildrenRequiringEventTraversal()+delta); } @@ -1879,7 +1879,7 @@ void StateSet::setNumChildrenRequiringEventTraversal(unsigned int num) } } } - + // finally Event this objects value. _numChildrenRequiringEventTraversal=num; } diff --git a/src/osg/Stats.cpp b/src/osg/Stats.cpp index 9c6d21a5b..938157b35 100644 --- a/src/osg/Stats.cpp +++ b/src/osg/Stats.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -48,31 +48,31 @@ bool Stats::setAttribute(unsigned int frameNumber, const std::string& attributeN if (frameNumber>_latestFrameNumber) { - // need to advance - + // need to advance + // first clear the entries up to and including the new frameNumber for(unsigned int i = _latestFrameNumber+1; i<= frameNumber; ++i) { unsigned int index = (i - _baseFrameNumber) % _attributeMapList.size(); _attributeMapList[index].clear(); } - + if ( (frameNumber-_baseFrameNumber) >= static_cast(_attributeMapList.size())) { _baseFrameNumber = (frameNumber/_attributeMapList.size())*_attributeMapList.size(); } - + _latestFrameNumber = frameNumber; - + } int index = getIndex(frameNumber); - if (index<0) + if (index<0) { OSG_NOTICE<<"Failed to assing valid index for Stats::setAttribute("<second; + value = itr->second; return true; } @@ -103,7 +103,7 @@ bool Stats::getAveragedAttribute(unsigned int startFrameNumber, unsigned int end { std::swap(endFrameNumber, startFrameNumber); } - + OpenThreads::ScopedLock lock(_mutex); double total = 0.0; @@ -131,7 +131,7 @@ Stats::AttributeMap& Stats::getAttributeMapNoMutex(unsigned int frameNumber) { int index = getIndex(frameNumber); if (index<0) return _invalidAttributeMap; - + return _attributeMapList[index]; } @@ -139,7 +139,7 @@ const Stats::AttributeMap& Stats::getAttributeMapNoMutex(unsigned int frameNumbe { int index = getIndex(frameNumber); if (index<0) return _invalidAttributeMap; - + return _attributeMapList[index]; } diff --git a/src/osg/StencilTwoSided.cpp b/src/osg/StencilTwoSided.cpp index d102d2b35..4c04dca91 100644 --- a/src/osg/StencilTwoSided.cpp +++ b/src/osg/StencilTwoSided.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osg/Switch.cpp b/src/osg/Switch.cpp index 0c048e503..f6b51301f 100644 --- a/src/osg/Switch.cpp +++ b/src/osg/Switch.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -93,7 +93,7 @@ bool Switch::insertChild( unsigned int index, Node *child, bool value ) { _values.insert(_values.begin()+index, value); } - + return true; } return false; @@ -118,7 +118,7 @@ void Switch::setChildValue(const Node* child,bool value) // find the child's position. unsigned int pos=getChildIndex(child); if (pos==_children.size()) return; - + _values[pos]=value; dirtyBound(); } @@ -134,7 +134,7 @@ bool Switch::getChildValue(const Node* child) const // find the child's position. unsigned int pos=getChildIndex(child); if (pos==_children.size()) return false; - + return _values[pos]; } @@ -179,7 +179,7 @@ bool Switch::setSingleChildOn(unsigned int pos) BoundingSphere Switch::computeBound() const { BoundingSphere bsphere; - if (_children.empty()) + if (_children.empty()) { return bsphere; } @@ -200,7 +200,7 @@ BoundingSphere Switch::computeBound() const } } - if (!bb.valid()) + if (!bb.valid()) { return bsphere; } diff --git a/src/osg/TexEnv.cpp b/src/osg/TexEnv.cpp index 061095eca..481c9009e 100644 --- a/src/osg/TexEnv.cpp +++ b/src/osg/TexEnv.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/TexEnvCombine.cpp b/src/osg/TexEnvCombine.cpp index 6373e67b4..54e9c409e 100644 --- a/src/osg/TexEnvCombine.cpp +++ b/src/osg/TexEnvCombine.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -57,7 +57,7 @@ void TexEnvCombine::apply(State& state) const static bool s_isNVTexEnvCrossbarSupported = isGLExtensionSupported(contextID,"GL_NV_texture_env_combine4"); - static bool s_isTexEnvDot3Supported = + static bool s_isTexEnvDot3Supported = isGLExtensionSupported(contextID,"GL_ARB_texture_env_dot3"); @@ -73,7 +73,7 @@ void TexEnvCombine::apply(State& state) const glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, _combine_RGB); - + if (_combine_RGB!=DOT3_RGBA) glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, _combine_Alpha); @@ -141,7 +141,7 @@ void TexEnvCombine::setOperand1_Alpha(GLint op) _operand1_Alpha = Valid_Operand_Alpha(op,"setOperand1_Alpha"); } void TexEnvCombine::setOperand2_Alpha(GLint op) -{ +{ _operand2_Alpha = Valid_Operand_Alpha(op,"setOperand2_Alpha"); } diff --git a/src/osg/TexEnvFilter.cpp b/src/osg/TexEnvFilter.cpp index 6108b534b..ac158a80e 100644 --- a/src/osg/TexEnvFilter.cpp +++ b/src/osg/TexEnvFilter.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/TexGen.cpp b/src/osg/TexGen.cpp index 389cee596..021ac0787 100644 --- a/src/osg/TexGen.cpp +++ b/src/osg/TexGen.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -72,7 +72,7 @@ void TexGen::setPlanesFromMatrix(const Matrixd& matrix) _plane_s.set(matrix(0,0),matrix(1,0),matrix(2,0),matrix(3,0)); _plane_t.set(matrix(0,1),matrix(1,1),matrix(2,1),matrix(3,1)); _plane_r.set(matrix(0,2),matrix(1,2),matrix(2,2),matrix(3,2)); - _plane_q.set(matrix(0,3),matrix(1,3),matrix(2,3),matrix(3,3)); + _plane_q.set(matrix(0,3),matrix(1,3),matrix(2,3),matrix(3,3)); } void TexGen::apply(State&) const @@ -81,7 +81,7 @@ void TexGen::apply(State&) const if (_mode == OBJECT_LINEAR || _mode == EYE_LINEAR) { GLenum glmode = _mode == OBJECT_LINEAR ? GL_OBJECT_PLANE : GL_EYE_PLANE; - + if (sizeof(_plane_s[0])==sizeof(GLfloat)) { glTexGenfv(GL_S, glmode, (const GLfloat*)_plane_s.ptr()); diff --git a/src/osg/TexGenNode.cpp b/src/osg/TexGenNode.cpp index db804fa92..9c6bf9fd3 100644 --- a/src/osg/TexGenNode.cpp +++ b/src/osg/TexGenNode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -19,7 +19,7 @@ TexGenNode::TexGenNode(): { // switch off culling of tex gen nodes by default. setCullingActive(false); - + _textureUnit = 0; setStateSet(new StateSet); _texgen = new TexGen; diff --git a/src/osg/TexMat.cpp b/src/osg/TexMat.cpp index 9943bbe4a..a869b4610 100644 --- a/src/osg/TexMat.cpp +++ b/src/osg/TexMat.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 6f997d7a2..8742ca305 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -435,7 +435,7 @@ void Texture::TextureObjectSet::flushDeletedTextureObjects(double currentTime, d unsigned int maxNumObjectsToDelete = _profile._size!=0 ? static_cast(ceil(double(sizeRequired) / double(_profile._size))): _orphanedTextureObjects.size(); - + OSG_INFO<<"_parent->getCurrTexturePoolSize()="<<_parent->getCurrTexturePoolSize() <<" _parent->getMaxTexturePoolSize()="<< _parent->getMaxTexturePoolSize()<isTextureCompressionRGTCSupported()) { @@ -1431,7 +1431,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const break; } } - + _internalFormat = internalFormat; // GLES doesn't cope with internal formats of 1,2,3 and 4 so map them to the appropriate equivilants. @@ -1441,7 +1441,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const if (_internalFormat==4) _internalFormat = GL_RGBA; computeInternalFormatType(); - + //OSG_NOTICE<<"Internal format="< _sourceFormat = GL_RGBA_INTEGER_EXT) // Should we do this? ( Art, 09. Sept. 2007) - + // compute internal format type based on the internal format switch(_internalFormat) { @@ -1463,17 +1463,17 @@ void Texture::computeInternalFormatType() const case GL_RGB16UI_EXT: case GL_RGB8UI_EXT: - case GL_LUMINANCE32UI_EXT: - case GL_LUMINANCE16UI_EXT: - case GL_LUMINANCE8UI_EXT: + case GL_LUMINANCE32UI_EXT: + case GL_LUMINANCE16UI_EXT: + case GL_LUMINANCE8UI_EXT: - case GL_INTENSITY32UI_EXT: - case GL_INTENSITY16UI_EXT: - case GL_INTENSITY8UI_EXT: + case GL_INTENSITY32UI_EXT: + case GL_INTENSITY16UI_EXT: + case GL_INTENSITY8UI_EXT: - case GL_LUMINANCE_ALPHA32UI_EXT: - case GL_LUMINANCE_ALPHA16UI_EXT: - case GL_LUMINANCE_ALPHA8UI_EXT : + case GL_LUMINANCE_ALPHA32UI_EXT: + case GL_LUMINANCE_ALPHA16UI_EXT: + case GL_LUMINANCE_ALPHA8UI_EXT : _internalFormatType = UNSIGNED_INTEGER; break; @@ -1485,20 +1485,20 @@ void Texture::computeInternalFormatType() const case GL_RGB16I_EXT: case GL_RGB8I_EXT: - case GL_LUMINANCE32I_EXT: - case GL_LUMINANCE16I_EXT: - case GL_LUMINANCE8I_EXT: + case GL_LUMINANCE32I_EXT: + case GL_LUMINANCE16I_EXT: + case GL_LUMINANCE8I_EXT: - case GL_INTENSITY32I_EXT: - case GL_INTENSITY16I_EXT: - case GL_INTENSITY8I_EXT: + case GL_INTENSITY32I_EXT: + case GL_INTENSITY16I_EXT: + case GL_INTENSITY8I_EXT: - case GL_LUMINANCE_ALPHA32I_EXT: - case GL_LUMINANCE_ALPHA16I_EXT: - case GL_LUMINANCE_ALPHA8I_EXT: + case GL_LUMINANCE_ALPHA32I_EXT: + case GL_LUMINANCE_ALPHA16I_EXT: + case GL_LUMINANCE_ALPHA8I_EXT: _internalFormatType = SIGNED_INTEGER; break; - + case GL_RGBA32F_ARB: case GL_RGBA16F_ARB: @@ -1506,16 +1506,16 @@ void Texture::computeInternalFormatType() const case GL_RGB16F_ARB: case GL_LUMINANCE32F_ARB: - case GL_LUMINANCE16F_ARB: + case GL_LUMINANCE16F_ARB: case GL_INTENSITY32F_ARB: - case GL_INTENSITY16F_ARB: + case GL_INTENSITY16F_ARB: case GL_LUMINANCE_ALPHA32F_ARB: - case GL_LUMINANCE_ALPHA16F_ARB: + case GL_LUMINANCE_ALPHA16F_ARB: _internalFormatType = FLOAT; break; - + default: _internalFormatType = NORMALIZED; break; @@ -1545,7 +1545,7 @@ bool Texture::isCompressedInternalFormat(GLint internalFormat) case(GL_COMPRESSED_RED_RGTC1_EXT): case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT): case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT): - case(GL_ETC1_RGB8_OES): + case(GL_ETC1_RGB8_OES): case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG): case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG): @@ -1567,21 +1567,21 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height else if (internalFormat == GL_COMPRESSED_RED_RGTC1_EXT || internalFormat == GL_COMPRESSED_SIGNED_RED_RGTC1_EXT) blockSize = 8; else if (internalFormat == GL_COMPRESSED_RED_GREEN_RGTC2_EXT || internalFormat == GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT) - blockSize = 16; + blockSize = 16; else if (internalFormat == GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG || internalFormat == GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG) { blockSize = 8 * 4; // Pixel by pixel block size for 2bpp GLint widthBlocks = width / 8; GLint heightBlocks = height / 4; GLint bpp = 2; - + // Clamp to minimum number of blocks if(widthBlocks < 2) widthBlocks = 2; if(heightBlocks < 2) heightBlocks = 2; - - size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8); + + size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8); return; } else if (internalFormat == GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG || internalFormat == GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG) @@ -1590,14 +1590,14 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height GLint widthBlocks = width / 4; GLint heightBlocks = height / 4; GLint bpp = 4; - + // Clamp to minimum number of blocks if(widthBlocks < 2) widthBlocks = 2; if(heightBlocks < 2) heightBlocks = 2; - - size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8); + + size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8); return; } else @@ -1605,13 +1605,13 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height OSG_WARN<<"Texture::getCompressedSize(...) : cannot compute correct size of compressed format ("<isMipmap() && extensions->isTextureMaxLevelSupported() && int( image->getNumMipmapLevels() ) < Image::computeNumberOfMipmapLevels( image->s(), image->t(), image->r() ) ) - glTexParameteri( target, GL_TEXTURE_MAX_LEVEL, image->getNumMipmapLevels() - 1 ); + glTexParameteri( target, GL_TEXTURE_MAX_LEVEL, image->getNumMipmapLevels() - 1 ); glTexParameteri( target, GL_TEXTURE_WRAP_S, ws ); - + if (target!=GL_TEXTURE_1D) glTexParameteri( target, GL_TEXTURE_WRAP_T, wt ); - + if (target==GL_TEXTURE_3D) glTexParameteri( target, GL_TEXTURE_WRAP_R, wr ); - + glTexParameteri( target, GL_TEXTURE_MIN_FILTER, _min_filter); glTexParameteri( target, GL_TEXTURE_MAG_FILTER, _mag_filter); @@ -1708,7 +1708,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const // integer textures are not supported by the shadow // GL_TEXTURE_1D_ARRAY_EXT could be included in the check below but its not yet implemented in OSG - if (extensions->isShadowSupported() && + if (extensions->isShadowSupported() && (target == GL_TEXTURE_2D || target == GL_TEXTURE_1D || target == GL_TEXTURE_RECTANGLE || target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_2D_ARRAY_EXT ) && _internalFormatType != SIGNED_INTEGER && _internalFormatType != UNSIGNED_INTEGER) { @@ -1725,7 +1725,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const glTexParameterf(target, TEXTURE_COMPARE_FAIL_VALUE_ARB, _shadow_ambient); } } - else + else { glTexParameteri(target, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); } @@ -1759,7 +1759,7 @@ void Texture::computeRequiredTextureDimensions(State& state, const osg::Image& i inwidth = width; inheight = height; - + if( _min_filter == LINEAR || _min_filter == NEAREST) { numMipmapLevels = 1; @@ -1774,8 +1774,8 @@ void Texture::computeRequiredTextureDimensions(State& state, const osg::Image& i for(int s=1; sisNonPowerOfTwoTextureSupported(_min_filter)="<isNonPowerOfTwoTextureSupported(_min_filter) <isNonPowerOfTwoTextureSupported(_min_filter)="<isNonPowerOfTwoTextureSupported(_min_filter) <getPixelFormat(),image->getDataType(),image->getPacking())*inheight; dataPtr = new unsigned char [newTotalSize]; - + if (!dataPtr) { OSG_WARN<<"Warning:: Not enough memory to resize image, cannot apply to texture."<glCompressedTexImage2D(target, 0, _internalFormat, - inwidth, inheight,0, - size, + extensions->glCompressedTexImage2D(target, 0, _internalFormat, + inwidth, inheight,0, + size, dataPtr); } @@ -1963,7 +1963,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima { // image is mip mapped so we take the mip map levels from the image. - + numMipmapLevels = image->getNumMipmapLevels(); int width = inwidth; @@ -2001,9 +2001,9 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima height = 1; getCompressedSize(_internalFormat, width, height, 1, blockSize,size); - - extensions->glCompressedTexImage2D(target, k, _internalFormat, - width, height, _borderWidth, + + extensions->glCompressedTexImage2D(target, k, _internalFormat, + width, height, _borderWidth, size, dataPtr + image->getMipmapOffset(k)); width >>= 1; @@ -2030,7 +2030,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima height >>= 1; } } - else + else { OSG_WARN<<"Warning:: Compressed image cannot be mip mapped"<releaseGLObjects(&state); } } - + #ifdef DO_TIMING static double s_total_time = 0.0; double delta_time = osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick()); @@ -2063,7 +2063,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima // clean up the resized image. delete [] dataPtr; } - + if (useClientStorage) { glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE,GL_FALSE); @@ -2079,16 +2079,16 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* return; // image size has changed so we have to re-load the image from scratch. - if (image->s()!=inwidth || image->t()!=inheight || image->getInternalTextureFormat()!=inInternalFormat ) + if (image->s()!=inwidth || image->t()!=inheight || image->getInternalTextureFormat()!=inInternalFormat ) { - applyTexImage2D_load(state, target, image, inwidth, inheight,numMipmapLevels); + applyTexImage2D_load(state, target, image, inwidth, inheight,numMipmapLevels); return; } // else image size the same as when loaded so we can go ahead and subload - + // If the texture's internal format is a compressed type, then the // user is requesting that the graphics card compress the image if it's - // not already compressed. However, if the image is not a multiple of + // not already compressed. However, if the image is not a multiple of // four in each dimension the subsequent calls to glTexSubImage* will // fail. Revert to uncompressed format in this case. if (isCompressedInternalFormat(_internalFormat) && @@ -2103,19 +2103,19 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* osg::Timer_t start_tick = osg::Timer::instance()->tick(); OSG_NOTICE<<"glTexSubImage2D pixelFormat = "<getPixelFormat()<getPixelFormat()); - + glPixelStorei(GL_UNPACK_ALIGNMENT,image->getPacking()); unsigned int rowLength = image->getRowLength(); - + unsigned char* dataPtr = (unsigned char*)image->data(); bool needImageRescale = inwidth!=image->s() || inheight!=image->t(); @@ -2195,11 +2195,11 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* dataPtr); } else if (extensions->isCompressedTexImage2DSupported()) - { + { GLint blockSize,size; getCompressedSize(image->getInternalTextureFormat(), inwidth, inheight, 1, blockSize,size); - extensions->glCompressedTexSubImage2D(target, 0, + extensions->glCompressedTexSubImage2D(target, 0, 0,0, inwidth, inheight, (GLenum)image->getPixelFormat(), @@ -2228,7 +2228,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* if (height == 0) height = 1; - glTexSubImage2D( target, k, + glTexSubImage2D( target, k, 0, 0, width, height, (GLenum)image->getPixelFormat(), @@ -2253,9 +2253,9 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* //state.checkGLErrors("before extensions->glCompressedTexSubImage2D("); - extensions->glCompressedTexSubImage2D(target, k, + extensions->glCompressedTexSubImage2D(target, k, 0, 0, - width, height, + width, height, (GLenum)image->getPixelFormat(), size, dataPtr + image->getMipmapOffset(k)); @@ -2271,10 +2271,10 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* else { //OSG_WARN<<"Warning:: cannot subload mip mapped texture from non mipmapped image."<bind(); fbo_ext->glGenerateMipmap(textureObject->target()); - + // inform state that this texture is the current one bound. state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); - + // if the function is not supported, then do manual allocation }else { allocateMipmap(state); } - + } void Texture::compileGLObjects(State& state) const @@ -2456,20 +2456,20 @@ Texture::Extensions::Extensions(unsigned int contextID) OSG_FATAL<<"Error: In Texture::Extensions::setupGLExtensions(..) OpenGL version test failed, requires valid graphics context."< @@ -62,12 +62,12 @@ int Texture1D::compare(const StateAttribute& sa) const } else { - return 1; // valid lhs._image is greater than null. + return 1; // valid lhs._image is greater than null. } } - else if (rhs._image.valid()) + else if (rhs._image.valid()) { - return -1; // valid rhs._image is greater than null. + return -1; // valid rhs._image is greater than null. } } @@ -107,7 +107,7 @@ void Texture1D::setImage(Image* image) _image = image; _modifiedCount.setAllElementsTo(0); - + if (_image.valid() && _image->requiresUpdateCall()) { setUpdateCallback(new Image::UpdateCallback()); @@ -119,7 +119,7 @@ void Texture1D::setImage(Image* image) void Texture1D::apply(State& state) const { #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); @@ -171,7 +171,7 @@ void Texture1D::apply(State& state) const else if (_subloadCallback.valid()) { - // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. + // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. _textureObjectBuffer[contextID] = textureObject = generateTextureObject(this, contextID, GL_TEXTURE_1D); textureObject->bind(); @@ -192,7 +192,7 @@ void Texture1D::apply(State& state) const else if (_image.valid() && _image->data()) { - // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. + // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. textureObject = generateTextureObject(this, contextID,GL_TEXTURE_1D); textureObject->bind(); @@ -205,22 +205,22 @@ void Texture1D::apply(State& state) const // update the modified count to show that it is upto date. getModifiedCount(contextID) = _image->getModifiedCount(); - + _textureObjectBuffer[contextID] = textureObject; - + // unref image data? if (isSafeToUnrefImageData(state) && _image->getDataVariance()==STATIC) { Texture1D* non_const_this = const_cast(this); non_const_this->_image = NULL; } - + } else if ( (_textureWidth!=0) && (_internalFormat!=0) ) { _textureObjectBuffer[contextID] = textureObject = generateTextureObject( this,contextID,GL_TEXTURE_1D,_numMipmapLevels,_internalFormat,_textureWidth,1,1,0); - + textureObject->bind(); applyTexParameters(GL_TEXTURE_1D,state); @@ -230,8 +230,8 @@ void Texture1D::apply(State& state) const _textureWidth, _borderWidth, _sourceFormat ? _sourceFormat : _internalFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, - 0); - + 0); + if (_readPBuffer.valid()) { _readPBuffer->bindPBufferToTexture(GL_FRONT); @@ -255,7 +255,7 @@ void Texture1D::apply(State& state) const void Texture1D::computeInternalFormat() const { - if (_image.valid()) computeInternalFormatWithImage(*_image); + if (_image.valid()) computeInternalFormatWithImage(*_image); else computeInternalFormatType(); } @@ -266,7 +266,7 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz if (!image || !image->data()) return; - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); const Extensions* extensions = getExtensions(contextID,true); @@ -277,7 +277,7 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz // select the internalFormat required for the texture. bool compressed = isCompressedInternalFormat(_internalFormat); - + //Rescale if resize hint is set or NPOT not supported or dimension exceeds max size if( _resizeNonPowerOfTwoHint || !extensions->isNonPowerOfTwoTextureSupported(_min_filter) || inwidth > extensions->maxTextureSize() ) { @@ -288,7 +288,7 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz glPixelStorei(GL_UNPACK_ALIGNMENT,image->getPacking()); glPixelStorei(GL_UNPACK_ROW_LENGTH,image->getRowLength()); - static MyCompressedTexImage1DArbProc glCompressedTexImage1D_ptr = + static MyCompressedTexImage1DArbProc glCompressedTexImage1D_ptr = convertPointerType(getGLExtensionFuncPtr("glCompressedTexImage1DARB")); if( _min_filter == LINEAR || _min_filter == NEAREST ) @@ -306,12 +306,12 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz else if(glCompressedTexImage1D_ptr) { numMipmapLevels = 1; - GLint blockSize = ( _internalFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ? 8 : 16 ); + GLint blockSize = ( _internalFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ? 8 : 16 ); GLint size = ((image->s()+3)/4)*((image->t()+3)/4)*blockSize; - glCompressedTexImage1D_ptr(target, 0, _internalFormat, - image->s(), _borderWidth, - size, - image->data()); + glCompressedTexImage1D_ptr(target, 0, _internalFormat, + image->s(), _borderWidth, + size, + image->data()); } @@ -351,14 +351,14 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz } else if(glCompressedTexImage1D_ptr) { - GLint blockSize = ( _internalFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ? 8 : 16 ); - GLint size = 0; + GLint blockSize = ( _internalFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ? 8 : 16 ); + GLint size = 0; for( GLsizei k = 0 ; k < numMipmapLevels && width ;k++) { size = ((width+3)/4)*blockSize; - glCompressedTexImage1D_ptr(target, k, _internalFormat, - width, _borderWidth, size, image->getMipmapData(k)); + glCompressedTexImage1D_ptr(target, k, _internalFormat, + width, _borderWidth, size, image->getMipmapData(k)); width >>= 1; } @@ -393,16 +393,16 @@ void Texture1D::copyTexImage1D(State& state, int x, int y, int width) return; } // the relevent texture object is not of the right size so - // needs to been deleted - // remove previously bound textures. + // needs to been deleted + // remove previously bound textures. dirtyTextureObject(); // note, dirtyTextureObject() dirties all the texture objects for // this texture, is this right? Perhaps we should dirty just the // one for this context. Note sure yet will leave till later. // RO July 2001. } - - + + // remove any previously assigned images as these are nolonger valid. _image = NULL; @@ -420,7 +420,7 @@ void Texture1D::copyTexImage1D(State& state, int x, int y, int width) _textureWidth = width; _numMipmapLevels = 1; - + textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,1,1,0); // inform state that this texture is the current one bound. @@ -469,7 +469,7 @@ void Texture1D::allocateMipmap(State& state) const // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject && _textureWidth != 0) { // bind texture @@ -481,7 +481,7 @@ void Texture1D::allocateMipmap(State& state) const // we do not reallocate the level 0, since it was already allocated width >>= 1; - + for( GLsizei k = 1; k < numMipmapLevels && width; k++) { if (width == 0) @@ -494,9 +494,9 @@ void Texture1D::allocateMipmap(State& state) const width >>= 1; } - + // inform state that this texture is the current one bound. - state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); + state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); } #else OSG_NOTICE<<"Warning: Texture1D::allocateMipmap(..) not supported."<getModifiedCount(); - + } else if (_readPBuffer.valid()) { @@ -216,7 +216,7 @@ void Texture2D::apply(State& state) const applyTexParameters(GL_TEXTURE_2D,state); _subloadCallback->load(*this,state); - + textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,_borderWidth); // in theory the following line is redundent, but in practice @@ -277,13 +277,13 @@ void Texture2D::apply(State& state) const // unless a second bind is called?!! // perhaps it is the first glBind which is not required... //glBindTexture( GL_TEXTURE_2D, handle ); - + } else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) ) { _textureObjectBuffer[contextID] = textureObject = generateTextureObject( this, contextID,GL_TEXTURE_2D,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,_borderWidth); - + textureObject->bind(); applyTexParameters(GL_TEXTURE_2D,state); @@ -293,13 +293,13 @@ void Texture2D::apply(State& state) const _textureWidth, _textureHeight, _borderWidth, _sourceFormat ? _sourceFormat : _internalFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, - 0); - + 0); + if (_readPBuffer.valid()) { _readPBuffer->bindPBufferToTexture(GL_FRONT); } - + } else { @@ -315,19 +315,19 @@ void Texture2D::apply(State& state) const void Texture2D::computeInternalFormat() const { - if (_image.valid()) computeInternalFormatWithImage(*_image); + if (_image.valid()) computeInternalFormatWithImage(*_image); else computeInternalFormatType(); } void Texture2D::copyTexImage2D(State& state, int x, int y, int width, int height ) { const unsigned int contextID = state.getContextID(); - + if (_internalFormat==0) _internalFormat=GL_RGBA; // get the globj for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject) { if (width==(int)_textureWidth && height==(int)_textureHeight) @@ -340,28 +340,28 @@ void Texture2D::copyTexImage2D(State& state, int x, int y, int width, int height return; } // the relevent texture object is not of the right size so - // needs to been deleted - // remove previously bound textures. + // needs to been deleted + // remove previously bound textures. dirtyTextureObject(); // note, dirtyTextureObject() dirties all the texture objects for // this texture, is this right? Perhaps we should dirty just the // one for this context. Note sure yet will leave till later. // RO July 2001. } - - + + // remove any previously assigned images as these are nolonger valid. _image = NULL; // switch off mip-mapping. // - + bool needHardwareMipMap = (_min_filter != LINEAR && _min_filter != NEAREST); bool hardwareMipMapOn = false; if (needHardwareMipMap) { hardwareMipMapOn = isHardwareMipmapGenerationEnabled(state); - + if (!hardwareMipMapOn) { // have to switch off mip mapping @@ -382,10 +382,10 @@ void Texture2D::copyTexImage2D(State& state, int x, int y, int width, int height _textureObjectBuffer[contextID] = textureObject = generateTextureObject(this, contextID,GL_TEXTURE_2D,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0); textureObject->bind(); - + applyTexParameters(GL_TEXTURE_2D,state); - + GenerateMipmapMode mipmapResult = mipmapBeforeTexImage(state, hardwareMipMapOn); glCopyTexImage2D( GL_TEXTURE_2D, 0, _internalFormat, x, y, width, height, 0 ); @@ -406,12 +406,12 @@ void Texture2D::copyTexSubImage2D(State& state, int xoffset, int yoffset, int x, // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject) { // we have a valid image textureObject->bind(); - + applyTexParameters(GL_TEXTURE_2D,state); bool needHardwareMipMap = (_min_filter != LINEAR && _min_filter != NEAREST); @@ -452,7 +452,7 @@ void Texture2D::allocateMipmap(State& state) const // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject && _textureWidth != 0 && _textureHeight != 0) { // bind texture @@ -466,7 +466,7 @@ void Texture2D::allocateMipmap(State& state) const // we do not reallocate the level 0, since it was already allocated width >>= 1; height >>= 1; - + for( GLsizei k = 1; k < numMipmapLevels && (width || height); k++) { if (width == 0) @@ -482,9 +482,9 @@ void Texture2D::allocateMipmap(State& state) const width >>= 1; height >>= 1; } - + // inform state that this texture is the current one bound. - state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); + state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); } } diff --git a/src/osg/Texture2DArray.cpp b/src/osg/Texture2DArray.cpp index 92c8c3a9b..53593f241 100644 --- a/src/osg/Texture2DArray.cpp +++ b/src/osg/Texture2DArray.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -59,7 +59,7 @@ int Texture2DArray::compare(const StateAttribute& sa) const { if (noImages && _images[n].valid()) noImages = false; if (noImages && rhs._images[n].valid()) noImages = false; - + if (_images[n]!=rhs._images[n]) // smart pointer comparison. { if (_images[n].valid()) @@ -71,17 +71,17 @@ int Texture2DArray::compare(const StateAttribute& sa) const } else { - return 1; // valid lhs._image is greater than null. + return 1; // valid lhs._image is greater than null. } } - else if (rhs._images[n].valid()) + else if (rhs._images[n].valid()) { - return -1; // valid rhs._image is greater than null. + return -1; // valid rhs._image is greater than null. } } } - + if (noImages) { int result = compareTextureObjects(rhs); @@ -109,7 +109,7 @@ void Texture2DArray::setImage(unsigned int layer, Image* image) OSG_WARN<<"Warning: Texture2DArray::setImage(..) failed, the given layer number is bigger then the size of the texture array."< _textureDepth) { _images.resize(depth, ref_ptr(0)); _modifiedCount.resize(depth, ImageModifiedCount()); } - + // resize the texture array _textureDepth = depth; } @@ -195,14 +195,14 @@ bool Texture2DArray::imagesValid() const void Texture2DArray::computeInternalFormat() const { - if (imagesValid()) computeInternalFormatWithImage(*_images[0]); + if (imagesValid()) computeInternalFormatWithImage(*_images[0]); else computeInternalFormatType(); } void Texture2DArray::apply(State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); @@ -218,7 +218,7 @@ void Texture2DArray::apply(State& state) const OSG_WARN<<"Warning: Texture2DArray::apply(..) failed, 2D texture arrays are not support by OpenGL driver."<getModifiedCount()) { @@ -275,7 +275,7 @@ void Texture2DArray::apply(State& state) const } } - + // there is no texture object, but exists a subload callback, so use it to upload images else if (_subloadCallback.valid()) { @@ -285,7 +285,7 @@ void Texture2DArray::apply(State& state) const applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT, state); _subloadCallback->load(*this,state); } - + // nothing before, but we have valid images, so do manual upload and create texture object manually // TODO: we assume _images[0] is valid, however this may not be always the case // some kind of checking for the first valid image is required (Art, may 2008) @@ -300,7 +300,7 @@ void Texture2DArray::apply(State& state) const // create texture object textureObject = generateTextureObject( this, contextID,GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,_textureDepth,0); - + // bind texture textureObject->bind(); applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT, state); @@ -310,7 +310,7 @@ void Texture2DArray::apply(State& state) const // First we need to allocate the texture memory int sourceFormat = _sourceFormat ? _sourceFormat : _internalFormat; - if( isCompressedInternalFormat( sourceFormat ) && + if( isCompressedInternalFormat( sourceFormat ) && sourceFormat == _internalFormat && extensions->isCompressedTexImage3DSupported() ) { @@ -320,7 +320,7 @@ void Texture2DArray::apply(State& state) const 0); } else - { + { // Override compressed source format with safe GL_RGBA value which not generate error // We can safely do this as source format is not important when source data is NULL if( isCompressedInternalFormat( sourceFormat ) ) @@ -329,12 +329,12 @@ void Texture2DArray::apply(State& state) const extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, 0, _internalFormat, _textureWidth, _textureHeight, _textureDepth, _borderWidth, sourceFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, - 0); + 0); } // For certain we have to manually allocate memory for mipmaps if images are compressed // if not allocated OpenGL will produce errors on mipmap upload. - // I have not tested if this is neccessary for plain texture formats but + // I have not tested if this is neccessary for plain texture formats but // common sense suggests its required as well. if( _min_filter != LINEAR && _min_filter != NEAREST && _images[0]->isMipmap() ) allocateMipmap( state ); @@ -353,8 +353,8 @@ void Texture2DArray::apply(State& state) const } const Texture::Extensions* texExtensions = Texture::getExtensions(contextID,true); - // source images have no mipmamps but we could generate them... - if( _min_filter != LINEAR && _min_filter != NEAREST && !_images[0]->isMipmap() && + // source images have no mipmamps but we could generate them... + if( _min_filter != LINEAR && _min_filter != NEAREST && !_images[0]->isMipmap() && _useHardwareMipMapGeneration && texExtensions->isGenerateMipMapSupported() ) { _numMipmapLevels = Image::computeNumberOfMipmapLevels( _textureWidth, _textureHeight ); @@ -362,41 +362,41 @@ void Texture2DArray::apply(State& state) const } textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,_textureDepth,0); - + // unref image data? if (isSafeToUnrefImageData(state)) { Texture2DArray* non_const_this = const_cast(this); for (int n=0; n<_textureDepth; n++) - { + { if (_images[n].valid() && _images[n]->getDataVariance()==STATIC) { non_const_this->_images[n] = NULL; } } } - + } - + // No images present, but dimensions are set. So create empty texture else if ( (_textureWidth > 0) && (_textureHeight > 0) && (_textureDepth > 0) && (_internalFormat!=0) ) { - // generate texture + // generate texture _textureObjectBuffer[contextID] = textureObject = generateTextureObject( this, contextID, GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,_textureDepth,0); - + textureObject->bind(); applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state); - + extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, 0, _internalFormat, _textureWidth, _textureHeight, _textureDepth, _borderWidth, _sourceFormat ? _sourceFormat : _internalFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, - 0); - + 0); + } - + // nothing before, so just unbind the texture target else { @@ -417,13 +417,13 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL if (!imagesValid()) return; - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - const Extensions* extensions = getExtensions(contextID,true); + const Extensions* extensions = getExtensions(contextID,true); const Texture::Extensions* texExtensions = Texture::getExtensions(contextID,true); GLenum target = GL_TEXTURE_2D_ARRAY_EXT; - + // compute the internal texture format, this set the _internalFormat to an appropriate value. computeInternalFormat(); @@ -436,7 +436,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL { // we give a warning and do nothing OSG_WARN<<"Warning: Texture2DArray::applyTexImage2DArray_subload(..) the given layer number exceeds the maximum number of supported layers."<ensureValidSizeForTexturing(extensions->max2DSize()); // image size or format has changed, this is not allowed, hence return - if (image->s()!=inwidth || - image->t()!=inheight || - image->getInternalTextureFormat()!=inInternalFormat ) + if (image->s()!=inwidth || + image->t()!=inheight || + image->getInternalTextureFormat()!=inInternalFormat ) { OSG_WARN<<"Warning: Texture2DArray::applyTexImage2DArray_subload(..) given image do have wrong dimension or internal format."<getPacking()); #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) glPixelStorei(GL_UNPACK_ROW_LENGTH,image->getRowLength()); #endif - bool useHardwareMipmapGeneration = + bool useHardwareMipmapGeneration = !image->isMipmap() && _useHardwareMipMapGeneration && texExtensions->isGenerateMipMapSupported(); // if no special mipmapping is required, then @@ -480,7 +480,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL (GLenum)image->getDataType(), image->data() ); } - + // if we support compression and image is compressed, then else if (extensions->isCompressedTexImage3DSupported()) { @@ -490,10 +490,10 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL getCompressedSize(_internalFormat, inwidth, inheight, 1, blockSize,size); extensions->glCompressedTexSubImage3D(target, 0, - 0, 0, indepth, - inwidth, inheight, 1, + 0, 0, indepth, + inwidth, inheight, 1, (GLenum)image->getPixelFormat(), - size, + size, image->data()); } @@ -525,7 +525,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL height = 1; extensions->glTexSubImage3D( target, k, 0, 0, indepth, - width, height, 1, + width, height, 1, (GLenum)image->getPixelFormat(), (GLenum)image->getDataType(), image->getMipmapData(k)); @@ -598,16 +598,16 @@ void Texture2DArray::allocateMipmap(State& state) const // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject && _textureWidth != 0 && _textureHeight != 0 && _textureDepth != 0) - { + { const Extensions* extensions = getExtensions(contextID,true); int safeSourceFormat = _sourceFormat ? _sourceFormat : _internalFormat; // Make sure source format does not contain compressed formats value (like DXT3) // they are invalid when passed to glTexImage3D source format parameter - if( isCompressedInternalFormat( safeSourceFormat ) ) + if( isCompressedInternalFormat( safeSourceFormat ) ) { if( safeSourceFormat != _internalFormat || !extensions->isCompressedTexImage3DSupported() ) safeSourceFormat = GL_RGBA; @@ -624,7 +624,7 @@ void Texture2DArray::allocateMipmap(State& state) const // we do not reallocate the level 0, since it was already allocated width >>= 1; height >>= 1; - + for( GLsizei k = 1; k < numMipmapLevels && (width || height); k++) { if (width == 0) @@ -632,13 +632,13 @@ void Texture2DArray::allocateMipmap(State& state) const if (height == 0) height = 1; - if( isCompressedInternalFormat(safeSourceFormat) ) + if( isCompressedInternalFormat(safeSourceFormat) ) { int size = 0, blockSize = 0; getCompressedSize( _internalFormat, width, height, _textureDepth, blockSize, size); - extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, k, _internalFormat, + extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, k, _internalFormat, width, height, _textureDepth, _borderWidth, size, NULL); @@ -647,16 +647,16 @@ void Texture2DArray::allocateMipmap(State& state) const { extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, k, _internalFormat, width, height, _textureDepth, _borderWidth, - safeSourceFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, + safeSourceFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, NULL); } width >>= 1; height >>= 1; } - + // inform state that this texture is the current one bound. - state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); + state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); } } @@ -684,10 +684,10 @@ Texture2DArray::Extensions::Extensions(const Extensions& rhs): { _isTexture3DSupported = rhs._isTexture3DSupported; _isTexture2DArraySupported = rhs._isTexture2DArraySupported; - + _max2DSize = rhs._max2DSize; _maxLayerCount = rhs._maxLayerCount; - + _glTexImage3D = rhs._glTexImage3D; _glTexSubImage3D = rhs._glTexSubImage3D; _glCopyTexSubImage3D = rhs._glCopyTexSubImage3D; diff --git a/src/osg/Texture2DMultisample.cpp b/src/osg/Texture2DMultisample.cpp index 2dbdd1ccf..6df05375a 100644 --- a/src/osg/Texture2DMultisample.cpp +++ b/src/osg/Texture2DMultisample.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * Texture2DMultisample codes Copyright (C) 2010 Marcin Hajder @@ -106,8 +106,8 @@ void Texture2DMultisample::apply(State& state) const } else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_numSamples!=0) ) { - _textureObjectBuffer[contextID] = textureObject = - generateTextureObject( this, + _textureObjectBuffer[contextID] = textureObject = + generateTextureObject( this, contextID, getTextureTarget(), 1, @@ -119,11 +119,11 @@ void Texture2DMultisample::apply(State& state) const textureObject->bind(); - extensions->glTexImage2DMultisample( getTextureTarget(), - _numSamples, - _internalFormat, - _textureWidth, - _textureHeight, + extensions->glTexImage2DMultisample( getTextureTarget(), + _numSamples, + _internalFormat, + _textureWidth, + _textureHeight, _fixedsamplelocations ); } diff --git a/src/osg/Texture3D.cpp b/src/osg/Texture3D.cpp index 2fa04367d..adb29c61f 100644 --- a/src/osg/Texture3D.cpp +++ b/src/osg/Texture3D.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -72,12 +72,12 @@ int Texture3D::compare(const StateAttribute& sa) const } else { - return 1; // valid lhs._image is greater than null. + return 1; // valid lhs._image is greater than null. } } - else if (rhs._image.valid()) + else if (rhs._image.valid()) { - return -1; // valid rhs._image is greater than null. + return -1; // valid rhs._image is greater than null. } } @@ -153,11 +153,11 @@ void Texture3D::computeRequiredTextureDimensions(State& state, const osg::Image& if (width>extensions->maxTexture3DSize()) width = extensions->maxTexture3DSize(); if (height>extensions->maxTexture3DSize()) height = extensions->maxTexture3DSize(); if (depth>extensions->maxTexture3DSize()) depth = extensions->maxTexture3DSize(); - + inwidth = width; inheight = height; indepth = depth; - + bool useHardwareMipMapGeneration = !image.isMipmap() && _useHardwareMipMapGeneration && texExtensions->isGenerateMipMapSupported(); if( _min_filter == LINEAR || _min_filter == NEAREST || useHardwareMipMapGeneration ) @@ -184,14 +184,14 @@ void Texture3D::computeRequiredTextureDimensions(State& state, const osg::Image& width >>= 1; height >>= 1; depth >>= 1; - } + } } } void Texture3D::apply(State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); @@ -200,7 +200,7 @@ void Texture3D::apply(State& state) const tom->getNumberApplied()++; const Extensions* extensions = getExtensions(contextID,true); - + if (!extensions->isTexture3DSupported()) { OSG_WARN<<"Warning: Texture3D::apply(..) failed, 3D texturing is not support by OpenGL driver."<bind(); applyTexParameters(GL_TEXTURE_3D,state); @@ -321,19 +321,19 @@ void Texture3D::apply(State& state) const _borderWidth, _sourceFormat ? _sourceFormat : _internalFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, - 0); - + 0); + if (_readPBuffer.valid()) { _readPBuffer->bindPBufferToTexture(GL_FRONT); } - + } else { glBindTexture( GL_TEXTURE_3D, 0 ); } - + // if texture object is now valid and we have to allocate mipmap levels, then if (textureObject != 0 && _texMipmapGenerationDirtyList[contextID]) { @@ -343,7 +343,7 @@ void Texture3D::apply(State& state) const void Texture3D::computeInternalFormat() const { - if (_image.valid()) computeInternalFormatWithImage(*_image); + if (_image.valid()) computeInternalFormatWithImage(*_image); else computeInternalFormatType(); } @@ -353,10 +353,10 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz if (!image || !image->data()) return; - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - const Extensions* extensions = getExtensions(contextID,true); + const Extensions* extensions = getExtensions(contextID,true); const Texture::Extensions* texExtensions = Texture::getExtensions(contextID,true); // compute the internal texture format, this set the _internalFormat to an appropriate value. @@ -370,8 +370,8 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz { //OSG_WARN<<"Warning::cannot currently use compressed format with 3D textures."<isNonPowerOfTwoTextureSupported(_min_filter) || inwidth > extensions->maxTexture3DSize() @@ -389,7 +389,7 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz if( _min_filter == LINEAR || _min_filter == NEAREST || useHardwareMipMapGeneration ) { bool hardwareMipMapOn = false; - if (_min_filter != LINEAR && _min_filter != NEAREST) + if (_min_filter != LINEAR && _min_filter != NEAREST) { if (useHardwareMipMapGeneration) glTexParameteri(GL_TEXTURE_3D, GL_GENERATE_MIPMAP_SGIS,GL_TRUE); hardwareMipMapOn = true; @@ -414,10 +414,10 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz GLint blockSize, size; getCompressedSize(_internalFormat, inwidth, inheight, indepth, blockSize,size); - extensions->glCompressedTexImage3D(target, 0, _internalFormat, - inwidth, inheight, indepth, + extensions->glCompressedTexImage3D(target, 0, _internalFormat, + inwidth, inheight, indepth, _borderWidth, - size, + size, image->data()); } @@ -472,7 +472,7 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz inwidth = image->s(); inheight = image->t(); indepth = image->r(); - + } void Texture3D::copyTexSubImage3D(State& state, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height ) @@ -509,11 +509,11 @@ void Texture3D::allocateMipmap(State& state) const // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject && _textureWidth != 0 && _textureHeight != 0 && _textureDepth != 0) { const Extensions* extensions = getExtensions(contextID,true); - + // bind texture textureObject->bind(); @@ -527,7 +527,7 @@ void Texture3D::allocateMipmap(State& state) const width >>= 1; height >>= 1; depth >>= 1; - + for( GLsizei k = 1; k < numMipmapLevels && (width || height || depth); k++) { if (width == 0) @@ -546,9 +546,9 @@ void Texture3D::allocateMipmap(State& state) const height >>= 1; depth >>= 1; } - + // inform state that this texture is the current one bound. - state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); + state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); } } @@ -608,7 +608,7 @@ void Texture3D::Extensions::setupGLExtensions(unsigned int contextID) if (_isTexture3DFast) _isTexture3DSupported = true; else _isTexture3DSupported = strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0; - + _maxTexture3DSize = 0; glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &_maxTexture3DSize); diff --git a/src/osg/TextureCubeMap.cpp b/src/osg/TextureCubeMap.cpp index cea3f4ab3..5ab37343d 100644 --- a/src/osg/TextureCubeMap.cpp +++ b/src/osg/TextureCubeMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -62,7 +62,7 @@ TextureCubeMap::TextureCubeMap(const TextureCubeMap& text,const CopyOp& copyop): _modifiedCount[4].setAllElementsTo(0); _modifiedCount[5].setAllElementsTo(0); -} +} TextureCubeMap::~TextureCubeMap() @@ -81,7 +81,7 @@ int TextureCubeMap::compare(const StateAttribute& sa) const { if (noImages && _images[n].valid()) noImages = false; if (noImages && rhs._images[n].valid()) noImages = false; - + if (_images[n]!=rhs._images[n]) // smart pointer comparison. { if (_images[n].valid()) @@ -93,12 +93,12 @@ int TextureCubeMap::compare(const StateAttribute& sa) const } else { - return 1; // valid lhs._image is greater than null. + return 1; // valid lhs._image is greater than null. } } - else if (rhs._images[n].valid()) + else if (rhs._images[n].valid()) { - return -1; // valid rhs._image is greater than null. + return -1; // valid rhs._image is greater than null. } } } @@ -184,13 +184,13 @@ bool TextureCubeMap::imagesValid() const void TextureCubeMap::computeInternalFormat() const { - if (imagesValid()) computeInternalFormatWithImage(*_images[0]); + if (imagesValid()) computeInternalFormatWithImage(*_images[0]); else computeInternalFormatType(); } void TextureCubeMap::apply(State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); @@ -286,7 +286,7 @@ void TextureCubeMap::apply(State& state) const textureObject = generateTextureObject( this, contextID,GL_TEXTURE_CUBE_MAP,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0); - + textureObject->bind(); applyTexParameters(GL_TEXTURE_CUBE_MAP,state); @@ -317,34 +317,34 @@ void TextureCubeMap::apply(State& state) const { TextureCubeMap* non_const_this = const_cast(this); for (int n=0; n<6; n++) - { + { if (_images[n].valid() && _images[n]->getDataVariance()==STATIC) { non_const_this->_images[n] = NULL; } } } - + } else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) ) { _textureObjectBuffer[contextID] = textureObject = generateTextureObject( this, contextID,GL_TEXTURE_CUBE_MAP,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0); - + textureObject->bind(); applyTexParameters(GL_TEXTURE_CUBE_MAP,state); for (int n=0; n<6; n++) - { + { // no image present, but dimensions at set so less create the texture glTexImage2D( faceTarget[n], 0, _internalFormat, _textureWidth, _textureHeight, _borderWidth, _sourceFormat ? _sourceFormat : _internalFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, - 0); + 0); } - + } else { @@ -379,25 +379,25 @@ void TextureCubeMap::copyTexSubImageCubeMap(State& state, int face, int xoffset, // create texture object. apply(state); - + textureObject = getTextureObject(contextID); - + if (!textureObject) { // failed to create texture object OSG_NOTICE<<"Warning : failed to create TextureCubeMap texture obeject, copyTexSubImageCubeMap abondoned."<bind(); - + applyTexParameters(GL_TEXTURE_CUBE_MAP, state); bool needHardwareMipMap = (_min_filter != LINEAR && _min_filter != NEAREST); @@ -432,7 +432,7 @@ void TextureCubeMap::allocateMipmap(State& state) const // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject && _textureWidth != 0 && _textureHeight != 0) { // bind texture @@ -446,7 +446,7 @@ void TextureCubeMap::allocateMipmap(State& state) const // we do not reallocate the level 0, since it was already allocated width >>= 1; height >>= 1; - + for( GLsizei k = 1; k < numMipmapLevels && (width || height); k++) { if (width == 0) @@ -462,13 +462,13 @@ void TextureCubeMap::allocateMipmap(State& state) const _sourceType ? _sourceType : GL_UNSIGNED_BYTE, 0); } - + width >>= 1; height >>= 1; } - + // inform state that this texture is the current one bound. - state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); + state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this); } } diff --git a/src/osg/TextureRectangle.cpp b/src/osg/TextureRectangle.cpp index 9fcac1deb..c3c1627b9 100644 --- a/src/osg/TextureRectangle.cpp +++ b/src/osg/TextureRectangle.cpp @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -56,7 +56,7 @@ TextureRectangle::TextureRectangle(Image* image): setFilter(MIN_FILTER, LINEAR); setFilter(MAG_FILTER, LINEAR); - + setImage(image); } @@ -90,12 +90,12 @@ int TextureRectangle::compare(const StateAttribute& sa) const } else { - return 1; // valid lhs._image is greater than null. + return 1; // valid lhs._image is greater than null. } } - else if (rhs._image.valid()) + else if (rhs._image.valid()) { - return -1; // valid rhs._image is greater than null. + return -1; // valid rhs._image is greater than null. } } @@ -146,7 +146,7 @@ void TextureRectangle::setImage(Image* image) void TextureRectangle::apply(State& state) const { - static bool s_rectangleSupported = + static bool s_rectangleSupported = OSG_GL3_FEATURES || isGLExtensionSupported(state.getContextID(),"GL_ARB_texture_rectangle") || isGLExtensionSupported(state.getContextID(),"GL_EXT_texture_rectangle") || @@ -158,7 +158,7 @@ void TextureRectangle::apply(State& state) const return; } - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); @@ -205,14 +205,14 @@ void TextureRectangle::apply(State& state) const else if (_image.valid() && getModifiedCount(contextID) != _image->getModifiedCount()) { applyTexImage_subload(GL_TEXTURE_RECTANGLE, _image.get(), state, _textureWidth, _textureHeight, _internalFormat); - + // update the modified count to show that it is upto date. getModifiedCount(contextID) = _image->getModifiedCount(); } } else if (_subloadCallback.valid()) { - // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. + // we don't have a applyTexImage1D_subload yet so can't reuse.. so just generate a new texture object. _textureObjectBuffer[contextID] = textureObject = generateTextureObject(this, contextID,GL_TEXTURE_RECTANGLE); textureObject->bind(); @@ -270,7 +270,7 @@ void TextureRectangle::apply(State& state) const { _textureObjectBuffer[contextID] = textureObject = generateTextureObject( this, contextID,GL_TEXTURE_RECTANGLE,0,_internalFormat,_textureWidth,_textureHeight,1,0); - + textureObject->bind(); applyTexParameters(GL_TEXTURE_RECTANGLE,state); @@ -280,13 +280,13 @@ void TextureRectangle::apply(State& state) const _textureWidth, _textureHeight, _borderWidth, _sourceFormat ? _sourceFormat : _internalFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, - 0); - + 0); + if (_readPBuffer.valid()) { _readPBuffer->bindPBufferToTexture(GL_FRONT); } - + } else { @@ -300,7 +300,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st if (!image || !image->data()) return; - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); const Extensions* extensions = getExtensions(contextID,true); @@ -340,9 +340,9 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st if(isCompressedInternalFormat(_internalFormat) && extensions->isCompressedTexImage2DSupported()) { - extensions->glCompressedTexImage2D(target, 0, _internalFormat, + extensions->glCompressedTexImage2D(target, 0, _internalFormat, image->s(), image->t(), 0, - image->getImageSizeInBytes(), + image->getImageSizeInBytes(), dataPtr); } else @@ -353,7 +353,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st (GLenum)image->getDataType(), dataPtr ); } - + if (pbo) { @@ -375,14 +375,14 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State& if (!image || !image->data()) return; - if (image->s()!=inwidth || image->t()!=inheight || image->getInternalTextureFormat()!=inInternalFormat) + if (image->s()!=inwidth || image->t()!=inheight || image->getInternalTextureFormat()!=inInternalFormat) { applyTexImage_load(target, image, state, inwidth, inheight); return; } - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); const Extensions* extensions = getExtensions(contextID,true); @@ -395,7 +395,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State& computeInternalFormat(); glPixelStorei(GL_UNPACK_ALIGNMENT, image->getPacking()); - unsigned int rowLength = image->getRowLength(); + unsigned int rowLength = image->getRowLength(); #ifdef DO_TIMING osg::Timer_t start_tick = osg::Timer::instance()->tick(); @@ -419,8 +419,8 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State& if(isCompressedInternalFormat(_internalFormat) && extensions->isCompressedTexSubImage2DSupported()) { - extensions->glCompressedTexSubImage2D(target, 0, - 0,0, + extensions->glCompressedTexSubImage2D(target, 0, + 0,0, image->s(), image->t(), (GLenum)image->getPixelFormat(), (GLenum)image->getDataType(), @@ -428,7 +428,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State& } else { - glTexSubImage2D(target, 0, + glTexSubImage2D(target, 0, 0,0, image->s(), image->t(), (GLenum)image->getPixelFormat(), @@ -448,19 +448,19 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State& void TextureRectangle::computeInternalFormat() const { - if (_image.valid()) computeInternalFormatWithImage(*_image); + if (_image.valid()) computeInternalFormatWithImage(*_image); else computeInternalFormatType(); } void TextureRectangle::copyTexImage2D(State& state, int x, int y, int width, int height ) { const unsigned int contextID = state.getContextID(); - + if (_internalFormat==0) _internalFormat=GL_RGBA; // get the globj for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject) { if (width==(int)_textureWidth && height==(int)_textureHeight) @@ -473,16 +473,16 @@ void TextureRectangle::copyTexImage2D(State& state, int x, int y, int width, int return; } // the relevent texture object is not of the right size so - // needs to been deleted - // remove previously bound textures. + // needs to been deleted + // remove previously bound textures. dirtyTextureObject(); // note, dirtyTextureObject() dirties all the texture objects for // this texture, is this right? Perhaps we should dirty just the // one for this context. Note sure yet will leave till later. // RO July 2001. } - - + + // remove any previously assigned images as these are nolonger valid. _image = NULL; @@ -491,7 +491,7 @@ void TextureRectangle::copyTexImage2D(State& state, int x, int y, int width, int _textureObjectBuffer[contextID] = textureObject = generateTextureObject(this, contextID,GL_TEXTURE_RECTANGLE); textureObject->bind(); - + applyTexParameters(GL_TEXTURE_RECTANGLE,state); @@ -503,7 +503,7 @@ void TextureRectangle::copyTexImage2D(State& state, int x, int y, int width, int bool generateMipMapSupported = extensions->isGenerateMipMapSupported(); hardwareMipMapOn = _useHardwareMipMapGeneration && generateMipMapSupported; - + if (!hardwareMipMapOn) { // have to swtich off mip mapping @@ -511,7 +511,7 @@ void TextureRectangle::copyTexImage2D(State& state, int x, int y, int width, int _min_filter = LINEAR; } } -*/ +*/ // if (hardwareMipMapOn) glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS,GL_TRUE); glCopyTexImage2D( GL_TEXTURE_RECTANGLE, 0, _internalFormat, x, y, width, height, 0 ); @@ -522,7 +522,7 @@ void TextureRectangle::copyTexImage2D(State& state, int x, int y, int width, int _textureWidth = width; _textureHeight = height; // _numMipmapLevels = 1; - + textureObject->setAllocated(1,_internalFormat,_textureWidth,_textureHeight,1,0); @@ -538,12 +538,12 @@ void TextureRectangle::copyTexSubImage2D(State& state, int xoffset, int yoffset, // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + if (textureObject) { // we have a valid image textureObject->bind(); - + applyTexParameters(GL_TEXTURE_RECTANGLE,state); /* bool needHardwareMipMap = (_min_filter != LINEAR && _min_filter != NEAREST); diff --git a/src/osg/Timer.cpp b/src/osg/Timer.cpp index bd9156a89..873e2e6c8 100644 --- a/src/osg/Timer.cpp +++ b/src/osg/Timer.cpp @@ -51,8 +51,8 @@ Timer* Timer::instance() OSG_NOTICE<<"Error: Timer::Timer() unable to use QueryPerformanceFrequency, "< 0 ) && defined(_POSIX_MONOTONIC_CLOCK) diff --git a/src/osg/Transform.cpp b/src/osg/Transform.cpp index fe5e06344..9fa478f46 100644 --- a/src/osg/Transform.cpp +++ b/src/osg/Transform.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -20,13 +20,13 @@ using namespace osg; class TransformVisitor : public NodeVisitor { public: - + enum CoordMode { WORLD_TO_LOCAL, LOCAL_TO_WORLD }; - + CoordMode _coordMode; Matrix& _matrix; @@ -50,11 +50,11 @@ class TransformVisitor : public NodeVisitor transform.computeWorldToLocalMatrix(_matrix,this); } } - + void accumulate(const NodePath& nodePath) { if (nodePath.empty()) return; - + unsigned int i = 0; if (_ignoreCameras) { @@ -67,15 +67,15 @@ class TransformVisitor : public NodeVisitor ++ritr, --i) { const osg::Camera* camera = dynamic_cast(*ritr); - if (camera && + if (camera && (camera->getReferenceFrame()!=osg::Transform::RELATIVE_RF || camera->getParents().empty())) { break; } } - } + } - // do the accumulation of the active part of nodepath. + // do the accumulation of the active part of nodepath. for(; i(nodePath[i])->accept(*this); } } - + protected: - + TransformVisitor& operator = (const TransformVisitor&) { return *this; } - + }; Matrix osg::computeLocalToWorld(const NodePath& nodePath, bool ignoreCameras) @@ -135,7 +135,7 @@ Transform::Transform() Transform::Transform(const Transform& transform,const CopyOp& copyop): Group(transform,copyop), _referenceFrame(transform._referenceFrame) -{ +{ } Transform::~Transform() @@ -145,9 +145,9 @@ Transform::~Transform() void Transform::setReferenceFrame(ReferenceFrame rf) { if (_referenceFrame == rf) return; - + _referenceFrame = rf; - + // switch off culling if transform is absolute. setCullingActive(_referenceFrame==RELATIVE_RF); } @@ -156,7 +156,7 @@ BoundingSphere Transform::computeBound() const { BoundingSphere bsphere = Group::computeBound(); if (!bsphere.valid()) return bsphere; - + // note, NULL pointer for NodeVisitor, so compute's need // to handle this case gracefully, normally this should not be a problem. Matrix l2w; diff --git a/src/osg/Uniform.cpp b/src/osg/Uniform.cpp index b6b736b29..70f037731 100644 --- a/src/osg/Uniform.cpp +++ b/src/osg/Uniform.cpp @@ -1,11 +1,11 @@ -/* -*-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) 2008 Zebra Imaging * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -249,7 +249,7 @@ int Uniform::compareData(const Uniform& rhs) const return memcmp( _uintArray->getDataPointer(), rhs._uintArray->getDataPointer(), _uintArray->getTotalDataSize() ); } - + return -1; // how got here? } @@ -1496,13 +1496,13 @@ void Uniform::setUpdateCallback(Callback* uc) OSG_INFO<<"Uniform::Setting Update callbacks"<setNumChildrenRequiringEventTraversal((*itr)->getNumChildrenRequiringEventTraversal()+delta); } } diff --git a/src/osg/UserDataContainer.cpp b/src/osg/UserDataContainer.cpp index 0d4293697..dfb949585 100644 --- a/src/osg/UserDataContainer.cpp +++ b/src/osg/UserDataContainer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/Version.cpp b/src/osg/Version.cpp index 04074d601..122d69a26 100644 --- a/src/osg/Version.cpp +++ b/src/osg/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -33,7 +33,7 @@ const char* osgGetVersion() osg_version_init = 0; } - + return osg_version; } @@ -46,7 +46,7 @@ const char* osgGetSOVersion() sprintf(osg_soversion,"%d",OPENSCENEGRAPH_SOVERSION); osg_soversion_init = 0; } - + return osg_soversion; } diff --git a/src/osg/VertexProgram.cpp b/src/osg/VertexProgram.cpp index 1e70c45bc..3029d5411 100644 --- a/src/osg/VertexProgram.cpp +++ b/src/osg/VertexProgram.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -23,7 +23,7 @@ using namespace osg; -// static cache of deleted vertex programs which can only +// static cache of deleted vertex programs which can only // by completely deleted once the appropriate OpenGL context // is set. typedef std::list VertexProgramObjectList; @@ -69,7 +69,7 @@ void VertexProgram::flushDeletedVertexProgramObjects(unsigned int contextID,doub elapsedTime = timer.delta_s(start_tick,timer.tick()); } } - + availableTime -= elapsedTime; } @@ -91,13 +91,13 @@ VertexProgram::VertexProgram(const VertexProgram& vp,const CopyOp& copyop): { _vertexProgram = vp._vertexProgram; - for( LocalParamList::const_iterator itr = vp._programLocalParameters.begin(); + for( LocalParamList::const_iterator itr = vp._programLocalParameters.begin(); itr != vp._programLocalParameters.end(); ++itr ) { _programLocalParameters[itr->first] = itr->second; } - for( MatrixList::const_iterator mitr = vp._matrixList.begin(); + for( MatrixList::const_iterator mitr = vp._matrixList.begin(); mitr != vp._matrixList.end(); ++mitr ) { _matrixList[mitr->first] = mitr->second; @@ -278,7 +278,7 @@ void VertexProgram::Extensions::glBindProgram(GLenum target, GLuint id) const else { OSG_WARN<<"Error: glBindProgram not supported by OpenGL driver"< @@ -35,7 +35,7 @@ View::View(): _camera->setProjectionMatrixAsPerspective( vfov, width/height, 1.0f,10000.0f); _camera->setClearColor(osg::Vec4f(0.2f, 0.2f, 0.4f, 1.0f)); - + osg::StateSet* stateset = _camera->getOrCreateStateSet(); stateset->setGlobalDefaults(); } @@ -59,7 +59,7 @@ View::~View() _camera->setView(0); _camera->setCullCallback(0); } - + // detach the cameras from this View to prevent dangling pointers for(Slaves::iterator itr = _slaves.begin(); itr != _slaves.end(); @@ -69,10 +69,10 @@ View::~View() cd._camera->setView(0); cd._camera->setCullCallback(0); } - + _camera = 0; _slaves.clear(); - _light = 0; + _light = 0; #if 0 if (osg::Referenced::getDeleteHandler()) @@ -81,7 +81,7 @@ View::~View() osg::Referenced::getDeleteHandler()->flushAll(); } #endif - + OSG_INFO<<"Done destructing osg::View"<setView(this); - + for(unsigned int i=0; i<_slaves.size(); ++i) { if (_slaves[i]._camera.valid()) _slaves[i]._camera->setView(this); @@ -111,7 +111,7 @@ void View::take(osg::View& rhs) void View::setLightingMode(LightingMode lightingMode) { _lightingMode = lightingMode; - if (_lightingMode != NO_LIGHT && !_light) + if (_lightingMode != NO_LIGHT && !_light) { _light = new osg::Light; _light->setThreadSafeRefUnref(true); @@ -126,7 +126,7 @@ void View::setLightingMode(LightingMode lightingMode) void View::setCamera(osg::Camera* camera) { if (_camera.valid()) _camera->setView(0); - + _camera = camera; if (_camera.valid()) @@ -169,7 +169,7 @@ bool View::addSlave(osg::Camera* camera, const osg::Matrix& projectionOffset, co if (useMastersSceneData) { camera->removeChildren(0,camera->getNumChildren()); - + if (_camera.valid()) { for(unsigned int i=0; i<_camera->getNumChildren(); ++i) @@ -182,8 +182,8 @@ bool View::addSlave(osg::Camera* camera, const osg::Matrix& projectionOffset, co _slaves.push_back(Slave(camera, projectionOffset, viewOffset, useMastersSceneData)); _slaves[i].updateSlave(*this); - - camera->setRenderer(createRenderer(camera)); + + camera->setRenderer(createRenderer(camera)); return true; } @@ -194,7 +194,7 @@ bool View::removeSlave(unsigned int pos) _slaves[pos]._camera->setView(0); _slaves[pos]._camera->setCullCallback(0); - + _slaves.erase(_slaves.begin()+pos); return true; @@ -218,7 +218,7 @@ unsigned int View::findSlaveIndexForCamera(osg::Camera* camera) const { if (_slaves[i]._camera == camera) return (i); } - + return _slaves.size(); } diff --git a/src/osg/Viewport.cpp b/src/osg/Viewport.cpp index 408e453e0..cd6a7e40f 100644 --- a/src/osg/Viewport.cpp +++ b/src/osg/Viewport.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osg/dxtctool.cpp b/src/osg/dxtctool.cpp index 9ed1189df..2e4628c8d 100644 --- a/src/osg/dxtctool.cpp +++ b/src/osg/dxtctool.cpp @@ -1,5 +1,5 @@ // dxtctool.cpp: implementation of DXTC Tools functions. -// +// // Copyright (C) 2002 Tanguy Fautré. // For conditions of distribution and use, // see copyright notice in dxtctool.h @@ -60,7 +60,7 @@ bool dxtc_pixels::VFlip() const // Nothing to do if Height == 1 if (m_Height == 1) return true; - + if (DXT1()) VFlip_DXT1(); else if (DXT3()) @@ -120,7 +120,7 @@ void dxtc_pixels::VFlip_DXT3() const for (size_t j = 0; j < (m_Width + 3) / 4; ++j) { const size_t TargetRow = ((m_Height + 3) / 4) - (i + 1); BVF_Alpha_DXT3(GetBlock(i, j, BSIZE_DXT3), GetBlock(TargetRow, j, BSIZE_DXT3)); - BVF_Color(((dxtc_int8 * ) GetBlock(i, j, BSIZE_DXT3)) + BSIZE_ALPHA_DXT3, + BVF_Color(((dxtc_int8 * ) GetBlock(i, j, BSIZE_DXT3)) + BSIZE_ALPHA_DXT3, ((dxtc_int8 * ) GetBlock(TargetRow, j, BSIZE_DXT3)) + BSIZE_ALPHA_DXT3); } } @@ -149,7 +149,7 @@ void dxtc_pixels::VFlip_DXT5() const for (size_t j = 0; j < (m_Width + 3) / 4; ++j) { const size_t TargetRow = ((m_Height + 3) / 4) - (i + 1); BVF_Alpha_DXT5(GetBlock(i, j, BSIZE_DXT5), GetBlock(TargetRow, j, BSIZE_DXT5)); - BVF_Color(((dxtc_int8 * ) GetBlock(i, j, BSIZE_DXT5)) + BSIZE_ALPHA_DXT5, + BVF_Color(((dxtc_int8 * ) GetBlock(i, j, BSIZE_DXT5)) + BSIZE_ALPHA_DXT5, ((dxtc_int8 * ) GetBlock(TargetRow, j, BSIZE_DXT5)) + BSIZE_ALPHA_DXT5); } } diff --git a/src/osgAnimation/Action.cpp b/src/osgAnimation/Action.cpp index f28d261c8..26e309d0e 100644 --- a/src/osgAnimation/Action.cpp +++ b/src/osgAnimation/Action.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,17 +36,17 @@ Action::Callback* Action::getFrameCallback(unsigned int frame) void Action::removeCallback(Callback* cb) { std::vector keyToRemove; - for (FrameCallback::iterator it = _framesCallback.begin(); it != _framesCallback.end(); ++it) + for (FrameCallback::iterator it = _framesCallback.begin(); it != _framesCallback.end(); ++it) { if (it->second.get()) { - if (it->second.get() == cb) + if (it->second.get() == cb) { it->second = it->second->getNestedCallback(); if (!it->second.valid()) keyToRemove.push_back(it->first); } - else + else { it->second->removeCallback(cb); } diff --git a/src/osgAnimation/ActionAnimation.cpp b/src/osgAnimation/ActionAnimation.cpp index a57a073a0..9b7a9643b 100644 --- a/src/osgAnimation/ActionAnimation.cpp +++ b/src/osgAnimation/ActionAnimation.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgAnimation/ActionBlendIn.cpp b/src/osgAnimation/ActionBlendIn.cpp index e8c9fc1b1..55eb55851 100644 --- a/src/osgAnimation/ActionBlendIn.cpp +++ b/src/osgAnimation/ActionBlendIn.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -17,7 +17,7 @@ using namespace osgAnimation; ActionBlendIn::ActionBlendIn() : _weight(0) {} -ActionBlendIn::ActionBlendIn(const ActionBlendIn& a, const osg::CopyOp& c) : Action(a,c) +ActionBlendIn::ActionBlendIn(const ActionBlendIn& a, const osg::CopyOp& c) : Action(a,c) { _weight = a._weight; _animation = a._animation; diff --git a/src/osgAnimation/ActionBlendOut.cpp b/src/osgAnimation/ActionBlendOut.cpp index 8e03cc0d1..59c40d895 100644 --- a/src/osgAnimation/ActionBlendOut.cpp +++ b/src/osgAnimation/ActionBlendOut.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -17,7 +17,7 @@ using namespace osgAnimation; ActionBlendOut::ActionBlendOut() : _weight(0) {} -ActionBlendOut::ActionBlendOut(const ActionBlendOut& a, const osg::CopyOp& c) : Action(a,c) +ActionBlendOut::ActionBlendOut(const ActionBlendOut& a, const osg::CopyOp& c) : Action(a,c) { _weight = a._weight; _animation = a._animation; diff --git a/src/osgAnimation/ActionCallback.cpp b/src/osgAnimation/ActionCallback.cpp index 2e4f2a23e..143d8f435 100644 --- a/src/osgAnimation/ActionCallback.cpp +++ b/src/osgAnimation/ActionCallback.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgAnimation/ActionStripAnimation.cpp b/src/osgAnimation/ActionStripAnimation.cpp index fa2c7c448..4d6a6d6f3 100644 --- a/src/osgAnimation/ActionStripAnimation.cpp +++ b/src/osgAnimation/ActionStripAnimation.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,11 +24,11 @@ const ActionAnimation* ActionStripAnimation::getAnimation() const { return _anim const ActionBlendIn* ActionStripAnimation::getBlendIn() const { return _blendIn.get(); } const ActionBlendOut* ActionStripAnimation::getBlendOut() const { return _blendOut.second.get(); } unsigned int ActionStripAnimation::getBlendOutStartFrame() const { return _blendOut.first; } - + unsigned int ActionStripAnimation::getLoop() const { return _animation->getLoop(); } -ActionStripAnimation::ActionStripAnimation(const ActionStripAnimation& a, const osg::CopyOp& c) : Action(a,c) +ActionStripAnimation::ActionStripAnimation(const ActionStripAnimation& a, const osg::CopyOp& c) : Action(a,c) { _animation = a._animation; _blendIn = a._blendIn; diff --git a/src/osgAnimation/ActionVisitor.cpp b/src/osgAnimation/ActionVisitor.cpp index 7e6ea5094..611acb39f 100644 --- a/src/osgAnimation/ActionVisitor.cpp +++ b/src/osgAnimation/ActionVisitor.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -48,9 +48,9 @@ Timeline* ActionVisitor::getCurrentTimeline() return _stackTimeline.back(); } -UpdateActionVisitor::UpdateActionVisitor() +UpdateActionVisitor::UpdateActionVisitor() { - _frame = 0; + _frame = 0; _currentAnimationPriority = 0; } @@ -116,7 +116,7 @@ void UpdateActionVisitor::apply(Action& action) void UpdateActionVisitor::apply(ActionBlendIn& action) { - if (isActive(action)) + if (isActive(action)) { unsigned int frame = getLocalFrame(); apply(static_cast(action)); @@ -126,7 +126,7 @@ void UpdateActionVisitor::apply(ActionBlendIn& action) void UpdateActionVisitor::apply(ActionBlendOut& action) { - if (isActive(action)) + if (isActive(action)) { unsigned int frame = getLocalFrame(); apply(static_cast(action)); diff --git a/src/osgAnimation/Animation.cpp b/src/osgAnimation/Animation.cpp index 47174135d..d3025f176 100644 --- a/src/osgAnimation/Animation.cpp +++ b/src/osgAnimation/Animation.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -103,7 +103,7 @@ bool Animation::update (double time, int priority) double ratio = _originalDuration / _duration; double t = (time - _startTime) * ratio; - switch (_playmode) + switch (_playmode) { case ONCE: if (t > _originalDuration) @@ -120,10 +120,10 @@ bool Animation::update (double time, int priority) t = fmod(t, _originalDuration); // std::cout << "t " << t << " duration " << _duration << std::endl; break; - case PPONG: + case PPONG: if (!_originalDuration) t = _startTime; - else + else { int tt = (int) (t / _originalDuration); t = fmod(t, _originalDuration); diff --git a/src/osgAnimation/AnimationManagerBase.cpp b/src/osgAnimation/AnimationManagerBase.cpp index f2ab20ba1..9f2d2b294 100644 --- a/src/osgAnimation/AnimationManagerBase.cpp +++ b/src/osgAnimation/AnimationManagerBase.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -41,7 +41,7 @@ void AnimationManagerBase::setAutomaticLink(bool state) { _automaticLink = state bool AnimationManagerBase::getAutomaticLink() const { return _automaticLink; } void AnimationManagerBase::operator()(osg::Node* node, osg::NodeVisitor* nv) -{ +{ if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) { if (needToLink()) diff --git a/src/osgAnimation/BasicAnimationManager.cpp b/src/osgAnimation/BasicAnimationManager.cpp index 53788ab2c..f42bea7e0 100644 --- a/src/osgAnimation/BasicAnimationManager.cpp +++ b/src/osgAnimation/BasicAnimationManager.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -18,24 +18,24 @@ using namespace osgAnimation; BasicAnimationManager::BasicAnimationManager() -: _lastUpdate(0.0) +: _lastUpdate(0.0) { } -BasicAnimationManager::BasicAnimationManager(const AnimationManagerBase& b, const osg::CopyOp& copyop) +BasicAnimationManager::BasicAnimationManager(const AnimationManagerBase& b, const osg::CopyOp& copyop) : AnimationManagerBase(b,copyop) -, _lastUpdate(0.0) +, _lastUpdate(0.0) { } -BasicAnimationManager::~BasicAnimationManager() +BasicAnimationManager::~BasicAnimationManager() { } void BasicAnimationManager::stopAll() { // loop over all playing animation - for( AnimationLayers::iterator iterAnim = _animationsPlaying.begin(); iterAnim != _animationsPlaying.end(); ++iterAnim ) + for( AnimationLayers::iterator iterAnim = _animationsPlaying.begin(); iterAnim != _animationsPlaying.end(); ++iterAnim ) { AnimationList& list = iterAnim->second; for (AnimationList::iterator it = list.begin(); it != list.end(); ++it) @@ -51,7 +51,7 @@ void BasicAnimationManager::playAnimation(Animation* pAnimation, int priority, f if ( isPlaying(pAnimation) ) stopAnimation(pAnimation); - + _animationsPlaying[priority].push_back(pAnimation); // for debug //std::cout << "player Animation " << pAnimation->getName() << " at " << _lastUpdate << std::endl; @@ -94,12 +94,12 @@ void BasicAnimationManager::update (double time) AnimationList& list = iterAnim->second; for (unsigned int i = 0; i < list.size(); i++) { - if (! list[i]->update(time, priority)) + if (! list[i]->update(time, priority)) { // debug // std::cout << list[i]->getName() << " finished at " << time << std::endl; toremove.push_back(i); - } else + } else { // debug //std::cout << list[i]->getName() << " updated" << std::endl; @@ -118,7 +118,7 @@ void BasicAnimationManager::update (double time) bool BasicAnimationManager::findAnimation(Animation* pAnimation) { - for( AnimationList::const_iterator iterAnim = _animations.begin(); iterAnim != _animations.end(); ++iterAnim ) + for( AnimationList::const_iterator iterAnim = _animations.begin(); iterAnim != _animations.end(); ++iterAnim ) { if ( (*iterAnim) == pAnimation ) return true; diff --git a/src/osgAnimation/Bone.cpp b/src/osgAnimation/Bone.cpp index ec50b2fa7..80ee648e5 100644 --- a/src/osgAnimation/Bone.cpp +++ b/src/osgAnimation/Bone.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -56,7 +56,7 @@ const Bone* Bone::getBoneParent() const if (getParents().empty()) return 0; const osg::Node::ParentList& parents = getParents(); - for (osg::Node::ParentList::const_iterator it = parents.begin(); it != parents.end(); ++it) + for (osg::Node::ParentList::const_iterator it = parents.begin(); it != parents.end(); ++it) { const Bone* pb = dynamic_cast(*it); if (pb) diff --git a/src/osgAnimation/BoneMapVisitor.cpp b/src/osgAnimation/BoneMapVisitor.cpp index befa9297f..0f205f59e 100644 --- a/src/osgAnimation/BoneMapVisitor.cpp +++ b/src/osgAnimation/BoneMapVisitor.cpp @@ -1,16 +1,16 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. - * + * * Authors: * Cedric Pinson */ diff --git a/src/osgAnimation/Channel.cpp b/src/osgAnimation/Channel.cpp index ad2de93f4..3b1c3c5e7 100644 --- a/src/osgAnimation/Channel.cpp +++ b/src/osgAnimation/Channel.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgAnimation/LinkVisitor.cpp b/src/osgAnimation/LinkVisitor.cpp index 99579fc17..e9f0bcd03 100644 --- a/src/osgAnimation/LinkVisitor.cpp +++ b/src/osgAnimation/LinkVisitor.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,7 +19,7 @@ using namespace osgAnimation; -LinkVisitor::LinkVisitor() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) +LinkVisitor::LinkVisitor() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { _nbLinkedTarget = 0; } diff --git a/src/osgAnimation/MorphGeometry.cpp b/src/osgAnimation/MorphGeometry.cpp index 8cabc9ffa..daa82a222 100644 --- a/src/osgAnimation/MorphGeometry.cpp +++ b/src/osgAnimation/MorphGeometry.cpp @@ -1,4 +1,4 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * * This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ MorphGeometry::MorphGeometry() : setUseVertexBufferObjects(true); } -MorphGeometry::MorphGeometry(const osg::Geometry& b) : +MorphGeometry::MorphGeometry(const osg::Geometry& b) : osg::Geometry(b, osg::CopyOp::DEEP_COPY_ARRAYS), _dirty(false), _method(NORMALIZED), @@ -53,7 +53,7 @@ MorphGeometry::MorphGeometry(const osg::Geometry& b) : computeInternalOptimizedGeometry(); } -MorphGeometry::MorphGeometry(const MorphGeometry& b, const osg::CopyOp& copyop) : +MorphGeometry::MorphGeometry(const MorphGeometry& b, const osg::CopyOp& copyop) : osg::Geometry(b,copyop), _dirty(b._dirty), _method(b._method), @@ -90,12 +90,12 @@ void MorphGeometry::transformSoftwareMethod() _normalSource = std::vector(normal->begin(),normal->end()); normal->setDataVariance(osg::Object::DYNAMIC); } - - if (!_positionSource.empty()) + + if (!_positionSource.empty()) { bool initialized = false; - if (_method == NORMALIZED) + if (_method == NORMALIZED) { // base * 1 - (sum of weights) + sum of (weight * target) float baseWeight = 0; @@ -202,20 +202,20 @@ void MorphGeometry::transformSoftwareMethod() } } -UpdateMorph::UpdateMorph(const UpdateMorph& apc,const osg::CopyOp& copyop) : +UpdateMorph::UpdateMorph(const UpdateMorph& apc,const osg::CopyOp& copyop) : osg::Object(apc, copyop), AnimationUpdateCallback(apc, copyop) { } -UpdateMorph::UpdateMorph(const std::string& name) : AnimationUpdateCallback(name) +UpdateMorph::UpdateMorph(const std::string& name) : AnimationUpdateCallback(name) { } /** Callback method called by the NodeVisitor when visiting a node.*/ void UpdateMorph::operator()(osg::Node* node, osg::NodeVisitor* nv) { - if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) + if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) { osg::Geode* geode = dynamic_cast(node); if (geode) @@ -224,7 +224,7 @@ void UpdateMorph::operator()(osg::Node* node, osg::NodeVisitor* nv) for (unsigned int i = 0; i != numDrawables; ++i) { osgAnimation::MorphGeometry* morph = dynamic_cast(geode->getDrawable(i)); - if (morph) + if (morph) { // Update morph weights std::map >::iterator iter = _weightTargets.begin(); diff --git a/src/osgAnimation/RigGeometry.cpp b/src/osgAnimation/RigGeometry.cpp index 4d5319713..cb683dcd2 100644 --- a/src/osgAnimation/RigGeometry.cpp +++ b/src/osgAnimation/RigGeometry.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -102,8 +102,8 @@ void RigGeometry::buildVertexInfluenceSet() return; } _vertexInfluenceSet.clear(); - for (osgAnimation::VertexInfluenceMap::iterator it = _vertexInfluenceMap->begin(); - it != _vertexInfluenceMap->end(); + for (osgAnimation::VertexInfluenceMap::iterator it = _vertexInfluenceMap->begin(); + it != _vertexInfluenceMap->end(); ++it) _vertexInfluenceSet.addVertexInfluence(it->second); @@ -179,12 +179,12 @@ void RigGeometry::copyFrom(osg::Geometry& from) for(unsigned int ti=0;ti * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -58,7 +58,7 @@ void RigTransformHardware::computeMatrixPaletteUniform(const osg::Matrix& transf OSG_WARN << "RigTransformHardware::computeUniformMatrixPalette can't set uniform at " << i << " elements" << std::endl; } } - + int RigTransformHardware::getNumBonesPerVertex() const { return _bonesPerVertex;} int RigTransformHardware::getNumVertexes() const { return _nbVertexes;} @@ -123,7 +123,7 @@ bool RigTransformHardware::createPalette(int nbVertexes, BoneMap boneMap, const for (int i = 0 ; i < (int)vertexIndexWeight.size(); i++) vertexIndexWeight[i].resize(maxBonePerVertex); - + _nbVertexes = nbVertexes; _bonesPerVertex = maxBonePerVertex; _bonePalette = palette; @@ -197,13 +197,13 @@ bool RigTransformHardware::init(RigGeometry& geom) { osg::Geometry& source = *geom.getSourceGeometry(); osg::Vec3Array* positionSrc = dynamic_cast(source.getVertexArray()); - if (!positionSrc) + if (!positionSrc) { OSG_WARN << "RigTransformHardware no vertex array in the geometry " << geom.getName() << std::endl; return false; } - if (!geom.getSkeleton()) + if (!geom.getSkeleton()) { OSG_WARN << "RigTransformHardware no skeleton set in geometry " << geom.getName() << std::endl; return false; diff --git a/src/osgAnimation/RigTransformSoftware.cpp b/src/osgAnimation/RigTransformSoftware.cpp index 239f02452..0889a6d52 100644 --- a/src/osgAnimation/RigTransformSoftware.cpp +++ b/src/osgAnimation/RigTransformSoftware.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -69,7 +69,7 @@ void RigTransformSoftware::operator()(RigGeometry& geom) } *positionDst = *positionSrc; } - + osg::Vec3Array* normalSrc = dynamic_cast(source.getNormalArray()); osg::Vec3Array* normalDst = dynamic_cast(destination.getNormalArray()); if (normalSrc && (!normalDst || (normalDst->size() != normalSrc->size()) ) ) @@ -86,8 +86,8 @@ void RigTransformSoftware::operator()(RigGeometry& geom) if (positionDst && !positionDst->empty()) { - compute(geom.getMatrixFromSkeletonToGeometry(), - geom.getInvMatrixFromSkeletonToGeometry(), + compute(geom.getMatrixFromSkeletonToGeometry(), + geom.getInvMatrixFromSkeletonToGeometry(), &positionSrc->front(), &positionDst->front()); positionDst->dirty(); @@ -95,8 +95,8 @@ void RigTransformSoftware::operator()(RigGeometry& geom) if (normalDst && !normalDst->empty()) { - computeNormal(geom.getMatrixFromSkeletonToGeometry(), - geom.getInvMatrixFromSkeletonToGeometry(), + computeNormal(geom.getMatrixFromSkeletonToGeometry(), + geom.getInvMatrixFromSkeletonToGeometry(), &normalSrc->front(), &normalDst->front()); normalDst->dirty(); @@ -109,19 +109,19 @@ void RigTransformSoftware::initVertexSetFromBones(const BoneMap& map, const Vert int size = influence.size(); _boneSetVertexSet.resize(size); - for (int i = 0; i < size; i++) + for (int i = 0; i < size; i++) { const VertexInfluenceSet::UniqVertexSetToBoneSet& inf = influence[i]; int nbBones = inf.getBones().size(); BoneWeightList& boneList = _boneSetVertexSet[i].getBones(); double sumOfWeight = 0; - for (int b = 0; b < nbBones; b++) + for (int b = 0; b < nbBones; b++) { const std::string& bname = inf.getBones()[b].getBoneName(); float weight = inf.getBones()[b].getWeight(); BoneMap::const_iterator it = map.find(bname); - if (it == map.end()) + if (it == map.end()) { OSG_WARN << "RigTransformSoftware Bone " << bname << " not found, skip the influence group " < 1.0 + threshold)) { for (int b = 0; b < (int)boneList.size(); b++) diff --git a/src/osgAnimation/Skeleton.cpp b/src/osgAnimation/Skeleton.cpp index e61fcf3c5..e83162c1b 100644 --- a/src/osgAnimation/Skeleton.cpp +++ b/src/osgAnimation/Skeleton.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ class ValidateSkeletonVisitor : public osg::NodeVisitor public: ValidateSkeletonVisitor(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} void apply(osg::Node& node) { return; } - void apply(osg::Transform& node) + void apply(osg::Transform& node) { // the idea is to traverse the skeleton or bone but to stop if other node is found Bone* bone = dynamic_cast(&node); @@ -75,7 +75,7 @@ public: }; void Skeleton::UpdateSkeleton::operator()(osg::Node* node, osg::NodeVisitor* nv) -{ +{ if (nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) { Skeleton* skeleton = dynamic_cast(node); diff --git a/src/osgAnimation/StackedMatrixElement.cpp b/src/osgAnimation/StackedMatrixElement.cpp index 4fd0dcac0..a26990169 100644 --- a/src/osgAnimation/StackedMatrixElement.cpp +++ b/src/osgAnimation/StackedMatrixElement.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,7 +30,7 @@ Target* StackedMatrixElement::getOrCreateTarget() { if (!_target.valid()) _target = new MatrixTarget(_matrix); - return _target.get(); + return _target.get(); } void StackedMatrixElement::update(float t) diff --git a/src/osgAnimation/StackedQuaternionElement.cpp b/src/osgAnimation/StackedQuaternionElement.cpp index a969ac51d..ca12c2265 100644 --- a/src/osgAnimation/StackedQuaternionElement.cpp +++ b/src/osgAnimation/StackedQuaternionElement.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,14 +37,14 @@ void StackedQuaternionElement::applyToMatrix(osg::Matrix& matrix) const {matrix. osg::Matrix StackedQuaternionElement::getAsMatrix() const { return osg::Matrix(_quaternion); } bool StackedQuaternionElement::isIdentity() const { return (_quaternion[0] == 0 && _quaternion[1] == 0 && _quaternion[2] == 0 && _quaternion[3] == 1.0); } -void StackedQuaternionElement::update(float t) -{ +void StackedQuaternionElement::update(float t) +{ if (_target.valid()) _quaternion = _target->getValue(); } Target* StackedQuaternionElement::getOrCreateTarget() -{ +{ if (!_target.valid()) _target = new QuatTarget(_quaternion); return _target.get(); diff --git a/src/osgAnimation/StackedRotateAxisElement.cpp b/src/osgAnimation/StackedRotateAxisElement.cpp index 13e91267e..c1bb5ffd3 100644 --- a/src/osgAnimation/StackedRotateAxisElement.cpp +++ b/src/osgAnimation/StackedRotateAxisElement.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,7 +19,7 @@ using namespace osgAnimation; StackedRotateAxisElement::StackedRotateAxisElement(const std::string& name, const osg::Vec3& axis, double angle) : StackedTransformElement(), _axis(axis), _angle(angle) { setName(name); } StackedRotateAxisElement::StackedRotateAxisElement(const osg::Vec3& axis, double angle) : _axis(axis), _angle(angle) { setName("rotateaxis"); } StackedRotateAxisElement::StackedRotateAxisElement() {} -StackedRotateAxisElement::StackedRotateAxisElement(const StackedRotateAxisElement& rhs, const osg::CopyOp&) : StackedTransformElement(rhs), _axis(rhs._axis), _angle(rhs._angle) +StackedRotateAxisElement::StackedRotateAxisElement(const StackedRotateAxisElement& rhs, const osg::CopyOp&) : StackedTransformElement(rhs), _axis(rhs._axis), _angle(rhs._angle) { if (rhs._target.valid()) _target = new FloatTarget(*rhs._target); @@ -28,7 +28,7 @@ StackedRotateAxisElement::StackedRotateAxisElement(const StackedRotateAxisElemen osg::Matrix StackedRotateAxisElement::getAsMatrix() const { return osg::Matrix::rotate(osg::Quat(_angle, _axis)); } void StackedRotateAxisElement::update(float t) -{ +{ if (_target.valid()) _angle = _target->getValue(); } @@ -45,8 +45,8 @@ void StackedRotateAxisElement::setAngle(double angle) _angle = angle; } -Target* StackedRotateAxisElement::getOrCreateTarget() -{ +Target* StackedRotateAxisElement::getOrCreateTarget() +{ if (!_target.valid()) _target = new FloatTarget(_angle); return _target.get(); diff --git a/src/osgAnimation/StackedScaleElement.cpp b/src/osgAnimation/StackedScaleElement.cpp index 3a7fe26ef..71f7ceb90 100644 --- a/src/osgAnimation/StackedScaleElement.cpp +++ b/src/osgAnimation/StackedScaleElement.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,14 +42,14 @@ StackedScaleElement::StackedScaleElement() _scale = osg::Vec3(1,1,1); } -void StackedScaleElement::update(float t) -{ +void StackedScaleElement::update(float t) +{ if (_target.valid()) _scale = _target->getValue(); } Target* StackedScaleElement::getOrCreateTarget() -{ +{ if (!_target.valid()) _target = new Vec3Target(_scale); return _target.get(); diff --git a/src/osgAnimation/StackedTransform.cpp b/src/osgAnimation/StackedTransform.cpp index de199b505..91ac2d842 100644 --- a/src/osgAnimation/StackedTransform.cpp +++ b/src/osgAnimation/StackedTransform.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgAnimation/StackedTranslateElement.cpp b/src/osgAnimation/StackedTranslateElement.cpp index 7ac2d0415..bbd54c11d 100644 --- a/src/osgAnimation/StackedTranslateElement.cpp +++ b/src/osgAnimation/StackedTranslateElement.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,10 +35,10 @@ const osg::Vec3& StackedTranslateElement::getTranslate() const { return _tran void StackedTranslateElement::setTranslate(const osg::Vec3& value) { _translate = value; } Target* StackedTranslateElement::getOrCreateTarget() -{ +{ if (!_target.valid()) _target = new Vec3Target(_translate); - return _target.get(); + return _target.get(); } Target* StackedTranslateElement::getTarget() {return _target.get();} const Target* StackedTranslateElement::getTarget() const {return _target.get();} diff --git a/src/osgAnimation/StatsHandler.cpp b/src/osgAnimation/StatsHandler.cpp index c36a5c016..288151816 100644 --- a/src/osgAnimation/StatsHandler.cpp +++ b/src/osgAnimation/StatsHandler.cpp @@ -88,7 +88,7 @@ struct StatsGraph : public osg::MatrixTransform addChild(_statsGraphGeode.get()); _statsGraphGeode->setCullingActive(false); } - + void changeYposition(float y) { osg::Vec3 _pos = getMatrix().getTrans(); @@ -326,7 +326,7 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback osg::ref_ptr _group; std::map _actions; - StatsTimeline() + StatsTimeline() { _statsHeight = 1024; _statsWidth = 1280; @@ -362,7 +362,7 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback _group->addChild(geode); osg::ref_ptr timeLabel = new osgText::Text; geode->addDrawable( timeLabel.get() ); - + timeLabel->setColor(color); timeLabel->setFont(font); timeLabel->setCharacterSize(characterSize); @@ -612,7 +612,7 @@ void StatsHandler::setUpHUDCamera(osgViewer::ViewerBase* viewer) _camera->setGraphicsContext(window); _camera->setViewport(0, 0, window->getTraits()->width, window->getTraits()->height); - + _camera->setRenderOrder(osg::Camera::POST_RENDER, 10); _camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0,_statsWidth,0.0,_statsHeight)); @@ -648,7 +648,7 @@ void StatsHandler::setUpScene(osgViewer::Viewer* viewer) _group = new osg::Group; _camera->addChild(_switch.get()); _switch->addChild(_group.get()); - + for (int i = 0; i < (int)finder._timelines.size(); i++) { StatsTimeline* s = new StatsTimeline; osg::MatrixTransform* m = s->createStatsForTimeline(finder._timelines[i].get()); @@ -684,7 +684,7 @@ void StatAction::init(osg::Stats* stats, const std::string& name, const osg::Vec graph->setCullingActive(false); graph->addStatGraph(stats, stats, color, 1.0, name); _graph = graph; - + _group->addChild(_label.get()); _group->addChild(_graph.get()); } @@ -708,7 +708,7 @@ void StatAction::setPosition(const osg::Vec3& pos) gfx->changeYposition(pos[1]); _textLabel->setPosition(pos - osg::Vec3(0, characterSize,0)); - + } diff --git a/src/osgAnimation/StatsVisitor.cpp b/src/osgAnimation/StatsVisitor.cpp index 8106ca708..48ee26797 100644 --- a/src/osgAnimation/StatsVisitor.cpp +++ b/src/osgAnimation/StatsVisitor.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -47,7 +47,7 @@ void StatsActionVisitor::apply(Action& action) void StatsActionVisitor::apply(ActionBlendIn& action) { - if (isActive(action)) + if (isActive(action)) { _channels.push_back(action.getName()); _stats->setAttribute(_frame,action.getName(), action.getWeight()); @@ -56,7 +56,7 @@ void StatsActionVisitor::apply(ActionBlendIn& action) void StatsActionVisitor::apply(ActionBlendOut& action) { - if (isActive(action)) + if (isActive(action)) { _channels.push_back(action.getName()); _stats->setAttribute(_frame,action.getName(), action.getWeight()); @@ -65,7 +65,7 @@ void StatsActionVisitor::apply(ActionBlendOut& action) void StatsActionVisitor::apply(ActionAnimation& action) { - if (isActive(action)) + if (isActive(action)) { _channels.push_back(action.getName()); _stats->setAttribute(_frame,action.getName(), action.getAnimation()->getWeight()); diff --git a/src/osgAnimation/Target.cpp b/src/osgAnimation/Target.cpp index b05775611..fa2150eea 100644 --- a/src/osgAnimation/Target.cpp +++ b/src/osgAnimation/Target.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgAnimation/Timeline.cpp b/src/osgAnimation/Timeline.cpp index e081fff96..318fa4c06 100644 --- a/src/osgAnimation/Timeline.cpp +++ b/src/osgAnimation/Timeline.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -131,7 +131,7 @@ void Timeline::update(double simulationTime) _animationManager->clearTargets(); updateTimeline.setFrame(_currentFrame); accept(updateTimeline); - if (_collectStats) + if (_collectStats) { if (!_statsVisitor) _statsVisitor = new StatsActionVisitor; @@ -237,11 +237,11 @@ bool Timeline::isActive(Action* activeAction) for (unsigned int i = 0; i < list.size(); i++) { Action* action = list[i].second.get(); - if (action == activeAction) + if (action == activeAction) { unsigned int firstFrame = list[i].first; // check if current frame of timeline hit an action interval - if (_currentFrame >= firstFrame && + if (_currentFrame >= firstFrame && _currentFrame < (firstFrame + action->getNumFrames()) ) return true; } diff --git a/src/osgAnimation/TimelineAnimationManager.cpp b/src/osgAnimation/TimelineAnimationManager.cpp index 97a7cd8f6..521d87854 100644 --- a/src/osgAnimation/TimelineAnimationManager.cpp +++ b/src/osgAnimation/TimelineAnimationManager.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgAnimation/UpdateBone.cpp b/src/osgAnimation/UpdateBone.cpp index 26fb9d142..cbc50ba3a 100644 --- a/src/osgAnimation/UpdateBone.cpp +++ b/src/osgAnimation/UpdateBone.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgAnimation/UpdateMaterial.cpp b/src/osgAnimation/UpdateMaterial.cpp index 30bd9b1c4..0e7abdb62 100644 --- a/src/osgAnimation/UpdateMaterial.cpp +++ b/src/osgAnimation/UpdateMaterial.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -17,7 +17,7 @@ using namespace osgAnimation; -UpdateMaterial::UpdateMaterial(const UpdateMaterial& apc,const osg::CopyOp& copyop) +UpdateMaterial::UpdateMaterial(const UpdateMaterial& apc,const osg::CopyOp& copyop) : osg::Object(apc, copyop), AnimationUpdateCallback(apc, copyop) { @@ -43,7 +43,7 @@ void UpdateMaterial::operator()(osg::StateAttribute* sa, osg::NodeVisitor* nv) osgAnimation::Vec4Target* UpdateMaterial::getDiffuse() { return _diffuse.get(); } -void UpdateMaterial::update(osg::Material& material) +void UpdateMaterial::update(osg::Material& material) { osg::Vec4 diffuse = _diffuse->getValue(); material.setDiffuse(osg::Material::FRONT_AND_BACK, diffuse); @@ -55,7 +55,7 @@ bool UpdateMaterial::link(osgAnimation::Channel* channel) { return channel->setTarget(_diffuse.get()); } - else + else { OSG_WARN << "Channel " << channel->getName() << " does not contain a valid symbolic name for this class " << className() << std::endl; } diff --git a/src/osgAnimation/UpdateMatrixTransform.cpp b/src/osgAnimation/UpdateMatrixTransform.cpp index a462c2e61..e3c0147ef 100644 --- a/src/osgAnimation/UpdateMatrixTransform.cpp +++ b/src/osgAnimation/UpdateMatrixTransform.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,7 +30,7 @@ UpdateMatrixTransform::UpdateMatrixTransform(const std::string& name) : Animatio /** Callback method called by the NodeVisitor when visiting a node.*/ void UpdateMatrixTransform::operator()(osg::Node* node, osg::NodeVisitor* nv) { - if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) + if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) { osg::MatrixTransform* matrixTransform = dynamic_cast(node); if (matrixTransform) @@ -48,7 +48,7 @@ void UpdateMatrixTransform::operator()(osg::Node* node, osg::NodeVisitor* nv) bool UpdateMatrixTransform::link(osgAnimation::Channel* channel) { const std::string& channelName = channel->getName(); - + // check if we can link a StackedTransformElement to the current Channel for (StackedTransform::iterator it = _transforms.begin(); it != _transforms.end(); ++it) { diff --git a/src/osgAnimation/VertexInfluence.cpp b/src/osgAnimation/VertexInfluence.cpp index 8778b747a..ad1686277 100644 --- a/src/osgAnimation/VertexInfluence.cpp +++ b/src/osgAnimation/VertexInfluence.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -26,11 +26,11 @@ const VertexInfluenceSet::VertexIndexToBoneWeightMap& VertexInfluenceSet::getVer void VertexInfluenceSet::buildVertex2BoneList() { _vertex2Bones.clear(); - for (BoneToVertexList::const_iterator it = _bone2Vertexes.begin(); it != _bone2Vertexes.end(); ++it) + for (BoneToVertexList::const_iterator it = _bone2Vertexes.begin(); it != _bone2Vertexes.end(); ++it) { const VertexInfluence& vi = (*it); int size = vi.size(); - for (int i = 0; i < size; i++) + for (int i = 0; i < size; i++) { VertexIndexWeight viw = vi[i]; int index = viw.first; @@ -49,11 +49,11 @@ void VertexInfluenceSet::buildVertex2BoneList() float sum = 0; for (int i = 0; i < size; i++) sum += bones[i].getWeight(); - if (sum < 1e-4) + if (sum < 1e-4) { OSG_WARN << "VertexInfluenceSet::buildVertex2BoneList warning the vertex " << it->first << " seems to have 0 weight, skip normalize for this vertex" << std::endl; } - else + else { float mult = 1.0/sum; for (int i = 0; i < size; i++) @@ -67,8 +67,8 @@ void VertexInfluenceSet::buildVertex2BoneList() // sort by name and weight struct SortByNameAndWeight : public std::less { - bool operator()(const VertexInfluenceSet::BoneWeight& b0, - const VertexInfluenceSet::BoneWeight& b1) const + bool operator()(const VertexInfluenceSet::BoneWeight& b0, + const VertexInfluenceSet::BoneWeight& b1) const { if (b0.getBoneName() < b1.getBoneName()) return true; @@ -82,8 +82,8 @@ struct SortByNameAndWeight : public std::less struct SortByBoneWeightList : public std::less { - bool operator()(const VertexInfluenceSet::BoneWeightList& b0, - const VertexInfluenceSet::BoneWeightList& b1) const + bool operator()(const VertexInfluenceSet::BoneWeightList& b0, + const VertexInfluenceSet::BoneWeightList& b1) const { if (b0.size() < b1.size()) return true; @@ -91,7 +91,7 @@ struct SortByBoneWeightList : public std::less UnifyBoneGroup; UnifyBoneGroup unifyBuffer; - for (VertexIndexToBoneWeightMap::iterator it = _vertex2Bones.begin(); it != _vertex2Bones.end(); ++it) + for (VertexIndexToBoneWeightMap::iterator it = _vertex2Bones.begin(); it != _vertex2Bones.end(); ++it) { BoneWeightList bones = it->second; int vertexIndex = it->first; // sort the vector to have a consistent key std::sort(bones.begin(), bones.end(), SortByNameAndWeight()); - + // we use the vector as key to differentiate group UnifyBoneGroup::iterator result = unifyBuffer.find(bones); if (result == unifyBuffer.end()) @@ -132,7 +132,7 @@ void VertexInfluenceSet::buildUniqVertexSetToBoneSetList() } _uniqVertexSetToBoneSet.reserve(unifyBuffer.size()); - for (UnifyBoneGroup::iterator it = unifyBuffer.begin(); it != unifyBuffer.end(); ++it) + for (UnifyBoneGroup::iterator it = unifyBuffer.begin(); it != unifyBuffer.end(); ++it) { _uniqVertexSetToBoneSet.push_back(it->second); } diff --git a/src/osgDB/Archive.cpp b/src/osgDB/Archive.cpp index 9384c25a1..28b33da3c 100644 --- a/src/osgDB/Archive.cpp +++ b/src/osgDB/Archive.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -73,7 +73,7 @@ void cleanupFileString(std::string& strFileOrDir) } //add a beginning separator - if(strFileOrDir[0] != '/') + if(strFileOrDir[0] != '/') { strFileOrDir.insert(0, "/"); } diff --git a/src/osgDB/AuthenticationMap.cpp b/src/osgDB/AuthenticationMap.cpp index 5f3d46d52..487c3e534 100644 --- a/src/osgDB/AuthenticationMap.cpp +++ b/src/osgDB/AuthenticationMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,7 +33,7 @@ const AuthenticationDetails* AuthenticationMap::getAuthenticationDetails(const s { itr = _authenticationMap.find(basePath); if (itr != _authenticationMap.end()) return itr->second.get(); - + basePath = osgDB::getFilePath(basePath); } return 0; diff --git a/src/osgDB/Callbacks.cpp b/src/osgDB/Callbacks.cpp index 42afe1f18..3e2d89b45 100644 --- a/src/osgDB/Callbacks.cpp +++ b/src/osgDB/Callbacks.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgDB/Compressors.cpp b/src/osgDB/Compressors.cpp index 8462c090c..2cd921636 100644 --- a/src/osgDB/Compressors.cpp +++ b/src/osgDB/Compressors.cpp @@ -25,7 +25,7 @@ class NullCompressor : public BaseCompressor { public: NullCompressor() {} - + virtual bool compress( std::ostream& fout, const std::string& src ) { int size = src.size(); @@ -33,7 +33,7 @@ public: fout.write( src.c_str(), src.size() ); return true; } - + virtual bool decompress( std::istream& fin, std::string& target ) { int size = 0; fin.read( (char*)&size, INT_SIZE ); @@ -59,17 +59,17 @@ class ZLibCompressor : public BaseCompressor { public: ZLibCompressor() {} - + virtual bool compress( std::ostream& fout, const std::string& src ) { int ret, flush = Z_FINISH; unsigned have; z_stream strm; unsigned char out[CHUNK]; - + int level = 6; int stategy = Z_DEFAULT_STRATEGY; - + /* allocate deflate state */ strm.zalloc = Z_NULL; strm.zfree = Z_NULL; @@ -79,10 +79,10 @@ public: 8, // default stategy ); if ( ret != Z_OK ) return false; - + strm.avail_in = src.size(); strm.next_in = (Bytef*)( &(*src.begin()) ); - + /* run deflate() on input until output buffer not full, finish compression if all of source has been read in */ do @@ -90,28 +90,28 @@ public: strm.avail_out = CHUNK; strm.next_out = out; ret = deflate(&strm, flush); /* no bad return value */ - + if ( ret == Z_STREAM_ERROR ) { OSG_NOTICE << "Z_STREAM_ERROR" << std::endl; return false; } - + have = CHUNK - strm.avail_out; if ( have>0 ) fout.write( (const char*)out, have ); - + if ( fout.fail() ) { (void)deflateEnd( &strm ); return false; } } while ( strm.avail_out==0 ); - + /* clean up and return */ (void)deflateEnd( &strm ); return true; } - + virtual bool decompress( std::istream& fin, std::string& target ) { int ret; @@ -119,7 +119,7 @@ public: z_stream strm; unsigned char in[CHUNK]; unsigned char out[CHUNK]; - + /* allocate inflate state */ strm.zalloc = Z_NULL; strm.zfree = Z_NULL; @@ -128,20 +128,20 @@ public: strm.next_in = Z_NULL; ret = inflateInit2( &strm, 15 + 32 ); // autodected zlib or gzip header - + if ( ret!=Z_OK ) { OSG_INFO << "failed to init" << std::endl; return ret!=0; } - + /* decompress until deflate stream ends or end of file */ do { fin.read( (char *)in, CHUNK ); strm.avail_in = fin.gcount(); if (strm.avail_in==0 ) break; - + /* run inflate() on input until output buffer not full */ strm.next_in = in; do @@ -149,7 +149,7 @@ public: strm.avail_out = CHUNK; strm.next_out = out; ret = inflate( &strm, Z_NO_FLUSH ); - + switch (ret) { case Z_NEED_DICT: @@ -161,10 +161,10 @@ public: have = CHUNK - strm.avail_out; target.append( (char*)out, have ); } while ( strm.avail_out==0 ); - + /* done when inflate() says it's done */ } while ( ret!=Z_STREAM_END ); - + /* clean up and return */ (void)inflateEnd( &strm ); return ret==Z_STREAM_END ? true : false; diff --git a/src/osgDB/ConvertUTF.cpp b/src/osgDB/ConvertUTF.cpp index cfa6be261..1b5013a89 100644 --- a/src/osgDB/ConvertUTF.cpp +++ b/src/osgDB/ConvertUTF.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index 4394b7bb6..1ae8ca720 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -233,7 +233,7 @@ public: } std::copy(expiredChildren.begin(), expiredChildren.end(), std::back_inserter(childrenRemoved)); } - + // advance the iterator to the next element ++itr; } @@ -371,7 +371,7 @@ public: bool _changeAnisotropy; float _valueAnisotropy; osg::ref_ptr _kdTreeBuilder; - + protected: FindCompileableGLObjectsVisitor& operator = (const FindCompileableGLObjectsVisitor&) { return *this; } @@ -555,7 +555,7 @@ void DatabasePager::RequestQueue::takeFirst(osg::ref_ptr& datab RequestQueue::RequestList::iterator selected_itr = _requestList.end(); int frameNumber = _pager->_frameNumber; - + for(RequestQueue::RequestList::iterator citr = _requestList.begin(); citr != _requestList.end(); ) @@ -648,7 +648,7 @@ int DatabasePager::DatabaseThread::cancel() if( isRunning() ) { setDone(true); - + switch(_mode) { case(HANDLE_ALL_REQUESTS): @@ -685,10 +685,10 @@ void DatabasePager::DatabaseThread::run() bool firstTime = true; - + osg::ref_ptr read_queue; osg::ref_ptr out_queue; - + switch(_mode) { case(HANDLE_ALL_REQUESTS): @@ -720,7 +720,7 @@ void DatabasePager::DatabaseThread::run() OSG_INFO<<_name<<": _pager->size()= "<size()<<" to delete = "<_childrenToDeleteList.size()<_fileName<<")"<tick(); @@ -924,7 +924,7 @@ void DatabasePager::DatabaseThread::run() _pager->_dataToMergeList->addNoLock(databaseRequest.get()); databaseRequest = 0; } - + } // _pager->_dataToCompileList->pruneOldRequestsAndCheckIfEmpty(); @@ -933,13 +933,13 @@ void DatabasePager::DatabaseThread::run() { OpenThreads::Thread::YieldCurrentThread(); } - - + + // go to sleep till our the next time our thread gets scheduled. if (firstTime) { - // do a yield to get round a peculiar thread hang when testCancel() is called + // do a yield to get round a peculiar thread hang when testCancel() is called // in certain circumstances - of which there is no particular pattern. YieldCurrentThread(); firstTime = false; @@ -952,16 +952,16 @@ void DatabasePager::DatabaseThread::run() DatabasePager::DatabasePager() { //OSG_INFO<<"Constructing DatabasePager()"<getNumOfDatabaseThreadsHint(), osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint()); @@ -1080,13 +1080,13 @@ DatabasePager::DatabasePager() DatabasePager::DatabasePager(const DatabasePager& rhs) { //OSG_INFO<<"Constructing DatabasePager(const DatabasePager& )"<& DatabasePager::prototype() DatabasePager* DatabasePager::create() { - return DatabasePager::prototype().valid() ? + return DatabasePager::prototype().valid() ? DatabasePager::prototype()->clone() : - new DatabasePager; + new DatabasePager; } void DatabasePager::setUpThreads(unsigned int totalNumThreads, unsigned int numHttpThreads) { _databaseThreads.clear(); - + unsigned int numGeneralThreads = numHttpThreads < totalNumThreads ? totalNumThreads - numHttpThreads : 1; - + if (numHttpThreads==0) { for(unsigned int i=0; istartThread(); } - + return pos; } @@ -1239,7 +1239,7 @@ bool DatabasePager::isRunning() const { if ((*dt_itr)->isRunning()) return true; } - + return false; } @@ -1299,7 +1299,7 @@ bool DatabasePager::getRequestsInProgress() const { if (getFileRequestListSize()>0) return true; - if (getDataToCompileListSize()>0) + if (getDataToCompileListSize()>0) { return true; } @@ -1366,7 +1366,7 @@ void DatabasePager::requestNodeFile(const std::string& fileName, osg::NodePath& osg::Timer_t start_tick = osg::Timer::instance()->tick(); static int previousFrame = -1; static double totalTime = 0.0; - + if (previousFrame!=frameNumber) { OSG_NOTICE<<"requestNodeFiles for "< lock(_fileRequestQueue->_requestMutex); - + if (!databaseRequestRef.valid() || databaseRequestRef->referenceCount()==1) { osg::ref_ptr databaseRequest = new DatabaseRequest; @@ -1450,18 +1450,18 @@ void DatabasePager::requestNodeFile(const std::string& fileName, osg::NodePath& _fileRequestQueue->addNoLock(databaseRequest.get()); } } - + if (!_startThreadCalled) { OpenThreads::ScopedLock lock(_run_mutex); - + if (!_startThreadCalled) { _startThreadCalled = true; _done = false; OSG_INFO<<"DatabasePager::startThread()"<getNumOfDatabaseThreadsHint(), @@ -1484,7 +1484,7 @@ void DatabasePager::requestNodeFile(const std::string& fileName, osg::NodePath& void DatabasePager::signalBeginFrame(const osg::FrameStamp* framestamp) { -#if 0 +#if 0 OSG_NOTICE<<"DatabasePager : _fileRequestQueue->size()="<<_fileRequestQueue->size() <<", _httpRequestQueue->size()= "<<_httpRequestQueue->size() <<", _dataToCompileList->size()= "<<_dataToCompileList->size() @@ -1508,7 +1508,7 @@ void DatabasePager::signalEndFrame() void DatabasePager::setDatabasePagerThreadPause(bool pause) { if (_databasePagerThreadPaused == pause) return; - + _databasePagerThreadPaused = pause; { OpenThreads::ScopedLock lock(_fileRequestQueue->_requestMutex); @@ -1576,7 +1576,7 @@ void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp) // get the data from the _dataToMergeList, leaving it empty via a std::vector<>.swap. _dataToMergeList->swap(localFileLoadedList); - + mid = osg::Timer::instance()->tick(); // add the loaded data into the scene graph. @@ -1608,18 +1608,18 @@ void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp) if (proxyNode) { proxyNode->getDatabaseRequest(proxyNode->getNumChildren()) = 0; - } + } } group->addChild(databaseRequest->_loadedModel.get()); // Check if parent plod was already registered if not start visitor from parent - if( plod && + if( plod && !_activePagedLODList->containsPagedLOD( plod ) ) { registerPagedLODs(plod, frameNumber); - } - else + } + else { registerPagedLODs(databaseRequest->_loadedModel.get(), frameNumber); } @@ -1665,7 +1665,7 @@ void DatabasePager::removeExpiredSubgraphs(const osg::FrameStamp& frameStamp) static double s_total_iter_stage_a = 0.0; static double s_total_time_stage_a = 0.0; static double s_total_max_stage_a = 0.0; - + static double s_total_iter_stage_b = 0.0; static double s_total_time_stage_b = 0.0; static double s_total_max_stage_b = 0.0; @@ -1686,25 +1686,25 @@ void DatabasePager::removeExpiredSubgraphs(const osg::FrameStamp& frameStamp) // numPagedLODs >= actual number of PagedLODs. There can be // invalid observer pointers in _activePagedLODList. unsigned int numPagedLODs = _activePagedLODList->size(); - + osg::Timer_t end_a_Tick = osg::Timer::instance()->tick(); double time_a = osg::Timer::instance()->delta_m(startTick,end_a_Tick); s_total_iter_stage_a += 1.0; s_total_time_stage_a += time_a; if (s_total_max_stage_a='0' && *ptr<='9') || - (*ptr>='a' && *ptr<='f') || + (*ptr>='a' && *ptr<='f') || (*ptr>='A' && *ptr<='F')) ) { ++ptr; } - + // got to end of string without failure, therefore must be a hex integer. if (*ptr==0) return INTEGER; } - + ptr = str; // check if a float or an int. while (*ptr!=0 && couldBeFloat) diff --git a/src/osgDB/FieldReader.cpp b/src/osgDB/FieldReader.cpp index 61e97c8de..a5fc8ae64 100644 --- a/src/osgDB/FieldReader.cpp +++ b/src/osgDB/FieldReader.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -195,7 +195,7 @@ bool FieldReader::_readField(Field* fieldPtr) if (fieldPtr) fieldPtr->addChar(c); } else - { + { escape = true; _fin->ignore(1); } @@ -255,7 +255,7 @@ bool FieldReader::_readField(Field* fieldPtr) if (fieldPtr) fieldPtr->addChar(c); } else - { + { escape = true; _fin->ignore(1); } diff --git a/src/osgDB/FieldReaderIterator.cpp b/src/osgDB/FieldReaderIterator.cpp index af52da973..bf3c8c211 100644 --- a/src/osgDB/FieldReaderIterator.cpp +++ b/src/osgDB/FieldReaderIterator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -319,7 +319,7 @@ bool FieldReaderIterator::matchSequence(const char* str) { if (str==NULL) return false; if (*str==0) return false; - + int fieldCount = 0; const char* end = str; while((*end)!=0 && (*end)==' ') ++end; diff --git a/src/osgDB/FileCache.cpp b/src/osgDB/FileCache.cpp index 175dabc85..e73a905d6 100644 --- a/src/osgDB/FileCache.cpp +++ b/src/osgDB/FileCache.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,8 +43,8 @@ bool FileCache::isFileAppropriateForFileCache(const std::string& originalFileNam std::string FileCache::createCacheFileName(const std::string& originalFileName) const { std::string serverAddress = osgDB::getServerAddress(originalFileName); - std::string cacheFileName = _fileCachePath + "/" + - serverAddress + (serverAddress.empty()?"":"/") + + std::string cacheFileName = _fileCachePath + "/" + + serverAddress + (serverAddress.empty()?"":"/") + osgDB::getServerFileName(originalFileName); OSG_INFO<<"FileCache::createCacheFileName("< @@ -71,7 +71,7 @@ std::string osgDB::getFileExtensionIncludingDot(const std::string& fileName) std::string osgDB::convertFileNameToWindowsStyle(const std::string& fileName) { std::string new_fileName(fileName); - + std::string::size_type slash = 0; while( (slash=new_fileName.find_first_of(UNIX_PATH_SEPARATOR,slash)) != std::string::npos) { @@ -83,7 +83,7 @@ std::string osgDB::convertFileNameToWindowsStyle(const std::string& fileName) std::string osgDB::convertFileNameToUnixStyle(const std::string& fileName) { std::string new_fileName(fileName); - + std::string::size_type slash = 0; while( (slash=new_fileName.find_first_of(WINDOWS_PATH_SEPARATOR,slash)) != std::string::npos) { @@ -201,10 +201,10 @@ bool osgDB::containsServerAddress(const std::string& filename) { // need to check for :// std::string::size_type pos(filename.find("://")); - if (pos == std::string::npos) + if (pos == std::string::npos) return false; std::string proto(filename.substr(0, pos)); - + return Registry::instance()->isProtocolRegistered(proto); } @@ -220,7 +220,7 @@ std::string osgDB::getServerProtocol(const std::string& filename) std::string osgDB::getServerAddress(const std::string& filename) { std::string::size_type pos(filename.find("://")); - + if (pos != std::string::npos) { std::string::size_type pos_slash = filename.find_first_of('/',pos+3); @@ -251,7 +251,7 @@ std::string osgDB::getServerFileName(const std::string& filename) { return ""; } - + } return filename; } @@ -359,10 +359,10 @@ std::string osgDB::getRealPath(const std::string& path) #else char resolved_path[PATH_MAX]; char* result = realpath(path.c_str(), resolved_path); - + if (result) return std::string(resolved_path); else return path; -#endif +#endif } namespace osgDB diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp index 3f119a3f5..b5950d794 100644 --- a/src/osgDB/FileUtils.cpp +++ b/src/osgDB/FileUtils.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,7 +32,7 @@ typedef char TCHAR; #include #include #include // for _mkdir - + #define mkdir(x,y) _mkdir((x)) #define stat64 _stati64 @@ -51,13 +51,13 @@ typedef char TCHAR; //>OSG_IOS //IOS includes #include "TargetConditionals.h" - - #if (TARGET_OS_IPHONE) + + #if (TARGET_OS_IPHONE) #include // workaround a bug which appears when compiling for SDK < 4.0 and for the simulator #ifdef __IPHONE_4_0 && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0) #define stat64 stat - #else + #else #if !TARGET_IPHONE_SIMULATOR #define stat64 stat #endif @@ -68,8 +68,8 @@ typedef char TCHAR; // 10.5 defines stat64 so we can't use this #define // By default, MAC_OS_X_VERSION_MAX_ALLOWED is set to the latest // system the headers know about. So I will use this as the control - // variable. (MIN_ALLOWED is set low by default so it is - // unhelpful in this case.) + // variable. (MIN_ALLOWED is set low by default so it is + // unhelpful in this case.) // Unfortunately, we can't use the label MAC_OS_X_VERSION_10_4 // for older OS's like Jaguar, Panther since they are not defined, // so I am going to hardcode the number. @@ -144,7 +144,7 @@ bool osgDB::makeDirectory( const std::string &path ) OSG_DEBUG << "osgDB::makeDirectory(): cannot create an empty directory" << std::endl; return false; } - + struct stat64 stbuf; #ifdef OSG_USE_UTF8_FILENAME if( _wstat64( OSGDB_STRING_TO_FILENAME(path).c_str(), &stbuf ) == 0 ) @@ -168,7 +168,7 @@ bool osgDB::makeDirectory( const std::string &path ) { if( dir.empty() ) break; - + #ifdef OSG_USE_UTF8_FILENAME if( _wstat64( OSGDB_STRING_TO_FILENAME(dir).c_str(), &stbuf ) < 0 ) #else @@ -181,7 +181,7 @@ bool osgDB::makeDirectory( const std::string &path ) case ENOTDIR: paths.push( dir ); break; - + default: OSG_DEBUG << "osgDB::makeDirectory(): " << strerror(errno) << std::endl; return false; @@ -193,7 +193,7 @@ bool osgDB::makeDirectory( const std::string &path ) while( !paths.empty() ) { std::string dir = paths.top(); - + #if defined(WIN32) //catch drive name if (dir.size() == 2 && dir.c_str()[1] == ':') { @@ -210,7 +210,7 @@ bool osgDB::makeDirectory( const std::string &path ) { OSG_DEBUG << "osgDB::makeDirectory(): " << strerror(errno) << std::endl; return false; - } + } paths.pop(); } return true; @@ -245,7 +245,7 @@ bool osgDB::setCurrentWorkingDirectory( const std::string &newCurrentWorkingDire OSG_DEBUG << "osgDB::setCurrentWorkingDirectory(): called with empty string." << std::endl; return false; } - + #ifdef OSG_USE_UTF8_FILENAME return _wchdir( OSGDB_STRING_TO_FILENAME(newCurrentWorkingDirectory).c_str()) == 0; #else @@ -279,7 +279,7 @@ void osgDB::convertStringPathIntoFilePathList(const std::string& paths,FilePathL if (!lastPath.empty()) filepath.push_back(lastPath); } - + } bool osgDB::fileExists(const std::string& filename) @@ -313,10 +313,10 @@ osgDB::FileType osgDB::fileType(const std::string& filename) std::string osgDB::findFileInPath(const std::string& filename, const FilePathList& filepath,CaseSensitivity caseSensitivity) { - if (filename.empty()) + if (filename.empty()) return filename; - if (!isFileNameNativeStyle(filename)) + if (!isFileNameNativeStyle(filename)) return findFileInPath(convertFileNameToNativeStyle(filename), filepath, caseSensitivity); @@ -326,24 +326,24 @@ std::string osgDB::findFileInPath(const std::string& filename, const FilePathLis { OSG_DEBUG << "itr='" <<*itr<< "'\n"; std::string path = itr->empty() ? filename : concatPaths(*itr, filename); - + path = getRealPath(path); OSG_DEBUG << "FindFileInPath() : trying " << path << " ...\n"; - if(fileExists(path)) + if(fileExists(path)) { OSG_DEBUG << "FindFileInPath() : USING " << path << "\n"; return path; } -#ifndef WIN32 +#ifndef WIN32 // windows already case insensitive so no need to retry.. - else if (caseSensitivity==CASE_INSENSITIVE) + else if (caseSensitivity==CASE_INSENSITIVE) { std::string foundfile = findFileInDirectory(filename,*itr,CASE_INSENSITIVE); if (!foundfile.empty()) return foundfile; } #endif - + } return std::string(); @@ -380,7 +380,7 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st #else bool win32 = false; #endif - + // If the fileName contains extra path information, make that part of the // directory name instead if (fileName != getSimpleFileName(fileName)) @@ -458,7 +458,7 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st // in the parent path realDirName = findFileInDirectory(lastElement, parentPath, CASE_INSENSITIVE); - + dc = osgDB::getDirectoryContents(realDirName); char lastChar = realDirName[realDirName.size()-1]; if (lastChar=='/') needFollowingBackslash = false; @@ -723,18 +723,18 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) convertStringPathIntoFilePathList("/usr/bin/:/usr/local/bin/",filepath); } - + #elif defined(WIN32) void osgDB::appendPlatformSpecificLibraryFilePaths(FilePathList& filepath) { // See http://msdn2.microsoft.com/en-us/library/ms682586.aspx - // Safe DLL search mode changes the DLL search order to search for + // Safe DLL search mode changes the DLL search order to search for // DLLs in the current directory after the system directories, instead - // of right after the application's directory. According to the article - // linked above, on Windows XP and Windows 2000, Safe DLL search mode - // is disabled by default. However, it is a good idea to enable it. We + // of right after the application's directory. According to the article + // linked above, on Windows XP and Windows 2000, Safe DLL search mode + // is disabled by default. However, it is a good idea to enable it. We // will search as if it was enabled. // So if SafeDllSearchMode is enabled, the search order is as follows: @@ -747,7 +747,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) if (retval != 0 && retval < size) { filenamestring pathstr(path); - filenamestring executableDir(pathstr, 0, + filenamestring executableDir(pathstr, 0, pathstr.find_last_of(OSGDB_FILENAME_TEXT("\\/"))); convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(executableDir), filepath); } @@ -796,35 +796,35 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) } #endif - // 3. The system directory. Use the GetSystemDirectory function to + // 3. The system directory. Use the GetSystemDirectory function to // get the path of this directory. filenamechar systemDir[(UINT)size]; retval = OSGDB_WINDOWS_FUNCT(GetSystemDirectory)(systemDir, (UINT)size); if (retval != 0 && retval < size) { - convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(systemDir), + convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(systemDir), filepath); } else { OSG_WARN << "Could not get system directory using " "Win32 API, using default directory." << std::endl; - convertStringPathIntoFilePathList("C:\\Windows\\System32", + convertStringPathIntoFilePathList("C:\\Windows\\System32", filepath); } - // 4. The 16-bit system directory. There is no function that obtains + // 4. The 16-bit system directory. There is no function that obtains // the path of this directory, but it is searched. - // 5. The Windows directory. Use the GetWindowsDirectory function to + // 5. The Windows directory. Use the GetWindowsDirectory function to // get the path of this directory. filenamechar windowsDir[(UINT)size]; retval = OSGDB_WINDOWS_FUNCT(GetWindowsDirectory)(windowsDir, (UINT)size); if (retval != 0 && retval < size) { - convertStringPathIntoFilePathList(std::string(OSGDB_FILENAME_TO_STRING(windowsDir)) + + convertStringPathIntoFilePathList(std::string(OSGDB_FILENAME_TO_STRING(windowsDir)) + "\\System", filepath); - convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(windowsDir), + convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(windowsDir), filepath); } else @@ -839,8 +839,8 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // 6. The current directory. convertStringPathIntoFilePathList(".", filepath); - // 7. The directories that are listed in the PATH environment - // variable. Note that this does not include the per-application + // 7. The directories that are listed in the PATH environment + // variable. Note that this does not include the per-application // path specified by the App Paths registry key. filenamechar* ptr; #ifdef OSG_USE_UTF8_FILENAME @@ -858,7 +858,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) appendInstallationLibraryFilePaths(filepath); } - + #elif defined(__APPLE__) #if (TARGET_OS_IPHONE) #define COMPILE_COCOA_VERSION @@ -875,7 +875,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) #include #endif #include - + // These functions are local to FileUtils.cpp and not exposed to the API // returns the path string except for numToShorten directories stripped off the end std::string GetShortenedPath(std::string path, int numToShorten) @@ -912,7 +912,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) CFRelease(urlRef); // docs say we are responsible for releasing CFURLRef } return path; - + } std::string GetApplicationParentPath(CFBundleRef mainBundle) @@ -930,7 +930,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) CFRelease(urlRef); } return path; - + } std::string GetApplicationResourcesPath(CFBundleRef mainBundle) @@ -947,17 +947,17 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // The Cocoa version is about 10 lines of code. // The Carbon version is noticably longer. - // Unfortunately, the Cocoa version requires -lobjc to be - // linked in when creating an executable. + // Unfortunately, the Cocoa version requires -lobjc to be + // linked in when creating an executable. // Rumor is that this will be done autmatically in gcc 3.5/Tiger, // but for now, this will cause a lot of headaches for people - // who aren't familiar with this concept, so the Carbon version + // who aren't familiar with this concept, so the Carbon version // is preferable. // But for the curious, both implementations are here. - // Note that if the Cocoa version is used, the file should be + // Note that if the Cocoa version is used, the file should be // renamed to use the .mm extension to denote Objective-C++. // And of course, you will need to link against Cocoa - // Update: There is a bug in the Cocoa version. Advanced users can remap + // Update: There is a bug in the Cocoa version. Advanced users can remap // their systems so these paths go somewhere else. The Carbon calls // will catch this, but the hardcoded Cocoa code below will not. @@ -968,26 +968,26 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // ~/Library/Application Support/OpenSceneGraph/PlugIns // /Library/Application Support/OpenSceneGraph/PlugIns // /Network/Library/Application Support/OpenSceneGraph/PlugIns - // - // As a side effect of this function, if the application is not a + // + // As a side effect of this function, if the application is not a // bundle, the first place searched becomes // YourProgram/PlugIns // // In principle, these other directories should be searched: // ~/Library/Application Support/YourProgram/PlugIns // /Library/Application Support/YourProgram/PlugIns - // /Network/Library/Application Support/TheProgram/PlugIns - // But I'm not going to worry about it for now because the - // bundle's PlugIns directory is supposed to be the preferred + // /Network/Library/Application Support/TheProgram/PlugIns + // But I'm not going to worry about it for now because the + // bundle's PlugIns directory is supposed to be the preferred // place for this anyway. // // Another directory that might be worth considering is // the directory the program resides in, // but I'm worried about multiplatform distribution. - // Because .so is used by other platforms like Linux, we + // Because .so is used by other platforms like Linux, we // could end up loading the wrong binary. // I'm not sure how robust the current code is for this case. - // Assuming the program doesn't crash, will OSG move on to the + // Assuming the program doesn't crash, will OSG move on to the // next search directory, or just give up? void osgDB::appendPlatformSpecificLibraryFilePaths(FilePathList& filepath) { @@ -1001,7 +1001,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // Since this is currently the only Objective-C code in the // library, we need an autoreleasepool for obj-c memory management. - // If more Obj-C is added, we might move this pool to another + // If more Obj-C is added, we might move this pool to another // location so it can be shared. Pools seem to be stackable, // so I don't think there will be a problem if multiple pools // exist at a time. @@ -1017,7 +1017,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // Now setup the other search paths // Cocoa has a nice method for tilde expansion. - // There's probably a better way of getting this directory, but I + // There's probably a better way of getting this directory, but I // can't find the call. userSupportDir = [@"~/Library/Application Support/OpenSceneGraph/PlugIns" stringByExpandingTildeInPath]; @@ -1048,18 +1048,18 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // In principle, these other directories should be searched: // ~/Library/Application Support/YourProgram/PlugIns // /Library/Application Support/YourProgram/PlugIns - // /Network/Library/Application Support/TheProgram/PlugIns - // But I'm not going to worry about it for now because the - // bundle's PlugIns directory is supposed to be the preferred + // /Network/Library/Application Support/TheProgram/PlugIns + // But I'm not going to worry about it for now because the + // bundle's PlugIns directory is supposed to be the preferred // place for this anyway. // // Another directory that might be worth considering is // the directory the program resides in, // but I'm worried about multiplatform distribution. - // Because .so is used by other platforms like Linux, we + // Because .so is used by other platforms like Linux, we // could end up loading the wrong binary. // I'm not sure how robust the current code is for this case. - // Assuming the program doesn't crash, will OSG move on to the + // Assuming the program doesn't crash, will OSG move on to the // next search directory, or just give up? void osgDB::appendPlatformSpecificLibraryFilePaths(FilePathList& filepath) { @@ -1082,10 +1082,10 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // Get the main bundle first. No need to retain or release it since // we are not keeping a reference myBundle = CFBundleGetMainBundle(); - + if(myBundle != NULL) { - // CFBundleGetMainBundle will return a bundle ref even if + // CFBundleGetMainBundle will return a bundle ref even if // the application isn't part of a bundle, so we need to check // if the path to the bundle ends in ".app" to see if it is a // proper application bundle. If it is, the plugins path is added @@ -1125,7 +1125,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) { // Get the URL url = CFURLCreateFromFSRef( 0, &f ); - + if(url) { filepath.push_back(GetPathFromCFURLRef(url) + OSG_PLUGIN_PATH); @@ -1149,7 +1149,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) { // Get the URL url = CFURLCreateFromFSRef( 0, &f ); - + if(url) { filepath.push_back(GetPathFromCFURLRef(url) + OSG_PLUGIN_PATH); @@ -1178,8 +1178,8 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) appendInstallationLibraryFilePaths(filepath); } #endif - -#else + +#else void osgDB::appendPlatformSpecificLibraryFilePaths(FilePathList& filepath) { @@ -1210,18 +1210,18 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) { // Get the main application bundle CFBundleRef mainBundle = CFBundleGetMainBundle(); - + if (mainBundle != NULL) { // Get the parent directory and the resources directory std::string bundlePath = GetApplicationBundlePath(mainBundle); std::string resourcesPath = GetApplicationResourcesPath(mainBundle); - + // check if application is really part of a .app bundle if(bundlePath.substr(bundlePath.length() - 4, 4) == std::string(".app")) { if(resourcesPath != std::string("")) filepath.push_back( resourcesPath ); - + std::string parentPath = GetShortenedPath(bundlePath, 1); if(parentPath != std::string("")) filepath.push_back( parentPath ); diff --git a/src/osgDB/ImageOptions.cpp b/src/osgDB/ImageOptions.cpp index 273eefe7e..46a72cf3b 100644 --- a/src/osgDB/ImageOptions.cpp +++ b/src/osgDB/ImageOptions.cpp @@ -11,7 +11,7 @@ ImageOptions::ImageOptions() ImageOptions::ImageOptions(const std::string& str) { - init(); + init(); _str = str; } @@ -20,9 +20,9 @@ void ImageOptions::init() { _sourceImageSamplingMode = NEAREST; _sourceImageWindowMode = ALL_IMAGE; - + _destinationImageWindowMode = ALL_IMAGE; - + _destinationDataType = GL_NONE; _destinationPixelFormat = GL_NONE; } diff --git a/src/osgDB/ImagePager.cpp b/src/osgDB/ImagePager.cpp index eedcf6507..2e8e7b4f6 100644 --- a/src/osgDB/ImagePager.cpp +++ b/src/osgDB/ImagePager.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -87,7 +87,7 @@ void ImagePager::ReadQueue::takeFirst(osg::ref_ptr& databaseReques if (!_requestList.empty()) { sort(); - + databaseRequest = _requestList.front(); databaseRequest->_requestQueue = 0; _requestList.erase(_requestList.begin()); @@ -126,9 +126,9 @@ int ImagePager::ImageThread::cancel() if( isRunning() ) { - + _done = true; - + switch(_mode) { case(HANDLE_ALL_REQUESTS): @@ -153,7 +153,7 @@ int ImagePager::ImageThread::cancel() // OSG_DEBUG<<"Waiting for DatabasePager to cancel"< read_queue; - + switch(_mode) { case(HANDLE_ALL_REQUESTS): @@ -186,7 +186,7 @@ void ImagePager::ImageThread::run() osg::ref_ptr imageRequest; read_queue->takeFirst(imageRequest); - + if (imageRequest.valid()) { osg::ref_ptr image = osgDB::readImageFile(imageRequest->_fileName); @@ -218,13 +218,13 @@ void ImagePager::ImageThread::run() { OpenThreads::Thread::YieldCurrentThread(); } - - + + // go to sleep till our the next time our thread gets scheduled. if (firstTime) { - // do a yield to get round a peculiar thread hang when testCancel() is called + // do a yield to get round a peculiar thread hang when testCancel() is called // in certain circumstances - of which there is no particular pattern. YieldCurrentThread(); firstTime = false; @@ -245,7 +245,7 @@ ImagePager::ImagePager(): { _startThreadCalled = false; _databasePagerThreadPaused = false; - + _readQueue = new ReadQueue(this,"Image Queue"); _completedQueue = new RequestQueue; _imageThreads.push_back(new ImageThread(this, ImageThread::HANDLE_ALL_REQUESTS, "Image Thread 1")); @@ -304,25 +304,25 @@ void ImagePager::requestImageFile(const std::string& fileName,osg::Object* attac request->_attachmentPoint = attachmentPoint; request->_attachmentIndex = attachmentIndex; request->_requestQueue = _readQueue.get(); - + _readQueue->add(request.get()); if (!_startThreadCalled) { OpenThreads::ScopedLock lock(_run_mutex); - + if (!_startThreadCalled) { _startThreadCalled = true; _done = false; - + for(ImageThreads::iterator itr = _imageThreads.begin(); itr != _imageThreads.end(); ++itr) { (*itr)->startThread(); } - + } } } @@ -353,7 +353,7 @@ void ImagePager::updateSceneGraph(const osg::FrameStamp&) OSG_NOTICE<<"ImagePager::updateSceneGraph() : error, image request attachment type not handled yet."<_requestList.clear(); } diff --git a/src/osgDB/Input.cpp b/src/osgDB/Input.cpp index 9209033a6..b2f1ffdc1 100644 --- a/src/osgDB/Input.cpp +++ b/src/osgDB/Input.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -274,7 +274,7 @@ bool Input::read(const char* str, Parameter value1) bool Input::read(const char* str, Parameter value1, Parameter value2) { - if ((*this)[0].matchWord(str) && + if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()) && value2.valid((*this)[2].getStr())) { @@ -288,7 +288,7 @@ bool Input::read(const char* str, Parameter value1, Parameter value2) bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3) { - if ((*this)[0].matchWord(str) && + if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()) && value2.valid((*this)[2].getStr()) && value3.valid((*this)[3].getStr())) @@ -304,7 +304,7 @@ bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4) { - if ((*this)[0].matchWord(str) && + if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()) && value2.valid((*this)[2].getStr()) && value3.valid((*this)[3].getStr()) && @@ -322,7 +322,7 @@ bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5) { - if ((*this)[0].matchWord(str) && + if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()) && value2.valid((*this)[2].getStr()) && value3.valid((*this)[3].getStr()) && @@ -342,7 +342,7 @@ bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6) { - if ((*this)[0].matchWord(str) && + if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()) && value2.valid((*this)[2].getStr()) && value3.valid((*this)[3].getStr()) && @@ -364,7 +364,7 @@ bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7) { - if ((*this)[0].matchWord(str) && + if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()) && value2.valid((*this)[2].getStr()) && value3.valid((*this)[3].getStr()) && @@ -388,7 +388,7 @@ bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8) { - if ((*this)[0].matchWord(str) && + if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()) && value2.valid((*this)[2].getStr()) && value3.valid((*this)[3].getStr()) && diff --git a/src/osgDB/InputStream.cpp b/src/osgDB/InputStream.cpp index 5d17d2bec..cf1ddcef0 100644 --- a/src/osgDB/InputStream.cpp +++ b/src/osgDB/InputStream.cpp @@ -28,7 +28,7 @@ InputStream::InputStream( const osgDB::Options* options ) { if ( !options ) return; _options = options; - + std::string schema; if ( options->getPluginStringData("ForceReadingImage")=="true" ) _forceReadingImage = true; @@ -43,7 +43,7 @@ InputStream::InputStream( const osgDB::Options* options ) s_lastSchema = schema; } } - + if ( schema.empty() ) { resetSchema(); @@ -223,16 +223,16 @@ InputStream& InputStream::operator>>( osg::Matrixd& mat ) osg::Array* InputStream::readArray() { osg::ref_ptr array = NULL; - + unsigned int id = 0; *this >> PROPERTY("ArrayID") >> id; - + ArrayMap::iterator itr = _arrayMap.find( id ); if ( itr!=_arrayMap.end() ) { return itr->second.get(); } - + DEF_MAPPEE(ArrayType, type); *this >> type; switch ( type.get() ) @@ -387,7 +387,7 @@ osg::Array* InputStream::readArray() default: throwException( "InputStream::readArray(): Unsupported array type." ); } - + if ( getException() ) return NULL; _arrayMap[id] = array; @@ -397,11 +397,11 @@ osg::Array* InputStream::readArray() osg::PrimitiveSet* InputStream::readPrimitiveSet() { osg::ref_ptr primitive = NULL; - + DEF_MAPPEE(PrimitiveType, type); DEF_MAPPEE(PrimitiveType, mode); *this >> type >> mode; - + switch ( type.get() ) { case ID_DRAWARRAYS: @@ -471,12 +471,12 @@ osg::PrimitiveSet* InputStream::readPrimitiveSet() default: throwException( "InputStream::readPrimitiveSet(): Unsupported array type." ); } - + if ( getException() ) return NULL; return primitive.release(); } -osg::Image* InputStream::readImage(bool readFromExternal) +osg::Image* InputStream::readImage(bool readFromExternal) { std::string className="osg::Image"; @@ -498,22 +498,22 @@ osg::Image* InputStream::readImage(bool readFromExternal) if ( getException() ) return NULL; osg::ref_ptr image = NULL; - + switch ( decision ) { case IMAGE_INLINE_DATA: if ( isBinary() ) { image = new osg::Image; - + // _origin, _s & _t & _r, _internalTextureFormat int origin, s, t, r, internalFormat; *this >> origin >> s >> t >> r >> internalFormat; - + // _pixelFormat, _dataType, _packing, _allocationMode int pixelFormat, dataType, packing, mode; *this >> pixelFormat >> dataType >> packing >> mode; - + // _data unsigned int size = 0; *this >> size; if ( size ) @@ -522,7 +522,7 @@ osg::Image* InputStream::readImage(bool readFromExternal) if ( !data ) throwException( "InputStream::readImage() Out of memory." ); if ( getException() ) return NULL; - + readCharArray( data, size ); image->setOrigin( (osg::Image::Origin)origin ); image->setImage( s, t, r, internalFormat, pixelFormat, dataType, @@ -554,7 +554,7 @@ osg::Image* InputStream::readImage(bool readFromExternal) if ( getException() ) return NULL; } readCharArray( data, size ); - + std::string ext = osgDB::getFileExtension( name ); osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension( ext ); @@ -562,7 +562,7 @@ osg::Image* InputStream::readImage(bool readFromExternal) { std::stringstream inputStream; inputStream.write( data, size ); - + osgDB::ReaderWriter::ReadResult rr = reader->readImage( inputStream ); if ( rr.validImage() ) image = rr.takeImage(); @@ -587,7 +587,7 @@ osg::Image* InputStream::readImage(bool readFromExternal) default: break; } - + if ( readFromExternal ) { image = osgDB::readImageFile( name, getOptions() ); @@ -610,7 +610,7 @@ osg::Object* InputStream::readObject( osg::Object* existingObj ) unsigned int id = 0; *this >> className >> BEGIN_BRACKET >> PROPERTY("UniqueID") >> id; if ( getException() ) return NULL; - + IdentifierMap::iterator itr = _identifierMap.find( id ); if ( itr!=_identifierMap.end() ) { @@ -635,7 +635,7 @@ osg::Object* InputStream::readObjectFields( const std::string& className, unsign return NULL; } _fields.push_back( className ); - + osg::ref_ptr obj = existingObj ? existingObj : wrapper->getProto()->cloneType(); _identifierMap[id] = obj; if ( obj.valid() ) @@ -651,10 +651,10 @@ osg::Object* InputStream::readObjectFields( const std::string& className, unsign continue; } _fields.push_back( assocWrapper->getName() ); - + assocWrapper->read( *this, *obj ); if ( getException() ) return NULL; - + _fields.pop_back(); } } @@ -669,11 +669,11 @@ void InputStream::readSchema( std::istream& fin ) while ( std::getline(fin, line) ) { if ( line[0]=='#' ) continue; // Comment - + StringList keyAndValue; split( line, keyAndValue, '=' ); if ( keyAndValue.size()<2 ) continue; - + setWrapperSchema( osgDB::trimEnclosingSpaces(keyAndValue[0]), osgDB::trimEnclosingSpaces(keyAndValue[1]) ); } @@ -683,7 +683,7 @@ InputStream::ReadType InputStream::start( InputIterator* inIterator ) { _fields.clear(); _fields.push_back( "Start" ); - + ReadType type = READ_UNKNOWN; _in = inIterator; if ( !_in ) @@ -691,7 +691,7 @@ InputStream::ReadType InputStream::start( InputIterator* inIterator ) if ( getException() ) return type; _in->setInputStream(this); - + // Check OSG header information unsigned int version = 0; if ( isBinary() ) @@ -699,7 +699,7 @@ InputStream::ReadType InputStream::start( InputIterator* inIterator ) unsigned int typeValue; *this >> typeValue >> version; type = static_cast(typeValue); - + unsigned int attributes; *this >> attributes; if ( attributes&0x2 ) _useSchemaData = true; } @@ -709,12 +709,12 @@ InputStream::ReadType InputStream::start( InputIterator* inIterator ) if ( typeString=="Scene" ) type = READ_SCENE; else if ( typeString=="Image" ) type = READ_IMAGE; else if ( typeString=="Object" ) type = READ_OBJECT; - + std::string osgName, osgVersion; *this >> PROPERTY("#Version") >> version; *this >> PROPERTY("#Generator") >> osgName >> osgVersion; } - + // Record file version for back-compatibility checking of wrappers _fileVersion = version; _fields.pop_back(); @@ -725,20 +725,20 @@ void InputStream::decompress() { if ( !isBinary() ) return; _fields.clear(); - + std::string compressorName; *this >> compressorName; if ( compressorName!="0" ) { std::string data; _fields.push_back( "Decompression" ); - + BaseCompressor* compressor = Registry::instance()->getObjectWrapperManager()->findCompressor(compressorName); if ( !compressor ) { OSG_WARN << "InputStream::decompress(): No such compressor " << compressorName << std::endl; } - + if ( !compressor->decompress(*(_in->getStream()), data) ) throwException( "InputStream: Failed to decompress stream." ); if ( getException() ) return; @@ -747,7 +747,7 @@ void InputStream::decompress() _in->setStream( _dataDecompress ); _fields.pop_back(); } - + if ( _useSchemaData ) { _fields.push_back( "SchemaData" ); @@ -769,7 +769,7 @@ void InputStream::setWrapperSchema( const std::string& name, const std::string& << name << std::endl; return; } - + StringList schema, methods, keyAndValue; std::vector types; split( properties, schema ); diff --git a/src/osgDB/MimeTypes.cpp b/src/osgDB/MimeTypes.cpp index 2b86bba71..490a824bb 100644 --- a/src/osgDB/MimeTypes.cpp +++ b/src/osgDB/MimeTypes.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ const char* builtinMimeTypeExtMappings[] = diff --git a/src/osgDB/ObjectWrapper.cpp b/src/osgDB/ObjectWrapper.cpp index 175337940..d6d694ab3 100644 --- a/src/osgDB/ObjectWrapper.cpp +++ b/src/osgDB/ObjectWrapper.cpp @@ -118,7 +118,7 @@ BaseSerializer* ObjectWrapper::getSerializer( const std::string& name ) if ( (*itr)->getName()==name ) return itr->get(); } - + for ( StringList::const_iterator itr=_associates.begin(); itr!=_associates.end(); ++itr ) { const std::string& assocName = *itr; @@ -129,7 +129,7 @@ BaseSerializer* ObjectWrapper::getSerializer( const std::string& name ) << assocName << std::endl; continue; } - + for ( SerializerList::iterator aitr=assocWrapper->_serializers.begin(); aitr!=assocWrapper->_serializers.end(); ++aitr ) { @@ -169,7 +169,7 @@ bool ObjectWrapper::read( InputStream& is, osg::Object& obj ) { (*itr)->objectRead(is, obj); } - + return readOK; } @@ -204,7 +204,7 @@ bool ObjectWrapper::readSchema( const StringList& properties, const std::vector< if ( !_backupSerializers.size() ) _backupSerializers = _serializers; _serializers.clear(); - + unsigned int size = properties.size(); unsigned int serializersSize = _backupSerializers.size(); for ( unsigned int i=0; igetName() ) { @@ -248,7 +248,7 @@ void ObjectWrapper::writeSchema( StringList& properties, std::vector& types { properties.push_back( (*itr)->getName() ); } - + for ( std::vector::iterator itr=_typeList.begin(); itr!=_typeList.end(); ++itr ) { @@ -414,7 +414,7 @@ ObjectWrapperManager::ObjectWrapperManager() glTable.add( "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG ); glTable.add( "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG ); glTable.add( "GL_ETC1_RGB8_OES",GL_ETC1_RGB8_OES ); - + // Texture source types glTable.add( "GL_BYTE", GL_BYTE ); glTable.add( "GL_SHORT", GL_SHORT ); diff --git a/src/osgDB/Options.cpp b/src/osgDB/Options.cpp index 359b1df78..da981c822 100644 --- a/src/osgDB/Options.cpp +++ b/src/osgDB/Options.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgDB/Output.cpp b/src/osgDB/Output.cpp index de851e57b..97e886e39 100644 --- a/src/osgDB/Output.cpp +++ b/src/osgDB/Output.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -47,13 +47,13 @@ void Output::init() _indentStep = 2; _numIndicesPerLine = 10; _pathNameHint = AS_IS; - + _outputTextureFiles = false; _textureFileNameNumber = 0; _outputShaderFiles = false; _shaderFileNameNumber = 0; - + _writeOutDefaultValues = false; const char* env = getenv("OSG_WRITE_OUT_DEFAULT_VALUES"); @@ -76,8 +76,8 @@ void Output::open(const char *name) } // Comment out to avoid compile errors under new compilers, the int mode -// is now a replaced by a class to wrap the mode. -// This method is not used right now to hopefully nobody will miss it... +// is now a replaced by a class to wrap the mode. +// This method is not used right now to hopefully nobody will miss it... // Jan 2002. // void Output::open(const char *name,int mode) // { @@ -194,13 +194,13 @@ std::string Output::getFileNameForOutput(const std::string& filename) const case(FULL_PATH): { // need to think about how best to implement this first... - OSG_WARN<<"Warning: Output::getFileNameForOutput() does not support FULL_PATH yet."<< std::endl; + OSG_WARN<<"Warning: Output::getFileNameForOutput() does not support FULL_PATH yet."<< std::endl; return filename; } case(RELATIVE_PATH): { // need to think about how best to implement this as well... - OSG_WARN<<"Warning: Output::getFileNameForOutput() does not support RELATIVE_PATH yet."<< std::endl; + OSG_WARN<<"Warning: Output::getFileNameForOutput() does not support RELATIVE_PATH yet."<< std::endl; return filename; } case(FILENAME_ONLY): @@ -222,10 +222,10 @@ std::string Output::getTextureFileNameForOutput() o << '_' << _textureFileNameNumber; fileName += o.str(); } - + fileName += ".dds"; ++_textureFileNameNumber; - + return fileName; } @@ -238,10 +238,10 @@ std::string Output::getShaderFileNameForOutput() o << '_' << _shaderFileNameNumber; fileName += o.str(); } - + fileName += ".glsl"; ++_shaderFileNameNumber; - + return fileName; } diff --git a/src/osgDB/OutputStream.cpp b/src/osgDB/OutputStream.cpp index e72dada23..c357fd98e 100644 --- a/src/osgDB/OutputStream.cpp +++ b/src/osgDB/OutputStream.cpp @@ -27,7 +27,7 @@ OutputStream::OutputStream( const osgDB::Options* options ) { if ( !options ) return; _options = options; - + if ( options->getPluginStringData("SchemaData")=="true" ) _useSchemaData = true; if ( !options->getPluginStringData("SchemaFile").empty() ) @@ -156,7 +156,7 @@ void OutputStream::writeArray( const osg::Array* a ) *this << std::endl; return; } - + switch ( a->getType() ) { case osg::Array::ByteArrayType: @@ -251,7 +251,7 @@ void OutputStream::writeArray( const osg::Array* a ) void OutputStream::writePrimitiveSet( const osg::PrimitiveSet* p ) { if ( !p ) return; - + switch ( p->getType() ) { case osg::PrimitiveSet::DrawArraysPrimitiveType: @@ -387,7 +387,7 @@ void OutputStream::writeImage( const osg::Image* img ) { unsigned int size = osg::Image::computeImageSizeInBytes(s,t,r,img->getPixelFormat(),img->getDataType(),img->getPacking()); offset += size; - + *this << offset; s >>= 1; @@ -395,7 +395,7 @@ void OutputStream::writeImage( const osg::Image* img ) r >>= 1; if (s<1) s=1; if (t<1) t=1; - if (r<1) r=1; + if (r<1) r=1; } } break; @@ -500,7 +500,7 @@ void OutputStream::writeObjectFields( const osg::Object* obj ) StringList properties; std::vector types; assocWrapper->writeSchema( properties, types ); - + unsigned int size = osg::minimum( properties.size(), types.size() ); if ( size>0 ) { @@ -528,16 +528,16 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t { _fields.clear(); _fields.push_back( "Start" ); - + _out = outIterator; if ( !_out ) throwException( "OutputStream: Null stream specified." ); if ( getException() ) return; - + if ( isBinary() ) { *this << (unsigned int)type << (unsigned int)OPENSCENEGRAPH_SOVERSION; - + bool useCompressSource = false; unsigned int attributes = 0; @@ -547,7 +547,7 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t useCompressSource = true; } *this << attributes; - + if ( !_compressorName.empty() ) { BaseCompressor* compressor = Registry::instance()->getObjectWrapperManager()->findCompressor(_compressorName); @@ -564,7 +564,7 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t } if ( !_compressorName.empty() ) *this << _compressorName; else *this << std::string("0"); // No compressor - + // Compressors and inbuilt schema use a new stream, which will be merged with the original one at the end. if ( useCompressSource ) { @@ -582,7 +582,7 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t case WRITE_OBJECT: typeString = "Object"; break; default: break; } - + *this << typeString << std::endl; *this << PROPERTY("#Version") << (unsigned int)OPENSCENEGRAPH_SOVERSION << std::endl; *this << PROPERTY("#Generator") << std::string("OpenSceneGraph") @@ -596,12 +596,12 @@ void OutputStream::compress( std::ostream* ostream ) { _fields.clear(); if ( !isBinary() ) return; - + std::stringstream schemaSource; if ( _useSchemaData ) { _fields.push_back( "SchemaData" ); - + std::string schemaData; for ( std::map::iterator itr=_inbuiltSchemaMap.begin(); itr!=_inbuiltSchemaMap.end(); ++itr ) @@ -610,15 +610,15 @@ void OutputStream::compress( std::ostream* ostream ) schemaData += itr->second; schemaData += '\n'; } - + int size = schemaData.size(); schemaSource.write( (char*)&size, INT_SIZE ); schemaSource.write( schemaData.c_str(), size ); - + _inbuiltSchemaMap.clear(); _fields.pop_back(); } - + if ( !_compressorName.empty() ) { _fields.push_back( "Compression" ); @@ -628,7 +628,7 @@ void OutputStream::compress( std::ostream* ostream ) _fields.pop_back(); return; } - + if ( !compressor->compress(*ostream, schemaSource.str() + _compressSource.str()) ) throwException( "OutputStream: Failed to compress stream." ); if ( getException() ) return; @@ -650,11 +650,11 @@ void OutputStream::writeSchema( std::ostream& fout ) { ObjectWrapper* wrapper = itr->second.get(); fout << itr->first << " ="; - + StringList properties; std::vector types; wrapper->writeSchema( properties, types ); - + std::string propertiesString; unsigned int size = osg::minimum( properties.size(), types.size() ); for ( unsigned int i=0; iget(); - + if (previouslyLoadedReaderWriters.count(rw)==0) { osg::ref_ptr rwi = new ReaderWriterInfo; @@ -125,9 +125,9 @@ bool osgDB::outputPluginDetails(std::ostream& out, const std::string& fileName) ++fl_itr) { out << *fl_itr << " "; - } + } out << std::endl; - + unsigned int longestOptionLength = 0; osgDB::ReaderWriter::FormatDescriptionMap::iterator fdm_itr; for(fdm_itr = info.protocols.begin(); diff --git a/src/osgDB/ReadFile.cpp b/src/osgDB/ReadFile.cpp index b32263b7d..169f47ff9 100644 --- a/src/osgDB/ReadFile.cpp +++ b/src/osgDB/ReadFile.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -91,7 +91,7 @@ Node* osgDB::readNodeFiles(std::vector& fileList,const Options* opt } } - + if (nodeList.empty()) { return NULL; @@ -113,7 +113,7 @@ Node* osgDB::readNodeFiles(std::vector& fileList,const Options* opt return group; } - + } Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const Options* options) @@ -128,14 +128,14 @@ Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const Options* options { osgDB::Registry::instance()->setFileCache(new osgDB::FileCache(filename)); } - + while (arguments.read("--image",filename)) { osg::ref_ptr image = readImageFile(filename.c_str(), options); if (image.valid()) { osg::Geode* geode = osg::createGeodeForImage(image.get()); - + if (image->isImageTranslucent()) { OSG_INFO<<"Image "<getFileName()<<" is translucent; setting up blending."< osgDB::readRefObjectFile(const std::string& filename,const Options* options) diff --git a/src/osgDB/ReaderWriter.cpp b/src/osgDB/ReaderWriter.cpp index 5a81c8772..ec48fd874 100644 --- a/src/osgDB/ReaderWriter.cpp +++ b/src/osgDB/ReaderWriter.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ bool ReaderWriter::acceptsExtension(const std::string& extension) const // check for an exact match std::string lowercase_ext = convertToLowerCase(extension); if (_supportedExtensions.count(lowercase_ext)!=0) return true; - + // if plugin supports wildcard extension then passthrough all types return (_supportedExtensions.count("*")!=0); } @@ -95,22 +95,22 @@ ReaderWriter::FeatureList ReaderWriter::featureAsString(ReaderWriter::Features f const char *s; } FeatureStringList; - FeatureStringList list[] = { + FeatureStringList list[] = { { FEATURE_READ_OBJECT, "readObject" }, - { FEATURE_READ_IMAGE, "readImage" }, + { FEATURE_READ_IMAGE, "readImage" }, { FEATURE_READ_HEIGHT_FIELD, "readHeightField" }, - { FEATURE_READ_NODE, "readNode" }, - { FEATURE_READ_SHADER, "readShader" }, + { FEATURE_READ_NODE, "readNode" }, + { FEATURE_READ_SHADER, "readShader" }, { FEATURE_WRITE_OBJECT, "writeObject" }, - { FEATURE_WRITE_IMAGE, "writeImage" }, + { FEATURE_WRITE_IMAGE, "writeImage" }, { FEATURE_WRITE_HEIGHT_FIELD, "writeHeightField" }, - { FEATURE_WRITE_NODE, "writeNode" }, + { FEATURE_WRITE_NODE, "writeNode" }, { FEATURE_WRITE_SHADER, "writeShader" }, { FEATURE_NONE,0 } }; - FeatureList result; - + FeatureList result; + for(FeatureStringList *p=list; p->feature != 0; p++) { if ((feature & p->feature) != 0) diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 98dc59c27..b43ba1b3a 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -78,14 +78,14 @@ public: ReaderWriter& operator * () { return *get(); } ReaderWriter* operator -> () { return get(); } - + bool valid() { return get()!=0; } - - void operator ++() + + void operator ++() { _rwUsed.insert(get()); } - + protected: @@ -93,10 +93,10 @@ protected: Registry::ReaderWriterList& _rwList; OpenThreads::ReentrantMutex& _pluginMutex; - + std::set _rwUsed; - ReaderWriter* get() + ReaderWriter* get() { OpenThreads::ScopedLock lock(_pluginMutex); Registry::ReaderWriterList::iterator itr=_rwList.begin(); @@ -206,8 +206,8 @@ void PrintFilePathList(std::ostream& stream,const FilePathList& filepath) Registry* Registry::instance(bool erase) { static ref_ptr s_registry = new Registry; - if (erase) - { + if (erase) + { s_registry->destruct(); s_registry = 0; } @@ -223,7 +223,7 @@ Registry::Registry() _buildKdTreesHint = Options::NO_PREFERENCE; _kdTreeBuilder = new osg::KdTreeBuilder; - + const char* kdtree_str = getenv("OSG_BUILD_KDTREES"); if (kdtree_str) { @@ -244,7 +244,7 @@ Registry::Registry() const char* fileCachePath = getenv("OSG_FILE_CACHE"); if (fileCachePath) { - _fileCache = new FileCache(fileCachePath); + _fileCache = new FileCache(fileCachePath); } _createNodeFromImage = false; @@ -253,7 +253,7 @@ Registry::Registry() // add default osga archive extension _archiveExtList.push_back("osga"); _archiveExtList.push_back("zip"); - + initFilePathLists(); @@ -291,7 +291,7 @@ Registry::Registry() addFileExtensionAlias("ivz", "gz"); addFileExtensionAlias("ozg", "gz"); - + addFileExtensionAlias("mag", "dicom"); addFileExtensionAlias("ph", "dicom"); addFileExtensionAlias("ima", "dicom"); @@ -396,11 +396,11 @@ Registry::Registry() addFileExtensionAlias("lw", "lwo"); #if defined(USE_VRML) - addFileExtensionAlias("wrl", "vrml"); + addFileExtensionAlias("wrl", "vrml"); #elif defined(USE_INVENTOR) addFileExtensionAlias("wrl", "iv"); #endif - + // add alias for the text/freetype plugin. addFileExtensionAlias("ttf", "freetype"); // true type addFileExtensionAlias("ttc", "freetype"); // true type @@ -420,7 +420,7 @@ Registry::Registry() addFileExtensionAlias("pbm", "pnm"); addFileExtensionAlias("pgm", "pnm"); addFileExtensionAlias("ppm", "pnm"); - + // add revision file mappings addFileExtensionAlias("added", "revisions"); @@ -438,7 +438,7 @@ Registry::Registry() break; addMimeTypeExtensionMapping( mimeType, builtinMimeTypeExtMappings[i+1] ); } - + // register server protocols, so the curl can handle it, if necessary registerProtocol("http"); registerProtocol("https"); @@ -459,13 +459,13 @@ void Registry::destruct() { // OSG_NOTICE<<"Registry::destruct()"<get()); if((*itr)->acceptsExtension(ext)) return (*itr).get(); } - + // now look for a plug-in to load the file. std::string libraryName = createLibraryNameForExtension(ext); OSG_NOTIFY(INFO) << "Now checking for plug-in "<(object)!=0; } @@ -920,7 +920,7 @@ struct Registry::ReadHeightFieldFunctor : public Registry::ReadFunctor { ReadHeightFieldFunctor(const std::string& filename, const Options* options):ReadFunctor(filename,options) {} - virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw) const { return rw.readHeightField(_filename, _options); } + virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw) const { return rw.readHeightField(_filename, _options); } virtual bool isValid(ReaderWriter::ReadResult& readResult) const { return readResult.validHeightField(); } virtual bool isValid(osg::Object* object) const { return dynamic_cast(object)!=0; } @@ -931,7 +931,7 @@ struct Registry::ReadNodeFunctor : public Registry::ReadFunctor { ReadNodeFunctor(const std::string& filename, const Options* options):ReadFunctor(filename,options) {} - virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw) const { return rw.readNode(_filename, _options); } + virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw) const { return rw.readNode(_filename, _options); } virtual bool isValid(ReaderWriter::ReadResult& readResult) const { return readResult.validNode(); } virtual bool isValid(osg::Object* object) const { return dynamic_cast(object)!=0; } @@ -944,7 +944,7 @@ struct Registry::ReadArchiveFunctor : public Registry::ReadFunctor ReadFunctor(filename,options), _status(status), _indexBlockSizeHint(indexBlockSizeHint) {} - + ReaderWriter::ArchiveStatus _status; unsigned int _indexBlockSizeHint; @@ -959,7 +959,7 @@ struct Registry::ReadShaderFunctor : public Registry::ReadFunctor { ReadShaderFunctor(const std::string& filename, const Options* options):ReadFunctor(filename,options) {} - virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw)const { return rw.readShader(_filename, _options); } + virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw)const { return rw.readShader(_filename, _options); } virtual bool isValid(ReaderWriter::ReadResult& readResult) const { return readResult.validShader(); } virtual bool isValid(osg::Object* object) const { return dynamic_cast(object)!=0; } @@ -1017,7 +1017,7 @@ std::string Registry::findDataFileImplementation(const std::string& filename, co if (!pathsContainsCurrentWorkingDirectory && osgDB::containsCurrentWorkingDirectoryReference(filepaths)) { pathsContainsCurrentWorkingDirectory = true; - } + } } if (!absolutePath && !pathsContainsCurrentWorkingDirectory) @@ -1028,7 +1028,7 @@ std::string Registry::findDataFileImplementation(const std::string& filename, co return filename; } } - + // if a directory is included in the filename, get just the (simple) filename itself and try that std::string simpleFileName = getSimpleFileName(filename); @@ -1108,13 +1108,13 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) OSG_INFO<<"Contains archive : "< options = readFunctor._options ? @@ -1124,7 +1124,7 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) options->setDatabasePath(archiveName); std::auto_ptr rf(readFunctor.cloneType(fileName, options.get())); - + result = rf->doRead(*archive); if (rf->isValid(result)) @@ -1135,7 +1135,7 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) OSG_INFO<<"Failed to read object from archive"< Results; Results results; @@ -1180,7 +1180,7 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) else if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) ++num_FILE_NOT_FOUND; else if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) ++num_ERROR_IN_READING_FILE; } - + if (num_FILE_NOT_HANDLED!=results.size()) { for(ritr=results.begin(); ritr!=results.end(); ++ritr) @@ -1235,7 +1235,7 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) return ReaderWriter::ReadResult("Warning: Could not find the .curl plugin to read from server."); } } - + if (!results.empty()) { unsigned int num_FILE_NOT_HANDLED = 0; @@ -1251,7 +1251,7 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) else if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) ++num_FILE_NOT_FOUND; else if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) ++num_ERROR_IN_READING_FILE; } - + if (num_FILE_NOT_HANDLED!=results.size()) { for(ritr=results.begin(); ritr!=results.end(); ++ritr) @@ -1305,9 +1305,9 @@ ReaderWriter::ReadResult Registry::readImplementation(const ReadFunctor& readFun else return ReaderWriter::ReadResult("Error file does not contain an osg::Object"); } } - + ReaderWriter::ReadResult rr = read(readFunctor); - if (rr.validObject()) + if (rr.validObject()) { // update cache with new entry. OSG_NOTIFY(INFO)<<"Adding to object cache "<writeNode(node,fileName,options); - + if (rr.success()) return rr; else results.push_back(rr); } @@ -1610,7 +1610,7 @@ ReaderWriter::WriteResult Registry::writeShaderImplementation(const Shader& shad { return ReaderWriter::WriteResult("Warning: Could not find plugin to write shader to file \""+fileName+"\"."); } - + if (results.front().message().empty()) { switch(results.front().status()) @@ -1709,7 +1709,7 @@ void Registry::removeFromArchiveCache(const std::string& fileName) { OpenThreads::ScopedLock lock(_archiveCacheMutex); ArchiveCache::iterator itr = _archiveCache.find(fileName); - if (itr!=_archiveCache.end()) + if (itr!=_archiveCache.end()) { _archiveCache.erase(itr); } @@ -1758,18 +1758,18 @@ void Registry::releaseGLObjects(osg::State* state) SharedStateManager* Registry::getOrCreateSharedStateManager() { if (!_sharedStateManager) _sharedStateManager = new SharedStateManager; - + return _sharedStateManager.get(); } -void Registry::registerProtocol(const std::string& protocol) -{ - _registeredProtocols.insert( convertToLowerCase(protocol) ); -} - -bool Registry::isProtocolRegistered(const std::string& protocol) -{ - return (_registeredProtocols.find( convertToLowerCase(protocol) ) != _registeredProtocols.end()); +void Registry::registerProtocol(const std::string& protocol) +{ + _registeredProtocols.insert( convertToLowerCase(protocol) ); +} + +bool Registry::isProtocolRegistered(const std::string& protocol) +{ + return (_registeredProtocols.find( convertToLowerCase(protocol) ) != _registeredProtocols.end()); } diff --git a/src/osgDB/SharedStateManager.cpp b/src/osgDB/SharedStateManager.cpp index ba8e6294d..83d1330a2 100644 --- a/src/osgDB/SharedStateManager.cpp +++ b/src/osgDB/SharedStateManager.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -17,7 +17,7 @@ using namespace osgDB; SharedStateManager::SharedStateManager(unsigned int mode): - osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) + osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { setShareMode(mode); _mutex=0; @@ -60,7 +60,7 @@ void SharedStateManager::prune() ++titr; } -} +} //---------------------------------------------------------------- @@ -70,7 +70,7 @@ void SharedStateManager::share(osg::Node *node, OpenThreads::Mutex *mt) { // const osg::Timer& timer = *osg::Timer::instance(); // osg::Timer_t start_tick = timer.tick(); - + _mutex = mt; node->accept(*this); tmpSharedTextureList.clear(); @@ -107,7 +107,7 @@ void SharedStateManager::apply(osg::Geode& geode) } } } - + bool SharedStateManager::isShared(osg::StateSet* ss) { if (shareStateSet(ss->getDataVariance())) @@ -155,7 +155,7 @@ osg::StateAttribute *SharedStateManager::find(osg::StateAttribute *sa) else return result->get(); } - + //---------------------------------------------------------------- // SharedStateManager::setStateSet @@ -194,12 +194,12 @@ void SharedStateManager::shareTextures(osg::StateSet* ss) TextureTextureSharePairMap::iterator titr = tmpSharedTextureList.find(texture); if(titr==tmpSharedTextureList.end()) { - // Texture is not in tmp list: + // Texture is not in tmp list: // First time it appears in this file, search Texture in sharedAttributeList osg::StateAttribute *textureFromSharedList = find(texture); if(textureFromSharedList) { - // Texture is in sharedAttributeList: + // Texture is in sharedAttributeList: // Share now. Required to be shared all next times if(_mutex) _mutex->lock(); ss->setTextureAttributeAndModes(unit, textureFromSharedList, osg::StateAttribute::ON); @@ -208,12 +208,12 @@ void SharedStateManager::shareTextures(osg::StateSet* ss) } else { - // Texture is not in _sharedAttributeList: + // Texture is not in _sharedAttributeList: // Add to _sharedAttributeList. Not needed to be // shared all next times. OpenThreads::ScopedLock lock(_listMutex); - _sharedTextureList.insert(texture); - tmpSharedTextureList[texture] = TextureSharePair(texture, false); + _sharedTextureList.insert(texture); + tmpSharedTextureList[texture] = TextureSharePair(texture, false); } } else if(titr->second.second) @@ -240,12 +240,12 @@ void SharedStateManager::process(osg::StateSet* ss, osg::Object* parent) StateSetStateSetSharePairMap::iterator sitr = tmpSharedStateSetList.find(ss); if (sitr==tmpSharedStateSetList.end()) { - // StateSet is not in tmp list: + // StateSet is not in tmp list: // First time it appears in this file, search StateSet in sharedObjectList osg::StateSet *ssFromSharedList = find(ss); if (ssFromSharedList) { - // StateSet is in sharedStateSetList: + // StateSet is in sharedStateSetList: // Share now. Required to be shared all next times if (_mutex) _mutex->lock(); setStateSet(ssFromSharedList, parent); @@ -254,13 +254,13 @@ void SharedStateManager::process(osg::StateSet* ss, osg::Object* parent) } else { - // StateSet is not in sharedStateSetList: + // StateSet is not in sharedStateSetList: // Add to sharedStateSetList. Not needed to be shared all next times. { OpenThreads::ScopedLock lock(_listMutex); - _sharedStateSetList.insert(ss); + _sharedStateSetList.insert(ss); tmpSharedStateSetList[ss] - = StateSetSharePair(ss, false); + = StateSetSharePair(ss, false); } // Only in this case sharing textures is also required if (_shareMode & (SHARE_DYNAMIC_TEXTURES | SHARE_STATIC_TEXTURES | SHARE_UNSPECIFIED_TEXTURES)) diff --git a/src/osgDB/Version.cpp b/src/osgDB/Version.cpp index 40f291acc..4706b7b64 100644 --- a/src/osgDB/Version.cpp +++ b/src/osgDB/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osgDB/WriteFile.cpp b/src/osgDB/WriteFile.cpp index d65befc63..0f3d38bd5 100644 --- a/src/osgDB/WriteFile.cpp +++ b/src/osgDB/WriteFile.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgDB/XmlParser.cpp b/src/osgDB/XmlParser.cpp index 5800e1e97..7ac7f33a4 100644 --- a/src/osgDB/XmlParser.cpp +++ b/src/osgDB/XmlParser.cpp @@ -363,7 +363,7 @@ bool XmlNode::read(Input& input) OSG_INFO<<"tag is closed correctly"<type = ATOM; } - else + else OSG_NOTICE<<"Error: tag is not closed correctly"<setProgramLocalParameter(_param+i, osg::Vec4(M(0, i), M(1, i), M(2, i), M(3, i))); - } + } } } } diff --git a/src/osgFX/BumpMapping.cpp b/src/osgFX/BumpMapping.cpp index 65c183f7b..8e1c356ef 100644 --- a/src/osgFX/BumpMapping.cpp +++ b/src/osgFX/BumpMapping.cpp @@ -23,7 +23,7 @@ namespace { using osg::NodeVisitor; - + // this is a visitor class that prepares all geometries in a subgraph // by calling prepareGeometry() which in turn generates tangent-space // basis vectors @@ -137,8 +137,8 @@ namespace // matrix. class ViewMatrixExtractor: public osg::StateAttribute { public: - - + + ViewMatrixExtractor() : osg::StateAttribute(), _vp(0), @@ -184,7 +184,7 @@ namespace osg::Matrix M = state.getInitialInverseViewMatrix(); for (int i=0; i<4; ++i) { _vp->setProgramLocalParameter(_param+i, osg::Vec4(M(0, i), M(1, i), M(2, i), M(3, i))); - } + } } } } @@ -225,7 +225,7 @@ namespace } META_Technique( - "FullArbTechnique", + "FullArbTechnique", "Single-pass technique, requires ARB_vertex_program and ARB_fragment_program." ); @@ -337,7 +337,7 @@ namespace " DP3 R0.x, R6.xyzx, R5.xyzx;" " MUL result.color.front.primary.w, c5.y, R0.x;" "END\n"; - + // fragment program std::ostringstream fp_oss; fp_oss << @@ -411,7 +411,7 @@ namespace { // "ARB Vp" technique uses ARB vertex program and DOT3 texture environment. - // Ambient and specular components are not handled. A texture for the diffuse + // Ambient and specular components are not handled. A texture for the diffuse // component is required as well as a normal map texture. class ArbVpTechnique: public Technique { public: @@ -510,7 +510,7 @@ namespace } // second pass, self-shadowing - bool selfShadowing = false; + bool selfShadowing = false; if (selfShadowing) { std::ostringstream vp_oss; @@ -545,7 +545,7 @@ namespace ss->setAttributeAndModes(vp.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); osg::ref_ptr bf = new osg::BlendFunc; - bf->setFunction(osg::BlendFunc::DST_COLOR, osg::BlendFunc::ZERO); + bf->setFunction(osg::BlendFunc::DST_COLOR, osg::BlendFunc::ZERO); ss->setAttributeAndModes(bf.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); ss->setTextureMode(_diffuse_unit, GL_TEXTURE_2D, osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); diff --git a/src/osgFX/Cartoon.cpp b/src/osgFX/Cartoon.cpp index ff3853c7d..0e57f2575 100644 --- a/src/osgFX/Cartoon.cpp +++ b/src/osgFX/Cartoon.cpp @@ -154,7 +154,7 @@ namespace /////////////////////////////////////////////////////////////////////////// // A port of Marco Jez's "cartoon.cg" to the OpenGL Shading Language -// by Mike Weiblen 2003-10-03, +// by Mike Weiblen 2003-10-03, // // This shader is simplified due to limitations in the OGLSL implementation // in the current 3Dlabs driver. As the OGLSL implementation improves, @@ -244,7 +244,7 @@ namespace _wf_mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(0, 0, 0, 1)); _wf_mat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(0, 0, 0, 1)); _wf_mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(0, 0, 0, 1)); - + // set by outline colour so no need to set here. //_wf_mat->setEmission(osg::Material::FRONT_AND_BACK, osg::Vec4(0, 0, 0, 1)); diff --git a/src/osgFX/MultiTextureControl.cpp b/src/osgFX/MultiTextureControl.cpp index 8c78c5e87..a357f8205 100644 --- a/src/osgFX/MultiTextureControl.cpp +++ b/src/osgFX/MultiTextureControl.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,26 +37,26 @@ void MultiTextureControl::setTextureWeight(unsigned int unit, float weight) _textureWeightList.resize(unit+1,0.0f); } _textureWeightList[unit] = weight; - + updateStateSet(); } void MultiTextureControl::updateStateSet() { osg::ref_ptr stateset = new osg::StateSet; - + unsigned int numTextureUnitsOn = 0; unsigned int unit; for(unit=0;unit<_textureWeightList.size();++unit) { if (_textureWeightList[unit]>0.0f) ++numTextureUnitsOn; } - + if (numTextureUnitsOn<=1) { for(unit=0;unit<_textureWeightList.size();++unit) { - if (_textureWeightList[unit]>0.0f) + if (_textureWeightList[unit]>0.0f) { osg::TexEnv* texenv = new osg::TexEnv(osg::TexEnv::MODULATE); stateset->setTextureAttribute(unit, texenv); @@ -97,12 +97,12 @@ void MultiTextureControl::updateStateSet() stateset->setTextureAttribute(1, texenv); } - } + } else if (_textureWeightList.size()==3) { float b = (_textureWeightList[0]+_textureWeightList[1])/(_textureWeightList[0]+_textureWeightList[1]+_textureWeightList[2]); float a = _textureWeightList[0]/(_textureWeightList[0]+_textureWeightList[1]); - + { osg::TexEnvCombine* texenv = new osg::TexEnvCombine; texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE); @@ -143,7 +143,7 @@ void MultiTextureControl::updateStateSet() stateset->setTextureAttribute(2, texenv); } - } + } setStateSet(stateset.get()); } diff --git a/src/osgFX/Registry.cpp b/src/osgFX/Registry.cpp index 2734cf3a0..7643596c3 100644 --- a/src/osgFX/Registry.cpp +++ b/src/osgFX/Registry.cpp @@ -8,7 +8,7 @@ Registry* Registry::instance() static osg::ref_ptr s_instance = new Registry; return s_instance.get(); } - + Registry::Registry() { } diff --git a/src/osgFX/SpecularHighlights.cpp b/src/osgFX/SpecularHighlights.cpp index 4b14ad001..dab091676 100644 --- a/src/osgFX/SpecularHighlights.cpp +++ b/src/osgFX/SpecularHighlights.cpp @@ -68,7 +68,7 @@ namespace osg::Matrix LM = osg::Matrix::rotate( osg::Vec3(lightvec.x(), lightvec.y(), lightvec.z()), eye_light_ref); - + glLoadMatrix((LM * osg::Matrix::inverse(M)).ptr()); } else { @@ -114,7 +114,7 @@ namespace { if (!Technique::validate(state)) return false; - osg::TextureCubeMap::Extensions *ext = + osg::TextureCubeMap::Extensions *ext = osg::TextureCubeMap::getExtensions(state.getContextID(), true); if (ext) { return ext->isCubeMapSupported(); diff --git a/src/osgFX/Technique.cpp b/src/osgFX/Technique.cpp index e6e736b1d..9ec1a2cf8 100644 --- a/src/osgFX/Technique.cpp +++ b/src/osgFX/Technique.cpp @@ -65,5 +65,5 @@ void Technique::traverse_implementation(osg::NodeVisitor& nv, Effect* fx) if (cv) { cv->popStateSet(); } - } + } } diff --git a/src/osgFX/Version.cpp b/src/osgFX/Version.cpp index cc7803bc3..f746b23bc 100644 --- a/src/osgFX/Version.cpp +++ b/src/osgFX/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osgGA/AnimationPathManipulator.cpp b/src/osgGA/AnimationPathManipulator.cpp index d29f52ee9..f9f62e7b4 100644 --- a/src/osgGA/AnimationPathManipulator.cpp +++ b/src/osgGA/AnimationPathManipulator.cpp @@ -4,7 +4,7 @@ using namespace osgGA; -AnimationPathManipulator::AnimationPathManipulator(osg::AnimationPath* animationPath) +AnimationPathManipulator::AnimationPathManipulator(osg::AnimationPath* animationPath) { _printOutTimingInfo = true; @@ -12,13 +12,13 @@ AnimationPathManipulator::AnimationPathManipulator(osg::AnimationPath* animation _timeOffset = 0.0; _timeScale = 1.0; _isPaused = false; - + _realStartOfTimedPeriod = 0.0; _animStartOfTimedPeriod = 0.0; _numOfFramesSinceStartOfTimedPeriod = -1; // need to init. } -AnimationPathManipulator::AnimationPathManipulator( const std::string& filename ) +AnimationPathManipulator::AnimationPathManipulator( const std::string& filename ) { _printOutTimingInfo = true; @@ -41,14 +41,14 @@ AnimationPathManipulator::AnimationPathManipulator( const std::string& filename _animationPath->read(in); in.close(); - + } void AnimationPathManipulator::home(double currentTime) { if (_animationPath.valid()) { - _timeOffset = _animationPath->getFirstTime()-currentTime; + _timeOffset = _animationPath->getFirstTime()-currentTime; } // reset the timing of the animation. @@ -85,13 +85,13 @@ bool AnimationPathManipulator::handle(const osgGA::GUIEventAdapter& ea,osgGA::GU if (ea.getKey()==' ') { _isPaused = false; - + home(ea,us); us.requestRedraw(); us.requestContinuousUpdate(false); - + return true; - } + } else if (ea.getKey()==')') { double time = _isPaused ? _pauseTime : ea.getTime(); @@ -103,23 +103,23 @@ bool AnimationPathManipulator::handle(const osgGA::GUIEventAdapter& ea,osgGA::GU // adjust timeOffset so the current animationTime does change. _timeOffset = animationTime/_timeScale - time; - + return true; - } + } else if (ea.getKey()=='(') { double time = _isPaused ? _pauseTime : ea.getTime(); double animationTime = (time+_timeOffset)*_timeScale; _timeScale /= 1.1; - + OSG_NOTICE<<"Animation speed = "<<_timeScale*100<<"%"<push_back(&node); } - + CameraViewSwitchManipulator::CameraViewList* _cameraViews; }; @@ -45,7 +45,7 @@ bool CameraViewSwitchManipulator::handle(const GUIEventAdapter& ea,GUIActionAdap switch(ea.getEventType()) { - + case(GUIEventAdapter::KEYDOWN): if (ea.getKey()=='[') { @@ -86,7 +86,7 @@ osg::Matrixd CameraViewSwitchManipulator::getMatrix() const OSG_NOTICE<<"CameraViewSwitchManipulator::getMatrix(): Unable to calculate matrix due to empty parental path."<accept(iv); - + if (lsi->containsIntersections()) { intersection = lsi->getIntersections().begin()->getWorldIntersectPoint(); @@ -184,9 +184,9 @@ void DriveManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter& us) if (getAutoComputeHomePosition()) computeHomePosition(); computePosition(_homeEye, _homeCenter, _homeUp); - + _velocity = 0.0; - + _pitch = 0.0; us.requestRedraw(); @@ -429,12 +429,12 @@ void DriveManipulator::computePosition(const osg::Vec3d& eye,const osg::Vec3d& c s.normalize(); osg::Vec3d u(s^f); u.normalize(); - + osg::Matrixd rotation_matrix(s[0], u[0], -f[0], 0.0, s[1], u[1], -f[1], 0.0, s[2], u[2], -f[2], 0.0, 0.0, 0.0, 0.0, 1.0); - + _eye = eye; _rotation = rotation_matrix.getRotate().inverse(); } @@ -452,7 +452,7 @@ bool DriveManipulator::calcMovement() OSG_INFO << "warning dt = "<getYnormalized(); _pitch += dy*dt; #endif - + osg::Quat yaw_rotation; yaw_rotation.makeRotate(yaw,up); - + _rotation *= yaw_rotation; - + rotation_matrix.makeRotate(_rotation); sv = osg::Vec3d(1.0,0.0,0.0) * rotation_matrix; @@ -538,7 +538,7 @@ bool DriveManipulator::calcMovement() double signedBuffer; if (distanceToMove>=0.0) signedBuffer=_buffer; else signedBuffer=-_buffer; - + // check to see if any obstruction in front. osg::Vec3d ip, np; if (intersect(_eye,_eye+lv*(signedBuffer+distanceToMove), ip, np)) @@ -574,7 +574,7 @@ bool DriveManipulator::calcMovement() return true; } - + // no hit on the terrain found therefore resort to a fall under // under the influence of gravity. osg::Vec3d dp = lfp; @@ -598,7 +598,7 @@ bool DriveManipulator::calcMovement() // no collision with terrain has been found therefore track horizontally. lv *= (_velocity*dt); - + _eye += lv; } diff --git a/src/osgGA/EventQueue.cpp b/src/osgGA/EventQueue.cpp index e8551a6da..557bd5fa3 100644 --- a/src/osgGA/EventQueue.cpp +++ b/src/osgGA/EventQueue.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,7 +24,7 @@ EventQueue::EventQueue(GUIEventAdapter::MouseYOrientation mouseYOrientation) _accumulateEventState = new GUIEventAdapter(); _accumulateEventState->setMouseYOrientation(mouseYOrientation); - + _firstTouchEmulatesMouse = true; } @@ -81,7 +81,7 @@ bool EventQueue::takeEvents(Events& events, double cutOffTime) for(; ritr != _eventQueue.rend() && ((*ritr)->getTime() > cutOffTime); ++ritr) {} if (ritr==_eventQueue.rend()) return false; - + for(Events::iterator itr = _eventQueue.begin(); itr != ritr.base(); ++itr) @@ -150,7 +150,7 @@ void EventQueue::penPressure(float pressure, double time) event->setEventType(GUIEventAdapter::PEN_PRESSURE); event->setPenPressure(pressure); event->setTime(time); - + addEvent(event); } @@ -162,7 +162,7 @@ void EventQueue::penOrientation(float tiltX, float tiltY, float rotation, double event->setPenTiltY(tiltY); event->setPenRotation(rotation); event->setTime(time); - + addEvent(event); } @@ -172,7 +172,7 @@ void EventQueue::penProximity(GUIEventAdapter::TabletPointerType pt, bool isEnte event->setEventType( (isEntering) ? GUIEventAdapter::PEN_PROXIMITY_ENTER : GUIEventAdapter::PEN_PROXIMITY_LEAVE); event->setTabletPointerType(pt); event->setTime(time); - + addEvent(event); } @@ -182,7 +182,7 @@ void EventQueue::mouseScroll(GUIEventAdapter::ScrollingMotion sm, double time) event->setEventType(GUIEventAdapter::SCROLL); event->setScrollingMotion(sm); event->setTime(time); - + addEvent(event); } @@ -192,7 +192,7 @@ void EventQueue::mouseScroll2D(float x, float y, double time) event->setEventType(GUIEventAdapter::SCROLL); event->setScrollingMotionDelta(x,y); event->setTime(time); - + addEvent(event); } @@ -212,7 +212,7 @@ void EventQueue::mouseMotion(float x, float y, double time) GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(event->getButtonMask() ? GUIEventAdapter::DRAG : GUIEventAdapter::MOVE); event->setTime(time); - + addEvent(event); } @@ -223,13 +223,13 @@ void EventQueue::mouseButtonPress(float x, float y, unsigned int button, double switch(button) { - case(1): + case(1): _accumulateEventState->setButtonMask(GUIEventAdapter::LEFT_MOUSE_BUTTON | _accumulateEventState->getButtonMask()); break; - case(2): + case(2): _accumulateEventState->setButtonMask(GUIEventAdapter::MIDDLE_MOUSE_BUTTON | _accumulateEventState->getButtonMask()); break; - case(3): + case(3): _accumulateEventState->setButtonMask(GUIEventAdapter::RIGHT_MOUSE_BUTTON | _accumulateEventState->getButtonMask()); break; } @@ -240,17 +240,17 @@ void EventQueue::mouseButtonPress(float x, float y, unsigned int button, double switch(button) { - case(1): + case(1): event->setButton(GUIEventAdapter::LEFT_MOUSE_BUTTON); break; - case(2): + case(2): event->setButton(GUIEventAdapter::MIDDLE_MOUSE_BUTTON); break; - case(3): + case(3): event->setButton(GUIEventAdapter::RIGHT_MOUSE_BUTTON); break; } - + addEvent(event); } @@ -261,13 +261,13 @@ void EventQueue::mouseDoubleButtonPress(float x, float y, unsigned int button, d switch(button) { - case(1): + case(1): _accumulateEventState->setButtonMask(GUIEventAdapter::LEFT_MOUSE_BUTTON | _accumulateEventState->getButtonMask()); break; - case(2): + case(2): _accumulateEventState->setButtonMask(GUIEventAdapter::MIDDLE_MOUSE_BUTTON | _accumulateEventState->getButtonMask()); break; - case(3): + case(3): _accumulateEventState->setButtonMask(GUIEventAdapter::RIGHT_MOUSE_BUTTON | _accumulateEventState->getButtonMask()); break; } @@ -278,17 +278,17 @@ void EventQueue::mouseDoubleButtonPress(float x, float y, unsigned int button, d switch(button) { - case(1): + case(1): event->setButton(GUIEventAdapter::LEFT_MOUSE_BUTTON); break; - case(2): + case(2): event->setButton(GUIEventAdapter::MIDDLE_MOUSE_BUTTON); break; - case(3): + case(3): event->setButton(GUIEventAdapter::RIGHT_MOUSE_BUTTON); break; } - + addEvent(event); } @@ -299,13 +299,13 @@ void EventQueue::mouseButtonRelease(float x, float y, unsigned int button, doubl switch(button) { - case(1): + case(1): _accumulateEventState->setButtonMask(~GUIEventAdapter::LEFT_MOUSE_BUTTON & _accumulateEventState->getButtonMask()); break; - case(2): + case(2): _accumulateEventState->setButtonMask(~GUIEventAdapter::MIDDLE_MOUSE_BUTTON & _accumulateEventState->getButtonMask()); break; - case(3): + case(3): _accumulateEventState->setButtonMask(~GUIEventAdapter::RIGHT_MOUSE_BUTTON & _accumulateEventState->getButtonMask()); break; } @@ -316,17 +316,17 @@ void EventQueue::mouseButtonRelease(float x, float y, unsigned int button, doubl switch(button) { - case(1): + case(1): event->setButton(GUIEventAdapter::LEFT_MOUSE_BUTTON); break; - case(2): + case(2): event->setButton(GUIEventAdapter::MIDDLE_MOUSE_BUTTON); break; - case(3): + case(3): event->setButton(GUIEventAdapter::RIGHT_MOUSE_BUTTON); break; } - + addEvent(event); } @@ -348,10 +348,10 @@ void EventQueue::keyPress(int key, double time, int unmodifiedKey) case(GUIEventAdapter::KEY_Hyper_R): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_HYPER | _accumulateEventState->getModKeyMask()); break; case(GUIEventAdapter::KEY_Caps_Lock): { - if ((_accumulateEventState->getModKeyMask() & GUIEventAdapter::MODKEY_CAPS_LOCK)!=0) + if ((_accumulateEventState->getModKeyMask() & GUIEventAdapter::MODKEY_CAPS_LOCK)!=0) _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_CAPS_LOCK & _accumulateEventState->getModKeyMask()); - else - _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_CAPS_LOCK | _accumulateEventState->getModKeyMask()); + else + _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_CAPS_LOCK | _accumulateEventState->getModKeyMask()); break; } case(GUIEventAdapter::KEY_Num_Lock): @@ -363,14 +363,14 @@ void EventQueue::keyPress(int key, double time, int unmodifiedKey) break; } default: break; - } + } GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::KEYDOWN); event->setKey(key); event->setUnmodifiedKey(unmodifiedKey); event->setTime(time); - + addEvent(event); } @@ -391,40 +391,40 @@ void EventQueue::keyRelease(int key, double time, int unmodifiedKey) case(GUIEventAdapter::KEY_Hyper_L): _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_HYPER & _accumulateEventState->getModKeyMask()); break; case(GUIEventAdapter::KEY_Hyper_R): _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_HYPER & _accumulateEventState->getModKeyMask()); break; default: break; - } + } GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::KEYUP); event->setKey(key); event->setUnmodifiedKey(unmodifiedKey); event->setTime(time); - + addEvent(event); } GUIEventAdapter* EventQueue::touchBegan(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time) { - if(_firstTouchEmulatesMouse) + if(_firstTouchEmulatesMouse) { // emulate left mouse button press - + _accumulateEventState->setButtonMask((1) | _accumulateEventState->getButtonMask()); _accumulateEventState->setX(x); _accumulateEventState->setY(y); } - + GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::PUSH); event->setTime(time); event->addTouchPoint(id, phase, x, y, 0); - + addEvent(event); - + return event; } - - + + GUIEventAdapter* EventQueue::touchMoved(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time) { if(_firstTouchEmulatesMouse) @@ -432,41 +432,41 @@ GUIEventAdapter* EventQueue::touchMoved(unsigned int id, GUIEventAdapter::Touch _accumulateEventState->setX(x); _accumulateEventState->setY(y); } - + GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::DRAG); event->setTime(time); event->addTouchPoint(id, phase, x, y, 0); addEvent(event); - + return event; } GUIEventAdapter* EventQueue::touchEnded(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, unsigned int tap_count, double time) { - if (_firstTouchEmulatesMouse) + if (_firstTouchEmulatesMouse) { _accumulateEventState->setButtonMask(~(1) & _accumulateEventState->getButtonMask()); _accumulateEventState->setX(x); _accumulateEventState->setY(y); } - + GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::RELEASE); event->setTime(time); event->addTouchPoint(id, phase, x, y, tap_count); addEvent(event); - + return event; } - + void EventQueue::closeWindow(double time) { GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::CLOSE_WINDOW); event->setTime(time); - + addEvent(event); } @@ -475,7 +475,7 @@ void EventQueue::quitApplication(double time) GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::QUIT_APPLICATION); event->setTime(time); - + addEvent(event); } @@ -485,14 +485,14 @@ void EventQueue::frame(double time) GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState); event->setEventType(GUIEventAdapter::FRAME); event->setTime(time); - + addEvent(event); } GUIEventAdapter* EventQueue::createEvent() { - if (_accumulateEventState.valid()) return new GUIEventAdapter(*_accumulateEventState.get()); - else return new GUIEventAdapter(); + if (_accumulateEventState.valid()) return new GUIEventAdapter(*_accumulateEventState.get()); + else return new GUIEventAdapter(); } void EventQueue::userEvent(osg::Referenced* userEventData, double time) @@ -501,7 +501,7 @@ void EventQueue::userEvent(osg::Referenced* userEventData, double time) event->setEventType(GUIEventAdapter::USER); event->setUserData(userEventData); event->setTime(time); - + addEvent(event); } diff --git a/src/osgGA/EventVisitor.cpp b/src/osgGA/EventVisitor.cpp index 885ab1848..0df141932 100644 --- a/src/osgGA/EventVisitor.cpp +++ b/src/osgGA/EventVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -35,7 +35,7 @@ void EventVisitor::addEvent(GUIEventAdapter* event) void EventVisitor::removeEvent(GUIEventAdapter* event) { - EventList::iterator itr = std::find(_events.begin(),_events.end(),event); + EventList::iterator itr = std::find(_events.begin(),_events.end(),event); if (itr!=_events.end()) _events.erase(itr); } diff --git a/src/osgGA/GUIEventAdapter.cpp b/src/osgGA/GUIEventAdapter.cpp index 2b51cf04c..2d4655571 100644 --- a/src/osgGA/GUIEventAdapter.cpp +++ b/src/osgGA/GUIEventAdapter.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -84,12 +84,12 @@ void GUIEventAdapter::setWindowRectangle(int x, int y, int width, int height, bo _windowY = y; _windowWidth = width; _windowHeight = height; - + if (updateMouseRange) { setInputRange(0, 0, width, height); } - + } void GUIEventAdapter::setInputRange(float Xmin, float Ymin, float Xmax, float Ymax) @@ -108,7 +108,7 @@ const osg::Matrix GUIEventAdapter::getPenOrientation() const osg::Matrix xrot = osg::Matrix::rotate ( xRad, osg::Vec3f(1.0f, 0.0f, 0.0f) ); osg::Matrix yrot = osg::Matrix::rotate ( yRad, osg::Vec3f(0.0f, 0.0f, 1.0f) ); osg::Matrix zrot = osg::Matrix::rotate ( zRad, osg::Vec3f(0.0f, 1.0f, 0.0f) ); - + return ( zrot * yrot * xrot ); } @@ -119,6 +119,6 @@ void GUIEventAdapter::addTouchPoint(unsigned int id, TouchPhase phase, float x, setX(x); setY(y); } - + _touchData->addTouchPoint(id, phase, x, y, tapCount); } diff --git a/src/osgGA/GUIEventHandler.cpp b/src/osgGA/GUIEventHandler.cpp index 3509ef4b5..25cd231ba 100644 --- a/src/osgGA/GUIEventHandler.cpp +++ b/src/osgGA/GUIEventHandler.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgGA/MultiTouchTrackballManipulator.cpp b/src/osgGA/MultiTouchTrackballManipulator.cpp index 8793ffbf4..37070bfb9 100644 --- a/src/osgGA/MultiTouchTrackballManipulator.cpp +++ b/src/osgGA/MultiTouchTrackballManipulator.cpp @@ -80,7 +80,7 @@ bool MultiTouchTrackballManipulator::handle( const GUIEventAdapter& ea, GUIActio case osgGA::GUIEventAdapter::PUSH: case osgGA::GUIEventAdapter::DRAG: case osgGA::GUIEventAdapter::RELEASE: - if (ea.isMultiTouchEvent()) + if (ea.isMultiTouchEvent()) { double eventTimeDelta = 1/60.0; //_ga_t0->getTime() - _ga_t1->getTime(); if( eventTimeDelta < 0. ) @@ -129,6 +129,6 @@ bool MultiTouchTrackballManipulator::handle( const GUIEventAdapter& ea, GUIActio default: break; } - + return handled ? handled : TrackballManipulator::handle(ea, us); } diff --git a/src/osgGA/NodeTrackerManipulator.cpp b/src/osgGA/NodeTrackerManipulator.cpp index 03b881b6f..64d8cac8f 100644 --- a/src/osgGA/NodeTrackerManipulator.cpp +++ b/src/osgGA/NodeTrackerManipulator.cpp @@ -105,7 +105,7 @@ void NodeTrackerManipulator::setTrackNode(osg::Node* node) OSG_NOTICE<<" "<<(*itr)->className()<getName()<<"): Path set"<getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP ? _zoomDelta : -_zoomDelta; buttonMask=GUIEventAdapter::SCROLL; - } - else + } + else { if (_ga_t1.get()==NULL) return false; dx = _ga_t0->getXnormalized()-_ga_t1->getXnormalized(); dy = _ga_t0->getYnormalized()-_ga_t1->getYnormalized(); float distance = sqrtf(dx*dx + dy*dy); - + // return if movement is too fast, indicating an error in event values or change in screen. if (distance>0.5) { return false; } - + // return if there is no movement. if (distance==0.0f) { @@ -310,7 +310,7 @@ bool SphericalManipulator::calcMovement() buttonMask = _ga_t1->getButtonMask(); } - + double throwScale = (_thrown && _ga_t0.valid() && _ga_t1.valid()) ? _delta_frame_time / (_ga_t0->getTime() - _ga_t1->getTime()) : 1.0; @@ -353,7 +353,7 @@ bool SphericalManipulator::calcMovement() { _elevation-=throwScale*dy*osg::PI_4; - // Only allows vertical rotation of 180deg + // Only allows vertical rotation of 180deg if(_elevation < -osg::PI_2) _elevation=-osg::PI_2; else if(_elevation > osg::PI_2) diff --git a/src/osgGA/StandardManipulator.cpp b/src/osgGA/StandardManipulator.cpp index a02db4b75..87cc30124 100644 --- a/src/osgGA/StandardManipulator.cpp +++ b/src/osgGA/StandardManipulator.cpp @@ -745,7 +745,7 @@ void StandardManipulator::fixVerticalAxis( const osg::Vec3d& forward, const osg: /** The method sends a ray into the scene and the point of the closest intersection is used to set a new center for the manipulator. For Orbit-style manipulators, - the orbiting center is set. For FirstPerson-style manipulators, view is pointed + the orbiting center is set. For FirstPerson-style manipulators, view is pointed towards the center.*/ bool StandardManipulator::setCenterByMousePointerIntersection( const GUIEventAdapter& ea, GUIActionAdapter& us ) { diff --git a/src/osgGA/StateSetManipulator.cpp b/src/osgGA/StateSetManipulator.cpp index 493db1381..3bf3dfa58 100644 --- a/src/osgGA/StateSetManipulator.cpp +++ b/src/osgGA/StateSetManipulator.cpp @@ -38,9 +38,9 @@ void StateSetManipulator::setStateSet(StateSet *stateset) { _stateset = stateset; #if 0 - // specify that this stateset is dynamic so it prevents - // the draw and update phase from overlapping - good for - // stability but breaks all the performance advantage of + // specify that this stateset is dynamic so it prevents + // the draw and update phase from overlapping - good for + // stability but breaks all the performance advantage of // DrawThreadPerContex. _stateset->setDataVariance(osg::Object::DYNAMIC); #endif @@ -59,11 +59,11 @@ const StateSet *StateSetManipulator::getStateSet() const void StateSetManipulator::clone() { if (!_stateset) return; - + // we clone the StateSet so that any draw traversals that might be running at the time of the - // event traversal won't change the same StateSet that is being read. One could just set the + // event traversal won't change the same StateSet that is being read. One could just set the // DataVariance to DYNAMIC to avoid this overlap, but this would introduce a performance penalty. - + StateSet::ParentList parents = _stateset->getParents(); osg::ref_ptr newStateSet = dynamic_cast(_stateset->clone(osg::CopyOp::SHALLOW_COPY)); @@ -81,7 +81,7 @@ void StateSetManipulator::clone() if (drawable) drawable->setStateSet(newStateSet.get()); } } - + _stateset = newStateSet; } @@ -101,7 +101,7 @@ bool StateSetManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa) (_stateset->getTextureMode(0,GL_TEXTURE_3D)&mode)!=0 || (_stateset->getTextureMode(0,GL_TEXTURE_RECTANGLE)&mode)!=0 || (_stateset->getTextureMode(0,GL_TEXTURE_CUBE_MAP)&mode)!=0; - + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) _texture |= ((_stateset->getTextureMode(0,GL_TEXTURE_1D)&mode)!=0); #endif @@ -153,9 +153,9 @@ void StateSetManipulator::getUsage(osg::ApplicationUsage& usage) const void StateSetManipulator::setBackfaceEnabled(bool newbackface) { if (_backface == newbackface) return; - + clone(); - + _backface = newbackface; if( _backface ) _stateset->setMode(GL_CULL_FACE,osg::StateAttribute::ON); else _stateset->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); @@ -164,7 +164,7 @@ void StateSetManipulator::setBackfaceEnabled(bool newbackface) void StateSetManipulator::setLightingEnabled(bool newlighting) { if (_lighting == newlighting) return; - + clone(); _lighting = newlighting; @@ -175,7 +175,7 @@ void StateSetManipulator::setLightingEnabled(bool newlighting) void StateSetManipulator::setTextureEnabled(bool newtexture) { if (_texture==newtexture) return; - + clone(); _texture = newtexture; @@ -213,7 +213,7 @@ void StateSetManipulator::cyclePolygonMode() osg::PolygonMode* polyModeObj = getOrCreatePolygonMode(); osg::PolygonMode::Mode currentMode = getPolygonMode(); - // cycle through the available modes. + // cycle through the available modes. switch(currentMode) { case osg::PolygonMode::FILL : polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE); break; @@ -232,7 +232,7 @@ osg::PolygonMode::Mode StateSetManipulator::getPolygonMode() const osg::PolygonMode* StateSetManipulator::getOrCreatePolygonMode() { osg::PolygonMode* polyModeObj = dynamic_cast(_stateset->getAttribute(osg::StateAttribute::POLYGONMODE)); - if (!polyModeObj) + if (!polyModeObj) { polyModeObj = new osg::PolygonMode; _stateset->setAttribute(polyModeObj); diff --git a/src/osgGA/UFOManipulator.cpp b/src/osgGA/UFOManipulator.cpp index 96f82708e..3e138a259 100644 --- a/src/osgGA/UFOManipulator.cpp +++ b/src/osgGA/UFOManipulator.cpp @@ -28,7 +28,7 @@ UFOManipulator::UFOManipulator(): _t0(0.0), _shift(false), _ctrl(false) -{ +{ _minHeightAboveGround = 2.0; _minDistanceInFront = 5.0; @@ -67,9 +67,9 @@ bool UFOManipulator::intersect(const osg::Vec3d& start, const osg::Vec3d& end, o osgUtil::IntersectionVisitor iv(lsi.get()); iv.setTraversalMask(_intersectTraversalMask); - + _node->accept(iv); - + if (lsi->containsIntersections()) { intersection = lsi->getIntersections().begin()->getWorldIntersectPoint(); @@ -82,7 +82,7 @@ void UFOManipulator::setNode( osg::Node *node ) { _node = node; - if (getAutoComputeHomePosition()) + if (getAutoComputeHomePosition()) computeHomePosition(); home(0.0); @@ -99,12 +99,12 @@ osg::Node* UFOManipulator::getNode() } -const char* UFOManipulator::className() const -{ - return "UFO"; +const char* UFOManipulator::className() const +{ + return "UFO"; } -void UFOManipulator::setByMatrix( const osg::Matrixd &mat ) +void UFOManipulator::setByMatrix( const osg::Matrixd &mat ) { _inverseMatrix = mat; _matrix.invert( _inverseMatrix ); @@ -117,7 +117,7 @@ void UFOManipulator::setByMatrix( const osg::Matrixd &mat ) _stop(); } -void UFOManipulator::setByInverseMatrix( const osg::Matrixd &invmat) +void UFOManipulator::setByInverseMatrix( const osg::Matrixd &invmat) { _matrix = invmat; _inverseMatrix.invert( _matrix ); @@ -135,7 +135,7 @@ osg::Matrixd UFOManipulator::getMatrix() const return (osg::Matrix::inverse(_offset) * _matrix); } -osg::Matrixd UFOManipulator::getInverseMatrix() const +osg::Matrixd UFOManipulator::getInverseMatrix() const { return (_inverseMatrix * _offset); } @@ -149,7 +149,7 @@ void UFOManipulator::computeHomePosition() /* * Find the ground - Assumption: The ground is the hit of an intersection - * from a line segment extending from above to below the database at its + * from a line segment extending from above to below the database at its * horizontal center, that intersects the database closest to zero. */ osg::CoordinateFrame cf( getCoordinateFrame(bs.center()) ); // not sure what position to use here @@ -191,7 +191,7 @@ void UFOManipulator::init(const GUIEventAdapter&, GUIActionAdapter&) _stop(); } -void UFOManipulator::home(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us) +void UFOManipulator::home(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us) { home(ea.getTime()); us.requestRedraw(); @@ -199,9 +199,9 @@ void UFOManipulator::home(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap } -void UFOManipulator::home(double) +void UFOManipulator::home(double) { - if (getAutoComputeHomePosition()) + if (getAutoComputeHomePosition()) computeHomePosition(); _position = _homeEye; @@ -256,7 +256,7 @@ bool UFOManipulator::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAda void UFOManipulator::getUsage(osg::ApplicationUsage& usage) const { - /** Way too busy. This needs to wait until we have a scrollable window + /** Way too busy. This needs to wait until we have a scrollable window usage.addKeyboardMouseBinding("UFO Manipulator: ", "Reset the viewing angle to 0.0"); usage.addKeyboardMouseBinding("UFO Manipulator: ", "Acceleration forward."); usage.addKeyboardMouseBinding("UFO Manipulator: ", "Acceleration backward (or deceleration forward"); @@ -429,7 +429,7 @@ void UFOManipulator::_keyDown( const osgGA::GUIEventAdapter &ea, osgGA::GUIActio if( fabs( _directionRotationRate ) < _directionRotationEpsilon ) _directionRotationRate = 0.0; } - + } break; @@ -464,7 +464,7 @@ void UFOManipulator::_frame( const osgGA::GUIEventAdapter &ea, osgGA::GUIActionA { osg::Vec3d _sideVec = _direction * osg::Matrix::rotate( -M_PI*0.5, upVec); - _position += ((_direction * _forwardSpeed) + + _position += ((_direction * _forwardSpeed) + (_sideVec * _sideSpeed) + (upVec * _upSpeed)) * _dt; @@ -476,7 +476,7 @@ void UFOManipulator::_frame( const osgGA::GUIEventAdapter &ea, osgGA::GUIActionA _pitchOffset *= -1; _yawOffset += _yawOffsetRate * _dt; - if( _yawOffset >= M_PI || _yawOffset < -M_PI ) + if( _yawOffset >= M_PI || _yawOffset < -M_PI ) _yawOffset *= -1; _offset = osg::Matrix::rotate( _yawOffset, getSideVector(cf), @@ -485,7 +485,7 @@ void UFOManipulator::_frame( const osgGA::GUIEventAdapter &ea, osgGA::GUIActionA _adjustPosition(); - _inverseMatrix.makeLookAt( _position, _position + _direction, upVec); + _inverseMatrix.makeLookAt( _position, _position + _direction, upVec); _matrix.invert(_inverseMatrix); if( _decelerateUpSideRate ) @@ -540,7 +540,7 @@ void UFOManipulator::_adjustPosition() // Check intersects infront. osg::Vec3d ip; - if (intersect(_position, + if (intersect(_position, _position + (_direction * (_minDistanceInFront * 3.0)), ip )) { @@ -552,13 +552,13 @@ void UFOManipulator::_adjustPosition() _stop(); } } - + // Check intersects below. osg::CoordinateFrame cf( getCoordinateFrame(_position) ); osg::Vec3d upVec( getUpVector(cf) ); - if (intersect(_position, - _position - upVec*_minHeightAboveGround*3, + if (intersect(_position, + _position - upVec*_minHeightAboveGround*3, ip )) { double d = (ip - _position).length(); diff --git a/src/osgGA/Version.cpp b/src/osgGA/Version.cpp index 33dc8e7da..77e7f8f2c 100644 --- a/src/osgGA/Version.cpp +++ b/src/osgGA/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgManipulator/AntiSquish.cpp b/src/osgManipulator/AntiSquish.cpp index 99235d789..4eab06e68 100644 --- a/src/osgManipulator/AntiSquish.cpp +++ b/src/osgManipulator/AntiSquish.cpp @@ -23,14 +23,14 @@ namespace public: AntiSquishCallback(AntiSquish* asq) : osg::NodeCallback(), _antiSquish(asq) {} virtual ~AntiSquishCallback() {}; - + virtual void operator() (osg::Node* node, osg::NodeVisitor* nv) { // Get the node path. osg::NodePath np = nv->getNodePath(); // Remove the last node which is the anti squish node itself. - np.pop_back(); + np.pop_back(); // Get the accumulated modeling matrix. osg::Matrix localToWorld = osg::computeLocalToWorld(np); @@ -76,7 +76,7 @@ AntiSquish::AntiSquish(const AntiSquish& pat,const osg::CopyOp& copyop) : _usePivot(pat._usePivot), _position(pat._position), _usePosition(pat._usePosition), - _cachedLocalToWorld(pat._cachedLocalToWorld) + _cachedLocalToWorld(pat._cachedLocalToWorld) { } @@ -87,7 +87,7 @@ AntiSquish::~AntiSquish() osg::Matrix AntiSquish::computeUnSquishedMatrix(const osg::Matrix& LTW, bool& flag) { osg::Vec3d t, s; - osg::Quat r, so; + osg::Quat r, so; if (LTW == _cachedLocalToWorld && _dirty == false) { @@ -95,12 +95,12 @@ osg::Matrix AntiSquish::computeUnSquishedMatrix(const osg::Matrix& LTW, bool& fl return osg::Matrix::identity(); } - _cachedLocalToWorld = LTW; + _cachedLocalToWorld = LTW; LTW.decompose(t, r, s, so); // Let's take an average of the scale. - double av = (s[0] + s[1] + s[2])/3.0; + double av = (s[0] + s[1] + s[2])/3.0; s[0] = av; s[1] = av; s[2]=av; if (av == 0) @@ -110,7 +110,7 @@ osg::Matrix AntiSquish::computeUnSquishedMatrix(const osg::Matrix& LTW, bool& fl } osg::Matrix unsquished; - + // // Final Matrix: [-Pivot][SO]^[S][SO][R][T][Pivot][LOCALTOWORLD]^[position] // OR [SO]^[S][SO][R][T][LOCALTOWORLD]^ @@ -126,7 +126,7 @@ osg::Matrix AntiSquish::computeUnSquishedMatrix(const osg::Matrix& LTW, bool& fl flag = false; return osg::Matrix::identity(); } - + //SO^ unsquished.postMult(invtmps); //S @@ -180,11 +180,11 @@ osg::Matrix AntiSquish::computeUnSquishedMatrix(const osg::Matrix& LTW, bool& fl { flag = false; return osg::Matrix::identity(); - } + } flag = true; _dirty = false; - return unsquished; + return unsquished; } diff --git a/src/osgManipulator/Dragger.cpp b/src/osgManipulator/Dragger.cpp index ae3385843..9f6aa1238 100644 --- a/src/osgManipulator/Dragger.cpp +++ b/src/osgManipulator/Dragger.cpp @@ -73,7 +73,7 @@ bool DraggerTransformCallback::receive(const MotionCommand& command) case MotionCommand::MOVE: { //OSG_NOTICE<<"MotionCommand::MOVE "<isProjectionOnSphere(); aa.requestRedraw(); } - return true; + return true; } - + // Pick finish. case (osgGA::GUIEventAdapter::RELEASE): { diff --git a/src/osgManipulator/Scale1DDragger.cpp b/src/osgManipulator/Scale1DDragger.cpp index 2c843e173..2552ff709 100644 --- a/src/osgManipulator/Scale1DDragger.cpp +++ b/src/osgManipulator/Scale1DDragger.cpp @@ -69,7 +69,7 @@ bool Scale1DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda { if ( pointer.contains(_leftHandleNode.get()) ) _scaleCenter = _projector->getLineEnd()[0]; - else if ( pointer.contains( _rightHandleNode.get()) ) + else if ( pointer.contains( _rightHandleNode.get()) ) _scaleCenter = _projector->getLineStart()[0]; } @@ -86,9 +86,9 @@ bool Scale1DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda aa.requestRedraw(); } - return true; + return true; } - + // Pick move. case (osgGA::GUIEventAdapter::DRAG): { @@ -109,7 +109,7 @@ bool Scale1DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda referencePoint = _projector->getLineStart()[0]; else referencePoint = _projector->getLineEnd()[0]; - + cmd->setStage(MotionCommand::MOVE); cmd->setLocalToWorldAndWorldToLocal(_projector->getLocalToWorld(),_projector->getWorldToLocal()); cmd->setScale(scale); @@ -122,9 +122,9 @@ bool Scale1DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda aa.requestRedraw(); } - return true; + return true; } - + // Pick finish. case (osgGA::GUIEventAdapter::RELEASE): { @@ -169,7 +169,7 @@ void Scale1DDragger::setupDefaultGeometry() lineGeode->addDrawable(geometry); } - + // Turn of lighting for line and set line width. lineGeode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); osg::LineWidth* linewidth = new osg::LineWidth(); @@ -186,7 +186,7 @@ void Scale1DDragger::setupDefaultGeometry() addChild(geode); setLeftHandleNode(*geode); } - + // Create a right box. { osg::Geode* geode = new osg::Geode; diff --git a/src/osgManipulator/Scale2DDragger.cpp b/src/osgManipulator/Scale2DDragger.cpp index 2a4fca8cb..c0d1cae41 100644 --- a/src/osgManipulator/Scale2DDragger.cpp +++ b/src/osgManipulator/Scale2DDragger.cpp @@ -75,25 +75,25 @@ bool Scale2DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda { _scaleCenter.set(0.0,0.0); - if (pointer.contains(_topLeftHandleNode.get())) + if (pointer.contains(_topLeftHandleNode.get())) { _referencePoint = _topLeftHandlePosition; if (_scaleMode == SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT) _scaleCenter = _bottomRightHandlePosition; } - else if (pointer.contains(_bottomLeftHandleNode.get())) + else if (pointer.contains(_bottomLeftHandleNode.get())) { _referencePoint = _bottomLeftHandlePosition; if (_scaleMode == SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT) _scaleCenter = _topRightHandlePosition; } - else if (pointer.contains(_bottomRightHandleNode.get())) + else if (pointer.contains(_bottomRightHandleNode.get())) { _referencePoint = _bottomRightHandlePosition; if (_scaleMode == SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT) _scaleCenter = _topLeftHandlePosition; } - else if (pointer.contains(_topRightHandleNode.get())) + else if (pointer.contains(_topRightHandleNode.get())) { _referencePoint = _topRightHandlePosition; if (_scaleMode == SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT) @@ -115,7 +115,7 @@ bool Scale2DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda aa.requestRedraw(); } - return true; + return true; } // Pick move. @@ -144,9 +144,9 @@ bool Scale2DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda aa.requestRedraw(); } - return true; + return true; } - + // Pick finish. case (osgGA::GUIEventAdapter::RELEASE): { @@ -189,7 +189,7 @@ void Scale2DDragger::setupDefaultGeometry() lineGeode->addDrawable(geometry); } - + // Turn of lighting for line and set line width. lineGeode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); osg::LineWidth* linewidth = new osg::LineWidth(); @@ -207,7 +207,7 @@ void Scale2DDragger::setupDefaultGeometry() addChild(geode); setTopLeftHandleNode(*geode); } - + // Create a bottom left box. { osg::Geode* geode = new osg::Geode; diff --git a/src/osgManipulator/ScaleAxisDragger.cpp b/src/osgManipulator/ScaleAxisDragger.cpp index 5e19fc476..7c849c7d1 100644 --- a/src/osgManipulator/ScaleAxisDragger.cpp +++ b/src/osgManipulator/ScaleAxisDragger.cpp @@ -26,18 +26,18 @@ ScaleAxisDragger::ScaleAxisDragger() _xDragger = new osgManipulator::Scale1DDragger(); addChild(_xDragger.get()); addDragger(_xDragger.get()); - + _yDragger = new osgManipulator::Scale1DDragger(); addChild(_yDragger.get()); addDragger(_yDragger.get()); - + _zDragger = new osgManipulator::Scale1DDragger(); addChild(_zDragger.get()); addDragger(_zDragger.get()); setParentDragger(getParentDragger()); } - + ScaleAxisDragger::~ScaleAxisDragger() { } @@ -48,7 +48,7 @@ void ScaleAxisDragger::setupDefaultGeometry() osg::Geode* lineGeode = new osg::Geode; { osg::Geometry* geometry = new osg::Geometry(); - + osg::Vec3Array* vertices = new osg::Vec3Array(2); (*vertices)[0] = osg::Vec3(0.0f,0.0f,0.0f); (*vertices)[1] = osg::Vec3(1.0f,0.0f,0.0f); @@ -73,7 +73,7 @@ void ScaleAxisDragger::setupDefaultGeometry() _zDragger->addChild(lineGeode); osg::Geode* geode = new osg::Geode; - + // Create a box. geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(1.0f,0.0f,0.0f), 0.05))); diff --git a/src/osgManipulator/TabBoxDragger.cpp b/src/osgManipulator/TabBoxDragger.cpp index 88b1ef14b..ccfe54aee 100644 --- a/src/osgManipulator/TabBoxDragger.cpp +++ b/src/osgManipulator/TabBoxDragger.cpp @@ -59,7 +59,7 @@ TabBoxDragger::TabBoxDragger() setParentDragger(getParentDragger()); } - + TabBoxDragger::~TabBoxDragger() { } diff --git a/src/osgManipulator/TabBoxTrackballDragger.cpp b/src/osgManipulator/TabBoxTrackballDragger.cpp index ec5530330..dc08f1202 100644 --- a/src/osgManipulator/TabBoxTrackballDragger.cpp +++ b/src/osgManipulator/TabBoxTrackballDragger.cpp @@ -29,7 +29,7 @@ TabBoxTrackballDragger::TabBoxTrackballDragger() _trackballDragger = new TrackballDragger(true); addChild(_trackballDragger.get()); addDragger(_trackballDragger.get()); - + _tabBoxDragger = new TabBoxDragger(); addChild(_tabBoxDragger.get()); addDragger(_tabBoxDragger.get()); diff --git a/src/osgManipulator/TabPlaneDragger.cpp b/src/osgManipulator/TabPlaneDragger.cpp index 55aa8edf8..65a38f8b9 100644 --- a/src/osgManipulator/TabPlaneDragger.cpp +++ b/src/osgManipulator/TabPlaneDragger.cpp @@ -82,12 +82,12 @@ void createCornerScaleDraggerGeometry(Scale2DDragger* cornerScaleDragger, osg::N // Create a top left box. { osg::Node* handleScene = createHandleScene(osg::Vec3(cornerScaleDragger->getTopLeftHandlePosition()[0], - 0.0,cornerScaleDragger->getTopLeftHandlePosition()[1]), + 0.0,cornerScaleDragger->getTopLeftHandlePosition()[1]), handleNode, handleScaleFactor); cornerScaleDragger->addChild(handleScene); cornerScaleDragger->setTopLeftHandleNode(*handleScene); } - + // Create a bottom left box. { osg::Node* handleScene = createHandleScene(osg::Vec3(cornerScaleDragger->getBottomLeftHandlePosition()[0], @@ -126,7 +126,7 @@ void createEdgeScaleDraggerGeometry(Scale1DDragger* horzEdgeScaleDragger, Scale1 horzEdgeScaleDragger->addChild(handleScene); horzEdgeScaleDragger->setLeftHandleNode(*handleScene); } - + // Create a right box. { osg::Node* handleScene = createHandleScene(osg::Vec3(horzEdgeScaleDragger->getRightHandlePosition(),0.0,0.0), @@ -161,7 +161,7 @@ void createTranslateDraggerGeometry(Scale2DDragger* cornerScaleDragger, Translat { osg::Geode* geode = new osg::Geode; osg::Geometry* geometry = new osg::Geometry(); - + osg::Vec3Array* vertices = new osg::Vec3Array(4); (*vertices)[0] = osg::Vec3(cornerScaleDragger->getTopLeftHandlePosition()[0],0.0,cornerScaleDragger->getTopLeftHandlePosition()[1]); (*vertices)[1] = osg::Vec3(cornerScaleDragger->getBottomLeftHandlePosition()[0],0.0,cornerScaleDragger->getBottomLeftHandlePosition()[1]); @@ -186,7 +186,7 @@ void createTranslateDraggerGeometry(Scale2DDragger* cornerScaleDragger, Translat translateDragger->getTranslate2DDragger()->addChild(geode); } - + } } @@ -196,7 +196,7 @@ TabPlaneDragger::TabPlaneDragger() : _handleScaleFactor(20.0) _cornerScaleDragger = new Scale2DDragger(Scale2DDragger::SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT); addChild(_cornerScaleDragger.get()); addDragger(_cornerScaleDragger.get()); - + _horzEdgeScaleDragger = new Scale1DDragger(Scale1DDragger::SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT); addChild(_horzEdgeScaleDragger.get()); addDragger(_horzEdgeScaleDragger.get()); @@ -209,10 +209,10 @@ TabPlaneDragger::TabPlaneDragger() : _handleScaleFactor(20.0) _translateDragger->setColor(osg::Vec4(0.7f, 0.7f, 0.7f, 1.0f)); addChild(_translateDragger.get()); addDragger(_translateDragger.get()); - + setParentDragger(getParentDragger()); } - + TabPlaneDragger::~TabPlaneDragger() { } @@ -225,7 +225,7 @@ bool TabPlaneDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAd if (!pointer.contains(this)) return false; // Since the translate plane and the handleNode lie on the same plane the hit could've been on either one. But we - // need to handle the scaling draggers before the translation. Check if the node path has the scaling nodes else + // need to handle the scaling draggers before the translation. Check if the node path has the scaling nodes else // check for the scaling nodes in next hit. if (_cornerScaleDragger->handle(pointer, ea, aa)) return true; @@ -233,10 +233,10 @@ bool TabPlaneDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAd return true; if (_vertEdgeScaleDragger->handle(pointer, ea, aa)) return true; - + PointerInfo nextPointer(pointer); nextPointer.next(); - + while (!nextPointer.completed()) { if (_cornerScaleDragger->handle(nextPointer, ea, aa)) diff --git a/src/osgManipulator/TabPlaneTrackballDragger.cpp b/src/osgManipulator/TabPlaneTrackballDragger.cpp index 6df75af33..c64563dc0 100644 --- a/src/osgManipulator/TabPlaneTrackballDragger.cpp +++ b/src/osgManipulator/TabPlaneTrackballDragger.cpp @@ -29,14 +29,14 @@ TabPlaneTrackballDragger::TabPlaneTrackballDragger() _trackballDragger = new TrackballDragger(true); addChild(_trackballDragger.get()); addDragger(_trackballDragger.get()); - + _tabPlaneDragger = new TabPlaneDragger(); addChild(_tabPlaneDragger.get()); addDragger(_tabPlaneDragger.get()); setParentDragger(getParentDragger()); } - + TabPlaneTrackballDragger::~TabPlaneTrackballDragger() { } diff --git a/src/osgManipulator/TrackballDragger.cpp b/src/osgManipulator/TrackballDragger.cpp index 45ae7c407..b9a801bc9 100644 --- a/src/osgManipulator/TrackballDragger.cpp +++ b/src/osgManipulator/TrackballDragger.cpp @@ -63,7 +63,7 @@ TrackballDragger::TrackballDragger(bool useAutoTransform) osg::AutoTransform *at = new osg::AutoTransform; at->setAutoScaleToScreen(true); at->addChild(scaler); - + AntiSquish* as = new AntiSquish; as->addChild(at); addChild(as); @@ -71,11 +71,11 @@ TrackballDragger::TrackballDragger(bool useAutoTransform) _xDragger = new RotateCylinderDragger(); scaler->addChild(_xDragger.get()); addDragger(_xDragger.get()); - + _yDragger = new RotateCylinderDragger(); scaler->addChild(_yDragger.get()); addDragger(_yDragger.get()); - + _zDragger = new RotateCylinderDragger(); scaler->addChild(_zDragger.get()); addDragger(_zDragger.get()); @@ -89,11 +89,11 @@ TrackballDragger::TrackballDragger(bool useAutoTransform) _xDragger = new RotateCylinderDragger(); addChild(_xDragger.get()); addDragger(_xDragger.get()); - + _yDragger = new RotateCylinderDragger(); addChild(_yDragger.get()); addDragger(_yDragger.get()); - + _zDragger = new RotateCylinderDragger(); addChild(_zDragger.get()); addDragger(_zDragger.get()); @@ -105,7 +105,7 @@ TrackballDragger::TrackballDragger(bool useAutoTransform) setParentDragger(getParentDragger()); } - + TrackballDragger::~TrackballDragger() { } @@ -137,7 +137,7 @@ void TrackballDragger::setupDefaultGeometry() #if !defined(OSG_GLES2_AVAILABLE) geode->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON); #endif - + } // Add line to all the individual 1D draggers. diff --git a/src/osgManipulator/Translate1DDragger.cpp b/src/osgManipulator/Translate1DDragger.cpp index abe96c57a..ceaf9d3b8 100644 --- a/src/osgManipulator/Translate1DDragger.cpp +++ b/src/osgManipulator/Translate1DDragger.cpp @@ -28,7 +28,7 @@ Translate1DDragger::Translate1DDragger() : Dragger(), _checkForNodeInNodePath(tr setColor(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f)); setPickColor(osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f)); } - + Translate1DDragger::Translate1DDragger(const osg::Vec3d& s, const osg::Vec3d& e) : Dragger(), _checkForNodeInNodePath(true) { _projector = new LineProjector(s,e); @@ -75,9 +75,9 @@ bool Translate1DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEven aa.requestRedraw(); } - return true; + return true; } - + // Pick move. case (osgGA::GUIEventAdapter::DRAG): { @@ -96,9 +96,9 @@ bool Translate1DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEven aa.requestRedraw(); } - return true; + return true; } - + // Pick finish. case (osgGA::GUIEventAdapter::RELEASE): { @@ -164,7 +164,7 @@ void Translate1DDragger::setupDefaultGeometry() osg::Drawable* cylinderGeom = new osg::ShapeDrawable(cylinder); setDrawableToAlwaysCull(*cylinderGeom); - + geode->addDrawable(cylinderGeom); } @@ -172,7 +172,7 @@ void Translate1DDragger::setupDefaultGeometry() // Create a line. { osg::Geometry* geometry = new osg::Geometry(); - + osg::Vec3Array* vertices = new osg::Vec3Array(2); (*vertices)[0] = _projector->getLineStart(); (*vertices)[1] = _projector->getLineEnd(); @@ -182,7 +182,7 @@ void Translate1DDragger::setupDefaultGeometry() lineGeode->addDrawable(geometry); } - + // Turn of lighting for line and set line width. lineGeode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); osg::LineWidth* linewidth = new osg::LineWidth(); diff --git a/src/osgManipulator/Translate2DDragger.cpp b/src/osgManipulator/Translate2DDragger.cpp index 219317407..4513f38e8 100644 --- a/src/osgManipulator/Translate2DDragger.cpp +++ b/src/osgManipulator/Translate2DDragger.cpp @@ -29,7 +29,7 @@ Translate2DDragger::Translate2DDragger() setColor(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f)); setPickColor(osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f)); } - + Translate2DDragger::Translate2DDragger(const osg::Plane& plane) { _projector = new PlaneProjector(plane); @@ -57,7 +57,7 @@ bool Translate2DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEven computeNodePathToRoot(*this,nodePathToRoot); osg::Matrix localToWorld = osg::computeLocalToWorld(nodePathToRoot); _projector->setLocalToWorld(localToWorld); - + if (_projector->project(pointer, _startProjectedPoint)) { // Generate the motion command. @@ -76,9 +76,9 @@ bool Translate2DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEven aa.requestRedraw(); } - return true; + return true; } - + // Pick move. case (osgGA::GUIEventAdapter::DRAG): { @@ -98,7 +98,7 @@ bool Translate2DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEven aa.requestRedraw(); } - return true; + return true; } // Pick finish. @@ -132,7 +132,7 @@ void Translate2DDragger::setupDefaultGeometry() osg::Geode* lineGeode = new osg::Geode; { osg::Geometry* geometry = new osg::Geometry(); - + osg::Vec3Array* vertices = new osg::Vec3Array(2); (*vertices)[0] = osg::Vec3(0.0f,0.0f,-0.5f); (*vertices)[1] = osg::Vec3(0.0f,0.0f,0.5f); @@ -158,7 +158,7 @@ void Translate2DDragger::setupDefaultGeometry() cone->setRotation(rotation); geode->addDrawable(new osg::ShapeDrawable(cone)); } - + // Create right cone. { osg::Cone* cone = new osg::Cone (osg::Vec3(0.0f, 0.0f, 0.5f), 0.025f, 0.10f); @@ -197,13 +197,13 @@ void Translate2DDragger::setupDefaultGeometry() xform->addChild(arrow); } - + // Rotate the xform so that the geometry lies on the plane. { osg::Vec3 normal = _projector->getPlane().getNormal(); normal.normalize(); osg::Quat rotation; rotation.makeRotate(osg::Vec3(0.0f, 1.0f, 0.0f), normal); xform->setMatrix(osg::Matrix(rotation)); } - + addChild(xform); } diff --git a/src/osgManipulator/TranslateAxisDragger.cpp b/src/osgManipulator/TranslateAxisDragger.cpp index 83ba064b3..73f4572a5 100644 --- a/src/osgManipulator/TranslateAxisDragger.cpp +++ b/src/osgManipulator/TranslateAxisDragger.cpp @@ -26,18 +26,18 @@ TranslateAxisDragger::TranslateAxisDragger() _xDragger = new Translate1DDragger(osg::Vec3(0.0,0.0,0.0), osg::Vec3(0.0,0.0,1.0)); addChild(_xDragger.get()); addDragger(_xDragger.get()); - + _yDragger = new Translate1DDragger(osg::Vec3(0.0,0.0,0.0), osg::Vec3(0.0,0.0,1.0)); addChild(_yDragger.get()); addDragger(_yDragger.get()); - + _zDragger = new Translate1DDragger(osg::Vec3(0.0,0.0,0.0), osg::Vec3(0.0,0.0,1.0)); addChild(_zDragger.get()); addDragger(_zDragger.get()); setParentDragger(getParentDragger()); } - + TranslateAxisDragger::~TranslateAxisDragger() { } @@ -48,7 +48,7 @@ void TranslateAxisDragger::setupDefaultGeometry() osg::Geode* lineGeode = new osg::Geode; { osg::Geometry* geometry = new osg::Geometry(); - + osg::Vec3Array* vertices = new osg::Vec3Array(2); (*vertices)[0] = osg::Vec3(0.0f,0.0f,0.0f); (*vertices)[1] = osg::Vec3(0.0f,0.0f,1.0f); @@ -73,7 +73,7 @@ void TranslateAxisDragger::setupDefaultGeometry() _zDragger->addChild(lineGeode); osg::Geode* geode = new osg::Geode; - + // Create a cone. { osg::Cone* cone = new osg::Cone (osg::Vec3(0.0f, 0.0f, 1.0f), 0.025f, 0.10f); diff --git a/src/osgManipulator/TranslatePlaneDragger.cpp b/src/osgManipulator/TranslatePlaneDragger.cpp index 00b0d5e39..8b5148b58 100644 --- a/src/osgManipulator/TranslatePlaneDragger.cpp +++ b/src/osgManipulator/TranslatePlaneDragger.cpp @@ -38,7 +38,7 @@ TranslatePlaneDragger::TranslatePlaneDragger() : _usingTranslate1DDragger(false) setParentDragger(getParentDragger()); } - + TranslatePlaneDragger::~TranslatePlaneDragger() { } @@ -76,7 +76,7 @@ void TranslatePlaneDragger::setupDefaultGeometry() { osg::Geode* geode = new osg::Geode; osg::Geometry* geometry = new osg::Geometry(); - + osg::Vec3Array* vertices = new osg::Vec3Array(4); (*vertices)[0] = osg::Vec3(-0.5,0.0,0.5); (*vertices)[1] = osg::Vec3(-0.5,0.0,-0.5); diff --git a/src/osgManipulator/Version.cpp b/src/osgManipulator/Version.cpp index bbbc5fcea..882cb8ddb 100644 --- a/src/osgManipulator/Version.cpp +++ b/src/osgManipulator/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgParticle/BounceOperator.cpp b/src/osgParticle/BounceOperator.cpp index e4632072a..1f50e029b 100644 --- a/src/osgParticle/BounceOperator.cpp +++ b/src/osgParticle/BounceOperator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 @@ -23,19 +23,19 @@ void BounceOperator::handleTriangle( const Domain& domain, Particle* P, double d osg::Vec3 nextpos = P->getPosition() + P->getVelocity() * dt; float distance = domain.plane.distance( P->getPosition() ); if ( distance*domain.plane.distance(nextpos)>=0 ) return; - + osg::Vec3 normal = domain.plane.getNormal(); float nv = normal * P->getVelocity(); osg::Vec3 hitPoint = P->getPosition() - P->getVelocity() * (distance / nv); - + float upos = (hitPoint - domain.v1) * domain.s1; float vpos = (hitPoint - domain.v1) * domain.s2; if ( upos<0.0f || vpos<0.0f || (upos + vpos)>1.0f ) return; - + // Compute tangential and normal components of velocity osg::Vec3 vn = normal * nv; osg::Vec3 vt = P->getVelocity() - vn; - + // Compute new velocity if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience ); else P->setVelocity( vt*(1.0f-_friction) - vn*_resilience ); @@ -46,19 +46,19 @@ void BounceOperator::handleRectangle( const Domain& domain, Particle* P, double osg::Vec3 nextpos = P->getPosition() + P->getVelocity() * dt; float distance = domain.plane.distance( P->getPosition() ); if ( distance*domain.plane.distance(nextpos)>=0 ) return; - + osg::Vec3 normal = domain.plane.getNormal(); float nv = normal * P->getVelocity(); osg::Vec3 hitPoint = P->getPosition() - P->getVelocity() * (distance / nv); - + float upos = (hitPoint - domain.v1) * domain.s1; float vpos = (hitPoint - domain.v1) * domain.s2; if ( upos<0.0f || upos>1.0f || vpos<0.0f || vpos>1.0f ) return; - + // Compute tangential and normal components of velocity osg::Vec3 vn = normal * nv; osg::Vec3 vt = P->getVelocity() - vn; - + // Compute new velocity if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience ); else P->setVelocity( vt*(1.0f-_friction) - vn*_resilience ); @@ -69,14 +69,14 @@ void BounceOperator::handlePlane( const Domain& domain, Particle* P, double dt ) osg::Vec3 nextpos = P->getPosition() + P->getVelocity() * dt; float distance = domain.plane.distance( P->getPosition() ); if ( distance*domain.plane.distance(nextpos)>=0 ) return; - + osg::Vec3 normal = domain.plane.getNormal(); float nv = normal * P->getVelocity(); - + // Compute tangential and normal components of velocity osg::Vec3 vn = normal * nv; osg::Vec3 vt = P->getVelocity() - vn; - + // Compute new velocity if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience ); else P->setVelocity( vt*(1.0f-_friction) - vn*_resilience ); @@ -90,27 +90,27 @@ void BounceOperator::handleSphere( const Domain& domain, Particle* P, double dt { float distance2 = (nextpos - domain.v1).length(); if ( distance2<=domain.r1 ) return; - + // Bounce back in if going outside osg::Vec3 normal = domain.v1 - P->getPosition(); normal.normalize(); float nmag = P->getVelocity() * normal; - + // Compute tangential and normal components of velocity osg::Vec3 vn = normal * nmag; osg::Vec3 vt = P->getVelocity() - vn; if ( nmag<0 ) vn = -vn; - + // Compute new velocity float tanscale = (vt.length2()<=_cutoff) ? 1.0f : (1.0f - _friction); P->setVelocity( vt * tanscale + vn * _resilience ); - + // Make sure the particle is fixed to stay inside nextpos = P->getPosition() + P->getVelocity() * dt; distance2 = (nextpos - domain.v1).length(); if ( distance2>domain.r1 ) { normal = domain.v1 - nextpos; normal.normalize(); - + osg::Vec3 wishPoint = domain.v1 - normal * (0.999f * domain.r1); P->setVelocity( (wishPoint - P->getPosition()) / dt ); } @@ -119,16 +119,16 @@ void BounceOperator::handleSphere( const Domain& domain, Particle* P, double dt { float distance2 = (nextpos - domain.v1).length(); if ( distance2>domain.r1 ) return; - + // Bounce back out if going inside osg::Vec3 normal = P->getPosition() - domain.v1; normal.normalize(); float nmag = P->getVelocity() * normal; - + // Compute tangential and normal components of velocity osg::Vec3 vn = normal * nmag; osg::Vec3 vt = P->getVelocity() - vn; if ( nmag<0 ) vn = -vn; - + // Compute new velocity float tanscale = (vt.length2()<=_cutoff) ? 1.0f : (1.0f - _friction); P->setVelocity( vt * tanscale + vn * _resilience ); @@ -140,18 +140,18 @@ void BounceOperator::handleDisk( const Domain& domain, Particle* P, double dt ) osg::Vec3 nextpos = P->getPosition() + P->getVelocity() * dt; float distance = domain.plane.distance( P->getPosition() ); if ( distance*domain.plane.distance(nextpos)>=0 ) return; - + osg::Vec3 normal = domain.plane.getNormal(); float nv = normal * P->getVelocity(); osg::Vec3 hitPoint = P->getPosition() - P->getVelocity() * (distance / nv); - + float radius = (hitPoint - domain.v1).length(); if ( radius>domain.r1 || radiusgetVelocity() - vn; - + // Compute new velocity if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience ); else P->setVelocity( vt*(1.0f-_friction) - vn*_resilience ); diff --git a/src/osgParticle/ConnectedParticleSystem.cpp b/src/osgParticle/ConnectedParticleSystem.cpp index eae5f8867..30a4c5372 100644 --- a/src/osgParticle/ConnectedParticleSystem.cpp +++ b/src/osgParticle/ConnectedParticleSystem.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,13 +43,13 @@ Particle* ConnectedParticleSystem::createParticle(const Particle* ptemplate) Particle* particle = ParticleSystem::createParticle(ptemplate); int particleIndex = (int)(particle - &_particles[0]); - + if (particle) { - + if (_startParticle == Particle::INVALID_INDEX) { - // we are the fisrt particle create, so start the connect particle list + // we are the fisrt particle create, so start the connect particle list _startParticle = particleIndex; } @@ -64,18 +64,18 @@ Particle* ConnectedParticleSystem::createParticle(const Particle* ptemplate) // set the new particle as the last particle created. _lastParticleCreated = particleIndex; - + } - + return particle; } - + void ConnectedParticleSystem::reuseParticle(int particleIndex) { // OSG_NOTICE<=(int)_particles.size()) return; - + Particle* particle = &_particles[particleIndex]; int previous = particle->getPreviousParticle(); int next = particle->getNextParticle(); @@ -85,19 +85,19 @@ void ConnectedParticleSystem::reuseParticle(int particleIndex) { _startParticle = particle->getNextParticle(); } - + if (_lastParticleCreated == particleIndex) { _lastParticleCreated = Particle::INVALID_INDEX; } - + // join up the previous and next particles to account for // the deletion of the this particle if (previous != Particle::INVALID_INDEX) { _particles[previous].setNextParticle(next); } - + if (next != Particle::INVALID_INDEX) { _particles[next].setPreviousParticle(previous); @@ -106,7 +106,7 @@ void ConnectedParticleSystem::reuseParticle(int particleIndex) // reset the next and previous particle entries of this particle particle->setPreviousParticle(Particle::INVALID_INDEX); particle->setNextParticle(Particle::INVALID_INDEX); - + // put the particle on the death stack ParticleSystem::reuseParticle(particleIndex); @@ -121,7 +121,7 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co const Particle* particle = (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0; if (!particle) return; - + osg::Vec4 pixelSizeVector = osg::CullingSet::computePixelSizeVector(*state.getCurrentViewport(),state.getProjectionMatrix(),state.getModelViewMatrix()); float unitPixelSize = fabs(1.0/(particle->getPosition()*pixelSizeVector)); @@ -170,7 +170,7 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co else { - // draw the connected particles as a quad stripped aligned to be orthogonal to the eye + // draw the connected particles as a quad stripped aligned to be orthogonal to the eye osg::Matrix eyeToLocalTransform; eyeToLocalTransform.invert(state.getModelViewMatrix()); osg::Vec3 eyeLocal = osg::Vec3(0.0f,0.0,0.0f)*eyeToLocalTransform; diff --git a/src/osgParticle/DomainOperator.cpp b/src/osgParticle/DomainOperator.cpp index d0445554c..ef0a30b7c 100644 --- a/src/osgParticle/DomainOperator.cpp +++ b/src/osgParticle/DomainOperator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // Written by Wang Rui, (C) 2010 diff --git a/src/osgParticle/Emitter.cpp b/src/osgParticle/Emitter.cpp index dfb796d01..d01c6bf10 100644 --- a/src/osgParticle/Emitter.cpp +++ b/src/osgParticle/Emitter.cpp @@ -4,14 +4,14 @@ #include osgParticle::Emitter::Emitter() -: ParticleProcessor(), +: ParticleProcessor(), _usedeftemp(true) { } osgParticle::Emitter::Emitter(const Emitter& copy, const osg::CopyOp& copyop) : ParticleProcessor(copy, copyop), - _usedeftemp(copy._usedeftemp), + _usedeftemp(copy._usedeftemp), _ptemp(copy._ptemp) { } diff --git a/src/osgParticle/ExplosionDebrisEffect.cpp b/src/osgParticle/ExplosionDebrisEffect.cpp index da52540ee..87b316b92 100644 --- a/src/osgParticle/ExplosionDebrisEffect.cpp +++ b/src/osgParticle/ExplosionDebrisEffect.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,28 +29,28 @@ ExplosionDebrisEffect::ExplosionDebrisEffect(bool automaticSetup): ParticleEffect(automaticSetup) { setDefaults(); - + _position.set(0.0f,0.0f,0.0f); _scale = 1.0f; _intensity = 1.0f; - + _emitterDuration = 0.1; _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); - + if (_automaticSetup) buildEffect(); } ExplosionDebrisEffect::ExplosionDebrisEffect(const osg::Vec3& position, float scale, float intensity) { setDefaults(); - + _position = position; _scale = scale; _intensity = intensity; - + _emitterDuration = 0.1; _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); - + if (_automaticSetup) buildEffect(); } @@ -63,16 +63,16 @@ ExplosionDebrisEffect::ExplosionDebrisEffect(const ExplosionDebrisEffect& copy, void ExplosionDebrisEffect::setDefaults() { ParticleEffect::setDefaults(); - - _textureFileName = "Images/particle.rgb"; + + _textureFileName = "Images/particle.rgb"; _emitterDuration = 0.1; - + // set up unit particle. - _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); + _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); _defaultParticleTemplate.setSizeRange(osgParticle::rangef(0.75f, 3.0f)); _defaultParticleTemplate.setAlphaRange(osgParticle::rangef(0.0f, 1.0f)); _defaultParticleTemplate.setColorRange(osgParticle::rangev4( - osg::Vec4(0.5f, 0.5f, 0.0f, 1.0f), + osg::Vec4(0.5f, 0.5f, 0.0f, 1.0f), osg::Vec4(0.2f, 0.2f, 0.2f, 0.5f))); } @@ -92,12 +92,12 @@ void ExplosionDebrisEffect::setUpEmitterAndProgram() osgParticle::Particle& ptemplate = _particleSystem->getDefaultParticleTemplate(); - float radius = 0.05f*_scale; + float radius = 0.05f*_scale; float density = 1000.0f; // 1000.0kg/m^3 ptemplate.setLifeTime(_defaultParticleTemplate.getLifeTime()); - // the following ranges set the envelope of the respective + // the following ranges set the envelope of the respective // graphical properties in time. ptemplate.setSizeRange(osgParticle::rangef(radius*_defaultParticleTemplate.getSizeRange().minimum, radius*_defaultParticleTemplate.getSizeRange().maximum)); @@ -154,15 +154,15 @@ void ExplosionDebrisEffect::setUpEmitterAndProgram() // set up program. if (!_program) - { + { _program = new osgParticle::FluidProgram; } - + if (_program.valid()) { _program->setParticleSystem(_particleSystem.get()); _program->setWind(_wind); } - + } - + diff --git a/src/osgParticle/ExplosionEffect.cpp b/src/osgParticle/ExplosionEffect.cpp index c15a39d07..54fbe1de3 100644 --- a/src/osgParticle/ExplosionEffect.cpp +++ b/src/osgParticle/ExplosionEffect.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,26 +31,26 @@ ExplosionEffect::ExplosionEffect(bool automaticSetup): ParticleEffect(automaticSetup) { setDefaults(); - + _position.set(0.0f,0.0f,0.0f); _scale = 1.0f; _intensity = 1.0f; - + _emitterDuration = 1.0; - + if (_automaticSetup) buildEffect(); } ExplosionEffect::ExplosionEffect(const osg::Vec3& position, float scale, float intensity) { setDefaults(); - + _position = position; _scale = scale; _intensity = intensity; - + _emitterDuration = 1.0; - + if (_automaticSetup) buildEffect(); } @@ -63,8 +63,8 @@ ExplosionEffect::ExplosionEffect(const ExplosionEffect& copy, const osg::CopyOp& void ExplosionEffect::setDefaults() { ParticleEffect::setDefaults(); - - _textureFileName = "Images/smoke.rgb"; + + _textureFileName = "Images/smoke.rgb"; _emitterDuration = 1.0; // set up unit particle. @@ -72,7 +72,7 @@ void ExplosionEffect::setDefaults() _defaultParticleTemplate.setSizeRange(osgParticle::rangef(0.75f, 3.0f)); _defaultParticleTemplate.setAlphaRange(osgParticle::rangef(0.1f, 1.0f)); _defaultParticleTemplate.setColorRange(osgParticle::rangev4( - osg::Vec4(1.0f, 0.8f, 0.2f, 1.0f), + osg::Vec4(1.0f, 0.8f, 0.2f, 1.0f), osg::Vec4(1.0f, 0.4f, 0.1f, 0.0f))); } @@ -92,12 +92,12 @@ void ExplosionEffect::setUpEmitterAndProgram() osgParticle::Particle& ptemplate = _particleSystem->getDefaultParticleTemplate(); - float radius = 0.4f*_scale; + float radius = 0.4f*_scale; float density = 1.2f; // 1.0kg/m^3 ptemplate.setLifeTime(_defaultParticleTemplate.getLifeTime()); - // the following ranges set the envelope of the respective + // the following ranges set the envelope of the respective // graphical properties in time. ptemplate.setSizeRange(osgParticle::rangef(radius*_defaultParticleTemplate.getSizeRange().minimum, radius*_defaultParticleTemplate.getSizeRange().maximum)); @@ -108,7 +108,7 @@ void ExplosionEffect::setUpEmitterAndProgram() ptemplate.setRadius(radius); ptemplate.setMass(density*radius*radius*radius*osg::PI*4.0f/3.0f); - } + } // set up emitter @@ -154,15 +154,15 @@ void ExplosionEffect::setUpEmitterAndProgram() // set up the program if (!_program) - { + { _program = new osgParticle::FluidProgram; } - + if (_program.valid()) { _program->setParticleSystem(_particleSystem.get()); _program->setWind(_wind); } - + } - + diff --git a/src/osgParticle/FireEffect.cpp b/src/osgParticle/FireEffect.cpp index 5a3c25425..0c6842bc6 100644 --- a/src/osgParticle/FireEffect.cpp +++ b/src/osgParticle/FireEffect.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -30,28 +30,28 @@ FireEffect::FireEffect(bool automaticSetup): ParticleEffect(automaticSetup) { setDefaults(); - + _position.set(0.0f,0.0f,0.0f); _scale = 1.0f; _intensity = 1.0f; - + _emitterDuration = 60.0; _defaultParticleTemplate.setLifeTime(0.5+0.1*_scale); - + if (_automaticSetup) buildEffect(); } FireEffect::FireEffect(const osg::Vec3& position, float scale, float intensity) { setDefaults(); - + _position = position; _scale = scale; _intensity = intensity; - + _emitterDuration = 60.0; _defaultParticleTemplate.setLifeTime(0.5+0.1*_scale); - + if (_automaticSetup) buildEffect(); } @@ -64,8 +64,8 @@ FireEffect::FireEffect(const FireEffect& copy, const osg::CopyOp& copyop): void FireEffect::setDefaults() { ParticleEffect::setDefaults(); - - _textureFileName = "Images/smoke.rgb"; + + _textureFileName = "Images/smoke.rgb"; _emitterDuration = 60.0; // set up unit particle. @@ -73,7 +73,7 @@ void FireEffect::setDefaults() _defaultParticleTemplate.setSizeRange(osgParticle::rangef(0.75f, 3.0f)); _defaultParticleTemplate.setAlphaRange(osgParticle::rangef(0.1f, 1.0f)); _defaultParticleTemplate.setColorRange(osgParticle::rangev4( - osg::Vec4(1, 0.8f, 0.2f, 1.0f), + osg::Vec4(1, 0.8f, 0.2f, 1.0f), osg::Vec4(1, 0.3f, 0.2f, 0.0f))); } @@ -92,12 +92,12 @@ void FireEffect::setUpEmitterAndProgram() osgParticle::Particle& ptemplate = _particleSystem->getDefaultParticleTemplate(); - float radius = 0.25f*_scale; + float radius = 0.25f*_scale; float density = 0.5f; // 0.5kg/m^3 ptemplate.setLifeTime(_defaultParticleTemplate.getLifeTime()); - // the following ranges set the envelope of the respective + // the following ranges set the envelope of the respective // graphical properties in time. ptemplate.setSizeRange(osgParticle::rangef(radius*_defaultParticleTemplate.getSizeRange().minimum, radius*_defaultParticleTemplate.getSizeRange().maximum)); @@ -157,10 +157,10 @@ void FireEffect::setUpEmitterAndProgram() // set up program. if (!_program) - { + { _program = new osgParticle::FluidProgram; } - + if (_program.valid()) { _program->setParticleSystem(_particleSystem.get()); diff --git a/src/osgParticle/FluidFrictionOperator.cpp b/src/osgParticle/FluidFrictionOperator.cpp index 89e550096..32ed51c57 100644 --- a/src/osgParticle/FluidFrictionOperator.cpp +++ b/src/osgParticle/FluidFrictionOperator.cpp @@ -20,7 +20,7 @@ osgParticle::FluidFrictionOperator::FluidFrictionOperator(const FluidFrictionOpe : Operator(copy, copyop), _coeff_A(copy._coeff_A), _coeff_B(copy._coeff_B), - _density(copy._density), + _density(copy._density), _viscosity(copy._viscosity), _ovr_rad(copy._ovr_rad), _current_program(0) @@ -34,9 +34,9 @@ void osgParticle::FluidFrictionOperator::operate(Particle* P, double dt) float vm = v.normalize(); float R = _coeff_A * r * vm + _coeff_B * r * r * vm * vm; - + osg::Vec3 Fr(-R * v.x(), -R * v.y(), -R * v.z()); - + #if 0 // Commenting out rotation of force vector rotation from local to world as the particle velocity itself // should already be in world coords so shouldn't need rotating. diff --git a/src/osgParticle/FluidProgram.cpp b/src/osgParticle/FluidProgram.cpp index 63cec8624..a889bcc55 100644 --- a/src/osgParticle/FluidProgram.cpp +++ b/src/osgParticle/FluidProgram.cpp @@ -30,12 +30,12 @@ void osgParticle::FluidProgram::execute(double dt) float radius = particle->getRadius(); float Area = osg::PI*radius*radius; float Volume = Area*radius*four_over_three; - + // compute force due to gravity + boyancy of displacing the fluid that the particle is emersed in. osg::Vec3 accel_gravity = _acceleration * ((particle->getMass() - _density*Volume) * particle->getMassInv()); - + // compute force due to friction - osg::Vec3 relative_wind = particle->getVelocity()-_wind; + osg::Vec3 relative_wind = particle->getVelocity()-_wind; osg::Vec3 wind_force = - relative_wind * Area * (_viscosityCoefficient + _densityCoefficient*relative_wind.length()); osg::Vec3 wind_accel = wind_force * particle->getMassInv(); @@ -48,7 +48,7 @@ void osgParticle::FluidProgram::execute(double dt) } particle->addVelocity(accel_gravity*dt + wind_accel*compenstated_dt); - + } } diff --git a/src/osgParticle/ModularEmitter.cpp b/src/osgParticle/ModularEmitter.cpp index ed114b79e..0cd708f88 100644 --- a/src/osgParticle/ModularEmitter.cpp +++ b/src/osgParticle/ModularEmitter.cpp @@ -11,12 +11,12 @@ osgParticle::ModularEmitter::ModularEmitter() _shooter(new RadialShooter) { } - + osgParticle::ModularEmitter::ModularEmitter(const ModularEmitter& copy, const osg::CopyOp& copyop): Emitter(copy, copyop), _numParticleToCreateMovementCompensationRatio(copy._numParticleToCreateMovementCompensationRatio), - _counter(static_cast(copyop(copy._counter.get()))), - _placer(static_cast(copyop(copy._placer.get()))), + _counter(static_cast(copyop(copy._counter.get()))), + _placer(static_cast(copyop(copy._placer.get()))), _shooter(static_cast(copyop(copy._shooter.get()))) { } @@ -51,7 +51,7 @@ void osgParticle::ModularEmitter::emitParticles(double dt) osg::Vec3d currentPosition = controlPosition * ltw; float distance = (currentPosition-previousPosition).length(); - float size = getUseDefaultTemplate() ? + float size = getUseDefaultTemplate() ? getParticleSystem()->getDefaultParticleTemplate().getSizeRange().minimum : getParticleTemplate().getSizeRange().minimum; @@ -61,7 +61,7 @@ void osgParticle::ModularEmitter::emitParticles(double dt) n = osg::maximum(n, int(rounded_down) + (((float) rand() < remainder * (float)RAND_MAX) ? 1 : 0)); } - + for (int i=0; icreateParticle(getUseDefaultTemplate()? 0: &getParticleTemplate()); @@ -69,14 +69,14 @@ void osgParticle::ModularEmitter::emitParticles(double dt) { _placer->place(P); _shooter->shoot(P); - + // Now need to transform the position and velocity because we having a moving model. float r = ((float)rand()/(float)RAND_MAX); P->transformPositionVelocity(emitterToPs, prevEmitterToPs, r); //P->transformPositionVelocity(ltw); - + if (cps) P->setUpTexCoordsAsPartOfConnectedParticleSystem(cps); - + } else { diff --git a/src/osgParticle/ModularProgram.cpp b/src/osgParticle/ModularProgram.cpp index 6977e7e0f..1ed5fa325 100644 --- a/src/osgParticle/ModularProgram.cpp +++ b/src/osgParticle/ModularProgram.cpp @@ -23,7 +23,7 @@ void osgParticle::ModularProgram::execute(double dt) Operator_vector::iterator ci_end = _operators.end(); ParticleSystem* ps = getParticleSystem(); - for (ci=_operators.begin(); ci!=ci_end; ++ci) { + for (ci=_operators.begin(); ci!=ci_end; ++ci) { (*ci)->beginOperate(this); (*ci)->operateParticles(ps, dt); (*ci)->endOperate(); diff --git a/src/osgParticle/MultiSegmentPlacer.cpp b/src/osgParticle/MultiSegmentPlacer.cpp index a7323fb96..68dec8989 100644 --- a/src/osgParticle/MultiSegmentPlacer.cpp +++ b/src/osgParticle/MultiSegmentPlacer.cpp @@ -8,7 +8,7 @@ osgParticle::MultiSegmentPlacer::MultiSegmentPlacer() : Placer(), _total_length(0) { } - + osgParticle::MultiSegmentPlacer::MultiSegmentPlacer(const MultiSegmentPlacer& copy, const osg::CopyOp& copyop) : Placer(copy, copyop), _vx(copy._vx), _total_length(copy._total_length) { @@ -18,13 +18,13 @@ void osgParticle::MultiSegmentPlacer::recompute_length() { Vertex_vector::iterator i; Vertex_vector::iterator i0 = _vx.begin(); - + _total_length = 0; for (i=_vx.begin(); i!=_vx.end(); ++i) { _total_length += (i->first - i0->first).length(); i->second = _total_length; - i0 = i; + i0 = i; } } @@ -32,7 +32,7 @@ void osgParticle::MultiSegmentPlacer::place(Particle* P) const { if (_vx.size() >= 2) { float x = rangef(0, _total_length).get_random(); - + Vertex_vector::const_iterator i; Vertex_vector::const_iterator i0 = _vx.begin(); const Vertex_vector::const_iterator vend = _vx.end(); @@ -46,7 +46,7 @@ void osgParticle::MultiSegmentPlacer::place(Particle* P) const return; } i0 = i; - } + } } else { diff --git a/src/osgParticle/Particle.cpp b/src/osgParticle/Particle.cpp index 90a6a9537..c978ed7b0 100644 --- a/src/osgParticle/Particle.cpp +++ b/src/osgParticle/Particle.cpp @@ -25,8 +25,8 @@ osgParticle::Particle::Particle() _sr(0.2f, 0.2f), _ar(1, 0), _cr(osg::Vec4(1, 1, 1, 1), osg::Vec4(1, 1, 1, 1)), - _si(new LinearInterpolator), - _ai(new LinearInterpolator), + _si(new LinearInterpolator), + _ai(new LinearInterpolator), _ci(new LinearInterpolator), _mustdie(false), _lifeTime(2), @@ -65,7 +65,7 @@ bool osgParticle::Particle::update(double dt, bool onlyTimeStamp) return false; } - double x = 0; + double x = 0; // if we don't live forever, compute our normalized age. if (_lifeTime > 0) { @@ -79,7 +79,7 @@ bool osgParticle::Particle::update(double dt, bool onlyTimeStamp) _alive = -1.0; return false; } - + // compute the current values for size, alpha and color. if (_lifeTime <= 0) { if (dt == _t0) { @@ -92,29 +92,29 @@ bool osgParticle::Particle::update(double dt, bool onlyTimeStamp) _current_alpha = _ai.get()->interpolate(x, _ar); _current_color = _ci.get()->interpolate(x, _cr); } - + // update position _prev_pos = _position; _position += _velocity * dt; - + // return now if we indicate that only time stamp should be updated // the shader will handle remain properties in this case if (onlyTimeStamp) return true; //Compute the current texture tile based on our normalized age int currentTile = _start_tile + static_cast(x * getNumTiles()); - + //If the current texture tile is different from previous, then compute new texture coords if(currentTile != _cur_tile) { - + _cur_tile = currentTile; _s_coord = _s_tile * fmod(_cur_tile , 1.0 / _s_tile); _t_coord = 1.0 - _t_tile * (static_cast(_cur_tile * _t_tile) + 1); // OSG_NOTICE< program = getProgram(); osg::ref_ptr particleSystem = getParticleSystem(); - if (!emitter || !particleSystem || !program) return; + if (!emitter || !particleSystem || !program) return; // clear the children. removeChildren(0,getNumChildren()); - + // add the emitter addChild(emitter.get()); - + // add the program to update the particles addChild(program.get()); @@ -165,7 +165,7 @@ void ParticleEffect::buildEffect() if (_useLocalParticleSystem) { particleSystem->setParticleScaleReferenceFrame(ParticleSystem::LOCAL_COORDINATES); - + // add the geode to the scene graph osg::Geode* geode = new osg::Geode; geode->addDrawable(particleSystem.get()); diff --git a/src/osgParticle/ParticleProcessor.cpp b/src/osgParticle/ParticleProcessor.cpp index 534c9bd2b..00f56dd44 100644 --- a/src/osgParticle/ParticleProcessor.cpp +++ b/src/osgParticle/ParticleProcessor.cpp @@ -66,7 +66,7 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) { ParticleSystem::ScopedWriteLock lock(*(_ps->getReadWriteMutex())); - //added- 1/17/06- bgandere@nps.edu + //added- 1/17/06- bgandere@nps.edu //a check to make sure we havent updated yet this frame if(_frameNumber < nv.getFrameStamp()->getFrameNumber()) { @@ -81,7 +81,7 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) _currentTime = 0; _t0 = -1; } - + // skip if we haven't initialized _t0 yet if (_t0 != -1) { @@ -93,21 +93,21 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) if (_endless || (_currentTime < (_startTime + _lifeTime))) alive = true; } - + // update current time _currentTime += t - _t0; - + // process only if the particle system is not frozen/culled - if (alive && - _enabled && - !_ps->isFrozen() && + if (alive && + _enabled && + !_ps->isFrozen() && ((_ps->getLastFrameNumber()+1) >= (nv.getFrameStamp()->getFrameNumber()) || !_ps->getFreezeOnCull())) { // initialize matrix flags _need_ltw_matrix = true; _need_wtl_matrix = true; _current_nodevisitor = &nv; - + // do some process (unimplemented in this base class) process( t - _t0 ); } else { @@ -120,8 +120,8 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) _t0 = t; } - //added- 1/17/06- bgandere@nps.edu - //updates the _frameNumber, keeping it current + //added- 1/17/06- bgandere@nps.edu + //updates the _frameNumber, keeping it current _frameNumber = nv.getFrameStamp()->getFrameNumber(); } else @@ -129,7 +129,7 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) OSG_WARN << "osgParticle::ParticleProcessor::traverse(NodeVisitor&) requires a valid FrameStamp to function, particles not updated.\n"; } - } else + } else { OSG_WARN << "ParticleProcessor \"" << getName() << "\": invalid particle system\n"; } diff --git a/src/osgParticle/ParticleSystem.cpp b/src/osgParticle/ParticleSystem.cpp index 1a98498e2..99fccf2bf 100644 --- a/src/osgParticle/ParticleSystem.cpp +++ b/src/osgParticle/ParticleSystem.cpp @@ -30,7 +30,7 @@ static double distance(const osg::Vec3& coord, const osg::Matrix& matrix) } osgParticle::ParticleSystem::ParticleSystem() -: osg::Drawable(), +: osg::Drawable(), _def_bbox(osg::Vec3(-10, -10, -10), osg::Vec3(10, 10, 10)), _alignment(BILLBOARD), _align_X_axis(1, 0, 0), @@ -41,8 +41,8 @@ osgParticle::ParticleSystem::ParticleSystem() _dirty_uniforms(false), _doublepass(false), _frozen(false), - _bmin(0, 0, 0), - _bmax(0, 0, 0), + _bmin(0, 0, 0), + _bmax(0, 0, 0), _reset_bounds_flag(false), _bounds_computed(false), _def_ptemp(Particle()), @@ -62,7 +62,7 @@ osgParticle::ParticleSystem::ParticleSystem() } osgParticle::ParticleSystem::ParticleSystem(const ParticleSystem& copy, const osg::CopyOp& copyop) -: osg::Drawable(copy, copyop), +: osg::Drawable(copy, copyop), _def_bbox(copy._def_bbox), _alignment(copy._alignment), _align_X_axis(copy._align_X_axis), @@ -73,8 +73,8 @@ osgParticle::ParticleSystem::ParticleSystem(const ParticleSystem& copy, const os _dirty_uniforms(copy._dirty_uniforms), _doublepass(copy._doublepass), _frozen(copy._frozen), - _bmin(copy._bmin), - _bmax(copy._bmax), + _bmin(copy._bmin), + _bmax(copy._bmax), _reset_bounds_flag(copy._reset_bounds_flag), _bounds_computed(copy._bounds_computed), _def_ptemp(copy._def_ptemp), @@ -107,7 +107,7 @@ void osgParticle::ParticleSystem::update(double dt, osg::NodeVisitor& nv) // At present, our lcoal shader implementation will ignore these particle props: // _cur_tile, _s_coord, _t_coord, _prev_pos, _prev_angle and _angle osg::StateSet* stateset = getOrCreateStateSet(); - + if (_dirty_uniforms) { osg::Uniform* u_vd = stateset->getUniform("visibilityDistance"); @@ -115,7 +115,7 @@ void osgParticle::ParticleSystem::update(double dt, osg::NodeVisitor& nv) _dirty_uniforms = false; } } - + for(unsigned int i=0; i<_particles.size(); ++i) { Particle& particle = _particles[i]; @@ -131,7 +131,7 @@ void osgParticle::ParticleSystem::update(double dt, osg::NodeVisitor& nv) } } } - + if (_sortMode != NO_SORT) { // sort particles @@ -151,7 +151,7 @@ void osgParticle::ParticleSystem::update(double dt, osg::NodeVisitor& nv) std::sort(_particles.begin(), _particles.end()); } } - + // force recomputing of bounding box on next frame dirtyBound(); } @@ -165,19 +165,19 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo // update the frame count, so other objects can detect when // this particle system is culled _last_frame = state.getFrameStamp()->getFrameNumber(); - + // update the dirty flag of delta time, so next time a new request for delta time // will automatically cause recomputing _dirty_dt = true; - + // get the current modelview matrix osg::Matrix modelview = state.getModelViewMatrix(); // set up depth mask for first rendering pass #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) - glPushAttrib(GL_DEPTH_BUFFER_BIT); + glPushAttrib(GL_DEPTH_BUFFER_BIT); #endif - + glDepthMask(GL_FALSE); // render, first pass @@ -192,7 +192,7 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo #endif // render, second pass - if (_doublepass) { + if (_doublepass) { // set up color mask for second rendering pass #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) glPushAttrib(GL_COLOR_BUFFER_BIT); @@ -236,7 +236,7 @@ void osgParticle::ParticleSystem::setDefaultAttributes(const std::string& textur texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR); texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::MIRROR); - texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR); + texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR); stateset->setTextureAttributeAndModes(texture_unit, texture, osg::StateAttribute::ON); osg::TexEnv *texenv = new osg::TexEnv; @@ -245,7 +245,7 @@ void osgParticle::ParticleSystem::setDefaultAttributes(const std::string& textur } osg::BlendFunc *blend = new osg::BlendFunc; - if (emissive_particles) { + if (emissive_particles) { blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE); } else { blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA); @@ -262,16 +262,16 @@ void osgParticle::ParticleSystem::setDefaultAttributesUsingShaders(const std::st { osg::StateSet *stateset = new osg::StateSet; stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); - + osg::PointSprite *sprite = new osg::PointSprite; stateset->setTextureAttributeAndModes(texture_unit, sprite, osg::StateAttribute::ON); - + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) stateset->setMode(GL_VERTEX_PROGRAM_POINT_SIZE, osg::StateAttribute::ON); #else OSG_NOTICE<<"Warning: ParticleSystem::setDefaultAttributesUsingShaders(..) not fully implemented."<setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR); texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::MIRROR); - texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR); + texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR); stateset->setTextureAttributeAndModes(texture_unit, texture, osg::StateAttribute::ON); } - + osg::BlendFunc *blend = new osg::BlendFunc; if (emissive_particles) - { + { blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE); } else @@ -293,7 +293,7 @@ void osgParticle::ParticleSystem::setDefaultAttributesUsingShaders(const std::st blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA); } stateset->setAttributeAndModes(blend, osg::StateAttribute::ON); - + osg::Program *program = new osg::Program; #ifdef USE_LOCAL_SHADERS char vertexShaderSource[] = @@ -337,11 +337,11 @@ void osgParticle::ParticleSystem::setDefaultAttributesUsingShaders(const std::st program->addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, osgDB::findDataFile("shaders/particle.frag"))); #endif stateset->setAttributeAndModes(program, osg::StateAttribute::ON); - + stateset->addUniform(new osg::Uniform("visibilityDistance", (float)_visibilityDistance)); stateset->addUniform(new osg::Uniform("baseTexture", texture_unit)); setStateSet(stateset); - + setUseVertexArray(true); setUseShaders(true); } @@ -383,10 +383,10 @@ void osgParticle::ParticleSystem::single_pass_render(osg::RenderInfo& renderInfo xScale = 1.0f/lengthX2; yScale = 1.0f/lengthY2; } - + scaled_aligned_xAxis *= xScale; scaled_aligned_yAxis *= yScale; - + xAxis *= xScale; yAxis *= yScale; } @@ -403,15 +403,15 @@ void osgParticle::ParticleSystem::single_pass_render(osg::RenderInfo& renderInfo // Enable writing depth mask when drawing user-defined particles glDepthMask(GL_TRUE); } - + for(unsigned int i=0; i<_particles.size(); i+=_detail) { const Particle* currentParticle = &_particles[i]; - + bool insideDistance = true; if (_sortMode != NO_SORT && _visibilityDistance>0.0) insideDistance = (currentParticle->getDepth()>=0.0 && currentParticle->getDepth()<=_visibilityDistance); - + if (currentParticle->isAlive() && insideDistance) { if (currentParticle->getShape() != startParticle->getShape()) @@ -428,7 +428,7 @@ void osgParticle::ParticleSystem::single_pass_render(osg::RenderInfo& renderInfo glDepthMask(GL_TRUE); } ++_draw_count; - + if (currentParticle->getShape() == Particle::USER) { if (requiresEndRender) @@ -439,22 +439,22 @@ void osgParticle::ParticleSystem::single_pass_render(osg::RenderInfo& renderInfo currentParticle->render(renderInfo, currentParticle->getPosition(), currentParticle->getAngle()); continue; } - + const osg::Vec3& angle = currentParticle->getAngle(); bool requiresRotation = (angle.x()!=0.0f || angle.y()!=0.0f || angle.z()!=0.0f); if (requiresRotation) { osg::Matrix R; R.makeRotate( - angle.x(), osg::Vec3(1, 0, 0), - angle.y(), osg::Vec3(0, 1, 0), + angle.x(), osg::Vec3(1, 0, 0), + angle.y(), osg::Vec3(0, 1, 0), angle.z(), osg::Vec3(0, 0, 1)); if (_alignment==BILLBOARD) { xAxis = osg::Matrix::transform3x3(R,scaled_aligned_xAxis); xAxis = osg::Matrix::transform3x3(modelview,xAxis); - + yAxis = osg::Matrix::transform3x3(R,scaled_aligned_yAxis); yAxis = osg::Matrix::transform3x3(modelview,yAxis); @@ -472,7 +472,7 @@ void osgParticle::ParticleSystem::single_pass_render(osg::RenderInfo& renderInfo { currentParticle->render(gl,currentParticle->getPosition(), xAxis, yAxis, scale); } - } + } } if (requiresEndRender) @@ -482,7 +482,7 @@ void osgParticle::ParticleSystem::single_pass_render(osg::RenderInfo& renderInfo void osgParticle::ParticleSystem::render_vertex_array(osg::RenderInfo& renderInfo) const { if (_particles.size() <= 0) return; - + // Compute the pointer and offsets Particle_vector::const_iterator itr = _particles.begin(); float* ptr = (float*)(&(*itr)); @@ -496,7 +496,7 @@ void osgParticle::ParticleSystem::render_vertex_array(osg::RenderInfo& renderInf GLsizei colorOffset = (float*)(&(itr->_current_color)) - ptr; // Color GLsizei velOffset = (float*)(&(itr->_velocity)) - ptr; // Velocity GLsizei propOffset = (float*)(&(itr->_alive)) - ptr; // Alive, size & alpha - + // Draw particles as arrays osg::State& state = *renderInfo.getState(); state.lazyDisablingOfVertexAttributes(); @@ -512,7 +512,7 @@ void osgParticle::ParticleSystem::render_vertex_array(osg::RenderInfo& renderInf } osg::BoundingBox osgParticle::ParticleSystem::computeBound() const -{ +{ if (!_bounds_computed) { return _def_bbox; diff --git a/src/osgParticle/ParticleSystemUpdater.cpp b/src/osgParticle/ParticleSystemUpdater.cpp index a888a607b..1c826e870 100644 --- a/src/osgParticle/ParticleSystemUpdater.cpp +++ b/src/osgParticle/ParticleSystemUpdater.cpp @@ -23,14 +23,14 @@ osgParticle::ParticleSystemUpdater::ParticleSystemUpdater(const ParticleSystemUp void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor& nv) { osgUtil::CullVisitor *cv = dynamic_cast(&nv); - if (cv) + if (cv) { if (nv.getFrameStamp()) { if( _frameNumber < nv.getFrameStamp()->getFrameNumber()) { _frameNumber = nv.getFrameStamp()->getFrameNumber(); - + double t = nv.getFrameStamp()->getSimulationTime(); if (_t0 != -1.0) { @@ -38,9 +38,9 @@ void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor& nv) for (i=_psv.begin(); i!=_psv.end(); ++i) { ParticleSystem* ps = i->get(); - + ParticleSystem::ScopedWriteLock lock(*(ps->getReadWriteMutex())); - + if (!ps->isFrozen() && (ps->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !ps->getFreezeOnCull())) { ps->update(t - _t0, nv); diff --git a/src/osgParticle/PrecipitationEffect.cpp b/src/osgParticle/PrecipitationEffect.cpp index 35cf404fc..eb199da62 100644 --- a/src/osgParticle/PrecipitationEffect.cpp +++ b/src/osgParticle/PrecipitationEffect.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -39,7 +39,7 @@ PrecipitationEffect::PrecipitationEffect(): _previousFrameTime(FLT_MAX) { setNumChildrenRequiringUpdateTraversal(1); - + setUpGeometries(1024); rain(0.5); @@ -81,7 +81,7 @@ void PrecipitationEffect::rain(float intensity) _cellSize.set(5.0f / (0.25f+intensity), 5.0f / (0.25f+intensity), 5.0f); _nearTransition = 25.f; _farTransition = 100.0f - 60.0f*sqrtf(intensity); - + if (!_fog) _fog = new osg::Fog; _fog->setMode(osg::Fog::EXP); @@ -89,7 +89,7 @@ void PrecipitationEffect::rain(float intensity) _fog->setColor(osg::Vec4(0.5, 0.5, 0.5, 1.0)); _useFarLineSegments = false; - + _dirty = true; update(); @@ -105,7 +105,7 @@ void PrecipitationEffect::snow(float intensity) _cellSize.set(5.0f / (0.25f+intensity), 5.0f / (0.25f+intensity), 5.0f); _nearTransition = 25.f; _farTransition = 100.0f - 60.0f*sqrtf(intensity); - + if (!_fog) _fog = new osg::Fog; _fog->setMode(osg::Fog::EXP); @@ -113,7 +113,7 @@ void PrecipitationEffect::snow(float intensity) _fog->setColor(osg::Vec4(0.6, 0.6, 0.6, 1.0)); _useFarLineSegments = false; - + _dirty = true; update(); @@ -121,19 +121,19 @@ void PrecipitationEffect::snow(float intensity) void PrecipitationEffect::compileGLObjects(osg::RenderInfo& renderInfo) const { - if (_quadGeometry.valid()) + if (_quadGeometry.valid()) { _quadGeometry->compileGLObjects(renderInfo); if (_quadGeometry->getStateSet()) _quadGeometry->getStateSet()->compileGLObjects(*renderInfo.getState()); } - if (_lineGeometry.valid()) + if (_lineGeometry.valid()) { _lineGeometry->compileGLObjects(renderInfo); if (_lineGeometry->getStateSet()) _lineGeometry->getStateSet()->compileGLObjects(*renderInfo.getState()); } - if (_pointGeometry.valid()) + if (_pointGeometry.valid()) { _pointGeometry->compileGLObjects(renderInfo); if (_pointGeometry->getStateSet()) _pointGeometry->getStateSet()->compileGLObjects(*renderInfo.getState()); @@ -146,7 +146,7 @@ void PrecipitationEffect::traverse(osg::NodeVisitor& nv) if (nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) { if (_dirty) update(); - + if (nv.getFrameStamp()) { double currentTime = nv.getFrameStamp()->getSimulationTime(); @@ -159,7 +159,7 @@ void PrecipitationEffect::traverse(osg::NodeVisitor& nv) return; } - + if (nv.getVisitorType() == osg::NodeVisitor::NODE_VISITOR) { if (_dirty) update(); @@ -172,10 +172,10 @@ void PrecipitationEffect::traverse(osg::NodeVisitor& nv) compileGLObjects(globjVisitor->getRenderInfo()); } } - + return; } - + if (nv.getVisitorType() != osg::NodeVisitor::CULL_VISITOR) { @@ -189,14 +189,14 @@ void PrecipitationEffect::traverse(osg::NodeVisitor& nv) } ViewIdentifier viewIndentifier(cv, nv.getNodePath()); - + { PrecipitationDrawableSet* precipitationDrawableSet = 0; - + { OpenThreads::ScopedLock lock(_mutex); precipitationDrawableSet = &(_viewDrawableMap[viewIndentifier]); - + if (!precipitationDrawableSet->_quadPrecipitationDrawable) { precipitationDrawableSet->_quadPrecipitationDrawable = new PrecipitationDrawable; @@ -218,30 +218,30 @@ void PrecipitationEffect::traverse(osg::NodeVisitor& nv) precipitationDrawableSet->_pointPrecipitationDrawable->setDrawType(GL_POINTS); } } - + cull(*precipitationDrawableSet, cv); - + cv->pushStateSet(_stateset.get()); float depth = 0.0f; if (!precipitationDrawableSet->_quadPrecipitationDrawable->getCurrentCellMatrixMap().empty()) { cv->pushStateSet(precipitationDrawableSet->_quadPrecipitationDrawable->getStateSet()); - cv->addDrawableAndDepth(precipitationDrawableSet->_quadPrecipitationDrawable.get(),cv->getModelViewMatrix(),depth); + cv->addDrawableAndDepth(precipitationDrawableSet->_quadPrecipitationDrawable.get(),cv->getModelViewMatrix(),depth); cv->popStateSet(); } if (!precipitationDrawableSet->_linePrecipitationDrawable->getCurrentCellMatrixMap().empty()) { cv->pushStateSet(precipitationDrawableSet->_linePrecipitationDrawable->getStateSet()); - cv->addDrawableAndDepth(precipitationDrawableSet->_linePrecipitationDrawable.get(),cv->getModelViewMatrix(),depth); + cv->addDrawableAndDepth(precipitationDrawableSet->_linePrecipitationDrawable.get(),cv->getModelViewMatrix(),depth); cv->popStateSet(); } if (!precipitationDrawableSet->_pointPrecipitationDrawable->getCurrentCellMatrixMap().empty()) { cv->pushStateSet(precipitationDrawableSet->_pointPrecipitationDrawable->getStateSet()); - cv->addDrawableAndDepth(precipitationDrawableSet->_pointPrecipitationDrawable.get(),cv->getModelViewMatrix(),depth); + cv->addDrawableAndDepth(precipitationDrawableSet->_pointPrecipitationDrawable.get(),cv->getModelViewMatrix(),depth); cv->popStateSet(); } @@ -270,16 +270,16 @@ void PrecipitationEffect::update() _inverse_du.set(1.0f/length_u, 0.0f, 0.0f); _inverse_dv.set(0.0f, 1.0f/length_v, 0.0f); _inverse_dw.set(0.0f, 0.0f, 1.0f/length_w); - + OSG_INFO<<"Cell size X="<set(_particleSize); } - + } -void PrecipitationEffect::createGeometry(unsigned int numParticles, - osg::Geometry* quad_geometry, +void PrecipitationEffect::createGeometry(unsigned int numParticles, + osg::Geometry* quad_geometry, osg::Geometry* line_geometry, osg::Geometry* point_geometry) { @@ -330,7 +330,7 @@ void PrecipitationEffect::createGeometry(unsigned int numParticles, osg::Vec2 offset10(1.0f,0.0f); osg::Vec2 offset01(0.0f,1.0f); osg::Vec2 offset11(1.0f,1.0f); - + osg::Vec2 offset0(0.5f,0.0f); osg::Vec2 offset1(0.5f,1.0f); @@ -343,7 +343,7 @@ void PrecipitationEffect::createGeometry(unsigned int numParticles, if (quad_geometry) { quad_geometry->setName("quad"); - + quad_vertices = new osg::Vec3Array(numParticles*4); quad_offsets = new osg::Vec2Array(numParticles*4); @@ -383,7 +383,7 @@ void PrecipitationEffect::createGeometry(unsigned int numParticles, for(unsigned int i=0; i< numParticles; ++i) { osg::Vec3 pos( random(0.0f, 1.0f), random(0.0f, 1.0f), random(0.0f, 1.0f)); - + // quad particles if (quad_vertices) { @@ -396,7 +396,7 @@ void PrecipitationEffect::createGeometry(unsigned int numParticles, (*quad_offsets)[i*4+2] = offset11; (*quad_offsets)[i*4+3] = offset10; } - + // line particles if (line_vertices) { @@ -405,7 +405,7 @@ void PrecipitationEffect::createGeometry(unsigned int numParticles, (*line_offsets)[i*2] = offset0; (*line_offsets)[i*2+1] = offset1; } - + // point particles if (point_vertices) { @@ -420,8 +420,8 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) unsigned int quadRenderBin = 13; unsigned int lineRenderBin = 12; unsigned int pointRenderBin = 11; - - + + OSG_INFO<<"PrecipitationEffect::setUpGeometries("<setUseVertexBufferObjects(true); needGeometryRebuild = true; } - + if (!_pointGeometry || _pointGeometry->getVertexArray()->getNumElements() != numParticles) { _pointGeometry = new osg::Geometry; _pointGeometry->setUseVertexBufferObjects(true); needGeometryRebuild = true; } - - if (needGeometryRebuild) + + if (needGeometryRebuild) { createGeometry(numParticles, _quadGeometry.get(), _lineGeometry.get(), _pointGeometry.get()); } @@ -456,13 +456,13 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) if (!_quadStateSet) { _quadStateSet = new osg::StateSet; - + osg::Program* program = new osg::Program; _quadStateSet->setAttribute(program); _quadStateSet->setRenderBinDetails(quadRenderBin,"DepthSortedBin"); #ifdef USE_LOCAL_SHADERS - char vertexShaderSource[] = + char vertexShaderSource[] = "uniform float inversePeriod;\n" "uniform vec4 particleColour;\n" "uniform float particleSize;\n" @@ -508,7 +508,7 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) " gl_ClipVertex = v1;\n" "}\n"; - char fragmentShaderSource[] = + char fragmentShaderSource[] = "uniform sampler2D baseTexture;\n" "varying vec2 texCoord;\n" "varying vec4 colour;\n" @@ -537,7 +537,7 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) _lineStateSet->setRenderBinDetails(lineRenderBin,"DepthSortedBin"); #ifdef USE_LOCAL_SHADERS - char vertexShaderSource[] = + char vertexShaderSource[] = "uniform float inversePeriod;\n" "uniform vec4 particleColour;\n" "uniform float particleSize;\n" @@ -580,7 +580,7 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) " gl_ClipVertex = v1;\n" "}\n"; - char fragmentShaderSource[] = + char fragmentShaderSource[] = "uniform sampler2D baseTexture;\n" "varying vec2 texCoord;\n" "varying vec4 colour;\n" @@ -608,7 +608,7 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) _pointStateSet->setAttribute(program); #ifdef USE_LOCAL_SHADERS - char vertexShaderSource[] = + char vertexShaderSource[] = "uniform float inversePeriod;\n" "uniform vec4 particleColour;\n" "uniform float particleSize;\n" @@ -638,7 +638,7 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) " gl_ClipVertex = gl_ModelViewMatrix * v_current;\n" "}\n"; - char fragmentShaderSource[] = + char fragmentShaderSource[] = "uniform sampler2D baseTexture;\n" "varying vec4 colour;\n" "\n" @@ -664,7 +664,7 @@ void PrecipitationEffect::setUpGeometries(unsigned int numParticles) #else OSG_NOTICE<<"Warning: ParticleEffect::setUpGeometries(..) not fully implemented."<setRenderBinDetails(pointRenderBin,"DepthSortedBin"); } @@ -692,18 +692,18 @@ void PrecipitationEffect::cull(PrecipitationDrawableSet& pds, osgUtil::CullVisit osg::Matrix inverse_modelview; inverse_modelview.invert(*(cv->getModelViewMatrix())); - + osg::Vec3 eyeLocal = osg::Vec3(0.0f,0.0f,0.0f) * inverse_modelview; //OSG_NOTICE<<" eyeLocal "<getProjectionMatrix())); @@ -712,7 +712,7 @@ void PrecipitationEffect::cull(PrecipitationDrawableSet& pds, osgUtil::CullVisit float i_delta = _farTransition * _inverse_du.x(); float j_delta = _farTransition * _inverse_dv.y(); float k_delta = 1;//_nearTransition * _inverse_dw.z(); - + int i_min = (int)floor(eye_i - i_delta); int j_min = (int)floor(eye_j - j_delta); int k_min = (int)floor(eye_k - k_delta); @@ -720,7 +720,7 @@ void PrecipitationEffect::cull(PrecipitationDrawableSet& pds, osgUtil::CullVisit int i_max = (int)ceil(eye_i + i_delta); int j_max = (int)ceil(eye_j + j_delta); int k_max = (int)ceil(eye_k + k_delta); - + //OSG_NOTICE<<"i_delta="<second.modelview.ptr()); + glLoadMatrix((*itr)->second.modelview.ptr()); } } else @@ -895,7 +895,7 @@ if (!_geometry) return; } _geometry->draw(renderInfo); - + unsigned int numVertices = osg::minimum(_geometry->getVertexArray()->getNumElements(), _numberOfVertices); glDrawArrays(_drawType, 0, numVertices); } @@ -906,7 +906,7 @@ if (!_geometry) return; glPopMatrix(); glMatrixMode( GL_MODELVIEW ); } - + glPopMatrix(); #else OSG_NOTICE<<"Warning: ParticleEffect::drawImplementation(..) not fully implemented."<getDefaultParticleTemplate(); - float radius = 0.5f*_scale; + float radius = 0.5f*_scale; float density = 1.0f; // 1.0kg/m^3 ptemplate.setLifeTime(_defaultParticleTemplate.getLifeTime()); - // the following ranges set the envelope of the respective + // the following ranges set the envelope of the respective // graphical properties in time. ptemplate.setSizeRange(osgParticle::rangef(radius*_defaultParticleTemplate.getSizeRange().minimum, radius*_defaultParticleTemplate.getSizeRange().maximum)); @@ -152,10 +152,10 @@ void SmokeEffect::setUpEmitterAndProgram() // set up program. if (!_program) - { + { _program = new osgParticle::FluidProgram; } - + if (_program.valid()) { _program->setParticleSystem(_particleSystem.get()); diff --git a/src/osgParticle/SmokeTrailEffect.cpp b/src/osgParticle/SmokeTrailEffect.cpp index b130ba2fc..1581b01fb 100644 --- a/src/osgParticle/SmokeTrailEffect.cpp +++ b/src/osgParticle/SmokeTrailEffect.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,31 +24,31 @@ using namespace osgParticle; SmokeTrailEffect::SmokeTrailEffect(bool automaticSetup): - ParticleEffect(automaticSetup) + ParticleEffect(automaticSetup) { setDefaults(); - + _position.set(0.0f,0.0f,0.0f); _scale = 1.0f; _intensity = 1.0f; _emitterDuration = 65.0; _defaultParticleTemplate.setLifeTime(5.0*_scale); - + if (_automaticSetup) buildEffect(); } SmokeTrailEffect::SmokeTrailEffect(const osg::Vec3& position, float scale, float intensity) { setDefaults(); - + _position = position; _scale = scale; _intensity = intensity; _emitterDuration = 65.0; _defaultParticleTemplate.setLifeTime(5.0*_scale); - + if (_automaticSetup) buildEffect(); } @@ -61,8 +61,8 @@ SmokeTrailEffect::SmokeTrailEffect(const SmokeTrailEffect& copy, const osg::Copy void SmokeTrailEffect::setDefaults() { ParticleEffect::setDefaults(); - - _textureFileName = "Images/continous_smoke.rgb"; + + _textureFileName = "Images/continous_smoke.rgb"; _emitterDuration = 65.0; // set up unit particle. @@ -70,7 +70,7 @@ void SmokeTrailEffect::setDefaults() _defaultParticleTemplate.setSizeRange(osgParticle::rangef(0.75f, 2.0f)); _defaultParticleTemplate.setAlphaRange(osgParticle::rangef(0.7f, 1.0f)); _defaultParticleTemplate.setColorRange(osgParticle::rangev4( - osg::Vec4(1, 1.0f, 1.0f, 1.0f), + osg::Vec4(1, 1.0f, 1.0f, 1.0f), osg::Vec4(1, 1.0f, 1.f, 0.0f))); @@ -90,12 +90,12 @@ void SmokeTrailEffect::setUpEmitterAndProgram() osgParticle::Particle& ptemplate = _particleSystem->getDefaultParticleTemplate(); - float radius = 0.5f*_scale; + float radius = 0.5f*_scale; float density = 1.0f; // 1.0kg/m^3 ptemplate.setLifeTime(_defaultParticleTemplate.getLifeTime()); - // the following ranges set the envelope of the respective + // the following ranges set the envelope of the respective // graphical properties in time. ptemplate.setSizeRange(osgParticle::rangef(radius*_defaultParticleTemplate.getSizeRange().minimum, radius*_defaultParticleTemplate.getSizeRange().maximum)); @@ -153,10 +153,10 @@ void SmokeTrailEffect::setUpEmitterAndProgram() // set up program. if (!_program) - { + { _program = new osgParticle::FluidProgram; } - + if (_program.valid()) { _program->setParticleSystem(_particleSystem.get()); diff --git a/src/osgParticle/Version.cpp b/src/osgParticle/Version.cpp index a4fd5d425..ad633bed7 100644 --- a/src/osgParticle/Version.cpp +++ b/src/osgParticle/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/3ds/ReaderWriter3DS.cpp b/src/osgPlugins/3ds/ReaderWriter3DS.cpp index c5d8f9d1f..60fcf1659 100644 --- a/src/osgPlugins/3ds/ReaderWriter3DS.cpp +++ b/src/osgPlugins/3ds/ReaderWriter3DS.cpp @@ -273,8 +273,8 @@ ReaderWriter3DS::ReaderObject::ReaderObject(const osgDB::ReaderWriter::Options* if (options) { std::istringstream iss(options->getOptionString()); - std::string opt; - while (iss >> opt) + std::string opt; + while (iss >> opt) { if (opt == "noMatrixTransforms") noMatrixTransforms = true; @@ -390,8 +390,8 @@ void ReaderWriter3DS::ReaderObject::addDrawableFromFace(osg::Geode * geode, Face // ChrisD: Worth bearing in mind that this splitting up of // faces into smoothing groups is only correct for faces // belonging to a single smoothing group. The smoothing group - // value is actually a bitmask for all the smoothing groups that - // a face may belong to. + // value is actually a bitmask for all the smoothing groups that + // a face may belong to. smoothingFaceMap[mesh->faces[*flitr].smoothing_group].push_back(*flitr); } @@ -569,10 +569,10 @@ osg::Node* ReaderWriter3DS::ReaderObject::processNode(StateSetMap& drawStateMap, if (group) { - if (strcmp(node->name, "$$$DUMMY") == 0) + if (strcmp(node->name, "$$$DUMMY") == 0) { if (node->type == LIB3DS_NODE_MESH_INSTANCE) - group->setName(reinterpret_cast(node)->instance_name); + group->setName(reinterpret_cast(node)->instance_name); } else if (node->type == LIB3DS_NODE_MESH_INSTANCE && strlen(reinterpret_cast(node)->instance_name) != 0) group->setName(reinterpret_cast(node)->instance_name); @@ -850,7 +850,7 @@ struct RemappedFace struct VertexParams { VertexParams() : matrix(NULL), smoothNormals(false), scaleUV(1.f, 1.f), offsetUV(0.f, 0.f) { } - const osg::Matrix* matrix; + const osg::Matrix* matrix; bool smoothNormals; osg::Vec2f scaleUV; osg::Vec2f offsetUV; @@ -858,7 +858,7 @@ struct VertexParams static bool isFaceValid(const Lib3dsMesh* mesh, const Lib3dsFace* face) { - return + return face->index[0] < mesh->nvertices && face->index[1] < mesh->nvertices && face->index[2] < mesh->nvertices; @@ -874,12 +874,12 @@ static bool isFaceValid(const Lib3dsMesh* mesh, const Lib3dsFace* face) 24 vertices to accomodate the 3 different normals at each vertex. */ static void addVertex( - const Lib3dsMesh* mesh, - RemappedFace& remappedFace, + const Lib3dsMesh* mesh, + RemappedFace& remappedFace, unsigned short int i, osg::Geometry* geometry, std::vector& origToNewMapping, - std::vector& splitVertexChain, + std::vector& splitVertexChain, const VertexParams& params) { osg::Vec3Array* vertices = (osg::Vec3Array*)geometry->getVertexArray(); @@ -961,11 +961,11 @@ static void addVertex( } static bool addFace( - const Lib3dsMesh* mesh, - RemappedFace& remappedFace, - osg::Geometry* geometry, - std::vector& origToNewMapping, - std::vector& splitVertexChain, + const Lib3dsMesh* mesh, + RemappedFace& remappedFace, + osg::Geometry* geometry, + std::vector& origToNewMapping, + std::vector& splitVertexChain, const VertexParams& params) { if (isFaceValid(mesh, remappedFace.face)) @@ -1018,7 +1018,7 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL osg_texCoords = new osg::Vec2Array(); osg_texCoords->reserve(m->nvertices); geom->setTexCoordArray(0, osg_texCoords.get()); - + // Texture 0 parameters (only one texture supported for now) if (ssi.lib3dsmat && *(ssi.lib3dsmat->texture1_map.name)) // valid texture = name not empty { @@ -1027,7 +1027,7 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL params.offsetUV = osg::Vec2f(tex3ds.offset[0], tex3ds.offset[1]); if (tex3ds.rotation != 0) OSG_NOTICE << "3DS texture rotation not supported yet" << std::endl; //TODO: tint_1, tint_2, tint_r, tint_g, tint_b - } + } } // The map between lib3ds mesh vertex indices and remapped osg vertices. @@ -1043,27 +1043,27 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL for (FaceList::iterator itr = faceList.begin(); itr != faceList.end(); ++itr, ++faceIndex) - { + { osg::Vec3 normal = copyLib3dsVec3ToOsgVec3(normals[*itr]); if (matrix) normal = osg::Matrix::transform3x3(normal, *(params.matrix)); normal.normalize(); Lib3dsFace& face = m->faces[*itr]; remappedFaces[faceIndex].face = &face; - remappedFaces[faceIndex].normal = normal; + remappedFaces[faceIndex].normal = normal; if (addFace(m, remappedFaces[faceIndex], geom, origToNewMapping, splitVertexChain, params)) { ++faceCount; } } - // 'Shrink to fit' all vertex arrays because potentially faceList refers to fewer vertices than the whole mesh. + // 'Shrink to fit' all vertex arrays because potentially faceList refers to fewer vertices than the whole mesh. // This will almost certainly be the case where mesh has been broken down into smoothing groups. if (osg_vertices.valid() && osg_vertices->size() < osg_vertices->capacity()) osg_vertices->trim(); if (osg_normals.valid() && osg_normals->size() < osg_normals->capacity()) osg_normals->trim(); if (osg_texCoords.valid() && osg_texCoords->size() < osg_texCoords->capacity()) osg_texCoords->trim(); - // Set geometry color to white. + // Set geometry color to white. osg::ref_ptr osg_colors = new osg::Vec4ubArray(1); (*osg_colors)[0].set(255,255,255,255); geom->setColorArray(osg_colors.get()); @@ -1214,8 +1214,8 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3 texenv->setSource2_RGB(osg::TexEnvCombine::CONSTANT); texenv->setConstantColor(osg::Vec4(factor, factor, factor, factor)); stateset->setTextureAttributeAndModes(unit, texenv, osg::StateAttribute::ON); - } - else + } + else { // from an email from Eric Hamil, September 30, 2003. // According to the 3DS spec, and other @@ -1238,7 +1238,7 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3 diffuse.set(0.8f,0.8f,0.8f); specular.set(0.0f,0.0f,0.0f); #endif - } + } unit++; } @@ -1249,12 +1249,12 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3 { if(texture1_map->getImage()->isImageTranslucent()) { - transparency = true; + transparency = true; stateset->setTextureAttributeAndModes(unit, opacity_map, osg::StateAttribute::ON); double factor = mat->opacity_map.percent; - + osg::TexEnvCombine* texenv = new osg::TexEnvCombine(); texenv->setCombine_Alpha(osg::TexEnvCombine::INTERPOLATE); texenv->setSource0_Alpha(osg::TexEnvCombine::TEXTURE); @@ -1262,9 +1262,9 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3 texenv->setSource2_Alpha(osg::TexEnvCombine::CONSTANT); texenv->setConstantColor(osg::Vec4(factor, factor, factor, 1.0 - factor)); stateset->setTextureAttributeAndModes(unit, texenv, osg::StateAttribute::ON); - + unit++; - } + } else { osg::notify(WARN)<<"The plugin does not support images without alpha channel for opacity"< -WriterCompareTriangle::WriterCompareTriangle(const osg::Geode & geode, unsigned int nbVertices) : geode(geode) +WriterCompareTriangle::WriterCompareTriangle(const osg::Geode & geode, unsigned int nbVertices) : geode(geode) { cutscene(nbVertices, geode.getBoundingBox()); } -bool -WriterCompareTriangle::operator()(const std::pair & t1, +bool +WriterCompareTriangle::operator()(const std::pair & t1, const std::pair & t2) const { const osg::Geometry *g = geode.getDrawable( t1.second )->asGeometry(); @@ -30,7 +30,7 @@ WriterCompareTriangle::operator()(const std::pair & t1, void WriterCompareTriangle::setMaxMin(unsigned int & nbVerticesX, unsigned int & nbVerticesY, - unsigned int & nbVerticesZ) const + unsigned int & nbVerticesZ) const { static const unsigned int min = 1; static const unsigned int max = 5; // Number of blocks used to divide the scene (arbitrary but seems ok) @@ -98,7 +98,7 @@ void WriterCompareTriangle::cutscene(int nbVertices, const osg::BoundingBox & sc boxList.push_back(osg::BoundingBox(xMin, // Add a bloc to the list yMin, zMin, - xMax, + xMax, yMax, zMax)); y += yinc; @@ -112,14 +112,14 @@ void WriterCompareTriangle::cutscene(int nbVertices, const osg::BoundingBox & sc } } -int -WriterCompareTriangle::inWhichBox(const osg::BoundingBox::value_type x, +int +WriterCompareTriangle::inWhichBox(const osg::BoundingBox::value_type x, const osg::BoundingBox::value_type y, const osg::BoundingBox::value_type z) const { for (unsigned int i = 0; i < boxList.size(); ++i) { - if (x >= boxList[i].xMin() && + if (x >= boxList[i].xMin() && x < boxList[i].xMax() && y >= boxList[i].yMin() && y < boxList[i].yMax() && diff --git a/src/osgPlugins/3ds/WriterCompareTriangle.h b/src/osgPlugins/3ds/WriterCompareTriangle.h index f1a8db9c6..4abed8246 100644 --- a/src/osgPlugins/3ds/WriterCompareTriangle.h +++ b/src/osgPlugins/3ds/WriterCompareTriangle.h @@ -17,7 +17,7 @@ class WriterCompareTriangle { public: WriterCompareTriangle(const osg::Geode & geode, unsigned int nbVertices); - bool operator()(const std::pair & t1, + bool operator()(const std::pair & t1, const std::pair & t2) const; private: void // This function prevent from cut scene in too many blocs @@ -34,12 +34,12 @@ private: cutscene(int nbVertices, const osg::BoundingBox & sceneBox); - /** + /** * Find in which box those points are. * \return the place of the box in the vector. * \sa See cutScene() about the definition of the boxes for faces sorting. */ - int inWhichBox(const osg::BoundingBox::value_type x, + int inWhichBox(const osg::BoundingBox::value_type x, const osg::BoundingBox::value_type y, const osg::BoundingBox::value_type z) const; int inWhichBox(const osg::BoundingBox::vec_type & point) const; diff --git a/src/osgPlugins/3ds/WriterNodeVisitor.cpp b/src/osgPlugins/3ds/WriterNodeVisitor.cpp index 8c63d8e62..1a0c2b792 100644 --- a/src/osgPlugins/3ds/WriterNodeVisitor.cpp +++ b/src/osgPlugins/3ds/WriterNodeVisitor.cpp @@ -127,10 +127,10 @@ namespace plugin3ds class PrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { public: - PrimitiveIndexWriter(osg::Geometry * geo, + PrimitiveIndexWriter(osg::Geometry * geo, ListTriangle & listTriangles, unsigned int drawable_n, - unsigned int material) : + unsigned int material) : osg::PrimitiveIndexFunctor(), _drawable_n(drawable_n), _listTriangles(listTriangles), @@ -445,8 +445,8 @@ std::string convertExt(const std::string & path, bool extendedFilePaths) } -WriterNodeVisitor::WriterNodeVisitor(Lib3dsFile * file3ds, const std::string & fileName, - const osgDB::ReaderWriter::Options* options, +WriterNodeVisitor::WriterNodeVisitor(Lib3dsFile * file3ds, const std::string & fileName, + const osgDB::ReaderWriter::Options* options, const std::string & srcDirectory) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _succeeded(true), @@ -597,7 +597,7 @@ std::string WriterNodeVisitor::getUniqueName(const std::string& _defaultValue, b // Tests if default name is valid and unique if (is3DSName(_defaultValue, _extendedFilePaths, isNodeName)) { - std::pair insertion( nameMap.insert(_defaultValue) ); + std::pair insertion( nameMap.insert(_defaultValue) ); if (insertion.second) return _defaultValue; // Return if element is newly inserted in the map (else there is a naming collision) } @@ -653,7 +653,7 @@ std::string WriterNodeVisitor::getUniqueName(const std::string& _defaultValue, b const std::string strippedName( filename + ext ); if (is3DSName(strippedName, _extendedFilePaths, isNodeName)) { - std::pair insertion( nameMap.insert(strippedName) ); + std::pair insertion( nameMap.insert(strippedName) ); if (insertion.second) return strippedName; // Return if element is newly inserted in the map (else there is a naming collision) } @@ -739,7 +739,7 @@ int WriterNodeVisitor::processStateSet(osg::StateSet* ss) return -1; } -/** +/** * Add a vertice to the index and link it with the Triangle index and the drawable. * \param index_vert is the map where the vertice are stored. * \param index is the indice of the vertice's position in the vec3. @@ -747,7 +747,7 @@ int WriterNodeVisitor::processStateSet(osg::StateSet* ss) * \return the position of the vertice in the final mesh. */ unsigned int -WriterNodeVisitor::getMeshIndexForGeometryIndex(MapIndices & index_vert, +WriterNodeVisitor::getMeshIndexForGeometryIndex(MapIndices & index_vert, unsigned int index, unsigned int drawable_n) { @@ -762,7 +762,7 @@ WriterNodeVisitor::getMeshIndexForGeometryIndex(MapIndices & index_vert, } -void +void WriterNodeVisitor::buildMesh(osg::Geode & geo, const osg::Matrix & mat, MapIndices & index_vert, @@ -829,7 +829,7 @@ WriterNodeVisitor::buildMesh(osg::Geode & geo, lib3ds_file_append_node(_file3ds, reinterpret_cast(node3ds), reinterpret_cast(_cur3dsNode)); } -unsigned int +unsigned int WriterNodeVisitor::calcVertices(osg::Geode & geo) { unsigned int numVertice = 0; @@ -923,8 +923,8 @@ WriterNodeVisitor::buildFaces(osg::Geode & geo, } } -void -WriterNodeVisitor::createListTriangle(osg::Geometry * geo, +void +WriterNodeVisitor::createListTriangle(osg::Geometry * geo, ListTriangle & listTriangles, bool & texcoords, unsigned int & drawable_n) @@ -946,7 +946,7 @@ WriterNodeVisitor::createListTriangle(osg::Geometry * geo, texcoords = true; } - int material = processStateSet(_currentStateSet.get()); + int material = processStateSet(_currentStateSet.get()); for(unsigned int i = 0; i < geo->getNumPrimitiveSets(); ++i) //Fill the Triangle List { diff --git a/src/osgPlugins/3ds/WriterNodeVisitor.h b/src/osgPlugins/3ds/WriterNodeVisitor.h index 80f369449..b5e30528b 100644 --- a/src/osgPlugins/3ds/WriterNodeVisitor.h +++ b/src/osgPlugins/3ds/WriterNodeVisitor.h @@ -57,8 +57,8 @@ class WriterNodeVisitor: public osg::NodeVisitor static const unsigned int MAX_VERTICES = 65000; static const unsigned int MAX_FACES = MAX_VERTICES; - WriterNodeVisitor(Lib3dsFile * file3ds, const std::string & fileName, - const osgDB::ReaderWriter::Options* options, + WriterNodeVisitor(Lib3dsFile * file3ds, const std::string & fileName, + const osgDB::ReaderWriter::Options* options, const std::string & srcDirectory); bool succeeded() const { return _succeeded; } @@ -134,7 +134,7 @@ class WriterNodeVisitor: public osg::NodeVisitor private: WriterNodeVisitor& operator = (const WriterNodeVisitor&) { return *this; } - /** + /** * Fill the faces field of the mesh and call buildMesh(). * \param geo is the geode who contain vertice and faces. * \param mat Local to world matrix applied to the geode @@ -143,13 +143,13 @@ class WriterNodeVisitor: public osg::NodeVisitor */ void buildFaces(osg::Geode & geo, const osg::Matrix & mat, ListTriangle & listTriangles, bool texcoords); - /** + /** * Calculate the number of vertices in the geode. * \return the number of vertices in the geode. */ unsigned int calcVertices(osg::Geode & geo); - /** + /** * Build a mesh * \param geo is the geode who contain vertice and faces * \param mat Local to world matrix applied to the geode @@ -162,10 +162,10 @@ class WriterNodeVisitor: public osg::NodeVisitor buildMesh(osg::Geode & geo, const osg::Matrix & mat, MapIndices & index_vert, - bool texcoords, + bool texcoords, Lib3dsMesh *mesh); - /** + /** * Add a vertice to the index and link him with the Triangle index and the drawable. * \param index_vert is the map where the vertice are stored. * \param index is the indice of the vertice's position in the vec3. @@ -173,17 +173,17 @@ class WriterNodeVisitor: public osg::NodeVisitor * \return the position of the vertice in the final mesh. */ unsigned int - getMeshIndexForGeometryIndex(MapIndices & index_vert, + getMeshIndexForGeometryIndex(MapIndices & index_vert, unsigned int index, unsigned int drawable_n); - /** + /** * Create the list of faces from the geode. * \param geo is the geode to study. * \param listTriangles is the list to fill. * \param texcoords tell us if we have to treat texture coord. * \param drawable_n tell us which drawable we are building. - */ - void createListTriangle(osg::Geometry * geo, + */ + void createListTriangle(osg::Geometry * geo, ListTriangle & listTriangles, bool & texcoords, unsigned int & drawable_n); diff --git a/src/osgPlugins/Inventor/ConvertToInventor.cpp b/src/osgPlugins/Inventor/ConvertToInventor.cpp index 2872e141f..3e7f99ae8 100644 --- a/src/osgPlugins/Inventor/ConvertToInventor.cpp +++ b/src/osgPlugins/Inventor/ConvertToInventor.cpp @@ -228,7 +228,7 @@ void osgArray2ivMField_template(const osg::Array *array, fieldClass &field, int ivType *a = field.startEditing(); osgType *ptr = (osgType*)array->getDataPointer() + startIndex; - + if (numItemsUntilMinusOne <= 0) for (i=0; i(array, (SoMFInt32&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return; + else if (ivApplicateIntType(array, (SoMFInt32&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return; else if (ivApplicateIntType(array, (SoMFUInt32&)field, startIndex, stopIndex, numItemsUntilMinusOne)) return; - else if (ivApplicateIntType(array, (SoMFShort&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return; + else if (ivApplicateIntType(array, (SoMFShort&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return; else if (ivApplicateIntType(array, (SoMFUShort&)field, startIndex, stopIndex, numItemsUntilMinusOne)) return; else if (field.isOfType(SoMFVec2f::getClassTypeId())) { @@ -473,7 +473,7 @@ bool ivProcessArray(const osg::Array *indices, const osg::Array *drawElemIndices bool ok = true; if (indices || drawElemIndices) { - + // "deindex" original data if (indices && !drawElemIndices) ok = ivDeindex(destField->startEditing(), @@ -746,7 +746,7 @@ static SoTexture2::Wrap convertTextureWrap(osg::Texture::WrapMode osgWrap) // original SGI Inventor: no // Coin: no (until current version Coin 2.5.0b3) // TGS Inventor: introduced in TGS Inventor 5.0 (available in SoTexture class) - + // note: Coin (since 2.0) uses CLAMP_TO_EDGE for rendering if SoTexture2::CLAMP is specified. switch (osgWrap) { @@ -789,11 +789,11 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o ivPrevState->ivHead->addChild(ivState->ivHead); if (ss) { - + // // Lighting // - + // enable/disable lighting updateMode(ivState->osgLighting, ss->getMode(GL_LIGHTING)); if (ivState->osgLighting != ivPrevState->osgLighting) { @@ -833,7 +833,7 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o "Ignoring face culling." << std::endl; // set two-sided lighting and backface culling off - sh->vertexOrdering = ivState->osgFrontFace==osg::FrontFace::COUNTER_CLOCKWISE ? + sh->vertexOrdering = ivState->osgFrontFace==osg::FrontFace::COUNTER_CLOCKWISE ? SoShapeHints::COUNTERCLOCKWISE : SoShapeHints::CLOCKWISE; sh->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE; } @@ -849,7 +849,7 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o // Warn if culling the lit faces while rendering unlit faces. // Inventor does not support this setup and it lits the unculled faces only. OSG_WARN << "IvWriter: Culling was set in a way that one-sided lighting will lit the culled sides of faces. " - "Using lighting on correct faces." << std::endl; + "Using lighting on correct faces." << std::endl; // face culling on sh->vertexOrdering = ccw ? SoShapeHints::COUNTERCLOCKWISE : SoShapeHints::CLOCKWISE; @@ -879,12 +879,12 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o if (!ivState->osgTexture2Enabled || ivState->osgTexture==NULL || ivState->osgTexture->getImage(0)==NULL) - + // empty texture disables texturing ivState->ivTexture = new SoTexture2; - + else { - + // reuse texture if possible ivState->ivTexture = ivTexturesMap[ivState->osgTexture][ivState->osgTexEnv]; @@ -898,7 +898,7 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o // texture file name const std::string &textureName = ivState->osgTexture->getImage(0)->getFileName(); ivState->ivTexture->filename.setValue(textureName.c_str()); // FIXME: handle inlined texture data in the files - + // wrap ivState->ivTexture->wrapS.setValue(convertTextureWrap( ivState->osgTexture->getWrap(osg::Texture::WRAP_S))); @@ -950,7 +950,7 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o OSG_WARN << "IvWriter: Model contains different materials for front and " "back faces. This is not handled properly. Using front material only." << std::endl; } - + // Convert colors // OSG represents colors by: Vec3, Vec4,Vec4ub // Inventor by: uint32 (RGBA, by SoPackedColor), SbColor (Vec3f, by SoMaterial and SoBaseColor) @@ -1179,15 +1179,15 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet // Post-processing for DrawArrayLengths if (drawArrayLengths && primSize==0 && drawArrayLengths->size()>=2) { - + postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->coordIndex); - + if (ivNormals && g->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX) postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->normalIndex); - + if (ivMaterial && g->getColorBinding()==osg::Geometry::BIND_PER_VERTEX) postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->materialIndex); - + if (ivTexCoords && !ivTexCoords->isOfType(SoTextureCoordinateFunction::getClassTypeId())) postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->textureCoordIndex); } @@ -1257,12 +1257,12 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet &((SoTextureCoordinate3*)ivCoords)->point, startIndex, n); } - } + } else #endif // __COIN__ nonIndexedTexCoords = ivTexCoords; } - + // create alternate normals if (ivNormals) { nonIndexedNormals = new SoNormal; @@ -1300,7 +1300,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet if (shape->isOfType(SoPointSet::getClassTypeId())) ((SoPointSet*)shape)->numPoints.setValue(elementsCount); else - + if (shape->isOfType(SoLineSet::getClassTypeId())) { switch (pset->getMode()) { case GL_LINES: @@ -1561,7 +1561,7 @@ void ConvertToInventor::processGeometry(const osg::Geometry *g, InventorState *i if (g->getTexCoordArray(0)->getDataSize() <= 2) { texCoords = new SoTextureCoordinate2; osgArray2ivMField(g->getTexCoordArray(0), ((SoTextureCoordinate2*)texCoords)->point); - } + } #ifdef __COIN__ else { texCoords = new SoTextureCoordinate3; @@ -1606,7 +1606,7 @@ void ConvertToInventor::processGeometry(const osg::Geometry *g, InventorState *i break; case GL_TRIANGLES: case GL_TRIANGLE_STRIP: - case GL_QUAD_STRIP: if (useIndices) + case GL_QUAD_STRIP: if (useIndices) if (vrml1Conversion) { shape = new SoIndexedFaceSet; needSeparateTriangles = true; @@ -1664,9 +1664,9 @@ void ConvertToInventor::processGeometry(const osg::Geometry *g, InventorState *i { const osg::DrawArrayLengths *drawArrayLengths = dynamic_cast(pset); - + int startIndex = drawArrayLengths->getFirst(); - + ok = processPrimitiveSet(g, pset, NULL, needSeparateTriangles, -1, primSize, startIndex, -1, normalIndex, colorIndex, coords, normals, ivMaterial, texCoords, @@ -1678,7 +1678,7 @@ void ConvertToInventor::processGeometry(const osg::Geometry *g, InventorState *i break; } - + case osg::PrimitiveSet::DrawElementsUBytePrimitiveType: case osg::PrimitiveSet::DrawElementsUShortPrimitiveType: case osg::PrimitiveSet::DrawElementsUIntPrimitiveType: @@ -1754,15 +1754,15 @@ void ConvertToInventor::processShapeDrawable(const osg::ShapeDrawable *d, Invent SoGroup *root) { // convert rotation rotation = osg::Quat(-M_PI_2, osg::Vec3(0.,1.,0.)) * osg::Quat(M_PI_2, osg::Vec3(1.,0.,0.)) * rotation; - + if (center.length2()==0. && rotation.zeroRotation() && ivState->ivTexture==NULL) // optimized handling of single node root->addChild(ivNode); - + else { SoSeparator *root2 = new SoSeparator; - + // handle transformation if (center.length2()!=0. || !rotation.zeroRotation()) { SoTransform *ivTransform = new SoTransform; @@ -1773,14 +1773,14 @@ void ConvertToInventor::processShapeDrawable(const osg::ShapeDrawable *d, Invent // handle texture if (ivState->ivTexture) root2->addChild(ivState->ivTexture); - + // build graph root2->addChild(ivNode); root->addChild(root2); } } - - virtual void apply(const osg::Sphere &s) { + + virtual void apply(const osg::Sphere &s) { SoSphere *ivSphere = new SoSphere; ivSphere->radius.setValue(s.getRadius()); processNode(ivSphere, s.getCenter(), osg::Quat(0., osg::Vec3(1.,0.,0.)), ivState->ivHead); @@ -1806,7 +1806,7 @@ void ConvertToInventor::processShapeDrawable(const osg::ShapeDrawable *d, Invent ivCylinder->height = c.getHeight(); processNode(ivCylinder, c.getCenter(), c.getRotation(), ivState->ivHead); } - + void warnNonSupported() { OSG_WARN << "IvWriter: Not supported ShapeDrawable found. Skipping it." << std::endl; } @@ -1816,7 +1816,7 @@ void ConvertToInventor::processShapeDrawable(const osg::ShapeDrawable *d, Invent virtual void apply(const osg::ConvexHull&) { warnNonSupported(); } virtual void apply(const osg::HeightField&) { warnNonSupported(); } virtual void apply(const osg::CompositeShape&) { warnNonSupported(); } - + InventorState *ivState; MyShapeVisitor(InventorState *ivState) { this->ivState = ivState; } } shapeVisitor(ivState); @@ -1839,7 +1839,7 @@ void ConvertToInventor::processDrawable(osg::Drawable *d) if (g != NULL) processGeometry(g, ivDrawableState); else - + if ((sd = dynamic_cast(d)) != NULL) { processShapeDrawable(sd, ivDrawableState); } @@ -1897,7 +1897,7 @@ void ConvertToInventor::apply(osg::Billboard& node) #ifdef __COIN__ if (useIvExtensions) { - + // Create SoSeparator and convert StateSet InventorState *ivState = createInventorState(node.getStateSet()); SoGroup *root = ivState->ivHead; @@ -1927,7 +1927,7 @@ void ConvertToInventor::apply(osg::Billboard& node) }; billboard->axisOfRotation.setValue(axis); #else - + billboard->axisOfRotation.setValue(SbVec3f(0.f,0.f,0.f)); #endif @@ -1954,7 +1954,7 @@ void ConvertToInventor::apply(osg::Billboard& node) } popInventorState(); - + } else apply((osg::Geode&)node); @@ -2021,7 +2021,7 @@ void ConvertToInventor::apply(osg::LOD& node) SoGroup *ivLOD = NULL; osg::LOD::RangeMode rangeMode = node.getRangeMode(); if (rangeMode == osg::LOD::DISTANCE_FROM_EYE_POINT) { - + // use SoLOD for DISTANCE_FROM_EYE_POINT SoLOD *lod = new SoLOD; @@ -2050,7 +2050,7 @@ void ConvertToInventor::apply(osg::LOD& node) ivLOD = lod; } else { - + // undefined mode -> put warning OSG_WARN << "IvWriter: Undefined LOD::RangeMode value." << std::endl; ivLOD = new SoGroup; diff --git a/src/osgPlugins/Inventor/ConvertToInventor.h b/src/osgPlugins/Inventor/ConvertToInventor.h index d057ff433..60cf02dab 100644 --- a/src/osgPlugins/Inventor/ConvertToInventor.h +++ b/src/osgPlugins/Inventor/ConvertToInventor.h @@ -102,7 +102,7 @@ protected: osg::CullFace::Mode osgCullFace; bool osgBlendEnabled; const osg::BlendFunc *osgBlendFunc; - + InventorState() {} InventorState(SoGroup *root) : ivHead(root), ivTexture(NULL), ivMaterial(NULL), osgMaterial(NULL), @@ -111,7 +111,7 @@ protected: osgLighting(true), osgTwoSided(false), osgFrontFace(osg::FrontFace::COUNTER_CLOCKWISE), osgCullFaceEnabled(false), osgCullFace(osg::CullFace::BACK), osgBlendEnabled(false), osgBlendFunc(NULL) {} - InventorState(const InventorState &s) : ivHead(s.ivHead), ivTexture(s.ivTexture), + InventorState(const InventorState &s) : ivHead(s.ivHead), ivTexture(s.ivTexture), ivMaterial(s.ivMaterial), osgMaterial(s.osgMaterial), osgTexture2Enabled(s.osgTexture2Enabled), osgTexture(s.osgTexture), osgTexEnv(s.osgTexEnv), osgTexGenS(s.osgTexGenS), osgTexGenT(s.osgTexGenT), osgTexGen(s.osgTexGen), diff --git a/src/osgPlugins/Inventor/PendulumCallback.h b/src/osgPlugins/Inventor/PendulumCallback.h index 265916216..0e689a153 100644 --- a/src/osgPlugins/Inventor/PendulumCallback.h +++ b/src/osgPlugins/Inventor/PendulumCallback.h @@ -9,13 +9,13 @@ class PendulumCallback : public osg::NodeCallback { public: - PendulumCallback(const osg::Vec3& axis, float startAngle, + PendulumCallback(const osg::Vec3& axis, float startAngle, float endAngle, float frequency); virtual void operator() (osg::Node* node, osg::NodeVisitor* nv); - + protected: - + float _startAngle; float _endAngle; float _frequency; diff --git a/src/osgPlugins/Inventor/ShuttleCallback.h b/src/osgPlugins/Inventor/ShuttleCallback.h index cd8cf2f98..6cbb498f0 100644 --- a/src/osgPlugins/Inventor/ShuttleCallback.h +++ b/src/osgPlugins/Inventor/ShuttleCallback.h @@ -9,13 +9,13 @@ class ShuttleCallback : public osg::NodeCallback { public: - ShuttleCallback(const osg::Vec3& startPos, const osg::Vec3& endPos, + ShuttleCallback(const osg::Vec3& startPos, const osg::Vec3& endPos, float frequency); virtual void operator() (osg::Node* node, osg::NodeVisitor* nv); - + protected: - + osg::Vec3 _startPos; osg::Vec3 _endPos; float _frequency; diff --git a/src/osgPlugins/OpenFlight/AncillaryRecords.cpp b/src/osgPlugins/OpenFlight/AncillaryRecords.cpp index fce52d9c6..15939e1ed 100644 --- a/src/osgPlugins/OpenFlight/AncillaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/AncillaryRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -48,7 +48,7 @@ class Comment : public Record if (_parent.valid()) { -#if 0 +#if 0 _parent->setComment(commentfield); #else unsigned int front_of_line = 0; @@ -255,10 +255,10 @@ class UVList : public Record { int count = 0; while (mask) - { + { if (mask & 0x0001) - ++count; - mask >>= 1; + ++count; + mask >>= 1; } return count; } diff --git a/src/osgPlugins/OpenFlight/AttrData.cpp b/src/osgPlugins/OpenFlight/AttrData.cpp index 2bb1d18d2..0be3781e0 100644 --- a/src/osgPlugins/OpenFlight/AttrData.cpp +++ b/src/osgPlugins/OpenFlight/AttrData.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -51,22 +51,22 @@ AttrData::AttrData() : useLodScale(0), lod0(0.0f), - scale0(1.0f), + scale0(1.0f), lod1(0.0f), - scale1(1.0f), - lod2(0.0f), - scale2(1.0f), + scale1(1.0f), + lod2(0.0f), + scale2(1.0f), lod3(0.0f), scale3(1.0f), lod4(0.0f), scale4(1.0f), lod5(0.0f), scale5(1.0f), - lod6(0.0f), + lod6(0.0f), scale6(1.0f), - lod7(0.0f), + lod7(0.0f), scale7(1.0f), - + clamp(0), magFilterAlpha(2), // 2 = None magFilterColor(2), // 2 = None diff --git a/src/osgPlugins/OpenFlight/AttrData.h b/src/osgPlugins/OpenFlight/AttrData.h index 06b457f13..9604cd46b 100644 --- a/src/osgPlugins/OpenFlight/AttrData.h +++ b/src/osgPlugins/OpenFlight/AttrData.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,7 +32,7 @@ class AttrData : public osg::Object public : AttrData(); - + AttrData(const AttrData& attr, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); META_Object(flt,AttrData); @@ -110,7 +110,7 @@ class AttrData : public osg::Object INTERNAL_FORMAT_TX_I_16 = 8, INTERNAL_FORMAT_TX_RGB_12 = 9 }; - + int32 texels_u; // Number of texels in u direction int32 texels_v; // Number of texels in v direction int32 direction_u; // Real world size u direction @@ -304,7 +304,7 @@ class AttrData : public osg::Object float64 geoPoint[2]; // Real earth coordinate of geospecific control point // (this value depends on the projection, earth model, // and geospecific points units) - } + } // ---------------- // v15.6 ends here diff --git a/src/osgPlugins/OpenFlight/ControlRecords.cpp b/src/osgPlugins/OpenFlight/ControlRecords.cpp index 89d2b4966..e4b1a9c0d 100644 --- a/src/osgPlugins/OpenFlight/ControlRecords.cpp +++ b/src/osgPlugins/OpenFlight/ControlRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -67,13 +67,13 @@ class PopLevel : public Record PrimaryRecord* parentPrimary = document.getTopOfLevelStack(); PrimaryRecord* currentPrimary = document.getCurrentPrimaryRecord(); - // Call dispose() for primary without push, pop level pair. + // Call dispose() for primary without push, pop level pair. if (currentPrimary && currentPrimary!=parentPrimary) { currentPrimary->dispose(document); } - // Call dispose() for primary with push, pop level pair. + // Call dispose() for primary with push, pop level pair. if (parentPrimary) { parentPrimary->dispose(document); diff --git a/src/osgPlugins/OpenFlight/DataInputStream.cpp b/src/osgPlugins/OpenFlight/DataInputStream.cpp index eb07c8fb4..381abe8e7 100644 --- a/src/osgPlugins/OpenFlight/DataInputStream.cpp +++ b/src/osgPlugins/OpenFlight/DataInputStream.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/DataInputStream.h b/src/osgPlugins/OpenFlight/DataInputStream.h index 0d284947f..7161ff037 100644 --- a/src/osgPlugins/OpenFlight/DataInputStream.h +++ b/src/osgPlugins/OpenFlight/DataInputStream.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ #include #include #include -#include "Types.h" +#include "Types.h" namespace flt { diff --git a/src/osgPlugins/OpenFlight/DataOutputStream.cpp b/src/osgPlugins/OpenFlight/DataOutputStream.cpp index 154f198cf..6c33c542d 100644 --- a/src/osgPlugins/OpenFlight/DataOutputStream.cpp +++ b/src/osgPlugins/OpenFlight/DataOutputStream.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/DataOutputStream.h b/src/osgPlugins/OpenFlight/DataOutputStream.h index cbb94e498..3be5dda5a 100644 --- a/src/osgPlugins/OpenFlight/DataOutputStream.h +++ b/src/osgPlugins/OpenFlight/DataOutputStream.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/Document.cpp b/src/osgPlugins/OpenFlight/Document.cpp index d6fee5df6..61fdc73c3 100644 --- a/src/osgPlugins/OpenFlight/Document.cpp +++ b/src/osgPlugins/OpenFlight/Document.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/Document.h b/src/osgPlugins/OpenFlight/Document.h index 4abc5e735..f13837ed4 100644 --- a/src/osgPlugins/OpenFlight/Document.h +++ b/src/osgPlugins/OpenFlight/Document.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -216,7 +216,7 @@ class Document bool _doUnitsConversion; bool _readObjectRecordData; CoordUnits _desiredUnits; - + bool _keepExternalReferences; friend class Header; diff --git a/src/osgPlugins/OpenFlight/ExportOptions.cpp b/src/osgPlugins/OpenFlight/ExportOptions.cpp index 6adeb75e2..06894d540 100644 --- a/src/osgPlugins/OpenFlight/ExportOptions.cpp +++ b/src/osgPlugins/OpenFlight/ExportOptions.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -65,7 +65,7 @@ std::string ExportOptions::_validateOption( "validate" ); */ std::string ExportOptions::_tempDirOption( "tempDir" ); /** Value: "lighting". - * Specifies a default enable/disable state for lighting, for Nodes in the + * Specifies a default enable/disable state for lighting, for Nodes in the * exported scene graph that don't set it explicitly. By default, the * exporter assumes lighting is enabled (GL_LIGHTING ON). Set this to * either ON or OFF. Example: @@ -107,7 +107,7 @@ ExportOptions::ExportOptions( const osgDB::ReaderWriter::Options* opt ) _validate( false ), _lightingDefault( true ), _stripTextureFilePath( false ) - + { if (opt) { diff --git a/src/osgPlugins/OpenFlight/ExportOptions.h b/src/osgPlugins/OpenFlight/ExportOptions.h index c40b067f3..9cd33d404 100644 --- a/src/osgPlugins/OpenFlight/ExportOptions.h +++ b/src/osgPlugins/OpenFlight/ExportOptions.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/FltExportVisitor.cpp b/src/osgPlugins/OpenFlight/FltExportVisitor.cpp index a2fcf1719..7b7947083 100644 --- a/src/osgPlugins/OpenFlight/FltExportVisitor.cpp +++ b/src/osgPlugins/OpenFlight/FltExportVisitor.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -257,7 +257,7 @@ FltExportVisitor::apply( osg::MatrixTransform& node ) } typedef std::vector< osg::ref_ptr< osg::Referenced > > UserDataList; - + UserDataList saveUserDataList( node.getNumChildren() ); unsigned int idx; diff --git a/src/osgPlugins/OpenFlight/FltExportVisitor.h b/src/osgPlugins/OpenFlight/FltExportVisitor.h index 0a89aa978..4de2b84a1 100644 --- a/src/osgPlugins/OpenFlight/FltExportVisitor.h +++ b/src/osgPlugins/OpenFlight/FltExportVisitor.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/FltWriteResult.h b/src/osgPlugins/OpenFlight/FltWriteResult.h index fb40fc139..4ab3a44b1 100644 --- a/src/osgPlugins/OpenFlight/FltWriteResult.h +++ b/src/osgPlugins/OpenFlight/FltWriteResult.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/GeometryRecords.cpp b/src/osgPlugins/OpenFlight/GeometryRecords.cpp index 85daddb2b..6b28110b0 100644 --- a/src/osgPlugins/OpenFlight/GeometryRecords.cpp +++ b/src/osgPlugins/OpenFlight/GeometryRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -256,7 +256,7 @@ public: // http://www.multigen-paradigm.com/ubb/Forum1/HTML/000967.html // Incorporate Face transparency per osg-users thread "Open Flight // characteristic not reflected in the current OSG" (Sept/Oct 2011) - colors->push_back(osg::Vec4(_primaryColor.r(), _primaryColor.g(), + colors->push_back(osg::Vec4(_primaryColor.r(), _primaryColor.g(), _primaryColor.b(), ( 1.0 - getTransparency() ) )); } } @@ -644,7 +644,7 @@ protected: billboard->getDrawable(i)->dirtyBound(); } - + billboard->dirtyBound(); } } @@ -1140,7 +1140,7 @@ protected: billboard->getDrawable(i)->dirtyBound(); } - + billboard->dirtyBound(); } } @@ -1248,7 +1248,7 @@ protected: { osg::Vec2f uv = in.readVec2f(); vertex.setUV(layer,uv); - + if (!uv.valid()) { OSG_NOTICE<<"Warning: data error detected in LocalVertexPool::readRecord uv="<size()) { Vertex& vertex = (*vertexList)[index]; diff --git a/src/osgPlugins/OpenFlight/LightPointRecords.cpp b/src/osgPlugins/OpenFlight/LightPointRecords.cpp index aa03eaf1f..7f069bce0 100644 --- a/src/osgPlugins/OpenFlight/LightPointRecords.cpp +++ b/src/osgPlugins/OpenFlight/LightPointRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -131,7 +131,7 @@ public: if (directional && vertex.validNormal()) { lp._sector = new osgSim::DirectionalSector( - vertex._normal, + vertex._normal, osg::DegreesToRadians(_lobeHorizontal), osg::DegreesToRadians(_lobeVertical), osg::DegreesToRadians(_lobeRoll)); @@ -145,7 +145,7 @@ public: { lp._blinkSequence->setDataVariance(osg::Object::DYNAMIC); lp._blinkSequence->setPhaseShift(_animationPhaseDelay); - lp._blinkSequence->addPulse(_animationPeriod - _animationPeriodEnable, + lp._blinkSequence->addPulse(_animationPeriod - _animationPeriodEnable, osg::Vec4f(0.0f, 0.0f, 0.0f, 0.0f)); lp._blinkSequence->addPulse(_animationPeriodEnable, lp._color); } @@ -165,7 +165,7 @@ public: // back sector lp._sector = new osgSim::DirectionalSector( - -vertex._normal, + -vertex._normal, osg::DegreesToRadians(_lobeHorizontal), osg::DegreesToRadians(_lobeVertical), osg::DegreesToRadians(_lobeRoll)); @@ -185,11 +185,11 @@ protected: _feature = in.readInt16(); int32 backColorIndex = in.readInt32(); - - _backColor = document.getColorPool() ? - document.getColorPool()->getColor(backColorIndex) : + + _backColor = document.getColorPool() ? + document.getColorPool()->getColor(backColorIndex) : osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f); - + _displayMode = in.readInt32(); _intensityFront = in.readFloat32(); _intensityBack = in.readFloat32(); @@ -285,7 +285,7 @@ public: if (directional && vertex.validNormal()) { lp._sector = new osgSim::DirectionalSector( - vertex._normal, + vertex._normal, osg::DegreesToRadians(_appearance->horizontalLobeAngle), osg::DegreesToRadians(_appearance->verticalLobeAngle), osg::DegreesToRadians(_appearance->lobeRollAngle)); @@ -358,7 +358,7 @@ public: // back sector lp._sector = new osgSim::DirectionalSector( - -vertex._normal, + -vertex._normal, osg::DegreesToRadians(_appearance->horizontalLobeAngle), osg::DegreesToRadians(_appearance->verticalLobeAngle), osg::DegreesToRadians(_appearance->lobeRollAngle)); diff --git a/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp b/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp index 53d62a530..6d4f3a9cd 100644 --- a/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -31,7 +31,7 @@ namespace flt LightSourcePaletteManager::LightSourcePaletteManager( ExportOptions& fltOpt ) : _currIndex( -1 ), _fltOpt( fltOpt ) - + { // TODO: Pay attention to the version here(?) } diff --git a/src/osgPlugins/OpenFlight/LightSourcePaletteManager.h b/src/osgPlugins/OpenFlight/LightSourcePaletteManager.h index 997b63e93..1e4fc767d 100644 --- a/src/osgPlugins/OpenFlight/LightSourcePaletteManager.h +++ b/src/osgPlugins/OpenFlight/LightSourcePaletteManager.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp b/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp index 75d44d232..72306c605 100644 --- a/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/MaterialPaletteManager.h b/src/osgPlugins/OpenFlight/MaterialPaletteManager.h index 53161895d..2af2a14a6 100644 --- a/src/osgPlugins/OpenFlight/MaterialPaletteManager.h +++ b/src/osgPlugins/OpenFlight/MaterialPaletteManager.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/Opcodes.h b/src/osgPlugins/OpenFlight/Opcodes.h index 8304341d3..4f73f7b62 100644 --- a/src/osgPlugins/OpenFlight/Opcodes.h +++ b/src/osgPlugins/OpenFlight/Opcodes.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/PaletteRecords.cpp b/src/osgPlugins/OpenFlight/PaletteRecords.cpp index 0577df78e..ea89ddeaf 100644 --- a/src/osgPlugins/OpenFlight/PaletteRecords.cpp +++ b/src/osgPlugins/OpenFlight/PaletteRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -218,7 +218,7 @@ protected: material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha)); material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha)); material->setShininess(osg::Material::FRONT_AND_BACK,shininess); - + MaterialPool* mp = document.getOrCreateMaterialPool(); (*mp)[index] = material; } @@ -257,14 +257,14 @@ protected: /*uint32 flags =*/ in.readUInt32(); std::string name = in.readString(12); in.forward(4*28); - + osg::Material* material = new osg::Material; material->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(ambient,alpha)); material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha)); material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha)); material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha)); material->setShininess(osg::Material::FRONT_AND_BACK,shininess); - + MaterialPool* mp = document.getOrCreateMaterialPool(); (*mp)[i] = material; } @@ -283,7 +283,7 @@ public: TexturePalette() {} META_Record(TexturePalette) - + protected: virtual ~TexturePalette() {} @@ -557,7 +557,7 @@ public: META_Record(LightSourcePalette) - enum LightType + enum LightType { INFINITE_LIGHT = 0, LOCAL_LIGHT = 1, @@ -655,9 +655,9 @@ protected: appearance->materialCode = in.readInt16(); appearance->featureID = in.readInt16(); - int32 backColorIndex = in.readInt32(); - appearance->backColor = document.getColorPool() ? - document.getColorPool()->getColor(backColorIndex) : + int32 backColorIndex = in.readInt32(); + appearance->backColor = document.getColorPool() ? + document.getColorPool()->getColor(backColorIndex) : osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f); appearance->displayMode = in.readInt32(); @@ -693,14 +693,14 @@ protected: appearance->fadeOutDuration = in.readFloat32(); appearance->LODRangeRatio = in.readFloat32(); appearance->LODScale = in.readFloat32(); - + if(document.version() > VERSION_15_8) appearance->texturePatternIndex = in.readInt16(-1); else appearance->texturePatternIndex = -1; - + // The final short is reserved; don't bother reading it. - + // Add to pool LightPointAppearancePool* lpaPool = document.getOrCreateLightPointAppearancePool(); (*lpaPool)[appearance->index] = appearance.get(); diff --git a/src/osgPlugins/OpenFlight/Pools.cpp b/src/osgPlugins/OpenFlight/Pools.cpp index 9524132c6..ea64068c0 100644 --- a/src/osgPlugins/OpenFlight/Pools.cpp +++ b/src/osgPlugins/OpenFlight/Pools.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/Pools.h b/src/osgPlugins/OpenFlight/Pools.h index 4df1a41a9..7d1058e4f 100644 --- a/src/osgPlugins/OpenFlight/Pools.h +++ b/src/osgPlugins/OpenFlight/Pools.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -94,7 +94,7 @@ public: // Get material, return default material if not found in palette. osg::Material* get(int index); - // Get or create material based on + // Get or create material based on // index: face material index // color: face color with alpha set to 1-face transparency. osg::Material* getOrCreateMaterial(int index, const osg::Vec4& faceColor); @@ -217,7 +217,7 @@ protected: struct LPAnimation : public osg::Referenced { - enum AnimationType + enum AnimationType { FLASHING_SEQUENCE = 0, ROTATING = 1, diff --git a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp b/src/osgPlugins/OpenFlight/PrimaryRecords.cpp index 8f97b5c80..6ef615c9b 100644 --- a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/PrimaryRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -87,7 +87,7 @@ protected: uint8 units = in.readUInt8(); // 0=Meters 1=Kilometers 4=Feet 5=Inches 8=Nautical miles /*uint8 textureWhite =*/ in.readUInt8(); /*uint32 flags =*/ in.readUInt32(); - + in.forward( 4*6 ); /*int32 projectionType =*/ in.readInt32(); @@ -222,7 +222,7 @@ protected: // of the animation bit. This implies forward animation (with swing) if ((document.version() < VERSION_15_8) && (_flags & SWING_ANIM)) _forwardAnim = true; - + // OpenFlight 15.8 adds backwards animations _backwardAnim = ( (document.version() >= VERSION_15_8) && ((_flags & BACKWARD_ANIM) != 0) ); @@ -259,7 +259,7 @@ protected: if (_forwardAnim) sequence->setInterval(loopMode, 0, -1); - else + else sequence->setInterval(loopMode, -1, 0); // Loop timing available from version 15.8. @@ -393,14 +393,14 @@ protected: float length_x = xAxis.normalize(); float length_y = yAxis.normalize(); float length_z = zAxis.normalize(); - + if ((length_x*length_y*length_z)==0.0f) { OSG_NOTICE<<"Warning: OpenFlight DegreeOfFreedom::readRecord() found erroneous axis definition:"< lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) using namespace flt; using namespace osg; @@ -226,7 +226,7 @@ class FLTReaderWriter : public ReaderWriter : _implicitPath( "." ) { supportsExtension("flt","OpenFlight format"); - + supportsOption("clampToEdge","Import option"); supportsOption("keepExternalReferences","Import option"); supportsOption("preserveFace","Import option"); @@ -262,7 +262,7 @@ class FLTReaderWriter : public ReaderWriter { return readNode(file, options); } - + virtual ReadResult readNode(const std::string& file, const Options* options) const { SERIALIZER(); @@ -280,7 +280,7 @@ class FLTReaderWriter : public ReaderWriter return ReadResult(node, ReaderWriter::ReadResult::FILE_LOADED_FROM_CACHE); } - // setting up the database path so that internally referenced file are searched for on relative paths. + // setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); @@ -303,7 +303,7 @@ class FLTReaderWriter : public ReaderWriter { // add to local cache. flt::Registry::instance()->addExternalToLocalCache(fileName,rr.getNode()); - + bool keepExternalReferences = false; if (options) keepExternalReferences = (options->getOptionString().find("keepExternalReferences")!=std::string::npos); @@ -323,7 +323,7 @@ class FLTReaderWriter : public ReaderWriter } else { - OSG_DEBUG << "keepExternalReferences found, so externals will be left as ProxyNodes"<getOptionString().find("clampToEdge")!=std::string::npos)); OSG_DEBUG << readerMsg << "clampToEdge=" << document.getReplaceClampWithClampToEdge() << std::endl; @@ -428,7 +428,7 @@ class FLTReaderWriter : public ReaderWriter opcode_type opcode = (opcode_type)dataStream.readUInt16(); size_type size = (size_type)dataStream.readUInt16(); - // If size == 0, an EOF has probably been reached, i.e. there is nothing + // If size == 0, an EOF has probably been reached, i.e. there is nothing // more to read so we must return. if (size==0) { @@ -514,8 +514,8 @@ class FLTReaderWriter : public ReaderWriter osgUtil::Optimizer optimizer; optimizer.optimize(document.getHeaderNode(), osgUtil::Optimizer::SHARE_DUPLICATE_STATE | - osgUtil::Optimizer::MERGE_GEOMETRY | - osgUtil::Optimizer::MERGE_GEODES | + osgUtil::Optimizer::MERGE_GEOMETRY | + osgUtil::Optimizer::MERGE_GEODES | osgUtil::Optimizer::TESSELLATE_GEOMETRY | osgUtil::Optimizer::STATIC_OBJECT_DETECTION); } diff --git a/src/osgPlugins/OpenFlight/Record.cpp b/src/osgPlugins/OpenFlight/Record.cpp index ba0ee101a..a1e339ac9 100644 --- a/src/osgPlugins/OpenFlight/Record.cpp +++ b/src/osgPlugins/OpenFlight/Record.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -56,7 +56,7 @@ void PrimaryRecord::read(RecordInputStream& in, Document& document) PrimaryRecord* parentPrimary = document.getTopOfLevelStack(); PrimaryRecord* currentPrimary = document.getCurrentPrimaryRecord(); - // Finally call dispose() for primary without push, pop level pair. + // Finally call dispose() for primary without push, pop level pair. if (currentPrimary && currentPrimary!=parentPrimary) { currentPrimary->dispose(document); diff --git a/src/osgPlugins/OpenFlight/Record.h b/src/osgPlugins/OpenFlight/Record.h index 64a835724..10f8f0bce 100644 --- a/src/osgPlugins/OpenFlight/Record.h +++ b/src/osgPlugins/OpenFlight/Record.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/RecordInputStream.cpp b/src/osgPlugins/OpenFlight/RecordInputStream.cpp index a5d904f17..09fccc8a8 100644 --- a/src/osgPlugins/OpenFlight/RecordInputStream.cpp +++ b/src/osgPlugins/OpenFlight/RecordInputStream.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/RecordInputStream.h b/src/osgPlugins/OpenFlight/RecordInputStream.h index 03b945856..be601104a 100644 --- a/src/osgPlugins/OpenFlight/RecordInputStream.h +++ b/src/osgPlugins/OpenFlight/RecordInputStream.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/Registry.cpp b/src/osgPlugins/OpenFlight/Registry.cpp index 13bc72682..87965888c 100644 --- a/src/osgPlugins/OpenFlight/Registry.cpp +++ b/src/osgPlugins/OpenFlight/Registry.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/Registry.h b/src/osgPlugins/OpenFlight/Registry.h index b7cb941f2..b94c6eb5a 100644 --- a/src/osgPlugins/OpenFlight/Registry.h +++ b/src/osgPlugins/OpenFlight/Registry.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ namespace flt { class Registry : public osg::Referenced { public: - + ~Registry(); static Registry* instance(); diff --git a/src/osgPlugins/OpenFlight/ReservedRecords.cpp b/src/osgPlugins/OpenFlight/ReservedRecords.cpp index c3569ac33..42700d262 100644 --- a/src/osgPlugins/OpenFlight/ReservedRecords.cpp +++ b/src/osgPlugins/OpenFlight/ReservedRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/RoadRecords.cpp b/src/osgPlugins/OpenFlight/RoadRecords.cpp index 5c41efb2a..104672242 100644 --- a/src/osgPlugins/OpenFlight/RoadRecords.cpp +++ b/src/osgPlugins/OpenFlight/RoadRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp b/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp index a2c2f8869..7e7e43a4d 100644 --- a/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/TexturePaletteManager.h b/src/osgPlugins/OpenFlight/TexturePaletteManager.h index 8a63a7e3e..f4b2fcd1f 100644 --- a/src/osgPlugins/OpenFlight/TexturePaletteManager.h +++ b/src/osgPlugins/OpenFlight/TexturePaletteManager.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/Types.h b/src/osgPlugins/OpenFlight/Types.h index f7595581e..a2c6dd49e 100644 --- a/src/osgPlugins/OpenFlight/Types.h +++ b/src/osgPlugins/OpenFlight/Types.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,8 +28,8 @@ typedef __int8 int8; typedef unsigned __int8 uint8; typedef __int16 int16; typedef unsigned __int16 uint16; -typedef __int32 int32; -typedef unsigned __int32 uint32; +typedef __int32 int32; +typedef unsigned __int32 uint32; typedef float float32; typedef double float64; @@ -39,8 +39,8 @@ typedef signed char int8; typedef unsigned char uint8; typedef signed short int16; typedef unsigned short uint16; -typedef signed int int32; -typedef unsigned int uint32; +typedef signed int int32; +typedef unsigned int uint32; typedef float float32; typedef double float64; diff --git a/src/osgPlugins/OpenFlight/Utils.h b/src/osgPlugins/OpenFlight/Utils.h index c083a2ed9..fbfb9d2ee 100644 --- a/src/osgPlugins/OpenFlight/Utils.h +++ b/src/osgPlugins/OpenFlight/Utils.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/Vertex.cpp b/src/osgPlugins/OpenFlight/Vertex.cpp index d392913b8..49c63bd8d 100644 --- a/src/osgPlugins/OpenFlight/Vertex.cpp +++ b/src/osgPlugins/OpenFlight/Vertex.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/Vertex.h b/src/osgPlugins/OpenFlight/Vertex.h index a5dbfb947..280ada458 100644 --- a/src/osgPlugins/OpenFlight/Vertex.h +++ b/src/osgPlugins/OpenFlight/Vertex.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp b/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp index ae6b8b47d..74f3ee666 100644 --- a/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -47,7 +47,7 @@ VertexPaletteManager::~VertexPaletteManager() // this file before we get to this destructor. return; } - OSG_INFO << "fltexp: Deleting temp file " << _verticesTempName << std::endl; + OSG_INFO << "fltexp: Deleting temp file " << _verticesTempName << std::endl; FLTEXP_DELETEFILE( _verticesTempName.c_str() ); } } @@ -64,7 +64,7 @@ VertexPaletteManager::add( const osg::Geometry& geom ) const osg::Array* c = geom.getColorArray(); const osg::Array* n = geom.getNormalArray(); const osg::Array* t = geom.getTexCoordArray( 0 ); - + const unsigned int size = v->getNumElements(); osg::ref_ptr< const osg::Vec3dArray > v3 = asVec3dArray( v, size ); osg::ref_ptr< const osg::Vec4Array > c4 = asVec4Array( c, size ); diff --git a/src/osgPlugins/OpenFlight/VertexPaletteManager.h b/src/osgPlugins/OpenFlight/VertexPaletteManager.h index aa4b0ffa4..47c603e80 100644 --- a/src/osgPlugins/OpenFlight/VertexPaletteManager.h +++ b/src/osgPlugins/OpenFlight/VertexPaletteManager.h @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/VertexRecords.cpp b/src/osgPlugins/OpenFlight/VertexRecords.cpp index 988624640..fb02dbe81 100644 --- a/src/osgPlugins/OpenFlight/VertexRecords.cpp +++ b/src/osgPlugins/OpenFlight/VertexRecords.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -201,7 +201,7 @@ class VertexCNT : public Record vertex.setCoord(coord*document.unitScale()); vertex.setNormal(normal); vertex.setUV(0,uv); - + if (!coord.valid()) { diff --git a/src/osgPlugins/OpenFlight/expAncillaryRecords.cpp b/src/osgPlugins/OpenFlight/expAncillaryRecords.cpp index 6605f0347..9f1902a11 100644 --- a/src/osgPlugins/OpenFlight/expAncillaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/expAncillaryRecords.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/expControlRecords.cpp b/src/osgPlugins/OpenFlight/expControlRecords.cpp index 5b9106e96..30ee84596 100644 --- a/src/osgPlugins/OpenFlight/expControlRecords.cpp +++ b/src/osgPlugins/OpenFlight/expControlRecords.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/osgPlugins/OpenFlight/expGeometryRecords.cpp b/src/osgPlugins/OpenFlight/expGeometryRecords.cpp index 3bfb1ef4e..de6ef656e 100644 --- a/src/osgPlugins/OpenFlight/expGeometryRecords.cpp +++ b/src/osgPlugins/OpenFlight/expGeometryRecords.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -497,7 +497,7 @@ FltExportVisitor::writeVertexList( int first, unsigned int count ) unsigned int idx; for( idx=0; idxwriteInt32( _vertexPalette->byteOffset( first+idx ) ); @@ -512,7 +512,7 @@ FltExportVisitor::writeVertexList( const std::vector& indices, uns unsigned int idx; for( idx=0; idxwriteInt32( _vertexPalette->byteOffset( indices[ idx ] ) ); diff --git a/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp b/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp index 9b6dd61b6..f46d17322 100644 --- a/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp @@ -1,9 +1,9 @@ -/* +/* * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at * your option) any later version. The full license is in the LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -211,7 +211,7 @@ FltExportVisitor::writeGroup( const osg::Group& group, } -// +// // Since OpenFlight doesn't have 'Sequence' records---just Group records that // may, optionally, be animated---this routine sets the animation-related // parameters for a Group record and simply forwards to writeGroup() @@ -219,14 +219,14 @@ FltExportVisitor::writeGroup( const osg::Group& group, void FltExportVisitor::writeSequence( const osg::Sequence& sequence ) { - + int32 flags = 0, loopCount = 0; float32 loopDuration = 0.0f, lastFrameDuration = 0.0f; osg::Sequence::LoopMode mode; int firstChildDisplayed, lastChildDisplayed; sequence.getInterval(mode, firstChildDisplayed, lastChildDisplayed); - + if (firstChildDisplayed == 0) { flags |= FORWARD_ANIM; @@ -422,7 +422,7 @@ FltExportVisitor::writeExternalReference( const osg::ProxyNode& proxy ) // Selectively turn off overrides for resources we don't need const ParentPools* pp = dynamic_cast(proxy.getUserData() ); - + if (pp && pp->getColorPool() ) flags &= ~COLOR_PALETTE_OVERRIDE; @@ -532,7 +532,7 @@ FltExportVisitor::writeSwitch( const osgSim::MultiSwitch* ms ) int32 numMasks = ms->getSwitchSetList().size(); int32 numWordsPerMask = ms->getNumChildren() / 32; if (ms->getNumChildren() % 32 != 0) ++numWordsPerMask; - + uint16 length( 28 + numMasks * numWordsPerMask * sizeof(int32) ); IdHelper id(*this, ms->getName() ); @@ -548,7 +548,7 @@ FltExportVisitor::writeSwitch( const osgSim::MultiSwitch* ms ) for (int i = 0; i < numMasks; ++i) { // ... write out the set of 32-bit words comprising the mask - uint32 maskWord = 0; + uint32 maskWord = 0; const osgSim::MultiSwitch::ValueList& maskBits = ms->getValueList(i); for (size_t j = 0; j < maskBits.size(); ++j) @@ -566,7 +566,7 @@ FltExportVisitor::writeSwitch( const osgSim::MultiSwitch* ms ) } // If the mask size wasn't a multiple of 32, need to write out - // the final word containing the 'remainder' bits + // the final word containing the 'remainder' bits if (maskBits.size() % 32 != 0) { _records->writeUInt32(maskWord); @@ -598,7 +598,7 @@ FltExportVisitor::writeSwitch( const osg::Switch* sw ) _records->writeInt32( numWordsPerMask ); // Bust the mask up into as many 32-bit words as are necessary to hold it - uint32 maskWord = 0; + uint32 maskWord = 0; const osg::Switch::ValueList& maskBits = sw->getValueList(); for (size_t i = 0; i < maskBits.size(); ++i) @@ -616,7 +616,7 @@ FltExportVisitor::writeSwitch( const osg::Switch* sw ) } // If the mask size wasn't a multiple of 32, need to write out - // the final word containing the 'remainder' bits + // the final word containing the 'remainder' bits if (maskBits.size() % 32 != 0) { _records->writeUInt32(maskWord); diff --git a/src/osgPlugins/ac/Geode.cpp b/src/osgPlugins/ac/Geode.cpp index a8bddbfed..04c67276e 100644 --- a/src/osgPlugins/ac/Geode.cpp +++ b/src/osgPlugins/ac/Geode.cpp @@ -46,7 +46,7 @@ void Geode::OutputVertex(int Index, const osg::IndexArray *pVertexIndices, const fout << LocalVertexIndex << " 0 0" << std::endl; } -void Geode::OutputLines(const int iCurrentMaterial, const unsigned int surfaceFlags, +void Geode::OutputLines(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrays* drawArray, ostream& fout) { unsigned int indexEnd = drawArray->getFirst() + drawArray->getCount(); @@ -57,7 +57,7 @@ void Geode::OutputLines(const int iCurrentMaterial, const unsigned int surfaceFl OutputVertex(vindex+1, pVertexIndices, pTexCoords, pTexIndices, fout); } } -void Geode::OutputLineStrip(const int iCurrentMaterial, const unsigned int surfaceFlags, +void Geode::OutputLineStrip(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrays* drawArray, ostream& fout) { unsigned int indexEnd = drawArray->getFirst() + drawArray->getCount(); @@ -67,7 +67,7 @@ void Geode::OutputLineStrip(const int iCurrentMaterial, const unsigned int surfa OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } } -void Geode::OutputLineLoop(const int iCurrentMaterial, const unsigned int surfaceFlags, +void Geode::OutputLineLoop(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrays* drawArray, ostream& fout) { unsigned int indexEnd = drawArray->getFirst() + drawArray->getCount(); @@ -77,14 +77,14 @@ void Geode::OutputLineLoop(const int iCurrentMaterial, const unsigned int surfac OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } } -void Geode::OutputTriangle(const int iCurrentMaterial, const unsigned int surfaceFlags, +void Geode::OutputTriangle(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrays* drawArray, ostream& fout) { unsigned int primCount = 0; unsigned int indexEnd = drawArray->getFirst() + drawArray->getCount(); for(unsigned int vindex=drawArray->getFirst(); vindexgetFirst() + drawArray->getCount(); unsigned int evenodd=0; for(unsigned int vindex=drawArray->getFirst(); vindexgetFirst() + drawArray->getCount(); @@ -123,14 +123,14 @@ void Geode::OutputTriangleFan(const int iCurrentMaterial, const unsigned int sur OutputVertex(vindex+1, pVertexIndices, pTexCoords, pTexIndices, fout); } } -void Geode::OutputQuads(const int iCurrentMaterial, const unsigned int surfaceFlags, +void Geode::OutputQuads(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrays* drawArray, std::ostream& fout) { unsigned int primCount = 0; unsigned int indexEnd = drawArray->getFirst() + drawArray->getCount(); for(unsigned int vindex=drawArray->getFirst(); vindexgetFirst() + drawArray->getCount(); @@ -151,7 +151,7 @@ void Geode::OutputQuadStrip(const int iCurrentMaterial, const unsigned int surfa OutputVertex(vindex+2, pVertexIndices, pTexCoords, pTexIndices, fout); } } -void Geode::OutputPolygon(const int iCurrentMaterial, const unsigned int surfaceFlags, +void Geode::OutputPolygon(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrays* drawArray, std::ostream& fout) { unsigned int indexEnd = drawArray->getFirst() + drawArray->getCount(); @@ -170,7 +170,7 @@ void Geode::OutputLineDARR(const int iCurrentMaterial, const unsigned int surfac { unsigned int localPrimLength; localPrimLength = 2; - + for(GLsizei primCount = 0; primCount < *primItr; ++primCount) { if ((primCount%localPrimLength)==0) @@ -180,7 +180,7 @@ void Geode::OutputLineDARR(const int iCurrentMaterial, const unsigned int surfac OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); ++vindex; } - + } } @@ -192,7 +192,7 @@ void Geode::OutputTriangleDARR(const int iCurrentMaterial, const unsigned int su { unsigned int localPrimLength; localPrimLength = 3; - + for(GLsizei primCount = 0; primCount < *primItr; ++primCount) { if ((primCount%localPrimLength)==0) @@ -202,7 +202,7 @@ void Geode::OutputTriangleDARR(const int iCurrentMaterial, const unsigned int su OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); ++vindex; } - + } } @@ -214,7 +214,7 @@ void Geode::OutputQuadsDARR(const int iCurrentMaterial, const unsigned int surfa { unsigned int localPrimLength; localPrimLength = 4; - + for(GLsizei primCount = 0; primCount < *primItr; ++primCount) { OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); @@ -224,7 +224,7 @@ void Geode::OutputQuadsDARR(const int iCurrentMaterial, const unsigned int surfa OutputVertex(vindex+3, pVertexIndices, pTexCoords, pTexIndices, fout); vindex+=4; } - + } } void Geode::OutputQuadStripDARR(const int iCurrentMaterial, const unsigned int surfaceFlags, @@ -235,7 +235,7 @@ void Geode::OutputQuadStripDARR(const int iCurrentMaterial, const unsigned int s { unsigned int localPrimLength; localPrimLength = *primItr; - + for(GLsizei primCount = 0; primCount < *primItr; ++primCount) { OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); @@ -245,7 +245,7 @@ void Geode::OutputQuadStripDARR(const int iCurrentMaterial, const unsigned int s OutputVertex(vindex+2, pVertexIndices, pTexCoords, pTexIndices, fout); vindex+=2; } - + } } void Geode::OutputPolygonDARR(const int iCurrentMaterial, const unsigned int surfaceFlags, @@ -256,7 +256,7 @@ void Geode::OutputPolygonDARR(const int iCurrentMaterial, const unsigned int sur { unsigned int localPrimLength; localPrimLength = *primItr; - + for(GLsizei primCount = 0; primCount < *primItr; ++primCount) { if ((primCount%localPrimLength)==0) @@ -266,7 +266,7 @@ void Geode::OutputPolygonDARR(const int iCurrentMaterial, const unsigned int sur OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); ++vindex; } - + } } void Geode::OutputTriangleStripDARR(const int iCurrentMaterial, const unsigned int surfaceFlags, @@ -278,7 +278,7 @@ void Geode::OutputTriangleStripDARR(const int iCurrentMaterial, const unsigned i // RFJ!!!!!!!!!! fixes for indexing int localPrimLength= *primItr; bool evenodd=true; - + for(GLsizei primCount = 0; primCount < localPrimLength - 2; ++primCount) { OutputSurfHead(iCurrentMaterial, surfaceFlags, 3, fout); @@ -291,7 +291,7 @@ void Geode::OutputTriangleStripDARR(const int iCurrentMaterial, const unsigned i } OutputVertex(vindex + primCount + 2, pVertexIndices, pTexCoords, pTexIndices, fout); evenodd=!evenodd; - } + } vindex += localPrimLength; } } @@ -302,7 +302,7 @@ void Geode::OutputTriangleFanDARR(const int iCurrentMaterial, const unsigned int for(osg::DrawArrayLengths::const_iterator primItr = drawArrayLengths->begin(); primItr end(); ++primItr) { int localPrimLength = *primItr; - + for(GLsizei primCount = 0; primCount < localPrimLength - 2; primCount++) { OutputSurfHead(iCurrentMaterial,surfaceFlags,3, fout); @@ -320,7 +320,7 @@ void Geode::OutputTriangleDelsUByte(const int iCurrentMaterial, const unsigned i const osg::DrawElementsUByte* drawElements, ostream& fout) { unsigned int primLength =3; - + unsigned int primCount = 0; for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItrend(); ++primCount,++primItr) { @@ -328,7 +328,7 @@ void Geode::OutputTriangleDelsUByte(const int iCurrentMaterial, const unsigned i { OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); } - + unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } @@ -341,7 +341,7 @@ void Geode::OutputTriangleStripDelsUByte(const int iCurrentMaterial, const unsig bool evenodd=true; for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItrend()-2; ++primItr) { - + unsigned int vindex=*primItr; unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); @@ -364,11 +364,11 @@ void Geode::OutputTriangleFanDelsUByte(const int iCurrentMaterial, const unsigne const unsigned int localPrimLength = 3; unsigned int vindex=*(drawElements->begin()); for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItrend()-2; ++primItr) - { + { unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -382,12 +382,12 @@ void Geode::OutputQuadStripDelsUByte(const int iCurrentMaterial, const unsigned for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItrend()-3; primItr+=2) { unsigned int vindex=*primItr; - + unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+3); unsigned int vindexp3=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -402,12 +402,12 @@ void Geode::OutputQuadsDelsUByte(const int iCurrentMaterial, const unsigned int for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItrend()-3; primItr+=4) { unsigned int vindex=*primItr; - + unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); unsigned int vindexp3=*(primItr+3); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -434,16 +434,16 @@ void Geode::OutputTriangleDelsUShort(const int iCurrentMaterial, const unsigned const osg::DrawElementsUShort* drawElements, ostream& fout) { unsigned int primLength =3; - + unsigned int primCount = 0; for(osg::DrawElementsUShort::const_iterator primItr=drawElements->begin(); primItrend(); ++primCount,++primItr) { - + if ((primCount%primLength) == 0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); } - + unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } @@ -478,11 +478,11 @@ void Geode::OutputTriangleFanDelsUShort(const int iCurrentMaterial, const unsign const unsigned int localPrimLength = 3; unsigned int vindex=*(drawElements->begin()); for(osg::DrawElementsUShort::const_iterator primItr=drawElements->begin(); primItrend()-2; ++primItr) - { + { unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -496,12 +496,12 @@ void Geode::OutputQuadStripDelsUShort(const int iCurrentMaterial, const unsigned for(osg::DrawElementsUShort::const_iterator primItr=drawElements->begin(); primItrend()-3; primItr+=2) { unsigned int vindex=*primItr; - + unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+3); unsigned int vindexp3=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -516,12 +516,12 @@ void Geode::OutputQuadsDelsUShort(const int iCurrentMaterial, const unsigned int for(osg::DrawElementsUShort::const_iterator primItr=drawElements->begin(); primItrend()-3; primItr+=4) { unsigned int vindex=*primItr; - + unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); unsigned int vindexp3=*(primItr+3); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -548,16 +548,16 @@ void Geode::OutputTriangleDelsUInt(const int iCurrentMaterial, const unsigned in const osg::DrawElementsUInt* drawElements, ostream& fout) { unsigned int primLength =3; - + unsigned int primCount = 0; for(osg::DrawElementsUInt::const_iterator primItr=drawElements->begin(); primItrend(); ++primCount,++primItr) { - + if ((primCount%primLength) == 0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); } - + unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } @@ -570,7 +570,7 @@ void Geode::OutputTriangleStripDelsUInt(const int iCurrentMaterial, const unsign bool evenodd=true; for(osg::DrawElementsUInt::const_iterator primItr=drawElements->begin(); primItrend()-2; ++primItr) { - + unsigned int vindex=*primItr; unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); @@ -593,11 +593,11 @@ void Geode::OutputTriangleFanDelsUInt(const int iCurrentMaterial, const unsigned const unsigned int localPrimLength = 3; unsigned int vindex=*(drawElements->begin()); for(osg::DrawElementsUInt::const_iterator primItr=drawElements->begin(); primItrend()-2; ++primItr) - { + { unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -611,12 +611,12 @@ void Geode::OutputQuadStripDelsUInt(const int iCurrentMaterial, const unsigned i for(osg::DrawElementsUInt::const_iterator primItr=drawElements->begin(); primItrend()-3; primItr+=2) { unsigned int vindex=*primItr; - + unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+3); unsigned int vindexp3=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -631,12 +631,12 @@ void Geode::OutputQuadsDelsUInt(const int iCurrentMaterial, const unsigned int s for(osg::DrawElementsUInt::const_iterator primItr=drawElements->begin(); primItrend()-3; primItr+=4) { unsigned int vindex=*primItr; - + unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); unsigned int vindexp3=*(primItr+3); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); - + OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); @@ -720,7 +720,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) // write out an object for each drawable. // Write out world object int ngeometry=0; // not all drawables are geometry, text is not converted to facets. - for (i = 0; i < iNumDrawables; i++) + for (i = 0; i < iNumDrawables; i++) { // so here we count the geometries to be converted to AC3D const osg::Drawable* Drawable = getDrawable(i); if (Drawable) { @@ -743,7 +743,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) if (NULL != pGeometry) { int iCurrentMaterial = -1; - + if (theState) { pRAP = theState->getAttributePair(osg::StateAttribute::MATERIAL); if (NULL != pRAP) @@ -752,7 +752,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) iNumMaterials++; } } - + //const osg::Vec3Array const osg::Array *pVertexArray = pGeometry->getVertexArray(); if (NULL != pVertexArray) @@ -763,7 +763,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) const osg::Vec2 *pTexCoords = NULL; fout << "OBJECT poly" << std::endl; fout << "name \"" << getName() << "\"" << std::endl; - + // Use zero offset co-ordinate as location IS OPTIONAL // fout << "loc " << "0 0 0" << std::endl; /* you could have an offset for the coordinates; it was suggested that the first coord would do. @@ -780,7 +780,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) << (*pVertexArray)[0][0] << " " << (*pVertexArray)[0][1] << " " << (*pVertexArray)[0][2] << std::endl; */ - + // Check for a texture if (theState) { @@ -795,11 +795,11 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) if (NULL != pTexture2D) { pTexCoords = (const osg::Vec2*)pGeometry->getTexCoordArray(0)->getDataPointer(); - + // OK now see if I can calcualate the repeats osg::Texture::WrapMode eWrapMode_s = pTexture2D->getWrap(osg::Texture::WRAP_S); //osg::Texture::WrapMode eWrapMode_t = pTexture2D->getWrap(osg::Texture::WRAP_T); - + if (eWrapMode_s == osg::Texture::REPEAT) { if (NULL != pTexCoords) @@ -808,7 +808,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) float fMin = std::numeric_limits::max(); float fMax = std::numeric_limits::min(); unsigned int iNumTexCoords = pGeometry->getTexCoordArray(0)->getNumElements(); - + for (j = 0; j < iNumTexCoords; j++) { if (pTexCoords[j][0] > fMax) @@ -842,7 +842,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) } } } - + fout << "numvert " << iNumVertices << std::endl; for (j = 0; j < iNumVertices; j++) { // use 3 types of osg::Vec for coordinates.... @@ -856,9 +856,9 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) const osg::Vec4Array *verts=static_cast(pVertexArray); fout << (*verts)[j][0] << " " << (*verts)[j][1] << " " << (*verts)[j][2] << std::endl; } - } - - + } + + // Generate a surface for each primitive unsigned int iNumSurfaces = 0; // complex tri-strip etc prims use more triangles osg::Geometry::PrimitiveSetList::const_iterator pItr; @@ -892,14 +892,14 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) } } fout << "numsurf " << iNumSurfaces << std::endl; - + for(pItr = pGeometry->getPrimitiveSetList().begin(); pItr != pGeometry->getPrimitiveSetList().end(); ++pItr) { const osg::PrimitiveSet* primitiveset = pItr->get(); GLenum mode=primitiveset->getMode(); - + unsigned int surfaceFlags = 0x00; - + switch(mode) { case(osg::PrimitiveSet::POINTS): @@ -915,7 +915,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) default: break; // compute later when =0. } - + // osg::StateAttribute::GLModeValue backface =theState->getMode(osg::StateAttribute::CULLFACE); // if (backface==osg::StateAttribute::ON) surfaceFlags |= 0x10; // else if (backface==osg::StateAttribute::OFF) surfaceFlags &= 0x0f; @@ -962,7 +962,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) } case(osg::PrimitiveSet::DrawArrayLengthsPrimitiveType): { - + const osg::DrawArrayLengths* drawArrayLengths = static_cast(primitiveset); switch(mode) { @@ -1018,7 +1018,7 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) default: break; // unknown shape } - + break; } case(osg::PrimitiveSet::DrawElementsUShortPrimitiveType): @@ -1050,23 +1050,23 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) /* if (primLength == 0) if (primLength == 0) primLength = primitiveset->getNumIndices(); - + const osg::DrawElementsUShort* drawElements = static_cast(primitiveset); - - unsigned int primCount = 0; - + + unsigned int primCount = 0; + for(osg::DrawElementsUShort::const_iterator primItr=drawElements->begin(); primItr!=drawElements->end(); ++primCount,++primItr) { - + if ((primCount%primLength) == 0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); } - + unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } */ - + break; } case(osg::PrimitiveSet::DrawElementsUIntPrimitiveType): @@ -1098,22 +1098,22 @@ void Geode::ProcessGeometry(ostream& fout, const unsigned int ioffset) /* if (primLength == 0) if (primLength == 0) primLength = primitiveset->getNumIndices(); - + const osg::DrawElementsUInt* drawElements = static_cast(primitiveset); - + unsigned int primCount=0; for(osg::DrawElementsUInt::const_iterator primItr=drawElements->begin(); primItr!=drawElements->end(); ++primCount,++primItr) { - + if ((primCount%primLength)==0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); } - + unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } */ - + break; } default: diff --git a/src/osgPlugins/ac/ac3d.cpp b/src/osgPlugins/ac/ac3d.cpp index 9b409698a..7f46cda63 100644 --- a/src/osgPlugins/ac/ac3d.cpp +++ b/src/osgPlugins/ac/ac3d.cpp @@ -70,12 +70,12 @@ class geodeVisitor : public osg::NodeVisitor { // collects geodes from scene sub class ReaderWriterAC : public osgDB::ReaderWriter { public: - + ReaderWriterAC() { supportsExtension("ac","AC3D Database format"); } - + virtual const char* className() const { return "AC3D Database Reader"; } virtual ReadResult readNode(const std::string& file,const Options* options) const @@ -86,7 +86,7 @@ class ReaderWriterAC : public osgDB::ReaderWriter // GWM added Dec 2003 - get full path name (change in osgDB handling of files). std::string fileName = osgDB::findDataFile( file, options ); OSG_INFO << "osgDB ac3d reader: starting reading \"" << fileName << "\"" << std::endl; - + // Anders Backmann - correct return if path not found if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; @@ -96,7 +96,7 @@ class ReaderWriterAC : public osgDB::ReaderWriter if (!fin.is_open()) return ReadResult::FILE_NOT_FOUND; // code for setting up the database path so that internally referenced file are - // searched for on relative paths. + // searched for on relative paths. osg::ref_ptr local_opt; if (options) local_opt = static_cast(options->clone(osg::CopyOp::DEEP_COPY_ALL)); @@ -162,7 +162,7 @@ class ReaderWriterAC : public osgDB::ReaderWriter fout.close(); return WriteResult::FILE_SAVED; } - + virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout, const Options* opts) const { // write ac file. @@ -177,7 +177,7 @@ class ReaderWriterAC : public osgDB::ReaderWriter } else OSG_WARN<<"File must start with a geode "< _refs; - + struct TriangleData { VertexIndex index[3]; }; std::vector _triangles; - + struct QuadData { VertexIndex index[4]; }; @@ -868,7 +868,7 @@ class SurfaceBin : public PrimitiveBin { weightedNormal += newNormal; } - + if (needTessellation) { unsigned polygonIndex = _toTessellatePolygons.size(); @@ -947,7 +947,7 @@ class SurfaceBin : public PrimitiveBin { else shadeModel->setMode(osg::ShadeModel::FLAT); stateSet->setAttribute(shadeModel); - + // Set up the arrays, allways store texture coords, may be we need them later ... osg::Geometry* geometry = new osg::Geometry; _geode->addDrawable(geometry); @@ -1138,11 +1138,11 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr osg::Vec2 textureRepeat(1, 1); float creaseAngle = 61; unsigned objectType = ObjectTypeGroup; - + while (!stream.eof() && stream.good()) { std::string token; stream >> token; - + if (token == "MATERIAL") { MaterialData mat; mat.readMaterial(stream); @@ -1151,7 +1151,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr else if (token == "OBJECT") { std::string type; stream >> type; - + if (type == "group") objectType = ObjectTypeGroup; else if (type == "light") @@ -1203,12 +1203,12 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr } else if (token == "numvert") { osg::Matrix currentTransform = transform*parentTransform; - + unsigned num; stream >> num; if (num != 0) { vertexSet->reserve(num); - + for (unsigned n = 0; n < num; ++n) { osg::Vec3 p; stream >> p[0] >> p[1] >> p[2]; @@ -1223,27 +1223,27 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr // list of materials required- generate one geode per material std::vector primitiveBins(fileData.getNumMaterials()); vertexSet->setCreaseAngle(creaseAngle); - + for (unsigned n = 0; n < num; ++n) { std::string token; stream >> token; - + if (token != "SURF") { OSG_FATAL << "osgDB ac3d reader: expected SURF line while reading object \"" << group->getName() << "\"!" << std::endl; return group.release(); } - + stream >> token; unsigned flags = strtol(token.c_str(), NULL, 0); - + stream >> token; if (token != "mat") { OSG_FATAL << "osgDB ac3d reader: expected mat line while reading object \"" << group->getName() << "\"!" << std::endl; return group.release(); } - + // read the material index unsigned matIdx; stream >> matIdx; @@ -1252,7 +1252,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr << group->getName() << "\"" << std::endl; return group.release(); } - + // now get the correct PrimitiveBin PrimitiveBin* primitiveBin = 0; primitiveBin = primitiveBins[matIdx].getOrCreatePrimitiveBin(flags, vertexSet.get()); @@ -1261,7 +1261,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr << group->getName() << "\"" << std::endl; return group.release(); } - + // read the refs stream >> token; if (token != "refs") { @@ -1269,7 +1269,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr << group->getName() << "\"" << std::endl; return group.release(); } - + unsigned nRefs = 0; stream >> nRefs; if (!stream) { @@ -1277,7 +1277,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr << group->getName() << "\"" << std::endl; return group.release(); } - + // in case this is an invalid refs count for this primitive // read further, but do not store that primitive bool acceptPrimitive = primitiveBin->beginPrimitive(nRefs); @@ -1291,7 +1291,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr << group->getName() << "\"" << std::endl; return group.release(); } - + // Read the texture corrdinates osg::Vec2 texCoord; stream >> texCoord[0] >> texCoord[1]; @@ -1302,12 +1302,12 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr std::string dummy; std::getline(stream, dummy); } - + if (acceptPrimitive) { texCoord[0] = textureOffset[0] + texCoord[0]*textureRepeat[0]; texCoord[1] = textureOffset[1] + texCoord[1]*textureRepeat[1]; - + if (!primitiveBin->vertex(index, texCoord)) { return group.release(); @@ -1322,7 +1322,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr } } } - + for (unsigned i = 0; i < primitiveBins.size(); ++i) primitiveBins[i].finalize(group.get(), fileData.getMaterial(i), textureData); } @@ -1345,7 +1345,7 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr group->setCullingActive(false); ls->setStateSetModes(*lightStateSet, osg::StateAttribute::ON); } - + group->addChild(k); } } @@ -1358,19 +1358,19 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr ac3dLight->setAmbient(osg::Vec4(0.5f,0.5f,0.5f,1.0f)); ac3dLight->setDiffuse(osg::Vec4(0.5f,0.5f,0.5f,1.0f)); ac3dLight->setSpecular(osg::Vec4(1.0f,1.0f,0.5f,1.0f)); - + osg::LightSource* ac3dLightSource = new osg::LightSource; ac3dLightSource->setDataVariance(osg::Object::STATIC); ac3dLightSource->setLight(ac3dLight); ac3dLightSource->setLocalStateSetModes(osg::StateAttribute::ON); - + // for some mad reason, you need to set this so that the light works. WHY? return ac3dLightSource; } return group.release(); } } - + return group.release(); } diff --git a/src/osgPlugins/bmp/ReaderWriterBMP.cpp b/src/osgPlugins/bmp/ReaderWriterBMP.cpp index 494dac682..1e47ebabd 100644 --- a/src/osgPlugins/bmp/ReaderWriterBMP.cpp +++ b/src/osgPlugins/bmp/ReaderWriterBMP.cpp @@ -546,12 +546,12 @@ static bool bmp_save(const osg::Image& img, std::ostream& fout) class ReaderWriterBMP : public osgDB::ReaderWriter { public: - + ReaderWriterBMP() { supportsExtension("bmp","BMP Image format"); } - + const char* className() const { return "BMP Image Reader"; } @@ -615,7 +615,7 @@ class ReaderWriterBMP : public osgDB::ReaderWriter int internalFormat; unsigned char *imageData = bmp_load(fin, s, t, internalFormat); - if (imageData == 0) return ReadResult::ERROR_IN_READING_FILE; + if (imageData == 0) return ReadResult::ERROR_IN_READING_FILE; unsigned int pixelFormat; switch (internalFormat) diff --git a/src/osgPlugins/bsp/BITSET.cpp b/src/osgPlugins/bsp/BITSET.cpp index 9e87b2879..223bdf8b0 100644 --- a/src/osgPlugins/bsp/BITSET.cpp +++ b/src/osgPlugins/bsp/BITSET.cpp @@ -5,7 +5,7 @@ // provide a link to my website in a readme file or similar // Downloaded from: www.paulsprojects.net // Created: 8th August 2002 -////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// #include "memory.h" #include "BITSET.h" diff --git a/src/osgPlugins/bsp/BITSET.h b/src/osgPlugins/bsp/BITSET.h index eb85a8ee8..8a2b135f1 100644 --- a/src/osgPlugins/bsp/BITSET.h +++ b/src/osgPlugins/bsp/BITSET.h @@ -5,7 +5,7 @@ // provide a link to my website in a readme file or similar // Downloaded from: www.paulsprojects.net // Created: 8th August 2002 -////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// #ifndef BITSET_H #define BITSET_H diff --git a/src/osgPlugins/bsp/Q3BSPLoad.cpp b/src/osgPlugins/bsp/Q3BSPLoad.cpp index b8432be1b..372eca7d7 100644 --- a/src/osgPlugins/bsp/Q3BSPLoad.cpp +++ b/src/osgPlugins/bsp/Q3BSPLoad.cpp @@ -44,7 +44,7 @@ bool Q3BSPLoad::Load(const std::string& filename, int curveTessellation) //Load in faces LoadFaces(file, curveTessellation); - + //Load textures LoadTextures(file); @@ -179,7 +179,7 @@ void Q3BSPLoad::LoadLightmaps(std::ifstream& aFile) if(b > 1.0f && (temp = (1.0f/b)) < scale) scale=temp; // scale up color values - scale*=255.0f; + scale*=255.0f; r*=scale; g*=scale; b*=scale; diff --git a/src/osgPlugins/bsp/Q3BSPLoad.h b/src/osgPlugins/bsp/Q3BSPLoad.h index 7b79b19b6..937311b85 100644 --- a/src/osgPlugins/bsp/Q3BSPLoad.h +++ b/src/osgPlugins/bsp/Q3BSPLoad.h @@ -208,5 +208,5 @@ public: } -#endif // Q3BSPLOAD_H +#endif // Q3BSPLOAD_H diff --git a/src/osgPlugins/bsp/Q3BSPReader.cpp b/src/osgPlugins/bsp/Q3BSPReader.cpp index f96880b4e..296893611 100644 --- a/src/osgPlugins/bsp/Q3BSPReader.cpp +++ b/src/osgPlugins/bsp/Q3BSPReader.cpp @@ -125,7 +125,7 @@ public: BSP_VERTEX m_controlPoints[9]; // Se accede a ellos en la carga protected: - + int m_tessellation; std::vector m_vertices; std::vector m_indices; @@ -285,8 +285,8 @@ osg::Geode* Q3BSPReader::convertFromBSP( } } - - + + osg::Geometry* patch_geom = new osg::Geometry; //tessellate the patch @@ -295,19 +295,19 @@ osg::Geode* Q3BSPReader::convertFromBSP( { stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); } - + if(lightmap_texture) { stateset->setTextureAttributeAndModes(1,lightmap_texture,osg::StateAttribute::ON); } - + //patch_group->addChild(map_geode); current_patch.m_quadraticPatches[y*numPatchesWide+x].Tessellate(8/*aCurveTessellation*/,patch_geom); map_geode->addDrawable(patch_geom); } } - + } @@ -364,7 +364,7 @@ osg::Geometry* Q3BSPReader::createMeshFace( const BSP_LOAD_FACE& aLoadFace,const } return obj_geom; - + } diff --git a/src/osgPlugins/bsp/Q3BSPReader.h b/src/osgPlugins/bsp/Q3BSPReader.h index 36ab1fc4a..d31ed69df 100644 --- a/src/osgPlugins/bsp/Q3BSPReader.h +++ b/src/osgPlugins/bsp/Q3BSPReader.h @@ -1,4 +1,4 @@ -// El siguiente bloque ifdef muestra la forma estándar de crear macros que facilitan +// El siguiente bloque ifdef muestra la forma estándar de crear macros que facilitan // la exportación de archivos DLL. Todos los archivos de este archivo DLL se compilan con el símbolo Q3BSP_EXPORTS // definido en la línea de comandos. Este símbolo no se debe definir en ningún proyecto // que utilice este archivo DLL. De este modo, otros proyectos cuyos archivos de código fuente incluyan el archivo diff --git a/src/osgPlugins/bsp/ReaderWriterBSP.cpp b/src/osgPlugins/bsp/ReaderWriterBSP.cpp index 58c622188..5ad32fe2e 100644 --- a/src/osgPlugins/bsp/ReaderWriterBSP.cpp +++ b/src/osgPlugins/bsp/ReaderWriterBSP.cpp @@ -52,7 +52,7 @@ ReaderWriter::ReadResult ReaderWriterBSP::readNode( // See if we can find the requested file std::string fileName = osgDB::findDataFile(file, options); - if (fileName.empty()) + if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; // Open the file and read the magic number and version diff --git a/src/osgPlugins/bsp/ReaderWriterBSP.h b/src/osgPlugins/bsp/ReaderWriterBSP.h index 6524b99a4..f203d4080 100644 --- a/src/osgPlugins/bsp/ReaderWriterBSP.h +++ b/src/osgPlugins/bsp/ReaderWriterBSP.h @@ -15,10 +15,10 @@ class ReaderWriterBSP : public osgDB::ReaderWriter public: virtual const char* className() const; - + virtual bool acceptsExtension(const std::string& extension) const; - - virtual ReadResult readNode(const std::string& file, + + virtual ReadResult readNode(const std::string& file, const Options* options) const; }; diff --git a/src/osgPlugins/bsp/VBSPData.cpp b/src/osgPlugins/bsp/VBSPData.cpp index d214ef755..7c1dc6242 100644 --- a/src/osgPlugins/bsp/VBSPData.cpp +++ b/src/osgPlugins/bsp/VBSPData.cpp @@ -256,7 +256,7 @@ void VBSPData::addStaticProp(StaticPropV4 & newProp) { StaticProp newPropV5; - // Create a version 5 static prop and copy the data from the given + // Create a version 5 static prop and copy the data from the given // version 4 prop into it memcpy(&newPropV5, &newProp, sizeof(StaticPropV4)); newPropV5.forced_fade_scale = 1.0; diff --git a/src/osgPlugins/bsp/VBSPData.h b/src/osgPlugins/bsp/VBSPData.h index 51e932acf..23a3b9438 100644 --- a/src/osgPlugins/bsp/VBSPData.h +++ b/src/osgPlugins/bsp/VBSPData.h @@ -183,7 +183,7 @@ protected: typedef std::vector SurfEdgeList; SurfEdgeList surface_edge_list; - + typedef std::vector FaceList; FaceList face_list; @@ -204,13 +204,13 @@ protected: typedef std::vector StaticPropModelList; StaticPropModelList static_prop_model_list; - + typedef std::vector StaticPropList; StaticPropList static_prop_list; - + typedef std::vector< osg::ref_ptr > StateSetList; StateSetList state_set_list; - + virtual ~VBSPData(); public: diff --git a/src/osgPlugins/bsp/VBSPEntity.cpp b/src/osgPlugins/bsp/VBSPEntity.cpp index 3d7a0bf5a..8127f146d 100644 --- a/src/osgPlugins/bsp/VBSPEntity.cpp +++ b/src/osgPlugins/bsp/VBSPEntity.cpp @@ -114,7 +114,7 @@ void VBSPEntity::processFuncBrush() // Get the origin parameter's value std::string value = (*param).second; - // Parse the value into a vector + // Parse the value into a vector entity_origin = getVector(value); } param = entity_parameters.find("angles"); @@ -123,7 +123,7 @@ void VBSPEntity::processFuncBrush() // Get the origin parameter's value std::string value = (*param).second; - // Parse the value into a vector + // Parse the value into a vector entity_angles = getVector(value); } } @@ -152,7 +152,7 @@ void VBSPEntity::processProp() // Get the origin parameter's value std::string value = (*param).second; - // Parse the value into a vector + // Parse the value into a vector entity_origin = getVector(value); } param = entity_parameters.find("angles"); @@ -161,7 +161,7 @@ void VBSPEntity::processProp() // Get the origin parameter's value std::string value = (*param).second; - // Parse the value into a vector + // Parse the value into a vector entity_angles = getVector(value); } } diff --git a/src/osgPlugins/bsp/VBSPGeometry.cpp b/src/osgPlugins/bsp/VBSPGeometry.cpp index 980c03775..a053afad5 100644 --- a/src/osgPlugins/bsp/VBSPGeometry.cpp +++ b/src/osgPlugins/bsp/VBSPGeometry.cpp @@ -30,7 +30,7 @@ VBSPGeometry::VBSPGeometry(VBSPData * bspData) disp_normal_array = new Vec3Array(); disp_texcoord_array = new Vec2Array(); disp_vertex_attr_array = new Vec4Array(); - + // Create a second primitive set for drawing indexed triangles, which is // the quickest method for drawing the displacement surfaces disp_primitive_set = new DrawElementsUInt(PrimitiveSet::TRIANGLES); @@ -42,7 +42,7 @@ VBSPGeometry::~VBSPGeometry() } -bool VBSPGeometry::doesEdgeExist(int row, int col, int direction, +bool VBSPGeometry::doesEdgeExist(int row, int col, int direction, int vertsPerEdge) { // See if there is an edge on the displacement surface from the given @@ -278,14 +278,14 @@ void VBSPGeometry::createDispSurface(Face & face, DisplaceInfo & dispInfo) osg::Vec2 texCoord; float alphaBlend; unsigned char edgeBits; - + // Get the texture info for this face currentTexInfo = bsp_data->getTexInfo(face.texinfo_index); currentTexData = bsp_data->getTexData(currentTexInfo.texdata_index); // Get the texture vectors and offsets. These are used to calculate - // texture coordinates + // texture coordinates texU.set(currentTexInfo.texture_vecs[0][0], currentTexInfo.texture_vecs[0][1], currentTexInfo.texture_vecs[0][2]); @@ -299,7 +299,7 @@ void VBSPGeometry::createDispSurface(Face & face, DisplaceInfo & dispInfo) texU *= 39.37f; texV *= 39.37f; - // Get the size of the texture involved, as the planar texture projection + // Get the size of the texture involved, as the planar texture projection // assumes non-normalized texture coordinates texUScale = 1.0f / (float)currentTexData.texture_width; texVScale = 1.0f / (float)currentTexData.texture_height; @@ -404,7 +404,7 @@ void VBSPGeometry::createDispSurface(Face & face, DisplaceInfo & dispInfo) // Calculate the displaced vertex dispVertex = - dispVertInfo.displace_vec * + dispVertInfo.displace_vec * (dispVertInfo.displace_dist * 0.0254); dispVertex += flatVertex; @@ -547,7 +547,7 @@ void VBSPGeometry::addFace(int faceIndex) currentTexData = bsp_data->getTexData(currentTexInfo.texdata_index); // Get the texture vectors and offsets. These are used to calculate - // texture coordinates + // texture coordinates texU.set(currentTexInfo.texture_vecs[0][0], currentTexInfo.texture_vecs[0][1], currentTexInfo.texture_vecs[0][2]); diff --git a/src/osgPlugins/bsp/VBSPReader.cpp b/src/osgPlugins/bsp/VBSPReader.cpp index 549a14c9a..8db6607f2 100644 --- a/src/osgPlugins/bsp/VBSPReader.cpp +++ b/src/osgPlugins/bsp/VBSPReader.cpp @@ -492,7 +492,7 @@ void VBSPReader::processStaticProps(std::istream & str, int offset, int length, // Next, skip over the static prop leaf array str.read((char *) &sprpLeaves, sizeof(StaticPropLeaves)); - str.seekg(sprpLeaves.num_leaf_entries * sizeof(unsigned short), + str.seekg(sprpLeaves.num_leaf_entries * sizeof(unsigned short), std::istream::cur); // Finally, read in the static prop entries @@ -575,7 +575,7 @@ ref_ptr VBSPReader::readTextureFile(std::string textureName) texFile = "materials/" + std::string(textureName) + ".vtf"; texPath = findDataFile(texFile, CASE_INSENSITIVE); - // Check up one directory if we don't find it here (the map file is + // Check up one directory if we don't find it here (the map file is // usually located in the "maps" directory, adjacent to the materials // directory) if (texPath.empty()) @@ -785,7 +785,7 @@ ref_ptr VBSPReader::readMaterialFile(std::string materialName) alpha = osg::asciiToDouble(token.c_str()); } } - + // Try the next token token = getToken(line, " \t\n\r\"", start); } @@ -1141,7 +1141,7 @@ bool VBSPReader::readFile(const std::string & file) // Load the bsp file lumps that we care about for (i = 0; i < MAX_LUMPS; i++) { - if ((header.lump_table[i].file_offset != 0) && + if ((header.lump_table[i].file_offset != 0) && (header.lump_table[i].lump_length != 0)) { // Process the lump diff --git a/src/osgPlugins/bsp/VBSPReader.h b/src/osgPlugins/bsp/VBSPReader.h index 8e1c8d0b9..421af423f 100644 --- a/src/osgPlugins/bsp/VBSPReader.h +++ b/src/osgPlugins/bsp/VBSPReader.h @@ -185,7 +185,7 @@ struct GameHeader // This is followed by this many GameLump entries (see below) }; - + struct GameLump { int lump_id; @@ -193,15 +193,15 @@ struct GameLump unsigned short lump_version; int lump_offset; int lump_length; -}; - - +}; + + // This is the ID for the static prop game lump const int STATIC_PROP_ID = (('s'<<24)+('p'<<16)+('r'<<8)+'p'); struct StaticPropModelNames -{ +{ int num_model_names; // This is followed by this many names, each 128 characters long diff --git a/src/osgPlugins/bvh/ReaderWriterBVH.cpp b/src/osgPlugins/bvh/ReaderWriterBVH.cpp index 1bd0374e0..88e21e1bb 100644 --- a/src/osgPlugins/bvh/ReaderWriterBVH.cpp +++ b/src/osgPlugins/bvh/ReaderWriterBVH.cpp @@ -53,7 +53,7 @@ public: stack.push_back( new osgAnimation::StackedTranslateElement("position", offset) ); stack.push_back( new osgAnimation::StackedQuaternionElement("quaternion", osg::Quat()) ); } - + if ( _drawingFlag && parent->getNumParents() && level>0 ) parent->getParent(0)->addChild( createRefGeometry(offset, 0.5).get() ); } @@ -310,7 +310,7 @@ protected: osg::ref_ptr createRefGeometry( osg::Vec3 p, double len ) { - osg::ref_ptr geode = new osg::Geode; + osg::ref_ptr geode = new osg::Geode; if ( _drawingFlag==1 ) { @@ -343,7 +343,7 @@ protected: geode->addDrawable( new osg::ShapeDrawable(box.get()) ); } - + return geode; } diff --git a/src/osgPlugins/cfg/Camera.cpp b/src/osgPlugins/cfg/Camera.cpp index 6bfe02ad8..704c53d1c 100644 --- a/src/osgPlugins/cfg/Camera.cpp +++ b/src/osgPlugins/cfg/Camera.cpp @@ -22,7 +22,7 @@ using namespace osgProducer; -Camera::Camera( void ) +Camera::Camera( void ) { _index = 0; @@ -46,14 +46,14 @@ Camera::Camera( void ) _lens = new Lens; _lens->setAutoAspect(true); _rs = new RenderSurface; - + _clear_color[0] = 0.2f; _clear_color[1] = 0.2f; _clear_color[2] = 0.4f; _clear_color[3] = 1.0f; - + _focal_distance = 1.0; - + _shareLens = true; _shareView = true; @@ -106,7 +106,7 @@ Camera::Lens::Lens( void ) // _right = 0.5; // _bottom = -0.5; // _top = 0.5; - + // Setting of the frustum which are appropriate for // a monitor which is 26cm high, 50cm distant from the // viewer and an horzintal/vetical aspect ratio of 1.25. @@ -137,7 +137,7 @@ void Camera::Lens::setAspectRatio( double aspectRatio ) _updateFOV(); } -void Camera::Lens::setPerspective( double hfov, double vfov, +void Camera::Lens::setPerspective( double hfov, double vfov, double nearClip, double farClip ) { _hfov = osg::DegreesToRadians(hfov); @@ -147,8 +147,8 @@ void Camera::Lens::setPerspective( double hfov, double vfov, _nearClip = nearClip; _farClip = farClip; - _left = -_nearClip * tan(_hfov/2.0); - _right = _nearClip * tan(_hfov/2.0); + _left = -_nearClip * tan(_hfov/2.0); + _right = _nearClip * tan(_hfov/2.0); _bottom = -_nearClip * tan(_vfov/2.0); _top = _nearClip * tan(_vfov/2.0); @@ -156,8 +156,8 @@ void Camera::Lens::setPerspective( double hfov, double vfov, setAutoAspect(false); } -void Camera::Lens::setFrustum( double left, double right, - double bottom, double top, +void Camera::Lens::setFrustum( double left, double right, + double bottom, double top, double nearClip, double farClip ) { _left = left; @@ -171,8 +171,8 @@ void Camera::Lens::setFrustum( double left, double right, setAutoAspect(false); } -void Camera::Lens::setOrtho( double left, double right, - double bottom, double top, +void Camera::Lens::setOrtho( double left, double right, + double bottom, double top, double nearClip, double farClip ) { _ortho_left = left; @@ -201,7 +201,7 @@ bool Camera::Lens::getFrustum( double& left, double& right, zNear = _matrix[14] / (_matrix[10]-1.0); zFar = _matrix[14] / (1.0+_matrix[10]); - + left = zNear * (_matrix[8]-1.0) / _matrix[0]; right = zNear * (1.0+_matrix[8]) / _matrix[0]; @@ -220,7 +220,7 @@ bool Camera::Lens::getOrtho( double& left, double& right, zNear = (_matrix[14]+1.0) / _matrix[10]; zFar = (_matrix[14]-1.0) / _matrix[10]; - + left = -(1.0+_matrix[12]) / _matrix[0]; right = (1.0-_matrix[12]) / _matrix[0]; @@ -320,10 +320,10 @@ void Camera::Lens::getParams( double &left, double &right, double &bottom, doubl void Camera::setProjectionRectangle( const float left, const float right, const float bottom, const float top ) { - _projrectLeft = left; - _projrectRight = right; - _projrectBottom = bottom; - _projrectTop = top; + _projrectLeft = left; + _projrectRight = right; + _projrectBottom = bottom; + _projrectTop = top; } void Camera::getProjectionRectangle( float &left, float &right, @@ -335,7 +335,7 @@ void Camera::getProjectionRectangle( float &left, float &right, top = _projrectTop; } -void Camera::setProjectionRectangle( int x, int y, unsigned int width, unsigned int height ) +void Camera::setProjectionRectangle( int x, int y, unsigned int width, unsigned int height ) { int _x, _y; unsigned int _w, _h; @@ -409,11 +409,11 @@ void Camera::getClearColor( float& red, float& green, float& blue, float& alpha) } -void Camera::clear( void ) +void Camera::clear( void ) { #if 0 if( !_initialized ) _initialize(); - int x, y; + int x, y; unsigned int w, h; getProjectionRectangle( x, y, w, h ); glViewport( x, y, w, h ); @@ -564,7 +564,7 @@ void Camera::Lens::generateMatrix(float xshear, float yshear, osg::Matrix::value // It's not an orthographic matrix so just assume a perspective shear matrix[ 8] += -xshear; matrix[ 9] += -yshear; - } + } else { matrix[12] += xshear; @@ -612,9 +612,9 @@ int Camera::cancel() #if 1 _done = true; #endif - + Thread::cancel(); - return 0; + return 0; } void Camera::advance() @@ -640,7 +640,7 @@ void Camera::run( void ) // printf(" Camera::run before frame block\n"); _frameBarrier->block(); - + if (_done) break; // printf(" Camera::run after frame block\n"); @@ -659,7 +659,7 @@ void Camera::run( void ) advance(); } - + // printf("Exiting Camera::run cleanly\n"); } @@ -675,12 +675,12 @@ bool Camera::removePostCullCallback( Callback *cb ) return _removeCallback( postCullCallbacks, cb ); } -bool Camera::removePreDrawCallback( Callback *cb ) +bool Camera::removePreDrawCallback( Callback *cb ) { return _removeCallback( preDrawCallbacks, cb ); } -bool Camera::removePostDrawCallback( Callback *cb ) +bool Camera::removePostDrawCallback( Callback *cb ) { return _removeCallback( postDrawCallbacks, cb ); } @@ -743,12 +743,12 @@ void Camera::FrameTimeStampSet::beginPipeTimer( PipeStatsID id) if( !_initialized ) _init(); - PipeTimer::instance()->begin( _pipeStatsNames[id][_pipeStatsDoubleBufferIndex] ); - _pipeStatsSetMask[_pipeStatsDoubleBufferIndex] |= (1<begin( _pipeStatsNames[id][_pipeStatsDoubleBufferIndex] ); + _pipeStatsSetMask[_pipeStatsDoubleBufferIndex] |= (1<setWindowRectangle(x,y,width,height, resize); } - void setLens( Lens *lens ) - { + void setLens( Lens *lens ) + { if( _lens.get() != lens ) - _lens = lens; + _lens = lens; } Lens *getLens() { return _lens.get(); } @@ -205,10 +205,10 @@ class Camera : public osg::Referenced ////////////////////////////////////////////////////////////////////////////////////// /** Convenience method for setting the Lens Perspective. See Camera::Lens::setPerspective(). */ - void setLensPerspective( double hfov, double vfov, + void setLensPerspective( double hfov, double vfov, double nearClip, double farClip, double xshear=0, double yshear=0 ) - { + { _offset._xshear = xshear; _offset._yshear = yshear; _lens->setPerspective(hfov,vfov,nearClip,farClip); @@ -216,47 +216,47 @@ class Camera : public osg::Referenced /** Convenience method for setting the Lens Frustum. See Camera::Lens::setFrustum(). */ - void setLensFrustum( double left, double right, - double bottom, double top, + void setLensFrustum( double left, double right, + double bottom, double top, double nearClip, double farClip, double xshear=0, double yshear=0 ) - { + { _offset._xshear = xshear; _offset._yshear = yshear; - _lens->setFrustum(left,right,bottom,top,nearClip, farClip); + _lens->setFrustum(left,right,bottom,top,nearClip, farClip); } /** Convenience method for setting the lens Orthographic projection. - See Camera::Lens::setOrtho() */ - void setLensOrtho( double left, double right, - double bottom, double top, + See Camera::Lens::setOrtho() */ + void setLensOrtho( double left, double right, + double bottom, double top, double nearClip, double farClip , double xshear=0, double yshear=0 ) - { + { _offset._xshear = xshear; _offset._yshear = yshear; - _lens->setOrtho( left, right, bottom, top, nearClip, farClip); + _lens->setOrtho( left, right, bottom, top, nearClip, farClip); } /** Convenience method for setting the lens shear. See Camera::Lens::setShear()*/ void setLensShear( double xshear, double yshear ) - { + { _offset._xshear = xshear; _offset._yshear = yshear; } /** Convenience method for getting the lens shear. See Camera::Lens::getShear() */ void getLensShear( double &xshear, double &yshear ) - { + { xshear = _offset._xshear; yshear = _offset._yshear; } - /** Convenience method for converting the Perpective lens to an + /** Convenience method for converting the Perpective lens to an Orthographic lens. see Camera::lens:convertToOrtho() */ bool convertLensToOrtho( float d) { return _lens->convertToOrtho(d); } - /** Convenience method for converting the Orthographic lens to an + /** Convenience method for converting the Orthographic lens to an Perspective lens. see Camera::lens:convertToPerspective() */ bool convertLensToPerspective( float d) { return _lens->convertToPerspective(d); } @@ -267,7 +267,7 @@ class Camera : public osg::Referenced /** Convenience method for applying the lens. See Camera::Lens::apply() */ void applyLens() { _lens->apply(_offset._xshear, _offset._yshear); } - /** Convenience method for getting the Lens parameters. + /** Convenience method for getting the Lens parameters. See Camera::Lens::apply() */ void getLensParams( double &left, double &right, double &bottom, double &top, double &nearClip, double &farClip, double &xshear, double &yshear ) @@ -277,11 +277,11 @@ class Camera : public osg::Referenced yshear = _offset._yshear; } - /** Convenience method for getting the Lens Horizontal field of view. + /** Convenience method for getting the Lens Horizontal field of view. See Camera::Lens::getHorizontalFov() */ float getLensHorizontalFov() { return _lens->getHorizontalFov(); } - /** Convenience method for getting the Lens Horizontal field of view. + /** Convenience method for getting the Lens Horizontal field of view. See Camera::Lens::getVerticalFov() */ float getLensVerticalFov() { return _lens->getVerticalFov(); } @@ -293,7 +293,7 @@ class Camera : public osg::Referenced /** Convenience method for getting the Lens ProjectionMatrix. See Camera::Lens::getMatrix() */ void getLensMatrix(osg::Matrix::value_type matrix[16] ) - { + { _lens->generateMatrix(_offset._xshear, _offset._yshear, matrix ); } @@ -321,9 +321,9 @@ class Camera : public osg::Referenced void setProjectionRectangle( int x, int y, unsigned int width, unsigned int height ); void getProjectionRectangle( int &x, int &y, unsigned int &width, unsigned int &height ) const ; - osg::Matrix::value_type *getProjectionMatrix () - { - _lens->generateMatrix(_offset._xshear, _offset._yshear, _projectionMatrix ); + osg::Matrix::value_type *getProjectionMatrix () + { + _lens->generateMatrix(_offset._xshear, _offset._yshear, _projectionMatrix ); return _projectionMatrix; } @@ -337,10 +337,10 @@ class Camera : public osg::Referenced const osg::Matrix::value_type *getPositionAndAttitudeMatrix( void ) const { return _viewMatrix; } void applyView(); - void setOffset( const osg::Matrix::value_type matrix[16], - osg::Matrix::value_type _xshear=0.0, - osg::Matrix::value_type _yshear=0.0); - void setOffset( double _xshear, double _yshear); + void setOffset( const osg::Matrix::value_type matrix[16], + osg::Matrix::value_type _xshear=0.0, + osg::Matrix::value_type _yshear=0.0); + void setOffset( double _xshear, double _yshear); void setOffsetMultiplyMethod( Offset::MultiplyMethod method ) { _offset._multiplyMethod = method; @@ -349,9 +349,9 @@ class Camera : public osg::Referenced void setClearColor( float red, float green, float blue, float alpha); void getClearColor( float& red, float& green, float& blue, float& alpha); - + void clear( void ); - + void setIndex( unsigned int index ) { _index = index; } unsigned int getIndex() const { return _index; } diff --git a/src/osgPlugins/cfg/CameraConfig.cpp b/src/osgPlugins/cfg/CameraConfig.cpp index 4c233b22d..1e630d77c 100644 --- a/src/osgPlugins/cfg/CameraConfig.cpp +++ b/src/osgPlugins/cfg/CameraConfig.cpp @@ -54,13 +54,13 @@ CameraConfig::CameraConfig() : _offset_shearx(0.0f), _offset_sheary(0.0f), _postmultiply(false) - + { _offset_matrix[0] = 1.0; _offset_matrix[1] = 0.0; _offset_matrix[2] = 0.0; _offset_matrix[3] = 0.0; _offset_matrix[4] = 0.0; _offset_matrix[5] = 1.0; _offset_matrix[6] = 0.0; _offset_matrix[7] = 0.0; _offset_matrix[8] = 0.0; _offset_matrix[9] = 0.0; _offset_matrix[10] = 1.0; _offset_matrix[11] = 0.0; _offset_matrix[12] = 0.0; _offset_matrix[13] = 0.0; _offset_matrix[14] = 0.0; _offset_matrix[15] = 1.0; - + _threadModelDirective = CameraGroup::getDefaultThreadModel(); } @@ -74,7 +74,7 @@ void CameraConfig::beginVisual( void ) void CameraConfig::beginVisual( const char * name ) { - std::pair::iterator,bool> res = + std::pair::iterator,bool> res = _visual_map.insert(std::pair(std::string(name), new VisualChooser)); _current_visual_chooser = (res.first)->second; _can_add_visual_attributes = true; @@ -103,7 +103,7 @@ void CameraConfig::setVisualByID( unsigned int id ) void CameraConfig::addVisualAttribute( VisualChooser::AttributeName token, int param ) { if( !_current_visual_chooser.valid() || _can_add_visual_attributes == false ) - { + { std::cerr << "CameraConfig::addVisualAttribute(token,param) : ERROR no current visual\n"; return; } @@ -157,9 +157,9 @@ VisualChooser *CameraConfig::findVisual( const char *name ) void CameraConfig::beginRenderSurface( const char *name ) { - std::pair >::iterator,bool> res = + std::pair >::iterator,bool> res = _render_surface_map.insert(std::pair >( - std::string(name), + std::string(name), new RenderSurface)); _current_render_surface = (res.first)->second.get(); _current_render_surface->setWindowName( std::string(name) ); @@ -275,13 +275,13 @@ unsigned int CameraConfig::getNumberOfRenderSurfaces() RenderSurface *CameraConfig::getRenderSurface( unsigned int index ) { - if( index >= _render_surface_map.size() ) + if( index >= _render_surface_map.size() ) return NULL; std::map >::iterator p; unsigned int i = 0; for( p = _render_surface_map.begin(); p != _render_surface_map.end(); p++ ) - if( i++ == index ) + if( i++ == index ) break; if( p == _render_surface_map.end() ) return NULL; @@ -309,7 +309,7 @@ void CameraConfig::addCamera( std::string name, Camera *camera ) void CameraConfig::beginCamera( std::string name ) { Camera *camera = new Camera; - std::pair >::iterator,bool> res = + std::pair >::iterator,bool> res = _camera_map.insert(std::pair >(name, camera)); _current_camera = (res.first)->second.get(); _can_add_camera_attributes = true; @@ -447,13 +447,13 @@ unsigned int CameraConfig::getNumberOfCameras() const const Camera *CameraConfig::getCamera( unsigned int n ) const { - if( n >= _camera_map.size() ) + if( n >= _camera_map.size() ) return NULL; unsigned int i; std::map >::const_iterator p; for( i = 0, p = _camera_map.begin(); p != _camera_map.end(); p++ ) - if( i++ == n ) + if( i++ == n ) break; if( p == _camera_map.end() ) return NULL; @@ -462,13 +462,13 @@ const Camera *CameraConfig::getCamera( unsigned int n ) const Camera *CameraConfig::getCamera( unsigned int n ) { - if( n >= _camera_map.size() ) + if( n >= _camera_map.size() ) return NULL; unsigned int i; std::map >::iterator p; for( i = 0, p = _camera_map.begin(); p != _camera_map.end(); p++ ) - if( i++ == n ) + if( i++ == n ) break; if( p == _camera_map.end() ) return NULL; @@ -482,7 +482,7 @@ void CameraConfig::beginInputArea() } void CameraConfig::addInputAreaEntry( char *renderSurfaceName ) -{ +{ osgProducer::RenderSurface *rs = findRenderSurface( renderSurfaceName ); if( rs == NULL ) { @@ -493,24 +493,24 @@ void CameraConfig::addInputAreaEntry( char *renderSurfaceName ) _input_area->addRenderSurface( rs ); } -void CameraConfig::endInputArea() +void CameraConfig::endInputArea() { _can_add_input_area_entries = false; } -void CameraConfig::setInputArea(InputArea *ia) -{ - _input_area=ia; +void CameraConfig::setInputArea(InputArea *ia) +{ + _input_area=ia; } -InputArea *CameraConfig::getInputArea() -{ - return _input_area.get(); +InputArea *CameraConfig::getInputArea() +{ + return _input_area.get(); } -const InputArea *CameraConfig::getInputArea() const -{ - return _input_area.get(); +const InputArea *CameraConfig::getInputArea() const +{ + return _input_area.get(); } #if 0 @@ -531,13 +531,13 @@ void CameraConfig::addStereoSystemCommand( int screen, std::string stereoCmd, st _stereoSystemCommands.push_back(StereoSystemCommand( screen, stereoCmd, monoCmd )); } -const std::vector &CameraConfig::getStereoSystemCommands() -{ - return _stereoSystemCommands; +const std::vector &CameraConfig::getStereoSystemCommands() +{ + return _stereoSystemCommands; } -CameraConfig::~CameraConfig() +CameraConfig::~CameraConfig() { } @@ -546,7 +546,7 @@ CameraConfig::~CameraConfig() void CameraConfig::rotateCameraOffset( osg::Matrix::value_type deg, osg::Matrix::value_type x, osg::Matrix::value_type y, osg::Matrix::value_type z ) { osg::Matrix m; - m.invert(osg::Matrix::rotate( osg::DegreesToRadians(deg), x,y,z)); + m.invert(osg::Matrix::rotate( osg::DegreesToRadians(deg), x,y,z)); m = m * osg::Matrix(_offset_matrix); memcpy( _offset_matrix, m.ptr(), sizeof( osg::Matrix::value_type[16] )); } @@ -554,7 +554,7 @@ void CameraConfig::rotateCameraOffset( osg::Matrix::value_type deg, osg::Matrix: void CameraConfig::translateCameraOffset( osg::Matrix::value_type x, osg::Matrix::value_type y, osg::Matrix::value_type z ) { osg::Matrix m; - m.invert(osg::Matrix::translate( x,y,z)); + m.invert(osg::Matrix::translate( x,y,z)); m = m * osg::Matrix(_offset_matrix); memcpy( _offset_matrix, m.ptr(), sizeof( osg::Matrix::value_type[16] )); } @@ -577,23 +577,23 @@ std::string CameraConfig::findFile( std::string filename ) if( ptr != NULL ) { path = std::string(ptr) + '/' + filename; - if( osgDB::fileExists(path)) + if( osgDB::fileExists(path)) return path; } // Check standard location(s) //path.clear(); path = std::string( "/usr/local/share/Producer/Config/") + filename; - if( osgDB::fileExists(path) ) + if( osgDB::fileExists(path) ) return path; //path.clear(); path = std::string( "/usr/share/Producer/Config/") + filename; - if( osgDB::fileExists(path) ) + if( osgDB::fileExists(path) ) return path; // Check local directory - if(osgDB::fileExists(filename)) + if(osgDB::fileExists(filename)) return filename; // Fail @@ -635,7 +635,7 @@ bool CameraConfig::defaultConfig() { std::stringstream sstr; sstr<<"Screen"< >::iterator,bool> res = + std::pair >::iterator,bool> res = _camera_map.insert(std::pair >(name, new Camera)); ((res.first)->second)->getRenderSurface()->setScreenNum( i ); @@ -650,7 +650,7 @@ bool CameraConfig::defaultConfig() ia->addRenderSurface(rs); } - _render_surface_map.insert(std::pair >( rs->getWindowName(), rs )); xshear -= 2.0; @@ -659,5 +659,5 @@ bool CameraConfig::defaultConfig() _threadModelDirective = CameraGroup::getDefaultThreadModel(); return true; -} +} diff --git a/src/osgPlugins/cfg/CameraConfig.h b/src/osgPlugins/cfg/CameraConfig.h index 0ed1c23e3..0272b6e7a 100644 --- a/src/osgPlugins/cfg/CameraConfig.h +++ b/src/osgPlugins/cfg/CameraConfig.h @@ -58,7 +58,7 @@ namespace osgProducer { class CameraConfig : public osg::Referenced { public : - CameraConfig(); + CameraConfig(); void beginVisual( void ); @@ -140,7 +140,7 @@ class CameraConfig : public osg::Referenced float xshear=0.0, float yshear=0.0 ); void setCameraLensShear( osg::Matrix::value_type xshear, osg::Matrix::value_type yshear ); - + void setCameraShareLens( bool shared ); void setCameraShareView( bool shared ); @@ -166,7 +166,7 @@ class CameraConfig : public osg::Referenced Camera *findCamera( const char *name ); unsigned int getNumberOfCameras() const; - + const Camera *getCamera( unsigned int n ) const; Camera *getCamera( unsigned int n ); diff --git a/src/osgPlugins/cfg/ConfigLexer.cpp b/src/osgPlugins/cfg/ConfigLexer.cpp index 31c837be6..d81fce112 100644 --- a/src/osgPlugins/cfg/ConfigLexer.cpp +++ b/src/osgPlugins/cfg/ConfigLexer.cpp @@ -925,15 +925,15 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP #line 37 ".././ConfigLexer.l" -{ +{ #ifdef DEBUG char buff[128]; int i = 0; #endif - + char c; while( (c = yyinput()) != '\n' ) - { + { if( c <= 0 ) break; #ifdef DEBUG @@ -969,7 +969,7 @@ YY_RULE_SETUP case 6: YY_RULE_SETUP #line 62 ".././ConfigLexer.l" -{ +{ char c; int i = 0; while( (c = yyinput()) != '"' ) diff --git a/src/osgPlugins/cfg/ConfigParser.cpp b/src/osgPlugins/cfg/ConfigParser.cpp index 53751b564..a7be967cf 100644 --- a/src/osgPlugins/cfg/ConfigParser.cpp +++ b/src/osgPlugins/cfg/ConfigParser.cpp @@ -531,43 +531,43 @@ static const unsigned short yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "PRTOKEN_VISUAL", "PRTOKEN_SET_SIMPLE", - "PRTOKEN_VISUAL_ID", "PRTOKEN_BUFFER_SIZE", "PRTOKEN_LEVEL", - "PRTOKEN_RGBA", "PRTOKEN_DOUBLEBUFFER", "PRTOKEN_STEREO", - "PRTOKEN_AUX_BUFFERS", "PRTOKEN_RED_SIZE", "PRTOKEN_GREEN_SIZE", - "PRTOKEN_BLUE_SIZE", "PRTOKEN_ALPHA_SIZE", "PRTOKEN_DEPTH_SIZE", - "PRTOKEN_STENCIL_SIZE", "PRTOKEN_ACCUM_RED_SIZE", - "PRTOKEN_ACCUM_GREEN_SIZE", "PRTOKEN_ACCUM_BLUE_SIZE", - "PRTOKEN_ACCUM_ALPHA_SIZE", "PRTOKEN_SAMPLES", "PRTOKEN_SAMPLE_BUFFERS", - "PRTOKEN_RENDER_SURFACE", "PRTOKEN_WINDOW_RECT", "PRTOKEN_INPUT_RECT", - "PRTOKEN_HOSTNAME", "PRTOKEN_DISPLAY", "PRTOKEN_SCREEN", - "PRTOKEN_BORDER", "PRTOKEN_DRAWABLE_TYPE", "PRTOKEN_WINDOW_TYPE", - "PRTOKEN_PBUFFER_TYPE", "PRTOKEN_CAMERA_GROUP", "PRTOKEN_CAMERA", - "PRTOKEN_PROJECTION_RECT", "PRTOKEN_LENS", "PRTOKEN_FRUSTUM", - "PRTOKEN_PERSPECTIVE", "PRTOKEN_ORTHO", "PRTOKEN_OFFSET", - "PRTOKEN_ROTATE", "PRTOKEN_TRANSLATE", "PRTOKEN_SCALE", "PRTOKEN_SHEAR", - "PRTOKEN_CLEAR_COLOR", "PRTOKEN_INPUT_AREA", "PRTOKEN_ERROR", - "PRTOKEN_INTEGER", "PRTOKEN_HEX_INTEGER", "PRTOKEN_FLOAT", - "PRTOKEN_TRUE", "PRTOKEN_FALSE", "PRTOKEN_QUOTED_STRING", - "PRTOKEN_STEREO_SYSTEM_COMMANDS", - "PRTOKEN_CUSTOM_FULL_SCREEN_RECTANGLE", "PRTOKEN_METHOD", - "PRTOKEN_PREMULTIPLY", "PRTOKEN_POSTMULTIPLY", - "PRTOKEN_OVERRIDE_REDIRECT", "PRTOKEN_SHARELENS", "PRTOKEN_SHAREVIEW", - "PRTOKEN_READ_DRAWABLE", "PRTOKEN_SET_RTT_MODE", - "PRTOKEN_RTT_MODE_NONE", "PRTOKEN_RTT_MODE_RGB", - "PRTOKEN_RTT_MODE_RGBA", "PRTOKEN_THREAD_MODEL", - "PRTOKEN_SINGLE_THREADED", "PRTOKEN_THREAD_PER_CAMERA", - "PRTOKEN_THREAD_PER_RENDER_SURFACE", "';'", "'{'", "'}'", "','", - "$accept", "config", "entries", "entry", "system_params", - "system_param", "threadModelDirective", "stereo_param", "camera_group", - "camera_group_attributes", "cameras", "camera", "@1", - "camera_attributes", "camera_attribute", "camera_offset", "@2", - "camera_offset_attributes", "camera_offset_attribute", - "offset_multiply_method", "lens", "lens_attributes", "lens_attribute", - "render_surface", "@3", "render_surface_attributes", - "render_surface_attribute", "drawableType", "rtt_mode", "visual", "@4", - "@5", "visual_attributes", "visual_attribute", "input_area", "@6", - "input_area_entries", "input_area_entry", "real", "floatparam", + "$end", "error", "$undefined", "PRTOKEN_VISUAL", "PRTOKEN_SET_SIMPLE", + "PRTOKEN_VISUAL_ID", "PRTOKEN_BUFFER_SIZE", "PRTOKEN_LEVEL", + "PRTOKEN_RGBA", "PRTOKEN_DOUBLEBUFFER", "PRTOKEN_STEREO", + "PRTOKEN_AUX_BUFFERS", "PRTOKEN_RED_SIZE", "PRTOKEN_GREEN_SIZE", + "PRTOKEN_BLUE_SIZE", "PRTOKEN_ALPHA_SIZE", "PRTOKEN_DEPTH_SIZE", + "PRTOKEN_STENCIL_SIZE", "PRTOKEN_ACCUM_RED_SIZE", + "PRTOKEN_ACCUM_GREEN_SIZE", "PRTOKEN_ACCUM_BLUE_SIZE", + "PRTOKEN_ACCUM_ALPHA_SIZE", "PRTOKEN_SAMPLES", "PRTOKEN_SAMPLE_BUFFERS", + "PRTOKEN_RENDER_SURFACE", "PRTOKEN_WINDOW_RECT", "PRTOKEN_INPUT_RECT", + "PRTOKEN_HOSTNAME", "PRTOKEN_DISPLAY", "PRTOKEN_SCREEN", + "PRTOKEN_BORDER", "PRTOKEN_DRAWABLE_TYPE", "PRTOKEN_WINDOW_TYPE", + "PRTOKEN_PBUFFER_TYPE", "PRTOKEN_CAMERA_GROUP", "PRTOKEN_CAMERA", + "PRTOKEN_PROJECTION_RECT", "PRTOKEN_LENS", "PRTOKEN_FRUSTUM", + "PRTOKEN_PERSPECTIVE", "PRTOKEN_ORTHO", "PRTOKEN_OFFSET", + "PRTOKEN_ROTATE", "PRTOKEN_TRANSLATE", "PRTOKEN_SCALE", "PRTOKEN_SHEAR", + "PRTOKEN_CLEAR_COLOR", "PRTOKEN_INPUT_AREA", "PRTOKEN_ERROR", + "PRTOKEN_INTEGER", "PRTOKEN_HEX_INTEGER", "PRTOKEN_FLOAT", + "PRTOKEN_TRUE", "PRTOKEN_FALSE", "PRTOKEN_QUOTED_STRING", + "PRTOKEN_STEREO_SYSTEM_COMMANDS", + "PRTOKEN_CUSTOM_FULL_SCREEN_RECTANGLE", "PRTOKEN_METHOD", + "PRTOKEN_PREMULTIPLY", "PRTOKEN_POSTMULTIPLY", + "PRTOKEN_OVERRIDE_REDIRECT", "PRTOKEN_SHARELENS", "PRTOKEN_SHAREVIEW", + "PRTOKEN_READ_DRAWABLE", "PRTOKEN_SET_RTT_MODE", + "PRTOKEN_RTT_MODE_NONE", "PRTOKEN_RTT_MODE_RGB", + "PRTOKEN_RTT_MODE_RGBA", "PRTOKEN_THREAD_MODEL", + "PRTOKEN_SINGLE_THREADED", "PRTOKEN_THREAD_PER_CAMERA", + "PRTOKEN_THREAD_PER_RENDER_SURFACE", "';'", "'{'", "'}'", "','", + "$accept", "config", "entries", "entry", "system_params", + "system_param", "threadModelDirective", "stereo_param", "camera_group", + "camera_group_attributes", "cameras", "camera", "@1", + "camera_attributes", "camera_attribute", "camera_offset", "@2", + "camera_offset_attributes", "camera_offset_attribute", + "offset_multiply_method", "lens", "lens_attributes", "lens_attribute", + "render_surface", "@3", "render_surface_attributes", + "render_surface_attribute", "drawableType", "rtt_mode", "visual", "@4", + "@5", "visual_attributes", "visual_attribute", "input_area", "@6", + "input_area_entries", "input_area_entry", "real", "floatparam", "intparam", "name", "string", "hex_integer", "bool", 0 }; #endif @@ -1171,7 +1171,7 @@ yyparse () #endif #endif { - + register int yystate; register int yyn; int yyresult; @@ -1672,7 +1672,7 @@ yyreduce: case 71: - { + { cfg->setRenderSurfaceBorder( yyvsp[-1].boolean ); ;} break; @@ -2210,10 +2210,10 @@ yyreturn: static void yyerror( const char *errmsg ) { - fprintf( stderr, + fprintf( stderr, "CameraConfig::parseFile(\"%s\") : %s - Line %d at or before \"%s\"\n", fileName.c_str(), - errmsg, + errmsg, flexer->lineno(), flexer->YYText() ); } diff --git a/src/osgPlugins/cfg/ReaderWriterCFG.cpp b/src/osgPlugins/cfg/ReaderWriterCFG.cpp index 938b41be9..319d85c21 100644 --- a/src/osgPlugins/cfg/ReaderWriterCFG.cpp +++ b/src/osgPlugins/cfg/ReaderWriterCFG.cpp @@ -1,9 +1,9 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 2007 Cedric Pinson * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -38,11 +38,11 @@ using namespace osgProducer; static osg::GraphicsContext::Traits* buildTrait(RenderSurface& rs) { VisualChooser& vc = *rs.getVisualChooser(); - + osg::GraphicsContext::Traits* traits = new osg::GraphicsContext::Traits; - - for (std::vector::iterator it = vc._visual_attributes.begin(); - it != vc._visual_attributes.end(); + + for (std::vector::iterator it = vc._visual_attributes.begin(); + it != vc._visual_attributes.end(); it++) { switch(it->_attribute) @@ -51,7 +51,7 @@ static osg::GraphicsContext::Traits* buildTrait(RenderSurface& rs) case(VisualChooser::BufferSize): break; // no present mapping case(VisualChooser::Level): traits->level = it->_parameter; break; case(VisualChooser::RGBA): break; // automatically set in osgViewer - case(VisualChooser::DoubleBuffer): traits->doubleBuffer = true; break; + case(VisualChooser::DoubleBuffer): traits->doubleBuffer = true; break; case(VisualChooser::Stereo): traits->quadBufferStereo = true; break; case(VisualChooser::AuxBuffers): break; // no present mapping case(VisualChooser::RedSize): traits->red = it->_parameter; break; @@ -73,7 +73,7 @@ static osg::GraphicsContext::Traits* buildTrait(RenderSurface& rs) OSG_INFO<<"ReaderWriterCFG buildTrait traits->samples="<samples<sampleBuffers="<sampleBuffers<hostName = rs.getHostName(); traits->displayNum = rs.getDisplayNum(); traits->screenNum = rs.getScreenNum(); @@ -120,16 +120,16 @@ static osgViewer::View* load(const std::string& file, const osgDB::ReaderWriter: { osg::GraphicsContext::Traits* newtraits = buildTrait(*rs); -#if 0 +#if 0 osg::GraphicsContext::ScreenIdentifier si; si.readDISPLAY(); if (si.displayNum>=0) newtraits->displayNum = si.displayNum; if (si.screenNum>=0) newtraits->screenNum = si.screenNum; #endif - + gc = osg::GraphicsContext::createGraphicsContext(newtraits); - + surfaces[rs] = gc.get(); traits = gc.valid() ? gc->getTraits() : 0; } @@ -177,7 +177,7 @@ static osgViewer::View* load(const std::string& file, const osgDB::ReaderWriter: OSG_INFO<<" GraphicsWindow has not been created successfully."< &getPBufferUserAttributes() const; @@ -478,7 +478,7 @@ class RenderSurface : public osg::Referenced DrawableType _drawableType; std::string _hostname; int _displayNum; - float _windowLeft, _windowRight, + float _windowLeft, _windowRight, _windowBottom, _windowTop; int _windowX, _windowY; unsigned int _windowWidth, _windowHeight; @@ -530,19 +530,19 @@ class RenderSurface : public osg::Referenced GLContext _windowGlcontext; GLContext _fullscreenGlcontext; CFDictionaryRef _oldDisplayMode; - + bool _captureDisplayOrWindow(); void _releaseDisplayOrWindow(); #endif - + // user-defined PBuffer attributes std::vector _user_pbattr; - + bool _useConfigEventThread; bool _checkOwnEvents; bool _useDefaultEsc; - + InputRectangle _inputRectangle; // void _computeScreenSize( unsigned int &width, unsigned int &height ) const; @@ -583,7 +583,7 @@ class RenderSurface : public osg::Referenced BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag); void KillGLWindow(); - + LONG WINAPI proc( Window, UINT, WPARAM, LPARAM ); static LONG WINAPI s_proc( Window, UINT, WPARAM, LPARAM ); static std::map registry; @@ -596,8 +596,8 @@ class RenderSurface : public osg::Referenced public: EventQueue * selectInput( unsigned int mask ); - - // if _parent is set, resize the window to + + // if _parent is set, resize the window to // fill the client area of the parent void resizeToParent(); #endif diff --git a/src/osgPlugins/cfg/VisualChooser.cpp b/src/osgPlugins/cfg/VisualChooser.cpp index 5b755bc92..7093a49e3 100644 --- a/src/osgPlugins/cfg/VisualChooser.cpp +++ b/src/osgPlugins/cfg/VisualChooser.cpp @@ -165,9 +165,9 @@ void VisualChooser::setSampleBuffers( unsigned int size ) addAttribute( SampleBuffers, size ); } -void VisualChooser::setVisualID( unsigned int id ) -{ - _visual_id = id; +void VisualChooser::setVisualID( unsigned int id ) +{ + _visual_id = id; } void VisualChooser::setSimpleConfiguration( bool doublebuffer ) @@ -179,7 +179,7 @@ void VisualChooser::setSimpleConfiguration( bool doublebuffer ) addAttribute( DoubleBuffer ); } -void VisualChooser::clear() +void VisualChooser::clear() { _visual_attributes.clear(); resetVisualInfo(); @@ -241,7 +241,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren GLint val; if((*_vinfo) && (aglDescribePixelFormat(*_vinfo, AGL_NO_RECOVERY, &val))) return _vinfo; } - else + else { // Use malloc() since new() causes a bus error _vinfo = (VisualInfo*)malloc(sizeof(VisualInfo*)); @@ -284,7 +284,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren if(*_vinfo == NULL) { std::cerr<< "aglChoosePixelFormat failed: " << aglGetError() << std::endl; - for(i=va.begin(); i!=va.end(); ++i) + for(i=va.begin(); i!=va.end(); ++i) { std::cerr << (*i) << ", "; } @@ -341,7 +341,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren { // If VisualInfo exists, then we may be able to reuse it GLint val; - if(!CGLDescribePixelFormat(*_vinfo, 0L, kCGLPFANoRecovery, &val)) + if(!CGLDescribePixelFormat(*_vinfo, 0L, kCGLPFANoRecovery, &val)) return _vinfo; } @@ -372,7 +372,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren { std::cerr<< "CGLChoosePixelFormat failed: " << CGLErrorString(err) << std::endl; std::vector::iterator i; - for(i=va.begin(); i!=va.end(); ++i) + for(i=va.begin(); i!=va.end(); ++i) { std::cerr << (*i) << ", "; } @@ -469,13 +469,13 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren else { p = _visual_attributes.end() - 1; - + while( _vinfo == NULL && va.size() > 0) { _vinfo = glXChooseVisual( dpy, screen, &(va.front()) ); if( _vinfo == NULL && va.size() > 0 ) { - + // should we report an message that we're relaxing constraints here? // std::cout << "Popping attributes"< & attribs.push_back(WGL_SUPPORT_OPENGL_ARB); attribs.push_back(1); attribs.push_back(WGL_ACCELERATION_ARB); - attribs.push_back(WGL_FULL_ACCELERATION_ARB); + attribs.push_back(WGL_FULL_ACCELERATION_ARB); return; } @@ -535,8 +535,8 @@ void VisualChooser::applyAttribute(const VisualAttribute &va, std::vector & switch (va.attribute()) { - case Level: return; - case BufferSize: attr.first = WGL_COLOR_BITS_ARB; break; + case Level: return; + case BufferSize: attr.first = WGL_COLOR_BITS_ARB; break; case RGBA: attr.first = WGL_PIXEL_TYPE_ARB; attr.second = WGL_TYPE_RGBA_ARB; break; case Stereo: attr.first = WGL_STEREO_ARB; attr.second = 1; break; case AuxBuffers: attr.first = WGL_AUX_BUFFERS_ARB; break; @@ -569,7 +569,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren if (_visual_attributes.empty()) setSimpleConfiguration(); - int vid; + int vid; bool failed = false; WGLExtensions *ext = WGLExtensions::instance(); @@ -586,13 +586,13 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren failed = !ext->wglChoosePixelFormat(*dpy, &attribs.front(), 0, 1, &vid, &num_formats) || num_formats == 0; if (failed) { - // **** DRIVER BUG? It seems that some ATI cards don't support + // **** DRIVER BUG? It seems that some ATI cards don't support // **** the WGL_SWAP_METHOD_ARB attribute. Now we try to remove // **** it from the attribute list and choose a pixel format again. for (std::vector::iterator k=attribs.begin(); k!=attribs.end(); ++k) { if (*k == WGL_SWAP_METHOD_ARB) - { + { // attribute come in sequential attribute,parameter pairs // as WGL specifications so we need to delete two entries attribs.erase(k,k+2); @@ -655,7 +655,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren if ( vid != 0 ) { // Is this additional check neccessary ? - // Did anyone encountered a situation where + // Did anyone encountered a situation where // ChoosePixelFormat returned PXIELFORMAT worse than required ? _visual_id = static_cast(vid); VisualInfo pfd; @@ -681,9 +681,9 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren if (i->attribute() == AuxBuffers) boolOK &= pfd.cAuxBuffers >= i->parameter(); } if ( !boolOK ) - vid = 0; + vid = 0; } - + if( vid == 0 ) { failed = true; @@ -695,7 +695,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren } } while (failed); - + } if (failed) @@ -710,7 +710,7 @@ VisualInfo *VisualChooser::choose( Display *dpy, int screen, bool strict_adheren // because the pixel format is usually chosen by visual ID rather // than by descriptor. _vinfo = new VisualInfo; - DescribePixelFormat(*dpy, _visual_id, sizeof(PIXELFORMATDESCRIPTOR), _vinfo); + DescribePixelFormat(*dpy, _visual_id, sizeof(PIXELFORMATDESCRIPTOR), _vinfo); return _vinfo; } @@ -737,7 +737,7 @@ void VisualChooser::setStrictAdherence(bool strictAdherence) bool VisualChooser::isDoubleBuffer() const { for (std::vector::const_iterator i=_visual_attributes.begin(); i!=_visual_attributes.end(); ++i) - if (i->attribute() == DoubleBuffer) + if (i->attribute() == DoubleBuffer) return true; return false; diff --git a/src/osgPlugins/cfg/VisualChooser.h b/src/osgPlugins/cfg/VisualChooser.h index 85e160ad9..7ebb45df7 100644 --- a/src/osgPlugins/cfg/VisualChooser.h +++ b/src/osgPlugins/cfg/VisualChooser.h @@ -21,7 +21,7 @@ namespace osgProducer { -class VisualChooser : public osg::Referenced +class VisualChooser : public osg::Referenced { public : VisualChooser( void ); @@ -30,9 +30,9 @@ class VisualChooser : public osg::Referenced UseGL, BufferSize, Level, - RGBA, - DoubleBuffer, - Stereo, + RGBA, + DoubleBuffer, + Stereo, AuxBuffers, RedSize, GreenSize, @@ -50,12 +50,12 @@ class VisualChooser : public osg::Referenced #if 0 //------------------------------------------------------------------------- // Explicitely set the visual info pointer. This will override the use of - // glXChooseVisual(). Useful for functions requiring a VisualChooser + // glXChooseVisual(). Useful for functions requiring a VisualChooser // argument, but not a XVisualInfo. void setVisual( VisualInfo *vinfo ); #endif //------------------------------------------------------------------------- - // Chooses a minimal set of parameters + // Chooses a minimal set of parameters void setSimpleConfiguration(bool doublebuffer = true); //------------------------------------------------------------------------- @@ -63,22 +63,22 @@ class VisualChooser : public osg::Referenced void clear() ; //------------------------------------------------------------------------- - // Generic method for adding an attribute without a parameter + // Generic method for adding an attribute without a parameter // (e.g DoubleBuffer ) void addAttribute( AttributeName attribute ); //------------------------------------------------------------------------- - // Generic method for adding an attribute with a parameter + // Generic method for adding an attribute with a parameter // (e.g DepthSize, 1 ) void addAttribute( AttributeName attribute, int parameter ); //------------------------------------------------------------------------- - // Generic method for adding an attribute without a parameter + // Generic method for adding an attribute without a parameter // (e.g DoubleBuffer ) void addExtendedAttribute( unsigned int attribute ); //------------------------------------------------------------------------- - // Generic method for adding an extended attribute with a parameter + // Generic method for adding an extended attribute with a parameter // (e.g DepthSize, 1 ) void addExtendedAttribute( unsigned int attribute, int parameter ); @@ -92,7 +92,7 @@ class VisualChooser : public osg::Referenced void setBufferSize( unsigned int size ); void setLevel( int level ); - + void useRGBA(); void useDoubleBuffer(); @@ -125,7 +125,7 @@ class VisualChooser : public osg::Referenced void setSamples( unsigned int size ); - void setVisualID( unsigned int id ); + void setVisualID( unsigned int id ); #if 0 @@ -133,16 +133,16 @@ class VisualChooser : public osg::Referenced // Chooses visual based on previously selected attributes and parameters // dpy = Conection to Xserver as returned by XOpenDisplay() // screen = XServer screen (Could be DefaultScreen(dpy)) - // strict_adherence = If true, return NULL visual info if the set of + // strict_adherence = If true, return NULL visual info if the set of // parameters is not matched verbatim. If set to // false, choose() will attempt to find a visual that // matches as much of the attribute list as possible // // Important Note : An attribute is removed from the end - // of the list before each retry, implying that the + // of the list before each retry, implying that the // attribute list should be specified in priority order, // most important attriutes first. - // + // VisualInfo *choose( Display *dpy, int screen, bool strict_adherence=false); @@ -157,7 +157,7 @@ class VisualChooser : public osg::Referenced public : - struct VisualAttribute + struct VisualAttribute { unsigned int _attribute; bool _has_parameter; @@ -196,7 +196,7 @@ class VisualChooser : public osg::Referenced void applyAttribute(const VisualAttribute &va, std::vector &attribs); void resetVisualInfo(); - + std::vector _visual_attributes; // VisualInfo *_vinfo; unsigned int _visual_id; diff --git a/src/osgPlugins/curl/ReaderWriterCURL.cpp b/src/osgPlugins/curl/ReaderWriterCURL.cpp index b4ff81c15..7d9e3815c 100644 --- a/src/osgPlugins/curl/ReaderWriterCURL.cpp +++ b/src/osgPlugins/curl/ReaderWriterCURL.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -39,7 +39,7 @@ using namespace osg_curl; // // StreamObject -// +// EasyCurl::StreamObject::StreamObject(std::ostream* outputStream, std::istream* inputStream, const std::string& cacheFileName): _outputStream(outputStream), _inputStream(inputStream), @@ -97,8 +97,8 @@ std::string EasyCurl::getFileNameFromURL(const std::string& url) // If the URL has query parameter "filename", return its value, // otherwise just return url assuming it has a filename at the end. // Typically, uploading will require cooperation with a server side - // script that requires parameters such as filename and/or session - // and/or authentication information, so in general the filename + // script that requires parameters such as filename and/or session + // and/or authentication information, so in general the filename // can not be assumed to be at the tail of the URL. std::string::size_type pos = url.find('?'); if (pos == std::string::npos) return url; @@ -119,7 +119,7 @@ std::string EasyCurl::getFileNameFromURL(const std::string& url) } return fileName; } - + size_t EasyCurl::StreamMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) { size_t realsize = size * nmemb; @@ -138,14 +138,14 @@ size_t EasyCurl::StreamMemoryCallback(void *ptr, size_t size, size_t nmemb, void EasyCurl::EasyCurl() { OSG_INFO<<"EasyCurl::EasyCurl()"<getAuthenticationMap()) ? + const osgDB::AuthenticationMap* authenticationMap = (options && options->getAuthenticationMap()) ? options->getAuthenticationMap() : osgDB::Registry::instance()->getAuthenticationMap(); @@ -256,7 +256,7 @@ void EasyCurl::setOptions(const std::string& proxyAddress, const std::string& fi authenticationMap->getAuthenticationDetails(fileName) : 0; - // configure/reset authentication if required. + // configure/reset authentication if required. if (details) { const std::string colon(":"); @@ -269,8 +269,8 @@ void EasyCurl::setOptions(const std::string& proxyAddress, const std::string& fi #if LIBCURL_VERSION_NUM >= 0x070a07 if (details->httpAuthentication != _previousHttpAuthentication) - { - curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, details->httpAuthentication); + { + curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, details->httpAuthentication); _previousHttpAuthentication = details->httpAuthentication; } #endif @@ -288,7 +288,7 @@ void EasyCurl::setOptions(const std::string& proxyAddress, const std::string& fi // need to reset if previously set. if (_previousHttpAuthentication!=0) { - curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, 0); + curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, 0); _previousHttpAuthentication = 0; } #endif @@ -311,7 +311,7 @@ osgDB::ReaderWriter::ReadResult EasyCurl::processResponse(CURLcode res, const st } else { - curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &code); + curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &code); } //If the code is greater than 400, there was an error @@ -429,7 +429,7 @@ osgDB::ReaderWriter::WriteResult ReaderWriterCURL::writeFile(const osg::Object& EasyCurl& easyCurl = getEasyCurl(); easyCurl.setConnectionTimeout(connectTimeout); easyCurl.setTimeout(timeout); - + // Output requestBuffer via curl, and return responseBuffer in message of result. return easyCurl.write(proxyAddress, fullFileName, sp, options); } @@ -454,7 +454,7 @@ void ReaderWriterCURL::getConnectionOptions(const osgDB::ReaderWriter::Options * { std::istringstream iss(options->getOptionString()); std::string opt, optProxy, optProxyPort; - while (iss >> opt) + while (iss >> opt) { int index = opt.find( "=" ); if( opt.substr( 0, index ) == "OSG_CURL_PROXY" ) @@ -526,24 +526,24 @@ osgDB::ReaderWriter::ReadResult ReaderWriterCURL::readFile(ObjectType objectType long connectTimeout = 0; long timeout = 0; getConnectionOptions(options, proxyAddress, connectTimeout, timeout); - + bool uncompress = false; - + if (ext=="gz" || ext=="osgz" || ext=="ivez") { OSG_INFO<<"CURL: Compressed file type "< local_opt = options ? - static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : + osg::ref_ptr local_opt = options ? + static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); @@ -612,10 +612,10 @@ osgDB::ReaderWriter::ReadResult ReaderWriterCURL::readFile(ObjectType objectType { return ReadResult::FILE_NOT_HANDLED; } - + buffer.str(uncompressed); } - + ReadResult readResult = readFile(objectType, reader, buffer, local_opt.get() ); local_opt->getDatabasePathList().pop_front(); @@ -685,7 +685,7 @@ bool ReaderWriterCURL::read(std::istream& fin, std::string& destination) const have = CHUNK - strm.avail_out; destination.append((char*)out, have); - + } while (strm.avail_out == 0); /* done when inflate() says it's done */ diff --git a/src/osgPlugins/curl/ReaderWriterCURL.h b/src/osgPlugins/curl/ReaderWriterCURL.h index 2f51bc06d..61ab9441c 100644 --- a/src/osgPlugins/curl/ReaderWriterCURL.h +++ b/src/osgPlugins/curl/ReaderWriterCURL.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -28,27 +28,27 @@ enum ObjectType HEIGHTFIELD, NODE }; - + class EasyCurl : public osg::Referenced { public: - + struct StreamObject { StreamObject(std::ostream* outputStream, std::istream* inputStream, const std::string& cacheFileName); - + void write(const char* ptr, size_t realsize); size_t read(char* ptr, size_t maxsize); - + std::ostream* _outputStream; std::istream* _inputStream; - + bool _foutOpened; std::string _cacheFileName; std::ofstream _fout; std::string _resultMimeType; }; - + static size_t StreamMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data); EasyCurl(); @@ -61,7 +61,7 @@ class EasyCurl : public osg::Referenced // the timeout variable is used to limit the whole transfer duration instead of the connection phase only. inline void setTimeout(long val) { _timeout = val; } - // Perform HTTP GET to download data from web server. + // Perform HTTP GET to download data from web server. osgDB::ReaderWriter::ReadResult read(const std::string& proxyAddress, const std::string& fileName, StreamObject& sp, const osgDB::ReaderWriter::Options *options); // Perform HTTP POST to upload data using "multipart/form-data" encoding to web server. @@ -84,9 +84,9 @@ class EasyCurl : public osg::Referenced void setOptions(const std::string& proxyAddress, const std::string& fileName, StreamObject& sp, const osgDB::ReaderWriter::Options *options); osgDB::ReaderWriter::ReadResult processResponse(CURLcode responseCode, const std::string& proxyAddress, const std::string& fileName, StreamObject& sp); - + CURL* _curl; - + std::string _previousPassword; long _previousHttpAuthentication; long _connectTimeout; @@ -97,13 +97,13 @@ class EasyCurl : public osg::Referenced class ReaderWriterCURL : public osgDB::ReaderWriter { public: - + ReaderWriterCURL(); - + ~ReaderWriterCURL(); virtual const char* className() const { return "HTTP Protocol Model Reader"; } - + virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"curl"); @@ -121,7 +121,7 @@ class ReaderWriterCURL : public osgDB::ReaderWriter { return readFile(OBJECT,fileName,options); } - + virtual ReadResult readImage(const std::string& fileName, const Options *options) const { return readFile(IMAGE,fileName,options); @@ -137,39 +137,39 @@ class ReaderWriterCURL : public osgDB::ReaderWriter return readFile(NODE,fileName,options); } - virtual WriteResult writeObject(const osg::Object& obj, const std::string& fileName, const Options* options) const + virtual WriteResult writeObject(const osg::Object& obj, const std::string& fileName, const Options* options) const { return writeFile(obj,fileName,options); } - virtual WriteResult writeImage(const osg::Image& image, const std::string& fileName, const Options* options) const + virtual WriteResult writeImage(const osg::Image& image, const std::string& fileName, const Options* options) const { return writeFile(image,fileName,options); } - virtual WriteResult writeHeightField(const osg::HeightField& heightField, const std::string& fileName, const Options* options) const + virtual WriteResult writeHeightField(const osg::HeightField& heightField, const std::string& fileName, const Options* options) const { return writeFile(heightField,fileName,options); } - virtual WriteResult writeNode(const osg::Node& node, const std::string& fileName, const Options* options) const - { + virtual WriteResult writeNode(const osg::Node& node, const std::string& fileName, const Options* options) const + { return writeFile(node,fileName,options); } ReadResult readFile(ObjectType objectType, osgDB::ReaderWriter* rw, std::istream& fin, const Options *options) const; WriteResult writeFile(const osg::Object& obj, osgDB::ReaderWriter* rw, std::ostream& fout, const Options *options) const; - + virtual ReadResult readFile(ObjectType objectType, const std::string& fullFileName, const Options *options) const; virtual WriteResult writeFile(const osg::Object& obj, const std::string& fullFileName, const Options *options) const; - + EasyCurl& getEasyCurl() const { OpenThreads::ScopedLock lock(_threadCurlMapMutex); osg::ref_ptr& ec = _threadCurlMap[OpenThreads::Thread::CurrentThread()]; if (!ec) ec = new EasyCurl; - + return *ec; } @@ -177,9 +177,9 @@ class ReaderWriterCURL : public osgDB::ReaderWriter protected: void getConnectionOptions(const osgDB::ReaderWriter::Options *options, std::string& proxyAddress, long& connectTimeout, long& timeout) const; - + typedef std::map< OpenThreads::Thread*, osg::ref_ptr > ThreadCurlMap; - + mutable OpenThreads::Mutex _threadCurlMapMutex; mutable ThreadCurlMap _threadCurlMap; }; diff --git a/src/osgPlugins/dae/ReaderWriterDAE.cpp b/src/osgPlugins/dae/ReaderWriterDAE.cpp index dae70e9a1..4d736d4de 100644 --- a/src/osgPlugins/dae/ReaderWriterDAE.cpp +++ b/src/osgPlugins/dae/ReaderWriterDAE.cpp @@ -1,9 +1,9 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -30,7 +30,7 @@ #include "windows.h" #endif -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) osgDB::ReaderWriter::ReadResult ReaderWriterDAE::readNode(const std::string& fname, diff --git a/src/osgPlugins/dae/daeRAnimations.cpp b/src/osgPlugins/dae/daeRAnimations.cpp index 552560e6e..8dfbd8a25 100644 --- a/src/osgPlugins/dae/daeRAnimations.cpp +++ b/src/osgPlugins/dae/daeRAnimations.cpp @@ -676,7 +676,7 @@ daeReader::ChannelPart* daeReader::processSampler(domChannel* pDomChannel, Sourc } //work around for files output by the Autodesk FBX converter. - if ((interpolationType == INTERPOLATION_BEZIER) && + if ((interpolationType == INTERPOLATION_BEZIER) && (_authoringTool == FBX_CONVERTER || _authoringTool == MAYA)) { interpolationType = INTERPOLATION_HERMITE; diff --git a/src/osgPlugins/dae/daeRMaterials.cpp b/src/osgPlugins/dae/daeRMaterials.cpp index 53511e876..a5efa8201 100644 --- a/src/osgPlugins/dae/daeRMaterials.cpp +++ b/src/osgPlugins/dae/daeRMaterials.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "daeReader.h" @@ -127,7 +127,7 @@ void daeReader::processBindMaterial( domBind_material *bm, domGeometry *geom, os osg::Drawable* drawable = geode->getDrawable(i); std::string materialName = drawable->getName(); osg::Geometry *cachedGeometry = dynamic_cast(cachedGeode->getDrawable(i)->asGeometry()); - + domInstance_material_Array &ima = bm->getTechnique_common()->getInstance_material_array(); std::string symbol; bool found = false; @@ -135,7 +135,7 @@ void daeReader::processBindMaterial( domBind_material *bm, domGeometry *geom, os { symbol = ima[j]->getSymbol(); if (symbol.compare(materialName) == 0) - { + { found = true; domMaterial *mat = daeSafeCast< domMaterial >(getElementFromURI( ima[j]->getTarget())); if (mat) @@ -167,7 +167,7 @@ void daeReader::processBindMaterial( domBind_material *bm, domGeometry *geom, os } clonedGeometry->getTexCoordArrayList().clear(); - // 2. For each possible texture unit find the correct texcoord array and + // 2. For each possible texture unit find the correct texcoord array and // indices from the cached drawable and place in the cloned drawable // in the correct texture unit slot unsigned int textureUnit(0); @@ -208,7 +208,7 @@ void daeReader::processMaterial(osg::StateSet *ss, domMaterial *mat ) if (effect) { processEffect(ss, effect); - + //TODO: process all of the setParams that could happen here in the material. ESP. the textures } else @@ -330,11 +330,11 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) OSG_WARN << "Currently no support for in Emission channel " << std::endl; processColorOrTextureType(ss, b->getAmbient(), osg::Material::AMBIENT, mat.get(), NULL, &AmbientStateAttribute ); - + processColorOrTextureType(ss, b->getDiffuse(), osg::Material::DIFFUSE, mat.get(), NULL, &DiffuseStateAttribute ); - if (DiffuseStateAttribute != NULL ) + if (DiffuseStateAttribute != NULL ) { - if (AmbientStateAttribute != NULL ) + if (AmbientStateAttribute != NULL ) { // Set the ambient and diffuse colour white so that the incoming fragment colour ends up as a // lit white colour. I modulate both textures onto this to approximate the lighting equation. @@ -366,7 +366,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) } else { - if (NULL != AmbientStateAttribute ) + if (NULL != AmbientStateAttribute ) OSG_WARN << "Ambient occlusion map only supported when diffuse texture also specified" << std::endl; } @@ -402,13 +402,13 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) processColorOrTextureType(ss, p->getEmission(), osg::Material::EMISSION, mat.get(), NULL, &EmissionStateAttribute ); if (NULL != EmissionStateAttribute) OSG_WARN << "Currently no support for in Emission channel " << std::endl; - + processColorOrTextureType(ss, p->getAmbient(), osg::Material::AMBIENT, mat.get(), NULL, &AmbientStateAttribute ); - + processColorOrTextureType(ss, p->getDiffuse(), osg::Material::DIFFUSE, mat.get(), NULL, &DiffuseStateAttribute ); - if (DiffuseStateAttribute != NULL ) + if (DiffuseStateAttribute != NULL ) { - if (AmbientStateAttribute != NULL ) + if (AmbientStateAttribute != NULL ) { // Set the ambient and diffuse colour white so that the incoming fragment colour ends up as a // lit white colour. I modulate both textures onto this to approximate the lighting equation. @@ -440,10 +440,10 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) } else { - if (NULL != AmbientStateAttribute ) + if (NULL != AmbientStateAttribute ) OSG_WARN << "Ambient occlusion map only supported when diffuse texture also specified" << std::endl; } - + if (processColorOrTextureType(ss, p->getSpecular(), osg::Material::SPECULAR, mat.get(), p->getShininess() ) && (NULL != DiffuseStateAttribute) ) { // Diffuse texture will defeat specular highlighting @@ -474,13 +474,13 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) processColorOrTextureType(ss, l->getEmission(), osg::Material::EMISSION, mat.get(), NULL, &EmissionStateAttribute ); if (NULL != EmissionStateAttribute) OSG_WARN << "Currently no support for in Emission channel " << std::endl; - + processColorOrTextureType(ss, l->getAmbient(), osg::Material::AMBIENT, mat.get(), NULL, &AmbientStateAttribute); processColorOrTextureType(ss, l->getDiffuse(), osg::Material::DIFFUSE, mat.get(), NULL, &DiffuseStateAttribute ); - if (DiffuseStateAttribute != NULL ) + if (DiffuseStateAttribute != NULL ) { - if (AmbientStateAttribute != NULL ) + if (AmbientStateAttribute != NULL ) { // Set the ambient and diffuse colour white so that the incoming fragment colour ends up as a // lit white colour. I modulate both textures onto this to approximate the lighting equation. @@ -512,7 +512,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) } else { - if (NULL != AmbientStateAttribute ) + if (NULL != AmbientStateAttribute ) OSG_WARN << "Ambient occlusion map only supported when diffuse texture also specified" << std::endl; } @@ -530,7 +530,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) { osg::Texture2D *sa = NULL; processColorOrTextureType(ss, c->getEmission(), osg::Material::EMISSION, mat.get(), NULL, &sa ); - if (sa != NULL ) + if (sa != NULL ) { unsigned int textureUnit( _pluginOptions.usePredefinedTextureUnits ? MAIN_TEXTURE_UNIT : 0); ss->setTextureMode( textureUnit, GL_TEXTURE_2D, GL_TRUE ); @@ -562,7 +562,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) // 1 texcoord // 0..* extra bool daeReader::processColorOrTextureType(const osg::StateSet* ss, - domCommon_color_or_texture_type *cot, + domCommon_color_or_texture_type *cot, osg::Material::ColorMode channel, osg::Material *mat, domCommon_float_or_param_type *fop, @@ -605,7 +605,7 @@ bool daeReader::processColorOrTextureType(const osg::StateSet* ss, } else OSG_WARN << "Currently no support for in Emission channel " << std::endl; - } + } else { OSG_WARN << "Missing , or in Emission channel " << std::endl; @@ -768,7 +768,7 @@ bool daeReader::GetFloat4Param(xsNCName Reference, domFloat4 &f4) const } } - domCommon_newparam_type *cnp = daeSafeCast< domCommon_newparam_type >( el ); + domCommon_newparam_type *cnp = daeSafeCast< domCommon_newparam_type >( el ); domFx_newparam_common *npc = daeSafeCast< domFx_newparam_common >( el ); if ((cnp != NULL) && (NULL != cnp->getFloat4())) { @@ -815,7 +815,7 @@ bool daeReader::GetFloatParam(xsNCName Reference, domFloat &f) const } } - domCommon_newparam_type *cnp = daeSafeCast< domCommon_newparam_type >( el ); + domCommon_newparam_type *cnp = daeSafeCast< domCommon_newparam_type >( el ); domFx_newparam_common *npc = daeSafeCast< domFx_newparam_common >( el ); if ((cnp != NULL) && (NULL != cnp->getFloat())) { @@ -1005,7 +1005,7 @@ osg::Texture2D* daeReader::processTexture( std::string target = std::string("./") + std::string(tex->getTexture()); OSG_NOTICE<<"processTexture("<( el ); + domCommon_newparam_type *cnp = daeSafeCast< domCommon_newparam_type >( el ); domFx_newparam_common *npc = daeSafeCast< domFx_newparam_common >( el ); if (cnp != NULL ) @@ -1048,7 +1048,7 @@ osg::Texture2D* daeReader::processTexture( OSG_WARN << "Could not locate newparam for source " << sampler->getSource()->getValue() << std::endl; return NULL; } - cnp = daeSafeCast< domCommon_newparam_type >( el ); + cnp = daeSafeCast< domCommon_newparam_type >( el ); npc = daeSafeCast< domFx_newparam_common >( el ); if (cnp != NULL ) @@ -1164,7 +1164,7 @@ The element • A_ZERO: Takes the transparency information from the color’s alpha channel, where the value 0.0 is opaque. • RGB_ONE: Takes the transparency information from the color’s red, green, and blue channels, where the value 1.0 * is opaque, with each channel modulated independently. -* When we update to a version of the dom using that schema we will need to modify the code below +* When we update to a version of the dom using that schema we will need to modify the code below */ void daeReader::processTransparencySettings( domCommon_transparent_type *ctt, diff --git a/src/osgPlugins/dae/daeRSceneObjects.cpp b/src/osgPlugins/dae/daeRSceneObjects.cpp index 2a7cfe7db..06d0b0914 100644 --- a/src/osgPlugins/dae/daeRSceneObjects.cpp +++ b/src/osgPlugins/dae/daeRSceneObjects.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "daeReader.h" @@ -42,7 +42,7 @@ osg::Group* daeReader::processOsgMultiSwitch(domTechnique* teq) { OSG_WARN << "Expected element 'ActiveSwitchSet' not found" << std::endl; } - + any = daeSafeCast(teq->getChild("ValueLists")); if (any) { @@ -59,13 +59,13 @@ osg::Group* daeReader::processOsgMultiSwitch(domTechnique* teq) cdom::tokenize(child->getValue(), " ", stringValues); cdom::tokenIter iter = stringValues.begin(); - + while (iter != stringValues.end()) { values.push_back(parseString(*iter)); ++iter; } - + msw->setValueList(currChild, values); } else @@ -156,7 +156,7 @@ osg::Group* daeReader::processOsgSequence(domTechnique* teq) { OSG_WARN << "Expected element 'LoopMode' not found" << std::endl; } - + int begin=0; any = daeSafeCast< domAny >(teq->getChild("IntervalBegin")); if (any) @@ -167,7 +167,7 @@ osg::Group* daeReader::processOsgSequence(domTechnique* teq) { OSG_WARN << "Expected element 'IntervalBegin' not found" << std::endl; } - + int end=-1; any = daeSafeCast< domAny >(teq->getChild("IntervalEnd")); if (any) @@ -191,7 +191,7 @@ osg::Group* daeReader::processOsgSequence(domTechnique* teq) { OSG_WARN << "Expected element 'DurationSpeed' not found" << std::endl; } - + int nreps = -1; any = daeSafeCast< domAny >(teq->getChild("DurationNReps")); if (any) @@ -266,10 +266,10 @@ osg::Group* daeReader::processOsgLOD(domTechnique* teq) { std::list stringValues; osg::LOD::MinMaxPair minMaxPair; - + cdom::tokenize(child->getValue(), " ", stringValues); cdom::tokenIter iter = stringValues.begin(); - + if (iter != stringValues.end()) { minMaxPair.first = parseString(*iter); @@ -334,7 +334,7 @@ osg::Node* daeReader::processLight( domLight *dlight ) domLight::domTechnique_common::domPoint *point; domLight::domTechnique_common::domSpot *spot; - if ( dlight->getTechnique_common() == NULL || + if ( dlight->getTechnique_common() == NULL || dlight->getTechnique_common()->getContents().getCount() == 0 ) { OSG_WARN << "Invalid content for light" << std::endl; @@ -349,12 +349,12 @@ osg::Node* daeReader::processLight( domLight *dlight ) _rootStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON); // Enable this OpenGL light _rootStateSet->setMode(GL_LIGHT0 + _numlights++, osg::StateAttribute::ON); - + // Set ambient of lightmodel to zero // Ambient lights are added as separate lights with only an ambient term osg::LightModel* lightmodel = new osg::LightModel; lightmodel->setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); - _rootStateSet->setAttributeAndModes(lightmodel, osg::StateAttribute::ON); + _rootStateSet->setAttributeAndModes(lightmodel, osg::StateAttribute::ON); osg::LightSource* lightsource = new osg::LightSource(); lightsource->setLight(light); @@ -370,36 +370,36 @@ osg::Node* daeReader::processLight( domLight *dlight ) spot = daeSafeCast< domLight::domTechnique_common::domSpot >( el ); if ( ambient != NULL ) { - if ( ambient->getColor() == NULL ) + if ( ambient->getColor() == NULL ) { OSG_WARN << "Invalid content for ambient light" << std::endl; return NULL; } light->setAmbient( osg::Vec4( ambient->getColor()->getValue()[0], - ambient->getColor()->getValue()[1], + ambient->getColor()->getValue()[1], ambient->getColor()->getValue()[2], 1.0f ) ); light->setDiffuse( osg::Vec4( 0, 0, 0, 0)); light->setSpecular( osg::Vec4( 0, 0, 0, 0)); - + // Tell OpenGL to make it a directional light (w=0) light->setPosition( osg::Vec4(0,0,0,0)); } else if ( directional != NULL ) { - if ( directional->getColor() == NULL ) + if ( directional->getColor() == NULL ) { OSG_WARN << "Invalid content for directional light" << std::endl; return NULL; } light->setAmbient( osg::Vec4( 0, 0, 0, 0)); - light->setDiffuse( osg::Vec4( directional->getColor()->getValue()[0], - directional->getColor()->getValue()[1], + light->setDiffuse( osg::Vec4( directional->getColor()->getValue()[0], + directional->getColor()->getValue()[1], directional->getColor()->getValue()[2], 1.0f ) ); light->setSpecular( osg::Vec4( directional->getColor()->getValue()[0], - directional->getColor()->getValue()[1], + directional->getColor()->getValue()[1], directional->getColor()->getValue()[2], 1.0f ) ); - + light->setDirection(osg::Vec3(0,0,-1)); // Tell OpenGL it is a directional light (w=0) @@ -407,17 +407,17 @@ osg::Node* daeReader::processLight( domLight *dlight ) } else if ( point != NULL ) { - if ( point->getColor() == NULL ) + if ( point->getColor() == NULL ) { OSG_WARN << "Invalid content for point light" << std::endl; return NULL; } light->setAmbient( osg::Vec4( 0, 0, 0, 0)); - light->setDiffuse( osg::Vec4( point->getColor()->getValue()[0], - point->getColor()->getValue()[1], + light->setDiffuse( osg::Vec4( point->getColor()->getValue()[0], + point->getColor()->getValue()[1], point->getColor()->getValue()[2], 1.0f ) ); - light->setSpecular( osg::Vec4( point->getColor()->getValue()[0], - point->getColor()->getValue()[1], + light->setSpecular( osg::Vec4( point->getColor()->getValue()[0], + point->getColor()->getValue()[1], point->getColor()->getValue()[2], 1.0f ) ); if ( point->getConstant_attenuation() != NULL ) @@ -450,17 +450,17 @@ osg::Node* daeReader::processLight( domLight *dlight ) } else if ( spot != NULL ) { - if ( spot->getColor() == NULL ) + if ( spot->getColor() == NULL ) { OSG_WARN << "Invalid content for spot light" << std::endl; return NULL; } light->setAmbient( osg::Vec4( 0, 0, 0, 0)); - light->setDiffuse( osg::Vec4( spot->getColor()->getValue()[0], - spot->getColor()->getValue()[1], + light->setDiffuse( osg::Vec4( spot->getColor()->getValue()[0], + spot->getColor()->getValue()[1], spot->getColor()->getValue()[2], 1.0f ) ); - light->setSpecular( osg::Vec4( spot->getColor()->getValue()[0], - spot->getColor()->getValue()[1], + light->setSpecular( osg::Vec4( spot->getColor()->getValue()[0], + spot->getColor()->getValue()[1], spot->getColor()->getValue()[2], 1.0f ) ); if ( spot->getConstant_attenuation() != NULL ) @@ -557,7 +557,7 @@ osg::Node* daeReader::processCamera( domCamera * dcamera ) // and pOsgCameraView->setFieldOfView(pXfov->getValue()); pOsgCameraView->setFieldOfViewMode(osg::CameraView::HORIZONTAL); - + if (pAspectRatio) { OSG_WARN << "Unexpected in '" << dcamera->getId() << "'" << std::endl; @@ -569,7 +569,7 @@ osg::Node* daeReader::processCamera( domCamera * dcamera ) pOsgCameraView->setFieldOfView(pXfov->getValue() * pAspectRatio->getValue()); pOsgCameraView->setFieldOfViewMode(osg::CameraView::HORIZONTAL); } - else + else { // pOsgCameraView->setFieldOfView(pXfov->getValue()); @@ -604,11 +604,11 @@ osg::Node* daeReader::processCamera( domCamera * dcamera ) } else if (pDomOrthographic) { - // + // // 1 , , and , and , and // 1 // 1 - + //domTargetableFloat *pXmag = daeSafeCast< domTargetableFloat >(pDomOrthographic->getXmag()); //domTargetableFloat *pYmag = daeSafeCast< domTargetableFloat >(pDomOrthographic->getYmag()); //domTargetableFloat *pAspectRatio = daeSafeCast< domTargetableFloat >(pDomOrthographic->getAspect_ratio()); @@ -617,7 +617,7 @@ osg::Node* daeReader::processCamera( domCamera * dcamera ) OSG_WARN << "Orthographic in '" << dcamera->getId() << "' not supported" << std::endl; //domTargetableFloat *pZnear = daeSafeCast< domTargetableFloat >(pDomOrthographic->getZnear()); - //domTargetableFloat *pZfar = daeSafeCast< domTargetableFloat >(pDomOrthographic->getZfar()); + //domTargetableFloat *pZfar = daeSafeCast< domTargetableFloat >(pDomOrthographic->getZfar()); // TODO The current osg::CameraView does not support storage of near far } diff --git a/src/osgPlugins/dae/daeReader.cpp b/src/osgPlugins/dae/daeReader.cpp index 00408e9ad..347e025da 100644 --- a/src/osgPlugins/dae/daeReader.cpp +++ b/src/osgPlugins/dae/daeReader.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "daeReader.h" @@ -51,7 +51,7 @@ daeReader::~daeReader() { } -bool daeReader::convert( const std::string &fileURI ) +bool daeReader::convert( const std::string &fileURI ) { // Clear caches _geometryMap.clear(); @@ -59,20 +59,20 @@ bool daeReader::convert( const std::string &fileURI ) _materialMap2.clear(); daeElement *colladaElement; - + daeInt count, result; _document = _dae->open(fileURI); - - if (!_document) + + if (!_document) { OSG_WARN << "Load failed in COLLADA DOM" << std::endl; return false; } OSG_INFO << "URI loaded: " << fileURI << std::endl; - if ( !_document->getScene() || !_document->getScene()->getInstance_visual_scene() ) + if ( !_document->getScene() || !_document->getScene()->getInstance_visual_scene() ) { OSG_WARN << "No scene found!" << std::endl; return false; @@ -120,33 +120,33 @@ bool daeReader::convert( const std::string &fileURI ) domInstanceWithExtra *ivs = _document->getScene()->getInstance_visual_scene(); _visualScene = daeSafeCast< domVisual_scene >( getElementFromURI( ivs->getUrl() ) ); - if ( _visualScene == NULL ) + if ( _visualScene == NULL ) { OSG_WARN << "Unable to locate visual scene!" << std::endl; return false; } - if (daeDatabase* database = _dae->getDatabase()) + if (daeDatabase* database = _dae->getDatabase()) { _invertTransparency = findInvertTransparency(database); - // build a std::map for lookup if Group or PositionAttitudeTransform should be created, + // build a std::map for lookup if Group or PositionAttitudeTransform should be created, // i.e, make it easy to check if a instance_rigid_body targets a visual node domInstance_rigid_body *pDomInstanceRigidBody; count = database->getElementCount(NULL, COLLADA_TYPE_INSTANCE_RIGID_BODY, NULL); - for (int i=0; igetElement(&colladaElement, i, NULL, COLLADA_TYPE_INSTANCE_RIGID_BODY); - if (result == DAE_OK) + if (result == DAE_OK) { pDomInstanceRigidBody = daeSafeCast(colladaElement); - if (pDomInstanceRigidBody) + if (pDomInstanceRigidBody) { domNode *node = daeSafeCast(pDomInstanceRigidBody->getTarget().getElement()); - if (node && node->getId()) + if (node && node->getId()) { - _targetMap[ std::string(node->getId()) ] = true; + _targetMap[ std::string(node->getId()) ] = true; } } } @@ -154,14 +154,14 @@ bool daeReader::convert( const std::string &fileURI ) // Build a map of elements that are targetted by animations count = database->getElementCount(NULL, COLLADA_TYPE_CHANNEL, NULL); - for (int i=0; igetElement(&colladaElement, i, NULL, COLLADA_TYPE_CHANNEL); - if (result == DAE_OK) + if (result == DAE_OK) { domChannel* pDomChannel = daeSafeCast(colladaElement); - if (pDomChannel) + if (pDomChannel) { std::string target = pDomChannel->getTarget(); size_t openparenthesis = target.find_first_of('('); @@ -185,7 +185,7 @@ bool daeReader::convert( const std::string &fileURI ) // identify every node as a joint, making it meaningless. std::vector instanceControllers; database->typeLookup(instanceControllers); - for (size_t i = 0; i < instanceControllers.size(); ++i) + for (size_t i = 0; i < instanceControllers.size(); ++i) { domInstance_controller* pInstanceController = instanceControllers[i]; @@ -222,7 +222,7 @@ bool daeReader::convert( const std::string &fileURI ) if (!pJoints) continue; const domInputLocal_Array& inputURIs = pJoints->getInput_array(); - domSource* pDomJointsSource = NULL; + domSource* pDomJointsSource = NULL; for (size_t i=0; i < inputURIs.getCount(); i++) { if (!strcmp(inputURIs[i]->getSemantic(), COMMON_PROFILE_INPUT_JOINT)) @@ -274,7 +274,7 @@ bool daeReader::convert( const std::string &fileURI ) { _rootNode->addUpdateCallback(pOsgAnimationManager); } - + return true; } @@ -299,7 +299,7 @@ void daeReader::addChild(osg::Group* group, osg::Node* node) osg::Group* daeReader::turnZUp() { osg::PositionAttitudeTransform* pat = NULL; - + // If not Z axis up we need to rotate scene to bring the Z axis up if (_assetUp_axis != UPAXISTYPE_Z_UP) { @@ -320,7 +320,7 @@ osg::Group* daeReader::turnZUp() osg::Group* daeReader::processVisualScene( domVisual_scene *scene ) { - osg::Group *retVal; + osg::Group *retVal; _rootStateSet = new osg::StateSet(); unsigned int nbVisualSceneGroup=scene->getNode_array().getCount(); @@ -332,7 +332,7 @@ osg::Group* daeReader::processVisualScene( domVisual_scene *scene ) } else { - retVal = turnZUp(); + retVal = turnZUp(); if (!retVal) { @@ -522,7 +522,7 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton) // See if it is targeted by an animation bool targeted = false; - if (node->getId()) + if (node->getId()) { targeted = _targetMap[std::string(node->getId())]; } @@ -532,7 +532,7 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton) bool isBone = skeleton || isJoint(node); - if (coordcount > 0 || targeted || isBone) + if (coordcount > 0 || targeted || isBone) { // TODO // single matrix -> MatrixTransform @@ -573,7 +573,7 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton) // 0..* const domInstance_camera_Array& cameraInstanceArray = node->getInstance_camera_array(); - for ( size_t i = 0; i < cameraInstanceArray.getCount(); i++ ) + for ( size_t i = 0; i < cameraInstanceArray.getCount(); i++ ) { daeElement *el = getElementFromURI( cameraInstanceArray[i]->getUrl()); domCamera *c = daeSafeCast< domCamera >( el ); @@ -586,11 +586,11 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton) // 0..* const domInstance_controller_Array& controllerInstanceArray = node->getInstance_controller_array(); - for ( size_t i = 0; i < controllerInstanceArray.getCount(); i++ ) + for ( size_t i = 0; i < controllerInstanceArray.getCount(); i++ ) { osg::Node* pOsgNode = processInstanceController( controllerInstanceArray[i]); - - // A skin controller may return NULL, since the RigGeometry is added as + + // A skin controller may return NULL, since the RigGeometry is added as // child of the skeleton and the skeleton already is added to the scenegraph if (pOsgNode) { @@ -600,18 +600,18 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton) // 0..* const domInstance_geometry_Array& geometryInstanceArray = node->getInstance_geometry_array(); - for ( size_t i = 0; i < geometryInstanceArray.getCount(); i++ ) + for ( size_t i = 0; i < geometryInstanceArray.getCount(); i++ ) { addChild(attachTo, processInstanceGeometry( geometryInstanceArray[i] )); } // 0..* const domInstance_light_Array& lightInstanceArray = node->getInstance_light_array(); - for ( size_t i = 0; i < lightInstanceArray.getCount(); i++ ) + for ( size_t i = 0; i < lightInstanceArray.getCount(); i++ ) { daeElement *el = getElementFromURI( lightInstanceArray[i]->getUrl()); domLight *pDomLight = daeSafeCast< domLight >( el ); - + if (pDomLight) addChild(attachTo, processLight(pDomLight)); else @@ -620,7 +620,7 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton) // 0..* const domInstance_node_Array& nodeInstanceArray = node->getInstance_node_array(); - for ( size_t i = 0; i < nodeInstanceArray.getCount(); i++ ) + for ( size_t i = 0; i < nodeInstanceArray.getCount(); i++ ) { daeElement *el = getElementFromURI( nodeInstanceArray[i]->getUrl()); domNode *n = daeSafeCast< domNode >( el ); @@ -634,7 +634,7 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton) // 0..* const domNode_Array& nodeArray = node->getNode_array(); - for ( size_t i = 0; i < nodeArray.getCount(); i++ ) + for ( size_t i = 0; i < nodeArray.getCount(); i++ ) { // Recursive call addChild(attachTo, processNode( nodeArray[i], skeleton )); diff --git a/src/osgPlugins/dae/daeReader.h b/src/osgPlugins/dae/daeReader.h index 6065daaec..10d043907 100644 --- a/src/osgPlugins/dae/daeReader.h +++ b/src/osgPlugins/dae/daeReader.h @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #ifndef _DAE_CONV_H_ @@ -76,7 +76,7 @@ inline daeElement *getElementFromIDRef( daeIDRef &idref ) } template< typename TInputArray, typename TInputType > -bool findInputSourceBySemantic( TInputArray& inputs, const char* semantic, daeElement *& element, +bool findInputSourceBySemantic( TInputArray& inputs, const char* semantic, daeElement *& element, TInputType ** input = NULL, int unit = 0 ) { element = NULL; @@ -129,8 +129,8 @@ inline osg::Matrix parseMatrixString(const std::string& valueAsString) /** @class daeReader -@brief Read a OSG scene from a DAE file -*/ +@brief Read a OSG scene from a DAE file +*/ class daeReader { public: enum TessellateMode @@ -153,7 +153,7 @@ public: virtual ~daeReader(); bool convert( const std::string &fileURI ); - + osg::Node* getRootNode() { return _rootNode; } const std::string& getAssetUnitName() const {return _assetUnitName;} @@ -167,14 +167,14 @@ public: TRANSPARENCY_MAP_UNIT }; - enum InterpolationType - { - INTERPOLATION_UNKNOWN, - INTERPOLATION_STEP, - INTERPOLATION_LINEAR, - INTERPOLATION_BEZIER, - INTERPOLATION_HERMITE, - INTERPOLATION_CARDINAL, + enum InterpolationType + { + INTERPOLATION_UNKNOWN, + INTERPOLATION_STEP, + INTERPOLATION_LINEAR, + INTERPOLATION_BEZIER, + INTERPOLATION_HERMITE, + INTERPOLATION_CARDINAL, INTERPOLATION_BSPLINE, //COLLADA spec states that if interpolation is not specified then @@ -274,7 +274,7 @@ private: standard. This function looks at all transparency values in the database and heuristically decides which way the values should be interpreted.*/ bool findInvertTransparency(daeDatabase*) const; - + osgAnimation::BasicAnimationManager* processAnimationLibraries(domCOLLADA* document); void processAnimationClip(osgAnimation::BasicAnimationManager* pOsgAnimationManager, domAnimation_clip* pDomAnimationClip); void processAnimationMap(const TargetChannelPartMap&, osgAnimation::Animation* pOsgAnimation); @@ -317,7 +317,7 @@ private: template< typename T > void processSinglePPrimitive(osg::Geode* geode, const domMesh* pDomMesh, const T* group, SourceMap& sources, GLenum mode); - + template< typename T > void processMultiPPrimitive(osg::Geode* geode, const domMesh* pDomMesh, const T* group, SourceMap& sources, GLenum mode); @@ -337,14 +337,14 @@ private: void processEffect(osg::StateSet *ss, domEffect *effect ); void processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ); bool processColorOrTextureType(const osg::StateSet*, - domCommon_color_or_texture_type *cot, - osg::Material::ColorMode channel, - osg::Material *mat, - domCommon_float_or_param_type *fop = NULL, + domCommon_color_or_texture_type *cot, + osg::Material::ColorMode channel, + osg::Material *mat, + domCommon_float_or_param_type *fop = NULL, osg::Texture2D **sa = NULL, bool normalizeShininess=false); void processTransparencySettings( domCommon_transparent_type *ctt, - domCommon_float_or_param_type *pTransparency, + domCommon_float_or_param_type *pTransparency, osg::StateSet*, osg::Material *material, unsigned int diffuseTextureUnit ); diff --git a/src/osgPlugins/dae/daeWGeometry.cpp b/src/osgPlugins/dae/daeWGeometry.cpp index 5e01c8508..e52d16584 100644 --- a/src/osgPlugins/dae/daeWGeometry.cpp +++ b/src/osgPlugins/dae/daeWGeometry.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "daeWriter.h" @@ -156,7 +156,7 @@ void daeWriter::writeRigGeometry(osgAnimation::RigGeometry *pOsgRigGeometry) std::string name( pOsgRigGeometry->getName() ); if (name.empty()) name = uniquify("skincontroller"); - else + else name = uniquify(name); pDomController->setId( name.c_str() ); _osgRigGeometryDomControllerMap.insert( std::make_pair( pOsgRigGeometry, pDomController ) ); @@ -190,7 +190,7 @@ void daeWriter::writeRigGeometry(osgAnimation::RigGeometry *pOsgRigGeometry) pDomJointsNameArray->setValue(jointNames); { domSource::domTechnique_common* pDomSourceTechniqueCommon = daeSafeCast< domSource::domTechnique_common >(pDomJointsSource->add(COLLADA_ELEMENT_TECHNIQUE_COMMON)); - + domAccessor* pDomAccessor = daeSafeCast< domAccessor >(pDomSourceTechniqueCommon->add(COLLADA_ELEMENT_ACCESSOR)); std::string url = "#" + jointsNameArrayName; pDomAccessor->setSource(url.c_str()); @@ -213,7 +213,7 @@ void daeWriter::writeRigGeometry(osgAnimation::RigGeometry *pOsgRigGeometry) pDomMatricesArray->setValue(matrices); { domSource::domTechnique_common* pDomSourceTechniqueCommon = daeSafeCast< domSource::domTechnique_common >(pDomSkinBindPoseSource->add(COLLADA_ELEMENT_TECHNIQUE_COMMON)); - + domAccessor* pDomAccessor = daeSafeCast< domAccessor >(pDomSourceTechniqueCommon->add(COLLADA_ELEMENT_ACCESSOR)); std::string url = "#" + matricesArrayName; pDomAccessor->setSource(url.c_str()); @@ -237,7 +237,7 @@ void daeWriter::writeRigGeometry(osgAnimation::RigGeometry *pOsgRigGeometry) pDomWeightsArray->setValue(weights); { domSource::domTechnique_common* pDomSourceTechniqueCommon = daeSafeCast< domSource::domTechnique_common >(pDomSkinWeightsSource->add(COLLADA_ELEMENT_TECHNIQUE_COMMON)); - + domAccessor* pDomAccessor = daeSafeCast< domAccessor >(pDomSourceTechniqueCommon->add(COLLADA_ELEMENT_ACCESSOR)); std::string url = "#" + weightsArrayName; pDomAccessor->setSource(url.c_str()); @@ -248,7 +248,7 @@ void daeWriter::writeRigGeometry(osgAnimation::RigGeometry *pOsgRigGeometry) } domSkin::domJoints* pDomJoints = daeSafeCast< domSkin::domJoints >(pDomSkin->add( COLLADA_ELEMENT_JOINTS )); - + domInputLocal* pDomInput = daeSafeCast< domInputLocal >(pDomJoints->add(COLLADA_ELEMENT_INPUT)); pDomInput->setSemantic(COMMON_PROFILE_INPUT_JOINT); url = "#" + skinJointsName; @@ -324,7 +324,7 @@ void daeWriter::writeMorphGeometry(osgAnimation::MorphGeometry *pOsgMorphGeometr std::string name( pOsgMorphGeometry->getName() ); if (name.empty()) name = uniquify("morphcontroller"); - else + else name = uniquify(name); pDomController->setId( name.c_str() ); _osgMorphGeometryDomControllerMap.insert( std::make_pair( pOsgMorphGeometry, pDomController ) ); @@ -441,7 +441,7 @@ void daeWriter::apply( osg::Geode &node ) for ( unsigned int i = 0; i < count; i++ ) { osg::Geometry *g = node.getDrawable( i )->asGeometry(); - + if ( g != NULL ) { osgAnimation::RigGeometry *pOsgRigGeometry = dynamic_cast(g); @@ -465,7 +465,7 @@ void daeWriter::apply( osg::Geode &node ) m_CurrentRenderingHint = g->getStateSet()->getRenderingHint(); pushStateSet(g->getStateSet()); - + domGeometry* pDomGeometry = getOrCreateDomGeometry(g); if (pDomGeometry) { @@ -516,7 +516,7 @@ void daeWriter::appendGeometryIndices(osg::Geometry *geom, else p->getValue().append( normals.inds!=NULL?normals.inds->index( ncount ):ncount ); } - + if ( color != NULL ) { if ( geom->getColorBinding() == osg::Geometry::BIND_PER_VERTEX ) @@ -524,7 +524,7 @@ void daeWriter::appendGeometryIndices(osg::Geometry *geom, else p->getValue().append( colors.inds!=NULL?colors.inds->index( ccount ):ccount ); } - + for ( unsigned int ti = 0; ti < texcoords.size(); ti++ ) { //ArrayNIndices &tc = texcoords[ti]; @@ -535,7 +535,7 @@ void daeWriter::appendGeometryIndices(osg::Geometry *geom, bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const std::string &name ) -{ +{ domMesh *mesh = daeSafeCast< domMesh >( geo->add( COLLADA_ELEMENT_MESH ) ); domSource *pos = NULL; domSource *norm = NULL; @@ -549,7 +549,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st domTrifans *trifans = NULL; domPolygons *polys = NULL; domPolylist *polylist = NULL; - + ArrayNIndices verts( geom->getVertexArray(), geom->getVertexIndices() ); ArrayNIndices normals( geom->getNormalArray(), geom->getNormalIndices() ); ArrayNIndices colors( geom->getColorArray(), geom->getColorIndices() ); @@ -714,12 +714,12 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st //process primitive group switch( mode ) { - case GL_POINTS: + case GL_POINTS: { - OSG_WARN << "Geometry contains points rendering. COLLADA does not" << std::endl; + OSG_WARN << "Geometry contains points rendering. COLLADA does not" << std::endl; continue; } - case GL_LINES: + case GL_LINES: { if ( lines == NULL ) { @@ -728,11 +728,11 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st std::string mat = name + "_material"; lines->setMaterial( mat.c_str() ); } - primLength = 2; + primLength = 2; valid = true; break; } - case GL_TRIANGLES: + case GL_TRIANGLES: { if ( tris == NULL ) { @@ -741,11 +741,11 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st std::string mat = name + "_material"; tris->setMaterial( mat.c_str() ); } - primLength = 3; + primLength = 3; valid = true; break; } - case GL_QUADS: + case GL_QUADS: { if ( polys == NULL ) { @@ -759,14 +759,14 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st else { polylist = createPrimGroup( COLLADA_ELEMENT_POLYLIST, mesh, norm, color, texcoord ); - + polylist->add( COLLADA_ELEMENT_VCOUNT ); polylist->add( COLLADA_ELEMENT_P ); std::string mat = name + "_material"; polylist->setMaterial( mat.c_str() ); } } - primLength = 4; + primLength = 4; valid = true; break; } @@ -806,7 +806,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st valid = true; break; } - default: + default: { if ( polys == NULL ) { @@ -827,7 +827,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st polylist->setMaterial( mat.c_str() ); } } - primLength = 0; + primLength = 0; valid = true; break; // compute later when =0. } @@ -839,13 +839,13 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st switch( ps->getType() ) { //draw arrays (array of contiguous vertices) - + //(primitive type+begin+end),(primitive type+begin+end)... case osg::PrimitiveSet::DrawArraysPrimitiveType: { //OSG_WARN << "DrawArrays" << std::endl; - if ( primLength == 0 ) + if ( primLength == 0 ) { primLength = ps->getNumIndices(); } @@ -886,7 +886,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st trifans->setCount( trifans->getCount() + 1 ); break; } - default: + default: { //TODO : test this case unsigned int nbPolygons=drawArray->getCount()/primLength; @@ -987,7 +987,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st trifans->setCount( trifans->getCount() + 1 ); break; } - default: + default: { if (_pluginOptions.usePolygons) @@ -1047,7 +1047,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st if ( primLength == 0 ) primLength = ps->getNumIndices(); osg::DrawElementsUByte* drawElements = static_cast( ps ); - + std::vector p; switch ( mode ) { @@ -1081,7 +1081,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st trifans->setCount( trifans->getCount() + 1 ); break; } - default: + default: { unsigned int nbPolygons=drawElements->size()/primLength; if (_pluginOptions.usePolygons) @@ -1146,7 +1146,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st if ( primLength == 0 ) primLength = ps->getNumIndices(); osg::DrawElementsUShort* drawElements = static_cast( ps ); - + std::vector p; switch ( mode ) { @@ -1180,7 +1180,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st trifans->setCount( trifans->getCount() + 1 ); break; } - default: + default: { unsigned int nbPolygons=drawElements->size()/primLength; if (_pluginOptions.usePolygons) @@ -1199,7 +1199,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st break; } } - + unsigned int primCount = 0; osg::DrawElementsUShort::iterator primItrBegin = drawElements->begin(); unsigned int nbVerticesPerPoly= drawElements->size()/p.size(); @@ -1212,12 +1212,12 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st { unsigned int vindex = *primItr; - + appendGeometryIndices(geom,p[iPoly],vindex, norm,color, verts,normals,colors,texcoords, ncount,ccount); - + if ( primCount>0 && ((primCount % primLength) == 0) ) { if ( geom->getNormalBinding() == osg::Geometry::BIND_PER_PRIMITIVE ) @@ -1235,9 +1235,9 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st #if ( _SECURE_SCL == 1 ) if (primItrBegin != drawElements->end()) #endif - primItrEnd+=nbVerticesPerPoly; + primItrEnd+=nbVerticesPerPoly; } - + break; } case osg::PrimitiveSet::DrawElementsUIntPrimitiveType: @@ -1247,7 +1247,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st if ( primLength == 0 ) primLength = ps->getNumIndices(); osg::DrawElementsUInt* drawElements = static_cast( ps ); - + std::vector p; switch ( mode ) { @@ -1281,7 +1281,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st trifans->setCount( trifans->getCount() + 1 ); break; } - default: + default: { unsigned int nbPolygons=drawElements->size()/primLength; if (_pluginOptions.usePolygons) @@ -1314,12 +1314,12 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st { unsigned int vindex = *primItr; - + appendGeometryIndices(geom,p[iPoly],vindex, norm,color, verts,normals,colors,texcoords, ncount,ccount); - + if ( primCount>0 && ((primCount % primLength) == 0) ) { if ( geom->getNormalBinding() == osg::Geometry::BIND_PER_PRIMITIVE ) @@ -1336,7 +1336,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st #if ( _SECURE_SCL == 1 ) if (primItrBegin != drawElements->end()) #endif - primItrEnd+=nbVerticesPerPoly; + primItrEnd+=nbVerticesPerPoly; } break; } @@ -1345,11 +1345,11 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st break; } - if ( geom->getNormalBinding() == osg::Geometry::BIND_PER_PRIMITIVE_SET ) + if ( geom->getNormalBinding() == osg::Geometry::BIND_PER_PRIMITIVE_SET ) { ncount++; } - if ( geom->getColorBinding() == osg::Geometry::BIND_PER_PRIMITIVE_SET ) + if ( geom->getColorBinding() == osg::Geometry::BIND_PER_PRIMITIVE_SET ) { ccount++; } @@ -1381,7 +1381,7 @@ domSource *daeWriter::createSource( daeElement *parent, const std::string &baseN param = daeSafeCast< domParam >( acc->add( COLLADA_ELEMENT_PARAM ) ); param->setName( "R" ); param->setType( "float" ); - + param = daeSafeCast< domParam >( acc->add( COLLADA_ELEMENT_PARAM ) ); param->setName( "G" ); param->setType( "float" ); diff --git a/src/osgPlugins/dae/daeWMaterials.cpp b/src/osgPlugins/dae/daeWMaterials.cpp index e3c4d439e..198b0834e 100644 --- a/src/osgPlugins/dae/daeWMaterials.cpp +++ b/src/osgPlugins/dae/daeWMaterials.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "daeWriter.h" @@ -77,7 +77,7 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa } domEffect *effect = daeSafeCast< domEffect >( lib_effects->add( COLLADA_ELEMENT_EFFECT ) ); std::string efName = name + "_effect"; - + effect->setId( efName.c_str() ); url = "#" + efName; @@ -142,12 +142,12 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa np->setSid( sampName.c_str() ); domFx_sampler2D_common *sampler = daeSafeCast< domFx_sampler2D_common >( np->add( COLLADA_ELEMENT_SAMPLER2D ) ); domFx_sampler2D_common_complexType::domSource *source = daeSafeCast< domFx_sampler2D_common_complexType::domSource >( sampler->add( COLLADA_ELEMENT_SOURCE ) ); - source->setValue( surfName.c_str() ); + source->setValue( surfName.c_str() ); //set sampler state domFx_sampler2D_common_complexType::domWrap_s *wrap_s = daeSafeCast< domFx_sampler2D_common_complexType::domWrap_s >( sampler->add( COLLADA_ELEMENT_WRAP_S ) ); osg::Texture::WrapMode wrap = tex->getWrap( osg::Texture::WRAP_S ); - switch( wrap ) + switch( wrap ) { case osg::Texture::CLAMP: case osg::Texture::CLAMP_TO_EDGE: @@ -169,7 +169,7 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa domFx_sampler2D_common_complexType::domWrap_t *wrap_t = daeSafeCast< domFx_sampler2D_common_complexType::domWrap_t >( sampler->add( COLLADA_ELEMENT_WRAP_T ) ); wrap = tex->getWrap( osg::Texture::WRAP_T ); - switch( wrap ) + switch( wrap ) { case osg::Texture::CLAMP: case osg::Texture::CLAMP_TO_EDGE: @@ -272,7 +272,7 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa const osg::Vec4 &dCol = osgmat->getDiffuseFrontAndBack()?osgmat->getDiffuse( osg::Material::FRONT_AND_BACK ):osgmat->getDiffuse( osg::Material::FRONT ); const osg::Vec4 &sCol = osgmat->getSpecularFrontAndBack()?osgmat->getSpecular( osg::Material::FRONT_AND_BACK ):osgmat->getSpecular( osg::Material::FRONT ); float shininess = osgmat->getShininessFrontAndBack()?osgmat->getShininess( osg::Material::FRONT_AND_BACK ):osgmat->getShininess( osg::Material::FRONT ); - + domCommon_color_or_texture_type *cot = daeSafeCast< domCommon_color_or_texture_type >( phong->add( COLLADA_ELEMENT_EMISSION ) ); domCommon_color_or_texture_type_complexType::domColor *col = daeSafeCast< domCommon_color_or_texture_type_complexType::domColor >( cot->add( COLLADA_ELEMENT_COLOR ) ); col->getValue().append( eCol.r() ); @@ -287,7 +287,7 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa col->getValue().append( aCol.b() ); col->getValue().append( aCol.a() ); - + //### check if we really have a texture if ( phong->getDiffuse() == NULL ) { @@ -301,7 +301,7 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa else { cot = phong->getDiffuse(); - + if (_pluginOptions.writeExtras) { // Adds the following to a texture element @@ -394,7 +394,7 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa domCommon_transparent_type *ctt = daeSafeCast< domCommon_transparent_type >( phong->add(COLLADA_ELEMENT_TRANSPARENT) ); ctt->setOpaque( FX_OPAQUE_ENUM_A_ONE ); domCommon_color_or_texture_type_complexType::domTexture * dtex = daeSafeCast< domCommon_color_or_texture_type_complexType::domTexture >( ctt->add(COLLADA_ELEMENT_TEXTURE) ); - + if (!_pluginOptions.earthTex) { std::string sampName = efName + "-sampler"; @@ -405,7 +405,7 @@ void daeWriter::processMaterial( osg::StateSet *ss, domBind_material *pDomBindMa std::string iName = efName + "-image"; dtex->setTexture( iName.c_str() ); } - dtex->setTexcoord( "texcoord0" ); + dtex->setTexcoord( "texcoord0" ); } else { diff --git a/src/osgPlugins/dae/daeWSceneObjects.cpp b/src/osgPlugins/dae/daeWSceneObjects.cpp index 12d51db8d..acc2742c6 100644 --- a/src/osgPlugins/dae/daeWSceneObjects.cpp +++ b/src/osgPlugins/dae/daeWSceneObjects.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "daeWriter.h" @@ -70,7 +70,7 @@ void daeWriter::apply( osg::Group &node ) debugPrint( node ); updateCurrentDaeNode(); currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) ); - + // If a multiswitch node, store it's data as extra "MultiSwitch" data in the "OpenSceneGraph" technique osgSim::MultiSwitch* multiswitch = dynamic_cast(&node); if (_pluginOptions.writeExtras && multiswitch) @@ -128,7 +128,7 @@ void daeWriter::apply( osg::Group &node ) } writeNodeExtra(node); - + lastDepth = _nodePath.size(); traverse( node ); @@ -175,7 +175,7 @@ void daeWriter::apply( osg::Switch &node ) } writeNodeExtra(node); - + lastDepth = _nodePath.size(); // Process all children @@ -214,7 +214,7 @@ void daeWriter::apply( osg::Sequence &node ) domAny *frameTime = (domAny*)teq->add("FrameTime"); std::stringstream fw; - for (unsigned int i = 0; i < node.getNumChildren(); i++) + for (unsigned int i = 0; i < node.getNumChildren(); i++) { if (i > 0) { @@ -237,7 +237,7 @@ void daeWriter::apply( osg::Sequence &node ) intervalBegin->setValue(toString(begin).c_str()); domAny *intervalEnd = (domAny*)teq->add("IntervalEnd"); intervalEnd->setValue(toString(end).c_str()); - + // duration float speed; int nreps; @@ -253,9 +253,9 @@ void daeWriter::apply( osg::Sequence &node ) } writeNodeExtra(node); - + lastDepth = _nodePath.size(); - + traverse( node ); } @@ -315,14 +315,14 @@ void daeWriter::apply( osg::LOD &node ) valueList->setValue(fw.str().c_str()); } } - + writeNodeExtra(node); // Process all children traverse( node ); } -void daeWriter::apply( osg::ProxyNode &node ) +void daeWriter::apply( osg::ProxyNode &node ) { OSG_WARN << "ProxyNode. Missing " << node.getNumChildren() << " children" << std::endl; } @@ -347,7 +347,7 @@ void daeWriter::apply( osg::LightSource &node ) } domLight *light = daeSafeCast< domLight >( lib_lights->add( COLLADA_ELEMENT_LIGHT ) ); light->setId( name.c_str() ); - + osg::Light* pOsgLight = node.getLight(); domLight *pDomLight = daeSafeCast< domLight >( lib_lights->add( COLLADA_ELEMENT_LIGHT ) ); @@ -387,7 +387,7 @@ void daeWriter::apply( osg::LightSource &node ) domPoint->getLinear_attenuation()->setValue(pOsgLight->getLinearAttenuation()); domPoint->add(COLLADA_ELEMENT_QUADRATIC_ATTENUATION); domPoint->getQuadratic_attenuation()->setValue(pOsgLight->getQuadraticAttenuation()); - + if ((position.x() != 0) || (position.y() != 0) || (position.z() != 0)) { // TODO wrap instance_light in a transforming node to translate default light [0,0,0] into proper position @@ -445,7 +445,7 @@ void daeWriter::apply( osg::LightSource &node ) domLight *ambientDomLight = daeSafeCast< domLight >( lib_lights->add( COLLADA_ELEMENT_LIGHT ) ); ambientDomLight->setId(name.c_str()); - + domLight::domTechnique_common *ambientDomTechniqueCommon = daeSafeCast(ambientDomLight->add(COLLADA_ELEMENT_TECHNIQUE_COMMON)); // Ambient light @@ -456,7 +456,7 @@ void daeWriter::apply( osg::LightSource &node ) domAmbient->add(COLLADA_ELEMENT_COLOR); domAmbient->getColor()->setValue(color); } - + traverse( node ); } @@ -513,15 +513,15 @@ void daeWriter::apply( osg::CameraView &node) domTargetableFloat *pYfov = NULL; switch(node.getFieldOfViewMode()) { - case(osg::CameraView::UNCONSTRAINED): + case(osg::CameraView::UNCONSTRAINED): pXfov = daeSafeCast< domTargetableFloat >( pDomPerspective->add( COLLADA_ELEMENT_XFOV ) ); pXfov->setValue(node.getFieldOfView()); break; - case(osg::CameraView::HORIZONTAL): + case(osg::CameraView::HORIZONTAL): pXfov = daeSafeCast< domTargetableFloat >( pDomPerspective->add( COLLADA_ELEMENT_XFOV ) ); pXfov->setValue(node.getFieldOfView()); break; - case(osg::CameraView::VERTICAL): + case(osg::CameraView::VERTICAL): pYfov = daeSafeCast< domTargetableFloat >( pDomPerspective->add( COLLADA_ELEMENT_YFOV ) ); pYfov->setValue(node.getFieldOfView()); break; diff --git a/src/osgPlugins/dae/daeWriter.cpp b/src/osgPlugins/dae/daeWriter.cpp index c281001e3..c9089bd54 100644 --- a/src/osgPlugins/dae/daeWriter.cpp +++ b/src/osgPlugins/dae/daeWriter.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "daeWriter.h" @@ -239,7 +239,7 @@ void daeWriter::createAssetTag( bool isZUpAxis ) //TODO : set date and time c->setValue( "2006-07-25T00:00:00Z" ); m->setValue( "2006-07-25T00:00:00Z" ); - + u->setName( "meter" ); u->setMeter( 1 ); } @@ -277,7 +277,7 @@ void daeWriter::createAssetTag(const osg::Node &node) - // get description info as name value pairs + // get description info as name value pairs if (node.getDescriptions().size()%2 == 0) { for(osg::Node::DescriptionList::const_iterator ditr=node.getDescriptions().begin(); @@ -286,15 +286,15 @@ void daeWriter::createAssetTag(const osg::Node &node) { std::string attrName( *ditr ); ++ditr; std::string attrValue( *ditr ); - + if (attrName=="collada_created" && !attrValue.empty()) { c->setValue( attrValue.c_str() ); - } + } else if (attrName=="collada_modified" && !attrValue.empty()) { m->setValue( attrValue.c_str() ); - } + } else if (attrName=="collada_keywords" && !attrValue.empty()) { domAsset::domKeywords *keywords = daeSafeCast< domAsset::domKeywords >(asset->add("keywords" )); @@ -351,35 +351,35 @@ void daeWriter::createAssetTag(const osg::Node &node) } else if (attrName=="collada_contributor{0}.author" && !attrValue.empty()) { - domAsset::domContributor::domAuthor *author = + domAsset::domContributor::domAuthor *author = daeSafeCast< domAsset::domContributor::domAuthor >(contributor->add("author" )); author->setValue( attrValue.c_str() ); } else if (attrName=="collada_contributor{0}.authoring_tool" && !attrValue.empty()) { - domAsset::domContributor::domAuthoring_tool *authoring_tool = + domAsset::domContributor::domAuthoring_tool *authoring_tool = daeSafeCast< domAsset::domContributor::domAuthoring_tool >(contributor->add("authoring_tool" )); authoring_tool->setValue( attrValue.c_str() ); } else if (attrName=="collada_contributor{0}.comments" && !attrValue.empty()) { - domAsset::domContributor::domComments *comments = + domAsset::domContributor::domComments *comments = daeSafeCast< domAsset::domContributor::domComments >(contributor->add("comments" )); comments->setValue( attrValue.c_str() ); } else if (attrName=="collada_contributor{0}.source_data" && !attrValue.empty()) { - domAsset::domContributor::domSource_data *source_data = + domAsset::domContributor::domSource_data *source_data = daeSafeCast< domAsset::domContributor::domSource_data >(contributor->add("source_data" )); source_data->setValue( attrValue.c_str() ); } else if (attrName=="collada_contributor{0}.copyright" && !attrValue.empty()) { - domAsset::domContributor::domCopyright *copyright = + domAsset::domContributor::domCopyright *copyright = daeSafeCast< domAsset::domContributor::domCopyright >(contributor->add("copyright" )); copyright->setValue( attrValue.c_str() ); } - + // TODO: handle array of contributor data rather that just the first. // also there is probably a better way to pass attribute data as DescriptionList is a bit fragile @@ -401,10 +401,10 @@ void daeWriter::pushStateSet(osg::StateSet* ss) if (NULL!=ss) { // Save our current stateset stateSetStack.push(currentStateSet.get()); - + // merge with node stateset currentStateSet = static_cast(currentStateSet->clone(osg::CopyOp::SHALLOW_COPY)); - currentStateSet->merge(*ss); + currentStateSet->merge(*ss); } } diff --git a/src/osgPlugins/dae/domSourceReader.cpp b/src/osgPlugins/dae/domSourceReader.cpp index b9133aa1a..926aac0c1 100644 --- a/src/osgPlugins/dae/domSourceReader.cpp +++ b/src/osgPlugins/dae/domSourceReader.cpp @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #include "domSourceReader.h" @@ -41,7 +41,7 @@ void domSourceReader::convert(bool doublePrecision) // Only handle floats or name array for now... daeDoubleArray* float_array = NULL; - if (src->getFloat_array()) + if (src->getFloat_array()) { float_array = &(src->getFloat_array()->getValue()); } @@ -51,7 +51,7 @@ void domSourceReader::convert(bool doublePrecision) return; } - switch (stride) + switch (stride) { case 1: m_array_type = Float; @@ -102,7 +102,7 @@ void domSourceReader::convert(bool doublePrecision) return; } - if (float_array) + if (float_array) { daeDoubleArray& va = *float_array; switch (m_array_type) diff --git a/src/osgPlugins/dae/domSourceReader.h b/src/osgPlugins/dae/domSourceReader.h index 89bcc6be6..c48f137a9 100644 --- a/src/osgPlugins/dae/domSourceReader.h +++ b/src/osgPlugins/dae/domSourceReader.h @@ -1,14 +1,14 @@ /* * Copyright 2006 Sony Computer Entertainment Inc. * - * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this + * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://research.scea.com/scea_shared_source_license.html * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing permissions and limitations under the - * License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing permissions and limitations under the + * License. */ #ifndef _DOM_SRC_CONV_H_ @@ -25,7 +25,7 @@ namespace osgDAE { @class domSourceReader Converts a source to an OSG vector array as soon as you call a getter, so calling simple precision version \c getArray() will force getArray() to return NULL, and vice-versa (for a Vec3 array in the example). @brief Convert sources from DAE to OSG arrays -*/ +*/ class domSourceReader { public: diff --git a/src/osgPlugins/dds/ReaderWriterDDS.cpp b/src/osgPlugins/dds/ReaderWriterDDS.cpp index 30d00f746..d22076dff 100644 --- a/src/osgPlugins/dds/ReaderWriterDDS.cpp +++ b/src/osgPlugins/dds/ReaderWriterDDS.cpp @@ -14,14 +14,14 @@ * HISTORY: Created 31.03.2003 * Modified 13.05.2004 * by George Tarantilis, gtaranti@nps.navy.mil -* Modified 22.05.2009 -* Wojtek Lewandowski, lewandowski@ai.com.pl +* Modified 22.05.2009 +* Wojtek Lewandowski, lewandowski@ai.com.pl * -* WARNING: -* Bit Masks in the WrtiteDDS are set for 8 bit components -* write with 4 or 16 bit components will -* probably produce corrupted file -* Wojtek Lewandowski 2009-05-22 +* WARNING: +* Bit Masks in the WrtiteDDS are set for 8 bit components +* write with 4 or 16 bit components will +* probably produce corrupted file +* Wojtek Lewandowski 2009-05-22 * **********************************************************************/ #include @@ -56,7 +56,7 @@ struct DDCOLORKEY DDCOLORKEY(): dwColorSpaceLowValue(0), dwColorSpaceHighValue(0) {} - + UI32 dwColorSpaceLowValue; UI32 dwColorSpaceHighValue; }; @@ -73,7 +73,7 @@ struct DDPIXELFORMAT dwGBitMask(0), dwBBitMask(0), dwRGBAlphaBitMask(0) {} - + UI32 dwSize; UI32 dwFlags; @@ -134,21 +134,21 @@ struct DDSURFACEDESC2 dwSize(0), dwFlags(0), dwHeight(0), - dwWidth(0), + dwWidth(0), lPitch(0), dwBackBufferCount(0), dwMipMapCount(0), dwAlphaBitDepth(0), - dwReserved(0), - lpSurface(0), - dwTextureStage(0) {} - + dwReserved(0), + lpSurface(0), + dwTextureStage(0) {} + UI32 dwSize; UI32 dwFlags; UI32 dwHeight; - UI32 dwWidth; - union + UI32 dwWidth; + union { I32 lPitch; UI32 dwLinearSize; @@ -156,7 +156,7 @@ struct DDSURFACEDESC2 union { UI32 dwBackBufferCount; - UI32 dwDepth; + UI32 dwDepth; }; union { @@ -164,15 +164,15 @@ struct DDSURFACEDESC2 UI32 dwRefreshRate; }; UI32 dwAlphaBitDepth; - UI32 dwReserved; - UI32 lpSurface; //Fred Marmond: removed from pointer type to UI32 for 64bits compatibility. it is unused data - DDCOLORKEY ddckCKDestOverlay; - DDCOLORKEY ddckCKDestBlt; - DDCOLORKEY ddckCKSrcOverlay; - DDCOLORKEY ddckCKSrcBlt; - DDPIXELFORMAT ddpfPixelFormat; - DDSCAPS2 ddsCaps; - UI32 dwTextureStage; + UI32 dwReserved; + UI32 lpSurface; //Fred Marmond: removed from pointer type to UI32 for 64bits compatibility. it is unused data + DDCOLORKEY ddckCKDestOverlay; + DDCOLORKEY ddckCKDestBlt; + DDCOLORKEY ddckCKSrcOverlay; + DDCOLORKEY ddckCKSrcBlt; + DDPIXELFORMAT ddpfPixelFormat; + DDSCAPS2 ddsCaps; + UI32 dwTextureStage; }; // @@ -203,7 +203,7 @@ struct DXT1TexelsBlock // DDPIXELFORMAT flags // #define DDPF_ALPHAPIXELS 0x00000001l -#define DDPF_FOURCC 0x00000004l // Compressed formats +#define DDPF_FOURCC 0x00000004l // Compressed formats #define DDPF_RGB 0x00000040l // Uncompressed formats #define DDPF_ALPHA 0x00000002l #define DDPF_COMPRESSED 0x00000080l @@ -250,7 +250,7 @@ static unsigned int ComputeImageSizeInBytes if( height < 1 ) height = 1; if( depth < 1 ) depth = 1; - // Taking advantage of the fact that + // Taking advantage of the fact that // DXT formats are defined as 4 successive numbers: // GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 @@ -295,7 +295,7 @@ osg::Image* ReadDDSFile(std::istream& _istream) DDSURFACEDESC2 ddsd; char filecode[4]; - + _istream.read(filecode, 4); if (strncmp(filecode, "DDS ", 4) != 0) { return NULL; @@ -303,8 +303,8 @@ osg::Image* ReadDDSFile(std::istream& _istream) // Get the surface desc. _istream.read((char*)(&ddsd), sizeof(ddsd)); - osg::ref_ptr osgImage = new osg::Image(); - + osg::ref_ptr osgImage = new osg::Image(); + //Check valid structure sizes if(ddsd.dwSize != 124 && ddsd.ddpfPixelFormat.dwSize != 32) { @@ -322,13 +322,13 @@ osg::Image* ReadDDSFile(std::istream& _istream) // Retreive image properties. int s = ddsd.dwWidth; int t = ddsd.dwHeight; - int r = depth; + int r = depth; unsigned int dataType = GL_UNSIGNED_BYTE; unsigned int pixelFormat = 0; unsigned int internalFormat = 0; // Handle some esoteric formats - if(ddsd.ddpfPixelFormat.dwFlags & DDPF_BUMPDUDV) + if(ddsd.ddpfPixelFormat.dwFlags & DDPF_BUMPDUDV) { OSG_WARN << "ReadDDSFile warning: DDPF_BUMPDUDV format is not supported" << std::endl; return NULL; @@ -339,7 +339,7 @@ osg::Image* ReadDDSFile(std::istream& _istream) // // but Q8W8U8L8 as RGB? // // A2W10U10V10 as RGBA (dwFlags == DDPF_BUMPDUDV + DDPF_ALPHAPIXELS) } - if(ddsd.ddpfPixelFormat.dwFlags & DDPF_BUMPLUMINANCE) + if(ddsd.ddpfPixelFormat.dwFlags & DDPF_BUMPLUMINANCE) { OSG_WARN << "ReadDDSFile warning: DDPF_BUMPLUMINANCE format is not supported" << std::endl; return NULL; @@ -348,10 +348,10 @@ osg::Image* ReadDDSFile(std::istream& _istream) // // L6V5U5 -- 655 is not supported data type in GL // // X8L8V8U8 -- just as RGB } - + // Uncompressed formats will usually use DDPF_RGB to indicate an RGB format, // while compressed formats will use DDPF_FOURCC with a four-character code. - + bool usingAlpha = ddsd.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS; // Uncompressed formats. @@ -372,7 +372,7 @@ osg::Image* ReadDDSFile(std::istream& _istream) const unsigned int UNSUPPORTED = 0; - static const RGBFormat rgbFormats[] = + static const RGBFormat rgbFormats[] = { { "R3G3B2" , 8, 0xe0, 0x1c, 0x03, 0x00, GL_RGB , GL_RGB , GL_UNSIGNED_BYTE_3_3_2 }, @@ -391,25 +391,25 @@ osg::Image* ReadDDSFile(std::istream& _istream) GL_RGBA, GL_BGRA, UNSUPPORTED }, { "R8G8B8", 24, 0xff0000, 0x00ff00, 0x0000ff, 0x000000, - GL_RGB , GL_BGR , GL_UNSIGNED_BYTE }, + GL_RGB , GL_BGR , GL_UNSIGNED_BYTE }, { "B8G8R8", 24, 0x0000ff, 0x00ff00, 0xff0000, 0x000000, - GL_RGB , GL_RGB , GL_UNSIGNED_BYTE }, + GL_RGB , GL_RGB , GL_UNSIGNED_BYTE }, { "A8R8G8B8", 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, - GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE }, + GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE }, { "X8R8G8B8", 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, - GL_RGB , GL_BGRA, GL_UNSIGNED_BYTE }, + GL_RGB , GL_BGRA, GL_UNSIGNED_BYTE }, { "A8B8G8R8", 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, - GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE }, + GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE }, { "X8B8G8R8", 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, - GL_RGB , GL_RGBA, GL_UNSIGNED_BYTE }, + GL_RGB , GL_RGBA, GL_UNSIGNED_BYTE }, { "A2R10G10B10", 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000, - GL_RGBA, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV }, + GL_RGBA, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV }, { "A2B10G10R10", 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000, - GL_RGBA, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV }, + GL_RGBA, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV }, { "G16R16", 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000, - GL_RGB, UNSUPPORTED, GL_UNSIGNED_SHORT }, + GL_RGB, UNSUPPORTED, GL_UNSIGNED_SHORT }, }; bool found = false; @@ -438,9 +438,9 @@ osg::Image* ReadDDSFile(std::istream& _istream) { OSG_INFO << "ReadDDSFile info : " << f.name << " format is not supported" << std::endl; - return NULL; + return NULL; } - } + } } if ( !found ) @@ -449,16 +449,16 @@ osg::Image* ReadDDSFile(std::istream& _istream) OSG_INFO << "ReadDDSFile info : ddsd.ddpfPixelFormat.dwRGBBitCount = " << ddsd.ddpfPixelFormat.dwRGBBitCount << std::endl; OSG_INFO << "ReadDDSFile info : ddsd.ddpfPixelFormat.dwRBitMask = 0x" - << std::hex << std::setw(8) << std::setfill('0') + << std::hex << std::setw(8) << std::setfill('0') << ddsd.ddpfPixelFormat.dwRBitMask << std::endl; OSG_INFO << "ReadDDSFile info : ddsd.ddpfPixelFormat.dwGBitMask = 0x" - << std::hex << std::setw(8) << std::setfill('0') + << std::hex << std::setw(8) << std::setfill('0') << ddsd.ddpfPixelFormat.dwGBitMask << std::endl; OSG_INFO << "ReadDDSFile info : ddsd.ddpfPixelFormat.dwBBitMask = 0x" - << std::hex << std::setw(8) << std::setfill('0') + << std::hex << std::setw(8) << std::setfill('0') << ddsd.ddpfPixelFormat.dwBBitMask << std::endl; OSG_INFO << "ReadDDSFile info : ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0x" - << std::hex << std::setw(8) << std::setfill('0') + << std::hex << std::setw(8) << std::setfill('0') << ddsd.ddpfPixelFormat.dwRGBAlphaBitMask << std::dec << std::endl; return NULL; } @@ -499,7 +499,7 @@ osg::Image* ReadDDSFile(std::istream& _istream) { OSG_INFO << "ReadDDSFile info : format = ALPHA" << std::endl; internalFormat = GL_ALPHA; - pixelFormat = GL_ALPHA; + pixelFormat = GL_ALPHA; } // Compressed formats else if(ddsd.ddpfPixelFormat.dwFlags & DDPF_FOURCC) @@ -538,7 +538,7 @@ osg::Image* ReadDDSFile(std::istream& _istream) OSG_INFO << "ReadDDSFile info : format = ATI2" << std::endl; internalFormat = GL_COMPRESSED_RED_GREEN_RGTC2_EXT; pixelFormat = GL_COMPRESSED_RED_GREEN_RGTC2_EXT; - break; + break; case 0x00000024: // A16B16G16R16 OSG_INFO << "ReadDDSFile info : format = A16B16G16R16" << std::endl; internalFormat = GL_RGBA; @@ -549,7 +549,7 @@ osg::Image* ReadDDSFile(std::istream& _istream) OSG_INFO << "ReadDDSFile info : format = A16B16G16R16F" << std::endl; internalFormat = GL_RGBA; // why no transparency? pixelFormat = GL_RGBA; - dataType = GL_HALF_FLOAT_NV; + dataType = GL_HALF_FLOAT_NV; break; case 0x0000006E: // Q16W16V16U16 OSG_INFO << "ReadDDSFile info : format = Q16W16V16U16" << std::endl; @@ -610,10 +610,10 @@ osg::Image* ReadDDSFile(std::istream& _istream) << " = 0x" << std::hex << std::setw(8) << std::setfill('0') << ddsd.ddpfPixelFormat.dwFourCC << std::dec << ") in dds file, image not loaded." << std::endl; - return NULL; + return NULL; } } - else + else { OSG_WARN << "ReadDDSFile warning: unhandled pixel format (ddsd.ddpfPixelFormat.dwFlags" << " = 0x" << std::hex << std::setw(8) << std::setfill('0') @@ -628,14 +628,14 @@ osg::Image* ReadDDSFile(std::istream& _istream) unsigned int sizeWithMipmaps = size; osg::Image::MipmapDataType mipmap_offsets; if ( ddsd.dwMipMapCount>1 ) - { + { unsigned numMipmaps = osg::Image::computeNumberOfMipmapLevels( s, t, r ); if( numMipmaps > ddsd.dwMipMapCount ) numMipmaps = ddsd.dwMipMapCount; // array starts at 1 level offset, 0 level skipped mipmap_offsets.resize( numMipmaps - 1 ); int width = s; - int height = t; + int height = t; int depth = r; for( unsigned int k = 0; k < mipmap_offsets.size(); ++k ) @@ -646,19 +646,19 @@ osg::Image* ReadDDSFile(std::istream& _istream) height = osg::maximum( height >> 1, 1 ); depth = osg::maximum( depth >> 1, 1 ); - sizeWithMipmaps += + sizeWithMipmaps += ComputeImageSizeInBytes( width, height, depth, pixelFormat, dataType ); } } - + unsigned char* imageData = new unsigned char [sizeWithMipmaps]; if(!imageData) { OSG_WARN << "ReadDDSFile warning: imageData == NULL" << std::endl; return NULL; } - - // Read pixels in two chunks. First main image, next mipmaps. + + // Read pixels in two chunks. First main image, next mipmaps. if ( !_istream.read( (char*)imageData, size ) ) { delete [] imageData; @@ -688,7 +688,7 @@ osg::Image* ReadDDSFile(std::istream& _istream) bool WriteDDSFile(const osg::Image *img, std::ostream& fout) { - // Initialize ddsd structure and its members + // Initialize ddsd structure and its members DDSURFACEDESC2 ddsd; memset( &ddsd, 0, sizeof( ddsd ) ); DDPIXELFORMAT ddpf; @@ -700,12 +700,12 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) DDSCAPS2 ddsCaps; memset( &ddsCaps, 0, sizeof( ddsCaps ) ); - ddsd.dwSize = sizeof(ddsd); + ddsd.dwSize = sizeof(ddsd); ddpf.dwSize = sizeof(ddpf); // Default values and initialization of structures' flags unsigned int SD_flags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; - unsigned int CAPS_flags = DDSCAPS_TEXTURE; + unsigned int CAPS_flags = DDSCAPS_TEXTURE; unsigned int PF_flags = 0; unsigned int CAPS2_flags = 0; @@ -737,10 +737,10 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) { ddpf.dwRBitMask = 0x000000ff; ddpf.dwGBitMask = 0x0000ff00; - ddpf.dwBBitMask = 0x00ff0000; + ddpf.dwBBitMask = 0x00ff0000; ddpf.dwRGBAlphaBitMask = 0xff000000; PF_flags |= (DDPF_ALPHAPIXELS | DDPF_RGB); - ddpf.dwRGBBitCount = pixelSize; + ddpf.dwRGBBitCount = pixelSize; ddsd.lPitch = img->getRowSizeInBytes(); SD_flags |= DDSD_PITCH; } @@ -749,10 +749,10 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) { ddpf.dwBBitMask = 0x000000ff; ddpf.dwGBitMask = 0x0000ff00; - ddpf.dwRBitMask = 0x00ff0000; + ddpf.dwRBitMask = 0x00ff0000; ddpf.dwRGBAlphaBitMask = 0xff000000; PF_flags |= (DDPF_ALPHAPIXELS | DDPF_RGB); - ddpf.dwRGBBitCount = pixelSize; + ddpf.dwRGBBitCount = pixelSize; ddsd.lPitch = img->getRowSizeInBytes(); SD_flags |= DDSD_PITCH; } @@ -761,8 +761,8 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) { ddpf.dwRBitMask = 0x000000ff; ddpf.dwRGBAlphaBitMask = 0x0000ff00; - PF_flags |= (DDPF_ALPHAPIXELS | DDPF_LUMINANCE); - ddpf.dwRGBBitCount = pixelSize; + PF_flags |= (DDPF_ALPHAPIXELS | DDPF_LUMINANCE); + ddpf.dwRGBBitCount = pixelSize; ddsd.lPitch = img->getRowSizeInBytes(); SD_flags |= DDSD_PITCH; } @@ -771,7 +771,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) { ddpf.dwRBitMask = 0x000000ff; ddpf.dwGBitMask = 0x0000ff00; - ddpf.dwBBitMask = 0x00ff0000; + ddpf.dwBBitMask = 0x00ff0000; PF_flags |= DDPF_RGB; ddpf.dwRGBBitCount = pixelSize; ddsd.lPitch = img->getRowSizeInBytes(); @@ -782,7 +782,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) { ddpf.dwBBitMask = 0x000000ff; ddpf.dwGBitMask = 0x0000ff00; - ddpf.dwRBitMask = 0x00ff0000; + ddpf.dwRBitMask = 0x00ff0000; PF_flags |= DDPF_RGB; ddpf.dwRGBBitCount = pixelSize; ddsd.lPitch = img->getRowSizeInBytes(); @@ -856,7 +856,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) ddsd.dwLinearSize = imageSize; SD_flags |= DDSD_LINEARSIZE; } - break; + break; case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: { ddpf.dwFourCC = FOURCC_ATI2; @@ -864,7 +864,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) ddsd.dwLinearSize = imageSize; SD_flags |= DDSD_LINEARSIZE; } - break; + break; case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: { ddpf.dwFourCC = FOURCC_ATI2; @@ -872,7 +872,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) ddsd.dwLinearSize = imageSize; SD_flags |= DDSD_LINEARSIZE; } - break; + break; default: OSG_WARN<<"Warning:: unhandled pixel format in image, file cannot be written."<getNumMipmapLevels(); OSG_INFO<<"writing out with mipmaps ddsd.dwMipMapCount"<flipVertical(); } - + return osgImage; } diff --git a/src/osgPlugins/dicom/ReaderWriterDICOM.cpp b/src/osgPlugins/dicom/ReaderWriterDICOM.cpp index a43f1f6ce..dd7e7be90 100644 --- a/src/osgPlugins/dicom/ReaderWriterDICOM.cpp +++ b/src/osgPlugins/dicom/ReaderWriterDICOM.cpp @@ -569,7 +569,7 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter } return true; } - + bool operator < (const SeriesIdentifier& rhs) const { if (SeriesInstanceUID < rhs.SeriesInstanceUID) return true; @@ -662,7 +662,7 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter SeriesIdentifier seriesIdentifier; seriesIdentifier.set(fileformat.getDataset()); - + // code for reading the intercept and scale that is required to convert to Hounsfield units. bool rescaling = false; double rescaleIntercept = 0.0; diff --git a/src/osgPlugins/directshow/DirectShowTexture.cpp b/src/osgPlugins/directshow/DirectShowTexture.cpp index b2cfd3d14..775f2d4a3 100644 --- a/src/osgPlugins/directshow/DirectShowTexture.cpp +++ b/src/osgPlugins/directshow/DirectShowTexture.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 2009 Tharsis Software +/* -*-c++-*- OpenSceneGraph - Copyright (C) 2009 Tharsis Software * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * Authors: @@ -37,145 +37,145 @@ struct NamedGuid const TCHAR *psz; }; -// 73646976-0000-0010-8000-00AA00389B71 'vids' == WMMEDIATYPE_Video -EXTERN_GUID(WMMEDIATYPE_Video, -0x73646976, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 73647561-0000-0010-8000-00AA00389B71 'auds' == WMMEDIATYPE_Audio -EXTERN_GUID(WMMEDIATYPE_Audio, -0x73647561, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 73636d64-0000-0010-8000-00AA00389B71 'scmd' == MEDIATYPE_Script -EXTERN_GUID(WMMEDIATYPE_Script, -0x73636d64, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 34A50FD8-8AA5-4386-81FE-A0EFE0488E31 WMMEDIATYPE_Image -EXTERN_GUID(WMMEDIATYPE_Image, -0x34a50fd8, 0x8aa5, 0x4386, 0x81, 0xfe, 0xa0, 0xef, 0xe0, 0x48, 0x8e, 0x31); -// D9E47579-930E-4427-ADFC-AD80F290E470 'fxfr' == WMMEDIATYPE_FileTransfer -EXTERN_GUID(WMMEDIATYPE_FileTransfer, -0xd9e47579, 0x930e, 0x4427, 0xad, 0xfc, 0xad, 0x80, 0xf2, 0x90, 0xe4, 0x70); -// 9BBA1EA7-5AB2-4829-BA57-0940209BCF3E 'text' == WMMEDIATYPE_Text -EXTERN_GUID(WMMEDIATYPE_Text, -0x9bba1ea7, 0x5ab2, 0x4829, 0xba, 0x57, 0x9, 0x40, 0x20, 0x9b, 0xcf, 0x3e); +// 73646976-0000-0010-8000-00AA00389B71 'vids' == WMMEDIATYPE_Video +EXTERN_GUID(WMMEDIATYPE_Video, +0x73646976, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 73647561-0000-0010-8000-00AA00389B71 'auds' == WMMEDIATYPE_Audio +EXTERN_GUID(WMMEDIATYPE_Audio, +0x73647561, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 73636d64-0000-0010-8000-00AA00389B71 'scmd' == MEDIATYPE_Script +EXTERN_GUID(WMMEDIATYPE_Script, +0x73636d64, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 34A50FD8-8AA5-4386-81FE-A0EFE0488E31 WMMEDIATYPE_Image +EXTERN_GUID(WMMEDIATYPE_Image, +0x34a50fd8, 0x8aa5, 0x4386, 0x81, 0xfe, 0xa0, 0xef, 0xe0, 0x48, 0x8e, 0x31); +// D9E47579-930E-4427-ADFC-AD80F290E470 'fxfr' == WMMEDIATYPE_FileTransfer +EXTERN_GUID(WMMEDIATYPE_FileTransfer, +0xd9e47579, 0x930e, 0x4427, 0xad, 0xfc, 0xad, 0x80, 0xf2, 0x90, 0xe4, 0x70); +// 9BBA1EA7-5AB2-4829-BA57-0940209BCF3E 'text' == WMMEDIATYPE_Text +EXTERN_GUID(WMMEDIATYPE_Text, +0x9bba1ea7, 0x5ab2, 0x4829, 0xba, 0x57, 0x9, 0x40, 0x20, 0x9b, 0xcf, 0x3e); -// 00000000-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_Base -EXTERN_GUID(WMMEDIASUBTYPE_Base, -0x00000000, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// e436eb78-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB1 -EXTERN_GUID(WMMEDIASUBTYPE_RGB1, -0xe436eb78, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); -// e436eb79-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB4 -EXTERN_GUID(WMMEDIASUBTYPE_RGB4, -0xe436eb79, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); -// e436eb7a-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB8 -EXTERN_GUID(WMMEDIASUBTYPE_RGB8, -0xe436eb7a, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); -// e436eb7b-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB565 -EXTERN_GUID(WMMEDIASUBTYPE_RGB565, -0xe436eb7b, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); -// e436eb7c-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB555 -EXTERN_GUID(WMMEDIASUBTYPE_RGB555, -0xe436eb7c, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); -// e436eb7d-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB24 -EXTERN_GUID(WMMEDIASUBTYPE_RGB24, -0xe436eb7d, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); -// e436eb7e-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB32 -EXTERN_GUID(WMMEDIASUBTYPE_RGB32, -0xe436eb7e, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); -// 30323449-0000-0010-8000-00AA00389B71 'YV12' == MEDIASUBTYPE_I420 -EXTERN_GUID(WMMEDIASUBTYPE_I420, -0x30323449, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 56555949-0000-0010-8000-00AA00389B71 'YV12' == MEDIASUBTYPE_IYUV -EXTERN_GUID(WMMEDIASUBTYPE_IYUV, -0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 31313259-0000-0010-8000-00AA00389B71 'YV12' == MEDIASUBTYPE_YV12 -EXTERN_GUID(WMMEDIASUBTYPE_YV12, -0x32315659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 32595559-0000-0010-8000-00AA00389B71 'YUY2' == MEDIASUBTYPE_YUY2 -EXTERN_GUID(WMMEDIASUBTYPE_YUY2, -0x32595559, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 59565955-0000-0010-8000-00AA00389B71 'UYVY' == MEDIASUBTYPE_UYVY -EXTERN_GUID(WMMEDIASUBTYPE_UYVY, -0x59565955, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 55595659-0000-0010-8000-00AA00389B71 'YVYU' == MEDIASUBTYPE_YVYU -EXTERN_GUID(WMMEDIASUBTYPE_YVYU, -0x55595659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 39555659-0000-0010-8000-00AA00389B71 'YVU9' == MEDIASUBTYPE_YVU9 -EXTERN_GUID(WMMEDIASUBTYPE_YVU9, -0x39555659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -// 3334504D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MP43 -EXTERN_GUID(WMMEDIASUBTYPE_MP43, -0x3334504D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 5334504D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MP4S -EXTERN_GUID(WMMEDIASUBTYPE_MP4S, -0x5334504D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 31564D57-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMV1 -EXTERN_GUID(WMMEDIASUBTYPE_WMV1, -0x31564D57, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 32564D57-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMV2 -EXTERN_GUID(WMMEDIASUBTYPE_WMV2, -0x32564D57, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 3153534D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MSS1 -EXTERN_GUID(WMMEDIASUBTYPE_MSS1, -0x3153534D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// e06d8026-db46-11cf-b4d1-00805f6cbbea WMMEDIASUBTYPE_MPEG2_VIDEO -EXTERN_GUID(WMMEDIASUBTYPE_MPEG2_VIDEO, -0xe06d8026, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea); -// 00000001-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_PCM -EXTERN_GUID(WMMEDIASUBTYPE_PCM, -0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000009-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_DRM -EXTERN_GUID(WMMEDIASUBTYPE_DRM, -0x00000009, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000162-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV9 -EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV9, -0x00000162, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000163-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudio_Lossless -EXTERN_GUID(WMMEDIASUBTYPE_WMAudio_Lossless, -0x00000163, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 3253534D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MSS2 -EXTERN_GUID(WMMEDIASUBTYPE_MSS2, -0x3253534D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 0000000A-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMSP1 -EXTERN_GUID( WMMEDIASUBTYPE_WMSP1, -0x0000000A,0x0000,0x0010,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71); -// 33564D57-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMV3 -EXTERN_GUID(WMMEDIASUBTYPE_WMV3, -0x33564D57, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000161-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV8 -EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV8, -0x00000161, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000161-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV7 -EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV7, -0x00000161, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000161-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV2 -EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV2, -0x00000161, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000130-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_ACELPnet -EXTERN_GUID(WMMEDIASUBTYPE_ACELPnet, -0x00000130, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 00000050-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MP3 -EXTERN_GUID(WMMEDIASUBTYPE_MP3, -0x00000055, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -// 776257d4-c627-41cb-8f81-7ac7ff1c40cc WMMEDIASUBTYPE_WebStream -EXTERN_GUID(WMMEDIASUBTYPE_WebStream, -0x776257d4, 0xc627, 0x41cb, 0x8f, 0x81, 0x7a, 0xc7, 0xff, 0x1c, 0x40, 0xcc); +// 00000000-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_Base +EXTERN_GUID(WMMEDIASUBTYPE_Base, +0x00000000, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// e436eb78-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB1 +EXTERN_GUID(WMMEDIASUBTYPE_RGB1, +0xe436eb78, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); +// e436eb79-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB4 +EXTERN_GUID(WMMEDIASUBTYPE_RGB4, +0xe436eb79, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); +// e436eb7a-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB8 +EXTERN_GUID(WMMEDIASUBTYPE_RGB8, +0xe436eb7a, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); +// e436eb7b-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB565 +EXTERN_GUID(WMMEDIASUBTYPE_RGB565, +0xe436eb7b, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); +// e436eb7c-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB555 +EXTERN_GUID(WMMEDIASUBTYPE_RGB555, +0xe436eb7c, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); +// e436eb7d-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB24 +EXTERN_GUID(WMMEDIASUBTYPE_RGB24, +0xe436eb7d, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); +// e436eb7e-524f-11ce-9f53-0020af0ba770 MEDIASUBTYPE_RGB32 +EXTERN_GUID(WMMEDIASUBTYPE_RGB32, +0xe436eb7e, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); +// 30323449-0000-0010-8000-00AA00389B71 'YV12' == MEDIASUBTYPE_I420 +EXTERN_GUID(WMMEDIASUBTYPE_I420, +0x30323449, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 56555949-0000-0010-8000-00AA00389B71 'YV12' == MEDIASUBTYPE_IYUV +EXTERN_GUID(WMMEDIASUBTYPE_IYUV, +0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 31313259-0000-0010-8000-00AA00389B71 'YV12' == MEDIASUBTYPE_YV12 +EXTERN_GUID(WMMEDIASUBTYPE_YV12, +0x32315659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 32595559-0000-0010-8000-00AA00389B71 'YUY2' == MEDIASUBTYPE_YUY2 +EXTERN_GUID(WMMEDIASUBTYPE_YUY2, +0x32595559, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 59565955-0000-0010-8000-00AA00389B71 'UYVY' == MEDIASUBTYPE_UYVY +EXTERN_GUID(WMMEDIASUBTYPE_UYVY, +0x59565955, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 55595659-0000-0010-8000-00AA00389B71 'YVYU' == MEDIASUBTYPE_YVYU +EXTERN_GUID(WMMEDIASUBTYPE_YVYU, +0x55595659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 39555659-0000-0010-8000-00AA00389B71 'YVU9' == MEDIASUBTYPE_YVU9 +EXTERN_GUID(WMMEDIASUBTYPE_YVU9, +0x39555659, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +// 3334504D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MP43 +EXTERN_GUID(WMMEDIASUBTYPE_MP43, +0x3334504D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 5334504D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MP4S +EXTERN_GUID(WMMEDIASUBTYPE_MP4S, +0x5334504D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 31564D57-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMV1 +EXTERN_GUID(WMMEDIASUBTYPE_WMV1, +0x31564D57, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 32564D57-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMV2 +EXTERN_GUID(WMMEDIASUBTYPE_WMV2, +0x32564D57, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 3153534D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MSS1 +EXTERN_GUID(WMMEDIASUBTYPE_MSS1, +0x3153534D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// e06d8026-db46-11cf-b4d1-00805f6cbbea WMMEDIASUBTYPE_MPEG2_VIDEO +EXTERN_GUID(WMMEDIASUBTYPE_MPEG2_VIDEO, +0xe06d8026, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea); +// 00000001-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_PCM +EXTERN_GUID(WMMEDIASUBTYPE_PCM, +0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000009-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_DRM +EXTERN_GUID(WMMEDIASUBTYPE_DRM, +0x00000009, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000162-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV9 +EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV9, +0x00000162, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000163-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudio_Lossless +EXTERN_GUID(WMMEDIASUBTYPE_WMAudio_Lossless, +0x00000163, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 3253534D-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MSS2 +EXTERN_GUID(WMMEDIASUBTYPE_MSS2, +0x3253534D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 0000000A-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMSP1 +EXTERN_GUID( WMMEDIASUBTYPE_WMSP1, +0x0000000A,0x0000,0x0010,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71); +// 33564D57-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMV3 +EXTERN_GUID(WMMEDIASUBTYPE_WMV3, +0x33564D57, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000161-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV8 +EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV8, +0x00000161, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000161-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV7 +EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV7, +0x00000161, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000161-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_WMAudioV2 +EXTERN_GUID(WMMEDIASUBTYPE_WMAudioV2, +0x00000161, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000130-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_ACELPnet +EXTERN_GUID(WMMEDIASUBTYPE_ACELPnet, +0x00000130, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 00000050-0000-0010-8000-00AA00389B71 WMMEDIASUBTYPE_MP3 +EXTERN_GUID(WMMEDIASUBTYPE_MP3, +0x00000055, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +// 776257d4-c627-41cb-8f81-7ac7ff1c40cc WMMEDIASUBTYPE_WebStream +EXTERN_GUID(WMMEDIASUBTYPE_WebStream, +0x776257d4, 0xc627, 0x41cb, 0x8f, 0x81, 0x7a, 0xc7, 0xff, 0x1c, 0x40, 0xcc); -// 05589f80-c356-11ce-bf01-00aa0055595a WMFORMAT_VideoInfo -EXTERN_GUID(WMFORMAT_VideoInfo, -0x05589f80, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a); -// 05589f81-c356-11ce-bf01-00aa0055595a WMFORMAT_WaveFormatEx -EXTERN_GUID(WMFORMAT_WaveFormatEx, -0x05589f81, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a); -// 5C8510F2-DEBE-4ca7-BBA5-F07A104F8DFF WMFORMAT_Script -EXTERN_GUID(WMFORMAT_Script, -0x5c8510f2, 0xdebe, 0x4ca7, 0xbb, 0xa5, 0xf0, 0x7a, 0x10, 0x4f, 0x8d, 0xff); +// 05589f80-c356-11ce-bf01-00aa0055595a WMFORMAT_VideoInfo +EXTERN_GUID(WMFORMAT_VideoInfo, +0x05589f80, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a); +// 05589f81-c356-11ce-bf01-00aa0055595a WMFORMAT_WaveFormatEx +EXTERN_GUID(WMFORMAT_WaveFormatEx, +0x05589f81, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a); +// 5C8510F2-DEBE-4ca7-BBA5-F07A104F8DFF WMFORMAT_Script +EXTERN_GUID(WMFORMAT_Script, +0x5c8510f2, 0xdebe, 0x4ca7, 0xbb, 0xa5, 0xf0, 0x7a, 0x10, 0x4f, 0x8d, 0xff); -// 82f38a70-c29f-11d1-97ad-00a0c95ea850 WMSCRIPTTYPE_TwoStrings -EXTERN_GUID( WMSCRIPTTYPE_TwoStrings, -0x82f38a70,0xc29f,0x11d1,0x97,0xad,0x00,0xa0,0xc9,0x5e,0xa8,0x50); +// 82f38a70-c29f-11d1-97ad-00a0c95ea850 WMSCRIPTTYPE_TwoStrings +EXTERN_GUID( WMSCRIPTTYPE_TwoStrings, +0x82f38a70,0xc29f,0x11d1,0x97,0xad,0x00,0xa0,0xc9,0x5e,0xa8,0x50); -// e06d80e3-db46-11cf-b4d1-00805f6cbbea WMFORMAT_MPEG2Video -EXTERN_GUID(WMFORMAT_MPEG2Video, -0xe06d80e3, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x05f, 0x6c, 0xbb, 0xea); +// e06d80e3-db46-11cf-b4d1-00805f6cbbea WMFORMAT_MPEG2Video +EXTERN_GUID(WMFORMAT_MPEG2Video, +0xe06d80e3, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x05f, 0x6c, 0xbb, 0xea); EXTERN_GUID( CLSID_WMMUTEX_Language, 0xD6E22A00,0x35DA,0x11D1,0x90,0x34,0x00,0xA0,0xC9,0x03,0x49,0xBE ); EXTERN_GUID( CLSID_WMMUTEX_Bitrate, 0xD6E22A01,0x35DA,0x11D1,0x90,0x34,0x00,0xA0,0xC9,0x03,0x49,0xBE ); @@ -184,7 +184,7 @@ EXTERN_GUID( CLSID_WMMUTEX_Unknown, 0xD6E22A03,0x35DA,0x11D1,0x90,0x34,0x00,0xA0 EXTERN_GUID( CLSID_WMBandwidthSharing_Exclusive, 0xaf6060aa,0x5197,0x11d2,0xb6,0xaf,0x00,0xc0,0x4f,0xd9,0x08,0xe9 ); EXTERN_GUID( CLSID_WMBandwidthSharing_Partial, 0xaf6060ab,0x5197,0x11d2,0xb6,0xaf,0x00,0xc0,0x4f,0xd9,0x08,0xe9 ); -const NamedGuid MediaType[]= +const NamedGuid MediaType[]= { {&MEDIASUBTYPE_AIFF, TEXT("AIFF\0")}, {&MEDIASUBTYPE_AU, TEXT("AU\0")}, @@ -702,7 +702,7 @@ HRESULT FindPinInterface(IBaseFilter* pFilter, const GUID* pFormat, PIN_DIRECTIO { hr = E_INVALIDARG; } - + return hr; } @@ -810,7 +810,7 @@ bool CTextureRenderer::initBuildGraph() hr = _graphBuilder->QueryInterface( IID_IBasicAudio, (void **)&_basicAudio); checkError(prefixForMessage, hr); //May be no sound so dont effect return result - + return true; } @@ -826,7 +826,7 @@ struct ListDeviceAvailable }; std::vector _listDevice; IEnumMoniker* _enumMoniker; - ListDeviceAvailable(IEnumMoniker *enumMoniker) : _enumMoniker(enumMoniker) + ListDeviceAvailable(IEnumMoniker *enumMoniker) : _enumMoniker(enumMoniker) { createList(); } @@ -877,7 +877,7 @@ struct ListDeviceAvailable VariantInit(&varFilterClsid); // Associate moniker with a file - hr = device->BindToStorage(0, 0, IID_IPropertyBag, + hr = device->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); // Read filter name from property bag @@ -905,7 +905,7 @@ struct ListDeviceAvailable } else if (hr == E_PROP_ID_UNSUPPORTED) { - clsidFilter = GUID_NULL; // No CLSID is listed. + clsidFilter = GUID_NULL; // No CLSID is listed. hr = S_OK; } } @@ -941,7 +941,7 @@ struct ListDeviceAvailable } } - + }; @@ -950,7 +950,7 @@ struct ListCapDeviceAvailable typedef std::pair CapEntry; std::vector _capsList; IAMStreamConfig* _config; - ListCapDeviceAvailable(IAMStreamConfig* config) : _config(config) + ListCapDeviceAvailable(IAMStreamConfig* config) : _config(config) { createList(); } @@ -1026,7 +1026,7 @@ struct ListCapDeviceAvailable return best; if (first != nullCapEntry) return first; - + if (!_capsList.empty()) return _capsList.front(); return nullCapEntry; @@ -1053,7 +1053,7 @@ struct ListCapDeviceAvailable { if (pmt->formattype == FORMAT_VideoInfo && pmt->cbFormat >= sizeof(VIDEOINFOHEADER)) { - VIDEOINFOHEADER *video= + VIDEOINFOHEADER *video= reinterpret_cast(pmt->pbFormat); _capsList.push_back(CapEntry(pmt, video)); } @@ -1081,7 +1081,7 @@ bool CTextureRenderer::setupOutputSoundDevice(ICreateDevEnum* devs) HRESULT hr; std::string outputdevice = "Default DirectSound Device"; - IEnumMoniker* audioRenderer = 0; hr = devs?devs->CreateClassEnumerator (CLSID_AudioRendererCategory, &audioRenderer, 0):0; + IEnumMoniker* audioRenderer = 0; hr = devs?devs->CreateClassEnumerator (CLSID_AudioRendererCategory, &audioRenderer, 0):0; if (!checkError(prefixForMessage, hr)) return false; ListDeviceAvailable deviceFinder(audioRenderer); @@ -1127,7 +1127,7 @@ bool CTextureRenderer::openVideoCaptureDevice(const std::string& capture, int wa if (!checkError(prefixForMessage, hr)) return false; - IEnumMoniker* cams = 0; hr = devs?devs->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &cams, 0):0; + IEnumMoniker* cams = 0; hr = devs?devs->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &cams, 0):0; if (!checkError(prefixForMessage, hr)) return false; @@ -1139,7 +1139,7 @@ bool CTextureRenderer::openVideoCaptureDevice(const std::string& capture, int wa } ListDeviceAvailable::DeviceEntry device = deviceFinder.getDevice(capture); - if (!device._device) + if (!device._device) { OSG_WARN << _imageStream.get() << " no capture device \"" << capture << "\" found" << std::endl; return false; @@ -1160,7 +1160,7 @@ bool CTextureRenderer::openVideoCaptureDevice(const std::string& capture, int wa if (!checkError(prefixForMessage, hr)) return false; - IEnumPins* pins = 0; hr = _videoCaptureDevice?_videoCaptureDevice->EnumPins(&pins):0; + IEnumPins* pins = 0; hr = _videoCaptureDevice?_videoCaptureDevice->EnumPins(&pins):0; if (!checkError(prefixForMessage, hr)) return false; @@ -1188,7 +1188,7 @@ bool CTextureRenderer::openVideoCaptureDevice(const std::string& capture, int wa if (!checkError(prefixForMessage, hr)) return false; - IPin* rnd = 0; + IPin* rnd = 0; hr = FindPin(L"In", &rnd); if (!checkError(prefixForMessage, hr)) return false; @@ -1217,7 +1217,7 @@ bool CTextureRenderer::openSoundCaptureDevice(const std::string& capture, int nb if (!checkError(prefixForMessage, hr)) return false; - IEnumMoniker* captureDevices = 0; hr = devs?devs->CreateClassEnumerator (CLSID_AudioInputDeviceCategory, &captureDevices, 0):0; + IEnumMoniker* captureDevices = 0; hr = devs?devs->CreateClassEnumerator (CLSID_AudioInputDeviceCategory, &captureDevices, 0):0; if (!checkError(prefixForMessage, hr)) return false; @@ -1229,7 +1229,7 @@ bool CTextureRenderer::openSoundCaptureDevice(const std::string& capture, int nb } ListDeviceAvailable::DeviceEntry device = deviceFinder.getDevice(capture); - if (!device._device) + if (!device._device) { OSG_WARN << _imageStream.get() << " no sound capture device \"" << capture << "\" found" << std::endl; return false; @@ -1277,7 +1277,7 @@ bool CTextureRenderer::openSoundCaptureDevice(const std::string& capture, int nb if (SUCCEEDED(hr)) { TCHAR buffer[32]; - + ZeroMemory(buffer, sizeof(buffer)); pwfex = (WAVEFORMATEX*)pmt->pbFormat; @@ -1311,7 +1311,7 @@ bool CTextureRenderer::openSoundCaptureDevice(const std::string& capture, int nb { OSG_WARN << prefixForMessage << " can t retrieve informations pins" << std::endl; } - } + } if (pISC) pISC->Release(); pISC = 0; IPin* captureOutputDevicePinOut = 0; hr = _soundCaptureDevice? ::GetPin(_soundCaptureDevice,L"Capture",&captureOutputDevicePinOut) : 0; if (FAILED(hr)) { @@ -1460,14 +1460,14 @@ bool CTextureRenderer::openFile(const std::string& file) hr = _graphBuilder->AddSourceFilter(wFileName, L"Source", &_fileSource); if (!checkError(prefixForMessage, hr)) return false; - + //Find the video pin hr = _fileSource? ::GetPin(_fileSource, &MEDIATYPE_Video, PINDIR_OUTPUT, &videoOutputPin):0; if (!checkError(prefixForMessage, hr)) return false; - IPin* rnd = 0; + IPin* rnd = 0; hr = FindPin(L"In", &rnd); if (!checkError(prefixForMessage, hr)) return false; @@ -1562,8 +1562,8 @@ void CTextureRenderer::releaseRessources() CTextureRenderer::CTextureRenderer( DirectShowImageStream* is, HRESULT* valid) : CBaseVideoRenderer(__uuidof(CLSID_TextureRenderer), - NAME("Texture Renderer"), - NULL, + NAME("Texture Renderer"), + NULL, valid) { std::string prefixForMessage; @@ -1742,7 +1742,7 @@ bool DirectShowImageStream::openCaptureDevices() { return false; } - + return true; } @@ -1818,23 +1818,23 @@ void DirectShowImageStream::seek(double time) } -double DirectShowImageStream::getCurrentTime() const +double DirectShowImageStream::getCurrentTime() const { OpenThreads::ScopedLock lock(_mutex); double currentTime = -1; if (_renderer.valid() && _renderer->_mediaSeeking) - { - + { + LONGLONG curTimeLL = 0; HRESULT hr = _renderer->_mediaSeeking->GetCurrentPosition(&curTimeLL); if (FAILED(hr)) { - OSG_NOTICE << this << " " << getErrorMessage(hr) << std::endl; - } - else + OSG_NOTICE << this << " " << getErrorMessage(hr) << std::endl; + } + else { currentTime = static_cast(curTimeLL); - currentTime = currentTime * (100.0 * 1e-9); // default unit in directshow IMediaSeeking + currentTime = currentTime * (100.0 * 1e-9); // default unit in directshow IMediaSeeking } } return currentTime; @@ -1846,12 +1846,12 @@ void DirectShowImageStream::setOptions(const Options& map) _options[it->first] = it->second; } -void DirectShowImageStream::quit(bool waitForThreadToExit) +void DirectShowImageStream::quit(bool waitForThreadToExit) { stop(); } -double DirectShowImageStream::getLength() const +double DirectShowImageStream::getLength() const { OpenThreads::ScopedLock lock(_mutex); double duration = 0; @@ -1865,14 +1865,14 @@ double DirectShowImageStream::getLength() const return duration; } -double DirectShowImageStream::getFrameRate() const +double DirectShowImageStream::getFrameRate() const { OpenThreads::ScopedLock lock(_mutex); int frameRate = 0; if (_renderer.valid()) _renderer->get_AvgFrameRate(&frameRate); - return static_cast(frameRate) * 1e-2; -} + return static_cast(frameRate) * 1e-2; +} void DirectShowImageStream::setTimeMultiplier(double rate) { @@ -1881,32 +1881,32 @@ void DirectShowImageStream::setTimeMultiplier(double rate) _renderer->_mediaSeeking->SetRate(rate); } -double DirectShowImageStream::getTimeMultiplier() const +double DirectShowImageStream::getTimeMultiplier() const { OpenThreads::ScopedLock lock(_mutex); double rate = 1.0; if (_renderer.valid() && _renderer->_mediaSeeking) _renderer->_mediaSeeking->GetRate(&rate); - return rate; + return rate; } -void DirectShowImageStream::setVolume(float vol) { - OpenThreads::ScopedLock lock(_mutex); - if (_renderer.valid() && _renderer->_basicAudio) - { - _renderer->_basicAudio->put_Volume(vol); - } +void DirectShowImageStream::setVolume(float vol) { + OpenThreads::ScopedLock lock(_mutex); + if (_renderer.valid() && _renderer->_basicAudio) + { + _renderer->_basicAudio->put_Volume(vol); + } } float DirectShowImageStream::getVolume() const { - OpenThreads::ScopedLock lock(_mutex); - double vol = 0; - if (_renderer.valid() && _renderer->_basicAudio) - { + OpenThreads::ScopedLock lock(_mutex); + double vol = 0; + if (_renderer.valid() && _renderer->_basicAudio) + { long d = 0; - _renderer->_basicAudio->get_Volume(&d); - vol = static_cast(d); - } + _renderer->_basicAudio->get_Volume(&d); + vol = static_cast(d); + } return vol; } diff --git a/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp b/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp index 41106b3b0..f3c65e745 100644 --- a/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp +++ b/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 2009 Tharsis Software +/* -*-c++-*- OpenSceneGraph - Copyright (C) 2009 Tharsis Software * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * Authors: @@ -52,7 +52,7 @@ public: return ReadResult::FILE_NOT_HANDLED; return readImageStream(filename, options); } - + ReadResult readImageStream(const std::string& filename, const osgDB::ReaderWriter::Options * options) const { OSG_INFO << "ReaderWriterDirectShow::readImage " << filename << std::endl; diff --git a/src/osgPlugins/dot/BaseDotVisitor.cpp b/src/osgPlugins/dot/BaseDotVisitor.cpp index d1279f6cb..262ae1559 100644 --- a/src/osgPlugins/dot/BaseDotVisitor.cpp +++ b/src/osgPlugins/dot/BaseDotVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include "BaseDotVisitor.h" @@ -29,10 +29,10 @@ namespace osgDot { _rankdir = "rankdir = LR;"; // Set the locale used by the _nodes and _edges streams to the // classic or "C" locale. This is needed because most of the - // Graphviz tools are not locale sensitive and get confused + // Graphviz tools are not locale sensitive and get confused // by id numbers containing commas or periods. _nodes.imbue(std::locale("C")); - _edges.imbue(std::locale("C")); + _edges.imbue(std::locale("C")); } BaseDotVisitor::~BaseDotVisitor() { @@ -67,11 +67,11 @@ namespace osgDot { setTraversalMode( TRAVERSE_ALL_CHILDREN ); if ( fout && *fout ) { root.accept( *this ); - + *fout << "digraph osg_scenegraph { "<<_rankdir<< std::endl; - + *fout << _nodes.str() << _edges.str(); - + *fout << "}" << std::endl; _nodes.clear(); @@ -84,7 +84,7 @@ namespace osgDot { return false; } - void BaseDotVisitor::apply(Node& node) { + void BaseDotVisitor::apply(Node& node) { int id; if ( getOrCreateId( &node, id ) ) { handle( node, id ); @@ -119,7 +119,7 @@ namespace osgDot { } } - + void BaseDotVisitor::apply(Group& node) { int id; @@ -137,7 +137,7 @@ namespace osgDot { } } - + } void BaseDotVisitor::handle(osg::Node& node, int id) { @@ -169,10 +169,10 @@ namespace osgDot { void BaseDotVisitor::handle(osg::Node& node, osg::StateSet& stateset, int parentID, int childID) { } - + void BaseDotVisitor::handle(osg::Drawable& drawable, int id) { } - + void BaseDotVisitor::handle(osg::Drawable& drawable, osg::StateSet& stateset, int parentID, int childID ) { } diff --git a/src/osgPlugins/dot/BaseDotVisitor.h b/src/osgPlugins/dot/BaseDotVisitor.h index 673591695..87b06662a 100644 --- a/src/osgPlugins/dot/BaseDotVisitor.h +++ b/src/osgPlugins/dot/BaseDotVisitor.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #pragma once @@ -44,9 +44,9 @@ namespace osgDot { bool run( osg::Node& root, std::ostream* ostream ); virtual void apply(osg::Node& node); - + virtual void apply(osg::Geode& node); - + virtual void apply(osg::Group& node); diff --git a/src/osgPlugins/dot/ReaderWriterDOT.cpp b/src/osgPlugins/dot/ReaderWriterDOT.cpp index 7e1797ab5..575ee481e 100644 --- a/src/osgPlugins/dot/ReaderWriterDOT.cpp +++ b/src/osgPlugins/dot/ReaderWriterDOT.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -20,7 +20,7 @@ class ReaderWriterDOT : public osgDB::ReaderWriter { virtual const char* className() const { return "DOT Writer"; } virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"dot"); } - virtual WriteResult writeNode(const osg::Node& node,const std::string& fileName,const Options* options = NULL) const { + virtual WriteResult writeNode(const osg::Node& node,const std::string& fileName,const Options* options = NULL) const { std::string ext = osgDB::getFileExtension(fileName); if (!acceptsExtension(ext)) { return WriteResult::FILE_NOT_HANDLED; @@ -33,7 +33,7 @@ class ReaderWriterDOT : public osgDB::ReaderWriter { return WriteResult(WriteResult::ERROR_IN_WRITING_FILE); } - + virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout,const Options* options = NULL) const { osgDot::SimpleDotVisitor sdv; diff --git a/src/osgPlugins/dot/SimpleDotVisitor.cpp b/src/osgPlugins/dot/SimpleDotVisitor.cpp index 86f614290..62831ff62 100644 --- a/src/osgPlugins/dot/SimpleDotVisitor.cpp +++ b/src/osgPlugins/dot/SimpleDotVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -20,7 +20,7 @@ namespace osgDot { SimpleDotVisitor::~SimpleDotVisitor() { } - + void SimpleDotVisitor::handle(osg::Node& node, int id) { std::stringstream label; label << " Node"; @@ -67,26 +67,26 @@ namespace osgDot { void SimpleDotVisitor::handle(osg::Geode& geode, osg::Drawable& drawable, int parentID, int childID ) { drawEdge( parentID, childID, "dashed" ); } - + void SimpleDotVisitor::handle(osg::Drawable& drawable, osg::StateSet& stateset, int parentID, int childID ) { drawEdge( parentID, childID, "dashed" ); } void SimpleDotVisitor::drawNode( int id, const std::string& shape, const std::string& style, const std::string& label, const std::string& color, const std::string& fillColor ) { _nodes << id << - "[shape=\"" << shape << + "[shape=\"" << shape << "\" ,label=\"" << label << "\" ,style=\"" << style << "\" ,color=\"" << color << "\" ,fillColor=\"" << fillColor << "\"]" << std::endl; } - + void SimpleDotVisitor::drawEdge( int sourceId, int sinkId, const std::string& style ) { _edges - << sourceId << ":top -> " - << sinkId << ":top [style=\"" - << style << "\"];" + << sourceId << ":top -> " + << sinkId << ":top [style=\"" + << style << "\"];" << std::endl; } diff --git a/src/osgPlugins/dot/SimpleDotVisitor.h b/src/osgPlugins/dot/SimpleDotVisitor.h index 4c3a94235..e5e986ebc 100644 --- a/src/osgPlugins/dot/SimpleDotVisitor.h +++ b/src/osgPlugins/dot/SimpleDotVisitor.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/dw/ReaderWriterDW.cpp b/src/osgPlugins/dw/ReaderWriterDW.cpp index a337f550f..ac2b3e794 100644 --- a/src/osgPlugins/dw/ReaderWriterDW.cpp +++ b/src/osgPlugins/dw/ReaderWriterDW.cpp @@ -8,7 +8,7 @@ // Design Workshop editor can be downloaded from www.artifice.com = Mac & Win95/98/NT versions are available. // DW Lite is completely free, produces textured 3D models // aimed mostly at the architectural world. Flat polygons are generally produced -// No ability to produce smooth shading, unfortunately. +// No ability to produce smooth shading, unfortunately. // But it is the best bangs per buck. (Anything/nothing = infinite value, and this is quite a lot/nothing) #include @@ -33,7 +33,7 @@ using namespace osg; #ifndef WIN32 - #define CALLBACK + #define CALLBACK #endif class _dwobj; // predefine for later call @@ -42,7 +42,7 @@ int dwfgets(char *clin, int max, FILE *fin); // , end of line= 13 as well as Cre class dwmaterial {// design workshop material, to be translated to OGL public: typedef enum {Properties,TiledTexture,FullFace, SpotLight,PointLight} mttype; - dwmaterial() { type=Properties; + dwmaterial() { type=Properties; opacity=1; specular=0; specexp=0; fname="";TextureWidth=1; TextureHeight=1; ctx=NULL; tx=NULL; id=0; dstate=NULL;colour[0]=colour[1]=colour[2]=colour[3]=1; bright=halfIn=halfOut=falloff=0;atyp=NONE; @@ -53,7 +53,7 @@ public: if (!dstate) dstate = new StateSet; if (isTextured()) { // shares common textures if (!ctx || !tx) { // new texture needed - if (fname.length()>0) { + if (fname.length()>0) { ctx=osgDB::readRefImageFile(fname.c_str(),options); if (ctx.valid()) { ctx->setFileName(fname); @@ -111,7 +111,7 @@ public: TextureWidth=repx; TextureHeight=repy; } - inline float getRepWid() const { return TextureWidth;} + inline float getRepWid() const { return TextureWidth;} inline float getRepHt() const { return TextureHeight;} inline int isFullFace() const { return type==FullFace;} inline int getid() const { return id;} @@ -120,15 +120,15 @@ public: inline void setspecular(float o) { specular=o;} inline void setspecexp(float o) { specexp=o;} void setType(const char *buff) { - if (strncmp(buff,"Tiled_Texture",13)==0) + if (strncmp(buff,"Tiled_Texture",13)==0) type=dwmaterial::TiledTexture; - else if (strncmp(buff,"Spot_Light",11)==0) + else if (strncmp(buff,"Spot_Light",11)==0) type=dwmaterial::SpotLight; - else if (strncmp(buff,"Point_Light",11)==0) + else if (strncmp(buff,"Point_Light",11)==0) type=dwmaterial::PointLight; - else if (strncmp(buff,"Properties",11)==0) + else if (strncmp(buff,"Properties",11)==0) type=dwmaterial::Properties; - else if (strncmp(buff,"Full_Face_Texture",16)==0) + else if (strncmp(buff,"Full_Face_Texture",16)==0) type=dwmaterial::FullFace; } void setfname(const char *buff) { @@ -193,7 +193,7 @@ public: _face() { nVertStart=0; opening=NULL; idx=NULL; nv=0; nop=0; nset=0; nrm[0]=nrm[1]=nrm[2]=0;} ~_face() { delete [] idx;} void setnv(const int n){ nv=n; idx=new int[n];} - void addvtx(const int n){ + void addvtx(const int n){ if (nset < nv) { idx[nset]=n; nset++; @@ -216,12 +216,12 @@ public: int i2=idx[1]; // second, must be non-coincident while (i2==i1 && ic=nv) { printf("Invalid vertices %d of %d. I1-3 %d %d %d.\n", ic, nv, i1, i2, i3); @@ -237,9 +237,9 @@ public: getside12(side,s2, verts); norm(nrm, s2, side); } - void settrans(Matrix &mx, const Vec3 nrm, const std::vector verts, const dwmaterial *mat) const { + void settrans(Matrix &mx, const Vec3 nrm, const std::vector verts, const dwmaterial *mat) const { // define the matrix perpendcular to normal for mapping textures - float wid=mat->getRepWid(); + float wid=mat->getRepWid(); float ht=mat->getRepHt(); Vec3 r1, r2,r3; // 3 rows of rotation matrix if (mat->isFullFace()) { // set wid, ht from polygon @@ -273,7 +273,7 @@ public: mx(0,j)=r1[j]; mx(1,j)=r2[j]; mx(2,j)=r3[j]; - } + } // mx.postTrans(mx,0.5f,0.5f,0.0f); if (mat->isFullFace()) { // set offset such that mx*verts[idx[0]] -> uv=(0,0) Vec3 pos; @@ -292,8 +292,8 @@ public: // mx.postScale(mx,1.0f/themat->TextureWidth, 1.0f/themat->TextureHeight,1); } inline int setnvop(const unsigned short n) { // add a new hole in this face with n vertices - _face *oldop=opening; - opening=new _face[nop+1]; + _face *oldop=opening; + opening=new _face[nop+1]; for (int i=0; i& verts, const dwmaterial *themat, + void tessellate(const std::vector& verts, const dwmaterial *themat, GLUtesselator *ts, _dwobj *dwob, const RefMatrix *tmat) const; - + void link(const int idop, const _face *f2, const int idop2,const std::vector verts, const dwmaterial *themat) const; // to join up opposed faces of a hole inline const int getidx(int i) const { return idx[i];} private: @@ -371,34 +371,34 @@ public: } void End() { // tessellation is done int nverts=vertices->size()-nbegin; - osg::DrawArrays *drw=NULL; + osg::DrawArrays *drw=NULL; switch (primType) { case GL_TRIANGLES: //gset->setPrimType( osg::GeoSet::TRIANGLES ); //gset->setNumPrims( nload/3 ); - drw=new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,nbegin,nverts); + drw=new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,nbegin,nverts); gset->addPrimitiveSet(drw); break; case GL_TRIANGLE_STRIP: //gset->setPrimType( osg::GeoSet::TRIANGLE_STRIP ); //gset->setPrimLengths( nuprimlengs ); - drw=new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_STRIP,nbegin,nverts); + drw=new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_STRIP,nbegin,nverts); gset->addPrimitiveSet(drw); break; case GL_TRIANGLE_FAN: //gset->setPrimType( osg::GeoSet::TRIANGLE_FAN ); //gset->setPrimLengths( nuprimlengs ); - drw=new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN,nbegin,nverts); + drw=new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN,nbegin,nverts); gset->addPrimitiveSet(drw); break; case GL_QUADS: //gset->setPrimType( osg::GeoSet::QUADS ); //gset->setNumPrims( nload/4 ); - drw=new osg::DrawArrays(osg::PrimitiveSet::QUADS,nbegin,nverts); + drw=new osg::DrawArrays(osg::PrimitiveSet::QUADS,nbegin,nverts); gset->addPrimitiveSet(drw); break; case GL_QUAD_STRIP: //gset->setPrimType( osg::GeoSet::QUAD_STRIP ); - drw=new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,nbegin,nverts); + drw=new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,nbegin,nverts); gset->addPrimitiveSet(drw); break; case GL_POLYGON: //gset->setPrimType( osg::GeoSet::POLYGON ); - drw=new osg::DrawArrays(osg::PrimitiveSet::POLYGON,nbegin,nverts); + drw=new osg::DrawArrays(osg::PrimitiveSet::POLYGON,nbegin,nverts); gset->addPrimitiveSet(drw); break; } @@ -407,17 +407,17 @@ public: primType=op; nbegin=vertices->size(); } - void combine( GLdouble coords[3], avertex *d[4], + void combine( GLdouble coords[3], avertex *d[4], GLfloat w[4], avertex **dataOut , _dwobj *dwob); - void linkholes(const std::vector verts, const dwmaterial *themat, - const _face *f1, const _face *f2, + void linkholes(const std::vector verts, const dwmaterial *themat, + const _face *f1, const _face *f2, const int ipr[2], const int nv) { int gsidx[4]; gsidx[0]=f1->getidx(ipr[1]); // vertex position index gsidx[1]=f1->getidx(ipr[0]); // vertex position index gsidx[2]=f2->getidx(nv-ipr[0]-1); // vertex position index gsidx[3]=f2->getidx(nv-ipr[1]-1); // vertex position index - + Matrix mx; // texture matrix transform to plane Vec3 s1,s2; Vec3 nrm; // calculated normal to face @@ -434,11 +434,11 @@ public: txcoords->push_back(uv); normals->push_back(nrm); } - osg::DrawArrays *drw=NULL; + osg::DrawArrays *drw=NULL; drw=new osg::DrawArrays(osg::PrimitiveSet::QUADS,n1,4); gset->addPrimitiveSet(drw); } - void tessellate(_face &fc, const std::vector& verts, const dwmaterial *themat,GLUtesselator* ts, _dwobj *dwob) + void tessellate(_face &fc, const std::vector& verts, const dwmaterial *themat,GLUtesselator* ts, _dwobj *dwob) { // generates a set of primitives all of one type (eg tris, qstrip trifan...) fc.setNBegin(vertices->size()); fc.tessellate(verts, themat, ts, dwob, tmat.get()); @@ -479,12 +479,12 @@ void CALLBACK myFaceEnd() prd->End(); } void CALLBACK myVertex(void *pv) -{// tess vertex call back with texture coord == void *pv1, +{// tess vertex call back with texture coord == void *pv1, prd->addv((avertex *)pv); } -void CALLBACK combineCallback( GLdouble coords[3], avertex *d[4], - GLfloat w[4], avertex **dataOut , _dwobj *dwob) -{ +void CALLBACK combineCallback( GLdouble coords[3], avertex *d[4], + GLfloat w[4], avertex **dataOut , _dwobj *dwob) +{ // dwob needed if there is a combine callback to add the new vertex to group prd->combine(coords, d, w, dataOut,dwob); } @@ -522,10 +522,10 @@ class _dwobj { // class for design workshop read of a single object public: _dwobj() { nverts=nfaces=0; openings=NULL;faces=NULL; tmat=NULL; edges=NULL; nopens=nfaceverts=0; fc1=fc2=NULL; colour[0]=colour[1]=colour[2]=colour[3]=1; - } + } ~_dwobj() {/*delete verts; delete faces;delete openings;*/ delete [] fc1;delete [] fc2; - } + } int readOpenings(FILE *fp, const int nexpected) { // read up to nexpected openings, each opening may have a number of vertices char buff[256]; @@ -667,7 +667,7 @@ private: osg::ref_ptr mx; // current uvw transform for currently tessealting face }; -void _face::tessellate(const std::vector& verts, const dwmaterial *themat, +void _face::tessellate(const std::vector& verts, const dwmaterial *themat, GLUtesselator *ts, _dwobj *dwob, const RefMatrix * /*tmat*/) const { int nvall=getallverts(); int nused=0; @@ -675,7 +675,7 @@ void _face::tessellate(const std::vector& verts, const dwmaterial *themat, Matrix mx; // texture matrix transform to plane settrans(mx, nrm, verts,themat); dwob->setmx(new RefMatrix(mx)); // may be used by combine callback to define txcoord - gluTessBeginPolygon(ts, dwob); + gluTessBeginPolygon(ts, dwob); gluTessBeginContour(ts); /**/ for (int j=0; j& verts, const dwmaterial *themat, gluTessVertex(ts, (double *)&(poses[nused]), (double *)(poses+nused)); nused++; } - gluTessEndContour(ts); + gluTessEndContour(ts); for (int k=0; k& verts, const dwmaterial *themat, gluTessEndPolygon(ts); delete [] poses; } -void prims::combine( GLdouble coords[3], avertex *d[4], +void prims::combine( GLdouble coords[3], avertex *d[4], GLfloat w[4], avertex **dataOut , _dwobj *dwob) { - avertex *newv = new avertex(); // (avertex *)calloc(1, sizeof(avertex)); - newv->pos[0] = coords[0]; - newv->pos[1] = coords[1]; + avertex *newv = new avertex(); // (avertex *)calloc(1, sizeof(avertex)); + newv->pos[0] = coords[0]; + newv->pos[1] = coords[1]; newv->pos[2] = coords[2]; newv->uv[0] = newv->uv[1] =0; newv->nrmv[0] = newv->nrmv[1] = newv->nrmv[2] =0; @@ -749,13 +749,13 @@ void _dwobj::buildDrawable(Group *grp, const osgDB::ReaderWriter::Options *optio faces[i].setnorm(verts); // set its normal and any hole normals nfnvf+=faces[i].getallverts(); // get total vertices in object, defines dimensions of NEW arrays } - - + + GLUtesselator* ts=gluNewTess(); - gluTessCallback(ts, GLU_TESS_BEGIN, (GLU_TESS_CALLBACK) myFaceBegin); - gluTessCallback(ts, GLU_TESS_VERTEX, (GLU_TESS_CALLBACK) myVertex); - gluTessCallback(ts, GLU_TESS_END, (GLU_TESS_CALLBACK) myFaceEnd); - gluTessCallback(ts, GLU_TESS_ERROR, (GLU_TESS_CALLBACK) error); + gluTessCallback(ts, GLU_TESS_BEGIN, (GLU_TESS_CALLBACK) myFaceBegin); + gluTessCallback(ts, GLU_TESS_VERTEX, (GLU_TESS_CALLBACK) myVertex); + gluTessCallback(ts, GLU_TESS_END, (GLU_TESS_CALLBACK) myFaceEnd); + gluTessCallback(ts, GLU_TESS_ERROR, (GLU_TESS_CALLBACK) error); gluTessCallback(ts, GLU_TESS_COMBINE_DATA, (GLU_TESS_CALLBACK) combineCallback); // for (int nvf=0; nvf<6; nvf++) { // for each length of face // for Geometry we dont need to collect prim types individually @@ -764,11 +764,11 @@ void _dwobj::buildDrawable(Group *grp, const osgDB::ReaderWriter::Options *optio prd->settmat(tmat.get()); osg::Geometry *gset = new osg::Geometry; prd->setGeometry(gset); - StateSet *dstate=themat->make(options); + StateSet *dstate=themat->make(options); gset->setStateSet( dstate ); grp->addChild( geode ); // add to the world outside geode->addDrawable(gset); - + // each face adds a primitive to the geometry, after it is tessellated for (i=0; itessellate(faces[i],verts, themat, ts, this); @@ -790,12 +790,12 @@ void _dwobj::buildDrawable(Group *grp, const osgDB::ReaderWriter::Options *optio class ReaderWriterDW : public osgDB::ReaderWriter { public: - + ReaderWriterDW() { supportsExtension("dw","Designer Workbench model format"); } - + virtual const char* className() const { return "Design Workshop Database Reader"; } virtual ReadResult readNode(const std::string& file,const osgDB::ReaderWriter::Options* options) const @@ -832,7 +832,7 @@ class ReaderWriterDW : public osgDB::ReaderWriter } Group *grp = new Group; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -851,7 +851,7 @@ class ReaderWriterDW : public osgDB::ReaderWriter rdg=MATERIAL; int id=atoi(buff); matpalet[nmat].setid(id); // current material to be modified - + } else if (strncmp(buff, "Phase:",6)==0) { } else if (strncmp(buff, "CurrPhase:",10)==0) { } else if (strncmp(buff, "numPhases:",10)==0) { @@ -889,8 +889,8 @@ class ReaderWriterDW : public osgDB::ReaderWriter if (end) *end='\0'; // removed matpalet[nmat].setfname(buff); } else if( strncmp(buff,"Extrusion:",10)==0 || - strncmp(buff,"Cube:",5)==0 || - strncmp(buff,"Polyline:",9)==0 || + strncmp(buff,"Cube:",5)==0 || + strncmp(buff,"Polyline:",9)==0 || strncmp(buff,"Polyhedron:",11)==0) { rdg=OBJECT; obj.buildDrawable(grp, options); @@ -898,7 +898,7 @@ class ReaderWriterDW : public osgDB::ReaderWriter } else if( strncmp(buff,"Mat:",4)==0) { int mt=atoi(buff+4); for (int j=0; j #include "DXFWriterNodeVisitor.h" - + // ROBERT - is there any need for a value visitor like this or is it just overkill? /** writes all values of an array out to a stream, applies a matrix beforehand if necessary */ @@ -27,116 +27,116 @@ /* class ValueVisitor : public osg::ValueVisitor { public: - ValueVisitor(std::ostream& fout, const Layer &layer,const osg::Matrix& m = osg::Matrix::identity()) : - osg::ValueVisitor(), - _fout(fout), - _layer(layer), - _m(m) - { - //_applyMatrix = (_m != osg::Matrix::identity()); + ValueVisitor(std::ostream& fout, const Layer &layer,const osg::Matrix& m = osg::Matrix::identity()) : + osg::ValueVisitor(), + _fout(fout), + _layer(layer), + _m(m) + { + //_applyMatrix = (_m != osg::Matrix::identity()); } - - virtual void apply(osg::Vec3 & inv) - { + + virtual void apply(osg::Vec3 & inv) + { osg::Vec3 point(inv) ; - point = point * _m; - _fout << "0 \nVERTEX\n 8\n"<<_layer._name<<"\n"; + point = point * _m; + _fout << "0 \nVERTEX\n 8\n"<<_layer._name<<"\n"; if ( _layer._color ) { - _fout << "62\n"<<_layer._color<<"\n"; + _fout << "62\n"<<_layer._color<<"\n"; } - _fout <<" 10\n"<getVertexArray())->at(i) * _m; - _fout <getVertexArray())->at(i) * _m; + _fout <(mode, count, indices); @@ -199,20 +199,20 @@ class DxfPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) { drawElementsImplementation(mode, count, indices); - } + } virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) { drawElementsImplementation(mode, count, indices); - } + } protected: - - templatevoid drawElementsImplementation(GLenum mode, GLsizei count, const T* indices) + + templatevoid drawElementsImplementation(GLenum mode, GLsizei count, const T* indices) { if (indices==0 || count==0) return; - typedef const T* IndexPointer; + typedef const T* IndexPointer; switch(mode) { @@ -221,7 +221,7 @@ class DxfPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { IndexPointer ilast = &indices[count]; for(IndexPointer iptr=indices;iptr _indexCache; - osg::Geometry* _geo; - + std::vector _indexCache; + osg::Geometry* _geo; + Layer _layer; AcadColor _acad; // needed to lookup new colors osg::Matrix _m; @@ -386,7 +386,7 @@ void DxfPrimitiveIndexWriter::drawArrays(GLenum mode,GLint first,GLsizei count) } case(GL_POINTS): { - + for(GLsizei i=0;igetNumElements(); ++i) { -// array->accept(i, vv); +// +// ValueVisitor vv(_fout, layer,m); +// for(unsigned int i = 0; i < array->getNumElements(); ++i) { +// array->accept(i, vv); // } -// +// // OSG_DEBUG << "processArray "<getNumElements() << " elements written" << std::endl; -// +// //} -void DXFWriterNodeVisitor::processStateSet(osg::StateSet* ss) +void DXFWriterNodeVisitor::processStateSet(osg::StateSet* ss) { - // anything to do if no material/texture? + // anything to do if no material/texture? osg::PolygonMode * pm = dynamic_cast(ss->getAttribute(osg::StateAttribute::POLYGONMODE)); if (pm) @@ -483,55 +483,55 @@ void DXFWriterNodeVisitor::processStateSet(osg::StateSet* ss) } } -void DXFWriterNodeVisitor::processGeometry(osg::Geometry* geo, osg::Matrix& m) +void DXFWriterNodeVisitor::processGeometry(osg::Geometry* geo, osg::Matrix& m) { - + // We only want to create a new layer for geometry with something to draw if (geo->getVertexArray() && geo->getVertexArray()->getNumElements() ) { processStateSet(_currentStateSet.get()); - + if ( _firstPass ) { // Must have unique layer names _layer._name = getLayerName( geo->getName().empty() ? geo->getParent(0)->getName() : geo->getName() ); OSG_DEBUG << "adding Layer " << _layer._name << std::endl; // if single colour include in header - if ( osg::Geometry::BIND_OVERALL == geo->getColorBinding() ) { + if ( osg::Geometry::BIND_OVERALL == geo->getColorBinding() ) { _layer._color = _acadColor.findColor(getNodeRGB(geo)); // per layer color } else if ( osg::Geometry::BIND_OFF== geo->getColorBinding() ) { _layer._color = 0xff; // use white - or can we easily lookup in texture? } else { _layer._color = 0; // per point color - } + } _layers.push_back(_layer); } else { _layer = _layers[_count++]; OSG_DEBUG << "writing Layer " << _layer._name << std::endl; - if ( geo->getNumPrimitiveSets() ) { - for(unsigned int i = 0; i < geo->getNumPrimitiveSets(); ++i) - { + if ( geo->getNumPrimitiveSets() ) { + for(unsigned int i = 0; i < geo->getNumPrimitiveSets(); ++i) + { osg::PrimitiveSet* ps = geo->getPrimitiveSet(i); DxfPrimitiveIndexWriter pif(_fout, geo,_layer,_acadColor,m,_writeTriangleAs3DFace); ps->accept(pif); - } - } else { + } + } else { // Is array visitor necessary for only dealing with vertex arrays? - //processArray(geo->getVertexArray(), _layer,m); + //processArray(geo->getVertexArray(), _layer,m); if ( geo->getVertexArray() ) { osg::Vec3Array* data=static_cast(geo->getVertexArray()); for (unsigned int ii=0;iigetNumElements();ii++) { osg::Vec3 point = data->at(ii) * m; - _fout << "0 \nVERTEX\n 8\n"<<_layer._name<<"\n"; + _fout << "0 \nVERTEX\n 8\n"<<_layer._name<<"\n"; if ( _layer._color ) { - _fout << "62\n"<<_layer._color<<"\n"; - } else { - _fout << "62\n"<<_acadColor.findColor(getNodeRGB(geo,ii))<<"\n"; + _fout << "62\n"<<_layer._color<<"\n"; + } else { + _fout << "62\n"<<_acadColor.findColor(getNodeRGB(geo,ii))<<"\n"; } - _fout<<" 10\n"<asGeometry(); if ( g != NULL ) { - pushStateSet(g->getStateSet()); - processGeometry(g,m); + pushStateSet(g->getStateSet()); + processGeometry(g,m); popStateSet(g->getStateSet()); } } - popStateSet(node.getStateSet()); + popStateSet(node.getStateSet()); } @@ -569,11 +569,11 @@ bool DXFWriterNodeVisitor::writeHeader(const osg::BoundingSphere &bound) if ( _layers.empty() ) { return false; } - _fout << "999\n written by OpenSceneGraph" << std::endl; + _fout << "999\n written by OpenSceneGraph" << std::endl; _fout << "0\nSECTION\n2\nHEADER\n"; _fout << "9\n$ACADVER\n1\nAC1006\n"; // specify minimum autocad version AC1006=R10 - + _fout << "9\n$EXTMIN\n10\n"<>16; int green = (0x0000ff00&rgb)>>8; @@ -102,10 +102,10 @@ protected: int L=std::min(std::min(red,green),blue); value = (float)H/255.0f; // note hsv and hsl define v differently! - sat=(float)(H-L)/(float)H; + sat=(float)(H-L)/(float)H; if (H==L) { - hue=0.0; + hue=0.0; }else if (H==red) { hue=360.0 + (60.0 * (float)(green-blue)/(float)(H-L)); if ( hue > 360 ) { hue-=360; } @@ -114,8 +114,8 @@ protected: } else if (H==blue) { hue=240.0 + (60.0 * (float)(red-green)/(float)(H-L)); } else { - hue = 0.0; - } + hue = 0.0; + } } int nearestColor(unsigned int rgb) @@ -126,13 +126,13 @@ protected: float v; hsv(rgb,h,s,v); - // aci index format is + // aci index format is // last digit odd = 50% sat, even=100% // last digit 0,1 = 100% value, 2,3=80%, 4,5=60% 6,7=50%, 8,9=30% - // first two sigits are hue angle /1.5 but count starts at 10, first 9 values are dummy named colours + // first two sigits are hue angle /1.5 but count starts at 10, first 9 values are dummy named colours int aci=10 + (int)(h/1.5); aci -= (aci%10); // ensure last digit is zero - + if ( v < 0.3 ) { aci += 9; } else if ( v < 0.5 ) { @@ -152,10 +152,10 @@ protected: return aci; } - + protected: - + typedef std::map ColorMap; ColorMap _indexColors; // maps RGB to autocad index colour ColorMap _hueColors; // maps hue angle to autocad index colour @@ -164,38 +164,38 @@ protected: class DXFWriterNodeVisitor: public osg::NodeVisitor { public: - DXFWriterNodeVisitor(std::ostream& fout) : - osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), - _fout(fout), + DXFWriterNodeVisitor(std::ostream& fout) : + osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), + _fout(fout), _currentStateSet(new osg::StateSet()), _firstPass(true), _writeTriangleAs3DFace(true) { - - + + } - - static unsigned int getNodeRGB(osg::Geometry *geo,unsigned int index=0) + + static unsigned int getNodeRGB(osg::Geometry *geo,unsigned int index=0) { osg::Vec4Array* data=static_cast(geo->getColorArray()); if ( data && indexsize() ) { - return (data->at(index).asABGR())>>8; + return (data->at(index).asABGR())>>8; } return 0; } - - bool writeHeader(const osg::BoundingSphere &bound);// call after first pass to trigger draw pass + + bool writeHeader(const osg::BoundingSphere &bound);// call after first pass to trigger draw pass void writeFooter(); void buildColorMap(); - virtual void apply(osg::Geode &node); - - virtual void apply(osg::Group &node) - { + virtual void apply(osg::Geode &node); + + virtual void apply(osg::Group &node) + { osg::NodeVisitor::traverse( node ); - + } void traverse (osg::Node &node) @@ -212,10 +212,10 @@ class DXFWriterNodeVisitor: public osg::NodeVisitor { if (NULL!=ss) { // Save our current stateset _stateSetStack.push(_currentStateSet.get()); - + // merge with node stateset _currentStateSet = static_cast(_currentStateSet->clone(osg::CopyOp::SHALLOW_COPY)); - _currentStateSet->merge(*ss); + _currentStateSet->merge(*ss); } } @@ -228,9 +228,9 @@ class DXFWriterNodeVisitor: public osg::NodeVisitor { _stateSetStack.pop(); } } - + int getNodeAcadColor(osg::Geometry *geo,int index=0) { return 0;} - + protected: struct CompareStateSet { @@ -240,9 +240,9 @@ class DXFWriterNodeVisitor: public osg::NodeVisitor { } }; - + private: - + DXFWriterNodeVisitor& operator = (const DXFWriterNodeVisitor&) { return *this; } // first pass get layer names and draw types @@ -250,14 +250,14 @@ class DXFWriterNodeVisitor: public osg::NodeVisitor { // second pass - output data void processGeometry(osg::Geometry* geo, osg::Matrix& m); - + void processArray(osg::Array* array, const Layer& layer,const osg::Matrix& m = osg::Matrix::identity()); - + void processStateSet(osg::StateSet* stateset); std::string getLayerName(const std::string& defaultValue = ""); - + typedef std::stack > StateSetStack; @@ -269,14 +269,14 @@ class DXFWriterNodeVisitor: public osg::NodeVisitor { osg::ref_ptr _currentStateSet; unsigned int _count; - std::vector _layers; + std::vector _layers; bool _firstPass; Layer _layer; bool _writeTriangleAs3DFace; - + AcadColor _acadColor; - + }; diff --git a/src/osgPlugins/dxf/ReaderWriterDXF.cpp b/src/osgPlugins/dxf/ReaderWriterDXF.cpp index 098de8d49..2c9ed1919 100644 --- a/src/osgPlugins/dxf/ReaderWriterDXF.cpp +++ b/src/osgPlugins/dxf/ReaderWriterDXF.cpp @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ #include @@ -37,35 +37,35 @@ public: { supportsExtension("dxf","Autodesk DXF format"); } - + virtual const char* className() { return "Autodesk DXF Reader/Writer"; } virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) const; - virtual WriteResult writeObject(const osg::Object& obj,const std::string& fileName,const Options* options=NULL) const + virtual WriteResult writeObject(const osg::Object& obj,const std::string& fileName,const Options* options=NULL) const { const osg::Node* node = dynamic_cast(&obj); if (node) return writeNode(*node, fileName, options); - else - return WriteResult(WriteResult::FILE_NOT_HANDLED); + else + return WriteResult(WriteResult::FILE_NOT_HANDLED); } - - - virtual WriteResult writeObject(const osg::Object& obj,std::ostream& fout,const Options* options=NULL) const + + + virtual WriteResult writeObject(const osg::Object& obj,std::ostream& fout,const Options* options=NULL) const { const osg::Node* node = dynamic_cast(&obj); if (node) return writeNode(*node, fout, options); - else - return WriteResult(WriteResult::FILE_NOT_HANDLED); + else + return WriteResult(WriteResult::FILE_NOT_HANDLED); } - virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout,const Options* =NULL) const - { + virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout,const Options* =NULL) const + { - - DXFWriterNodeVisitor nv(fout); + + DXFWriterNodeVisitor nv(fout); (const_cast(&node))->accept(nv); // first pass is to get all node names and types -> layers @@ -73,22 +73,22 @@ public: (const_cast(&node))->accept(nv); // second pass outputs data nv.writeFooter(); } - - return WriteResult(WriteResult::FILE_SAVED); + + return WriteResult(WriteResult::FILE_SAVED); } - virtual WriteResult writeNode(const osg::Node& node,const std::string& fileName,const Options* options =NULL) const - { + virtual WriteResult writeNode(const osg::Node& node,const std::string& fileName,const Options* options =NULL) const + { if (!acceptsExtension(osgDB::getFileExtension(fileName))) return WriteResult(WriteResult::FILE_NOT_HANDLED); osgDB::ofstream f(fileName.c_str()); - + if (!f.is_open() ) { return WriteResult(WriteResult::ERROR_IN_WRITING_FILE); } - DXFWriterNodeVisitor nv(f); - + DXFWriterNodeVisitor nv(f); + (const_cast(&node))->accept(nv); // first pass is to get all node names and types -> layers if ( nv.writeHeader(node.getBound()) ) { @@ -96,7 +96,7 @@ public: nv.writeFooter(); } - return WriteResult(WriteResult::FILE_SAVED); + return WriteResult(WriteResult::FILE_SAVED); } protected: @@ -107,7 +107,7 @@ REGISTER_OSGPLUGIN(dxf, ReaderWriterdxf) // read file and convert to OSG. -osgDB::ReaderWriter::ReadResult +osgDB::ReaderWriter::ReadResult ReaderWriterdxf::readNode(const std::string& filename, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getFileExtension(filename); @@ -119,9 +119,9 @@ ReaderWriterdxf::readNode(const std::string& filename, const osgDB::ReaderWriter double maxError=0.0; // if useAccuracy - the accuracy (max deviation) from the arc bool improveAccuracyOnly=false; // if true only use the given accuracy if it would improve the curve compared to the previous implementation // Thus you can ensure that large curves get rendered better but small ones don't get worse - + std::string optionsstring=options->getOptionString(); - + size_t accstart=optionsstring.find("Accuracy("); if (accstart>=0) { const char* start=optionsstring.c_str() + accstart + strlen("Accuracy("); @@ -131,11 +131,11 @@ ReaderWriterdxf::readNode(const std::string& filename, const osgDB::ReaderWriter // Option to only use the new accuracy code when it would improve on the accuracy of the old method if (optionsstring.find("ImproveAccuracyOnly") != std::string::npos) { improveAccuracyOnly=true; - } - // Pull out the initial dxfArc copy from the registry and set accuracy there. + } + // Pull out the initial dxfArc copy from the registry and set accuracy there. // When actual dxfArcs/Circles are created they will inherit these parameters from the exemplar dxfEntity::getRegistryEntity("ARC")->setAccuracy(true,maxError,improveAccuracyOnly); - dxfEntity::getRegistryEntity("CIRCLE")->setAccuracy(true,maxError,improveAccuracyOnly); + dxfEntity::getRegistryEntity("CIRCLE")->setAccuracy(true,maxError,improveAccuracyOnly); } // accuracy options exists } // options exist diff --git a/src/osgPlugins/dxf/aci.cpp b/src/osgPlugins/dxf/aci.cpp index 5127e534b..d8345d3a8 100644 --- a/src/osgPlugins/dxf/aci.cpp +++ b/src/osgPlugins/dxf/aci.cpp @@ -1,18 +1,18 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ #include "aci.h" -double aci::table[256*3] = +double aci::table[256*3] = { /* dummy */ 0,0,0, /* 1 */ 1,0,0, diff --git a/src/osgPlugins/dxf/aci.h b/src/osgPlugins/dxf/aci.h index a4d0790b5..1eb3beca3 100644 --- a/src/osgPlugins/dxf/aci.h +++ b/src/osgPlugins/dxf/aci.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ diff --git a/src/osgPlugins/dxf/codeValue.h b/src/osgPlugins/dxf/codeValue.h index 95042d3c8..67cb8a8ad 100644 --- a/src/osgPlugins/dxf/codeValue.h +++ b/src/osgPlugins/dxf/codeValue.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ diff --git a/src/osgPlugins/dxf/dxfBlock.cpp b/src/osgPlugins/dxf/dxfBlock.cpp index 39dec16a9..8fb7f524a 100644 --- a/src/osgPlugins/dxf/dxfBlock.cpp +++ b/src/osgPlugins/dxf/dxfBlock.cpp @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -18,7 +18,7 @@ using namespace std; -void +void dxfBlock::assign(dxfFile* dxf, codeValue& cv) { string s = cv._string; diff --git a/src/osgPlugins/dxf/dxfBlock.h b/src/osgPlugins/dxf/dxfBlock.h index 3be191a08..986ca0c4a 100644 --- a/src/osgPlugins/dxf/dxfBlock.h +++ b/src/osgPlugins/dxf/dxfBlock.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -36,7 +36,7 @@ public: virtual void assign(dxfFile* dxf, codeValue& cv); EntityList& getEntityList() { return _entityList; } const osg::Vec3d& getPosition() const; - + protected: EntityList _entityList; dxfEntity* _currentEntity; diff --git a/src/osgPlugins/dxf/dxfDataTypes.h b/src/osgPlugins/dxf/dxfDataTypes.h index f83ee7749..10a358e87 100644 --- a/src/osgPlugins/dxf/dxfDataTypes.h +++ b/src/osgPlugins/dxf/dxfDataTypes.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -32,12 +32,12 @@ public: inline static bool between(int a, int m, int x) { return (a >= m && a <= x); } inline static int typeForCode(int gc) { if ( between(gc, 0, 9) || - gc == 100 || gc == 102 || + gc == 100 || gc == 102 || between(gc, 300, 309) || between(gc, 410, 419) || between(gc, 430, 439) || between(gc, 470, 479) || - gc == 999 || + gc == 999 || between(gc, 1000, 1009) ) return STRING; diff --git a/src/osgPlugins/dxf/dxfEntity.cpp b/src/osgPlugins/dxf/dxfEntity.cpp index b1e40b680..926475868 100644 --- a/src/osgPlugins/dxf/dxfEntity.cpp +++ b/src/osgPlugins/dxf/dxfEntity.cpp @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -34,7 +34,7 @@ RegisterEntityProxy g_dxfLWPolyline; RegisterEntityProxy g_dxfInsert; RegisterEntityProxy g_dxfText; -void +void dxfBasicEntity::assign(dxfFile* , codeValue& cv) { switch (cv._groupCode) { @@ -70,7 +70,7 @@ dxf3DFace::assign(dxfFile* dxf, codeValue& cv) case 33: _vertices[cv._groupCode - 30].z() = d; break; - + default: dxfBasicEntity::assign(dxf, cv); break; @@ -103,7 +103,7 @@ dxfVertex::assign(dxfFile* dxf, codeValue& cv) { double d = cv._double; // 2005.12.13 pdr: learned today that negative indices mean something and were possible - + int s = cv._int; // 2005.12.13 pdr: group codes [70,78] now signed int. if ( s < 0 ) s = -s; switch (cv._groupCode) { @@ -128,7 +128,7 @@ dxfVertex::assign(dxfFile* dxf, codeValue& cv) case 74: _indice4 = s; break; - + default: dxfBasicEntity::assign(dxf, cv); break; @@ -179,25 +179,25 @@ dxfCircle::drawScene(scene* sc) double theta=5.0; // we generate polyline from "spokes" at theta degrees at arc's center if (_useAccuracy) { - // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc - // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with + // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc + // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with // one side=r-maxError, hypotenuse=r, and internal angle at center is half the angle we will step with: - double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius. + double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius. double newtheta=acos( (_radius-maxError) / _radius); - newtheta=osg::RadiansToDegrees(newtheta)*2.0; - + newtheta=osg::RadiansToDegrees(newtheta)*2.0; + // Option to only use the new accuracy code when it would improve on the accuracy of the old method if (_improveAccuracyOnly) { theta=min(newtheta,theta); } else { theta=newtheta; } - } + } theta=osg::DegreesToRadians(theta); // We create an anglestep<=theta so that the line's points are evenly distributed around the circle unsigned int numsteps=static_cast(floor(osg::PI*2/theta)); - if (numsteps<3) numsteps=3; // Sanity check: minimal representation of a circle is a tri + if (numsteps<3) numsteps=3; // Sanity check: minimal representation of a circle is a tri double anglestep=osg::PI*2/numsteps; double angle1 = 0.0; @@ -209,7 +209,7 @@ dxfCircle::drawScene(scene* sc) vlist.push_back(b); } - sc->addLineStrip(getLayer(), _color, vlist); // Should really add LineLoop implementation and save a vertex + sc->addLineStrip(getLayer(), _color, vlist); // Should really add LineLoop implementation and save a vertex sc->ocs_clear(); } @@ -273,12 +273,12 @@ dxfArc::drawScene(scene* sc) double theta=5.0; // we generate polyline from "spokes" at theta degrees at arc's center if (_useAccuracy) { - // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc - // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with + // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc + // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with // one side=r-maxError, hypotenuse=r, and internal angle at center is half the angle we will step with: - double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius. + double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius. double newtheta=acos( (_radius-maxError) / _radius); - newtheta=osg::RadiansToDegrees(newtheta)*2.0; + newtheta=osg::RadiansToDegrees(newtheta)*2.0; //cout<<"r="<<_radius<<" _me="<<_maxError<<" (_radius-_maxError)="<<(_radius-_maxError)<<" newtheta="<addTriangles(getLayer(), _color, vlist, invert_order); - } else if (_flag & 64) { + } else if (_flag & 64) { unsigned short _facetype = 3; for (unsigned int i = 0; i < _indices.size(); i++) { @@ -678,7 +678,7 @@ dxfPolyline::drawScene(scene* sc) sc->ocs_clear(); } -void +void dxfLWPolyline::assign(dxfFile* dxf, codeValue& cv) { string s = cv._string; @@ -796,10 +796,10 @@ dxfInsert::drawScene(scene* sc) // INSERTs can be nested. So pull the current matrix // and push it back after we fill our context // This is a snapshot in time. I will rewrite all this to be cleaner, - // but for now, it seems working fine + // but for now, it seems working fine // (with the files I have, the results are equal to Voloview, // and better than Deep Exploration and Lightwave). - + // sanity check (useful when no block remains after all unsupported entities have been filtered out) if (!_block) return; @@ -839,7 +839,7 @@ dxfInsert::drawScene(scene* sc) } -void +void dxfText::assign(dxfFile* dxf, codeValue& cv) { switch (cv._groupCode) { @@ -912,17 +912,17 @@ dxfText::drawScene(scene* sc) _text->setCharacterSize( _height, 1.0/_xscale ); _text->setFont("arial.ttf"); - + Quat qr( DegreesToRadians(_rotation), Z_AXIS ); - + if ( _flags & 2 ) qr = Quat( PI, Y_AXIS ) * qr; if ( _flags & 4 ) qr = Quat( PI, X_AXIS ) * qr; - + _text->setAxisAlignment(osgText::Text::USER_DEFINED_ROTATION); _text->setRotation(qr); - + if ( _hjustify != 0 || _vjustify !=0 ) _point1 = _point2; - + switch (_vjustify) { case 3: switch (_hjustify) { @@ -973,23 +973,23 @@ dxfText::drawScene(scene* sc) } break; } - + _text->setAlignment(align); - + sc->addText(getLayer(), _color, _point1, _text.get()); sc->ocs_clear(); } // static -void +void dxfEntity::registerEntity(dxfBasicEntity* entity) { _registry[entity->name()] = entity; } // static -void +void dxfEntity::unregisterEntity(dxfBasicEntity* entity) { map >::iterator itr = _registry.find(entity->name()); @@ -1006,14 +1006,14 @@ void dxfEntity::drawScene(scene* sc) } } -void +void dxfEntity::assign(dxfFile* dxf, codeValue& cv) { string s = cv._string; if (cv._groupCode == 66 && !(_entity && string("TABLE") == _entity->name())) { // The funny thing here. Group code 66 has been called 'obsoleted' // for a POLYLINE. But not for an INSERT. Moreover, a TABLE - // can have a 66 for... an obscure bottom cell color value. + // can have a 66 for... an obscure bottom cell color value. // I decided to rely on the presence of the 66 code for // the POLYLINE. If you find a better alternative, // contact me, or correct this code diff --git a/src/osgPlugins/dxf/dxfEntity.h b/src/osgPlugins/dxf/dxfEntity.h index 0f877b60c..532aa89ab 100644 --- a/src/osgPlugins/dxf/dxfEntity.h +++ b/src/osgPlugins/dxf/dxfEntity.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -50,7 +50,7 @@ getOCSMatrix(const osg::Vec3d& ocs, osg::Matrixd& m) ax.normalize(); ay = ocsaxis ^ ax; ay.normalize(); - m = osg::Matrixd( ax.x(), ax.y(), ax.z(), 0, + m = osg::Matrixd( ax.x(), ax.y(), ax.z(), 0, ay.x(), ay.y(), ay.z(), 0, ocsaxis.x(), ocsaxis.y(), ocsaxis.z(), 0, 0,0,0,1); @@ -92,7 +92,7 @@ public: dxfCircle() : _radius(0), _ocs(0,0,1) {} virtual ~dxfCircle() {} virtual dxfBasicEntity* create() { // we create a copy which uses our accuracy settings - dxfBasicEntity* circle=new dxfCircle; + dxfBasicEntity* circle=new dxfCircle; circle->setAccuracy(_useAccuracy,_maxError,_improveAccuracyOnly); return circle; } @@ -111,7 +111,7 @@ public: dxfArc() : _radius(0), _startAngle(0), _endAngle(360), _ocs(0,0,1) {} virtual ~dxfArc() {} virtual dxfBasicEntity* create() { // we create a copy which uses our accuracy settings - dxfBasicEntity* arc=new dxfArc; + dxfBasicEntity* arc=new dxfArc; arc->setAccuracy(_useAccuracy,_maxError,_improveAccuracyOnly); //std::cout<<"dxfArc::create with _useAccuracy="<<_useAccuracy<<" maxError="<<_maxError<<" improveAccuracyOnly="<<_improveAccuracyOnly< _rw; }; diff --git a/src/osgPlugins/dxf/dxfFile.cpp b/src/osgPlugins/dxf/dxfFile.cpp index dc2e1192f..61d350b6c 100644 --- a/src/osgPlugins/dxf/dxfFile.cpp +++ b/src/osgPlugins/dxf/dxfFile.cpp @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -22,12 +22,12 @@ using namespace std; -bool +bool dxfFile::parseFile() { if (_fileName == "") return false; _reader = new dxfReader; - + if (_reader->openFile(_fileName)) { codeValue cv; while(_reader->nextGroupCode(cv)) { @@ -45,8 +45,8 @@ dxfFile::parseFile() } } -osg::Group* -dxfFile::dxf2osg() +osg::Group* +dxfFile::dxf2osg() { if (!_entities) return NULL; if (!_tables) { // a dxfTable is needed to create undefined layers @@ -62,7 +62,7 @@ dxfFile::dxf2osg() return g; } -dxfBlock* +dxfBlock* dxfFile::findBlock(std::string name) { if (_blocks.get()) @@ -73,14 +73,14 @@ dxfFile::findBlock(std::string name) /// not used. if you want to know what a header variable /// contains, call this. pass the complete variable name /// including "$", for example: "$EXTMAX" -VariableList +VariableList dxfFile::getVariable(std::string var) { return _header->getVariable(var); } /// parse the dxf sections -short +short dxfFile::assign(codeValue& cv) { std::string s = cv._string; diff --git a/src/osgPlugins/dxf/dxfFile.h b/src/osgPlugins/dxf/dxfFile.h index b0ff5c4af..d9a03dff0 100644 --- a/src/osgPlugins/dxf/dxfFile.h +++ b/src/osgPlugins/dxf/dxfFile.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -26,7 +26,7 @@ class dxfFile { public: - dxfFile(std::string fileName) : + dxfFile(std::string fileName) : _fileName(fileName), _isNewSection(false) {} @@ -34,7 +34,7 @@ public: osg::Group* dxf2osg(); dxfBlock* findBlock(std::string name); VariableList getVariable(std::string var); - + protected: short assign(codeValue& cv); diff --git a/src/osgPlugins/dxf/dxfReader.cpp b/src/osgPlugins/dxf/dxfReader.cpp index 78731a094..9a8c9ceb6 100644 --- a/src/osgPlugins/dxf/dxfReader.cpp +++ b/src/osgPlugins/dxf/dxfReader.cpp @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ #include "dxfReader.h" @@ -23,7 +23,7 @@ using namespace std; -static +static std::string trim(const string& str) { @@ -36,30 +36,30 @@ trim(const string& str) /* ************** readerBase */ -bool readerBase::readGroup(std::ifstream& f, codeValue& cv) -{ +bool readerBase::readGroup(std::ifstream& f, codeValue& cv) +{ cv.reset(); if (readGroupCode(f, cv._groupCode)) { cv._type = dxfDataType::typeForCode(cv._groupCode); switch (cv._type) { - case dxfDataType::BOOL: + case dxfDataType::BOOL: return readValue(f, cv._bool); break; - case dxfDataType::SHORT: + case dxfDataType::SHORT: return readValue(f, cv._short); break; - case dxfDataType::INT: + case dxfDataType::INT: return readValue(f, cv._int); break; - case dxfDataType::LONG: + case dxfDataType::LONG: return readValue(f, cv._long); break; - case dxfDataType::DOUBLE: + case dxfDataType::DOUBLE: return readValue(f, cv._double); break; case dxfDataType::UNKNOWN: - case dxfDataType::STRING: - case dxfDataType::HEX: + case dxfDataType::STRING: + case dxfDataType::HEX: default: // to do: default case an error return readValue(f, cv._string); break; @@ -167,7 +167,7 @@ bool readerText::readValue(std::ifstream& f, double &d) */ -bool +bool dxfReader::openFile(std::string fileName) { if (fileName.size() == 0) return false; @@ -190,7 +190,7 @@ dxfReader::openFile(std::string fileName) // gossage. un mac peut mettre juste CR. ca fonctionne pas: // if (cr > 0 && (!lf || lf > cr + 1)) // _reader = new readerText('\r'); -// else +// else _reader = new readerText; _ifs.seekg(0, ios::beg); return true; diff --git a/src/osgPlugins/dxf/dxfReader.h b/src/osgPlugins/dxf/dxfReader.h index f8e3a300f..25a4cbfea 100644 --- a/src/osgPlugins/dxf/dxfReader.h +++ b/src/osgPlugins/dxf/dxfReader.h @@ -1,18 +1,18 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ -/* File handling. +/* File handling. dxfFile creates a dxfReader, which in turn create a readerText or a readerBinary - depending on file type. + depending on file type. */ #ifndef DXF_READER #define DXF_READER 1 diff --git a/src/osgPlugins/dxf/dxfSection.cpp b/src/osgPlugins/dxf/dxfSection.cpp index 15dee2628..cdda11273 100644 --- a/src/osgPlugins/dxf/dxfSection.cpp +++ b/src/osgPlugins/dxf/dxfSection.cpp @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -27,7 +27,7 @@ void dxfHeader::assign(dxfFile*, codeValue& cv) } } -void dxfTables::assign(dxfFile* dxf, codeValue& cv) +void dxfTables::assign(dxfFile* dxf, codeValue& cv) { if (cv._groupCode == 0 && cv._string == "TABLE") { _currentTable = NULL; @@ -58,7 +58,7 @@ void dxfBlocks::assign(dxfFile* dxf, codeValue& cv) } } -void dxfEntities::assign(dxfFile* dxf, codeValue& cv) +void dxfEntities::assign(dxfFile* dxf, codeValue& cv) { if (cv._groupCode == 0) { if (_currentEntity && _currentEntity->done()) { @@ -75,13 +75,13 @@ void dxfEntities::assign(dxfFile* dxf, codeValue& cv) } } -void +void dxfEntities::drawScene(scene* sc) { for (EntityList::iterator itr = _entityList.begin(); itr != _entityList.end(); ++itr) (*itr)->drawScene(sc); } -dxfBlock* +dxfBlock* dxfBlocks::findBlock(std::string s) { return _blockNameList[s]; } diff --git a/src/osgPlugins/dxf/dxfSection.h b/src/osgPlugins/dxf/dxfSection.h index 155659a7f..651887e2b 100644 --- a/src/osgPlugins/dxf/dxfSection.h +++ b/src/osgPlugins/dxf/dxfSection.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -62,11 +62,11 @@ public: dxfTables() : _inLayerTable(false) {} virtual ~dxfTables() {} virtual void assign(dxfFile* dxf, codeValue& cv); - dxfLayerTable* getOrCreateLayerTable() - { + dxfLayerTable* getOrCreateLayerTable() + { if (!_layerTable.get()) _layerTable = new dxfLayerTable; - return _layerTable.get(); + return _layerTable.get(); } protected: diff --git a/src/osgPlugins/dxf/dxfSectionBase.h b/src/osgPlugins/dxf/dxfSectionBase.h index c0c2784d3..225a4a459 100644 --- a/src/osgPlugins/dxf/dxfSectionBase.h +++ b/src/osgPlugins/dxf/dxfSectionBase.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ diff --git a/src/osgPlugins/dxf/dxfTable.cpp b/src/osgPlugins/dxf/dxfTable.cpp index 1b20ed7da..3055c1f4f 100644 --- a/src/osgPlugins/dxf/dxfTable.cpp +++ b/src/osgPlugins/dxf/dxfTable.cpp @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ #include "dxfTable.h" @@ -14,7 +14,7 @@ #include "codeValue.h" -void dxfLayer::assign(dxfFile*, codeValue& cv) +void dxfLayer::assign(dxfFile*, codeValue& cv) { switch (cv._groupCode) { case 2: @@ -30,7 +30,7 @@ void dxfLayer::assign(dxfFile*, codeValue& cv) } } -void dxfLayerTable::assign(dxfFile* dxf, codeValue& cv) +void dxfLayerTable::assign(dxfFile* dxf, codeValue& cv) { std::string s = cv._string; if (cv._groupCode == 0 ) { diff --git a/src/osgPlugins/dxf/dxfTable.h b/src/osgPlugins/dxf/dxfTable.h index ce3e03f63..152948ba6 100644 --- a/src/osgPlugins/dxf/dxfTable.h +++ b/src/osgPlugins/dxf/dxfTable.h @@ -1,12 +1,12 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ @@ -56,8 +56,8 @@ public: virtual ~dxfLayerTable() {} virtual void assign(dxfFile* dxf, codeValue& cv); - dxfLayer* findOrCreateLayer(std::string name) - { + dxfLayer* findOrCreateLayer(std::string name) + { if (name == "") name = "0"; // nowhere it is said "" is invalid, but... dxfLayer* layer = _layers[name].get(); if (!layer) { diff --git a/src/osgPlugins/dxf/scene.cpp b/src/osgPlugins/dxf/scene.cpp index ce6798830..382c98595 100644 --- a/src/osgPlugins/dxf/scene.cpp +++ b/src/osgPlugins/dxf/scene.cpp @@ -10,7 +10,7 @@ using namespace osg; using namespace std; -osg::Vec4 +osg::Vec4 sceneLayer::getColor(unsigned short color) { // you're supposed to have a correct color in hand @@ -23,18 +23,18 @@ sceneLayer::getColor(unsigned short color) scene::scene(dxfLayerTable* lt) : _layerTable(lt) -{ - _m.makeIdentity(); - _r.makeIdentity(); +{ + _m.makeIdentity(); + _r.makeIdentity(); } -void +void scene::setLayerTable(dxfLayerTable* lt) -{ - _layerTable = lt; +{ + _layerTable = lt; } -Vec3d scene::addVertex(Vec3d v) +Vec3d scene::addVertex(Vec3d v) { v += _t; v = preMultd(_r, v); @@ -45,23 +45,23 @@ Vec3d scene::addVertex(Vec3d v) return a; } -Vec3d scene::addNormal(Vec3d v) +Vec3d scene::addNormal(Vec3d v) { // to do: vertices are not always listed in order. find why. return v; } -void -scene::addPoint(const std::string & l, unsigned short color, Vec3d & s) +void +scene::addPoint(const std::string & l, unsigned short color, Vec3d & s) { dxfLayer* layer = _layerTable->findOrCreateLayer(l); if (layer->getFrozen()) return; sceneLayer* ly = findOrCreateSceneLayer(l); Vec3d a(addVertex(s)); - ly->_points[correctedColorIndex(l, color)].push_back(a); + ly->_points[correctedColorIndex(l, color)].push_back(a); } -void -scene::addLine(const std::string & l, unsigned short color, Vec3d & s, Vec3d & e) +void +scene::addLine(const std::string & l, unsigned short color, Vec3d & s, Vec3d & e) { dxfLayer* layer = _layerTable->findOrCreateLayer(l); if (layer->getFrozen()) return; @@ -70,7 +70,7 @@ scene::addLine(const std::string & l, unsigned short color, Vec3d & s, Vec3d & e ly->_lines[correctedColorIndex(l, color)].push_back(a); ly->_lines[correctedColorIndex(l, color)].push_back(b); } -void scene::addLineStrip(const std::string & l, unsigned short color, std::vector & vertices) +void scene::addLineStrip(const std::string & l, unsigned short color, std::vector & vertices) { dxfLayer* layer = _layerTable->findOrCreateLayer(l); if (layer->getFrozen()) return; @@ -82,7 +82,7 @@ void scene::addLineStrip(const std::string & l, unsigned short color, std::vecto } ly->_linestrips[correctedColorIndex(l, color)].push_back(converted); } -void scene::addLineLoop(const std::string & l, unsigned short color, std::vector & vertices) +void scene::addLineLoop(const std::string & l, unsigned short color, std::vector & vertices) { dxfLayer* layer = _layerTable->findOrCreateLayer(l); if (layer->getFrozen()) return; @@ -97,7 +97,7 @@ void scene::addLineLoop(const std::string & l, unsigned short color, std::vector } -void scene::addTriangles(const std::string & l, unsigned short color, std::vector & vertices, bool inverted) +void scene::addTriangles(const std::string & l, unsigned short color, std::vector & vertices, bool inverted) { dxfLayer* layer = _layerTable->findOrCreateLayer(l); if (layer->getFrozen()) return; @@ -115,7 +115,7 @@ void scene::addTriangles(const std::string & l, unsigned short color, std::vecto a = itr++; b = itr++; c = itr++; - } + } if (a != vertices.end() && b != vertices.end() && c != vertices.end()) { @@ -128,11 +128,11 @@ void scene::addTriangles(const std::string & l, unsigned short color, std::vecto } } } -void scene::addQuads(const std::string & l, unsigned short color, std::vector & vertices, bool inverted) +void scene::addQuads(const std::string & l, unsigned short color, std::vector & vertices, bool inverted) { dxfLayer* layer = _layerTable->findOrCreateLayer(l); if (layer->getFrozen()) return; - + sceneLayer* ly = findOrCreateSceneLayer(l); for (VList::iterator itr = vertices.begin(); itr != vertices.end(); ) { @@ -172,10 +172,10 @@ void scene::addQuads(const std::string & l, unsigned short color, std::vectorfindOrCreateLayer(l); if (layer->getFrozen()) return; @@ -193,13 +193,13 @@ void scene::addText(const std::string & l, unsigned short color, Vec3d & point, Quat ro, so; qm.decompose( t, ro, s, so ); text->setRotation( text->getRotation() * ro ); - + sceneLayer::textInfo ti( correctedColorIndex(l,color), pscene, text ); ly->_textList.push_back(ti); } -unsigned short +unsigned short scene::correctedColorIndex(const std::string & l, unsigned short color) { if (color >= aci::MIN && color <= aci::MAX) diff --git a/src/osgPlugins/dxf/scene.h b/src/osgPlugins/dxf/scene.h index ebb08a63c..84b1b1a42 100644 --- a/src/osgPlugins/dxf/scene.h +++ b/src/osgPlugins/dxf/scene.h @@ -1,18 +1,18 @@ /* dxfReader for OpenSceneGraph Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) * Programmed by Paul de Repentigny - * + * * OpenSceneGraph is (C) 2004 Robert Osfield - * + * * This library is provided as-is, without support of any kind. * * Read DXF docs or OSG docs for any related questions. - * + * * You may contact the author if you have suggestions/corrections/enhancements. */ /** Simulate the scene with double precision before passing it back to osg. - this permits us to scale down offsets from 0,0,0 with a few matrixtransforms, + this permits us to scale down offsets from 0,0,0 with a few matrixtransforms, in case the objects are too far from that center. */ @@ -45,7 +45,7 @@ public: } inline void makeMinValid() { // we count on _min to offset the whole scene - // so, we make sure its at 0,0,0 if + // so, we make sure its at 0,0,0 if // bounds are not set (anyway, the scene should be empty, // if we need to set any value of _min to 0). if (_min.x() == DBL_MAX) _min.x() = 0; @@ -57,12 +57,12 @@ public: }; -static inline +static inline osg::Geometry* createPtGeometry( osg::PrimitiveSet::Mode pointType, osg::Vec3Array* vertices, const osg::Vec4 & color) { osg::Geometry* geom = new osg::Geometry; geom->setVertexArray(vertices); - geom->addPrimitiveSet(new osg::DrawArrays(pointType, 0, vertices->size())); + geom->addPrimitiveSet(new osg::DrawArrays(pointType, 0, vertices->size())); osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(color); geom->setColorArray(colors); @@ -74,12 +74,12 @@ osg::Geometry* createPtGeometry( osg::PrimitiveSet::Mode pointType, osg::Vec3Arr return geom; } -static inline +static inline osg::Geometry* createLnGeometry( osg::PrimitiveSet::Mode lineType, osg::Vec3Array* vertices, const osg::Vec4 & color) { osg::Geometry* geom = new osg::Geometry; geom->setVertexArray(vertices); - geom->addPrimitiveSet(new osg::DrawArrays(lineType, 0, vertices->size())); + geom->addPrimitiveSet(new osg::DrawArrays(lineType, 0, vertices->size())); osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(color); geom->setColorArray(colors); @@ -91,12 +91,12 @@ osg::Geometry* createLnGeometry( osg::PrimitiveSet::Mode lineType, osg::Vec3Arra return geom; } -static inline +static inline osg::Geometry* createTriGeometry( osg::Vec3Array* vertices, osg::Vec3Array* normals, const osg::Vec4 & color) { osg::Geometry* geom = new osg::Geometry; geom->setVertexArray(vertices); - geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, vertices->size())); + geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, vertices->size())); osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(color); geom->setColorArray(colors); @@ -106,12 +106,12 @@ osg::Geometry* createTriGeometry( osg::Vec3Array* vertices, osg::Vec3Array* norm return geom; } -static inline +static inline osg::Geometry* createQuadGeometry( osg::Vec3Array* vertices, osg::Vec3Array* normals, const osg::Vec4 & color) { osg::Geometry* geom = new osg::Geometry; geom->setVertexArray(vertices); - geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, vertices->size())); + geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, vertices->size())); osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(color); geom->setColorArray(colors); @@ -121,7 +121,7 @@ osg::Geometry* createQuadGeometry( osg::Vec3Array* vertices, osg::Vec3Array* nor return geom; } -static inline +static inline osg::Geode* createModel(const std::string & name, osg::Drawable* drawable) { osg::Geode* geode = new osg::Geode; @@ -172,7 +172,7 @@ public: MapVList _trinorms; MapVList _quads; MapVList _quadnorms; - + struct textInfo { textInfo(short int color, osg::Vec3 point, osgText::Text *text) : @@ -182,9 +182,9 @@ public: osg::ref_ptr _text; }; - typedef std::vector TextList; + typedef std::vector TextList; TextList _textList; - + protected: std::string _name; @@ -192,7 +192,7 @@ protected: void osgPoints(osg::Group* root, bounds &b) { - + for (MapVList::iterator mitr = _points.begin(); mitr != _points.end(); ++mitr) { osg::Vec3Array *coords = new osg::Vec3Array; @@ -212,7 +212,7 @@ protected: ++mlitr) { for(VListList::iterator itr = mlitr->second.begin(); - itr != mlitr->second.end(); + itr != mlitr->second.end(); ++itr) { if (itr->size()) { diff --git a/src/osgPlugins/exr/ReaderWriterEXR.cpp b/src/osgPlugins/exr/ReaderWriterEXR.cpp index 4e2f96018..247923a1a 100644 --- a/src/osgPlugins/exr/ReaderWriterEXR.cpp +++ b/src/osgPlugins/exr/ReaderWriterEXR.cpp @@ -5,7 +5,7 @@ #include #if defined _WIN32 && !defined OSG_LIBRARY_STATIC -//Make the half format work against openEXR libs +//Make the half format work against openEXR libs #define OPENEXR_DLL #endif @@ -93,9 +93,9 @@ unsigned char *exr_load(std::istream& fin, bool inputError = false; Array2D pixels; int width,height,numComponents; - + try - { + { C_IStream inStream(&fin); RgbaInputFile rgbafile(inStream); @@ -107,7 +107,7 @@ unsigned char *exr_load(std::istream& fin, pixels.resizeErase (height, width); - rgbafile.setFrameBuffer((&pixels)[0][0] - dw.min.x - dw.min.y * width, 1, width); + rgbafile.setFrameBuffer((&pixels)[0][0] - dw.min.x - dw.min.y * width, 1, width); rgbafile.readPixels(dw.min.y, dw.max.y); } catch( char * str ) { @@ -119,7 +119,7 @@ unsigned char *exr_load(std::istream& fin, { return buffer; } - + //If there is no information in alpha channel do not store the alpha channel numComponents = 3; for (long i = height-1; i >= 0; i--) @@ -140,13 +140,13 @@ unsigned char *exr_load(std::istream& fin, { return NULL; } - + //Copy and allocate data to a unsigned char array that OSG can use for texturing unsigned dataSize = (sizeof(half) * height * width * numComponents); //buffer = new unsigned char[dataSize]; buffer = (unsigned char*)malloc(dataSize); half* pOut = (half*) buffer; - + for (long i = height-1; i >= 0; i--) { for (long j = 0 ; j < width; j++) @@ -177,9 +177,9 @@ public: } virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"exr"); } - + virtual const char* className() const { return "EXR Image Reader"; } - + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const { return readImage(fin, options); @@ -205,15 +205,15 @@ public: osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); if(!istream) return ReadResult::FILE_NOT_HANDLED; - + ReadResult rr = readEXRStream(istream); - if(rr.validImage()) + if(rr.validImage()) { rr.getImage()->setFileName(fileName); } return rr; } - + virtual WriteResult writeImage(const osg::Image& image,std::ostream& fout,const Options*) const { bool success = writeEXRStream(image, fout, ""); @@ -233,7 +233,7 @@ public: if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; bool success = writeEXRStream(img, fout, fileName); - + fout.close(); if(success) @@ -275,7 +275,7 @@ protected: Array2D outPixels(height,width); //If texture is half format if (dataType == GL_HALF_FLOAT_ARB) - { + { for (long i = height-1; i >= 0; i--) { half* pOut = (half*) img.data(0,i); @@ -317,14 +317,14 @@ protected: else {outPixels[i][j].a = 1.0f;} } - } - } + } + } else { //If texture format not supported return false; } - + try { //Write to stream diff --git a/src/osgPlugins/fbx/WriterCompareTriangle.cpp b/src/osgPlugins/fbx/WriterCompareTriangle.cpp index f6f8939dd..d7cb3f0cb 100644 --- a/src/osgPlugins/fbx/WriterCompareTriangle.cpp +++ b/src/osgPlugins/fbx/WriterCompareTriangle.cpp @@ -1,14 +1,14 @@ #include "WriterCompareTriangle.h" WriterCompareTriangle::WriterCompareTriangle(const osg::Geode& geode, - unsigned int nbVertices) - : geode(geode) -{ + unsigned int nbVertices) + : geode(geode) +{ cutscene(nbVertices, geode.getDrawable(0)->asGeometry()->getBound()); } -bool -WriterCompareTriangle::operator()(const std::pair& t1, +bool +WriterCompareTriangle::operator()(const std::pair& t1, const std::pair& t2) const { const osg::Geometry* g = geode.getDrawable( t1.second )->asGeometry(); @@ -35,7 +35,7 @@ WriterCompareTriangle::operator()(const std::pair& t1, void WriterCompareTriangle::setMaxMin(unsigned int& nbVerticesX, unsigned int& nbVerticesY, - unsigned int& nbVerticesZ) const + unsigned int& nbVerticesZ) const { static const unsigned int min = 1; if (nbVerticesX < min) @@ -115,7 +115,7 @@ WriterCompareTriangle::cutscene(int nbVertices, boxList.push_back(osg::BoundingBox(xMin, // Add a box to the list yMin, zMin, - xMax, + xMax, yMax, zMax)); y += yinc; @@ -129,14 +129,14 @@ WriterCompareTriangle::cutscene(int nbVertices, } } -int -WriterCompareTriangle::inWhichBox(const osg::Vec3::value_type x, +int +WriterCompareTriangle::inWhichBox(const osg::Vec3::value_type x, const osg::Vec3::value_type y, const osg::Vec3::value_type z) const { for (unsigned int i = 0; i < boxList.size(); ++i) { - if (x >= boxList[i].xMin() && + if (x >= boxList[i].xMin() && x < boxList[i].xMax() && y >= boxList[i].yMin() && y < boxList[i].yMax() && diff --git a/src/osgPlugins/fbx/WriterCompareTriangle.h b/src/osgPlugins/fbx/WriterCompareTriangle.h index eb42e24e4..96b4a101a 100644 --- a/src/osgPlugins/fbx/WriterCompareTriangle.h +++ b/src/osgPlugins/fbx/WriterCompareTriangle.h @@ -18,7 +18,7 @@ public: WriterCompareTriangle(const osg::Geode& geode, unsigned int nbVertices); - bool operator()(const std::pair& t1, + bool operator()(const std::pair& t1, const std::pair& t2) const; private: void // This function prevents the scene being cut into too many boxes @@ -35,12 +35,12 @@ private: cutscene(int nbVertices, const osg::BoundingBox& sceneBox); - /** + /** * Find in which box those points are. * \return the place of the box in the vector. * \sa See cutScene() about the definition of the boxes for faces sorting. */ - int inWhichBox(const osg::Vec3::value_type x, + int inWhichBox(const osg::Vec3::value_type x, const osg::Vec3::value_type y, const osg::Vec3::value_type z) const; diff --git a/src/osgPlugins/fbx/WriterNodeVisitor.cpp b/src/osgPlugins/fbx/WriterNodeVisitor.cpp index 904431e0a..ad5cfb1de 100644 --- a/src/osgPlugins/fbx/WriterNodeVisitor.cpp +++ b/src/osgPlugins/fbx/WriterNodeVisitor.cpp @@ -538,7 +538,7 @@ WriterNodeVisitor::setControlPointAndNormalsAndUV(const osg::Geode& geo, //case osg::Geometry::BIND_PER_PRIMITIVE: //case osg::Geometry::BIND_PER_VERTEX: // break; - //} + //} lLayerElementNormal->GetDirectArray().SetAt(it->second, normal); } @@ -638,7 +638,7 @@ void WriterNodeVisitor::createListTriangle(const osg::Geometry* geo, if (nbVertices==0) return; - int material = processStateSet(_currentStateSet.get()); + int material = processStateSet(_currentStateSet.get()); PrimitiveIndexWriter pif(geo, listTriangles, drawable_n, material); for (unsigned int iPrimSet = 0; iPrimSet < geo->getNumPrimitiveSets(); ++iPrimSet) //Fill the Triangle List diff --git a/src/osgPlugins/fbx/WriterNodeVisitor.h b/src/osgPlugins/fbx/WriterNodeVisitor.h index a1e8246b4..343756959 100644 --- a/src/osgPlugins/fbx/WriterNodeVisitor.h +++ b/src/osgPlugins/fbx/WriterNodeVisitor.h @@ -208,7 +208,7 @@ class WriterNodeVisitor: public osg::NodeVisitor /// Set Vertices, normals, and UVs void setControlPointAndNormalsAndUV(const osg::Geode& geo, MapIndices& index_vert, - bool texcoords, + bool texcoords, KFbxMesh* fbxMesh); /** @@ -228,7 +228,7 @@ class WriterNodeVisitor: public osg::NodeVisitor typedef std::stack > StateSetStack; typedef std::map, Material, CompareStateSet> MaterialMap; - + ///We need this for every new Node we create. KFbxSdkManager* _pSdkManager; diff --git a/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp b/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp index c8569aa66..8aa832346 100644 --- a/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp +++ b/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp @@ -20,7 +20,7 @@ FbxMaterialToOsgStateSet::convert(const KFbxSurfaceMaterial* pFbxMat) osg::ref_ptr pOsgMat = new osg::Material; pOsgMat->setName(pFbxMat->GetName()); - + StateSetContent result; result.material = pOsgMat; diff --git a/src/osgPlugins/fbx/fbxRAnimation.cpp b/src/osgPlugins/fbx/fbxRAnimation.cpp index ceb1d2b10..869ebd87d 100644 --- a/src/osgPlugins/fbx/fbxRAnimation.cpp +++ b/src/osgPlugins/fbx/fbxRAnimation.cpp @@ -39,7 +39,7 @@ void readKeys(KFbxAnimCurve* curveX, KFbxAnimCurve* curveY, KFbxAnimCurve* curve for (int nCurve = 0; nCurve < 3; ++nCurve) { KFbxAnimCurve* pCurve = curves[nCurve]; - + int nKeys = pCurve ? pCurve->KeyGetCount() : 0; if (!nKeys) diff --git a/src/osgPlugins/fbx/fbxRMesh.cpp b/src/osgPlugins/fbx/fbxRMesh.cpp index 1efd6f6bf..98f64692f 100644 --- a/src/osgPlugins/fbx/fbxRMesh.cpp +++ b/src/osgPlugins/fbx/fbxRMesh.cpp @@ -148,14 +148,14 @@ osg::Array* createVec4Array(bool doublePrecision) osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap, std::vector& stateSetList, - GeometryType gt, - unsigned int mti, - bool bNormal, + GeometryType gt, + unsigned int mti, + bool bNormal, bool useDiffuseMap, bool useOpacityMap, bool useEmissiveMap, // more here... - bool bColor, + bool bColor, const osgDB::Options& options, bool lightmapTextures) { @@ -224,7 +224,7 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap, if (lightmapTextures) { double factor = ssc.diffuseFactor; - osg::ref_ptr texenv = new osg::TexEnvCombine(); + osg::ref_ptr texenv = new osg::TexEnvCombine(); texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE); texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE); texenv->setSource1_RGB(osg::TexEnvCombine::PREVIOUS); @@ -254,7 +254,7 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap, } // setup combiner to ignore RGB... - osg::ref_ptr texenv = new osg::TexEnvCombine(); + osg::ref_ptr texenv = new osg::TexEnvCombine(); texenv->setCombine_RGB(osg::TexEnvCombine::REPLACE); texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS); stateSet->setTextureAttributeAndModes(StateSetContent::OPACITY_TEXTURE_UNIT, texenv.get(), osg::StateAttribute::ON); @@ -276,7 +276,7 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap, // setup combiner for factor... double factor = ssc.reflectionFactor; - osg::ref_ptr texenv = new osg::TexEnvCombine(); + osg::ref_ptr texenv = new osg::TexEnvCombine(); texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE); texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE); texenv->setSource1_RGB(osg::TexEnvCombine::PREVIOUS); @@ -517,7 +517,7 @@ const KFbxLayerElementUV* getUVElementForChannel(std::string uvChannelName, { return uv; } - } + } return 0; } @@ -746,7 +746,7 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh( osg::Geometry* pGeometry = getGeometry(pGeode, geometryMap, stateSetList, geomType, materialIndex, - pFbxNormals != 0, + pFbxNormals != 0, pFbxUVs_diffuse != 0, pFbxUVs_opacity != 0, pFbxUVs_emissive != 0, diff --git a/src/osgPlugins/ffmpeg/FFmpegAudioStream.cpp b/src/osgPlugins/ffmpeg/FFmpegAudioStream.cpp index 7c34655ee..d77e80159 100644 --- a/src/osgPlugins/ffmpeg/FFmpegAudioStream.cpp +++ b/src/osgPlugins/ffmpeg/FFmpegAudioStream.cpp @@ -34,41 +34,41 @@ FFmpegAudioStream::~FFmpegAudioStream() } void FFmpegAudioStream::setAudioSink(osg::AudioSink* audio_sink) -{ +{ OSG_NOTICE<<"FFmpegAudioStream::setAudioSink( "<audio_decoder().setAudioSink(audio_sink); + m_decoder->audio_decoder().setAudioSink(audio_sink); } void FFmpegAudioStream::consumeAudioBuffer(void * const buffer, const size_t size) -{ +{ m_decoder->audio_decoder().fillBuffer(buffer, size); } double FFmpegAudioStream::duration() const -{ - return m_decoder->duration(); +{ + return m_decoder->duration(); } -int FFmpegAudioStream::audioFrequency() const -{ - return m_decoder->audio_decoder().frequency(); +int FFmpegAudioStream::audioFrequency() const +{ + return m_decoder->audio_decoder().frequency(); } -int FFmpegAudioStream::audioNbChannels() const -{ +int FFmpegAudioStream::audioNbChannels() const +{ return m_decoder->audio_decoder().nbChannels(); } -osg::AudioStream::SampleFormat FFmpegAudioStream::audioSampleFormat() const -{ - return m_decoder->audio_decoder().sampleFormat(); +osg::AudioStream::SampleFormat FFmpegAudioStream::audioSampleFormat() const +{ + return m_decoder->audio_decoder().sampleFormat(); } diff --git a/src/osgPlugins/ffmpeg/FFmpegClocks.cpp b/src/osgPlugins/ffmpeg/FFmpegClocks.cpp index 9a6d2cf2d..d16f092c4 100644 --- a/src/osgPlugins/ffmpeg/FFmpegClocks.cpp +++ b/src/osgPlugins/ffmpeg/FFmpegClocks.cpp @@ -60,7 +60,7 @@ void FFmpegClocks::reset(const double start_time) m_pause_time = 0; m_seek_time = 0; - + m_audio_buffer_end_pts = start_time; m_audio_timer.setStartTick(); } @@ -84,7 +84,7 @@ void FFmpegClocks::rewind() m_pause_time = 0; m_seek_time = 0; - + m_audio_buffer_end_pts = m_start_time; m_audio_timer.setStartTick(); @@ -94,13 +94,13 @@ void FFmpegClocks::rewind() if (m_audio_disabled) return; - m_video_clock = m_start_time; + m_video_clock = m_start_time; } void FFmpegClocks::seek(double seek_time) { ScopedLock lock(m_mutex); - + m_video_clock = seek_time; m_last_frame_delay = 0.040; m_frame_time = seek_time; @@ -183,13 +183,13 @@ double FFmpegClocks::videoRefreshSchedule(const double pts) // If incorrect delay, use previous one - + if (delay <= 0.0 || delay >= 1.0) { delay = m_last_frame_delay; if(!m_audio_disabled) m_frame_time = pts - delay; } - + // Save for next time m_last_frame_delay = delay; @@ -249,8 +249,8 @@ double FFmpegClocks::getCurrentTime() { if(!m_paused) m_last_current_time = getAudioTime(); - - return m_last_current_time; + + return m_last_current_time; } } // namespace osgFFmpeg diff --git a/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp b/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp index 1aa45fc5a..5c6ec2c81 100644 --- a/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp +++ b/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp @@ -61,7 +61,7 @@ bool FFmpegDecoder::open(const std::string & filename, FFmpegParameters* paramet if (filename.compare(0, 5, "/dev/")==0) { avdevice_register_all(); - + OSG_NOTICE<<"Attempting to stream "<sample_rate; m_nb_channels = m_context->channels; - switch (m_context->sample_fmt) + switch (m_context->sample_fmt) { case AV_SAMPLE_FMT_NONE: throw std::runtime_error("invalid audio format AV_SAMPLE_FMT_NONE"); @@ -231,7 +231,7 @@ void FFmpegDecoderAudio::fillBuffer(void * const buffer, size_t size) void FFmpegDecoderAudio::decodeLoop() { const bool skip_audio = ! validContext() || ! m_audio_sink.valid(); - + if (! skip_audio && ! m_audio_sink->playing()) { m_clocks.audioSetDelay(m_audio_sink->getDelay()); @@ -339,7 +339,7 @@ size_t FFmpegDecoderAudio::decodeFrame(void * const buffer, const size_t size) // If we have some data, return it and come back for more later. if (data_size > 0) - return data_size; + return data_size; } // Get next packet diff --git a/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp b/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp index c6f21180b..53881c138 100644 --- a/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp +++ b/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp @@ -276,10 +276,10 @@ int FFmpegDecoderVideo::convert(AVPicture *dst, int dst_pix_fmt, AVPicture *src, src_width, src_height, (PixelFormat) dst_pix_fmt, /*SWS_BILINEAR*/ SWS_BICUBIC, NULL, NULL, NULL); } - + OSG_INFO<<"Using sws_scale "; - + int result = sws_scale(m_swscale_ctx, (src->data), (src->linesize), 0, src_height, (dst->data), (dst->linesize)); diff --git a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp index 915907b66..26c2ad4d9 100644 --- a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp +++ b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp @@ -43,7 +43,7 @@ FFmpegImageStream::~FFmpegImageStream() OSG_INFO<<"Destructing FFmpegImageStream..."<duration(); +{ + return m_decoder->duration(); } @@ -187,15 +187,15 @@ double FFmpegImageStream::getCurrentTime() const double FFmpegImageStream::getFrameRate() const -{ - return m_decoder->video_decoder().frameRate(); +{ + return m_decoder->video_decoder().frameRate(); } -bool FFmpegImageStream::isImageTranslucent() const -{ - return m_decoder->video_decoder().alphaChannel(); +bool FFmpegImageStream::isImageTranslucent() const +{ + return m_decoder->video_decoder().alphaChannel(); } @@ -236,7 +236,7 @@ void FFmpegImageStream::run() { OSG_WARN << "FFmpegImageStream::run : unhandled exception" << std::endl; } - + OSG_NOTICE<<"Finished FFmpegImageStream::run()"<rewind(); } -void FFmpegImageStream::cmdSeek(double time) +void FFmpegImageStream::cmdSeek(double time) { m_decoder->seek(time); } diff --git a/src/osgPlugins/ffmpeg/FFmpegParameters.cpp b/src/osgPlugins/ffmpeg/FFmpegParameters.cpp index db1736bf3..57f912024 100644 --- a/src/osgPlugins/ffmpeg/FFmpegParameters.cpp +++ b/src/osgPlugins/ffmpeg/FFmpegParameters.cpp @@ -21,7 +21,7 @@ extern "C" { #include } - + inline PixelFormat osg_av_get_pix_fmt(const char *name) { return av_get_pix_fmt(name); } #else diff --git a/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp b/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp index 31a721638..ba20b83b8 100644 --- a/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp +++ b/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -55,7 +55,7 @@ public: supportsExtension("3gp", "3G multi-media format"); supportsExtension("sdp", "Session Description Protocol"); supportsExtension("m2ts", "MPEG-2 Transport Stream"); - + supportsOption("format", "Force setting input format (e.g. vfwcap for Windows webcam)"); supportsOption("pixel_format", "Set pixel format"); supportsOption("frame_size", "Set frame size (e.g. 320x240)"); @@ -108,7 +108,7 @@ public: return readImageStream(path, parameters.get()); } - + ReadResult readImageStream(const std::string& filename, osgFFmpeg::FFmpegParameters* parameters) const { OSG_INFO << "ReaderWriterFFmpeg::readImage " << filename << std::endl; @@ -122,7 +122,7 @@ public: } private: - + void parseOptions(osgFFmpeg::FFmpegParameters* parameters, const osgDB::ReaderWriter::Options * options) const { if (options && options->getNumPluginStringData()>0) diff --git a/src/osgPlugins/freetype/FreeTypeFont.cpp b/src/osgPlugins/freetype/FreeTypeFont.cpp index 44d8f362d..a6dcd7a80 100644 --- a/src/osgPlugins/freetype/FreeTypeFont.cpp +++ b/src/osgPlugins/freetype/FreeTypeFont.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -230,7 +230,7 @@ FreeTypeFont::~FreeTypeFont() // remove myself from the local registry to ensure that // not dangling pointers remain freeTypeLibrary->removeFontImplmentation(this); - + // free the freetype font face itself FT_Done_Face(_face); _face = 0; @@ -271,7 +271,7 @@ void FreeTypeFont::setFontResolution(const osgText::FontResolution& fontSize) (unsigned int)(width+2*margin) > _facade->getTextureHeightHint()) { OSG_WARN<<"Warning: FreeTypeFont::setSize("<getTextureWidthHint()-2*margin; height = _facade->getTextureHeightHint()-2*margin; @@ -302,9 +302,9 @@ osgText::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& fontRes, u float coord_scale = getCoordScale(); // - // GT: fix for symbol fonts (i.e. the Webdings font) as the wrong character are being - // returned, for symbol fonts in windows (FT_ENCONDING_MS_SYMBOL in freetype) the correct - // values are from 0xF000 to 0xF0FF not from 0x000 to 0x00FF (0 to 255) as you would expect. + // GT: fix for symbol fonts (i.e. the Webdings font) as the wrong character are being + // returned, for symbol fonts in windows (FT_ENCONDING_MS_SYMBOL in freetype) the correct + // values are from 0xF000 to 0xF0FF not from 0x000 to 0x00FF (0 to 255) as you would expect. // Microsoft uses a private field for its symbol fonts // unsigned int charindex = charcode; @@ -331,15 +331,15 @@ osgText::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& fontRes, u unsigned int sourceWidth = glyphslot->bitmap.width;; unsigned int sourceHeight = glyphslot->bitmap.rows; - + unsigned int width = sourceWidth; unsigned int height = sourceHeight; osg::ref_ptr glyph = new osgText::Glyph(_facade, charcode); - + unsigned int dataSize = width*height; unsigned char* data = new unsigned char[dataSize]; - + // clear the image to zeros. for(unsigned char* p=data;psetInternalTextureFormat(GL_ALPHA); - // copy image across to osgText::Glyph image. + // copy image across to osgText::Glyph image. switch(glyphslot->bitmap.pixel_mode) { case FT_PIXEL_MODE_MONO: @@ -367,7 +367,7 @@ osgText::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& fontRes, u } break; - + case FT_PIXEL_MODE_GRAY: for(int r=sourceHeight-1;r>=0;--r) { @@ -378,7 +378,7 @@ osgText::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& fontRes, u } } break; - + default: OSG_WARN << "FT_Load_Char(...) returned bitmap with unknown pixel_mode " << glyphslot->bitmap.pixel_mode << std::endl; } @@ -404,7 +404,7 @@ osgText::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& fontRes, u OSG_NOTICE<<" coord_scale = "<units_per_EM = "<<_face->units_per_EM<<", scale="<<1.0f/float(_face->units_per_EM)<setImplementation(0); else fontImplementation->_facade = 0; } - + FT_Done_FreeType( _ftlibrary); } @@ -75,7 +75,7 @@ bool FreeTypeLibrary::getFace(const std::string& fontfile,unsigned int index, FT OSG_WARN<<" .... be opened, read or simply that it is broken.."< lock(getMutex()); - + FreeTypeFont* fontImp = new FreeTypeFont(fontfile,face,flags); osgText::Font* font = new osgText::Font(fontImp); _fontImplementationSet.insert(fontImp); - + return font; } osgText::Font* FreeTypeLibrary::getFont(std::istream& fontstream, unsigned int index, unsigned int flags) @@ -170,12 +170,12 @@ osgText::Font* FreeTypeLibrary::getFont(std::istream& fontstream, unsigned int i FT_Byte * buffer = getFace(fontstream, index, face); if (face == 0) return (0); - + OpenThreads::ScopedLock lock(getMutex()); FreeTypeFont* fontImp = new FreeTypeFont(buffer,face,flags); osgText::Font* font = new osgText::Font(fontImp); - + _fontImplementationSet.insert(fontImp); return font; @@ -184,20 +184,20 @@ osgText::Font* FreeTypeLibrary::getFont(std::istream& fontstream, unsigned int i void FreeTypeLibrary::verifyCharacterMap(FT_Face face) { // - // GT: Verify the correct character mapping for MS windows + // GT: Verify the correct character mapping for MS windows // as symbol fonts were being returned incorrectly // FT_CharMap charmap; if (face->charmap == NULL) { - for (int n = 0; n < face->num_charmaps; n++) - { - charmap = face->charmaps[n]; - if (charmap->platform_id == TT_PLATFORM_MICROSOFT) - { + for (int n = 0; n < face->num_charmaps; n++) + { + charmap = face->charmaps[n]; + if (charmap->platform_id == TT_PLATFORM_MICROSOFT) + { FT_Set_Charmap(face, charmap); - break; - } + break; + } } } } diff --git a/src/osgPlugins/freetype/FreeTypeLibrary.h b/src/osgPlugins/freetype/FreeTypeLibrary.h index 58ac6fc08..2fa796b7c 100644 --- a/src/osgPlugins/freetype/FreeTypeLibrary.h +++ b/src/osgPlugins/freetype/FreeTypeLibrary.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -38,7 +38,7 @@ public: osgText::Font* getFont(const std::string& fontfile,unsigned int index=0, unsigned int flags=0); osgText::Font* getFont(std::istream& fontstream, unsigned int index=0, unsigned int flags=0); - + void removeFontImplmentation(FreeTypeFont* fontImpl) { _fontImplementationSet.erase(fontImpl); } protected: @@ -47,11 +47,11 @@ protected: bool getFace(const std::string& fontfile,unsigned int index, FT_Face & face); /** common method to load a FT_Face from a stream */ FT_Byte* getFace(std::istream& fontstream, unsigned int index, FT_Face & face); - + /** Verify the correct character mapping for MS windows */ void verifyCharacterMap(FT_Face face); - /** protected constructor to ensure the only way to create the + /** protected constructor to ensure the only way to create the * library is via the singleton instance method.*/ FreeTypeLibrary(); diff --git a/src/osgPlugins/gdal/DataSetLayer.cpp b/src/osgPlugins/gdal/DataSetLayer.cpp index 9e7c15c3e..19ac67b5e 100644 --- a/src/osgPlugins/gdal/DataSetLayer.cpp +++ b/src/osgPlugins/gdal/DataSetLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -150,8 +150,8 @@ void DataSetLayer::setUpLocator() geoTransform[2], geoTransform[5], 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, geoTransform[0], geoTransform[3], 0.0, 1.0); - - + + int nPixels = _dataset->GetRasterXSize(); int nLines = _dataset->GetRasterYSize(); @@ -161,7 +161,7 @@ void DataSetLayer::setUpLocator() locator->setDefinedInFile(true); - setLocator(locator.get()); + setLocator(locator.get()); } else if (_dataset->GetGCPCount()>0 && _dataset->GetGCPProjection()) @@ -173,9 +173,9 @@ void DataSetLayer::setUpLocator() /* Create a transformation object from the source to */ /* destination coordinate system. */ /* -------------------------------------------------------------------- */ - void *hTransformArg = - GDALCreateGenImgProjTransformer( _dataset, pszSourceSRS, - NULL, pszSourceSRS, + void *hTransformArg = + GDALCreateGenImgProjTransformer( _dataset, pszSourceSRS, + NULL, pszSourceSRS, TRUE, 0.0, 1 ); if ( hTransformArg == NULL ) @@ -189,8 +189,8 @@ void DataSetLayer::setUpLocator() /* -------------------------------------------------------------------- */ double adfDstGeoTransform[6]; int nPixels=0, nLines=0; - if( GDALSuggestedWarpOutput( _dataset, - GDALGenImgProjTransform, hTransformArg, + if( GDALSuggestedWarpOutput( _dataset, + GDALGenImgProjTransform, hTransformArg, adfDstGeoTransform, &nPixels, &nLines ) != CE_None ) { @@ -209,10 +209,10 @@ void DataSetLayer::setUpLocator() locator->setTransform( osg::Matrixd::scale(static_cast(nPixels-1), static_cast(nLines-1), 1.0) * matrix); - + locator->setDefinedInFile(true); - setLocator(locator.get()); + setLocator(locator.get()); } else { diff --git a/src/osgPlugins/gdal/DataSetLayer.h b/src/osgPlugins/gdal/DataSetLayer.h index 550984aa0..b529e2d6e 100644 --- a/src/osgPlugins/gdal/DataSetLayer.h +++ b/src/osgPlugins/gdal/DataSetLayer.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,9 +31,9 @@ class DataSetLayer : public osgTerrain::Layer /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ DataSetLayer(const DataSetLayer& dataSetLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Object(GDALPlugin, DataSetLayer); - + virtual bool isOpen() const { return _dataset!=0; } virtual void open(); @@ -49,11 +49,11 @@ class DataSetLayer : public osgTerrain::Layer void setGdalReader(const osgDB::ReaderWriter* rw); protected: - + virtual ~DataSetLayer(); - + void setUpLocator(); - + GDALDataset* _dataset; osgDB::ReaderWriter* _gdalReader; diff --git a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp index ba5dfac7e..1d41c903d 100644 --- a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp +++ b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -32,7 +32,7 @@ #include "DataSetLayer.h" -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) // From easyrgb.com float Hue_2_RGB( float v1, float v2, float vH ) @@ -48,18 +48,18 @@ float Hue_2_RGB( float v1, float v2, float vH ) class ReaderWriterGDAL : public osgDB::ReaderWriter { public: - + ReaderWriterGDAL() { supportsExtension("gdal","GDAL Image reader"); } - + virtual const char* className() const { return "GDAL Image Reader"; } virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const { if (file.empty()) return ReadResult::FILE_NOT_FOUND; - + if (osgDB::equalCaseInsensitive(osgDB::getFileExtension(file),"gdal")) { return readObject(osgDB::getNameLessExtension(file),options); @@ -75,16 +75,16 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter // open a DataSetLayer. osg::ref_ptr dataset = new GDALPlugin::DataSetLayer(fileName); dataset->setGdalReader(this); - + if (dataset->isOpen()) return dataset.release(); - + return ReadResult::FILE_NOT_HANDLED; } virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - + if (osgDB::equalCaseInsensitive(osgDB::getFileExtension(fileName),"gdal")) { return readImage(osgDB::getNameLessExtension(fileName),options); @@ -93,11 +93,11 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter OpenThreads::ScopedLock lock(_serializerMutex); return const_cast(this)->local_readImage(fileName, options); } - + virtual ReadResult readHeightField(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - + if (osgDB::equalCaseInsensitive(osgDB::getFileExtension(fileName),"gdal")) { return readHeightField(osgDB::getNameLessExtension(fileName),options); @@ -125,10 +125,10 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter std::auto_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED; - + int dataWidth = dataset->GetRasterXSize(); int dataHeight = dataset->GetRasterYSize(); - + int windowX = 0; int windowY = 0; int windowWidth = dataWidth; @@ -148,7 +148,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter if (imageOptions) { OSG_INFO<<"Got ImageOptions"<_sourceImageWindowMode) { @@ -158,12 +158,12 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter double desiredY = (double)dataHeight * imageOptions->_sourceRatioWindow.windowY; double desiredWidth = (double)dataWidth * imageOptions->_sourceRatioWindow.windowWidth; double desiredHeight = (double)dataHeight * imageOptions->_sourceRatioWindow.windowHeight; - + windowX = osg::maximum((int)(floor(desiredX))-margin,0); windowY = osg::maximum((int)(floor(desiredY))-margin,0); windowWidth = osg::minimum((int)(ceil(desiredX + desiredWidth))+margin,dataWidth)-windowX; windowHeight = osg::minimum((int)(ceil(desiredY + desiredHeight))+margin,dataHeight)-windowY; - + texCoordRange = new osgDB::ImageOptions::TexCoordRange; texCoordRange->set((desiredX-(double)windowX)/(double)windowWidth, ((double)(windowY+windowHeight) -(desiredY+desiredHeight))/(double)windowHeight, @@ -182,8 +182,8 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter // leave source window dimensions as whole image. break; } - - // reapply the window coords to the pixel window so that calling code + + // reapply the window coords to the pixel window so that calling code // knows the original pixel size imageOptions->_sourcePixelWindow.windowX = windowX; imageOptions->_sourcePixelWindow.windowY = windowY; @@ -209,10 +209,10 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter break; } - } + } -// windowX = 0; -// windowY = 0; +// windowX = 0; +// windowY = 0; // windowWidth = destWidth; // windowHeight = destHeight; @@ -229,11 +229,11 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter OSG_INFO << " destHeight = "<GetRasterCount()<GetProjectionRef()<GetGeoTransform(geoTransform)==CE_None) { @@ -244,34 +244,34 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter } int numBands = dataset->GetRasterCount(); - - + + GDALRasterBand* bandGray = 0; GDALRasterBand* bandRed = 0; GDALRasterBand* bandGreen = 0; GDALRasterBand* bandBlue = 0; GDALRasterBand* bandAlpha = 0; GDALRasterBand* bandPalette = 0; - + int internalFormat = GL_LUMINANCE; unsigned int pixelFormat = GL_LUMINANCE; unsigned int dataType = 0; unsigned int numBytesPerPixel = 0; - + GDALDataType targetGDALType = GDT_Byte; for(int b=1;b<=numBands;++b) { - + GDALRasterBand* band = dataset->GetRasterBand(b); - + OSG_INFO << " Band "<GetColorTable()->GetPaletteInterpretation()) << std::endl; } - + // int gotMin,gotMax; // double minmax[2]; -// +// // minmax[0] = band->GetMinimum(&gotMin); // minmax[1] = band->GetMaximum(&gotMax); // if (!(gotMin && gotMax)) @@ -318,7 +318,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter // OSG_INFO<<" computing min max"<RasterIO(GF_Read,windowX,windowY,windowWidth,windowHeight,(void*)(imageData+1),destWidth,destHeight,targetGDALType,pixelSpace,lineSpace); bandBlue->RasterIO(GF_Read,windowX,windowY,windowWidth,windowHeight,(void*)(imageData+2),destWidth,destHeight,targetGDALType,pixelSpace,lineSpace); bandAlpha->RasterIO(GF_Read,windowX,windowY,windowWidth,windowHeight,(void*)(imageData+3),destWidth,destHeight,targetGDALType,pixelSpace,lineSpace); - + } else { @@ -391,7 +391,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter bandRed->RasterIO(GF_Read,windowX,windowY,windowWidth,windowHeight,(void*)(imageData+0),destWidth,destHeight,targetGDALType,pixelSpace,lineSpace); bandGreen->RasterIO(GF_Read,windowX,windowY,windowWidth,windowHeight,(void*)(imageData+1),destWidth,destHeight,targetGDALType,pixelSpace,lineSpace); bandBlue->RasterIO(GF_Read,windowX,windowY,windowWidth,windowHeight,(void*)(imageData+2),destWidth,destHeight,targetGDALType,pixelSpace,lineSpace); - + } } else if (bandGray) @@ -457,7 +457,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter OSG_INFO << "numBytesPerPixel: " << numBytesPerPixel << std::endl; bandPalette->RasterIO(GF_Read,windowX,windowY,windowWidth,windowHeight,(void*)(rawImageData),destWidth,destHeight,targetGDALType,pixelSpace,lineSpace); - + // Map the indexes to an actual RGBA Value. for (int i = 0; i < destWidth * destHeight; i++) { @@ -504,7 +504,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter float R, G, B; if ( S == 0 ) //HSL values = 0 - 1 { - R = L; //RGB results = 0 - 1 + R = L; //RGB results = 0 - 1 G = L; B = L; } @@ -520,8 +520,8 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter R = Hue_2_RGB( var_1, var_2, H + ( 1 / 3 ) ); G = Hue_2_RGB( var_1, var_2, H ); - B = Hue_2_RGB( var_1, var_2, H - ( 1 / 3 ) ); - } + B = Hue_2_RGB( var_1, var_2, H - ( 1 / 3 ) ); + } imageData[4*i+0] = static_cast(R*255.0f); imageData[4*i+1] = static_cast(G*255.0f); imageData[4*i+2] = static_cast(B*255.0f); @@ -542,10 +542,10 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter { OSG_INFO << "not found any usable bands in file."<setUserData(texCoordRange); - + image->flipVertical(); - + return image; } - - return 0; + + return 0; } - + ReadResult local_readHeightField(const std::string& fileName, const osgDB::ReaderWriter::Options* options) { @@ -579,10 +579,10 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter std::auto_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED; - + int dataWidth = dataset->GetRasterXSize(); int dataHeight = dataset->GetRasterYSize(); - + int windowX = 0; int windowY = 0; int windowWidth = dataWidth; @@ -599,7 +599,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter if (imageOptions) { OSG_INFO<<"Got ImageOptions"<_sourceImageWindowMode) { @@ -609,12 +609,12 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter double desiredY = (double)dataHeight * imageOptions->_sourceRatioWindow.windowY; double desiredWidth = (double)dataWidth * imageOptions->_sourceRatioWindow.windowWidth; double desiredHeight = (double)dataHeight * imageOptions->_sourceRatioWindow.windowHeight; - + windowX = osg::maximum((int)(floor(desiredX))-margin,0); windowY = osg::maximum((int)(floor(desiredY))-margin,0); windowWidth = osg::minimum((int)(ceil(desiredX + desiredWidth))+margin,dataWidth)-windowX; windowHeight = osg::minimum((int)(ceil(desiredY + desiredHeight))+margin,dataHeight)-windowY; - + texCoordRange = new osgDB::ImageOptions::TexCoordRange; texCoordRange->set((desiredX-(double)windowX)/(double)windowWidth, ((double)(windowY+windowHeight) -(desiredY+desiredHeight))/(double)windowHeight, @@ -633,7 +633,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter // leave source window dimensions as whole image. break; } - + switch(imageOptions->_destinationImageWindowMode) { case(osgDB::ImageOptions::RATIO_WINDOW): @@ -653,10 +653,10 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter break; } - } + } -// windowX = 0; -// windowY = 0; +// windowX = 0; +// windowY = 0; // windowWidth = destWidth; // windowHeight = destHeight; @@ -673,11 +673,11 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter OSG_INFO << " destHeight = "<GetRasterCount()<GetProjectionRef()<GetGeoTransform(geoTransform); OSG_INFO << " GetGeoTransform == "<< err <<" == CE_None"<GetGCPCount()<GetRasterCount(); - - + + GDALRasterBand* bandGray = 0; GDALRasterBand* bandRed = 0; GDALRasterBand* bandGreen = 0; GDALRasterBand* bandBlue = 0; GDALRasterBand* bandAlpha = 0; - + for(int b=1;b<=numBands;++b) { - + GDALRasterBand* band = dataset->GetRasterBand(b); - + OSG_INFO << " Band "<GetColorInterpretation()==GCI_GrayIndex) bandGray = band; else if (band->GetColorInterpretation()==GCI_RedBand) bandRed = band; else if (band->GetColorInterpretation()==GCI_GreenBand) bandGreen = band; else if (band->GetColorInterpretation()==GCI_BlueBand) bandBlue = band; else if (band->GetColorInterpretation()==GCI_AlphaBand) bandAlpha = band; else bandGray = band; - + } - - + + GDALRasterBand* bandSelected = 0; if (!bandSelected && bandGray) bandSelected = bandGray; else if (!bandSelected && bandAlpha) bandSelected = bandAlpha; @@ -776,15 +776,15 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter } } hf->setOrigin(osg::Vec3(BottomLeft[0],BottomLeft[1],0)); - + hf->setXInterval(sqrt(geoTransform[1]*geoTransform[1] + geoTransform[2]*geoTransform[2])); hf->setYInterval(sqrt(geoTransform[4]*geoTransform[4] + geoTransform[5]*geoTransform[5])); - + hf->setRotation(osg::Quat(rotation, osg::Vec3d(0.0, 0.0, 1.0))); return hf; } - + return ReadResult::FILE_NOT_HANDLED; } @@ -798,9 +798,9 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter GDALAllRegister(); } } - + mutable OpenThreads::ReentrantMutex _serializerMutex; - + }; // now register with Registry to instantiate the above diff --git a/src/osgPlugins/geo/ClipRegion.cpp b/src/osgPlugins/geo/ClipRegion.cpp index 418f38278..f80ea6ffc 100644 --- a/src/osgPlugins/geo/ClipRegion.cpp +++ b/src/osgPlugins/geo/ClipRegion.cpp @@ -31,19 +31,19 @@ GeoClipRegion::GeoClipRegion(const GeoClipRegion& clr,const osg::CopyOp& copyop) } void GeoClipRegion::addClipNode(osg::Node *gd) { - + osg::StateSet *state=gd->getOrCreateStateSet(); // add clip node(s) to set stencil bit marking the clip area. - // stencil op so that the stencil buffer get set at the clip pixels + // stencil op so that the stencil buffer get set at the clip pixels osg::Stencil* stencil = new osg::Stencil; stencil->setFunction(osg::Stencil::ALWAYS,1,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::REPLACE); state->setAttributeAndModes(stencil,osg::StateAttribute::ON); - + // switch off the writing to the color bit planes. (Dont show the clip area) osg::ColorMask* colorMask = new osg::ColorMask; colorMask->setMask(false,false,false,false); - + state->setRenderBinDetails(stencilbin,"RenderBin"); state->setMode(GL_CULL_FACE,osg::StateAttribute::OFF); state->setAttribute(colorMask); @@ -56,10 +56,10 @@ void GeoClipRegion::addClipNode(osg::Node *gd) { } bool GeoClipRegion::addChild( osg::Node *child ) -{ - // bin the last - draw 'real' scenery last, using Z buffer to clip against any clip region... +{ + // bin the last - draw 'real' scenery last, using Z buffer to clip against any clip region... - osg::StateSet* statesetBin2 = child->getOrCreateStateSet(); + osg::StateSet* statesetBin2 = child->getOrCreateStateSet(); statesetBin2->setRenderBinDetails(stencilbin+3,"RenderBin"); /* osg::Stencil* stencil = new osg::Stencil; stencil->setFunction(osg::Stencil::ALWAYS,0,~0); @@ -118,7 +118,7 @@ void GeoClipRegion::addDrawClipNode(osg::Node *ndclip) { osg::StateSet *state=ndclip->getOrCreateStateSet(); // last bin - draw clip area and blend it with the clipped, visible geometry. - + // set up depth so all writing to depth goes to maximum depth. osg::Depth* depth = new osg::Depth; depth->setFunction(osg::Depth::ALWAYS); diff --git a/src/osgPlugins/geo/ClipRegion.h b/src/osgPlugins/geo/ClipRegion.h index a058d825d..ed0d52d1f 100644 --- a/src/osgPlugins/geo/ClipRegion.h +++ b/src/osgPlugins/geo/ClipRegion.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,7 +23,7 @@ * by the projection into screen coordinates of the ClipGeode. * Used for cutouts in instrumentation. * - * + * */ class GeoClipRegion : public osg::Group { @@ -34,10 +34,10 @@ class GeoClipRegion : public osg::Group /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ GeoClipRegion(const GeoClipRegion&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - // clip nodes define a screen region that is protected + // clip nodes define a screen region that is protected void addClipNode(osg::Node *gd); /* clipped children are only drawn inside the clip Node(s) protected screen area - * Obscured Nodes are (partly) hidden where the clipNodes overlap + * Obscured Nodes are (partly) hidden where the clipNodes overlap */ virtual bool addClippedChild( osg::Node *child ); virtual bool addObscuredChild( osg::Node *child ); @@ -46,7 +46,7 @@ class GeoClipRegion : public osg::Group void addDrawClipNode(osg::Node *ndclip); void setBin(const int bin) { stencilbin=bin;} protected : - + virtual ~GeoClipRegion(); int stencilbin; }; diff --git a/src/osgPlugins/geo/ReaderWriterGEO.cpp b/src/osgPlugins/geo/ReaderWriterGEO.cpp index 613d0c0e1..131637f1e 100644 --- a/src/osgPlugins/geo/ReaderWriterGEO.cpp +++ b/src/osgPlugins/geo/ReaderWriterGEO.cpp @@ -2,8 +2,8 @@ // www.carbongraphics.com for more information about the Geo animation+ modeller // supports geometry and group & face level animations. // Vertex level animation partly supported - defines movement (translate, rotate, colour)! -// Loader has been divided into two parts -// 1- general geometry (here) & +// Loader has been divided into two parts +// 1- general geometry (here) & // 2- animation (see geoActions.cpp). // ver 1.2 GWM Nov 2003 @@ -80,7 +80,7 @@ geoHeaderGeo::~geoHeaderGeo() delete intVars; delete useVars; delete extVars; - + if (color_palette) { color_palette->clear(); @@ -99,7 +99,7 @@ const geoValue *geoHeaderGeo::getGeoVar(const unsigned fid) const { } return st; } -double *geoHeaderGeo::getVar(const unsigned fid) const { +double *geoHeaderGeo::getVar(const unsigned fid) const { double *dv=NULL; dv=intVars->getVar(fid); if (!dv) { @@ -119,7 +119,7 @@ void geoHeaderGeo::update(const osg::FrameStamp *_frameStamp) { // update the scene osg::Timer_t _frameTick = _timer.tick(); _lastFrameTick=_frameTick; - + double time = _frameStamp->getSimulationTime(); intVars->update( _frameStamp); moveit(time); @@ -226,8 +226,8 @@ public: { // this must only be called with a vertex georecord. // gr is tha vertex; gface is the face containing the vertex bool hbeh=false; // true if this vertex has a behaviour - if (gr->getType()==DB_DSK_VERTEX || - gr->getType()==DB_DSK_FAT_VERTEX || + if (gr->getType()==DB_DSK_VERTEX || + gr->getType()==DB_DSK_FAT_VERTEX || gr->getType()==DB_DSK_SLIM_VERTEX) { const geoField *gfshade=gface->getField(GEO_DB_POLY_SHADEMODEL); // shaded gouraud, flat... int shademodel=gfshade ? gfshade->getInt() : -1; @@ -323,7 +323,7 @@ public: gfd=gr->getField(GEO_DB_VRTX_UV_SET_0); if (gfd) { uvc=(float *)gfd->getstore(0); - + if (uvc) { // then there are tx coords osg::Vec2 uv(uvc[0], uvc[1]); txcoords->push_back(uv); @@ -376,7 +376,7 @@ public: for (i=0; isize(); i++) { output << "Nind " << i << " = " << (*normindices)[i] << std::endl; } - return output; // to enable cascading, monkey copy from osg\plane or \quat, Ubyte4, vec2,3,4,... + return output; // to enable cascading, monkey copy from osg\plane or \quat, Ubyte4, vec2,3,4,... } private: const std::vector *cpool; // passed in from the geo file @@ -440,9 +440,9 @@ class ReaderGEO osgDB::ifstream fin(fileName.c_str(), std::ios::binary | std::ios::in ); if (fin.is_open() ) { // read the input file. - // code for setting up the database path so that internally referenced file are searched for on relative paths. - osg::ref_ptr local_opt = options ? - static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : + // code for setting up the database path so that internally referenced file are searched for on relative paths. + osg::ref_ptr local_opt = options ? + static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new osgDB::ReaderWriter::Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -479,7 +479,7 @@ class ReaderGEO nodeList=makeosg(sorted, local_opt.get()); // make a list of osg nodes geotxlist.clear(); - geomatlist.clear(); + geomatlist.clear(); txlist.clear(); txenvlist.clear(); matlist.clear();/* */ @@ -526,7 +526,7 @@ class ReaderGEO const geoField *gfd; // OSG_WARN << *itr << std::endl; // now parse for push/pops and add to lists - + switch ((*itr).getType()) { case 101: // old header - not appropriate! curparent= &(*itr); @@ -546,7 +546,7 @@ class ReaderGEO case DB_DSK_HEADER: // attach to previous curparent= &(*itr); sorted.push_back(&(*itr)); - cpalrec=NULL; + cpalrec=NULL; break; case DB_DSK_INTERNAL_VARS: // attach to parent case DB_DSK_LOCAL_VARS: @@ -643,7 +643,7 @@ class ReaderGEO if (curparent) { (*itr).setparent(curparent); curparent->addchild(&(*itr)); - } + } break; } } @@ -732,7 +732,7 @@ class ReaderGEO if (shademodel==GEO_POLY_SHADEMODEL_LIT || shademodel==GEO_POLY_SHADEMODEL_LIT_GOURAUD) dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON ); - else + else dstate->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); { // reclaim the colours gfd=grec->getField(GEO_DB_POLY_USE_MATERIAL_DIFFUSE); // true: use material... @@ -863,7 +863,7 @@ class ReaderGEO numt->setName(name); gfd=gr->getField(GEO_DB_TEXT_MATRIX); if (gfd) { - float *fmat=gfd->getMat44Arr(); + float *fmat=gfd->getMat44Arr(); // text->setPosition(osg::Vec3(fmat[12],fmat[13],fmat[14])); numt->setMatrix(Matrix(fmat)); } @@ -933,8 +933,8 @@ class ReaderGEO itr!=gr.end(); ++itr) { - if ((*itr)->getType()==DB_DSK_VERTEX || - (*itr)->getType()==DB_DSK_FAT_VERTEX || + if ((*itr)->getType()==DB_DSK_VERTEX || + (*itr)->getType()==DB_DSK_FAT_VERTEX || (*itr)->getType()==DB_DSK_SLIM_VERTEX) { // light point vertices osg::Vec3 pos; @@ -1016,7 +1016,7 @@ class ReaderGEO Geode *gd=new Geode; gfd=(*itr)->getField(GEO_DB_POLY_DSTYLE); // solid, wire... int dstyle= gfd ? gfd->getInt() : GEO_POLY_DSTYLE_SOLID; - if (!usemat && + if (!usemat && (shademodel== GEO_POLY_SHADEMODEL_LIT ||shademodel== GEO_POLY_SHADEMODEL_LIT_GOURAUD) ) { // get the per vertex colours OR per face colours. gfd=(*itr)->getField(GEO_DB_POLY_PACKED_COLOR); // the colour if (gfd) { @@ -1125,7 +1125,7 @@ class ReaderGEO const std::vector gr=grec.getchildren(); // std::vector geom; if (gr.size()>0) { - std::vector ia; // list of texture indices & vinfo found in this geode; sort into new + std::vector ia; // list of texture indices & vinfo found in this geode; sort into new const geoField *gfd=grec.getField(GEO_DB_RENDERGROUP_CULLING); // back, front, none unsigned int bothsides=gfd ? gfd->getUInt() : 0; // vertexInfo vinf(&coord_pool, &normal_pool); // holds all types of coords, indices etc @@ -1141,12 +1141,12 @@ class ReaderGEO gfd=(*itr)->getField(GEO_DB_POLY_SHADEMODEL); // shaded gouraud, flat... int shademodel=gfd ? gfd->getInt() : GEO_POLY_SHADEMODEL_LIT_GOURAUD; geoInfo *gi=getGeometry((*itr), nug, &ia, imat,shademodel, bothsides); - + //shade models GEO_POLY_SHADEMODEL_FLAT GEO_POLY_SHADEMODEL_GOURAUD // GEO_POLY_SHADEMODEL_LIT GEO_POLY_SHADEMODEL_LIT_GOURAUD gfd=(*itr)->getField(GEO_DB_POLY_USE_MATERIAL_DIFFUSE); // true: use material... bool usemat= gfd ? gfd->getBool() : false; - if (!usemat || + if (!usemat || shademodel== GEO_POLY_SHADEMODEL_LIT /*||shademodel== GEO_POLY_SHADEMODEL_LIT_GOURAUD) */ ) { // get the per vertex colours OR per face colours. gfd=(*itr)->getField(GEO_DB_POLY_PACKED_COLOR); // the colour if (gfd) { @@ -1175,9 +1175,9 @@ class ReaderGEO } } if (hasColorAction(bhv)) addPolyActions(bhv, *gi, nv); - + if (dstyle==GEO_POLY_DSTYLE_SOLID_BOTH_SIDES || dstyle == GEO_POLY_DSTYLE_SOLID) { - osg::DrawArrays *drw=new osg::DrawArrays(osg::PrimitiveSet::POLYGON,gi->getStart(nv),nv); + osg::DrawArrays *drw=new osg::DrawArrays(osg::PrimitiveSet::POLYGON,gi->getStart(nv),nv); gi->getGeom()->addPrimitiveSet(drw); } if (dstyle == GEO_POLY_DSTYLE_OPEN_WIRE) { @@ -1217,7 +1217,7 @@ class ReaderGEO const std::vector gr=grec.getchildren(); std::vector geom; if (gr.size()>0) { - std::vector ia; // list of texture indices found in this geode; sort into new + std::vector ia; // list of texture indices found in this geode; sort into new for (std::vector::const_iterator itr=gr.begin(); itr!=gr.end(); ++itr) { @@ -1234,7 +1234,7 @@ class ReaderGEO { // in geo text is defined with a matrix included in the geo.geode (gr is this geo.geode) // - we need to create this tree to render text -#if 1 +#if 1 return NULL; // temporary disable april 2003 #else Group *nug=new Group; @@ -1251,7 +1251,7 @@ class ReaderGEO return nug; #endif } - + Group *makeLightPointGeodes(const georecord *gr) { Group *nug=new Group; const geoField *gfd=gr->getField(GEO_DB_NODE_NAME); @@ -1267,7 +1267,7 @@ class ReaderGEO } Group *makeAnimatedGeodes(const georecord *gr) { // create a group full of animated geodes. Used for any animations applied to facets! - // movement actions require a transform node to be inserted, and this cannot be + // movement actions require a transform node to be inserted, and this cannot be // derived from Geode. So create a group, add matrix transform(s) for each animated polygon const geoField *gfd=gr->getField(GEO_DB_RENDERGROUP_MAT); const int imat=gfd ? gfd->getInt():0; @@ -1362,14 +1362,14 @@ class ReaderGEO sw->setAllChildrenOff(); if (gfd) { int imask; - + imask=gfd->getInt(); - + // set the bits in the osg::Switch. int selector_mask = 0x1; for(int pos=0;pos<32;++pos) { - sw->setValue(pos,((imask&selector_mask)!=0)); + sw->setValue(pos,((imask&selector_mask)!=0)); selector_mask <<= 1; } OSG_WARN << gr << " imask " << imask << std::endl; @@ -1383,7 +1383,7 @@ class ReaderGEO } return sw; } - + osg::Sequence *makeSequence(const georecord *gr) { Sequence *sq=new Sequence; @@ -1410,16 +1410,16 @@ class ReaderGEO osg::Drawable* createClipSurface(float xMin,float xMax,float yMin,float yMax,float z) { // set up the Geometry that defines the clipped region. osg::Geometry* geom = new osg::Geometry; - + osg::Vec3Array* coords = new osg::Vec3Array(4); (*coords)[0].set(xMin,yMax,z); (*coords)[1].set(xMin,yMin,z); (*coords)[2].set(xMax,yMin,z); (*coords)[3].set(xMax,yMax,z); geom->setVertexArray(coords); - + geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); - + return geom; } Group *makeClipRegion(const georecord *gr) { @@ -1489,7 +1489,7 @@ class ReaderGEO { if ((*rcitr)->getType()==DB_DSK_INTERNAL_VARS) { theHeader->addInternalVars(**rcitr); - // theHeader->setUpdateCallback(theHeader->getInternalVars()); + // theHeader->setUpdateCallback(theHeader->getInternalVars()); } if ((*rcitr)->getType()==DB_DSK_FLOAT_VAR) { if (theHeader.valid()) theHeader->addUserVar((**rcitr)); @@ -1569,7 +1569,7 @@ class ReaderGEO } tx->setFilter(osg::Texture::MIN_FILTER, filt); gfd=gr->getField(GEO_DB_TEX_MAGFILTER); - if (gfd) { + if (gfd) { unsigned imod=gfd->getUInt(); switch (imod) { case GEO_DB_TEX_NEAREST: @@ -1612,7 +1612,7 @@ class ReaderGEO else delete cb; } break; - + case DB_DSK_SCALE_ACTION: { geoMoveBehaviour *sb=new geoMoveBehaviour; ok=sb->makeBehave((*rcitr), theHeader.get()); @@ -1627,7 +1627,7 @@ class ReaderGEO else delete cb; } break; - + case DB_DSK_COMPARE_ACTION: { geoCompareBehaviour *cb=new geoCompareBehaviour; ok=cb->makeBehave((*rcitr), theHeader.get()); @@ -1808,7 +1808,7 @@ class ReaderGEO } (*itr)->setNode(holder); break; -/* holder= theHeader.get(); // makeHeader(gr);// +/* holder= theHeader.get(); // makeHeader(gr);// (*itr)->setNode(holder); if (mtr) { holder->addChild(mtr); @@ -1836,7 +1836,7 @@ class ReaderGEO } (*itr)->setNode(holder); break; - case DB_DSK_LOD: + case DB_DSK_LOD: holder=makeLOD(gr); (*itr)->setNode(holder); break; @@ -1912,7 +1912,7 @@ class ReaderGEO holder=makePage(gr); (*itr)->setNode(holder); break; - case DB_DSK_PERSPECTIVE_GRID_INFO: + case DB_DSK_PERSPECTIVE_GRID_INFO: { // relates to how model is viewed in Geo modeller osg::Group *gp=new Group; holder=gp; @@ -1926,20 +1926,20 @@ class ReaderGEO case DB_DSK_FLOAT2_VAR: case DB_DSK_FLOAT3_VAR: case DB_DSK_FLOAT4_VAR: - case DB_DSK_INTERNAL_VARS: - case DB_DSK_LOCAL_VARS: + case DB_DSK_INTERNAL_VARS: + case DB_DSK_LOCAL_VARS: case DB_DSK_EXTERNAL_VARS: case DB_DSK_CLAMP_ACTION: - case DB_DSK_RANGE_ACTION: - case DB_DSK_ROTATE_ACTION: - case DB_DSK_TRANSLATE_ACTION: - case DB_DSK_SCALE_ACTION: - case DB_DSK_ARITHMETIC_ACTION: - case DB_DSK_LOGIC_ACTION: - case DB_DSK_CONDITIONAL_ACTION: - case DB_DSK_LOOPING_ACTION: - case DB_DSK_COMPARE_ACTION: - case DB_DSK_VISIBILITY_ACTION: + case DB_DSK_RANGE_ACTION: + case DB_DSK_ROTATE_ACTION: + case DB_DSK_TRANSLATE_ACTION: + case DB_DSK_SCALE_ACTION: + case DB_DSK_ARITHMETIC_ACTION: + case DB_DSK_LOGIC_ACTION: + case DB_DSK_CONDITIONAL_ACTION: + case DB_DSK_LOOPING_ACTION: + case DB_DSK_COMPARE_ACTION: + case DB_DSK_VISIBILITY_ACTION: case DB_DSK_STRING_CONTENT_ACTION: default: { osg::Group *gp=new Group; @@ -2049,7 +2049,7 @@ class ReaderGEO } return NULL; } - + private: geoRecordList recs; // the records read from file std::vector coord_pool; // current vertex ooords @@ -2084,18 +2084,18 @@ void userVars::addUserVar(const georecord &gr) { const geoField *gfd= gr.getField(GEO_DB_FLOAT_VAR_FID); unsigned int fid=gfd ? gfd->getUInt():0; geoValue *nm=new geoValue(tok,fid); - + gfd= gr.getField(GEO_DB_FLOAT_VAR_NAME); const char *name=gfd->getChar(); nm->setName(name); - + gfd= gr.getField(GEO_DB_FLOAT_VAR_VALUE); nm->setVal(gfd ? gfd->getFloat():0.0f); //gfd= gr.getField(GEO_DB_FLOAT_VAR_DEFAULT); //nm->setdefault(gfd ? gfd->getFloat():0.0f); //float fdef=gfd ? gfd->getFloat():0.0f; - + gfd= gr.getField(GEO_DB_FLOAT_VAR_CONSTRAINED); if (gfd) { nm->setConstrained(); @@ -2132,7 +2132,7 @@ void internalVars::update(const osg::FrameStamp *_frameStamp) { if (timestart<0) { time_t long_time; struct tm *newtime; - + long_time=time( NULL ); // * Get time as long integer. newtime = localtime( &long_time ); // * Convert to local time. timestart=newtime->tm_hour*3600 +newtime->tm_min*60+ newtime->tm_sec; @@ -2197,7 +2197,7 @@ void geoField::parseExt(std::ifstream &fin) const { // Feb 2003 parse onme exten } nread++; } -void geoField::readfile(std::ifstream &fin, const uint id) { // is part of a record id +void geoField::readfile(std::ifstream &fin, const uint id) { // is part of a record id unsigned char tokid, type; unsigned short nits; if (!fin.eof()) { @@ -2251,13 +2251,13 @@ void geoField::readfile(std::ifstream &fin, const uint id) { // is part of a rec class ReaderWriterGEO : public osgDB::ReaderWriter { public: - + ReaderWriterGEO() { supportsExtension("gem","CarbonGraphics Geo model format"); supportsExtension("geo","CarbonGraphics Geo model format"); } - + virtual const char* className() const { return "GEO Reader/Writer"; } virtual bool acceptsExtension(const std::string& extension) const diff --git a/src/osgPlugins/geo/geoActions.cpp b/src/osgPlugins/geo/geoActions.cpp index e73f75b8e..47243d2bc 100644 --- a/src/osgPlugins/geo/geoActions.cpp +++ b/src/osgPlugins/geo/geoActions.cpp @@ -297,7 +297,7 @@ void geoDiscreteBehaviour::doaction(osg::Node *) { // do math operation if (in && out) { float v=*in; *out=rangelist.begin()->getVal(); - for (std::vector::const_iterator itr=rangelist.begin(); + for (std::vector::const_iterator itr=rangelist.begin(); itr=itr->getMin() && v<=itr->getMax()) *out=itr->getVal(); } @@ -356,7 +356,7 @@ void geoMoveBehaviour::doaction(osg::Node *node) { break; case DB_DSK_ROTATE_ACTION: //std::cout << node->getName() << " v: " << getVar() << " rotion " << DEG2RAD(getValue()) << std::endl; - mtr->preMult( osg::Matrix::translate(-centre)* + mtr->preMult( osg::Matrix::translate(-centre)* osg::Matrix::rotate(DEG2RAD(getValue()),axis)* // nov 2003 negative rotation convention osg::Matrix::translate(centre)); break; @@ -393,7 +393,7 @@ bool geoMoveBehaviour::makeBehave(const georecord *grec, const geoHeaderGeo *the ok=true; } } - } else if (act==DB_DSK_TRANSLATE_ACTION) { + } else if (act==DB_DSK_TRANSLATE_ACTION) { const geoField *gfd=grec->getField(GEO_DB_TRANSLATE_ACTION_INPUT_VAR); if (gfd) { unsigned fid= gfd->getUInt(); // field identifier @@ -413,7 +413,7 @@ bool geoMoveBehaviour::makeBehave(const georecord *grec, const geoHeaderGeo *the ok=true; } } - } else if (act==DB_DSK_SCALE_ACTION) { // Nov 2002 not yet implemented in the modeller! + } else if (act==DB_DSK_SCALE_ACTION) { // Nov 2002 not yet implemented in the modeller! } return ok; } @@ -429,8 +429,8 @@ void geoMoveVertexBehaviour::doaction(osg::Matrix *mtr) { break; case DB_DSK_ROTATE_ACTION: //std::cout << dr->getName() << " v: " << getVar() << " rotion " << DEG2RAD(getValue()) << std::endl; - *mtr = (*mtr)*osg::Matrix::translate(-getCentre())* - osg::Matrix::rotate(DEG2RAD(getValue()),getAxis())* + *mtr = (*mtr)*osg::Matrix::translate(-getCentre())* + osg::Matrix::rotate(DEG2RAD(getValue()),getAxis())* osg::Matrix::translate(getCentre()); break; } @@ -463,7 +463,7 @@ bool geoMoveVertexBehaviour::makeBehave(const georecord *grec, const geoHeaderGe ok=true; } } - } else if (act==DB_DSK_TRANSLATE_ACTION) { + } else if (act==DB_DSK_TRANSLATE_ACTION) { const geoField *gfd=grec->getField(GEO_DB_TRANSLATE_ACTION_INPUT_VAR); if (gfd) { unsigned fid= gfd->getUInt(); // field identifier @@ -483,7 +483,7 @@ bool geoMoveVertexBehaviour::makeBehave(const georecord *grec, const geoHeaderGe ok=true; } } - } else if (act==DB_DSK_SCALE_ACTION) { // Nov 2002 not yet implemented in the modeller! + } else if (act==DB_DSK_SCALE_ACTION) { // Nov 2002 not yet implemented in the modeller! } return ok; } @@ -547,7 +547,7 @@ void geoColourBehaviour::doaction(osg::Drawable *dr) } } -void geoStrContentBehaviour::doaction(osg::Drawable* /*node*/) +void geoStrContentBehaviour::doaction(osg::Drawable* /*node*/) { // do new text #ifdef USETEXT // buggy text feb 2003 osgText::Text *txt=dynamic_cast(node); @@ -687,7 +687,7 @@ void geoBehaviourDrawableCB::update(osg::NodeVisitor *,osg::Drawable *dr) { newpos=true; } } - } + } if (newpos) { osg::Vec3Array* vtxa = dynamic_cast(gm->getVertexArray()); (*vtxa)[prevvtr]=pos*mtr; diff --git a/src/osgPlugins/geo/geoCore.h b/src/osgPlugins/geo/geoCore.h index a9e071c7c..76bbc96de 100644 --- a/src/osgPlugins/geo/geoCore.h +++ b/src/osgPlugins/geo/geoCore.h @@ -8,18 +8,18 @@ --------------------------------------------------------------------------- - PROPRIETARY RIGHTS NOTICE: - - This software contains proprietary information and trade secrets of Carbon - Graphics LLC. No part or all of this software may be reproduced in any - form, without the written permission of Carbon Graphics LLC. + PROPRIETARY RIGHTS NOTICE: - This software file can only be used in conjunction with the Geo SDK & - libraries to create Plugin modules for the Geo 3D Modeling & Animation + This software contains proprietary information and trade secrets of Carbon + Graphics LLC. No part or all of this software may be reproduced in any + form, without the written permission of Carbon Graphics LLC. + + This software file can only be used in conjunction with the Geo SDK & + libraries to create Plugin modules for the Geo 3D Modeling & Animation package. - COPYRIGHT NOTICE: - + COPYRIGHT NOTICE: + Copyright © 1998-2001 Carbon Graphics Llc, ALL RIGHTS RESERVED \*===========================================================================*/ @@ -29,10 +29,10 @@ #define _GEO_CORE_H_ -// The following ifdef block is the standard way of creating macros which make exporting +// The following ifdef block is the standard way of creating macros which make exporting // from a DLL simpler. All files within this DLL are compiled with the GEO_DB_EXPORTS // symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see +// that uses this DLL. This way any other project whose source files include this file see // GEO_DB_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. @@ -42,7 +42,7 @@ #else #define GEO_DB_API __declspec( dllimport ) #endif -#else +#else #define GEO_DB_API #endif diff --git a/src/osgPlugins/geo/geoFormat.h b/src/osgPlugins/geo/geoFormat.h index 766489d40..2240d0f7d 100644 --- a/src/osgPlugins/geo/geoFormat.h +++ b/src/osgPlugins/geo/geoFormat.h @@ -8,27 +8,27 @@ AUTHOR: Andy Bushnell ------------------------------------------------------------------------- -PROPRIETARY RIGHTS NOTICE: - - This software contains proprietary information and trade secrets of Carbon - Graphics LLC. No part or all of this software may be reproduced in any form, +PROPRIETARY RIGHTS NOTICE: + + This software contains proprietary information and trade secrets of Carbon + Graphics LLC. No part or all of this software may be reproduced in any form, without the written permission of Carbon Graphics LLC. Exception: This Software file can be used by third-party software developers (without - using the Geo SDK libraries) for any purpose OTHER THAN loading Geo format - files into an application or executable (such as, though not limited to, + using the Geo SDK libraries) for any purpose OTHER THAN loading Geo format + files into an application or executable (such as, though not limited to, geometry Modelers & animation systems) which is primarily intended to allow for - the CREATION or MODIFICATION of geometric or animation data. - - Specifically,using this software (either all or part thereof) to aid in the - creation of a Geo format loader for a run-time system, game engine, toolkit + the CREATION or MODIFICATION of geometric or animation data. + + Specifically,using this software (either all or part thereof) to aid in the + creation of a Geo format loader for a run-time system, game engine, toolkit IG (Image Generation) System or any software where the PRIMARY purpose is real-time image playback and interactivity and not Model Creation and/or modification is permitted. -COPYRIGHT NOTICE: - +COPYRIGHT NOTICE: + Copyright © 1998-2001 Carbon Graphics Llc, ALL RIGHTS RESERVED \*===========================================================================*/ @@ -42,7 +42,7 @@ COPYRIGHT NOTICE: #define GEO_1_0_RC2 1132 #define GEO_1_0_RC3 1133 -#define GEO_1_0_RC4 1134 +#define GEO_1_0_RC4 1134 #define GEO_1_0 1141 #define GEO_1_1_RC1 1231 @@ -82,7 +82,7 @@ COPYRIGHT NOTICE: const unsigned int DB_DSK_HEADER = 100; // NOTE File MAGIC ID *CHANGED* //---------------------------------------------------------------- -// +// //---------------------------------------------------------------- const unsigned int DB_DSK_GROUP = 102; @@ -107,25 +107,25 @@ const unsigned int DB_DSK_TEXT = 121; const unsigned int DB_DSK_BASE_GROUP = 122; const unsigned int DB_DSK_BASE_SURFACE = 123; const unsigned int DB_DSK_BEHAVIOR = 124; -const unsigned int DB_DSK_CLAMP_ACTION = 125; -const unsigned int DB_DSK_RANGE_ACTION = 126; -const unsigned int DB_DSK_ROTATE_ACTION = 127; -const unsigned int DB_DSK_TRANSLATE_ACTION = 128; -const unsigned int DB_DSK_SCALE_ACTION = 129; -const unsigned int DB_DSK_ARITHMETIC_ACTION = 130; -const unsigned int DB_DSK_LOGIC_ACTION = 131; -const unsigned int DB_DSK_CONDITIONAL_ACTION = 132; -const unsigned int DB_DSK_LOOPING_ACTION = 133; -const unsigned int DB_DSK_COMPARE_ACTION = 134; -const unsigned int DB_DSK_VISIBILITY_ACTION = 135; -const unsigned int DB_DSK_STRING_CONTENT_ACTION = 136; -const unsigned int DB_DSK_INTERNAL_VARS = 137; -const unsigned int DB_DSK_LOCAL_VARS = 138; -const unsigned int DB_DSK_EXTERNAL_VARS = 139; -const unsigned int DB_DSK_FLOAT_VAR = 140; -const unsigned int DB_DSK_INT_VAR = 141; -const unsigned int DB_DSK_LONG_VAR = 142; -const unsigned int DB_DSK_DOUBLE_VAR = 143; +const unsigned int DB_DSK_CLAMP_ACTION = 125; +const unsigned int DB_DSK_RANGE_ACTION = 126; +const unsigned int DB_DSK_ROTATE_ACTION = 127; +const unsigned int DB_DSK_TRANSLATE_ACTION = 128; +const unsigned int DB_DSK_SCALE_ACTION = 129; +const unsigned int DB_DSK_ARITHMETIC_ACTION = 130; +const unsigned int DB_DSK_LOGIC_ACTION = 131; +const unsigned int DB_DSK_CONDITIONAL_ACTION = 132; +const unsigned int DB_DSK_LOOPING_ACTION = 133; +const unsigned int DB_DSK_COMPARE_ACTION = 134; +const unsigned int DB_DSK_VISIBILITY_ACTION = 135; +const unsigned int DB_DSK_STRING_CONTENT_ACTION = 136; +const unsigned int DB_DSK_INTERNAL_VARS = 137; +const unsigned int DB_DSK_LOCAL_VARS = 138; +const unsigned int DB_DSK_EXTERNAL_VARS = 139; +const unsigned int DB_DSK_FLOAT_VAR = 140; +const unsigned int DB_DSK_INT_VAR = 141; +const unsigned int DB_DSK_LONG_VAR = 142; +const unsigned int DB_DSK_DOUBLE_VAR = 143; const unsigned int DB_DSK_BOOL_VAR = 144; // unsigned int DEPRICATED = 145; const unsigned int DB_DSK_IF_CONDITION = 146; @@ -133,30 +133,30 @@ const unsigned int DB_DSK_ELSE_CONDITION = 147; // unsigned int DEPRICATED = 148; const unsigned int DB_DSK_COLOR_PALETTE = 149; const unsigned int DB_DSK_COLOR_RAMP_ACTION = 150; -const unsigned int DB_DSK_FLOAT2_VAR = 151; -const unsigned int DB_DSK_FLOAT3_VAR = 152; -const unsigned int DB_DSK_FLOAT4_VAR = 153; -const unsigned int DB_DSK_LINEAR_ACTION = 154; -const unsigned int DB_DSK_TASK_ACTION = 155; -const unsigned int DB_DSK_PERIODIC_ACTION = 156; +const unsigned int DB_DSK_FLOAT2_VAR = 151; +const unsigned int DB_DSK_FLOAT3_VAR = 152; +const unsigned int DB_DSK_FLOAT4_VAR = 153; +const unsigned int DB_DSK_LINEAR_ACTION = 154; +const unsigned int DB_DSK_TASK_ACTION = 155; +const unsigned int DB_DSK_PERIODIC_ACTION = 156; // unsigned int DEPRICATED = 157; -const unsigned int DB_DSK_TRIG_ACTION = 158; -const unsigned int DB_DSK_INVERSE_ACTION = 159; +const unsigned int DB_DSK_TRIG_ACTION = 158; +const unsigned int DB_DSK_INVERSE_ACTION = 159; const unsigned int DB_DSK_TRUNCATE_ACTION = 160; -const unsigned int DB_DSK_ABS_ACTION = 161; +const unsigned int DB_DSK_ABS_ACTION = 161; const unsigned int DB_DSK_IF_THEN_ELSE_ACTION = 162; // simple variable value check -const unsigned int DB_DSK_DCS_ACTION = 163; +const unsigned int DB_DSK_DCS_ACTION = 163; const unsigned int DB_DSK_INSTANCE = 164; const unsigned int DB_DSK_COORD_POOL = 165; const unsigned int DB_DSK_LIGHTPT = 166; const unsigned int DB_DSK_EXTERNAL = 167; const unsigned int DB_DSK_NORMAL_POOL = 168; const unsigned int DB_DSK_DISCRETE_ACTION = 169; -const unsigned int DB_DSK_STRING_VAR = 170; +const unsigned int DB_DSK_STRING_VAR = 170; const unsigned int DB_DSK_STRING_COPY_ACTION = 171; const unsigned int DB_DSK_PAGE = 172; -const unsigned int DB_DSK_SQRT_ACTION = 173; -const unsigned int DB_DSK_LOG_ACTION = 174; +const unsigned int DB_DSK_SQRT_ACTION = 173; +const unsigned int DB_DSK_LOG_ACTION = 174; const unsigned int DB_DSK_PLANE_TEXTURE_MAPPING_INFO = 175; const unsigned int DB_DSK_CYLINDER_TEXTURE_MAPPING_INFO = 176; // not implemented in 1.0 const unsigned int DB_DSK_SPHERE_TEXTURE_MAPPING_INFO = 177; // not implemented in 1.0 @@ -183,10 +183,10 @@ const unsigned int DB_DSK_TRANSITION_RULE_ACTION = 197; const unsigned int DB_DSK_PUSH_ACTION = 198; // Indicates a list of child actions coming const unsigned int DB_DSK_POP_ACTION = 199; // End of child action list const unsigned int DB_DSK_LIGHT_GROUP = 200; -const unsigned int DB_DSK_CONTINUOUS_ACTION = 201; -const unsigned int DB_DSK_MOMENTARY_ACTION = 202; -const unsigned int DB_DSK_NSTATE_ACTION = 203; -const unsigned int DB_DSK_ROTARY_DRAG_ACTION = 204; +const unsigned int DB_DSK_CONTINUOUS_ACTION = 201; +const unsigned int DB_DSK_MOMENTARY_ACTION = 202; +const unsigned int DB_DSK_NSTATE_ACTION = 203; +const unsigned int DB_DSK_ROTARY_DRAG_ACTION = 204; const unsigned int DB_DSK_DCS = 205; const unsigned int DB_DSK_FAT_VERTEX = 206; const unsigned int DB_DSK_SLIM_VERTEX = 207; @@ -194,8 +194,8 @@ const unsigned int DB_DSK_CG_SHADER = 208; const unsigned int DB_DSK_CGFX_SHADER = 209; const unsigned int DB_DSK_GLSL_SHADER = 210; - - + + @@ -312,7 +312,7 @@ struct GEO_DB_API geoRecordHeader struct GEO_DB_API geoFieldHeader { /** The Field ID for the data about to be read from disk. This Field - * token record in effect describes the data which is going to + * token record in effect describes the data which is going to * follow this geoFieldToken struct. This description is sufficient to * allow parsing code to step over and ignore either fields or whole * records if they are unknown or unwanted. @@ -332,7 +332,7 @@ struct GEO_DB_API geoFieldHeader /** The Field ID for the data about to be read from disk. This Field - * token record in effect describes the data which is going to + * token record in effect describes the data which is going to * follow this geoExtendedFieldHeader struct. This description is sufficient to * allow parsing code to step over and ignore either fields or whole * records if they are unknown or unwanted. @@ -343,15 +343,15 @@ struct GEO_DB_API geoFieldHeader * example of a large vertex palette... * * on disk: - * + * * geoFieldHeader * { * DB_UCHAR id GEO_DB_VRTX_COORDS - * DB_UCHAR type DB_EXTENDED_FIELD_STRUCT + * DB_UCHAR type DB_EXTENDED_FIELD_STRUCT * DB_USHORT num 1 * } * - * parse code now knows there is 1 record of an extended field struct + * parse code now knows there is 1 record of an extended field struct * following the header. It just so happens that the following "data item" * is itself a header (this time of the extended variety) * @@ -369,18 +369,18 @@ struct GEO_DB_API geoFieldHeader * after being informed of such by a preceeding geoFieldHeader. This means that * parse code only needs to look for geoRecordHeader & geoFieldHeader records. * It also means that there is enough info grouped together, so that an - * ignoreField function can work - given a geoFieldHeader to ignore. + * ignoreField function can work - given a geoFieldHeader to ignore. * * The id field is also an unsigned short in this header - meaning that records * will be able to have more than 255 fields (the limit of a typical * geoFieldHeader field - since its "id" field is only an unsigned char). If any * records have more than 255 fields then their ids will be unsigned shorts and * on disk they will be represented by... - * + * * geoFieldHeader * { * DB_UCHAR id GEO_DB_NODE_EXTENDED - * DB_UCHAR type DB_EXTENDED_FIELD_STRUCT + * DB_UCHAR type DB_EXTENDED_FIELD_STRUCT * DB_USHORT num 1 * } * @@ -443,23 +443,23 @@ const unsigned char GEO_DB_NODE_ID = 7; // interna // // Field ID Address Ranges... // -//NODE 1 through 19 -// DERIVED_A : public NODE 20 through 79 -// DERIVED_B : public DERIVED_A 80 through 139 +//NODE 1 through 19 +// DERIVED_A : public NODE 20 through 79 +// DERIVED_B : public DERIVED_A 80 through 139 // DERIVED_C : public DERIVED_B 140 through 199 // DERIVED_D : public DERIVED_C 200 through 255 // //Examples: // //GEO_DSK_MULTI_TEX_SHADER: -// Node Property IDs 1 through 19 +// Node Property IDs 1 through 19 // Group Property IDs 20 through 79 // RenderGroup property IDs 80 through 139 // MultiTexShader Property IDs 140 through 199 // // //DB_DSK_LIGHTPT: -// Node Property IDs 1 through 19 +// Node Property IDs 1 through 19 // Polygon Property IDs 20 through 79 // LightPt property IDs 80 through 139 // @@ -482,7 +482,7 @@ const unsigned char GEO_DB_HDR_EXTENDED = 4; // From N const unsigned char GEO_DB_HDR_COMMENT = 5; // From Node const unsigned char GEO_DB_HDR_NAME = 6; // From Node const unsigned char GEO_DB_HDR_NODE_ID = 7; // From Node - + const unsigned char GEO_DB_HDR_UNITS = 20; // Header Additions const unsigned char GEO_DB_HDR_BBOX = 21; const unsigned char GEO_DB_HDR_VERSION = 22; @@ -494,19 +494,19 @@ const unsigned char GEO_DB_HDR_LAMBERT2 = 27; const unsigned char GEO_DB_HDR_UTM_ZONE = 28; const unsigned char GEO_DB_HDR_SOUTHERN_HEMISPHERE = 29; const unsigned char GEO_DB_HDR_ELLIPSOID = 30; -const unsigned char GEO_DB_HDR_ORIGIN_LAT = 31; +const unsigned char GEO_DB_HDR_ORIGIN_LAT = 31; const unsigned char GEO_DB_HDR_ORIGIN_LON = 32; -const unsigned char GEO_DB_HDR_SW_CORNER_LAT = 33; -const unsigned char GEO_DB_HDR_SW_CORNER_LON = 34; -const unsigned char GEO_DB_HDR_NE_CORNER_LAT = 35; +const unsigned char GEO_DB_HDR_SW_CORNER_LAT = 33; +const unsigned char GEO_DB_HDR_SW_CORNER_LON = 34; +const unsigned char GEO_DB_HDR_NE_CORNER_LAT = 35; const unsigned char GEO_DB_HDR_NE_CORNER_LON = 36; const unsigned char GEO_DB_HDR_SW_CORNER_X = 37; const unsigned char GEO_DB_HDR_SW_CORNER_Y = 38; const unsigned char GEO_DB_HDR_OFFSET_X = 39; -const unsigned char GEO_DB_HDR_OFFSET_Y = 40; -const unsigned char GEO_DB_HDR_OFFSET_Z = 41; -const unsigned char GEO_DB_HDR_MAJOR_AXIS = 42; -const unsigned char GEO_DB_HDR_MINOR_AXIS = 43; +const unsigned char GEO_DB_HDR_OFFSET_Y = 40; +const unsigned char GEO_DB_HDR_OFFSET_Z = 41; +const unsigned char GEO_DB_HDR_MAJOR_AXIS = 42; +const unsigned char GEO_DB_HDR_MINOR_AXIS = 43; @@ -684,10 +684,10 @@ const unsigned char GEO_DB_VIEW_SELECTIVE_SHADING = 14; /////////////////////////////////////////////////////////////////////////////// // -// DB_DSK_PERSPECTIVE_GRID_INFO Record +// DB_DSK_PERSPECTIVE_GRID_INFO Record // -// DB_DSK_XY_GRID_INFO Record -// DB_DSK_XZ_GRID_INFO Record +// DB_DSK_XY_GRID_INFO Record +// DB_DSK_XZ_GRID_INFO Record // DB_DSK_YZ_GRID_INFO Record - Field Ids // /////////////////////////////////////////////////////////////////////////////// @@ -713,15 +713,15 @@ const unsigned char GEO_DB_GRID_MATRIX = 9; /////////////////////////////////////////////////////////////////////////////// // All Node Fields + - + const unsigned char GEO_DB_GRP_BBOX = 20; // Group Additions const unsigned char GEO_DB_GRP_INSTANCE_DEF = 21; const unsigned char GEO_DB_GRP_FLAG_SHOW_BBOX = 22; const unsigned char GEO_DB_GRP_ZBUFFER = 23; -const unsigned char GEO_DB_GRP_MATRIX_TRANSFORM = 24; -const unsigned char GEO_DB_GRP_TRANSLATE_TRANSFORM = 25; -const unsigned char GEO_DB_GRP_ROTATE_TRANSFORM = 26; -const unsigned char GEO_DB_GRP_SCALE_TRANSFORM = 27; +const unsigned char GEO_DB_GRP_MATRIX_TRANSFORM = 24; +const unsigned char GEO_DB_GRP_TRANSLATE_TRANSFORM = 25; +const unsigned char GEO_DB_GRP_ROTATE_TRANSFORM = 26; +const unsigned char GEO_DB_GRP_SCALE_TRANSFORM = 27; const unsigned char GEO_DB_GRP_TOD_DISPLAY = 28; const unsigned char GEO_DB_GRP_NOISECT = 29; @@ -830,8 +830,8 @@ const unsigned char GEO_DB_DCS_VECTOR = 129; // All Node Fields + // All Group Fields + - -const unsigned char GEO_DB_CULL_GRP_RADIUS = 80; // CullGroup Additions + +const unsigned char GEO_DB_CULL_GRP_RADIUS = 80; // CullGroup Additions @@ -845,10 +845,10 @@ const unsigned char GEO_DB_CULL_GRP_RADIUS = 80; // CullGr // All Node Fields + // All Group Fields + - + const unsigned char GEO_DB_Z_GRP_DEPTH_OFFSET = 80; // ZOffsetGroup Additions -const unsigned char GEO_DB_Z_GRP_DEPTH_OFFSET_CONSTANT = 81; -const unsigned char GEO_DB_Z_GRP_TYPE = 82; +const unsigned char GEO_DB_Z_GRP_DEPTH_OFFSET_CONSTANT = 81; +const unsigned char GEO_DB_Z_GRP_TYPE = 82; @@ -862,7 +862,7 @@ const unsigned char GEO_DB_Z_GRP_TYPE = 82; // All Node Fields + // All Group Fields + - + const unsigned char GEO_DB_MULTI_SAMPLE_AA_GRP_NUM_SAMPLES = 80; // MultiSampleAAGroup Additions const unsigned char GEO_DB_MULTI_SAMPLE_AA_GRP_JITTER_RADIUS= 81; const unsigned char GEO_DB_MULTI_SAMPLE_AA_GRP_ALPHA_CLAMP = 82; @@ -880,8 +880,8 @@ const unsigned char GEO_DB_MULTI_SAMPLE_AA_GRP_ALPHA_CLAMP = 82; // All Node Fields + // All Group Fields + - -const unsigned char GEO_DB_LINE_AA_GRP_RANGE = 80; // LineAAGroup Additions + +const unsigned char GEO_DB_LINE_AA_GRP_RANGE = 80; // LineAAGroup Additions const unsigned char GEO_DB_LINE_AA_GRP_ALPHA_FACTOR = 81; @@ -898,7 +898,7 @@ const unsigned char GEO_DB_LINE_AA_GRP_ALPHA_FACTOR = 81; // All Node Fields + // All Group Fields + - + const unsigned char GEO_DB_FADE_GRP_NEAR_RANGE = 80; // FadeGroup Additions const unsigned char GEO_DB_FADE_GRP_NEAR_TRANSITION = 81; const unsigned char GEO_DB_FADE_GRP_FAR_RANGE = 82; @@ -968,7 +968,7 @@ const unsigned char GEO_DB_BSP_PLANE_EQUATION = 80; // BSP Add const unsigned char GEO_DB_LOD_IN = 80; // LOD Additions const unsigned char GEO_DB_LOD_OUT = 81; const unsigned char GEO_DB_LOD_CENTER = 82; -const unsigned char GEO_DB_LOD_CALC = 83; +const unsigned char GEO_DB_LOD_CALC = 83; const unsigned char GEO_DB_LOD_FREEZE_CENTER = 84; @@ -1021,10 +1021,10 @@ const unsigned char GEO_DB_INSTANCE_DEF = 80; // insta // All Node Fields + // All Group Fields + - + const unsigned char GEO_DB_SWITCH_CURRENT_MASK = 80; // switch Additions -const unsigned char GEO_DB_SWITCH_MASK_WIDTH = 81; -const unsigned char GEO_DB_SWITCH_NUM_MASKS = 82; +const unsigned char GEO_DB_SWITCH_MASK_WIDTH = 81; +const unsigned char GEO_DB_SWITCH_NUM_MASKS = 82; const unsigned char GEO_DB_SWITCH_MASKS = 83; @@ -1042,7 +1042,7 @@ const unsigned char GEO_DB_SWITCH_MASKS = 83; // All Node Fields + // All Group Fields + - + const unsigned char GEO_DB_PAGE_ACTIVE_CHILD = 80; // page Additions @@ -1058,17 +1058,17 @@ const unsigned char GEO_DB_PAGE_ACTIVE_CHILD = 80; // page Add /////////////////////////////////////////////////////////////////////////////// // It is important to note that user extended Group fields begin with a field -// ID of 140 (GEO_DB_BASE_GROUP_START_EXTERNAL). This allows Geo to add -// additional fields to the BaseGroup class +// ID of 140 (GEO_DB_BASE_GROUP_START_EXTERNAL). This allows Geo to add +// additional fields to the BaseGroup class // All Node Fields + // All Group Fields + - + const unsigned char GEO_DB_BASE_GROUP_CLASSNAME = 80; // BaseGroup Additions const unsigned char GEO_DB_BASE_GROUP_EXTENDED_TYPE = 81; const unsigned char GEO_DB_BASE_GROUP_PLUGIN_REQUIRED = 82; - -const unsigned char GEO_DB_BASE_GROUP_START_EXTERNAL = 140; // User Derived Node Additions + +const unsigned char GEO_DB_BASE_GROUP_START_EXTERNAL = 140; // User Derived Node Additions @@ -1081,7 +1081,7 @@ const unsigned char GEO_DB_BASE_GROUP_START_EXTERNAL = 140; // User De // GEO_DB_BASE_SURFACE Record - Field Ids // // It is important to note that user extended Surface fields begin with a field -// ID of 80 (GEO_DB_BASE_SURFACE_START_EXTERNAL). This allows Geo to add +// ID of 80 (GEO_DB_BASE_SURFACE_START_EXTERNAL). This allows Geo to add // additional fields which will be common to all derived groups up to this // number // @@ -1091,12 +1091,12 @@ const unsigned char GEO_DB_BASE_GROUP_START_EXTERNAL = 140; // User De // All Node Fields + - + const unsigned char GEO_DB_BASE_SURFACE_CLASSNAME = 20; // BaseSurface Additions const unsigned char GEO_DB_BASE_SURFACE_EXTENDED_TYPE = 21; const unsigned char GEO_DB_BASE_SURFACE_PLUGIN_REQUIRED = 22; - -const unsigned char GEO_DB_BASE_SURFACE_START_EXTERNAL = 80; // User Derived Node Additions + +const unsigned char GEO_DB_BASE_SURFACE_START_EXTERNAL = 80; // User Derived Node Additions @@ -1113,16 +1113,16 @@ const unsigned char GEO_DB_BASE_SURFACE_START_EXTERNAL = 80; // User D // All Group Fields + const unsigned char GEO_DB_RENDERGROUP_MAT = 80; // RenderGroup Additions -const unsigned char GEO_DB_RENDERGROUP_TERRAIN = 81; -const unsigned char GEO_DB_RENDERGROUP_BILLBOARD = 82; -const unsigned char GEO_DB_RENDERGROUP_LIGHTING = 83; -const unsigned char GEO_DB_RENDERGROUP_FOG = 84; -const unsigned char GEO_DB_RENDERGROUP_GAIN = 85; -const unsigned char GEO_DB_RENDERGROUP_TRANSPARENCY = 86; -const unsigned char GEO_DB_RENDERGROUP_CULLING = 87; -const unsigned char GEO_DB_RENDERGROUP_BLENDING = 88; -const unsigned char GEO_DB_RENDERGROUP_ALPHA_REF = 89; -const unsigned char GEO_DB_RENDERGROUP_LIGHTPTS = 90; +const unsigned char GEO_DB_RENDERGROUP_TERRAIN = 81; +const unsigned char GEO_DB_RENDERGROUP_BILLBOARD = 82; +const unsigned char GEO_DB_RENDERGROUP_LIGHTING = 83; +const unsigned char GEO_DB_RENDERGROUP_FOG = 84; +const unsigned char GEO_DB_RENDERGROUP_GAIN = 85; +const unsigned char GEO_DB_RENDERGROUP_TRANSPARENCY = 86; +const unsigned char GEO_DB_RENDERGROUP_CULLING = 87; +const unsigned char GEO_DB_RENDERGROUP_BLENDING = 88; +const unsigned char GEO_DB_RENDERGROUP_ALPHA_REF = 89; +const unsigned char GEO_DB_RENDERGROUP_LIGHTPTS = 90; @@ -1179,7 +1179,7 @@ const unsigned char GEO_DB_MULTI_TEX_SHADER_TEX7_BLEND_COLOR= 163; // All Node Fields + -const unsigned char GEO_DB_POLY_NORMAL = 20; // Polygon Additions +const unsigned char GEO_DB_POLY_NORMAL = 20; // Polygon Additions const unsigned char GEO_DB_POLY_CENTER = 21; const unsigned char GEO_DB_POLY_PACKED_COLOR = 22; const unsigned char GEO_DB_POLY_DSTYLE = 23; @@ -1251,7 +1251,7 @@ const unsigned char GEO_DB_PLANE_TEXTURE_MAPPING_INFO_TEXTURE_UNIT = 4; // // Many of the possible LightPt fields do not make sense in the context of a // Light point - namely most of the Polygon rendering & texturing properties. -// These will likely not be present in a Geo file - if they are they can be +// These will likely not be present in a Geo file - if they are they can be // ignored. /////////////////////////////////////////////////////////////////////////////// @@ -1309,7 +1309,7 @@ const unsigned char GEO_DB_TEXT_FONT = 31; /////////////////////////////////////////////////////////////////////////////// // -// GEO_DB_MESH Record - Field Ids +// GEO_DB_MESH Record - Field Ids // /////////////////////////////////////////////////////////////////////////////// @@ -1343,13 +1343,13 @@ const unsigned char GEO_DB_MESH_TYPE = 80; // Mesh Add const unsigned char GEO_DB_VRTX_COORD_INDEX = 20; // Vertex Additions const unsigned char GEO_DB_VRTX_UV_SET_0 = 21; -const unsigned char GEO_DB_VRTX_UV_SET_1 = 22; -const unsigned char GEO_DB_VRTX_UV_SET_2 = 23; -const unsigned char GEO_DB_VRTX_UV_SET_3 = 24; -const unsigned char GEO_DB_VRTX_UV_SET_4 = 25; -const unsigned char GEO_DB_VRTX_UV_SET_5 = 26; -const unsigned char GEO_DB_VRTX_UV_SET_6 = 27; -const unsigned char GEO_DB_VRTX_UV_SET_7 = 28; +const unsigned char GEO_DB_VRTX_UV_SET_1 = 22; +const unsigned char GEO_DB_VRTX_UV_SET_2 = 23; +const unsigned char GEO_DB_VRTX_UV_SET_3 = 24; +const unsigned char GEO_DB_VRTX_UV_SET_4 = 25; +const unsigned char GEO_DB_VRTX_UV_SET_5 = 26; +const unsigned char GEO_DB_VRTX_UV_SET_6 = 27; +const unsigned char GEO_DB_VRTX_UV_SET_7 = 28; const unsigned char GEO_DB_VRTX_NORMAL = 29; const unsigned char GEO_DB_VRTX_PACKED_COLOR = 30; const unsigned char GEO_DB_VRTX_COLOR_INDEX = 31; @@ -1587,7 +1587,7 @@ const unsigned char GEO_DB_TRANSITION_RATIO = 7; // DB_DSK_POP_ACTION // DB_DSK_POP_ACTION // -// if the first state had an optional set of actions to perform when +// if the first state had an optional set of actions to perform when // active it would have the following construct... // DB_DSK_STATE_MACHINE_ACTION // DB_DSK_PUSH_ACTION @@ -1651,7 +1651,7 @@ const unsigned char GEO_DB_ROTATE_ACTION_MAX = 6; // DB_DSK_CLAMP_ACTION Record Field Ids // const unsigned char GEO_DB_CLAMP_ACTION_INPUT_VAR = 1; -const unsigned char GEO_DB_CLAMP_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_CLAMP_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_CLAMP_ACTION_MIN_VAL = 3; const unsigned char GEO_DB_CLAMP_ACTION_MAX_VAL = 4; @@ -1661,7 +1661,7 @@ const unsigned char GEO_DB_CLAMP_ACTION_MAX_VAL = 4; // DB_DSK_RANGE_ACTION Record Field Ids // const unsigned char GEO_DB_RANGE_ACTION_INPUT_VAR = 1; -const unsigned char GEO_DB_RANGE_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_RANGE_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_RANGE_ACTION_IN_MIN_VAL = 3; const unsigned char GEO_DB_RANGE_ACTION_IN_MAX_VAL = 4; const unsigned char GEO_DB_RANGE_ACTION_OUT_MIN_VAL = 5; @@ -1673,7 +1673,7 @@ const unsigned char GEO_DB_RANGE_ACTION_OUT_MAX_VAL = 6; // DB_DSK_ARITHMETIC_ACTION Record Field Ids // const unsigned char GEO_DB_ARITHMETIC_ACTION_INPUT_VAR = 1; -const unsigned char GEO_DB_ARITHMETIC_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_ARITHMETIC_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_ARITHMETIC_ACTION_OP_TYPE = 3; const unsigned char GEO_DB_ARITHMETIC_ACTION_OPERAND_VALUE = 4; const unsigned char GEO_DB_ARITHMETIC_ACTION_OPERAND_VAR = 5; @@ -1684,7 +1684,7 @@ const unsigned char GEO_DB_ARITHMETIC_ACTION_OPERAND_VAR = 5; // DB_DSK_EQUATION_ACTION Record Field Ids // const unsigned char GEO_DB_EQUATION_ACTION_INPUT_VAR = 1; -const unsigned char GEO_DB_EQUATION_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_EQUATION_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_EQUATION_ACTION_A_VAL = 3; const unsigned char GEO_DB_EQUATION_ACTION_C_VAL = 4; const unsigned char GEO_DB_EQUATION_ACTION_A_VAR = 5; @@ -1711,7 +1711,7 @@ const unsigned char GEO_DB_TRIG_ACTION_OP = 7; // DB_DSK_CONTINUOUS_ACTION Record Field Ids // const unsigned char GEO_DB_CONTINUOUS_ACTION_INPUT_VAR = 1; // Not used -const unsigned char GEO_DB_CONTINUOUS_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_CONTINUOUS_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_CONTINUOUS_ACTION_UPDATE_TYPE = 4; const unsigned char GEO_DB_CONTINUOUS_ACTION_UPDATE_VAL = 5; const unsigned char GEO_DB_CONTINUOUS_ACTION_DEFAULT_VAL = 6; @@ -1727,7 +1727,7 @@ const unsigned char GEO_DB_CONTINUOUS_ACTION_MINMAX_BEHAVIOR = 10; // DB_DSK_MOMENTARY_ACTION Record Field Ids // const unsigned char GEO_DB_MOMENTARY_ACTION_INPUT_VAR = 1; // Not used -const unsigned char GEO_DB_MOMENTARY_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_MOMENTARY_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_MOMENTARY_ACTION_DEFAULT_VAL = 3; const unsigned char GEO_DB_MOMENTARY_ACTION_VAL = 4; @@ -1736,7 +1736,7 @@ const unsigned char GEO_DB_MOMENTARY_ACTION_VAL = 4; // DB_DSK_NSTATE_ACTION Record Field Ids // const unsigned char GEO_DB_NSTATE_ACTION_INPUT_VAR = 1; // Not used -const unsigned char GEO_DB_NSTATE_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_NSTATE_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_NSTATE_ACTION_DIRECTION = 3; const unsigned char GEO_DB_NSTATE_ACTION_BEHAVIOR = 4; const unsigned char GEO_DB_NSTATE_ACTION_NUM_ITEMS = 5; @@ -1748,7 +1748,7 @@ const unsigned char GEO_DB_NSTATE_ACTION_VALS = 7; // DB_DSK_ROTARY_DRAG_ACTION Record Field Ids // const unsigned char GEO_DB_ROTARY_DRAG_ACTION_INPUT_VAR = 1; // Not used -const unsigned char GEO_DB_ROTARY_DRAG_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_ROTARY_DRAG_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_ROTARY_DRAG_ACTION_BEHAVIOR = 3; const unsigned char GEO_DB_ROTARY_DRAG_ACTION_ORIGIN = 4; @@ -1757,7 +1757,7 @@ const unsigned char GEO_DB_ROTARY_DRAG_ACTION_ORIGIN = 4; // DB_DSK_TASK_ACTION Record Field Ids // const unsigned char GEO_DB_TASK_ACTION_INPUT_VAR = 1; -const unsigned char GEO_DB_TASK_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_TASK_ACTION_OUTPUT_VAR = 2; /////////////////////////////////////////////////////////////////// @@ -1787,7 +1787,7 @@ const unsigned char GEO_DB_COLOR_RAMP_ACTION_MATCH_COLUMNS = 9; // DB_DSK_COMPARE_ACTION Record Field Ids // const unsigned char GEO_DB_COMPARE_ACTION_INPUT_VAR = 1; -const unsigned char GEO_DB_COMPARE_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_COMPARE_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_COMPARE_ACTION_OP_TYPE = 3; const unsigned char GEO_DB_COMPARE_ACTION_OPERAND_VALUE = 4; const unsigned char GEO_DB_COMPARE_ACTION_OPERAND_VAR = 5; @@ -1890,7 +1890,7 @@ const unsigned char GEO_DB_DCS_ACTION_SCALE_Z_VAR = 15; // DB_DSK_DISCRETE_ACTION Record Field Ids // const unsigned char GEO_DB_DISCRETE_ACTION_INPUT_VAR = 1; -const unsigned char GEO_DB_DISCRETE_ACTION_OUTPUT_VAR = 2; +const unsigned char GEO_DB_DISCRETE_ACTION_OUTPUT_VAR = 2; const unsigned char GEO_DB_DISCRETE_ACTION_NUM_ITEMS = 3; const unsigned char GEO_DB_DISCRETE_ACTION_OUTPUT_VAR_TYPE = 4; const unsigned char GEO_DB_DISCRETE_ACTION_MIN_VALS = 5; @@ -1911,7 +1911,7 @@ struct GEO_DB_API geoExtensionDefRec { /** The Node type for which this extension exists */ - unsigned int nodetype; // 4 bytes + unsigned int nodetype; // 4 bytes /** The data type of the extension - defined in terms of GEO_DB_DATATYPE_INT * GEO_DB_DATATYPE_FLOAT, GEO_DB_DATATYPE_BOOL etc. @@ -1923,10 +1923,10 @@ struct GEO_DB_API geoExtensionDefRec * of GEO_DB_DATATYPE_BOOL means that this extension will be accessed as one * of many in an option menu */ - unsigned char subdatatype; // 1 bytes + unsigned char subdatatype; // 1 bytes - /** The User ID (uid) is the optional value provided (in code) by the user - * to identify this particular extension. Users can search & retrieve + /** The User ID (uid) is the optional value provided (in code) by the user + * to identify this particular extension. Users can search & retrieve * extension values based on this user ID number. */ unsigned short uid; // 2 bytes @@ -1942,8 +1942,8 @@ struct GEO_DB_API geoExtensionDefRec * divided up as 15 chars for the option menu title, 8 chars for * this particular option menu's label and 1 char for the terminator * 2. When the extension is a text field or boolean toggle value - it is - * recommended that only the 15 chars for the field label be used - - * setting a 23 char-length label for a text input field will be a + * recommended that only the 15 chars for the field label be used - + * setting a 23 char-length label for a text input field will be a * waste of time, as it will get truncated on display anyway. */ char name[24]; // 24 bytes diff --git a/src/osgPlugins/geo/geoTypes.h b/src/osgPlugins/geo/geoTypes.h index c8c822e3f..24b2b034d 100644 --- a/src/osgPlugins/geo/geoTypes.h +++ b/src/osgPlugins/geo/geoTypes.h @@ -8,27 +8,27 @@ AUTHOR: Andy Bushnell ------------------------------------------------------------------------- -PROPRIETARY RIGHTS NOTICE: +PROPRIETARY RIGHTS NOTICE: - This software contains proprietary information and trade secrets of Carbon - Graphics LLC. No part or all of this software may be reproduced in any form, - without the written permission of Carbon Graphics LLC. + This software contains proprietary information and trade secrets of Carbon + Graphics LLC. No part or all of this software may be reproduced in any form, + without the written permission of Carbon Graphics LLC. Exception: This Software file can be used by third-party software developers (without - using the Geo SDK libraries) for any purpose OTHER THAN loading Geo format - files into an application or executable (such as, though not limited to, + using the Geo SDK libraries) for any purpose OTHER THAN loading Geo format + files into an application or executable (such as, though not limited to, geometry Modelers & animation systems) which is primarily intended to allow for - the CREATION or MODIFICATION of geometric or animation data. - - Specifically,using this software (either all or part thereof) to aid in the - creation of a Geo format loader for a run-time system, game engine, toolkit + the CREATION or MODIFICATION of geometric or animation data. + + Specifically,using this software (either all or part thereof) to aid in the + creation of a Geo format loader for a run-time system, game engine, toolkit IG (Image Generation) System or any software where the PRIMARY purpose is real-time image playback and interactivity and not Model Creation and/or modification is permitted. -COPYRIGHT NOTICE: - +COPYRIGHT NOTICE: + Copyright © 1998-2001 Carbon Graphics Llc, ALL RIGHTS RESERVED \*===========================================================================*/ @@ -54,9 +54,9 @@ COPYRIGHT NOTICE: - -/** - * constants to identify the plugin type + +/** + * constants to identify the plugin type */ const uint GEO_PLUGIN_TYPE_UNDEFINED = 1; const uint GEO_PLUGIN_TYPE_GEOMETRY_IMPORTER = 2; @@ -123,13 +123,13 @@ const uint GEO_TOOL_TYPE_LAST = GEO_TOOL_TYPE_GRID; * The GEO Node Type Class Hierarchy is as follows... * * GEO_DB_BASE - * GEO_DB_GROUP + * GEO_DB_GROUP * GEO_DB_SEQUENCE * GEO_DB_LOD * GEO_DB_SWITCH * GEO_DB_BASE_GROUP * GEO_DB_RENDERGROUP - * GEO_DB_MULTI_TEX_SHADER + * GEO_DB_MULTI_TEX_SHADER * GEO_DB_BASE_RENDERGROUP (*) * GEO_DB_EXTERNAL * GEO_DB_INSTANCE @@ -152,8 +152,8 @@ const uint GEO_TOOL_TYPE_LAST = GEO_TOOL_TYPE_GRID; * GEO_DB_BASE_SURFACE (*) * GEO_DB_TEXT * GEO_DB_VERTEX - * GEO_DB_FAT_VERTEX - * GEO_DB_SLIM_VERTEX + * GEO_DB_FAT_VERTEX + * GEO_DB_SLIM_VERTEX * GEO_DB_HEADER * * (*) Not available in Geo Version 1.0 @@ -179,29 +179,29 @@ const uint GEO_DB_BSP = (0x00000400 | GEO_DB_GROUP); const uint GEO_DB_POLYGON = (0x00000800 | GEO_DB_SURFACE); //------------ const uint GEO_DB_MESH = (0x00001000 | GEO_DB_POLYGON); -const uint GEO_DB_CULL_GROUP = (0x00002000 | GEO_DB_GROUP); -const uint GEO_DB_MULTI_TEX_SHADER = (0x00004000 | GEO_DB_RENDERGROUP); +const uint GEO_DB_CULL_GROUP = (0x00002000 | GEO_DB_GROUP); +const uint GEO_DB_MULTI_TEX_SHADER = (0x00004000 | GEO_DB_RENDERGROUP); const uint GEO_DB_PAGE = (0x00008000 | GEO_DB_GROUP); //------------ -const uint GEO_DB_Z_OFFSET_GROUP = (0x00010000 | GEO_DB_GROUP); -const uint GEO_DB_MULTI_SAMPLE_AA_GROUP = (0x00020000 | GEO_DB_GROUP); +const uint GEO_DB_Z_OFFSET_GROUP = (0x00010000 | GEO_DB_GROUP); +const uint GEO_DB_MULTI_SAMPLE_AA_GROUP = (0x00020000 | GEO_DB_GROUP); const uint GEO_DB_TEXT = (0x00040000 | GEO_DB_GEOMETRY); const uint GEO_DB_VERTEX = (0x00080000 | GEO_DB_GEOMETRY); //------------ const uint GEO_DB_HEADER = (0x00100000 | GEO_DB_BASE); -const uint GEO_DB_LINE_AA_GROUP = (0x00200000 | GEO_DB_GROUP); +const uint GEO_DB_LINE_AA_GROUP = (0x00200000 | GEO_DB_GROUP); const uint GEO_DB_BASE_GROUP = (0x00400000 | GEO_DB_GROUP); const uint GEO_DB_BASE_SURFACE = (0x00800000 | GEO_DB_SURFACE); //------------ -const uint GEO_DB_EXTERNAL = (0x01000000 | GEO_DB_GROUP); +const uint GEO_DB_EXTERNAL = (0x01000000 | GEO_DB_GROUP); const uint GEO_DB_BASE_RENDERGROUP = (0x02000000 | GEO_DB_RENDERGROUP); const uint GEO_DB_INSTANCE = (0x04000000 | GEO_DB_GROUP); const uint GEO_DB_LIGHTPT = (0x08000000 | GEO_DB_POLYGON); //------------ -const uint GEO_DB_FADE_GROUP = (0x10000000 | GEO_DB_GROUP); -const uint GEO_DB_DECAL_GROUP = (0x20000000 | GEO_DB_GROUP); -const uint GEO_DB_LIGHT_GROUP = (0x40000000 | GEO_DB_GROUP); -const uint GEO_DB_FAT_VERTEX = (0x80000000 | GEO_DB_VERTEX); +const uint GEO_DB_FADE_GROUP = (0x10000000 | GEO_DB_GROUP); +const uint GEO_DB_DECAL_GROUP = (0x20000000 | GEO_DB_GROUP); +const uint GEO_DB_LIGHT_GROUP = (0x40000000 | GEO_DB_GROUP); +const uint GEO_DB_FAT_VERTEX = (0x80000000 | GEO_DB_VERTEX); //------------ //-------------------------------------------------------------------- @@ -215,17 +215,17 @@ const uint GEO_DB_DCS = (0x00001000 | GEO_DB_GROUP); // older version types for Compatability & convenience // -const uint GEO_DB_ALL = GEO_DB_BASE; -const uint GEO_DB_ALL_GROUP_TYPES = GEO_DB_GROUP; +const uint GEO_DB_ALL = GEO_DB_BASE; +const uint GEO_DB_ALL_GROUP_TYPES = GEO_DB_GROUP; const uint GEO_DB_ALL_GEOMETRY_TYPES = GEO_DB_GEOMETRY; -const uint GEO_DB_ALL_SURFACE_TYPES = GEO_DB_SURFACE; +const uint GEO_DB_ALL_SURFACE_TYPES = GEO_DB_SURFACE; - -/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// /** constants to identify the type of picking to be done */ -const uint GEO_PICK_GROUP = 0x00000001; +const uint GEO_PICK_GROUP = 0x00000001; const uint GEO_PICK_PRIM = 0x00000002; const uint GEO_PICK_VERTEX = 0x00000004; const uint GEO_PICK_GRID = 0x00000010; @@ -236,7 +236,7 @@ const uint GEO_PICK_TEXT = 0x00000080; -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** constants to identify mouse button usage */ const uint GEO_NO_MOUSE = 0x00000000; const uint GEO_LEFT_MOUSE = 0x00000001; @@ -250,7 +250,7 @@ const uint GEO_MIDDLE_AND_RIGHT_MOUSE = 0x00000010; // PROPERTY TYPES /////////////////////////////////////////////////////////////////// -// Identifiers for Geo data types - Used in geoProperty & geoPropertyExtension Classes +// Identifiers for Geo data types - Used in geoProperty & geoPropertyExtension Classes const unsigned char GEO_DB_DATATYPE_STRING = 1; const unsigned char GEO_DB_DATATYPE_SHORT = 2; const unsigned char GEO_DB_DATATYPE_INT = 3; @@ -301,8 +301,8 @@ const uint GEO_TRANSFORM_TYPE_MATRIX = 4; -/////////////////////////////////////////////////////////////////////////////// -/** Predefined model unit identifier. database model units can be modified +/////////////////////////////////////////////////////////////////////////////// +/** Predefined model unit identifier. database model units can be modified * via set/getUnits */ const uint GEO_DB_INCHES = 1; @@ -315,12 +315,12 @@ const uint GEO_DB_KILOMETERS = 7; - -/////////////////////////////////////////////////////////////////////////////// -/** Constants to define the modeler's intended "up" direction if that - * makes any sense + +/////////////////////////////////////////////////////////////////////////////// +/** Constants to define the modeler's intended "up" direction if that + * makes any sense */ - + const int GEO_DB_UP_AXIS_X = 1; const int GEO_DB_UP_AXIS_Y = 2; // the default const int GEO_DB_UP_AXIS_Z = 3; @@ -341,7 +341,7 @@ const short GEO_DB_PROJ_TYPE_LAST = GEO_DB_PROJ_TYPE_GEOCENTRIC; /////////////////////////////////////////////////////////////////////////////// // DB_HDR_ELLIPSOID - defines // Constants to define the ellipsoid model used for the projection -// +// const short GEO_DB_ELLIPSOID_USER_DEFINED = -1; const short GEO_DB_ELLIPSOID_WGS_1984 = 0; const short GEO_DB_ELLIPSOID_WGS_1972 = 1; @@ -353,10 +353,10 @@ const short GEO_DB_ELLIPSOID_LAST = GEO_DB_ELLIPSOID_NAD_1927; -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** Constants to control the drawing effect - * - * Constants to control the drawing of geometry primitives - usefull if user + * + * Constants to control the drawing of geometry primitives - usefull if user * wants to call standard draw method in a tool postDraw callback */ const uint GEO_DB_SOLID = 0x00000001; @@ -399,9 +399,9 @@ const uint GEO_DB_SELECTIVE_ZBUFFER = 0x80000000; - -/////////////////////////////////////////////////////////////////////////////// -/** constants to identify the different Group types + +/////////////////////////////////////////////////////////////////////////////// +/** constants to identify the different Group types */ const uint GEO_GROUP_TYPE_CONTAINER = 1; const uint GEO_GROUP_TYPE_CULL = 2; @@ -413,9 +413,9 @@ const uint GEO_GROUP_TYPE_TERRAIN = 7; const uint GEO_GROUP_TYPE_DECAL = 8; -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** Constants to control the display of a Group based on time-of-day -* +* */ const uint GEO_DB_GROUP_TOD_DISPLAY_NIGHT = 0x00000001; const uint GEO_DB_GROUP_TOD_DISPLAY_DAWN = 0x00000002; @@ -425,9 +425,9 @@ const uint GEO_DB_GROUP_TOD_DISPLAY_DUSK = 0x00000008; -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** Constants to control the intersection testing of this Group at runtime -* +* */ const uint GEO_DB_GROUP_ISECT_IG_DEFINED = 0; const uint GEO_DB_GROUP_ISECT_YES = 1; @@ -436,9 +436,9 @@ const uint GEO_DB_GROUP_ISECT_NO = 2; -/////////////////////////////////////////////////////////////////////////////// -/** Constants to control the switch Node behavior - * +/////////////////////////////////////////////////////////////////////////////// +/** Constants to control the switch Node behavior + * * Switch Nodes can either be addative (in which case the * accumulate drawable children) or selective (in which case * the determine which of their children should be drawn). @@ -452,7 +452,7 @@ const uint GEO_SWITCH_TYPE_SELECTIVE = 2; -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** Constants to identify special behavior int ZOffset GRoups */ const uint GEO_DB_ZOFFSET_GROUP_TYPE_UNDEFINED = 0; @@ -461,9 +461,9 @@ const uint GEO_DB_ZOFFSET_GROUP_TYPE_MARKINGS = 2; -/////////////////////////////////////////////////////////////////////////////// -/** Constants to control the Light Group behavior -* +/////////////////////////////////////////////////////////////////////////////// +/** Constants to control the Light Group behavior +* * Light Groups are Groups with the Light-Group flag set. Any Light pt children * are effected by these settings */ @@ -472,9 +472,9 @@ const uint GEO_LIGHT_GROUP_ANIM_ON = 1; const uint GEO_LIGHT_GROUP_ANIM_RANDOM = 2; -/////////////////////////////////////////////////////////////////////////////// -/** Constants that specify the type of Light Group -* +/////////////////////////////////////////////////////////////////////////////// +/** Constants that specify the type of Light Group +* * FIXED is for airfields etc. * MOVING is for aircraft/ships etc. */ @@ -483,7 +483,7 @@ const uint GEO_LIGHT_GROUP_TYPE_MOVING = 1; /////////////////////////////////////////////////////////////////////////////// -/** Type Tokens for Node & Tool Gui Widgets +/** Type Tokens for Node & Tool Gui Widgets */ const int GUI_FLOAT = 1; const int GUI_INT = 2; @@ -491,7 +491,7 @@ const int GUI_STRING = 3; /////////////////////////////////////////////////////////////////////////////// -/** geoWidget Typedef - Used by Node & Tool Gui Widgets +/** geoWidget Typedef - Used by Node & Tool Gui Widgets */ typedef void geoWidget; diff --git a/src/osgPlugins/geo/geoUnits.h b/src/osgPlugins/geo/geoUnits.h index 0fc32a4c4..2ad062c01 100644 --- a/src/osgPlugins/geo/geoUnits.h +++ b/src/osgPlugins/geo/geoUnits.h @@ -2,34 +2,34 @@ NAME: geoUnits.h -DESCRIPTION: Constants to convert coordinate data to/from meters (Geo +DESCRIPTION: Constants to convert coordinate data to/from meters (Geo default) AUTHOR: Andy Bushnell ------------------------------------------------------------------------- -PROPRIETARY RIGHTS NOTICE: - +PROPRIETARY RIGHTS NOTICE: + This software contains proprietary information and trade secrets of Carbon - Graphics LLC. No part or all of this software may be reproduced in any form, - without the written permission of Carbon Graphics LLC. + Graphics LLC. No part or all of this software may be reproduced in any form, + without the written permission of Carbon Graphics LLC. Exception: This Software file can be used by third-party software developers (without - using the Geo SDK libraries) for any purpose OTHER THAN loading Geo format - files into an application or executable (such as, though not limited to, + using the Geo SDK libraries) for any purpose OTHER THAN loading Geo format + files into an application or executable (such as, though not limited to, geometry Modelers & animation systems) which is primarily intended to allow for - the CREATION or MODIFICATION of geometric or animation data. - - Specifically,using this software (either all or part thereof) to aid in the - creation of a Geo format loader for a run-time system, game engine, toolkit + the CREATION or MODIFICATION of geometric or animation data. + + Specifically,using this software (either all or part thereof) to aid in the + creation of a Geo format loader for a run-time system, game engine, toolkit IG (Image Generation) System or any software where the PRIMARY purpose is real-time image playback and interactivity and not Model Creation and/or modification is permitted. -COPYRIGHT NOTICE: - +COPYRIGHT NOTICE: + Copyright © 1998-2001 Carbon Graphics Llc, ALL RIGHTS RESERVED \*===========================================================================*/ @@ -43,8 +43,8 @@ COPYRIGHT NOTICE: const float KM_TO_METERS = 1000.0f; const float CM_TO_METERS = 0.01f; const float MM_TO_METERS = 0.001f; -const float NM_TO_METERS = 1852.0f; -const float MILES_TO_METERS = 1609.344f; +const float NM_TO_METERS = 1852.0f; +const float MILES_TO_METERS = 1609.344f; const float YARDS_TO_METERS = 0.9144f; const float FEET_TO_METERS = 0.3048f; const float INCHES_TO_METERS= 0.0254f; @@ -64,7 +64,7 @@ const float FEET_TO_YARDS = 0.333333333f; const float FEET_TO_CM = 30.48f; const float FEET_TO_INCHES = 12.0f; const float INCHES_TO_FEET = 0.083333333f; -const float INCHES_TO_CM = 2.54f; +const float INCHES_TO_CM = 2.54f; const float MPH_TO_FPS = 1.4667f; const float MPH_TO_MPS = 0.447f; diff --git a/src/osgPlugins/geo/geoVersion.h b/src/osgPlugins/geo/geoVersion.h index 38edc8f0f..cac5b6360 100644 --- a/src/osgPlugins/geo/geoVersion.h +++ b/src/osgPlugins/geo/geoVersion.h @@ -9,18 +9,18 @@ ------------------------------------------------------------------------- -PROPRIETARY RIGHTS NOTICE: - - This software contains proprietary information and trade secrets of Carbon - Graphics LLC. No part or all of this software may be reproduced in any - form, without the written permission of Carbon Graphics LLC. +PROPRIETARY RIGHTS NOTICE: - This software file can only be used in conjunction with the Geo SDK & - libraries to create Plugin modules for the Geo 3D Modeling & Animation + This software contains proprietary information and trade secrets of Carbon + Graphics LLC. No part or all of this software may be reproduced in any + form, without the written permission of Carbon Graphics LLC. + + This software file can only be used in conjunction with the Geo SDK & + libraries to create Plugin modules for the Geo 3D Modeling & Animation package. -COPYRIGHT NOTICE: - +COPYRIGHT NOTICE: + Copyright © 1998-2001 Carbon Graphics Llc, ALL RIGHTS RESERVED \*===========================================================================*/ @@ -35,7 +35,7 @@ COPYRIGHT NOTICE: /////////////////////////////////////////////////////////////////////////////// -// Constants for the GEO_LIB_LEVEL_VERSION +// Constants for the GEO_LIB_LEVEL_VERSION /////////////////////////////////////////////////////////////////////////////// /** Signifies a pre-alpha version of the software */ @@ -55,7 +55,7 @@ const unsigned char GEO_FULL_RELEASE = 14; /////////////////////////////////////////////////////////////////////////////// -// Constants to identify the Geo version +// Constants to identify the Geo version /////////////////////////////////////////////////////////////////////////////// /** this constant specifies the Geo Major release number */ diff --git a/src/osgPlugins/geo/osgGeoAction.h b/src/osgPlugins/geo/osgGeoAction.h index 40735dd88..6b5e75b40 100644 --- a/src/osgPlugins/geo/osgGeoAction.h +++ b/src/osgPlugins/geo/osgGeoAction.h @@ -5,7 +5,7 @@ using namespace osg; -class georecord; // You don't need to know how I read a geo record, +class georecord; // You don't need to know how I read a geo record, // but objects of this class are passed to some of the parsing routines. // The values are defined in osgGeoStructs.h which is distributed with OSG. @@ -13,7 +13,7 @@ class geoBehaviour { // base class for action & math functions where var out = f public: geoBehaviour() { } virtual ~geoBehaviour() { } - virtual void doaction(osg::Node *)=0;// {} // do math or action operation + virtual void doaction(osg::Node *)=0;// {} // do math or action operation virtual bool makeBehave(const georecord *grec, const geoHeaderGeo *theHeader)=0; // pure virtual protected: @@ -76,7 +76,7 @@ public: inline double get(void) const { return varop? *varop : constant;} private: float constant; - const double *varop; // if null use constant value in maths; else + const double *varop; // if null use constant value in maths; else }; class geoArithBehaviour : public geoMathBehaviour { @@ -102,7 +102,7 @@ public: void setType(uint iact); void setTrigType(int iop); void setPeriodicType(int iop); - + virtual void doaction(osg::Node *); // do math operation virtual bool makeBehave(const georecord *grec, geoHeaderGeo *theHeader); private: @@ -123,7 +123,7 @@ public: private: float constant; optype oper; - const double *varop; // if null use constant value in maths; else + const double *varop; // if null use constant value in maths; else }; class geoRangeBehaviour :public geoMathBehaviour { @@ -181,7 +181,7 @@ private: class geoActionBehaviour : public geoBehaviour { // base class for any scenegraph changes public: geoActionBehaviour() { var=NULL; type=0;} - virtual ~geoActionBehaviour() { + virtual ~geoActionBehaviour() { var=NULL;} void setType(const unsigned int t) { type=t; } void setVar(const double *v) { var=v;} diff --git a/src/osgPlugins/geo/osgGeoAnimation.h b/src/osgPlugins/geo/osgGeoAnimation.h index 5bf9b6090..6279cfef3 100644 --- a/src/osgPlugins/geo/osgGeoAnimation.h +++ b/src/osgPlugins/geo/osgGeoAnimation.h @@ -6,7 +6,7 @@ // These functions are demonstrated in geodemo.cpp. // Consider a model as being a class (or a subroutine). The class has a 'draw' method -// supplied by OSG, and the model can be animated (parts of the model +// supplied by OSG, and the model can be animated (parts of the model // rotate, move, change colour, become invisible etc.). // // The model developer attaches 'behaviours' to parts of the model (using the Geo graphical editor) @@ -14,7 +14,7 @@ // Internal, usually time dependent variables which cannot be modified by the developer. // User variables - may be a function of other variables, defined in the editor. // External variables - the user written callback function extvarupdate sets these values on each frame of simulation. -// User & external variables may be defined as a mathematical or logical function of +// User & external variables may be defined as a mathematical or logical function of // all the variables (external variables, internal variables & user variables). // as a design rule, you should not normally attach a function to uvarupdate @@ -32,12 +32,12 @@ class geoHeader: public osg::PositionAttitudeTransform { // adds position attitude orientation for not Z up models, // plus animation variables. public: - geoHeader() { + geoHeader() { uvarupdate=NULL; extvarupdate=NULL; }; geoHeader(const geoHeader &geo,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : osg::PositionAttitudeTransform(geo,copyop) - { + { // const geoHeaderGeo *ghg=static_cast (&geo); } diff --git a/src/osgPlugins/geo/osgGeoNodes.h b/src/osgPlugins/geo/osgGeoNodes.h index fcb0e08e0..923adbd7b 100644 --- a/src/osgPlugins/geo/osgGeoNodes.h +++ b/src/osgPlugins/geo/osgGeoNodes.h @@ -19,7 +19,7 @@ public: ~geoValue() {} inline unsigned int getToken() const { return token;} inline unsigned int getFID() const { return fid;} - inline double *getVar() { + inline double *getVar() { return &(val.d);} // address of variable inline const double getVal() const { return (val.d);} void setVal(double v) { val.d=v; @@ -52,11 +52,11 @@ public: internalVars() { } internalVars(const internalVars &iv) { vars=iv.vars; } - ~internalVars() { + ~internalVars() { } void addInternalVars(const georecord &gr); void update(const osg::FrameStamp *_frameStamp); - double *getVar(const unsigned fid) { + double *getVar(const unsigned fid) { for (std::vector::iterator itr=vars.begin(); itr!=vars.end(); ++itr) @@ -92,13 +92,13 @@ public: ~userVars() {} unsigned int number() { return vars.size();} std::vector *getvars() { return &vars;} - double *getVar(const unsigned fid) { + double *getVar(const unsigned fid) { for (std::vector::iterator itr=vars.begin(); itrgetFID() == fid) return (itr->getVar()); } return NULL; } - const geoValue *getGeoVar(const unsigned fid) const { + const geoValue *getGeoVar(const unsigned fid) const { for (std::vector::const_iterator itr=vars.begin(); itrgetFID() == fid) return (&(*itr)); } @@ -118,7 +118,7 @@ public: friend inline std::ostream& operator << (std::ostream& output, const pack_colour& pc) { output << " cpalette: " <<(int)pc.cr << " " <<(int)pc.cg << " " <<(int)pc.cb << " " <<(int)pc.ca; - return output; // to enable cascading.. + return output; // to enable cascading.. } private: unsigned char cr, cg, cb, ca; @@ -132,7 +132,7 @@ class geoHeaderGeo: public geoHeader { public: geoHeaderGeo(); geoHeaderGeo(const geoHeaderGeo &geo,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + void addInternalVars(const georecord &gr) { intVars->addInternalVars(gr);} internalVars *getInternalVars(void) const { return intVars;} const std::string getVarname(const unsigned fid) const { diff --git a/src/osgPlugins/geo/osgGeoStructs.h b/src/osgPlugins/geo/osgGeoStructs.h index f7cd00578..a3350741d 100644 --- a/src/osgPlugins/geo/osgGeoStructs.h +++ b/src/osgPlugins/geo/osgGeoStructs.h @@ -477,7 +477,7 @@ public: case DB_DSK_FLOAT2_VAR: case DB_DSK_FLOAT3_VAR: case DB_DSK_FLOAT4_VAR: - + case DB_DSK_INTERNAL_VARS: case DB_DSK_LOCAL_VARS: case DB_DSK_EXTERNAL_VARS: @@ -612,7 +612,7 @@ public: case DB_DSK_BOOL_VAR: output << "Bool var" << std::endl; break; default: output << " inp record " << gr.id << std::endl; break; } - + for (geoFieldList::const_iterator itr=gr.fields.begin(); itr!=gr.fields.end(); ++itr) diff --git a/src/osgPlugins/gif/ReaderWriterGIF.cpp b/src/osgPlugins/gif/ReaderWriterGIF.cpp index 861161de4..c6195ae8e 100644 --- a/src/osgPlugins/gif/ReaderWriterGIF.cpp +++ b/src/osgPlugins/gif/ReaderWriterGIF.cpp @@ -60,39 +60,39 @@ extern "C" #define MY_GIF_DEBUG 1 -// GifImageStream class +// GifImageStream class class GifImageStream : public osg::ImageStream, public OpenThreads::Thread { public: GifImageStream() : osg::ImageStream(), _multiplier(1.0), - _currentLength(0), - _length(0), - _frameNum(0), - _dataNum(0), + _currentLength(0), + _length(0), + _frameNum(0), + _dataNum(0), _done(false) { _status=PAUSED; } virtual Object* clone() const { return new GifImageStream; } - virtual bool isSameKindAs( const Object* obj ) const + virtual bool isSameKindAs( const Object* obj ) const { return dynamic_cast(obj) != NULL; } virtual const char* className() const { return "GifImageStream"; } - virtual void play() - { - if (!isRunning()) + virtual void play() + { + if (!isRunning()) start(); - _status=PLAYING; + _status=PLAYING; } virtual void pause() { _status=PAUSED; } virtual void rewind() { setReferenceTime( 0.0 ); } - virtual void quit( bool waitForThreadToExit=true ) + virtual void quit( bool waitForThreadToExit=true ) { _done = true; if ( waitForThreadToExit ) @@ -107,7 +107,7 @@ public: virtual double getLength() const { return _length*0.01*_multiplier; } // Go to a specific position of stream - virtual void setReferenceTime( double time ) + virtual void setReferenceTime( double time ) { OpenThreads::ScopedLock lock(_mutex); @@ -130,14 +130,14 @@ public: virtual double getReferenceTime() const { return _currentLength*0.01*_multiplier; } // Speed up, slow down or back to normal (1.0) - virtual void setTimeMultiplier( double m ) + virtual void setTimeMultiplier( double m ) { OpenThreads::ScopedLock lock(_mutex); if ( m>0 ) _multiplier = m; } virtual double getTimeMultiplier() const { return _multiplier; } - + // Not used in GIF animation virtual void setVolume(float) {} virtual float getVolume() const { return 0.0f; } @@ -230,7 +230,7 @@ protected: } } - virtual ~GifImageStream() + virtual ~GifImageStream() { if( isRunning() ) quit( true ); @@ -315,11 +315,11 @@ int transparent) col = *rowdata++; /* just in case */ if (col >= colormapsize) col = 0; - + if ( col == transparent ) { // keep pixels of last image if transparent mode is on - // this is necessary for GIF animating + // this is necessary for GIF animating ptr += 3; } else @@ -500,7 +500,7 @@ GifImageStream** obj) } } - // Record gif image stream + // Record gif image stream if ( *obj && obj ) { (*obj)->addToImageStream( giffile->SWidth, giffile->SHeight, 1, 4, delaytime, buffer ); @@ -525,7 +525,7 @@ GifImageStream** obj) if (extension[0] >= 4 && extension[1] & 0x1) transparent = extension[4]; else transparent = -1; - delaytime = (extension[3]<<8)+extension[2]; // minimum unit 1/100s, so 8 here means 8/100s + delaytime = (extension[3]<<8)+extension[2]; // minimum unit 1/100s, so 8 here means 8/100s } while (extension != NULL) { @@ -564,12 +564,12 @@ GifImageStream** obj) class ReaderWriterGIF : public osgDB::ReaderWriter { public: - + ReaderWriterGIF() { supportsExtension("gif","GIF Image format"); } - + virtual const char* className() const { return "GIF Image Reader"; } ReadResult readGIFStream(std::istream& fin) const @@ -592,7 +592,7 @@ class ReaderWriterGIF : public osgDB::ReaderWriter return ReadResult("GIF loader: Out of memory error"); } - // Use GifImageStream to display animate GIFs + // Use GifImageStream to display animate GIFs if ( gifStream ) { OSG_DEBUG<<"Using GifImageStream ..."<setFileName(file); return rr; } - + virtual WriteResult writeImage(const osg::Image& img,std::ostream& fout,const osgDB::ReaderWriter::Options* options) const { return local_writeImage(fout,img,options); diff --git a/src/osgPlugins/gz/ReaderWriterGZ.cpp b/src/osgPlugins/gz/ReaderWriterGZ.cpp index 0f4d1ce72..8a917742e 100644 --- a/src/osgPlugins/gz/ReaderWriterGZ.cpp +++ b/src/osgPlugins/gz/ReaderWriterGZ.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ class ReaderWriterGZ : public osgDB::ReaderWriter { public: - + enum ObjectType { OBJECT, @@ -42,11 +42,11 @@ class ReaderWriterGZ : public osgDB::ReaderWriter }; ReaderWriterGZ(); - + ~ReaderWriterGZ(); virtual const char* className() const { return "HTTP Protocol Model Reader"; } - + virtual ReadResult openArchive(const std::string& fileName,ArchiveStatus status, unsigned int , const Options* options) const { if (status!=READ) return ReadResult(ReadResult::FILE_NOT_HANDLED); @@ -57,7 +57,7 @@ class ReaderWriterGZ : public osgDB::ReaderWriter { return readFile(OBJECT,fileName,options); } - + virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { return readFile(IMAGE,fileName,options); @@ -74,7 +74,7 @@ class ReaderWriterGZ : public osgDB::ReaderWriter } ReadResult readFile(ObjectType objectType, osgDB::ReaderWriter* rw, std::istream& fin, const osgDB::ReaderWriter::Options* options) const; - + ReadResult readFile(ObjectType objectType, const std::string& fullFileName, const osgDB::ReaderWriter::Options* options) const; @@ -83,7 +83,7 @@ class ReaderWriterGZ : public osgDB::ReaderWriter { return writeFile(OBJECT, &obj, fileName, options); } - + virtual WriteResult writeImage(const osg::Image& image, const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { return writeFile(IMAGE, &image, fileName, options); @@ -100,13 +100,13 @@ class ReaderWriterGZ : public osgDB::ReaderWriter } WriteResult writeFile(ObjectType objectType, const osg::Object* object, osgDB::ReaderWriter* rw, std::ostream& fin, const osgDB::ReaderWriter::Options* options) const; - + WriteResult writeFile(ObjectType objectType, const osg::Object* object, const std::string& fullFileName, const osgDB::ReaderWriter::Options* options) const; bool read(std::istream& fin, std::string& destination) const; bool write(std::ostream& fout, const std::string& source) const; - + }; @@ -148,7 +148,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterGZ::readFile(ObjectType objectType, osgDB::ReaderWriter* rw = 0; if (osgDB::equalCaseInsensitive(ext,"osgz")) - { + { rw = osgDB::Registry::instance()->getReaderWriterForExtension("osg"); OSG_INFO<<"osgz ReaderWriter "<getReaderWriterForExtension(baseExt); OSG_INFO< local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); osgDB::ifstream fin(fileName.c_str(), std::ios::binary|std::ios::in); if (!fin) return ReadResult::ERROR_IN_READING_FILE; - + std::string dest; read(fin, dest); @@ -207,7 +207,7 @@ osgDB::ReaderWriter::WriteResult ReaderWriterGZ::writeFile(ObjectType objectType osgDB::ReaderWriter* rw = 0; if (osgDB::equalCaseInsensitive(ext,"osgz")) - { + { rw = osgDB::Registry::instance()->getReaderWriterForExtension("osg"); OSG_NOTICE<<"osgz ReaderWriter "<getReaderWriterForExtension(baseExt); OSG_NOTICE<0) fout.write((const char*)out, have); - + if (fout.fail()) { (void)deflateEnd(&strm); diff --git a/src/osgPlugins/hdr/ReaderWriterHDR.cpp b/src/osgPlugins/hdr/ReaderWriterHDR.cpp index 159671b70..507b5a3b1 100644 --- a/src/osgPlugins/hdr/ReaderWriterHDR.cpp +++ b/src/osgPlugins/hdr/ReaderWriterHDR.cpp @@ -71,7 +71,7 @@ public: virtual ReadResult readImage(const std::string &_file, const osgDB::ReaderWriter::Options *_opts) const { std::string filepath = osgDB::findDataFile(_file, _opts); - if (filepath.empty()) + if (filepath.empty()) return ReadResult::FILE_NOT_FOUND; if (!HDRLoader::isHDRFile(filepath.c_str())) @@ -167,7 +167,7 @@ public: { internalFormat = GL_RGBA8; pixelFormat = GL_RGBA; - } else { + } else { internalFormat = GL_RGB32F_ARB; pixelFormat = GL_RGB; } @@ -214,7 +214,7 @@ public: { if (opt=="NO_YFLIP") { - // We want to YFLIP because although the file format specification + // We want to YFLIP because although the file format specification // dictates that +Y M +X N is a valid resolution line, no software (including // HDRShop!) actually recognises it; hence everything tends to be written upside down // So we flip the image first... @@ -224,8 +224,8 @@ public: { rawRGBE = true; } - /* The following are left out for the moment as - we don't really do anything with them in OSG + /* The following are left out for the moment as + we don't really do anything with them in OSG else if(opt=="GAMMA") { iss >> gamma; @@ -238,7 +238,7 @@ public: } } - + // Reject unhandled image formats if(rawRGBE==false) { diff --git a/src/osgPlugins/hdr/hdrloader.cpp b/src/osgPlugins/hdr/hdrloader.cpp index d08f65cf0..99bd18ab6 100644 --- a/src/osgPlugins/hdr/hdrloader.cpp +++ b/src/osgPlugins/hdr/hdrloader.cpp @@ -57,11 +57,11 @@ bool HDRLoader::isHDRFile(const char *_fileName) char str[10]; size_t numRead = fread(str, 10, 1, file); - + fclose(file); if (numRead<1) return false; - + if (memcmp(str, "#?RADIANCE", 10) && memcmp(str, "#?RGBE", 6)) return false; @@ -80,12 +80,12 @@ bool HDRLoader::load(const char *_fileName, const bool _rawRGBE, HDRLoaderResult size_t numRead = fread(str, 10, 1, file); - if (numRead<1) + if (numRead<1) { fclose(file); return false; } - + if (memcmp(str, "#?RADIANCE", 10)) { fseek(file, 0, SEEK_SET); diff --git a/src/osgPlugins/hdr/hdrwriter.cpp b/src/osgPlugins/hdr/hdrwriter.cpp index 9c9a52a87..5d760258c 100644 --- a/src/osgPlugins/hdr/hdrwriter.cpp +++ b/src/osgPlugins/hdr/hdrwriter.cpp @@ -1,4 +1,4 @@ -/* +/* The following code was based on code from the following location: http://www.graphics.cornell.edu/online/formats/rgbe/ @@ -8,7 +8,7 @@ developed by Greg Ward. It handles the conversions between rgbe and pixels consisting of floats. The data is assumed to be an array of floats. By default there are three floats per pixel in the order red, green, blue. - (RGBE_DATA_??? values control this.) Only the mimimal header reading and + (RGBE_DATA_??? values control this.) Only the mimimal header reading and writing is implemented. Each routine does error checking and will return a status value as defined below. This code is intended as a skeleton so feel free to modify it to suit your needs. @@ -22,7 +22,7 @@ The file format is described fully in http://radsite.lbl.gov/radiance/refer/filefmts.pdf For the moment, we don't output most of the header fields - + */ #include @@ -142,7 +142,7 @@ bool HDRWriter::writeBytesRLE(std::ostream& fout, unsigned char *data, int numby beg_run += run_count; old_run_count = run_count; run_count = 1; - while((data[beg_run] == data[beg_run + run_count]) + while((data[beg_run] == data[beg_run + run_count]) && (beg_run + run_count < numbytes) && (run_count < 127)) { @@ -197,14 +197,14 @@ bool HDRWriter::writeRLE( const osg::Image* img, std::ostream& fout) return writeNoRLE(fout,img); buffer = (unsigned char *)malloc(sizeof(unsigned char)*4*scanline_width); - if (buffer == NULL) + if (buffer == NULL) // no buffer space so write flat return writeNoRLE(fout,img); for(int row = 0; rowdata(0, row); - + rgbe[0] = 2; rgbe[1] = 2; rgbe[2] = scanline_width >> 8; diff --git a/src/osgPlugins/hdr/hdrwriter.h b/src/osgPlugins/hdr/hdrwriter.h index 9aeda1b1a..4afbf5f45 100644 --- a/src/osgPlugins/hdr/hdrwriter.h +++ b/src/osgPlugins/hdr/hdrwriter.h @@ -1,4 +1,4 @@ -/* +/* The following code was based on code from the following location: http://www.graphics.cornell.edu/online/formats/rgbe/ @@ -8,7 +8,7 @@ developed by Greg Ward. It handles the conversions between rgbe and pixels consisting of floats. The data is assumed to be an array of floats. By default there are three floats per pixel in the order red, green, blue. - (RGBE_DATA_??? values control this.) Only the mimimal header reading and + (RGBE_DATA_??? values control this.) Only the mimimal header reading and writing is implemented. Each routine does error checking and will return a status value as defined below. This code is intended as a skeleton so feel free to modify it to suit your needs. @@ -42,7 +42,7 @@ protected: static bool writeNoRLE( std::ostream& fout, const osg::Image* image); static bool writePixelsRAW( std::ostream& fout, unsigned char* data, int numpixels); -// read or write run length encoded files +// read or write run length encoded files // must be called to read or write whole scanlines static bool writeBytesRLE(std::ostream& fout, unsigned char *data, int numbytes); diff --git a/src/osgPlugins/imageio/ReaderWriterImageIO.cpp b/src/osgPlugins/imageio/ReaderWriterImageIO.cpp index 11c4efe0f..1712fd7ab 100644 --- a/src/osgPlugins/imageio/ReaderWriterImageIO.cpp +++ b/src/osgPlugins/imageio/ReaderWriterImageIO.cpp @@ -41,7 +41,7 @@ /************************************************************** ***** Begin Callback functions for istream block reading ***** **************************************************************/ - + // This callback reads some bytes from an istream and copies it // to a Quartz buffer (supplied by Apple framework). size_t MyProviderGetBytesCallback(void* istream_userdata, void* quartz_buffer, size_t the_count) @@ -140,7 +140,7 @@ CGImageRef CreateCGImageFromDataStream(std::istream& fin) MyProviderRewindCallback, MyProviderReleaseInfoCallback }; - + CGDataProviderRef data_provider = CGDataProviderCreateSequential(&fin, &provider_callbacks); @@ -153,7 +153,7 @@ CGImageRef CreateCGImageFromDataStream(std::istream& fin) MyProviderRewindCallback, MyProviderReleaseInfoCallback }; - + CGDataProviderRef data_provider = CGDataProviderCreate(&fin, &provider_callbacks); #endif // If we had a way of hinting at what the data type is, we could @@ -169,7 +169,7 @@ CGImageRef CreateCGImageFromDataStream(std::istream& fin) } image_ref = CGImageSourceCreateImageAtIndex(source_ref, 0, NULL); - + /* Don't need the SourceRef any more (error or not) */ CFRelease(source_ref); @@ -197,10 +197,10 @@ CGImageRef CreateCGImageFromFile(const char* the_path) OSG_WARN << "CreateCGImageFromFile :: could not create CCFSTring" << std::endl; return NULL; } - + /* Create a CFURL from a CFString */ the_url = CFURLCreateWithFileSystemPath( - NULL, + NULL, cf_string, kCFURLPOSIXPathStyle, false @@ -208,14 +208,14 @@ CGImageRef CreateCGImageFromFile(const char* the_path) /* Don't need the CFString any more (error or not) */ CFRelease(cf_string); - + if(!the_url) { OSG_WARN << "CreateCGImageFromFile :: could not create CFUrl" << std::endl; return NULL; } - + source_ref = CGImageSourceCreateWithURL(the_url, NULL); /* Don't need the URL any more (error or not) */ CFRelease(the_url); @@ -232,7 +232,7 @@ CGImageRef CreateCGImageFromFile(const char* the_path) if (!image_ref) { OSG_WARN << "CreateCGImageFromFile :: could not get Image" << std::endl; } - + /* Don't need the SourceRef any more (error or not) */ CFRelease(source_ref); @@ -258,13 +258,13 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) size_t bytes_per_row = CGImageGetBytesPerRow(image_ref); // size_t bits_per_component = CGImageGetBitsPerComponent(image_ref); size_t bits_per_component = 8; - + CGImageAlphaInfo alpha_info = CGImageGetAlphaInfo(image_ref); - + GLint internal_format; GLenum pixel_format; GLenum data_type; - + void* image_data = calloc(the_width * 4, the_height); CGColorSpaceRef color_space; @@ -288,7 +288,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) internal_format = GL_RGBA8; pixel_format = GL_BGRA_EXT; data_type = GL_UNSIGNED_INT_8_8_8_8_REV; - + bytes_per_row = the_width*4; // color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); color_space = CGColorSpaceCreateDeviceRGB(); @@ -297,7 +297,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) bitmap_info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Big; /* XRGB Big Endian */ #else bitmap_info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little; /* XRGB Little Endian */ -#endif +#endif } else { @@ -324,13 +324,13 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) bitmap_info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big; /* XRGB Big Endian */ #else bitmap_info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little; /* XRGB Little Endian */ -#endif +#endif break; } // // Tatsuhiro Nishioka // 16 bpp grayscale (8 bit white and 8 bit alpha) causes invalid argument combination - // in CGBitmapContextCreate. + // in CGBitmapContextCreate. // I guess it is safer to handle 16 bit grayscale image as 32-bit RGBA image. // It works at least on FlightGear // @@ -341,7 +341,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) internal_format = GL_RGBA8; pixel_format = GL_BGRA_EXT; data_type = GL_UNSIGNED_INT_8_8_8_8_REV; - + bytes_per_row = the_width*4; // color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); color_space = CGColorSpaceCreateDeviceRGB(); @@ -351,7 +351,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) bitmap_info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Big; /* XRGB Big Endian */ #else bitmap_info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little; /* XRGB Little Endian */ -#endif +#endif break; } default: @@ -362,7 +362,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) } } - + // Sets up a context to be drawn to with image_data as the area to be drawn to CGContextRef bitmap_context = CGBitmapContextCreate( image_data, @@ -373,31 +373,31 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) color_space, bitmap_info ); - + // Draws the image into the context's image_data CGContextDrawImage(bitmap_context, the_rect, image_ref); CGContextRelease(bitmap_context); - // + // // Reverse the premultiplied alpha for avoiding unexpected darker edges // by Tatsuhiro Nishioka (based on SDL's workaround on the similar issue) // http://bugzilla.libsdl.org/show_bug.cgi?id=868 - // + // if (bits_per_pixel > 8 && (bitmap_info & kCGBitmapAlphaInfoMask) == kCGImageAlphaPremultipliedFirst) { int i, j; GLubyte *pixels = (GLubyte *)image_data; for (i = the_height * the_width; i--; ) { - + #if __BIG_ENDIAN__ // That value is a temporary one and only needed for endianess conversion GLuint *value = (GLuint *)pixels; - // + // // swap endian of each pixel for avoiding weird colors on ppc macs // by Tatsuhiro Nishioka - // FIXME: I've tried many combinations of pixel_format, internal_format, and data_type + // FIXME: I've tried many combinations of pixel_format, internal_format, and data_type // but none worked well. Therefore I tried endian swapping, which seems working with gif,png,tiff,tga,and psd. - // (for grayscaled tga and non-power-of-two tga, I can't guarantee since test images (made with Gimp) + // (for grayscaled tga and non-power-of-two tga, I can't guarantee since test images (made with Gimp) // get corrupted on Preview.app ... *value = ((*value) >> 24) | (((*value) << 8) & 0x00FF0000) | (((*value) >> 8) & 0x0000FF00) | ((*value) << 24); #endif @@ -419,7 +419,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) // data_type = GL_UNSIGNED_BYTE; osg::Image* osg_image = new osg::Image; - + osg_image->setImage( the_width, the_height, @@ -459,7 +459,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) * least `(width * bitsPerComponent * number of components + 7)/8' bytes. */ size_t target_bytes_per_row; - + CGColorSpaceRef color_space; CGBitmapInfo bitmap_info; /* From what I can figure out so far... @@ -476,7 +476,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) * we don't want to touch the data, so again we turn to the vImage framework * and invert the data. */ - vImage_Buffer vimage_buffer_in = + vImage_Buffer vimage_buffer_in = { (void*)osg_image.data(), // need to override const, but we don't modify the data so it's safe image_height, @@ -491,7 +491,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) image_height, image_width, 0 // will fill-in in switch - }; + }; vImage_Error vimage_error_flag; // FIXME: Do I want to use format, type, or internalFormat? @@ -506,9 +506,9 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) { return NULL; } - + // out_image_data = calloc(target_bytes_per_row, image_height); - out_image_data = malloc(target_bytes_per_row * image_height); + out_image_data = malloc(target_bytes_per_row * image_height); if(NULL == out_image_data) { OSG_WARN << "In CreateCGImageFromOSGData, malloc failed" << std::endl; @@ -531,7 +531,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) free(out_image_data); CGColorSpaceRelease(color_space); return NULL; - } + } break; @@ -544,9 +544,9 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) // http://developer.apple.com/qa/qa2001/qa1037.html // colorSpace=NULL is for alpha only color_space = NULL; - + // out_image_data = calloc(target_bytes_per_row, image_height); - out_image_data = malloc(target_bytes_per_row * image_height); + out_image_data = malloc(target_bytes_per_row * image_height); if(NULL == out_image_data) { OSG_WARN << "In CreateCGImageFromOSGData, malloc failed" << std::endl; @@ -567,7 +567,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) OSG_WARN << "In CreateCGImageFromOSGData for GL_ALPHA, vImageVerticalReflect_Planar8 failed with vImage Error Code: " << vimage_error_flag << std::endl; free(out_image_data); return NULL; - } + } break; @@ -590,9 +590,9 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) OSG_WARN << "In CreateCGImageFromOSGData, CGColorSpaceCreateWithName failed" << std::endl; return NULL; } - + // out_image_data = calloc(target_bytes_per_row, image_height); - out_image_data = malloc(target_bytes_per_row * image_height); + out_image_data = malloc(target_bytes_per_row * image_height); if(NULL == out_image_data) { OSG_WARN << "In CreateCGImageFromOSGData, malloc failed" << std::endl; @@ -630,8 +630,8 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) free(out_image_data); CGColorSpaceRelease(color_space); return NULL; - } - + } + break; } case GL_RGBA: @@ -645,7 +645,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) return NULL; } // out_image_data = calloc(target_bytes_per_row, image_height); - out_image_data = malloc(target_bytes_per_row * image_height); + out_image_data = malloc(target_bytes_per_row * image_height); if(NULL == out_image_data) { OSG_WARN << "In CreateCGImageFromOSGData, malloc failed" << std::endl; @@ -666,7 +666,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) free(out_image_data); CGColorSpaceRelease(color_space); return NULL; - } + } break; } case GL_BGRA: @@ -677,7 +677,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) bitmap_info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Big; /* XRGB Big Endian */ #else bitmap_info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little; /* XRGB Little Endian */ -#endif +#endif } else { @@ -693,7 +693,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) return NULL; } // out_image_data = calloc(target_bytes_per_row, image_height); - out_image_data = malloc(target_bytes_per_row * image_height); + out_image_data = malloc(target_bytes_per_row * image_height); if(NULL == out_image_data) { OSG_WARN << "In CreateCGImageFromOSGData, malloc failed" << std::endl; @@ -714,7 +714,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) free(out_image_data); CGColorSpaceRelease(color_space); return NULL; - } + } break; } // FIXME: Handle other cases. @@ -744,7 +744,7 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image) free(out_image_data); return NULL; } - + /* Make an image out of our bitmap; does a cheap vm_copy of the bitmap */ CGImageRef image_ref = CGBitmapContextCreateImage(bitmap_context); @@ -781,23 +781,23 @@ CGImageDestinationRef CreateCGImageDestinationFromFile(const char* the_path, co { return NULL; } - + /* Create a CFURL from a CFString */ the_url = CFURLCreateWithFileSystemPath( - NULL, + NULL, cf_string, kCFURLPOSIXPathStyle, false ); - + /* Don't need the CFString any more (error or not) */ CFRelease(cf_string); - + if(!the_url) { return NULL; } - + if(the_options) { std::istringstream iss(the_options->getOptionString()); @@ -805,14 +805,14 @@ CGImageDestinationRef CreateCGImageDestinationFromFile(const char* the_path, co while (iss >> opt) { // Not handled: The user could do something stupid and specify both PNG and JPEG options. - + if(opt=="PNG_COMPRESSION") { found_png_option = true; // I don't see an option to set PNG compression levels in the API so this info is unused. int level; iss >> level; - + } else if(opt=="JPEG_QUALITY") { @@ -826,7 +826,7 @@ CGImageDestinationRef CreateCGImageDestinationFromFile(const char* the_path, co } } } - + CFStringRef path_extension = CFURLCopyPathExtension(the_url); if(NULL == path_extension) @@ -858,15 +858,15 @@ CGImageDestinationRef CreateCGImageDestinationFromFile(const char* the_path, co CFRelease(path_extension); } - + dest_ref = CGImageDestinationCreateWithURL( - the_url, - uti_type, + the_url, + uti_type, 1, // image file will contain only one image NULL ); - + CFRelease(uti_type); CFRelease(the_url); @@ -878,20 +878,20 @@ CGImageDestinationRef CreateCGImageDestinationFromFile(const char* the_path, co CFStringRef the_keys[1]; CFNumberRef the_values[1]; CFDictionaryRef the_dict; - + the_keys[0] = kCGImageDestinationLossyCompressionQuality; the_values[0] = CFNumberCreate( NULL, kCFNumberFloat32Type, &compression_quality ); - + the_dict = CFDictionaryCreate(NULL, (const void**)&the_keys, (const void**)&the_values, 1, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFRelease(the_values[0]); // Now that we have the dict, actually set the property. CGImageDestinationSetProperties(dest_ref, the_dict); - + CFRelease(the_dict); } @@ -908,13 +908,13 @@ CGImageDestinationRef CreateCGImageDestinationFromDataStream(std::ostream& fout, bool found_png_option = false; bool found_jpeg_option = false; float compression_quality = 1.0f; - + CGDataConsumerCallbacks consumer_callbacks = { MyConsumerPutBytesCallback, MyConsumerReleaseInfoCallback }; - + CGDataConsumerRef data_consumer = CGDataConsumerCreate(&fout, &consumer_callbacks); if(the_options) @@ -924,14 +924,14 @@ CGImageDestinationRef CreateCGImageDestinationFromDataStream(std::ostream& fout, while (iss >> opt) { // Not handled: The user could do something stupid and specify both PNG and JPEG options. - + if(opt=="PNG_COMPRESSION") { found_png_option = true; // I don't see an option to set PNG compression levels in the API so this info is unused. int level; iss >> level; - + } else if(opt=="JPEG_QUALITY") { @@ -945,7 +945,7 @@ CGImageDestinationRef CreateCGImageDestinationFromDataStream(std::ostream& fout, } } } - + if(found_jpeg_option) { @@ -963,7 +963,7 @@ CGImageDestinationRef CreateCGImageDestinationFromDataStream(std::ostream& fout, kUTTypeImage // "public.image" ); } - + // If we had a way of hinting at what the data type is, we could // pass this hint in the second parameter. @@ -973,11 +973,11 @@ CGImageDestinationRef CreateCGImageDestinationFromDataStream(std::ostream& fout, 1, // image file will contain only one image NULL ); - + CGDataConsumerRelease(data_consumer); CFRelease(uti_type); - - + + // Not handled: The user could do something stupid and specify both PNG and JPEG options. if(found_jpeg_option) { @@ -985,23 +985,23 @@ CGImageDestinationRef CreateCGImageDestinationFromDataStream(std::ostream& fout, CFStringRef the_keys[1]; CFNumberRef the_values[1]; CFDictionaryRef the_dict; - + the_keys[0] = kCGImageDestinationLossyCompressionQuality; the_values[0] = CFNumberCreate( NULL, kCFNumberFloat32Type, &compression_quality ); - + the_dict = CFDictionaryCreate(NULL, (const void**)&the_keys, (const void**)&the_values, 1, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFRelease(the_values[0]); - + // Now that we have the dict, actually set the property. CGImageDestinationSetProperties(dest_ref, the_dict); - + CFRelease(the_dict); } - + return dest_ref; } /************************************************************** @@ -1017,12 +1017,12 @@ public: ReaderWriterImageIO() { - supportsExtension("jpg", "jpg image file"); + supportsExtension("jpg", "jpg image file"); supportsExtension("jpeg", "jpeg image file"); supportsExtension("jpe", "jpe image file"); supportsExtension("jp2", "jp2 image file"); - supportsExtension("tiff", "tiff image file"); - supportsExtension("tif", "tif image file"); + supportsExtension("tiff", "tiff image file"); + supportsExtension("tif", "tif image file"); supportsExtension("gif", "gif image file"); supportsExtension("png", "png image file"); supportsExtension("pict", "pict image file"); @@ -1035,14 +1035,14 @@ public: supportsExtension("tga", "tga image file"); supportsExtension("targa", "targa image file"); supportsExtension("psd", "psd image file"); - + supportsExtension("pdf", "pdf image file"); supportsExtension("eps", "eps image file"); supportsExtension("epi", "epi image file"); supportsExtension("epsf", "epsf image file"); supportsExtension("epsi", "epsi image file"); supportsExtension("ps", "postscript image file"); - + supportsExtension("dng", "dng image file"); supportsExtension("cr2", "cr2 image file"); supportsExtension("crw", "crw image file"); @@ -1083,12 +1083,12 @@ public: // Apple's UTI guide: // http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html return - osgDB::equalCaseInsensitive(extension,"jpg") || + osgDB::equalCaseInsensitive(extension,"jpg") || osgDB::equalCaseInsensitive(extension,"jpeg") || osgDB::equalCaseInsensitive(extension,"jpe") || osgDB::equalCaseInsensitive(extension,"jp2") || - osgDB::equalCaseInsensitive(extension,"tiff") || - osgDB::equalCaseInsensitive(extension,"tif") || + osgDB::equalCaseInsensitive(extension,"tiff") || + osgDB::equalCaseInsensitive(extension,"tif") || osgDB::equalCaseInsensitive(extension,"gif") || osgDB::equalCaseInsensitive(extension,"png") || osgDB::equalCaseInsensitive(extension,"pict") || @@ -1101,14 +1101,14 @@ public: osgDB::equalCaseInsensitive(extension,"tga") || osgDB::equalCaseInsensitive(extension,"targa") || osgDB::equalCaseInsensitive(extension,"psd") || - + osgDB::equalCaseInsensitive(extension,"pdf") || osgDB::equalCaseInsensitive(extension,"eps") || osgDB::equalCaseInsensitive(extension,"epi") || osgDB::equalCaseInsensitive(extension,"epsf") || osgDB::equalCaseInsensitive(extension,"epsi") || osgDB::equalCaseInsensitive(extension,"ps") || - + osgDB::equalCaseInsensitive(extension,"dng") || osgDB::equalCaseInsensitive(extension,"cr2") || osgDB::equalCaseInsensitive(extension,"crw") || @@ -1135,7 +1135,7 @@ public: } - + ReadResult readImageStream(std::istream& fin) const { // Call ImageIO to load the image. @@ -1144,7 +1144,7 @@ public: // Create an osg::Image from the CGImageRef. osg::Image* osg_image = CreateOSGImageFromCGImage(cg_image_ref); - + CFRelease(cg_image_ref); return osg_image; } @@ -1154,18 +1154,18 @@ public: ReadResult read_result = readImageStream(fin); return read_result; } - + ReadResult readImageFile(const std::string& file_name) const { OSG_INFO << "imageio readImageFile: " << file_name << std::endl; - + // Call ImageIO to load the image. CGImageRef cg_image_ref = CreateCGImageFromFile(file_name.c_str()); if (NULL == cg_image_ref) return ReadResult::FILE_NOT_FOUND; // Create an osg::Image from the CGImageRef. osg::Image* osg_image = CreateOSGImageFromCGImage(cg_image_ref); - + CFRelease(cg_image_ref); return osg_image; @@ -1182,7 +1182,7 @@ public: #if 1 ReadResult read_result = readImageFile(full_file_name); #else - // Only here to help test istream backend. The file version is better because + // Only here to help test istream backend. The file version is better because // the filenname.extension could potentially be used by ImageIO to hint what the format type is. osgDB::ifstream istream(full_file_name.c_str(), std::ios::in | std::ios::binary); if(!istream) return ReadResult::FILE_NOT_HANDLED; @@ -1208,14 +1208,14 @@ public: CGImageDestinationRef cg_dest_ref = CreateCGImageDestinationFromDataStream(fout, the_options); if (NULL == cg_dest_ref) return WriteResult::ERROR_IN_WRITING_FILE; - + CGImageRef cg_image_ref = CreateCGImageFromOSGData(osg_image); if(NULL == cg_image_ref) { CFRelease(cg_dest_ref); return WriteResult::ERROR_IN_WRITING_FILE; } - + CGImageDestinationAddImage(cg_dest_ref, cg_image_ref, NULL); if(CGImageDestinationFinalize(cg_dest_ref)) { @@ -1225,13 +1225,13 @@ public: { ret_val = WriteResult::ERROR_IN_WRITING_FILE; } - + CFRelease(cg_image_ref); CFRelease(cg_dest_ref); - - return WriteResult::FILE_SAVED; + + return WriteResult::FILE_SAVED; } - + virtual WriteResult writeImage(const osg::Image& osg_image, std::ostream& fout, const osgDB::ReaderWriter::Options* the_options) const { WriteResult write_result = writeImageStream(osg_image, fout, the_options); @@ -1267,10 +1267,10 @@ public: { ret_val = WriteResult::ERROR_IN_WRITING_FILE; } - + CFRelease(cg_image_ref); CFRelease(cg_dest_ref); - + return WriteResult::FILE_SAVED; } @@ -1291,12 +1291,12 @@ public: full_file_name = file_name; return writeImageFile(osg_image, full_file_name, the_options); #else - // Only here to help test ostream backend. The file version is better because + // Only here to help test ostream backend. The file version is better because // the filenname.extension could potentially be used by ImageIO to hint what the format type is. osgDB::ofstream fout(file_name.c_str(), std::ios::out | std::ios::binary); if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; return writeImage(osg_image, fout, the_options); -#endif +#endif } }; diff --git a/src/osgPlugins/imageio/ReaderWriterImageIO_IOS.cpp b/src/osgPlugins/imageio/ReaderWriterImageIO_IOS.cpp index a8c7c7ba3..cc8c969ba 100644 --- a/src/osgPlugins/imageio/ReaderWriterImageIO_IOS.cpp +++ b/src/osgPlugins/imageio/ReaderWriterImageIO_IOS.cpp @@ -98,7 +98,7 @@ CGImageRef CreateCGImageFromDataStream(std::istream& fin) ); source_ref = CGImageSourceCreateWithData(the_cf_data, NULL); */ - + CGDataProviderSequentialCallbacks provider_callbacks = { 0, @@ -107,44 +107,44 @@ CGImageRef CreateCGImageFromDataStream(std::istream& fin) MyProviderRewindCallback, MyProviderReleaseInfoCallback }; - + CGDataProviderRef data_provider = CGDataProviderCreateSequential(&fin, &provider_callbacks); - + // If we had a way of hinting at what the data type is, we could // pass this hint in the second parameter. source_ref = CGImageSourceCreateWithDataProvider(data_provider, NULL); - + CGDataProviderRelease(data_provider); - - + + if(!source_ref) { return NULL; } - + image_ref = CGImageSourceCreateImageAtIndex(source_ref, 0, NULL); - + /* Don't need the SourceRef any more (error or not) */ CFRelease(source_ref); - + return image_ref; } static NSString* toNSString(const std::string& text, NSStringEncoding nsse) { NSString* nstr = nil; - + if (!text.empty()) { nstr = [NSString stringWithCString:text.c_str() encoding:nsse]; //nstr = [NSString stringWithUTF8String:text.c_str()];// encoding:nsse] } - + if (nstr == nil) { nstr = @""; } - + return nstr; } @@ -166,10 +166,10 @@ osg::Image* ReadCoreGraphicsImageFromFile(std::string file) //std::string strPath = osgDB::getFilePath(file); //std::string strName = osgDB::getStrippedName(file); //std::string strFile = strPath + "/" + strName; - - //NSString* path = [NSString stringWithCString:strName.c_str() encoding:NSUTF8StringEncoding]; - //NSString* ext = [NSString stringWithCString:strExt.c_str() encoding:NSUTF8StringEncoding]; - + + //NSString* path = [NSString stringWithCString:strName.c_str() encoding:NSUTF8StringEncoding]; + //NSString* ext = [NSString stringWithCString:strExt.c_str() encoding:NSUTF8StringEncoding]; + //CGImageRef textureImage = [UIImage imageNamed:path].CGImage; //CGImageRef textureImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:path ofType:ext]].CGImage; NSString* path = [NSString stringWithCString:file.c_str() encoding:NSUTF8StringEncoding]; @@ -186,8 +186,8 @@ osg::Image* ReadCoreGraphicsImageFromFile(std::string file) [pool release]; return NULL; } - - size_t texWidth = CGImageGetWidth(textureImage); + + size_t texWidth = CGImageGetWidth(textureImage); size_t texHeight = CGImageGetHeight(textureImage); GLubyte *textureData = (GLubyte *)malloc(texWidth * texHeight * 4); if (!textureData) { @@ -204,7 +204,7 @@ osg::Image* ReadCoreGraphicsImageFromFile(std::string file) return NULL; } - CGContextRef textureContext = CGBitmapContextCreate(textureData, + CGContextRef textureContext = CGBitmapContextCreate(textureData, texWidth, texHeight, 8, texWidth * 4, csref, @@ -216,13 +216,13 @@ osg::Image* ReadCoreGraphicsImageFromFile(std::string file) [pool release]; return NULL; } - + //copy into texturedata CGContextDrawImage(textureContext, CGRectMake(0.0f, 0.0f, (float)texWidth, (float)texHeight), textureImage); CGContextRelease(textureContext); - + //create the osg image int s = texWidth; int t = texHeight; @@ -233,19 +233,19 @@ osg::Image* ReadCoreGraphicsImageFromFile(std::string file) GL_UNSIGNED_BYTE, textureData, osg::Image::USE_MALLOC_FREE); - + //flip vertical image->flipVertical(); - - // + + // // Reverse the premultiplied alpha for avoiding unexpected darker edges // by Tatsuhiro Nishioka (based on SDL's workaround on the similar issue) // http://bugzilla.libsdl.org/show_bug.cgi?id=868 - // + // int i, j; GLubyte *pixels = (GLubyte *)image->data(); for (i = image->t() * image->s(); i--; ) { - + GLubyte alpha = pixels[3]; if (alpha && (alpha < 255)) { for (j = 0; j < 3; ++j) { @@ -268,7 +268,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef textureImage) return NULL; } - size_t texWidth = CGImageGetWidth(textureImage); + size_t texWidth = CGImageGetWidth(textureImage); size_t texHeight = CGImageGetHeight(textureImage); GLubyte *textureData = (GLubyte *)malloc(texWidth * texHeight * 4); @@ -277,7 +277,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef textureImage) [pool release]; return NULL; } - + CGColorSpaceRef csref = CGColorSpaceCreateDeviceRGB(); if (!csref) { NSLog(@"imageio: failed to create CGColorSpaceRef.\n"); @@ -286,7 +286,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef textureImage) return NULL; } - CGContextRef textureContext = CGBitmapContextCreate(textureData, + CGContextRef textureContext = CGBitmapContextCreate(textureData, texWidth, texHeight, 8, texWidth * 4, csref, @@ -298,15 +298,15 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef textureImage) [pool release]; return NULL; } - + //copy into texturedata CGContextDrawImage(textureContext, CGRectMake(0.0f, 0.0f, (float)texWidth, (float)texHeight), textureImage); - CGContextFlush(textureContext); + CGContextFlush(textureContext); CGContextRelease(textureContext); - - + + //create the osg image int s = texWidth; int t = texHeight; @@ -317,21 +317,21 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef textureImage) GL_UNSIGNED_BYTE, textureData, osg::Image::USE_MALLOC_FREE); - + //flip vertical image->flipVertical(); - - // + + // // Reverse the premultiplied alpha for avoiding unexpected darker edges // by Tatsuhiro Nishioka (based on SDL's workaround on the similar issue) // http://bugzilla.libsdl.org/show_bug.cgi?id=868 - // - - + // + + int i, j; GLubyte *pixels = (GLubyte *)image->data(); for (i = image->t() * image->s(); i--; ) { - + GLubyte alpha = pixels[3]; if (alpha && (alpha < 255)) { for (j = 0; j < 3; ++j) { @@ -351,13 +351,13 @@ class ReaderWriterImageIO : public osgDB::ReaderWriter public: ReaderWriterImageIO() { - - supportsExtension("jpg", "jpg image file"); + + supportsExtension("jpg", "jpg image file"); supportsExtension("jpeg", "jpeg image file"); supportsExtension("jpe", "jpe image file"); supportsExtension("jp2", "jp2 image file"); - supportsExtension("tiff", "tiff image file"); - supportsExtension("tif", "tif image file"); + supportsExtension("tiff", "tiff image file"); + supportsExtension("tif", "tif image file"); supportsExtension("gif", "gif image file"); supportsExtension("png", "png image file"); supportsExtension("pict", "pict image file"); @@ -370,14 +370,14 @@ public: supportsExtension("tga", "tga image file"); supportsExtension("targa", "targa image file"); supportsExtension("psd", "psd image file"); - + supportsExtension("pdf", "pdf image file"); supportsExtension("eps", "eps image file"); supportsExtension("epi", "epi image file"); supportsExtension("epsf", "epsf image file"); supportsExtension("epsi", "epsi image file"); supportsExtension("ps", "postscript image file"); - + supportsExtension("dng", "dng image file"); supportsExtension("cr2", "cr2 image file"); supportsExtension("crw", "crw image file"); @@ -399,13 +399,13 @@ public: supportsExtension("srf", "srf image file"); supportsExtension("cur", "cur image file"); supportsExtension("xbm", "xbm image file"); - + supportsExtension("raw", "raw image file"); } - + virtual const char* className() const { return "Mac OS X ImageIO based Image Reader/Writer"; } - - + + virtual bool acceptsExtension(const std::string& extension) const { // ImageIO speaks in UTIs. @@ -418,12 +418,12 @@ public: // Apple's UTI guide: // http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html return - osgDB::equalCaseInsensitive(extension,"jpg") || + osgDB::equalCaseInsensitive(extension,"jpg") || osgDB::equalCaseInsensitive(extension,"jpeg") || osgDB::equalCaseInsensitive(extension,"jpe") || osgDB::equalCaseInsensitive(extension,"jp2") || - osgDB::equalCaseInsensitive(extension,"tiff") || - osgDB::equalCaseInsensitive(extension,"tif") || + osgDB::equalCaseInsensitive(extension,"tiff") || + osgDB::equalCaseInsensitive(extension,"tif") || osgDB::equalCaseInsensitive(extension,"gif") || osgDB::equalCaseInsensitive(extension,"png") || osgDB::equalCaseInsensitive(extension,"pict") || @@ -436,14 +436,14 @@ public: osgDB::equalCaseInsensitive(extension,"tga") || osgDB::equalCaseInsensitive(extension,"targa") || osgDB::equalCaseInsensitive(extension,"psd") || - + osgDB::equalCaseInsensitive(extension,"pdf") || osgDB::equalCaseInsensitive(extension,"eps") || osgDB::equalCaseInsensitive(extension,"epi") || osgDB::equalCaseInsensitive(extension,"epsf") || osgDB::equalCaseInsensitive(extension,"epsi") || osgDB::equalCaseInsensitive(extension,"ps") || - + osgDB::equalCaseInsensitive(extension,"dng") || osgDB::equalCaseInsensitive(extension,"cr2") || osgDB::equalCaseInsensitive(extension,"crw") || @@ -465,35 +465,35 @@ public: osgDB::equalCaseInsensitive(extension,"srf") || osgDB::equalCaseInsensitive(extension,"cur") || osgDB::equalCaseInsensitive(extension,"xbm") || - + osgDB::equalCaseInsensitive(extension,"raw"); } - - - + + + ReadResult readImageStream(std::istream& fin) const { // Call ImageIO to load the image. CGImageRef cg_image_ref = CreateCGImageFromDataStream(fin); if (NULL == cg_image_ref) return ReadResult::FILE_NOT_FOUND; - + // Create an osg::Image from the CGImageRef. osg::Image* osg_image = CreateOSGImageFromCGImage(cg_image_ref); - + CFRelease(cg_image_ref); return osg_image; } - + virtual ReadResult readImage(std::istream& fin, const osgDB::ReaderWriter::Options* the_options = NULL) const { ReadResult read_result = readImageStream(fin); return read_result; } - + ReadResult readImageFile(const std::string& file_name) const { //osg::notify(osg::INFO) << "imageio readImageFile: " << file_name << std::endl; - + // Create an osg::Image from the CGImageRef. osg::Image* osg_image = ReadCoreGraphicsImageFromFile(file_name); @@ -511,7 +511,7 @@ public: #if 1 ReadResult read_result = readImageFile(full_file_name); #else - // Only here to help test istream backend. The file version is better because + // Only here to help test istream backend. The file version is better because // the filenname.extension could potentially be used by ImageIO to hint what the format type is. std::ifstream istream(full_file_name.c_str(), std::ios::in | std::ios::binary); if(!istream) return ReadResult::FILE_NOT_HANDLED; @@ -530,7 +530,7 @@ public: { WriteResult ret_val = WriteResult::ERROR_IN_WRITING_FILE; - return WriteResult::FILE_SAVED; + return WriteResult::FILE_SAVED; } virtual WriteResult writeImage(const osg::Image& osg_image, std::ostream& fout, const osgDB::ReaderWriter::Options* the_options) const @@ -542,7 +542,7 @@ public: WriteResult writeImageFile(const osg::Image& osg_image, const std::string& full_file_name, const osgDB::ReaderWriter::Options* the_options) const { WriteResult ret_val = WriteResult::ERROR_IN_WRITING_FILE; - + return WriteResult::FILE_SAVED; } @@ -557,12 +557,12 @@ public: full_file_name = file_name; return writeImageFile(osg_image, full_file_name, the_options); #else - // Only here to help test ostream backend. The file version is better because + // Only here to help test ostream backend. The file version is better because // the filenname.extension could potentially be used by ImageIO to hint what the format type is. std::ofstream fout(file_name.c_str(), std::ios::out | std::ios::binary); if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; return writeImage(osg_image, fout, the_options); -#endif +#endif } }; diff --git a/src/osgPlugins/ive/AnimationPathCallback.cpp b/src/osgPlugins/ive/AnimationPathCallback.cpp index fdd923845..b2f42c8a5 100644 --- a/src/osgPlugins/ive/AnimationPathCallback.cpp +++ b/src/osgPlugins/ive/AnimationPathCallback.cpp @@ -61,7 +61,7 @@ void AnimationPathCallback::read(DataInputStream* in){ } else in_THROW_EXCEPTION("AnimationPathCallback::read(): Could not cast this osg::AnimationPathCallback to an osg::Object."); - + // Read AnimationPathCallback's properties _pivotPoint = in->readVec3(); _timeOffset = in->readDouble(); diff --git a/src/osgPlugins/ive/AutoTransform.cpp b/src/osgPlugins/ive/AutoTransform.cpp index 11fde9473..16819ab6b 100644 --- a/src/osgPlugins/ive/AutoTransform.cpp +++ b/src/osgPlugins/ive/AutoTransform.cpp @@ -32,7 +32,7 @@ void AutoTransform::write(DataOutputStream* out){ out->writeVec3(getPosition()); out->writeVec3(getPivotPoint()); out->writeFloat(getAutoUpdateEyeMovementTolerance()); - + out->writeInt(getAutoRotateMode()); out->writeBool(getAutoScaleToScreen()); @@ -46,7 +46,7 @@ void AutoTransform::write(DataOutputStream* out){ out->writeQuat(getRotation()); out->writeVec3(getScale()); - + } void AutoTransform::read(DataInputStream* in){ diff --git a/src/osgPlugins/ive/BlinkSequence.cpp b/src/osgPlugins/ive/BlinkSequence.cpp index 3ab1d7712..0e741901b 100644 --- a/src/osgPlugins/ive/BlinkSequence.cpp +++ b/src/osgPlugins/ive/BlinkSequence.cpp @@ -45,7 +45,7 @@ void BlinkSequence::write(DataOutputStream* out){ // Write out SequenceGroup. if( getSequenceGroup() ) out->writeDouble(getSequenceGroup()->_baseTime); - else + else out->writeDouble( 0.0 ); } @@ -78,7 +78,7 @@ void BlinkSequence::read(DataInputStream* in){ // Read in SequenceGroup double baseTime = in->readDouble(); if (baseTime!=0.0) setSequenceGroup(new osgSim::SequenceGroup(baseTime)); - + } else{ in_THROW_EXCEPTION("BlinkSequence::read(): Expected BlinkSequence identification."); diff --git a/src/osgPlugins/ive/Camera.cpp b/src/osgPlugins/ive/Camera.cpp index 2d3e860b5..3ff2d8ccc 100644 --- a/src/osgPlugins/ive/Camera.cpp +++ b/src/osgPlugins/ive/Camera.cpp @@ -46,20 +46,20 @@ void Camera::write(DataOutputStream* out){ { out->writeStateAttribute(getViewport()); } - + out->writeInt(getTransformOrder()); // Write Camera's properties. out->writeMatrixd(getProjectionMatrix()); out->writeMatrixd(getViewMatrix()); - + out->writeInt(getRenderOrder()); out->writeInt(getRenderTargetImplementation()); out->writeInt(getRenderTargetFallback()); - + out->writeUInt(getDrawBuffer()); out->writeUInt(getReadBuffer()); - + const BufferAttachmentMap& baf = getBufferAttachmentMap(); out->writeUInt(baf.size()); for(BufferAttachmentMap::const_iterator itr = baf.begin(); @@ -80,12 +80,12 @@ void Camera::write(DataOutputStream* out){ out->writeBool(attachment._texture.valid()); if(attachment._texture.valid()) out->writeStateAttribute(attachment._texture.get()); - + out->writeUInt(attachment._level); out->writeUInt(attachment._face); out->writeBool(attachment._mipMapGeneration); } - + } void Camera::read(DataInputStream* in) @@ -121,32 +121,32 @@ void Camera::read(DataInputStream* in) osg::Viewport* vp = dynamic_cast(attribute.get()); if (vp) setViewport(vp); } - + setTransformOrder((TransformOrder)in->readInt()); // Read matrix setProjectionMatrix(in->readMatrixd()); setViewMatrix(in->readMatrixd()); - + setRenderOrder((RenderOrder)in->readInt()); - + RenderTargetImplementation impl = (RenderTargetImplementation)in->readInt(); RenderTargetImplementation fallback = (RenderTargetImplementation)in->readInt(); setRenderTargetImplementation(impl, fallback); - + setDrawBuffer((GLenum)in->readUInt()); setReadBuffer((GLenum)in->readUInt()); - + _bufferAttachmentMap.clear(); - + unsigned int numAttachments = in->readUInt(); for(unsigned int i=0; ireadInt(); if (in->getVersion() < VERSION_0036 ) { - // prior to VERSION_0036, there was no PACKED_DEPTH_STENCIL_BUFFER so we have to + // prior to VERSION_0036, there was no PACKED_DEPTH_STENCIL_BUFFER so we have to // bump up the value of one to make sure it maps to the original location. if (buffer_component >= PACKED_DEPTH_STENCIL_BUFFER) { @@ -156,7 +156,7 @@ void Camera::read(DataInputStream* in) Attachment& attachment = _bufferAttachmentMap[BufferComponent(buffer_component)]; attachment._internalFormat = (GLenum)in->readUInt(); - + if (in->readBool()) { // this ain't right... what if we need to share images???? diff --git a/src/osgPlugins/ive/CameraView.cpp b/src/osgPlugins/ive/CameraView.cpp index a8f213bc8..b17637caa 100644 --- a/src/osgPlugins/ive/CameraView.cpp +++ b/src/osgPlugins/ive/CameraView.cpp @@ -31,7 +31,7 @@ void CameraView::write(DataOutputStream* out) else out_THROW_EXCEPTION("CameraView::write(): Could not cast this osg::CameraView to an osg::Transform."); - // Write CameraView's properties. + // Write CameraView's properties. out->writeVec3(getPosition()); out->writeQuat(getAttitude()); out->writeDouble(getFieldOfView()); @@ -54,7 +54,7 @@ void CameraView::read(DataInputStream* in){ } else in_THROW_EXCEPTION("CameraView::read(): Could not cast this osg::CameraView to an osg::Transform."); - + // Read CameraView's properties setPosition(in->readVec3()); setAttitude(in->readQuat()); diff --git a/src/osgPlugins/ive/ClipPlane.cpp b/src/osgPlugins/ive/ClipPlane.cpp index b9bf32b44..1c2b407f7 100644 --- a/src/osgPlugins/ive/ClipPlane.cpp +++ b/src/osgPlugins/ive/ClipPlane.cpp @@ -30,9 +30,9 @@ void ClipPlane::write(DataOutputStream* out){ out_THROW_EXCEPTION("ClipPlane::write(): Could not cast this osg::ClipPlane to an osg::Object."); // write ClipPlane's properties - + out->writeVec4d(getClipPlane()); - + out->writeUInt(getClipPlaneNum()); } diff --git a/src/osgPlugins/ive/ClusterCullingCallback.cpp b/src/osgPlugins/ive/ClusterCullingCallback.cpp index 57b6e5927..78eef1c8c 100644 --- a/src/osgPlugins/ive/ClusterCullingCallback.cpp +++ b/src/osgPlugins/ive/ClusterCullingCallback.cpp @@ -54,14 +54,14 @@ void ClusterCullingCallback::read(DataInputStream* in) } else in_THROW_EXCEPTION("ClusterCullingCallback::read(): Could not cast this osg::ClusterCullingCallback to an osg::Object."); - + // Read ClusterCullingCallback's properties - + _controlPoint = in->readVec3(); _normal = in->readVec3(); _radius = in->readFloat(); _deviation = in->readFloat(); - + } else { diff --git a/src/osgPlugins/ive/CompositeLayer.cpp b/src/osgPlugins/ive/CompositeLayer.cpp index 2e83256c6..50d48e952 100644 --- a/src/osgPlugins/ive/CompositeLayer.cpp +++ b/src/osgPlugins/ive/CompositeLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -53,7 +53,7 @@ void CompositeLayer::read(DataInputStream* in) int id = in->peekInt(); if (id != IVECOMPOSITELAYER) in_THROW_EXCEPTION("CompositeLayer::read(): Expected CompositeLayer identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/ConvexPlanarPolygon.h b/src/osgPlugins/ive/ConvexPlanarPolygon.h index 9cd25d1f8..26c4945d8 100644 --- a/src/osgPlugins/ive/ConvexPlanarPolygon.h +++ b/src/osgPlugins/ive/ConvexPlanarPolygon.h @@ -9,7 +9,7 @@ class ConvexPlanarPolygon : public osg::ConvexPlanarPolygon, public ReadWrite { public: void write(DataOutputStream* out); void read(DataInputStream* in); - + virtual ~ConvexPlanarPolygon() {} }; } diff --git a/src/osgPlugins/ive/DOFTransform.cpp b/src/osgPlugins/ive/DOFTransform.cpp index 298a5c105..aef5f76d2 100644 --- a/src/osgPlugins/ive/DOFTransform.cpp +++ b/src/osgPlugins/ive/DOFTransform.cpp @@ -50,7 +50,7 @@ void DOFTransform::write(DataOutputStream* out){ { out->writeChar((char)(getHPRMultOrder())); } - + out->writeULong(getLimitationFlags()); out->writeBool(getAnimationOn()); } diff --git a/src/osgPlugins/ive/DataInputStream.cpp b/src/osgPlugins/ive/DataInputStream.cpp index f076a4657..3c038d792 100644 --- a/src/osgPlugins/ive/DataInputStream.cpp +++ b/src/osgPlugins/ive/DataInputStream.cpp @@ -180,26 +180,26 @@ DataInputStream::DataInputStream(std::istream* istream, const osgDB::ReaderWrite if(_version>VERSION){ throwException("DataInputStream::DataInputStream(): The version found in the file is newer than this library can handle."); } - + if (_version>=VERSION_0033) { int compressionLevel = readInt(); - + if (compressionLevel>0) { OSG_INFO<<"compressed ive stream"< a = new osg::IntArray(size); _istream->read((char*)&((*a)[0]), INTSIZE*size); @@ -679,7 +679,7 @@ osg::UShortArray* DataInputStream::readUShortArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::UShortArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE*size); @@ -705,7 +705,7 @@ osg::UIntArray* DataInputStream::readUIntArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::UIntArray(size); _istream->read((char*)&((*a)[0]), INTSIZE*size); @@ -731,7 +731,7 @@ osg::Vec4ubArray* DataInputStream::readVec4ubArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec4ubArray(size); _istream->read((char*)&((*a)[0]), INTSIZE*size); @@ -751,7 +751,7 @@ bool DataInputStream::readPackedFloatArray(osg::FloatArray* a) { int size = readInt(); - a->resize(size); + a->resize(size); if (size == 0) return true; @@ -759,7 +759,7 @@ bool DataInputStream::readPackedFloatArray(osg::FloatArray* a) if (readBool()) { float value = readFloat(); - + for(int i=0; irdstate() & _istream->failbit) { throwException("DataInputStream::readFloatArray(): Failed to read float array."); @@ -880,7 +880,7 @@ osg::Vec3Array* DataInputStream::readVec3Array() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec3Array(size); _istream->read((char*)&((*a)[0]), FLOATSIZE*3*size); @@ -909,7 +909,7 @@ osg::Vec4Array* DataInputStream::readVec4Array(){ int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec4Array(size); _istream->read((char*)&((*a)[0]), FLOATSIZE*4*size); @@ -936,7 +936,7 @@ osg::Vec2bArray* DataInputStream::readVec2bArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec2bArray(size); _istream->read((char*)&((*a)[0]), CHARSIZE * 2 * size); @@ -957,7 +957,7 @@ osg::Vec3bArray* DataInputStream::readVec3bArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec3bArray(size); _istream->read((char*)&((*a)[0]), CHARSIZE * 3 * size); @@ -978,7 +978,7 @@ osg::Vec4bArray* DataInputStream::readVec4bArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec4bArray(size); _istream->read((char*)&((*a)[0]), CHARSIZE * 4 * size); @@ -999,7 +999,7 @@ osg::Vec2sArray* DataInputStream::readVec2sArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec2sArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE * 2 * size); @@ -1029,7 +1029,7 @@ osg::Vec3sArray* DataInputStream::readVec3sArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec3sArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE * 3 * size); @@ -1060,7 +1060,7 @@ osg::Vec4sArray* DataInputStream::readVec4sArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec4sArray(size); _istream->read((char*)&((*a)[0]), SHORTSIZE * 4 * size); @@ -1119,7 +1119,7 @@ osg::Vec3dArray* DataInputStream::readVec3dArray() int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec3dArray(size); _istream->read((char*)&((*a)[0]), DOUBLESIZE*3*size); @@ -1148,7 +1148,7 @@ osg::Vec4dArray* DataInputStream::readVec4dArray(){ int size = readInt(); if (size == 0) return NULL; - + osg::ref_ptr a = new osg::Vec4dArray(size); _istream->read((char*)&((*a)[0]), DOUBLESIZE*4*size); @@ -1339,7 +1339,7 @@ osg::StateSet* DataInputStream::readStateSet() // read its properties from stream ((ive::StateSet*)(stateset.get()))->read(this); - + // exit early if an exception has been set. if (getException()) return 0; @@ -1527,7 +1527,7 @@ osg::StateAttribute* DataInputStream::readStateAttribute() throwException("Unknown StateAttribute in StateSet::read()"); return 0; } - + // exit early if an exception has been set. if (getException()) return 0; @@ -1554,7 +1554,7 @@ osg::Uniform* DataInputStream::readUniform() // read its properties from stream ((ive::Uniform*)(uniform.get()))->read(this); - + // exit early if an exception has been set. if (getException()) return 0; @@ -1582,7 +1582,7 @@ osg::Shader* DataInputStream::readShader() // read its properties from stream ((ive::Shader*)(shader.get()))->read(this); - + // exit early if an exception has been set. if (getException()) return 0; @@ -1938,7 +1938,7 @@ osgTerrain::Layer* DataInputStream::readLayer() else{ throwException("Unknown layer identification in DataInputStream::readLayer()"); } - + // exit early if an exception has been set. if (getException()) return 0; @@ -2009,7 +2009,7 @@ osgVolume::Layer* DataInputStream::readVolumeLayer() else{ throwException("Unknown layer identification in DataInputStream::readLayer()"); } - + // exit early if an exception has been set. if (getException()) return 0; @@ -2038,7 +2038,7 @@ osgVolume::Locator* DataInputStream::readVolumeLocator() // read its properties from stream ((ive::VolumeLocator*)(locator.get()))->read(this); - + // exit early if an exception has been set. if (getException()) return 0; @@ -2115,10 +2115,10 @@ osgVolume::Property* DataInputStream::readVolumeProperty() else{ throwException("Unknown layer identification in DataInputStream::readVolumeProperty()"); } - + // exit early if an exception has been set. if (getException()) return 0; - + // and add it to the locator map, _volumePropertyMap[id] = property; @@ -2131,10 +2131,10 @@ osg::Object* DataInputStream::readObject() { int id = readInt(); if (id<0) return 0; - + if (id==IVENODE) { - return readNode(); + return readNode(); } else if (id==IVESTATESET) { @@ -2158,7 +2158,7 @@ osg::Object* DataInputStream::readObject() return sal.release(); } - + return 0; } diff --git a/src/osgPlugins/ive/DataInputStream.h b/src/osgPlugins/ive/DataInputStream.h index 3d9f42601..506287256 100644 --- a/src/osgPlugins/ive/DataInputStream.h +++ b/src/osgPlugins/ive/DataInputStream.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ #include #include "IveVersion.h" -#include "DataTypeSize.h" +#include "DataTypeSize.h" #include "Exception.h" @@ -56,7 +56,7 @@ public: double readDouble(); std::string readString(); void readCharArray(char* data, int size); - + osg::Vec2 readVec2(); osg::Vec3 readVec3(); osg::Vec4 readVec4(); @@ -88,7 +88,7 @@ public: osg::Vec4sArray* readVec4sArray(); osg::Vec2dArray* readVec2dArray(); osg::Vec3dArray* readVec3dArray(); - osg::Vec4dArray* readVec4dArray(); + osg::Vec4dArray* readVec4dArray(); osg::Image* readImage(std::string s); osg::Image* readImage(IncludeImageMode mode); @@ -140,13 +140,13 @@ public: void throwException(const std::string& message) { _exception = new Exception(message); } void throwException(Exception* exception) { _exception = exception; } const Exception* getException() const { return _exception.get(); } - + private: int _version; bool _peeking; - int _peekValue; + int _peekValue; ImageMap _imageMap; StateSetMap _statesetMap; StateAttributeMap _stateAttributeMap; @@ -162,9 +162,9 @@ private: VolumePropertyMap _volumePropertyMap; bool _loadExternalReferenceFiles; - + osg::ref_ptr _options; - + osg::ref_ptr _exception; }; diff --git a/src/osgPlugins/ive/DataOutputStream.cpp b/src/osgPlugins/ive/DataOutputStream.cpp index ddf18a9c4..b6f7f762d 100644 --- a/src/osgPlugins/ive/DataOutputStream.cpp +++ b/src/osgPlugins/ive/DataOutputStream.cpp @@ -168,7 +168,7 @@ DataOutputStream::DataOutputStream(std::ostream * ostream, const osgDB::ReaderWr if (_options.get()) { std::string optionsString = _options->getOptionString(); - + if(optionsString.find("noTexturesInIVEFile")!=std::string::npos) { setIncludeImageMode(IMAGE_REFERENCE_FILE); } else if(optionsString.find("includeImageFileInIVEFile")!=std::string::npos) { @@ -198,7 +198,7 @@ DataOutputStream::DataOutputStream(std::ostream * ostream, const osgDB::ReaderWr { std::string::size_type endOfToken = optionsString.find_first_of('=', terrainErrorPos); std::string::size_type endOfNumber = optionsString.find_first_of(' ', endOfToken); - std::string::size_type numOfCharInNumber = (endOfNumber != std::string::npos) ? + std::string::size_type numOfCharInNumber = (endOfNumber != std::string::npos) ? endOfNumber-endOfToken-1 : optionsString.size()-endOfToken-1; @@ -206,7 +206,7 @@ DataOutputStream::DataOutputStream(std::ostream * ostream, const osgDB::ReaderWr { std::string numberString = optionsString.substr(endOfToken+1, numOfCharInNumber); _maximumErrorToSizeRatio = osg::asciiToDouble(numberString.c_str()); - + OSG_DEBUG<<"TerrainMaximumErrorToSizeRatio = "<<_maximumErrorToSizeRatio<0) { - - _ostream = &_compressionStream; + + _ostream = &_compressionStream; } } DataOutputStream::~DataOutputStream() { if (_compressionLevel>0) - { + { _ostream = _output_ostream; std::string compressionString(_compressionStream.str()); writeUInt(compressionString.size()); - + compress(*_output_ostream, compressionString); } } @@ -268,7 +268,7 @@ bool DataOutputStream::compress(std::ostream& fout, const std::string& source) c unsigned have; z_stream strm; unsigned char out[CHUNK]; - + int level = 6; int stategy = Z_DEFAULT_STRATEGY; // looks to be the best for .osg/.ive files //int stategy = Z_FILTERED; @@ -279,7 +279,7 @@ bool DataOutputStream::compress(std::ostream& fout, const std::string& source) c strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; - ret = deflateInit2(&strm, + ret = deflateInit2(&strm, level, Z_DEFLATED, 15+16, // +16 to use gzip encoding @@ -307,7 +307,7 @@ bool DataOutputStream::compress(std::ostream& fout, const std::string& source) c have = CHUNK - strm.avail_out; if (have>0) fout.write((const char*)out, have); - + if (fout.fail()) { (void)deflateEnd(&strm); @@ -659,15 +659,15 @@ void DataOutputStream::writePackedFloatArray(const osg::FloatArray* a, float max int size = a->getNumElements(); writeInt(size); if (size==0) return; - + float minValue = (*a)[0]; - float maxValue = minValue; + float maxValue = minValue; for(int i=1; imaxValue) maxValue = (*a)[i]; } - + if (minValue==maxValue) { OSG_DEBUG<<"Writing out "<0.0f) { - + //float byteError = 0.0f; float byteMultiplier = 255.0f/(maxValue-minValue); float byteInvMultiplier = 1.0f/byteMultiplier; @@ -723,10 +723,10 @@ void DataOutputStream::writePackedFloatArray(const osg::FloatArray* a, float max if (packingSize==1) { writeInt(1); - + writeFloat(minValue); writeFloat(maxValue); - + float byteMultiplier = 255.0f/(maxValue-minValue); for(int i=0; igetWriteHint()==osg::Image::STORE_INLINE) + if (image->getWriteHint()==osg::Image::STORE_INLINE) { return IMAGE_INCLUDE_DATA; } - else if (image->getWriteHint()==osg::Image::EXTERNAL_FILE) + else if (image->getWriteHint()==osg::Image::EXTERNAL_FILE) { return IMAGE_REFERENCE_FILE; } @@ -1450,7 +1450,7 @@ IncludeImageMode DataOutputStream::getIncludeImageMode(const osg::Image* image) void DataOutputStream::writeImage(osg::Image *image) { IncludeImageMode mode = getIncludeImageMode(image); - + if ( getVersion() >= VERSION_0029) { osg::ImageSequence* is = dynamic_cast(image); @@ -1853,7 +1853,7 @@ void DataOutputStream::writeVolumeProperty(const osgVolume::Property* property) void DataOutputStream::writeObject(const osg::Object* object) { const osg::Node* node = dynamic_cast(object); - if (node) + if (node) { writeInt(IVENODE); writeNode(node); @@ -1861,7 +1861,7 @@ void DataOutputStream::writeObject(const osg::Object* object) } const osg::StateSet* stateset = dynamic_cast(object); - if (stateset) + if (stateset) { writeInt(IVESTATESET); writeStateSet(stateset); @@ -1869,7 +1869,7 @@ void DataOutputStream::writeObject(const osg::Object* object) } const osg::StateAttribute* sa = dynamic_cast(object); - if (sa) + if (sa) { writeInt(IVESTATEATTRIBUTE); writeStateAttribute(sa); @@ -1877,7 +1877,7 @@ void DataOutputStream::writeObject(const osg::Object* object) } const osg::Drawable* drawable = dynamic_cast(object); - if (drawable) + if (drawable) { writeInt(IVEDRAWABLE); writeDrawable(drawable); @@ -1885,7 +1885,7 @@ void DataOutputStream::writeObject(const osg::Object* object) } const osgSim::ShapeAttributeList* sal = dynamic_cast(object); - if (sal) + if (sal) { writeInt(IVESHAPEATTRIBUTELIST); ((ive::ShapeAttributeList*)sal)->write(this); @@ -1905,10 +1905,10 @@ std::string DataOutputStream::getTextureFileNameForOutput() o << '_' << _textureFileNameNumber; fileName += o.str(); } - + fileName += ".dds"; ++_textureFileNameNumber; - + return fileName; } diff --git a/src/osgPlugins/ive/DataOutputStream.h b/src/osgPlugins/ive/DataOutputStream.h index db93ab0e8..d42b610ab 100644 --- a/src/osgPlugins/ive/DataOutputStream.h +++ b/src/osgPlugins/ive/DataOutputStream.h @@ -28,7 +28,7 @@ #include #include -namespace ive { +namespace ive { class DataOutputStream{ @@ -39,12 +39,12 @@ public: const osgDB::ReaderWriter::Options* getOptions() const { return _options.get(); } unsigned int getVersion() { return VERSION; } - + void writeBool(bool b); void writeChar(char c); void writeUChar(unsigned char c); void writeUShort(unsigned short s); - void writeShort(short s); + void writeShort(short s); void writeUInt(unsigned int s); void writeInt(int i); void writeFloat(float f); @@ -69,25 +69,25 @@ public: void writeUShortArray(const osg::UShortArray* a); void writeUIntArray(const osg::UIntArray* a); void writeVec4ubArray(const osg::Vec4ubArray* a); - void writeVec2b(const osg::Vec2b& v); - void writeVec3b(const osg::Vec3b& v); - void writeVec4b(const osg::Vec4b& v); - + void writeVec2b(const osg::Vec2b& v); + void writeVec3b(const osg::Vec3b& v); + void writeVec4b(const osg::Vec4b& v); + void writePackedFloatArray(const osg::FloatArray* a, float maxError); - + void writeFloatArray(const osg::FloatArray* a); void writeVec2Array(const osg::Vec2Array* a); void writeVec3Array(const osg::Vec3Array* a); void writeVec4Array(const osg::Vec4Array* a); void writeVec2sArray(const osg::Vec2sArray* a); void writeVec3sArray(const osg::Vec3sArray* a); - void writeVec4sArray(const osg::Vec4sArray* a); + void writeVec4sArray(const osg::Vec4sArray* a); void writeVec2bArray(const osg::Vec2bArray* a); void writeVec3bArray(const osg::Vec3bArray* a); void writeVec4bArray(const osg::Vec4bArray* a); void writeVec2dArray(const osg::Vec2dArray* a); void writeVec3dArray(const osg::Vec3dArray* a); - void writeVec4dArray(const osg::Vec4dArray* a); + void writeVec4dArray(const osg::Vec4dArray* a); void writeMatrixf(const osg::Matrixf& mat); void writeMatrixd(const osg::Matrixd& mat); @@ -160,7 +160,7 @@ public: std::ostream* _ostream; std::ostream* _output_ostream; std::string _filename; // not necessary, but optional for use in texture export - + std::stringstream _compressionStream; int _compressionLevel; diff --git a/src/osgPlugins/ive/DataTypeSize.h b/src/osgPlugins/ive/DataTypeSize.h index 3d116d916..7b9c0db8c 100644 --- a/src/osgPlugins/ive/DataTypeSize.h +++ b/src/osgPlugins/ive/DataTypeSize.h @@ -24,4 +24,4 @@ enum IncludeImageMode } -#endif +#endif diff --git a/src/osgPlugins/ive/DrawArrayLengths.cpp b/src/osgPlugins/ive/DrawArrayLengths.cpp index dc6b566e8..51235f88a 100644 --- a/src/osgPlugins/ive/DrawArrayLengths.cpp +++ b/src/osgPlugins/ive/DrawArrayLengths.cpp @@ -56,7 +56,7 @@ void DrawArrayLengths::read(DataInputStream* in){ // Read properties setFirst(in->readInt()); - + // Read array length and its elements. int size = in->readInt(); for(int i=0; ireadInt(); resize(size); in->readCharArray((char*)&front(), size * SHORTSIZE); - + if (in->_byteswap) { for (int i = 0 ; i < size ; i++ ) { osg::swapBytes((char *)&((*this)[i]),SHORTSIZE) ; } - } + } } else{ in_THROW_EXCEPTION("DrawElementsUShort::read(): Expected DrawElementsUShort identification."); diff --git a/src/osgPlugins/ive/Drawable.cpp b/src/osgPlugins/ive/Drawable.cpp index 67b6afd9d..4455225bc 100644 --- a/src/osgPlugins/ive/Drawable.cpp +++ b/src/osgPlugins/ive/Drawable.cpp @@ -34,15 +34,15 @@ void Drawable::write(DataOutputStream* out) out_THROW_EXCEPTION("Drawable::write(): Could not cast this osg::Drawable to an osg::Object."); // Write Drawable's properties. - + // Write stateset if any out->writeBool(getStateSet()!=0); if (getStateSet()) { out->writeStateSet(getStateSet()); } - - + + osg::ClusterCullingCallback* ccc = dynamic_cast(getCullCallback()); out->writeBool(ccc!=0); if(ccc) @@ -107,7 +107,7 @@ void Drawable::read(DataInputStream* in) setCullCallback(ccc); } - + if (in->getVersion() >= VERSION_0010) { if (in->readBool()) diff --git a/src/osgPlugins/ive/Effect.cpp b/src/osgPlugins/ive/Effect.cpp index 52fff9a7a..7da1d1e32 100644 --- a/src/osgPlugins/ive/Effect.cpp +++ b/src/osgPlugins/ive/Effect.cpp @@ -29,7 +29,7 @@ void Effect::write(DataOutputStream* out){ // Write Effect's properties. out->writeBool(getEnabled()); - + out->writeInt(getSelectedTechnique()); } @@ -50,7 +50,7 @@ void Effect::read(DataInputStream* in){ // Read Effect's properties setEnabled(in->readBool()); - + selectTechnique(in->readInt()); } else{ diff --git a/src/osgPlugins/ive/EllipsoidModel.cpp b/src/osgPlugins/ive/EllipsoidModel.cpp index cd3a3c32a..22c3114b5 100644 --- a/src/osgPlugins/ive/EllipsoidModel.cpp +++ b/src/osgPlugins/ive/EllipsoidModel.cpp @@ -53,7 +53,7 @@ void EllipsoidModel::read(DataInputStream* in){ setRadiusEquator(in->readDouble()); setRadiusPolar(in->readDouble()); - + } else{ diff --git a/src/osgPlugins/ive/Exception.h b/src/osgPlugins/ive/Exception.h index 5d47ccbda..14df688f7 100644 --- a/src/osgPlugins/ive/Exception.h +++ b/src/osgPlugins/ive/Exception.h @@ -9,7 +9,7 @@ namespace ive{ #define THROW_EXCEPTION(str) { throwException(new Exception(str)); return; } #define in_THROW_EXCEPTION(str) { in->throwException(new Exception(str)); return; } #define out_THROW_EXCEPTION(str) { out->throwException(new Exception(str)); return; } - + class Exception : public osg::Referenced { public: diff --git a/src/osgPlugins/ive/FadeText.cpp b/src/osgPlugins/ive/FadeText.cpp index c20fe2e71..96c6c0716 100644 --- a/src/osgPlugins/ive/FadeText.cpp +++ b/src/osgPlugins/ive/FadeText.cpp @@ -52,7 +52,7 @@ void FadeText::read(DataInputStream* in){ } else in_THROW_EXCEPTION("FadeText::read(): Could not cast this osgText::FadeText to an osgText::Text."); - + setFadeSpeed(in->readFloat()); } else{ diff --git a/src/osgPlugins/ive/Fog.cpp b/src/osgPlugins/ive/Fog.cpp index 0460f221c..75c8dca5c 100644 --- a/src/osgPlugins/ive/Fog.cpp +++ b/src/osgPlugins/ive/Fog.cpp @@ -7,7 +7,7 @@ * CREATED BY: Liang Aibin * * HISTORY: Created 17.06.2008 - * + * **********************************************************************/ #include "Exception.h" diff --git a/src/osgPlugins/ive/Geode.cpp b/src/osgPlugins/ive/Geode.cpp index 7fa34d9a4..a3a68dc6d 100644 --- a/src/osgPlugins/ive/Geode.cpp +++ b/src/osgPlugins/ive/Geode.cpp @@ -41,7 +41,7 @@ void Geode::write(DataOutputStream* out){ // Write out every drawable. for(unsigned int i=0;i(drawable)) ((ive::Geometry*)(drawable))->write(out); else{ @@ -72,11 +72,11 @@ void Geode::read(DataInputStream* in){ int size = in->readInt(); // Read the drawables. for(int i = 0; ipeekInt(); osg::Drawable* drawable; if(id == IVEGEOMETRY){ - drawable = new osg::Geometry(); + drawable = new osg::Geometry(); ((Geometry*)(drawable))->read(in); addDrawable(drawable); } @@ -84,7 +84,7 @@ void Geode::read(DataInputStream* in){ in_THROW_EXCEPTION("Unknown drawable identification in Geode::read()"); #else addDrawable(in->readDrawable()); -#endif +#endif } } else{ diff --git a/src/osgPlugins/ive/Geometry.cpp b/src/osgPlugins/ive/Geometry.cpp index b22655a97..39aac9a9d 100644 --- a/src/osgPlugins/ive/Geometry.cpp +++ b/src/osgPlugins/ive/Geometry.cpp @@ -68,7 +68,7 @@ void Geometry::write(DataOutputStream* out){ { out->writeArray(getVertexIndices()); } - + // Write normal array if any if ( out->getVersion() < VERSION_0013 ) { @@ -89,11 +89,11 @@ void Geometry::write(DataOutputStream* out){ out->writeArray(getNormalArray()); } } - + // Write normal indices if any out->writeBool(getNormalIndices()!=0); if (getNormalIndices()){ - out->writeArray(getNormalIndices()); + out->writeArray(getNormalIndices()); } // Write color array if any. out->writeBool(getColorArray()!=0); @@ -104,7 +104,7 @@ void Geometry::write(DataOutputStream* out){ // Write color indices if any out->writeBool(getColorIndices()!=0); if (getColorIndices()){ - out->writeArray(getColorIndices()); + out->writeArray(getColorIndices()); } // Write secondary color array if any out->writeBool(getSecondaryColorArray()!=0); @@ -219,7 +219,7 @@ void Geometry::read(DataInputStream* in){ in_THROW_EXCEPTION("Unknown PrimitiveSet in Geometry::read()"); } } - + // Read vertex array if any bool va=in->readBool(); if (va){ @@ -301,12 +301,12 @@ void Geometry::read(DataInputStream* in){ { setVertexAttribBinding(i,in->readBinding()); setVertexAttribNormalize(i,in->readBool()?GL_TRUE:GL_FALSE); - + // Read coords if valid bool coords_valid = in->readBool(); if(coords_valid) setVertexAttribArray(i, in->readArray()); - + // Read Indices if valid bool indices_valid = in->readBool(); if(indices_valid) diff --git a/src/osgPlugins/ive/Group.cpp b/src/osgPlugins/ive/Group.cpp index 2e6047893..16a6ed6a8 100644 --- a/src/osgPlugins/ive/Group.cpp +++ b/src/osgPlugins/ive/Group.cpp @@ -71,7 +71,7 @@ void Group::read(DataInputStream* in){ // Read children. for(int i=0; ireadNode()); + addChild(in->readNode()); } } else{ diff --git a/src/osgPlugins/ive/HeightFieldLayer.cpp b/src/osgPlugins/ive/HeightFieldLayer.cpp index 507156b1b..2f0b6645b 100644 --- a/src/osgPlugins/ive/HeightFieldLayer.cpp +++ b/src/osgPlugins/ive/HeightFieldLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,9 +36,9 @@ void HeightFieldLayer::write(DataOutputStream* out) if (getFileName().empty() && getHeightField()) { osg::HeightField* hf = getHeightField(); - + // using inline heightfield - out->writeBool(true); + out->writeBool(true); if (out->getVersion()>=VERSION_0035) { // Write HeightField's properties. @@ -52,16 +52,16 @@ void HeightFieldLayer::write(DataOutputStream* out) out->writeUInt(hf->getBorderWidth()); float maxError = 0.0f; - + if (getLocator()) { osg::Vec3d world_origin, world_corner; - + getLocator()->convertLocalToModel(osg::Vec3d(0.0,0.0,0.0), world_origin); getLocator()->convertLocalToModel(osg::Vec3d(1.0,1.0,0.0), world_corner); - + double distance = (world_origin-world_corner).length(); - + maxError = distance * out->getTerrainMaximumErrorToSizeRatio(); } @@ -70,14 +70,14 @@ void HeightFieldLayer::write(DataOutputStream* out) else { out->writeShape(getHeightField()); - } + } } else { // using external heightfield file - out->writeBool(false); - out->writeString(getFileName()); + out->writeBool(false); + out->writeString(getFileName()); } } @@ -88,7 +88,7 @@ void HeightFieldLayer::read(DataInputStream* in) int id = in->peekInt(); if (id != IVEHEIGHTFIELDLAYER) in_THROW_EXCEPTION("HeightFieldLayer::read(): Expected HeightFieldLayer identification."); - + // Read Layer's identification. id = in->readInt(); @@ -101,18 +101,18 @@ void HeightFieldLayer::read(DataInputStream* in) bool useInlineHeightField = in->readBool(); - + if (useInlineHeightField) { - + if (in->getVersion()>=VERSION_0035) { osg::HeightField* hf = new osg::HeightField; - + // Read HeightField's properties //setColor(in->readVec4()); unsigned int col = in->readUInt(); - unsigned int row = in->readUInt(); + unsigned int row = in->readUInt(); hf->allocate(col,row); hf->setOrigin(in->readVec3()); @@ -127,7 +127,7 @@ void HeightFieldLayer::read(DataInputStream* in) { in->readPackedFloatArray(hf->getFloatArray()); } - + setHeightField(hf); } @@ -135,14 +135,14 @@ void HeightFieldLayer::read(DataInputStream* in) { osg::Shape* shape = in->readShape(); setHeightField(dynamic_cast(shape)); - } + } } else { std::string filename = in->readString(); setFileName(filename); - + setHeightField(osgDB::readHeightFieldFile(filename,in->getOptions())); } diff --git a/src/osgPlugins/ive/HeightFieldLayer.h b/src/osgPlugins/ive/HeightFieldLayer.h index d9fe4f3ad..7aafb88cd 100644 --- a/src/osgPlugins/ive/HeightFieldLayer.h +++ b/src/osgPlugins/ive/HeightFieldLayer.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/Image.cpp b/src/osgPlugins/ive/Image.cpp index c09f096a2..d9b1a4580 100644 --- a/src/osgPlugins/ive/Image.cpp +++ b/src/osgPlugins/ive/Image.cpp @@ -39,14 +39,14 @@ void Image::write(DataOutputStream* out) if ( out->getVersion() >= VERSION_0032) { out->writeInt((int)getWriteHint()); - } + } // Write width, height, depth of image. out->writeInt(s()); out->writeInt(t()); out->writeInt(r()); - - + + OSG_DEBUG << "image written '" << getFileName()<<"'\t"<writeInt(getPacking()); // Write modified tag. - out->writeInt(getModifiedCount()); + out->writeInt(getModifiedCount()); // Write mipmapdata vector int size = _mipmapData.size(); @@ -98,11 +98,11 @@ void Image::read(DataInputStream* in) // Read name setFileName(in->readString()); - + if ( in->getVersion() >= VERSION_0032) { setWriteHint((osg::Image::WriteHint)in->readInt()); - } + } // Read width, height, depth of image. int is=in->readInt(); @@ -118,7 +118,7 @@ void Image::read(DataInputStream* in) // Read modified tag. setModifiedCount((unsigned int)in->readInt()); - // Read mipmapdata vector + // Read mipmapdata vector int size = in->readInt(); MipmapDataType mipmapData(size); @@ -130,20 +130,20 @@ void Image::read(DataInputStream* in) //std::cout<<_mipmapData[i]<<"\t"; } //std::cout<readBool()) { unsigned int dataSize = (unsigned int)in->readInt(); - + //static int totalSize = 0; - + //totalSize += dataSize; //std::cout<readInt(); @@ -61,12 +61,12 @@ void ImageLayer::read(DataInputStream* in) in_THROW_EXCEPTION("ImageLayer::read(): Could not cast this osgLayer::Layer to an osg::Group."); - bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? + bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading() : false; // Should we read image data from stream IncludeImageMode includeImg = (IncludeImageMode)in->readChar(); - + if (includeImg==IMAGE_REFERENCE_FILE && deferExternalLayerLoading) { setFileName(in->readString()); diff --git a/src/osgPlugins/ive/ImageLayer.h b/src/osgPlugins/ive/ImageLayer.h index e40c05bf0..a7243471e 100644 --- a/src/osgPlugins/ive/ImageLayer.h +++ b/src/osgPlugins/ive/ImageLayer.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/ImageSequence.cpp b/src/osgPlugins/ive/ImageSequence.cpp index 23ec9ec81..55c632890 100644 --- a/src/osgPlugins/ive/ImageSequence.cpp +++ b/src/osgPlugins/ive/ImageSequence.cpp @@ -32,8 +32,8 @@ void ImageSequence::write(DataOutputStream* out) else out_THROW_EXCEPTION("ImageSequence::write(): Could not cast this osg::ImageSequence to an osg::Object."); // Write ImageSequence's properties. - - + + out->writeInt(getMode()); out->writeDouble(getLength()); @@ -77,7 +77,7 @@ void ImageSequence::read(DataInputStream* in) setMode((osg::ImageSequence::Mode)(in->readInt())); setLength(in->readDouble()); - + unsigned int numFileNames = in->readUInt(); if (numFileNames>0) { @@ -94,7 +94,7 @@ void ImageSequence::read(DataInputStream* in) addImage(in->readImage()); } } - + } else{ in_THROW_EXCEPTION("ImageSequence::read(): Expected ImageSequence identification."); diff --git a/src/osgPlugins/ive/IveVersion.h b/src/osgPlugins/ive/IveVersion.h index 6096b6ec3..d47cbaaeb 100644 --- a/src/osgPlugins/ive/IveVersion.h +++ b/src/osgPlugins/ive/IveVersion.h @@ -5,7 +5,7 @@ /* The VERSION tag should be updated any time the IVE format changes in order to support backward - compatibility (if implemented). VERSION is + compatibility (if implemented). VERSION is stored in the 2nd 4 bytes of the file */ #define VERSION_0001 1 @@ -60,7 +60,7 @@ of the IVE file being read in. The IVE format is always written in the native endian of the machine to provide optimum reading of the file. - BYTE_SEX is stored in the first 4 bytes of the + BYTE_SEX is stored in the first 4 bytes of the file */ #define ENDIAN_TYPE 0x01020304 #define OPPOSITE_ENDIAN_TYPE 0x04030201 diff --git a/src/osgPlugins/ive/Layer.cpp b/src/osgPlugins/ive/Layer.cpp index 2228469e4..079164ddc 100644 --- a/src/osgPlugins/ive/Layer.cpp +++ b/src/osgPlugins/ive/Layer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,7 +37,7 @@ void Layer::write(DataOutputStream* out) else out_THROW_EXCEPTION("Layer::write(): Could not cast this osgLayer::Layer to an osg::Object."); - + if (out->getVersion() >= VERSION_0023) { out->writeLocator(getLocator()); @@ -57,8 +57,8 @@ void Layer::write(DataOutputStream* out) LayerHelper helper; helper.writeLocator(out, getLocator()); } - - + + out->writeUInt(getMinLevel()); out->writeUInt(getMaxLevel()); @@ -75,7 +75,7 @@ void Layer::read(DataInputStream* in) int id = in->peekInt(); if (id != IVELAYER) in_THROW_EXCEPTION("Layer::read(): Expected Layer identification."); - + // Read Layer's identification. id = in->readInt(); @@ -117,7 +117,7 @@ void Layer::read(DataInputStream* in) void LayerHelper::writeLayer(DataOutputStream* out, osgTerrain::Layer* layer) { - if (layer) + if (layer) { out->writeBool(true); @@ -192,31 +192,31 @@ osgTerrain::Layer* LayerHelper::readLayer(DataInputStream* in) std::string filename = in->readString(); osg::ref_ptr object = osgDB::readObjectFile(filename+".gdal"); osgTerrain::ProxyLayer* proxyLayer = dynamic_cast(object.get()); - + osg::ref_ptr locator = readLocator(in); unsigned int minLevel = in->readUInt(); unsigned int maxLevel = in->readUInt(); - + if (proxyLayer) { if (locator.valid()) proxyLayer->setLocator(locator.get()); - + proxyLayer->setMinLevel(minLevel); proxyLayer->setMaxLevel(maxLevel); } - + return proxyLayer; } - + return new osgTerrain::ImageLayer; } void LayerHelper::writeLocator(DataOutputStream* out, osgTerrain::Locator* locator) { - if (locator) + if (locator) { out->writeBool(true); - + ((ive::Locator*)(locator))->write(out); } else @@ -229,11 +229,11 @@ osgTerrain::Locator* LayerHelper::readLocator(DataInputStream* in) { bool locatorExist = in->readBool(); if (!locatorExist) return 0; - + osgTerrain::Locator* locator = new osgTerrain::Locator; - + ((ive::Locator*)(locator))->read(in); - + return locator; } @@ -249,8 +249,8 @@ void Layer::writeValidDataOperator(DataOutputStream* out, osgTerrain::ValidDataO out->writeFloat(validRange->getMinValue()); out->writeFloat(validRange->getMaxValue()); } - else - { + else + { osgTerrain::NoDataValue* noDataValue = dynamic_cast(validDataOperator); if (noDataValue) { @@ -269,14 +269,14 @@ osgTerrain::ValidDataOperator* Layer::readValidDataOperator(DataInputStream* in) { bool hasOperator = in->readBool(); if (!hasOperator) return 0; - + int id = in->peekInt(); if (id==IVEVALIDRANGE) { id = in->readInt(); float minValue = in->readFloat(); float maxValue = in->readFloat(); - return new osgTerrain::ValidRange(minValue,maxValue); + return new osgTerrain::ValidRange(minValue,maxValue); } else if (id==IVENODATAVALUE) { diff --git a/src/osgPlugins/ive/Layer.h b/src/osgPlugins/ive/Layer.h index 2ba6f1ac5..a333de3de 100644 --- a/src/osgPlugins/ive/Layer.h +++ b/src/osgPlugins/ive/Layer.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ class LayerHelper public: LayerHelper() {} - + void writeLayer(DataOutputStream* out, osgTerrain::Layer* layer); osgTerrain::Layer* readLayer(DataInputStream* in); @@ -33,7 +33,7 @@ class LayerHelper osgTerrain::Locator* readLocator(DataInputStream* in); }; -class Layer : public osgTerrain::Layer, public ReadWrite +class Layer : public osgTerrain::Layer, public ReadWrite { public: void write(DataOutputStream* out); diff --git a/src/osgPlugins/ive/LightPoint.cpp b/src/osgPlugins/ive/LightPoint.cpp index 0add16e77..dfe470524 100644 --- a/src/osgPlugins/ive/LightPoint.cpp +++ b/src/osgPlugins/ive/LightPoint.cpp @@ -60,7 +60,7 @@ void LightPoint::write(DataOutputStream* out){ if(_blinkSequence.valid()){ ((ive::BlinkSequence*)(_blinkSequence.get()))->write(out); } - + // Write out blendingMode. out->writeInt(_blendingMode); } @@ -118,7 +118,7 @@ void LightPoint::read(DataInputStream* in){ ((ive::BlinkSequence*)(blinkSequence))->read(in); _blinkSequence = blinkSequence; } - + // Read in blendingMode. _blendingMode = (osgSim::LightPoint::BlendingMode)in->readInt(); } diff --git a/src/osgPlugins/ive/LightPointNode.cpp b/src/osgPlugins/ive/LightPointNode.cpp index d23125512..eb507da81 100644 --- a/src/osgPlugins/ive/LightPointNode.cpp +++ b/src/osgPlugins/ive/LightPointNode.cpp @@ -69,7 +69,7 @@ void LightPointNode::read(DataInputStream* in){ { setPointSprite(in->readBool()); } - + // Read in lightpoints. unsigned int size = in->readUInt(); for(unsigned int i=0; iwrite(out); else out_THROW_EXCEPTION("Layer::write(): Could not cast this osgLayer::Layer to an osg::Object."); - + out->writeInt(getCoordinateSystemType()); out->writeString(getFormat()); out->writeString(getCoordinateSystem()); - + out->writeBool(getEllipsoidModel()!=0); if(getEllipsoidModel()) { ((ive::EllipsoidModel*)(getEllipsoidModel()))->write(out); } - + out->writeBool(getDefinedInFile()); out->writeBool(getTransformScaledByResolution()); out->writeMatrixd(getTransform()); @@ -54,7 +54,7 @@ void Locator::read(DataInputStream* in) { in_THROW_EXCEPTION("Locator::read(): Expected Locator identification."); } - + // Read Locator's identification. id = in->readInt(); @@ -68,7 +68,7 @@ void Locator::read(DataInputStream* in) setCoordinateSystemType(static_cast(in->readInt())); setFormat(in->readString()); setCoordinateSystem(in->readString()); - + bool readEllipsoidModel = in->readBool(); if (readEllipsoidModel) { @@ -76,7 +76,7 @@ void Locator::read(DataInputStream* in) ((ive::EllipsoidModel*)(em))->read(in); setEllipsoidModel(em); } - + setDefinedInFile(in->readBool()); setTransformScaledByResolution(in->readBool()); setTransform(in->readMatrixd()); diff --git a/src/osgPlugins/ive/Locator.h b/src/osgPlugins/ive/Locator.h index d46be90e8..ac13ab742 100644 --- a/src/osgPlugins/ive/Locator.h +++ b/src/osgPlugins/ive/Locator.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/Material.cpp b/src/osgPlugins/ive/Material.cpp index c31f83304..22d9f8843 100644 --- a/src/osgPlugins/ive/Material.cpp +++ b/src/osgPlugins/ive/Material.cpp @@ -36,7 +36,7 @@ void Material::write(DataOutputStream* out){ out->writeBool(_ambientFrontAndBack); out->writeVec4(_ambientFront); out->writeVec4(_ambientBack); - // Write diffuse + // Write diffuse out->writeBool(_diffuseFrontAndBack); out->writeVec4(_diffuseFront); out->writeVec4(_diffuseBack); diff --git a/src/osgPlugins/ive/Multisample.cpp b/src/osgPlugins/ive/Multisample.cpp index 212076d4e..97962fec9 100644 --- a/src/osgPlugins/ive/Multisample.cpp +++ b/src/osgPlugins/ive/Multisample.cpp @@ -5,7 +5,7 @@ * DESCRIPTION: Read/Write osg::Multisample in binary format to disk. * * CREATED BY: Nikolaus Hanekamp - * + * * * HISTORY: Created 15.06.2007 * diff --git a/src/osgPlugins/ive/Node.cpp b/src/osgPlugins/ive/Node.cpp index 8ef0fdb19..9fc0afecc 100644 --- a/src/osgPlugins/ive/Node.cpp +++ b/src/osgPlugins/ive/Node.cpp @@ -52,7 +52,7 @@ void Node::write(DataOutputStream* out){ if(nDesc!=0){ std::vector desc = getDescriptions(); for(int i=0;iwriteString(desc[i]); + out->writeString(desc[i]); } // Write Stateset if any out->writeBool( getStateSet()!=0); @@ -66,7 +66,7 @@ void Node::write(DataOutputStream* out){ { ((ive::AnimationPathCallback*)(nc))->write(out); } - + if (out->getVersion() >= VERSION_0006) { osg::ClusterCullingCallback* ccc = dynamic_cast(getCullCallback()); diff --git a/src/osgPlugins/ive/Object.cpp b/src/osgPlugins/ive/Object.cpp index c8f9281e9..962fb3079 100644 --- a/src/osgPlugins/ive/Object.cpp +++ b/src/osgPlugins/ive/Object.cpp @@ -35,16 +35,16 @@ void Object::write(DataOutputStream* out) case(osg::Object::DYNAMIC): out->writeChar((char)1); break; case(osg::Object::UNSPECIFIED): out->writeChar((char)2); break; } - + if ( out->getVersion() >= VERSION_0031) { const osg::Object* object = dynamic_cast(getUserData()); - if (object) + if (object) { out->writeBool(true); out->writeObject(object); } - else + else { out->writeBool(false); } diff --git a/src/osgPlugins/ive/PagedLOD.cpp b/src/osgPlugins/ive/PagedLOD.cpp index 02a43b59c..5acb2173e 100644 --- a/src/osgPlugins/ive/PagedLOD.cpp +++ b/src/osgPlugins/ive/PagedLOD.cpp @@ -134,11 +134,11 @@ void PagedLOD::read(DataInputStream* in) if (getDatabasePath().empty() && in->getOptions() && !in->getOptions()->getDatabasePathList().empty()) { const std::string& path = in->getOptions()->getDatabasePathList().front(); - if (!path.empty()) + if (!path.empty()) { setDatabasePath(path); } - } + } setRadius(in->readFloat()); @@ -157,7 +157,7 @@ void PagedLOD::read(DataInputStream* in) int i; for(i=0; ireadNode()); + addChild(in->readNode()); } // Read centermode @@ -178,7 +178,7 @@ void PagedLOD::read(DataInputStream* in) for(i=0;ireadString()); } - + // PagedLOD priority settings // 2006/03/10 GW diff --git a/src/osgPlugins/ive/PositionAttitudeTransform.cpp b/src/osgPlugins/ive/PositionAttitudeTransform.cpp index 7f583382d..5bfe92906 100644 --- a/src/osgPlugins/ive/PositionAttitudeTransform.cpp +++ b/src/osgPlugins/ive/PositionAttitudeTransform.cpp @@ -29,7 +29,7 @@ void PositionAttitudeTransform::write(DataOutputStream* out){ else out_THROW_EXCEPTION("PositionAttitudeTransform::write(): Could not cast this osg::PositionAttitudeTransform to an osg::Transform."); // Write PositionAttitudeTransform's properties. - + out->writeVec3(getPosition()); out->writeQuat(getAttitude()); out->writeVec3(getScale()); diff --git a/src/osgPlugins/ive/PrimitiveSet.cpp b/src/osgPlugins/ive/PrimitiveSet.cpp index 1af6d7298..2eb01a813 100644 --- a/src/osgPlugins/ive/PrimitiveSet.cpp +++ b/src/osgPlugins/ive/PrimitiveSet.cpp @@ -34,7 +34,7 @@ void PrimitiveSet::write(DataOutputStream* out){ { out->writeInt(getNumInstances()); } - + // Write PrimitiveSet's properties. out->writeInt(getMode()); } diff --git a/src/osgPlugins/ive/Program.cpp b/src/osgPlugins/ive/Program.cpp index 43194b3e4..8b359aee9 100644 --- a/src/osgPlugins/ive/Program.cpp +++ b/src/osgPlugins/ive/Program.cpp @@ -29,7 +29,7 @@ void Program::write(DataOutputStream* out){ } else out_THROW_EXCEPTION("Program::write(): Could not cast this osg::Program to an osg::Object."); - + if ( out->getVersion() >= VERSION_0030 ) { out->writeInt(getParameter(GL_GEOMETRY_VERTICES_OUT_EXT)); @@ -47,7 +47,7 @@ void Program::write(DataOutputStream* out){ out->writeUInt(itr->second); } - // Write + // Write out->writeUInt(getNumShaders()); for(unsigned int si=0; siwriteUInt(getNumFileNames()); unsigned int numChildrenToWriteOut = 0; unsigned int i; - + std::string writeDirectory; if (!(out->getOptions()->getDatabasePathList().empty())) writeDirectory = out->getOptions()->getDatabasePathList().front(); - + if (!writeDirectory.empty()) writeDirectory = writeDirectory + "/"; - + bool writeOutExternalIVEFIles = !out->getIncludeExternalReferences() && out->getWriteExternalReferenceFiles() && !out->getUseOriginalExternalReferences(); - + for(i=0; iwriteString(""); - + if (igetOptions() && !in->getOptions()->getDatabasePathList().empty()) { const std::string& path = in->getOptions()->getDatabasePathList().front(); - if (!path.empty()) + if (!path.empty()) { setDatabasePath(path); } @@ -183,7 +183,7 @@ void ProxyNode::read(DataInputStream* in) { osgDB::FilePathList& fpl = ((osgDB::ReaderWriter::Options*)in->getOptions())->getDatabasePathList(); fpl.push_front( fpl.empty() ? osgDB::getFilePath(getFileName(i)) : fpl.front()+'/'+ osgDB::getFilePath(getFileName(i))); - addChild(in->readNode()); + addChild(in->readNode()); fpl.pop_front(); } diff --git a/src/osgPlugins/ive/ReaderWriterIVE.cpp b/src/osgPlugins/ive/ReaderWriterIVE.cpp index f2f661df3..af521eb4d 100644 --- a/src/osgPlugins/ive/ReaderWriterIVE.cpp +++ b/src/osgPlugins/ive/ReaderWriterIVE.cpp @@ -14,7 +14,7 @@ using namespace osgDB; class ReaderWriterIVE : public ReaderWriter { public: - + ReaderWriterIVE() { supportsExtension("ive","OpenSceneGraph native binary format"); @@ -30,7 +30,7 @@ class ReaderWriterIVE : public ReaderWriter supportsOption("noLoadExternalReferenceFiles","Import option"); supportsOption("OutputTextureFiles","Write out the texture images to file"); } - + virtual const char* className() const { return "IVE Reader/Writer"; } virtual bool acceptsExtension(const std::string& extension) const @@ -57,7 +57,7 @@ class ReaderWriterIVE : public ReaderWriter osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); return readImage(istream, local_opt.get()); } - + virtual ReadResult readNode(const std::string& file, const Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); @@ -66,14 +66,14 @@ class ReaderWriterIVE : public ReaderWriter std::string fileName = osgDB::findDataFile( file, options ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); return readNode(istream,local_opt.get()); } - + virtual ReadResult readObject(std::istream& fin, const Options* options) const { return readNode(fin, options); @@ -82,7 +82,7 @@ class ReaderWriterIVE : public ReaderWriter virtual ReadResult readImage(std::istream& fin, const Options* options) const { ive::DataInputStream in(&fin, options); - if (in.getException()) + if (in.getException()) { return in.getException()->getError(); } @@ -94,7 +94,7 @@ class ReaderWriterIVE : public ReaderWriter { // Create datainputstream. ive::DataInputStream in(&fin, options); - if (in.getException()) + if (in.getException()) { return in.getException()->getError(); } @@ -115,7 +115,7 @@ class ReaderWriterIVE : public ReaderWriter { std::string ext = getFileExtension(fileName); if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; if(local_opt->getDatabasePathList().empty()) local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -134,7 +134,7 @@ class ReaderWriterIVE : public ReaderWriter std::string ext = getFileExtension(fileName); if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; if(local_opt->getDatabasePathList().empty()) local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -143,12 +143,12 @@ class ReaderWriterIVE : public ReaderWriter osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); if (!fout) return WriteResult::ERROR_IN_WRITING_FILE; - + WriteResult result = writeNode(node, fout, local_opt.get()); fout.close(); return result; } - + virtual WriteResult writeObject(const Object& object,std::ostream& fout, const osgDB::ReaderWriter::Options* options) const { const Node* node = dynamic_cast(&object); @@ -163,7 +163,7 @@ class ReaderWriterIVE : public ReaderWriter ive::DataOutputStream out(&fout, options); out.writeImage(ive::IMAGE_INCLUDE_DATA, const_cast(&image)); if (fout.fail()) return WriteResult::ERROR_IN_WRITING_FILE; - if (out.getException()) + if (out.getException()) { OSG_WARN<<"Error writing IVE image: "<< out.getException()->getError() << std::endl; return WriteResult::FILE_NOT_HANDLED; @@ -178,7 +178,7 @@ class ReaderWriterIVE : public ReaderWriter out.writeNode(const_cast(&node)); if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE; - if (out.getException()) + if (out.getException()) { OSG_WARN<<"Error writing IVE image: "<< out.getException()->getError() << std::endl; return WriteResult::FILE_NOT_HANDLED; diff --git a/src/osgPlugins/ive/Sequence.cpp b/src/osgPlugins/ive/Sequence.cpp index 8ee1f815c..c97f06c18 100644 --- a/src/osgPlugins/ive/Sequence.cpp +++ b/src/osgPlugins/ive/Sequence.cpp @@ -48,7 +48,7 @@ void Sequence::write(DataOutputStream* out) { out->writeFloat(getTime(i)); } - + if (out->getVersion() >= VERSION_0022) { // Write last frame time @@ -117,7 +117,7 @@ void Sequence::read(DataInputStream* in) { setTime(i, in->readFloat()); } - + if (in->getVersion() >= VERSION_0022) { // Read last frame time diff --git a/src/osgPlugins/ive/Shader.cpp b/src/osgPlugins/ive/Shader.cpp index 3f99dc79c..879e35b04 100644 --- a/src/osgPlugins/ive/Shader.cpp +++ b/src/osgPlugins/ive/Shader.cpp @@ -66,7 +66,7 @@ void Shader::read(DataInputStream* in) { setName(in->readString()); } - + setType(static_cast(in->readInt())); setShaderSource(in->readString()); diff --git a/src/osgPlugins/ive/Shape.cpp b/src/osgPlugins/ive/Shape.cpp index c8911e0cd..be2fe6106 100644 --- a/src/osgPlugins/ive/Shape.cpp +++ b/src/osgPlugins/ive/Shape.cpp @@ -316,7 +316,7 @@ void HeightField::write(DataOutputStream* out) out->writeQuat(getRotation()); out->writeFloat(getSkirtHeight()); out->writeUInt(getBorderWidth()); - + unsigned int size = getHeightList().size(); out->writeUInt(size); for(unsigned int i = 0; i < size; i++) @@ -324,9 +324,9 @@ void HeightField::write(DataOutputStream* out) out->writeFloat((getHeightList())[i]); } - - - + + + } void HeightField::read(DataInputStream* in) @@ -349,17 +349,17 @@ void HeightField::read(DataInputStream* in) // Read HeightField's properties //setColor(in->readVec4()); unsigned int col = in->readUInt(); - unsigned int row = in->readUInt(); + unsigned int row = in->readUInt(); allocate(col,row); setOrigin(in->readVec3()); setXInterval(in->readFloat()); setYInterval(in->readFloat()); setRotation(in->readQuat()); - + setSkirtHeight(in->readFloat()); setBorderWidth(in->readUInt()); - + unsigned int size = in->readUInt(); in->_istream->read((char*)&(getHeightList()[0]), FLOATSIZE*size); if (in->_istream->rdstate() & in->_istream->failbit) diff --git a/src/osgPlugins/ive/ShapeAttributeList.cpp b/src/osgPlugins/ive/ShapeAttributeList.cpp index 9da79febf..07f5c3792 100644 --- a/src/osgPlugins/ive/ShapeAttributeList.cpp +++ b/src/osgPlugins/ive/ShapeAttributeList.cpp @@ -2,7 +2,7 @@ * * FILE: ShapeAttributeList.cpp * - * DESCRIPTION: Read/Write osgSim::ShapeAttributeList in binary + * DESCRIPTION: Read/Write osgSim::ShapeAttributeList in binary * format to disk. * * CREATED BY: John Vidar Larring @@ -46,7 +46,7 @@ void ShapeAttributeList::read(DataInputStream* in) // Read size of the list unsigned int count = in->readUInt(); - + resize(count); // Read elements of the list @@ -64,7 +64,7 @@ void ShapeAttributeList::write(DataOutputStream* out, const osgSim::ShapeAttribu { // Write name out->writeString(sa.getName()); - + // Write datatype osgSim::ShapeAttribute::Type type = sa.getType(); out->writeInt((int)type); @@ -100,10 +100,10 @@ void ShapeAttributeList::read(DataInputStream* in, osgSim::ShapeAttribute& sa) switch (type) { case osgSim::ShapeAttribute::INTEGER: - sa.setValue(in->readInt()); + sa.setValue(in->readInt()); break; case osgSim::ShapeAttribute::DOUBLE: - sa.setValue(in->readDouble()); + sa.setValue(in->readDouble()); break; case osgSim::ShapeAttribute::STRING: if (in->readBool()) diff --git a/src/osgPlugins/ive/ShapeAttributeList.h b/src/osgPlugins/ive/ShapeAttributeList.h index b391a26bd..6aac4d988 100644 --- a/src/osgPlugins/ive/ShapeAttributeList.h +++ b/src/osgPlugins/ive/ShapeAttributeList.h @@ -9,7 +9,7 @@ class ShapeAttributeList : public osgSim::ShapeAttributeList, public ReadWrite { public: void write(DataOutputStream* out); void read(DataInputStream* in); - + void write(DataOutputStream* out, const osgSim::ShapeAttribute& sa); void read(DataInputStream* in, osgSim::ShapeAttribute& sa); }; diff --git a/src/osgPlugins/ive/ShapeDrawable.cpp b/src/osgPlugins/ive/ShapeDrawable.cpp index c640473da..1ea56765d 100644 --- a/src/osgPlugins/ive/ShapeDrawable.cpp +++ b/src/osgPlugins/ive/ShapeDrawable.cpp @@ -88,7 +88,7 @@ void ShapeDrawable::read(DataInputStream* in) else in_THROW_EXCEPTION("ShapeDrawable::read(): Could not cast this osg::ShapeDrawable to an osg::Object."); } - + // Read ShapeDrawable's properties setColor(in->readVec4()); diff --git a/src/osgPlugins/ive/StateSet.cpp b/src/osgPlugins/ive/StateSet.cpp index 049df99ee..188377dd9 100644 --- a/src/osgPlugins/ive/StateSet.cpp +++ b/src/osgPlugins/ive/StateSet.cpp @@ -106,31 +106,31 @@ void StateSet::read(DataInputStream* in){ if(id == IVESTATESET){ // Code to read StateSet's properties. id = in->readInt(); - + // If the osg class is inherited by any other class we should also read this from file. osg::Object* obj = dynamic_cast(this); if(obj){ ((ive::Object*)(obj))->read(in);; } else - in_THROW_EXCEPTION("StateSet::read(): Could not cast this osg::StateSet to an osg::Object."); + in_THROW_EXCEPTION("StateSet::read(): Could not cast this osg::StateSet to an osg::Object."); // Read render bin details. char c = in->readChar(); int num = in->readInt(); std::string name = in->readString(); switch((int)c){ - case 0: - setRenderBinDetails(num, name, osg::StateSet::INHERIT_RENDERBIN_DETAILS); + case 0: + setRenderBinDetails(num, name, osg::StateSet::INHERIT_RENDERBIN_DETAILS); break; - case 1: - setRenderBinDetails(num, name, osg::StateSet::USE_RENDERBIN_DETAILS); + case 1: + setRenderBinDetails(num, name, osg::StateSet::USE_RENDERBIN_DETAILS); break; - case 2: - setRenderBinDetails(num, name, osg::StateSet::OVERRIDE_RENDERBIN_DETAILS); + case 2: + setRenderBinDetails(num, name, osg::StateSet::OVERRIDE_RENDERBIN_DETAILS); break; - case 3: - setRenderBinDetails(num, name, osg::StateSet::USE_RENDERBIN_DETAILS); + case 3: + setRenderBinDetails(num, name, osg::StateSet::USE_RENDERBIN_DETAILS); break; default: in_THROW_EXCEPTION("Unknown RenderBinMode in StateSet::read()"); } @@ -144,13 +144,13 @@ void StateSet::read(DataInputStream* in){ setMode((osg::StateAttribute::GLMode)mode, (osg::StateAttribute::GLModeValue)value); } - // Read state attributes + // Read state attributes size = in->readInt(); for(i=0;ireadStateAttribute(); setAttribute(attribute, (osg::StateAttribute::OverrideValue)in->readInt()); } - + // Read texture stateset mode. int nUnits = in->readInt(); int unit; @@ -177,7 +177,7 @@ void StateSet::read(DataInputStream* in){ if ( in->getVersion() >= VERSION_0010 ) { - // Read uniforms + // Read uniforms size = in->readInt(); for(i=0;iwriteInt(getFunction()); out->writeInt(getFunctionRef()); out->writeUInt(getFunctionMask()); - + out->writeInt(getStencilFailOperation()); out->writeInt(getStencilPassAndDepthFailOperation()); out->writeInt(getStencilPassAndDepthPassOperation()); - + out->writeUInt(getWriteMask()); - + } @@ -61,11 +61,11 @@ void Stencil::read(DataInputStream* in){ setFunction((Function)in->readInt()); setFunctionRef(in->readInt()); setFunctionMask(in->readUInt()); - + setStencilFailOperation((Operation)in->readInt()); setStencilPassAndDepthFailOperation((Operation)in->readInt()); setStencilPassAndDepthPassOperation((Operation)in->readInt()); - + setWriteMask(in->readUInt()); } diff --git a/src/osgPlugins/ive/StencilTwoSided.cpp b/src/osgPlugins/ive/StencilTwoSided.cpp index 8ebccd935..caddb4f46 100644 --- a/src/osgPlugins/ive/StencilTwoSided.cpp +++ b/src/osgPlugins/ive/StencilTwoSided.cpp @@ -29,17 +29,17 @@ void StencilTwoSided::write(DataOutputStream* out){ else out_THROW_EXCEPTION("Stencil::write(): Could not cast this osg::Stencil to an osg::Object."); // Write Stencil's properties. - + out->writeInt(getFunction(FRONT)); out->writeInt(getFunctionRef(FRONT)); out->writeUInt(getFunctionMask(FRONT)); - + out->writeInt(getStencilFailOperation(FRONT)); out->writeInt(getStencilPassAndDepthFailOperation(FRONT)); out->writeInt(getStencilPassAndDepthPassOperation(FRONT)); - + out->writeUInt(getWriteMask(FRONT)); - + out->writeInt(getFunction(BACK)); out->writeInt(getFunctionRef(BACK)); out->writeUInt(getFunctionMask(BACK)); @@ -69,11 +69,11 @@ void StencilTwoSided::read(DataInputStream* in){ setFunction(FRONT, (Function)in->readInt()); setFunctionRef(FRONT, in->readInt()); setFunctionMask(FRONT, in->readUInt()); - + setStencilFailOperation(FRONT, (Operation)in->readInt()); setStencilPassAndDepthFailOperation(FRONT, (Operation)in->readInt()); setStencilPassAndDepthPassOperation(FRONT, (Operation)in->readInt()); - + setWriteMask(FRONT, in->readUInt()); setFunction(BACK, (Function)in->readInt()); diff --git a/src/osgPlugins/ive/SwitchLayer.cpp b/src/osgPlugins/ive/SwitchLayer.cpp index 4c44ada0b..fb12e8caf 100644 --- a/src/osgPlugins/ive/SwitchLayer.cpp +++ b/src/osgPlugins/ive/SwitchLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -39,7 +39,7 @@ void SwitchLayer::read(DataInputStream* in) int id = in->peekInt(); if (id != IVESWITCHLAYER) in_THROW_EXCEPTION("SwitchLayer::read(): Expected SwitchLayer identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/Terrain.cpp b/src/osgPlugins/ive/Terrain.cpp index 4b5ed7dac..9a1bc8799 100644 --- a/src/osgPlugins/ive/Terrain.cpp +++ b/src/osgPlugins/ive/Terrain.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/Terrain.h b/src/osgPlugins/ive/Terrain.h index 51547f1a5..d8d3dc46b 100644 --- a/src/osgPlugins/ive/Terrain.h +++ b/src/osgPlugins/ive/Terrain.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/TerrainTile.cpp b/src/osgPlugins/ive/TerrainTile.cpp index 072a6f9e3..b27a1c09a 100644 --- a/src/osgPlugins/ive/TerrainTile.cpp +++ b/src/osgPlugins/ive/TerrainTile.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -71,9 +71,9 @@ void TerrainTile::write(DataOutputStream* out) helper.writeLayer(out, getColorLayer(i)); } } - + writeTerrainTechnique(out, getTerrainTechnique()); - + } void TerrainTile::read(DataInputStream* in) @@ -98,7 +98,7 @@ void TerrainTile::read(DataInputStream* in) if (in->getVersion() >= VERSION_0026) { - + int level = in->readInt(); int x = in->readInt(); int y = in->readInt(); @@ -115,7 +115,7 @@ void TerrainTile::read(DataInputStream* in) for(unsigned int i=0; ireadLayer()); - } + } } else { @@ -131,7 +131,7 @@ void TerrainTile::read(DataInputStream* in) setColorLayer(i, helper.readLayer(in)); } } - + setTerrainTechnique(readTerrainTechnique(in)); if (in->getOptions()) @@ -143,7 +143,7 @@ void TerrainTile::read(DataInputStream* in) } } - if (osgTerrain::TerrainTile::getTileLoadedCallback().valid()) + if (osgTerrain::TerrainTile::getTileLoadedCallback().valid()) osgTerrain::TerrainTile::getTileLoadedCallback()->loaded(this, in->getOptions()); } diff --git a/src/osgPlugins/ive/TerrainTile.h b/src/osgPlugins/ive/TerrainTile.h index 1b7458aba..37444ebae 100644 --- a/src/osgPlugins/ive/TerrainTile.h +++ b/src/osgPlugins/ive/TerrainTile.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ public: static void writeTerrainTechnique(DataOutputStream* out, osgTerrain::TerrainTechnique* technique); static osgTerrain::TerrainTechnique* readTerrainTechnique(DataInputStream* out); - + }; } diff --git a/src/osgPlugins/ive/TexEnvCombine.cpp b/src/osgPlugins/ive/TexEnvCombine.cpp index 9839bb4f8..d2ff18210 100644 --- a/src/osgPlugins/ive/TexEnvCombine.cpp +++ b/src/osgPlugins/ive/TexEnvCombine.cpp @@ -29,7 +29,7 @@ void TexEnvCombine::write(DataOutputStream* out){ else out_THROW_EXCEPTION("TexEnvCombine::write(): Could not cast this osg::TexEnvCombine to an osg::Object."); // Write TexEnvCombine's properties. - + // Write combine method out->writeInt(getCombine_RGB()); out->writeInt(getCombine_Alpha()); diff --git a/src/osgPlugins/ive/TexGen.cpp b/src/osgPlugins/ive/TexGen.cpp index b05f8824e..40af77f07 100644 --- a/src/osgPlugins/ive/TexGen.cpp +++ b/src/osgPlugins/ive/TexGen.cpp @@ -57,7 +57,7 @@ void TexGen::read(DataInputStream* in){ in_THROW_EXCEPTION("TexGen::read(): Could not cast this osg::TexGen to an osg::Object."); // Read TexGen's properties setMode((osg::TexGen::Mode)in->readInt()); - + if ( in->getVersion() >= VERSION_0005 ) { setPlane(osg::TexGen::S, in->readPlane()); diff --git a/src/osgPlugins/ive/TexMat.cpp b/src/osgPlugins/ive/TexMat.cpp index 94a56f5b4..e6daf8e94 100644 --- a/src/osgPlugins/ive/TexMat.cpp +++ b/src/osgPlugins/ive/TexMat.cpp @@ -57,7 +57,7 @@ void TexMat::read(DataInputStream* in){ // Read matrix setMatrix(in->readMatrixf()); - + if ( in->getVersion() >= VERSION_0017 ) { setScaleByTextureRectangleSize(in->readBool()); diff --git a/src/osgPlugins/ive/Text.cpp b/src/osgPlugins/ive/Text.cpp index 9d2b637bc..0031a0810 100644 --- a/src/osgPlugins/ive/Text.cpp +++ b/src/osgPlugins/ive/Text.cpp @@ -33,7 +33,7 @@ void Text::write(DataOutputStream* out){ } else out_THROW_EXCEPTION("Text::write(): Could not cast this osgText::Text to an osg::Drawable."); - + // Write Text's properties. if( getFont() ) { @@ -63,9 +63,9 @@ void Text::write(DataOutputStream* out){ out->writeUInt(getCharacterSizeMode()); out->writeFloat(getMaximumWidth()); out->writeFloat(getMaximumHeight()); - + out->writeFloat(getLineSpacing()); - + out->writeUInt(getAlignment()); out->writeQuat(getRotation()); //FIXME: controllare che ci sia @@ -122,7 +122,7 @@ void Text::write(DataOutputStream* out){ } //std::copy(textstring.begin(),textstring.end(),std::back_inserter(str)); - + out->writeBool(true); out->writeString(str); } @@ -130,7 +130,7 @@ void Text::write(DataOutputStream* out){ { // do it the hardway...output each character as an int osg::ref_ptr strarr = new osg::UIntArray(textstring.size()); - + for(itr=textstring.begin(); itr!=textstring.end(); ++itr) @@ -215,7 +215,7 @@ void Text::read(DataInputStream* in){ setBackdropImplementation((osgText::Text::BackdropImplementation) in->readUInt()); setColorGradientMode((osgText::Text::ColorGradientMode) in->readUInt()); - osg::Vec4 colorGradientTopLeft,colorGradientBottomLeft,colorGradientBottomRight,colorGradientTopRight; + osg::Vec4 colorGradientTopLeft,colorGradientBottomLeft,colorGradientBottomRight,colorGradientTopRight; colorGradientTopLeft = in->readVec4(); colorGradientBottomLeft = in->readVec4(); colorGradientBottomRight = in->readVec4(); diff --git a/src/osgPlugins/ive/Text3D.cpp b/src/osgPlugins/ive/Text3D.cpp index a0bcff4c8..7f43e578e 100644 --- a/src/osgPlugins/ive/Text3D.cpp +++ b/src/osgPlugins/ive/Text3D.cpp @@ -34,7 +34,7 @@ void Text3D::write(DataOutputStream* out){ } else out_THROW_EXCEPTION("Text::write(): Could not cast this osgText::Text to an osg::Drawable."); - + // Write Text's properties. if( getFont() ) { @@ -64,9 +64,9 @@ void Text3D::write(DataOutputStream* out){ out->writeUInt(getCharacterSizeMode()); out->writeFloat(getMaximumWidth()); out->writeFloat(getMaximumHeight()); - + out->writeFloat(getLineSpacing()); - + out->writeUInt(getAlignment()); out->writeQuat(getRotation()); //FIXME: controllare che ci sia @@ -104,7 +104,7 @@ void Text3D::write(DataOutputStream* out){ } //std::copy(textstring.begin(),textstring.end(),std::back_inserter(str)); - + out->writeBool(true); out->writeString(str); } @@ -112,7 +112,7 @@ void Text3D::write(DataOutputStream* out){ { // do it the hardway...output each character as an int osg::ref_ptr strarr = new osg::UIntArray(textstring.size()); - + for(itr=textstring.begin(); itr!=textstring.end(); ++itr) diff --git a/src/osgPlugins/ive/Texture.cpp b/src/osgPlugins/ive/Texture.cpp index 4682a9225..3db4bb4dc 100644 --- a/src/osgPlugins/ive/Texture.cpp +++ b/src/osgPlugins/ive/Texture.cpp @@ -42,7 +42,7 @@ void Texture::write(DataOutputStream* out){ out->writeVec4(_borderColor); out->writeInt(_internalFormatMode); - + if ( out->getVersion() >= VERSION_0008 ) { out->writeInt(_internalFormat); @@ -56,7 +56,7 @@ void Texture::write(DataOutputStream* out){ out->writeBool(_clientStorageHint); out->writeBool(_resizeNonPowerOfTwoHint); } - + if ( out->getVersion() >= VERSION_0014 ) { out->writeInt(_sourceFormat); diff --git a/src/osgPlugins/ive/Texture1D.cpp b/src/osgPlugins/ive/Texture1D.cpp index 7bf250a48..af39d074b 100644 --- a/src/osgPlugins/ive/Texture1D.cpp +++ b/src/osgPlugins/ive/Texture1D.cpp @@ -6,7 +6,7 @@ * * CREATED BY: Copied from Texture 2D.cpp and edited for Texture 1D * by Don Burns - * + * * HISTORY: Created 27.1.2004 * * Copyright 2003 VR-C, OSGPL @@ -50,7 +50,7 @@ void Texture1D::read(DataInputStream* in){ else in_THROW_EXCEPTION("Texture1D::read(): Could not cast this osg::Texture1D to an osg::Texture."); // Read image. - + // Should we read image data from stream osg::Image *image = in->readImage(); if(image) { diff --git a/src/osgPlugins/ive/Texture2D.cpp b/src/osgPlugins/ive/Texture2D.cpp index bb1d55889..a8218739c 100644 --- a/src/osgPlugins/ive/Texture2D.cpp +++ b/src/osgPlugins/ive/Texture2D.cpp @@ -50,7 +50,7 @@ void Texture2D::read(DataInputStream* in){ else in_THROW_EXCEPTION("Texture2D::read(): Could not cast this osg::Texture2D to an osg::Texture."); // Read image. - + osg::Image *image = in->readImage(); if(image) { setImage(image); diff --git a/src/osgPlugins/ive/Texture2DArray.h b/src/osgPlugins/ive/Texture2DArray.h index 0fdaae749..55c71c102 100644 --- a/src/osgPlugins/ive/Texture2DArray.h +++ b/src/osgPlugins/ive/Texture2DArray.h @@ -7,7 +7,7 @@ namespace ive { -class Texture2DArray : public osg::Texture2DArray, public ReadWrite +class Texture2DArray : public osg::Texture2DArray, public ReadWrite { public: void write(DataOutputStream* out); diff --git a/src/osgPlugins/ive/Texture3D.cpp b/src/osgPlugins/ive/Texture3D.cpp index d9f33db7e..31d12d724 100644 --- a/src/osgPlugins/ive/Texture3D.cpp +++ b/src/osgPlugins/ive/Texture3D.cpp @@ -50,7 +50,7 @@ void Texture3D::read(DataInputStream* in){ else in_THROW_EXCEPTION("Texture3D::read(): Could not cast this osg::Texture3D to an osg::Texture."); // Read image. - + // Should we read image data from stream osg::Image *image = in->readImage(); if(image) { diff --git a/src/osgPlugins/ive/TextureCubeMap.cpp b/src/osgPlugins/ive/TextureCubeMap.cpp index 43b4e0745..98ab2a960 100644 --- a/src/osgPlugins/ive/TextureCubeMap.cpp +++ b/src/osgPlugins/ive/TextureCubeMap.cpp @@ -107,7 +107,7 @@ void TextureCubeMap::read(DataInputStream* in) setImage(osg::TextureCubeMap::POSITIVE_Z,in->readImage(includeImg)); setImage(osg::TextureCubeMap::NEGATIVE_Z,in->readImage(includeImg)); } - + } else{ in_THROW_EXCEPTION("TextureCubeMap::read(): Expected TextureCubeMap identification."); diff --git a/src/osgPlugins/ive/TextureCubeMap.h b/src/osgPlugins/ive/TextureCubeMap.h index 1bdfcc51b..a3bfda496 100644 --- a/src/osgPlugins/ive/TextureCubeMap.h +++ b/src/osgPlugins/ive/TextureCubeMap.h @@ -7,7 +7,7 @@ namespace ive { -class TextureCubeMap : public osg::TextureCubeMap, public ReadWrite +class TextureCubeMap : public osg::TextureCubeMap, public ReadWrite { public: void write(DataOutputStream* out); diff --git a/src/osgPlugins/ive/TextureRectangle.cpp b/src/osgPlugins/ive/TextureRectangle.cpp index 2d95890cb..d8e2b846c 100644 --- a/src/osgPlugins/ive/TextureRectangle.cpp +++ b/src/osgPlugins/ive/TextureRectangle.cpp @@ -50,7 +50,7 @@ void TextureRectangle::read(DataInputStream* in){ else in_THROW_EXCEPTION("TextureRectangle::read(): Could not cast this osg::TextureRectangle to an osg::Texture."); // Read image. - + // Should we read image data from stream osg::Image *image = in->readImage(); if(image) { diff --git a/src/osgPlugins/ive/Uniform.cpp b/src/osgPlugins/ive/Uniform.cpp index 2cc9905d6..367598738 100644 --- a/src/osgPlugins/ive/Uniform.cpp +++ b/src/osgPlugins/ive/Uniform.cpp @@ -32,7 +32,7 @@ void Uniform::write(DataOutputStream* out){ out_THROW_EXCEPTION("Uniform::write(): Could not cast this osg::Uniform to an osg::Object."); out->writeInt(getType()); - + if ( out->getVersion() < VERSION_0012 ) { out->writeString(getName()); @@ -163,14 +163,14 @@ void Uniform::read(DataInputStream* in) { in_THROW_EXCEPTION("Uniform::read(): Expected Uniform identification."); } - + setType(static_cast(in->readInt())); if ( in->getVersion() < VERSION_0012 ) { setName(in->readString()); } - + if ( in->getVersion() >= VERSION_0016 ) { setNumElements( in->readUInt() ); diff --git a/src/osgPlugins/ive/Volume.cpp b/src/osgPlugins/ive/Volume.cpp index b0c64a092..fc12a7e7d 100644 --- a/src/osgPlugins/ive/Volume.cpp +++ b/src/osgPlugins/ive/Volume.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/Volume.h b/src/osgPlugins/ive/Volume.h index c2696d0c0..5d0e3ab27 100644 --- a/src/osgPlugins/ive/Volume.h +++ b/src/osgPlugins/ive/Volume.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeCompositeLayer.cpp b/src/osgPlugins/ive/VolumeCompositeLayer.cpp index 412c8c471..6fc1b0f31 100644 --- a/src/osgPlugins/ive/VolumeCompositeLayer.cpp +++ b/src/osgPlugins/ive/VolumeCompositeLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -52,7 +52,7 @@ void VolumeCompositeLayer::read(DataInputStream* in) int id = in->peekInt(); if (id != IVEVOLUMECOMPOSITELAYER) in_THROW_EXCEPTION("VolumeCompositeLayer::read(): Expected CompositeLayer identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/VolumeCompositeProperty.cpp b/src/osgPlugins/ive/VolumeCompositeProperty.cpp index cb35c189e..aad7ffa2a 100644 --- a/src/osgPlugins/ive/VolumeCompositeProperty.cpp +++ b/src/osgPlugins/ive/VolumeCompositeProperty.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -45,7 +45,7 @@ void VolumeCompositeProperty::read(DataInputStream* in) int id = in->peekInt(); if (id != IVEVOLUMECOMPOSITEPROPERTY) in_THROW_EXCEPTION("VolumeCompositeProperty::read(): Expected CompositeProperty identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/VolumeCompositeProperty.h b/src/osgPlugins/ive/VolumeCompositeProperty.h index 8bc6ddbbb..ec0ce6083 100644 --- a/src/osgPlugins/ive/VolumeCompositeProperty.h +++ b/src/osgPlugins/ive/VolumeCompositeProperty.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeImageLayer.cpp b/src/osgPlugins/ive/VolumeImageLayer.cpp index 48f48c7a0..ae74743e4 100644 --- a/src/osgPlugins/ive/VolumeImageLayer.cpp +++ b/src/osgPlugins/ive/VolumeImageLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -47,7 +47,7 @@ void VolumeImageLayer::read(DataInputStream* in) int id = in->peekInt(); if (id != IVEVOLUMEIMAGELAYER) in_THROW_EXCEPTION("VolumeImageLayer::read(): Expected ImageLayer identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/VolumeImageLayer.h b/src/osgPlugins/ive/VolumeImageLayer.h index 518686e9e..29a1a09d4 100644 --- a/src/osgPlugins/ive/VolumeImageLayer.h +++ b/src/osgPlugins/ive/VolumeImageLayer.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeLayer.cpp b/src/osgPlugins/ive/VolumeLayer.cpp index a1ae2f2c2..125bec040 100644 --- a/src/osgPlugins/ive/VolumeLayer.cpp +++ b/src/osgPlugins/ive/VolumeLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -45,7 +45,7 @@ void VolumeLayer::read(DataInputStream* in) int id = in->peekInt(); if (id != IVEVOLUMELAYER) in_THROW_EXCEPTION("VolumeLayer::read(): Expected Layer identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/VolumeLayer.h b/src/osgPlugins/ive/VolumeLayer.h index e8db0b8cc..04da2dea1 100644 --- a/src/osgPlugins/ive/VolumeLayer.h +++ b/src/osgPlugins/ive/VolumeLayer.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeLocator.cpp b/src/osgPlugins/ive/VolumeLocator.cpp index 098c242f1..80eef856b 100644 --- a/src/osgPlugins/ive/VolumeLocator.cpp +++ b/src/osgPlugins/ive/VolumeLocator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -41,7 +41,7 @@ void VolumeLocator::read(DataInputStream* in) { in_THROW_EXCEPTION("VolumeLocator::read(): Expected Locator identification."); } - + // Read Locator's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/VolumeLocator.h b/src/osgPlugins/ive/VolumeLocator.h index c94914e49..d26e3d99b 100644 --- a/src/osgPlugins/ive/VolumeLocator.h +++ b/src/osgPlugins/ive/VolumeLocator.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeProperty.h b/src/osgPlugins/ive/VolumeProperty.h index e8db0b8cc..04da2dea1 100644 --- a/src/osgPlugins/ive/VolumeProperty.h +++ b/src/osgPlugins/ive/VolumeProperty.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeScalarProperty.cpp b/src/osgPlugins/ive/VolumeScalarProperty.cpp index c663fcc12..d9e1100d7 100644 --- a/src/osgPlugins/ive/VolumeScalarProperty.cpp +++ b/src/osgPlugins/ive/VolumeScalarProperty.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ void VolumeScalarProperty::read(DataInputStream* in) int id = in->peekInt(); if (id != IVEVOLUMESCALARPROPERTY) in_THROW_EXCEPTION("VolumeScalarProperty::read(): Expected CompositeProperty identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/VolumeScalarProperty.h b/src/osgPlugins/ive/VolumeScalarProperty.h index 75394b9d9..5cab12aa9 100644 --- a/src/osgPlugins/ive/VolumeScalarProperty.h +++ b/src/osgPlugins/ive/VolumeScalarProperty.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeSwitchProperty.cpp b/src/osgPlugins/ive/VolumeSwitchProperty.cpp index edd60767d..ed9a5f8cc 100644 --- a/src/osgPlugins/ive/VolumeSwitchProperty.cpp +++ b/src/osgPlugins/ive/VolumeSwitchProperty.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -40,7 +40,7 @@ void VolumeSwitchProperty::read(DataInputStream* in) int id = in->peekInt(); if (id != IVEVOLUMESWITCHPROPERTY) in_THROW_EXCEPTION("VolumeSwitchProperty::read(): Expected CompositeProperty identification."); - + // Read Layer's identification. id = in->readInt(); diff --git a/src/osgPlugins/ive/VolumeSwitchProperty.h b/src/osgPlugins/ive/VolumeSwitchProperty.h index 043a2e441..170a8b9fd 100644 --- a/src/osgPlugins/ive/VolumeSwitchProperty.h +++ b/src/osgPlugins/ive/VolumeSwitchProperty.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeTile.cpp b/src/osgPlugins/ive/VolumeTile.cpp index a91525d74..9142a96c1 100644 --- a/src/osgPlugins/ive/VolumeTile.cpp +++ b/src/osgPlugins/ive/VolumeTile.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -83,7 +83,7 @@ osgVolume::VolumeTechnique* VolumeTile::readVolumeTechnique(DataInputStream* in) { bool hasTechnique = in->readBool(); if (!hasTechnique) return 0; - + int id = in->readInt(); if (id==IVEVOLUMERAYTRACEDTECHNIQUE) { diff --git a/src/osgPlugins/ive/VolumeTile.h b/src/osgPlugins/ive/VolumeTile.h index 52cf9e0a5..ba9669fc8 100644 --- a/src/osgPlugins/ive/VolumeTile.h +++ b/src/osgPlugins/ive/VolumeTile.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -29,7 +29,7 @@ public: void writeVolumeTechnique(DataOutputStream* out, osgVolume::VolumeTechnique* technique); osgVolume::VolumeTechnique* readVolumeTechnique(DataInputStream* out); - + }; } diff --git a/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp b/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp index a0dd749f8..2d313f527 100644 --- a/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp +++ b/src/osgPlugins/ive/VolumeTransferFunctionProperty.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/ive/VolumeTransferFunctionProperty.h b/src/osgPlugins/ive/VolumeTransferFunctionProperty.h index 073d6731a..b17333307 100644 --- a/src/osgPlugins/ive/VolumeTransferFunctionProperty.h +++ b/src/osgPlugins/ive/VolumeTransferFunctionProperty.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgPlugins/jp2/ReaderWriterJP2.cpp b/src/osgPlugins/jp2/ReaderWriterJP2.cpp index 2e1a3e9de..7b3c6cc42 100644 --- a/src/osgPlugins/jp2/ReaderWriterJP2.cpp +++ b/src/osgPlugins/jp2/ReaderWriterJP2.cpp @@ -301,8 +301,8 @@ class ReaderWriterJP2 : public osgDB::ReaderWriter } jas_image_t* jimage = jas_image_decode(in, -1, opt); // last is the option string whatto put there? if(opt) delete[] opt; - - if (!jimage) return ReadResult::FILE_NOT_HANDLED; + + if (!jimage) return ReadResult::FILE_NOT_HANDLED; int internalFormat = jimage->numcmpts_; @@ -511,7 +511,7 @@ class ReaderWriterJP2 : public osgDB::ReaderWriter getdata(mem, jimage); jas_stream_t* out = jas_stream_memopen(0, 0); - if (!out) + if (!out) return WriteResult::ERROR_IN_WRITING_FILE; char* opt = 0; diff --git a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp index 02994bd11..b15d92f07 100644 --- a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp +++ b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp @@ -679,7 +679,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter default: { OSG_DEBUG << "ReaderWriterJPEG::write_JPEG_file - Error pixel format non supported" << std::endl; - return WriteResult::ERROR_IN_WRITING_FILE; break; + return WriteResult::ERROR_IN_WRITING_FILE; break; } } @@ -729,7 +729,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter { return WriteResult::ERROR_IN_WRITING_FILE; }*/ - + //jpeg_stdio_dest(&cinfo, outfile); osgDBJPEG::jpeg_stream_dest(&cinfo, &fout); @@ -834,7 +834,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter int r = 1; //int internalFormat = numComponents_ret; - int internalFormat = + int internalFormat = numComponents_ret == 1 ? GL_LUMINANCE : numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : numComponents_ret == 3 ? GL_RGB : diff --git a/src/osgPlugins/logo/ReaderWriterLOGO.cpp b/src/osgPlugins/logo/ReaderWriterLOGO.cpp index c58743a82..9748b3ae8 100644 --- a/src/osgPlugins/logo/ReaderWriterLOGO.cpp +++ b/src/osgPlugins/logo/ReaderWriterLOGO.cpp @@ -57,7 +57,7 @@ class Logos: public osg::Drawable vp->height() != logos->getViewport()->height() ) { logos->getViewport()->setViewport( vp->x(), vp->y(), vp->width(), vp->height() ); - logos->dirtyDisplayList(); + logos->dirtyDisplayList(); } } } @@ -65,7 +65,7 @@ class Logos: public osg::Drawable } }; - Logos() + Logos() { osg::StateSet *sset = new osg::StateSet; osg::BlendFunc *transp = new osg::BlendFunc; @@ -74,7 +74,7 @@ class Logos: public osg::Drawable sset->setMode( GL_BLEND, osg::StateAttribute::ON ); sset->setMode( GL_DEPTH_TEST, osg::StateAttribute::OFF ); sset->setTextureMode( 0, GL_TEXTURE_2D, osg::StateAttribute::OFF ); -#if 1 +#if 1 // for now we'll crudely set the bin number to 100 to force it to draw later and ontop of the scene sset->setRenderBinDetails( 100 , "RenderBin" ); #else @@ -97,7 +97,7 @@ class Logos: public osg::Drawable { #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) - if( renderInfo.getContextID() != _contextID ) + if( renderInfo.getContextID() != _contextID ) return; @@ -168,7 +168,7 @@ class Logos: public osg::Drawable glPopMatrix(); glMatrixMode( GL_PROJECTION ); glPopMatrix(); - glMatrixMode( GL_MODELVIEW ); + glMatrixMode( GL_MODELVIEW ); #else OSG_NOTICE<<"Warning: Logos::drawImplementation(..) not supported."<(tn); if( screen != n ) { @@ -317,10 +317,10 @@ class LOGOReaderWriter : public osgDB::ReaderWriter } } fclose( fp ); - + if( ld->hasLogos() ) geode->addDrawable( ld ); - + geode->setCullingActive(false); return geode; } diff --git a/src/osgPlugins/lwo/Block.cpp b/src/osgPlugins/lwo/Block.cpp index 1d4bd0e8d..800a257fe 100644 --- a/src/osgPlugins/lwo/Block.cpp +++ b/src/osgPlugins/lwo/Block.cpp @@ -122,7 +122,7 @@ void Block::compile(const lwo2::FORM::SURF::BLOK *blok) imap_.texture_amplitude = tamp->amplitude.fraction; } } - + } else { OSG_WARN << "Warning: lwosg::Block: only IMAP (image map) block types are supported, this block will be ignored" << std::endl; } @@ -136,7 +136,7 @@ osg::Vec3 Block::setup_texture_point(const osg::Vec3 &P) const Q -= imap_.mapping.center_; Q = Q * osg::Matrix::rotate(ypr.z(), osg::Vec3(0, 0, -1)); Q = Q * osg::Matrix::rotate(ypr.x(), osg::Vec3(0, 1, 0)); - Q = Q * osg::Matrix::rotate(ypr.y(), osg::Vec3(-1, 0, 0)); + Q = Q * osg::Matrix::rotate(ypr.y(), osg::Vec3(-1, 0, 0)); if (imap_.projection != Image_map::SPHERICAL) { Q.x() *= 1/imap_.mapping.size_.x(); Q.y() *= 1/imap_.mapping.size_.y(); diff --git a/src/osgPlugins/lwo/Block.h b/src/osgPlugins/lwo/Block.h index c43ad2683..55948f003 100644 --- a/src/osgPlugins/lwo/Block.h +++ b/src/osgPlugins/lwo/Block.h @@ -30,7 +30,7 @@ namespace lwosg osg::Vec3 center_; osg::Vec3 size_; - osg::Vec3 rotation_; + osg::Vec3 rotation_; // missing: OREF, FALL Coordinate_system_type csys_; diff --git a/src/osgPlugins/lwo/Converter.cpp b/src/osgPlugins/lwo/Converter.cpp index 06acd93f0..1b35b47bb 100644 --- a/src/osgPlugins/lwo/Converter.cpp +++ b/src/osgPlugins/lwo/Converter.cpp @@ -116,7 +116,7 @@ void Converter::build_scene_graph(Object &obj) // compute remapping map for default surface j->compute_vertex_remapping(0, remappings[0]); - // compute remapping maps for other surfaces + // compute remapping maps for other surfaces for (Object::Surface_map::const_iterator h=obj.surfaces().begin(); h!=obj.surfaces().end(); ++h) { j->compute_vertex_remapping(&h->second, remappings[&h->second]); } @@ -170,7 +170,7 @@ void Converter::build_scene_graph(Object &obj) const Unit::Index_list &remapping = remappings[surface]; // clean up points and normals according to remapping map - OSG_DEBUG << "DEBUG INFO: lwosg::Converter: \tcleaning up redundant vertices and vertex attributes for surface '" << (surface ? surface->get_name() : std::string("anonymous")) << "'\n"; + OSG_DEBUG << "DEBUG INFO: lwosg::Converter: \tcleaning up redundant vertices and vertex attributes for surface '" << (surface ? surface->get_name() : std::string("anonymous")) << "'\n"; osg::ref_ptr new_points = new osg::Vec3Array; osg::ref_ptr new_normals = new osg::Vec3Array; for (unsigned pi=0; pipoints()->size(); ++pi) { @@ -179,13 +179,13 @@ void Converter::build_scene_graph(Object &obj) new_normals->push_back((*normals)[pi]); } } - + OSG_DEBUG << "DEBUG INFO: lwosg::Converter: \tcreating geometry for surface '" << (surface ? surface->get_name() : std::string("anonymous")) << "'\n"; osg::ref_ptr geo = new osg::Geometry; geo->setVertexArray(new_points.get()); geo->setNormalArray(new_normals.get()); - geo->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); + geo->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); bool group_used = false; @@ -208,7 +208,7 @@ void Converter::build_scene_graph(Object &obj) options_.force_arb_compression, options_.texturemap_bindings, db_options_.get()); - if (sgrp) + if (sgrp) { group_used = true; osg::ref_ptr grp_geode = new osg::Geode; diff --git a/src/osgPlugins/lwo/Converter.h b/src/osgPlugins/lwo/Converter.h index d21fe0a4a..ce97d67b0 100644 --- a/src/osgPlugins/lwo/Converter.h +++ b/src/osgPlugins/lwo/Converter.h @@ -34,11 +34,11 @@ namespace lwosg VertexMap_binding_map texturemap_bindings; Options() - : csf(new LwoCoordFixer), - max_tex_units(0), - apply_light_model(true), - use_osgfx(false), - force_arb_compression(false), + : csf(new LwoCoordFixer), + max_tex_units(0), + apply_light_model(true), + use_osgfx(false), + force_arb_compression(false), combine_geodes(false) { } diff --git a/src/osgPlugins/lwo/Layer.h b/src/osgPlugins/lwo/Layer.h index f848a9b82..32f884035 100644 --- a/src/osgPlugins/lwo/Layer.h +++ b/src/osgPlugins/lwo/Layer.h @@ -22,7 +22,7 @@ namespace lwosg inline Layer(); inline const lwo2::FORM::LAYR *get_layer_chunk() const; - inline void set_layer_chunk(const lwo2::FORM::LAYR *layr); + inline void set_layer_chunk(const lwo2::FORM::LAYR *layr); inline int number() const; diff --git a/src/osgPlugins/lwo/Object.cpp b/src/osgPlugins/lwo/Object.cpp index 74a00377f..20216a2df 100644 --- a/src/osgPlugins/lwo/Object.cpp +++ b/src/osgPlugins/lwo/Object.cpp @@ -119,7 +119,7 @@ void Object::parse(const iff::Chunk_list &data) if (pnts) { Unit new_unit; for (lwo2::FORM::PNTS::Point_list::const_iterator i=pnts->point_location.begin(); i!=pnts->point_location.end(); ++i) { - new_unit.points()->push_back(csf_->fix_point(osg::Vec3(i->X, i->Y, i->Z) /*+ current_layer.pivot()*/)); + new_unit.points()->push_back(csf_->fix_point(osg::Vec3(i->X, i->Y, i->Z) /*+ current_layer.pivot()*/)); } new_unit.shares().assign(new_unit.points()->size(), Unit::Index_list()); current_layer.units().push_back(new_unit); @@ -274,7 +274,7 @@ void Object::parse(const iff::Chunk_list &data) for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) { VertexMap *this_map = current_layer.units().back().polygons().at(i->poly.index).weight_maps()->getOrCreate(vmad->name); (*this_map)[i->vert.index] = osg::Vec4(i->value.at(0), 0, 0, 0); - } + } } if (type == "TXUV") { if (vmad->dimension != 2) { @@ -284,7 +284,7 @@ void Object::parse(const iff::Chunk_list &data) for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) { VertexMap *this_map = current_layer.units().back().polygons().at(i->poly.index).texture_maps()->getOrCreate(vmad->name); (*this_map)[i->vert.index] = osg::Vec4(i->value.at(0), i->value.at(1), 0, 0); - } + } } if (type == "RGB ") { if (vmad->dimension != 3) { @@ -294,7 +294,7 @@ void Object::parse(const iff::Chunk_list &data) for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) { VertexMap *this_map = current_layer.units().back().polygons().at(i->poly.index).rgb_maps()->getOrCreate(vmad->name); (*this_map)[i->vert.index] = osg::Vec4(i->value.at(0), i->value.at(1), i->value.at(2), 1); - } + } } if (type == "RGBA") { if (vmad->dimension != 4) { @@ -304,7 +304,7 @@ void Object::parse(const iff::Chunk_list &data) for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) { VertexMap *this_map = current_layer.units().back().polygons().at(i->poly.index).rgba_maps()->getOrCreate(vmad->name); (*this_map)[i->vert.index] = osg::Vec4(i->value.at(0), i->value.at(1), i->value.at(2), i->value.at(3)); - } + } } } @@ -429,7 +429,7 @@ void Object::generate_auto_texture_maps() case Image_map::Y: uv.set(cylindrical_angle(P.x(), P.z()), P.y()); break; case Image_map::Z: uv.set(cylindrical_angle(P.x(), -P.y()), P.z()); break; default: ; - } + } uv.x() *= block.get_image_map().wrap_amount_w; uv += osg::Vec2(0, 0.5f); } diff --git a/src/osgPlugins/lwo/Object.h b/src/osgPlugins/lwo/Object.h index 5fc624ec1..ef0cf147f 100644 --- a/src/osgPlugins/lwo/Object.h +++ b/src/osgPlugins/lwo/Object.h @@ -85,7 +85,7 @@ namespace lwosg void generate_normals(); void generate_auto_texture_maps(); - private: + private: Layer_map layers_; typedef std::map Clip_map; diff --git a/src/osgPlugins/lwo/Polygon.h b/src/osgPlugins/lwo/Polygon.h index 134547995..52e44ff1e 100644 --- a/src/osgPlugins/lwo/Polygon.h +++ b/src/osgPlugins/lwo/Polygon.h @@ -68,7 +68,7 @@ namespace lwosg protected: inline void dirty_normal() { last_used_points_ = 0; } - private: + private: Index_list indices_; Duplication_map dup_vertices_; diff --git a/src/osgPlugins/lwo/ReaderWriterLWO.cpp b/src/osgPlugins/lwo/ReaderWriterLWO.cpp index c06c7b502..a27954874 100644 --- a/src/osgPlugins/lwo/ReaderWriterLWO.cpp +++ b/src/osgPlugins/lwo/ReaderWriterLWO.cpp @@ -6,8 +6,8 @@ * Copyright (C) 2001 Ulrich Hertlein * Improved LWO2 reader is (C) 2003-2004 Marco Jez * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ @@ -54,24 +54,24 @@ public: supportsExtension("lw","Lightwave object format"); supportsExtension("geo","Lightwave geometry format"); } - + virtual const char* className() const { return "Lightwave Object Reader"; } virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { - std::string ext = osgDB::getLowerCaseFileExtension(file); + std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; std::string fileName = osgDB::findDataFile( file, options ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); ReadResult result = readNode_LWO1(fileName,local_opt.get()); if (result.success()) return result; - + if (!options || options->getOptionString() != "USE_OLD_READER") { ReadResult result = readNode_LWO2(fileName, local_opt.get()); if (result.success()) return result; @@ -88,7 +88,7 @@ public: protected: - + }; @@ -196,7 +196,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string typedef std::map MaterialToGeometryCollectionMap; MaterialToGeometryCollectionMap mtgcm; - + // bin the indices for each material into the mtis; int i; for (i = 0; i < lw->face_cnt; ++i) @@ -210,7 +210,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string if (face.texcoord) gc._numPrimitivesWithTexCoords += 1; } } - + MaterialToGeometryCollectionMap::iterator itr; for(itr=mtgcm.begin(); itr!=mtgcm.end(); ++itr) { @@ -221,7 +221,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string lwMaterial& lw_material = lw->material[itr->first]; gc._geom = new osg::Geometry; - + osg::Vec3Array* vertArray = new osg::Vec3Array(gc._numPoints); gc._vertices = vertArray->begin(); gc._geom->setVertexArray(vertArray); @@ -232,10 +232,10 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string lw_material.g, lw_material.b, 1.0f); - + gc._geom->setColorArray(colors); gc._geom->setColorBinding(osg::Geometry::BIND_OVERALL); - + // set up texture if needed. if (gc._numPrimitivesWithTexCoords==gc._numPrimitives) { @@ -266,7 +266,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); gc._texturesActive=true; - + gc._geom->setStateSet(stateset); osg::Vec2Array* texcoordArray = new osg::Vec2Array(gc._numPoints); @@ -275,17 +275,17 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string } } } - } + } } - - + + for (i = 0; i < lw->face_cnt; ++i) { lwFace& face = lw->face[i]; if (face.index_cnt>=3) { GeometryCollection& gc = mtgcm[face.material]; - + osg::PrimitiveSet::Mode mode; switch(face.index_cnt) { @@ -308,7 +308,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string mode = osg::PrimitiveSet::POLYGON; break; } - + gc._geom->addPrimitiveSet(new osg::DrawArrays(mode,gc._coordCount,face.index_cnt)); gc._coordCount += face.index_cnt; @@ -325,22 +325,22 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string { (*gc._vertices++).set(lw->vertex[face.index[j]*3], lw->vertex[face.index[j]*3+2], lw->vertex[face.index[j]*3+1]); } - + if (gc._texturesActive && face.texcoord) { for(j=face.index_cnt-1;j>=0;--j) { (*gc._texcoords++).set(face.texcoord[j*2],face.texcoord[j*2+1]); - } - } + } + } } } osg::Geode* geode = new osg::Geode; - + osgUtil::Tessellator tessellator; - - // add everthing into the Geode. + + // add everthing into the Geode. osgUtil::SmoothingVisitor smoother; for(itr=mtgcm.begin(); itr!=mtgcm.end(); @@ -349,11 +349,11 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string GeometryCollection& gc = itr->second; if (gc._geom) { - + tessellator.retessellatePolygons(*gc._geom); - + smoother.smooth(*gc._geom); - + geode->addDrawable(gc._geom); } diff --git a/src/osgPlugins/lwo/Surface.cpp b/src/osgPlugins/lwo/Surface.cpp index ee29321a4..17f34150e 100644 --- a/src/osgPlugins/lwo/Surface.cpp +++ b/src/osgPlugins/lwo/Surface.cpp @@ -121,7 +121,7 @@ void Surface::compile(const lwo2::FORM::SURF *surf, const Clip_map &clips) new_block.get_image_map().clip = &i->second; } else { OSG_WARN << "Warning: lwosg::Surface: cannot find clip number " << new_block.get_image_map().image_map << std::endl; - } + } } blocks_.insert(Block_map::value_type(new_block.get_ordinal(), new_block)); } @@ -195,7 +195,7 @@ void Surface::generate_stateset(unsigned int max_tex_units, bool force_arb_compr OSG_WARN << "Warning: lwosg::Surface: maximum number of texture units (" << max_tex_units << ") has been reached, skipping incoming blocks" << std::endl; break; } - + osg::ref_ptr image = osgDB::readRefImageFile(image_file, db_options); if (!image) break; @@ -324,7 +324,7 @@ osg::Group *Surface::apply(osg::Geometry *geo, const VertexMap_map *texture_maps } } } - + osg::Vec4 color = osg::Vec4(base_color_, 1-transparency_); const VertexMap_map *color_maps = 0; diff --git a/src/osgPlugins/lwo/Tessellator.cpp b/src/osgPlugins/lwo/Tessellator.cpp index 51e6d2e82..7450fb16b 100644 --- a/src/osgPlugins/lwo/Tessellator.cpp +++ b/src/osgPlugins/lwo/Tessellator.cpp @@ -9,7 +9,7 @@ using namespace lwosg; -namespace lwosg +namespace lwosg { void CALLBACK cb_begin_data(GLenum type, void *data) @@ -52,7 +52,7 @@ bool Tessellator::tessellate(const Polygon &poly, const osg::Vec3Array *points, osg::gluTessCallback(tess, GLU_TESS_ERROR_DATA, (osg::GLU_TESS_CALLBACK) (cb_error_data)); osg::gluTessBeginPolygon(tess, this); - osg::gluTessBeginContour(tess); + osg::gluTessBeginContour(tess); double *vertices = new double[poly.indices().size() * 3]; int *indices = new int[poly.indices().size()]; diff --git a/src/osgPlugins/lwo/Unit.cpp b/src/osgPlugins/lwo/Unit.cpp index 4a527a01e..e6d88ff3e 100644 --- a/src/osgPlugins/lwo/Unit.cpp +++ b/src/osgPlugins/lwo/Unit.cpp @@ -71,7 +71,7 @@ void Unit::generate_normals() } for (Polygon::Index_list::const_iterator j=poly.indices().begin(); j!=poly.indices().end(); ++j) { - + osg::Vec4 N(poly.face_normal(points_.get()), 0); unsigned num_smoothed = 1; @@ -106,7 +106,7 @@ void Unit::flatten_maps() i->local_normals()->clear(); VertexMap_map::const_iterator j; - + // flatten weight maps while (!i->weight_maps()->empty()) { VertexMap_map::iterator j = i->weight_maps()->begin(); @@ -174,7 +174,7 @@ void Unit::flatten_map(Polygon &poly, const VertexMap *local_map, VertexMap *glo if (vm->second->find(*i) != vm->second->end()) (*vm->second.get())[new_index] = (*vm->second.get())[*i]; } - + // duplicate subpatch weights for (vm=subpatch_weight_maps()->begin(); vm!=subpatch_weight_maps()->end(); ++vm) { if (vm->second->find(*i) != vm->second->end()) @@ -186,32 +186,32 @@ void Unit::flatten_map(Polygon &poly, const VertexMap *local_map, VertexMap *glo if (vm->second->find(*i) != vm->second->end()) (*vm->second.get())[new_index] = (*vm->second.get())[*i]; } - + // duplicate RGBs for (vm=rgb_maps()->begin(); vm!=rgb_maps()->end(); ++vm) { if (vm->second->find(*i) != vm->second->end()) (*vm->second.get())[new_index] = (*vm->second.get())[*i]; } - + // duplicate RGBAs for (vm=rgba_maps()->begin(); vm!=rgba_maps()->end(); ++vm) { if (vm->second->find(*i) != vm->second->end()) (*vm->second.get())[new_index] = (*vm->second.get())[*i]; } - + // duplicate displacements for (vm=displacement_maps()->begin(); vm!=displacement_maps()->end(); ++vm) { if (vm->second->find(*i) != vm->second->end()) (*vm->second.get())[new_index] = (*vm->second.get())[*i]; } - + // duplicate spots for (vm=spot_maps()->begin(); vm!=spot_maps()->end(); ++vm) { if (vm->second->find(*i) != vm->second->end()) (*vm->second.get())[new_index] = (*vm->second.get())[*i]; - } - - // update vertex index + } + + // update vertex index poly.dup_vertices()[j] = *i; *i = new_index; } diff --git a/src/osgPlugins/lwo/iffparser.h b/src/osgPlugins/lwo/iffparser.h index 0376adbab..ba2c215cb 100644 --- a/src/osgPlugins/lwo/iffparser.h +++ b/src/osgPlugins/lwo/iffparser.h @@ -19,7 +19,7 @@ namespace iff struct Chunk { virtual ~Chunk() - { + { Chunk_list *fod = free_on_destroy(); if (fod) { for (Chunk_list::iterator i=fod->begin(); i!=fod->end(); ++i) { @@ -29,7 +29,7 @@ namespace iff } virtual Chunk_list *free_on_destroy() { return 0; } - }; + }; template class GenericParser { @@ -50,7 +50,7 @@ namespace iff inline std::ostream &os() { return os_; } - private: + private: GenericParser& operator = (const GenericParser&) { return *this; } diff --git a/src/osgPlugins/lwo/lwo2chunks.h b/src/osgPlugins/lwo/lwo2chunks.h index 329158a39..7c1e200f1 100644 --- a/src/osgPlugins/lwo/lwo2chunks.h +++ b/src/osgPlugins/lwo/lwo2chunks.h @@ -59,7 +59,7 @@ namespace lwo2 }; typedef std::vector Mapping_list; - Mapping_list mapping; + Mapping_list mapping; }; CHUNK (POLS) { @@ -219,7 +219,7 @@ namespace lwo2 }; SUBCHUNK (NEGA) { - U2 enable; + U2 enable; }; SUBCHUNK (IFLT) { @@ -592,7 +592,7 @@ namespace lwo2 U2 displacement_axis; }; - }; + }; }; diff --git a/src/osgPlugins/lwo/lwo2parser.h b/src/osgPlugins/lwo/lwo2parser.h index cb2a5c6b9..2e49ad6a0 100644 --- a/src/osgPlugins/lwo/lwo2parser.h +++ b/src/osgPlugins/lwo/lwo2parser.h @@ -34,7 +34,7 @@ namespace lwo2 protected: virtual iff::Chunk *parse_chunk_data(const std::string &tag, const std::string &context, Iter it, Iter end); iff::Chunk *parse_subchunk(Iter &it, const std::string &context); - + Parser& operator = (const Parser&) { return *this; } }; @@ -125,7 +125,7 @@ namespace lwo2 pl.numvert = nvf & 0x03FF; for (int i=0; ipolygons.push_back(pl); + chk->polygons.push_back(pl); } return chk; } diff --git a/src/osgPlugins/lwo/lwo2read.h b/src/osgPlugins/lwo/lwo2read.h index d637276ea..99701c317 100644 --- a/src/osgPlugins/lwo/lwo2read.h +++ b/src/osgPlugins/lwo/lwo2read.h @@ -12,7 +12,7 @@ #include "lwo2types.h" -namespace lwo2 +namespace lwo2 { template diff --git a/src/osgPlugins/lwo/lwo2types.h b/src/osgPlugins/lwo/lwo2types.h index c27f5a415..dd7ded04b 100644 --- a/src/osgPlugins/lwo/lwo2types.h +++ b/src/osgPlugins/lwo/lwo2types.h @@ -12,7 +12,7 @@ #include -namespace lwo2 +namespace lwo2 { // basic types @@ -26,7 +26,7 @@ struct ID4 id[2] = 0; id[3] = 0; } - + char id[4]; }; diff --git a/src/osgPlugins/lwo/old_Lwo2.cpp b/src/osgPlugins/lwo/old_Lwo2.cpp index 6af16d9d0..5ad8bedc4 100644 --- a/src/osgPlugins/lwo/old_Lwo2.cpp +++ b/src/osgPlugins/lwo/old_Lwo2.cpp @@ -18,8 +18,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ @@ -64,7 +64,7 @@ Lwo2::~Lwo2() } } -bool +bool Lwo2::ReadFile( const string& filename ) { OSG_INFO << "Opening file: " << filename << std::endl; @@ -78,13 +78,13 @@ Lwo2::ReadFile( const string& filename ) // checking EA-IFF85 format // http://www.lightwave3d.com/developer/75lwsdk/docs/filefmts/eaiff85.html - if (_read_uint() != tag_FORM) + if (_read_uint() != tag_FORM) { OSG_INFO << "File '" << filename << "' is not IFF format file." << std::endl; _fin.close(); return false; } - else + else { OSG_INFO << "Detected EA-IFF85 format" << std::endl; } @@ -92,16 +92,16 @@ Lwo2::ReadFile( const string& filename ) unsigned int form_size = _read_uint(); OSG_INFO << "Form size: " << form_size << std::endl; - // checking LWO2 format + // checking LWO2 format // http://www.lightwave3d.com/developer/75lwsdk/docs/filefmts/lwo2.html - if (_read_uint() != tag_LWO2) + if (_read_uint() != tag_LWO2) { unsigned long make_id(const char*); OSG_INFO << "File '" << filename << "' is not LWO2 format file." << std::endl; _fin.close(); return false; } - else + else { OSG_INFO << "Detected LWO2 format" << std::endl; } @@ -119,43 +119,43 @@ Lwo2::ReadFile( const string& filename ) _print_tag(current_tag_name, current_tag_size); - if (current_tag_name == tag_TAGS) + if (current_tag_name == tag_TAGS) { _read_tag_strings(current_tag_size); - } - else if (current_tag_name == tag_LAYR) + } + else if (current_tag_name == tag_LAYR) { _read_layer(current_tag_size); } - else if (current_tag_name == tag_PNTS) + else if (current_tag_name == tag_PNTS) { _read_points(current_tag_size); } - else if (current_tag_name == tag_VMAP) + else if (current_tag_name == tag_VMAP) { _read_vertex_mapping(current_tag_size); } - else if (current_tag_name == tag_VMAD) + else if (current_tag_name == tag_VMAD) { _read_polygons_mapping(current_tag_size); } - else if (current_tag_name == tag_POLS) + else if (current_tag_name == tag_POLS) { _read_polygons(current_tag_size); } - else if (current_tag_name == tag_PTAG) + else if (current_tag_name == tag_PTAG) { _read_polygon_tag_mapping(current_tag_size); } - else if (current_tag_name == tag_CLIP) + else if (current_tag_name == tag_CLIP) { _read_image_definition(current_tag_size); } - else if (current_tag_name == tag_SURF) + else if (current_tag_name == tag_SURF) { _read_surface(current_tag_size); - } - else + } + else { _fin.seekg(current_tag_size + current_tag_size % 2, ios::cur); } @@ -166,7 +166,7 @@ Lwo2::ReadFile( const string& filename ) return _successfully_read = true; } -unsigned char +unsigned char Lwo2::_read_char() { char c = 0; @@ -177,31 +177,31 @@ Lwo2::_read_char() return static_cast(c); } -unsigned int +unsigned int Lwo2::_read_uint() { return - (_read_char() << 24) | - (_read_char() << 16) | - (_read_char() << 8) | + (_read_char() << 24) | + (_read_char() << 16) | + (_read_char() << 8) | _read_char(); } -unsigned short +unsigned short Lwo2::_read_short() { return - (_read_char() << 8) | + (_read_char() << 8) | _read_char(); } -float +float Lwo2::_read_float() { return lwo2::changeType4(_read_uint()); } -// read null terminated string +// read null terminated string string& Lwo2::_read_string(string& str) @@ -212,7 +212,7 @@ Lwo2::_read_string(string& str) str += c; } while (c != 0); - // if length of string (including \0) is odd skip another byte + // if length of string (including \0) is odd skip another byte if (str.length() % 2) { _read_char(); } @@ -222,38 +222,38 @@ Lwo2::_read_string(string& str) // print 4-char tag to debug out -void +void Lwo2::_print_tag(unsigned int tag, unsigned int size) { - OSG_DEBUG << "Found tag " - << char(tag >> 24) - << char(tag >> 16) - << char(tag >> 8) - << char(tag) - << " size " << size << " bytes" + OSG_DEBUG << "Found tag " + << char(tag >> 24) + << char(tag >> 16) + << char(tag >> 8) + << char(tag) + << " size " << size << " bytes" << std::endl; } // print 4-char type -void +void Lwo2::_print_type(unsigned int type) { - OSG_DEBUG << " type \t" - << char(type >> 24) - << char(type >> 16) - << char(type >> 8) - << char(type) + OSG_DEBUG << " type \t" + << char(type >> 24) + << char(type >> 16) + << char(type >> 8) + << char(type) << std::endl; } // read TAGS info -void +void Lwo2::_read_tag_strings(unsigned long size) { while (size > 0) { string name; _read_string(name); - size -= name.length() + name.length() % 2; + size -= name.length() + name.length() % 2; _tags.push_back(name); OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl; @@ -262,7 +262,7 @@ Lwo2::_read_tag_strings(unsigned long size) // read LAYR info -void Lwo2::_read_layer(unsigned long size) +void Lwo2::_read_layer(unsigned long size) { unsigned short number = _read_short(); size -= 2; @@ -282,9 +282,9 @@ void Lwo2::_read_layer(unsigned long size) size -= 4 * 3; _read_string(layer->_name); - size -= layer->_name.length() + layer->_name.length() % 2; + size -= layer->_name.length() + layer->_name.length() % 2; - if (size > 2) + if (size > 2) { layer->_parent = _read_short(); size -= 2; @@ -295,7 +295,7 @@ void Lwo2::_read_layer(unsigned long size) // read PNTS info -void Lwo2::_read_points(unsigned long size) +void Lwo2::_read_points(unsigned long size) { int count = size / 12; OSG_DEBUG << " count \t" << count << std::endl; @@ -309,12 +309,12 @@ void Lwo2::_read_points(unsigned long size) float z = _read_float(); point.coord = Vec3(x, y, z); _current_layer->_points.push_back(point); - } + } } // read VMAP info -void Lwo2::_read_vertex_mapping(unsigned long size) +void Lwo2::_read_vertex_mapping(unsigned long size) { unsigned int type = _read_uint(); size -= 4; @@ -328,10 +328,10 @@ void Lwo2::_read_vertex_mapping(unsigned long size) string name; _read_string(name); - size -= name.length() + name.length() % 2; + size -= name.length() + name.length() % 2; OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl; - if (type == tag_TXUV && dimension == 2) + if (type == tag_TXUV && dimension == 2) { int count = size / 10; unsigned short n; @@ -350,7 +350,7 @@ void Lwo2::_read_vertex_mapping(unsigned long size) } } } - else + else { // not recognized yet @@ -361,15 +361,15 @@ void Lwo2::_read_vertex_mapping(unsigned long size) // read POLS info -void -Lwo2::_read_polygons(unsigned long size) +void +Lwo2::_read_polygons(unsigned long size) { unsigned int type = _read_uint(); size -= 4; _print_type(type); - if (type == tag_FACE) + if (type == tag_FACE) { unsigned short vertex_count; @@ -390,12 +390,12 @@ Lwo2::_read_polygons(unsigned long size) points_list.push_back(point); size -= 2; - } + } _current_layer->_polygons.push_back(points_list); } } - else + else { // not recognized yet @@ -406,14 +406,14 @@ Lwo2::_read_polygons(unsigned long size) // read PTAG info -void Lwo2::_read_polygon_tag_mapping(unsigned long size) +void Lwo2::_read_polygon_tag_mapping(unsigned long size) { unsigned int type = _read_uint(); size -= 4; _print_type(type); - if (type == tag_SURF) + if (type == tag_SURF) { int count = size / 4; _current_layer->_polygons_tag.resize(count); @@ -428,7 +428,7 @@ void Lwo2::_read_polygon_tag_mapping(unsigned long size) _current_layer->_polygons_tag[polygon_index] = tag_index; } } - else + else { // not recognized yet @@ -439,7 +439,7 @@ void Lwo2::_read_polygon_tag_mapping(unsigned long size) // read VMAD info -void Lwo2::_read_polygons_mapping(unsigned long size) +void Lwo2::_read_polygons_mapping(unsigned long size) { unsigned int type = _read_uint(); size -= 4; @@ -453,10 +453,10 @@ void Lwo2::_read_polygons_mapping(unsigned long size) string name; _read_string(name); - size -= name.length() + name.length() % 2; + size -= name.length() + name.length() % 2; OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl; - if (type == tag_TXUV && dimension == 2) + if (type == tag_TXUV && dimension == 2) { OSG_DEBUG << " polygons mappings:" << endl; OSG_DEBUG << "\tpoint\tpolygon\ttexcoord" << endl; @@ -477,7 +477,7 @@ void Lwo2::_read_polygons_mapping(unsigned long size) OSG_DEBUG << " \t" << point_index << "\t" << polygon_index << "\t" << Vec2(u, v) << endl; - // apply texture coordinates + // apply texture coordinates PointsList& points_list = _current_layer->_polygons[polygon_index]; for (unsigned int i = 0; i < points_list.size(); i++) { @@ -488,7 +488,7 @@ void Lwo2::_read_polygons_mapping(unsigned long size) } } } - else + else { // not recognized yet @@ -500,7 +500,7 @@ void Lwo2::_read_polygons_mapping(unsigned long size) // read CLIP info -void +void Lwo2::_read_image_definition(unsigned long size) { unsigned int index = _read_uint(); @@ -522,13 +522,13 @@ Lwo2::_read_image_definition(unsigned long size) string name; _read_string(name); - size -= name.length() + name.length() % 2; + size -= name.length() + name.length() % 2; if (index + 1 > _images.size()) { _images.resize(index + 1); } - + _images[index] = name.c_str(); OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl; @@ -544,18 +544,18 @@ void Lwo2::_read_surface(unsigned long size) surface->state_set = NULL; _read_string(surface->name); - size -= surface->name.length() + surface->name.length() % 2; + size -= surface->name.length() + surface->name.length() % 2; OSG_DEBUG << " name \t'" << surface->name.c_str() << "'" << std::endl; string source; _read_string(source); - size -= source.length() + source.length() % 2; + size -= source.length() + source.length() % 2; OSG_DEBUG << " source \t'" << source.c_str() << "'" << std::endl; unsigned long current_tag_name; unsigned short current_tag_size; - while (size > 0 && !_fin.eof()) + while (size > 0 && !_fin.eof()) { current_tag_name = _read_uint(); size -= 4; @@ -564,13 +564,13 @@ void Lwo2::_read_surface(unsigned long size) _print_tag(current_tag_name, current_tag_size); - if (current_tag_name == tag_BLOK) + if (current_tag_name == tag_BLOK) { // BLOK int blok_size = current_tag_size; size -= blok_size; - while (blok_size > 0) + while (blok_size > 0) { current_tag_name = _read_uint(); blok_size -= 4; @@ -585,7 +585,7 @@ void Lwo2::_read_surface(unsigned long size) OSG_DEBUG << " image index\t" << surface->image_index << std::endl; blok_size -= 2; } - else if (current_tag_name == tag_IMAP) + else if (current_tag_name == tag_IMAP) { // IMAP @@ -594,7 +594,7 @@ void Lwo2::_read_surface(unsigned long size) string ordinal; _read_string(ordinal); - imap_size -= ordinal.length() + ordinal.length() % 2; + imap_size -= ordinal.length() + ordinal.length() % 2; OSG_DEBUG << " ordinal \t'" << ordinal.c_str() << "'" << std::endl; while(imap_size > 0) @@ -610,7 +610,7 @@ void Lwo2::_read_surface(unsigned long size) imap_size -= current_tag_size + current_tag_size % 2; } } - else + else { _fin.seekg(current_tag_size + current_tag_size % 2, ios::cur); blok_size -= current_tag_size + current_tag_size % 2; @@ -631,7 +631,7 @@ void Lwo2::_read_surface(unsigned long size) _fin.seekg(current_tag_size + current_tag_size % 2, ios::cur); size -= current_tag_size + current_tag_size % 2; } - else + else { _fin.seekg(current_tag_size + current_tag_size % 2, ios::cur); size -= current_tag_size + current_tag_size % 2; @@ -643,7 +643,7 @@ void Lwo2::_read_surface(unsigned long size) // Generation OSG Geode object from parsed LWO2 file -bool +bool Lwo2::GenerateGroup( Group& group ) { if (!_successfully_read) return false; @@ -705,7 +705,7 @@ Lwo2::_generate_statesets_from_surfaces() OSG_DEBUG << "\tcreating surface " << (*itr_surf).first << std::endl; // check if exist texture image for this surface - if (surface->image_index >= 0) + if (surface->image_index >= 0) { osg::ref_ptr image = osgDB::readRefImageFile(_images[surface->image_index]); OSG_DEBUG << "\tloaded image '" << _images[surface->image_index] << "'" << std::endl; @@ -715,7 +715,7 @@ Lwo2::_generate_statesets_from_surfaces() // create texture Texture2D* texture = new osg::Texture2D; texture->setImage(image.get()); - state_set->setTextureAttributeAndModes(0, texture, StateAttribute::ON); + state_set->setTextureAttributeAndModes(0, texture, StateAttribute::ON); // setup texture wrapping texture->setWrap(Texture::WRAP_S, Texture::REPEAT); @@ -734,7 +734,7 @@ Lwo2::_generate_statesets_from_surfaces() data++; // skip b // check alpha - if (*data < 255) + if (*data < 255) { use_blending = true; break; @@ -773,10 +773,10 @@ Lwo2::_generate_statesets_from_surfaces() } } -// makes 4-byte integer tag from four chars +// makes 4-byte integer tag from four chars // used in IFF standard -unsigned long make_id(const char* tag) +unsigned long make_id(const char* tag) { unsigned long result = 0; for (unsigned int i = 0; i < strlen(tag) && i < 4; i++) @@ -785,4 +785,4 @@ unsigned long make_id(const char* tag) result += int(tag[i]); } return result; -} +} diff --git a/src/osgPlugins/lwo/old_Lwo2.h b/src/osgPlugins/lwo/old_Lwo2.h index 6baf991ac..f1f76e185 100644 --- a/src/osgPlugins/lwo/old_Lwo2.h +++ b/src/osgPlugins/lwo/old_Lwo2.h @@ -18,8 +18,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ @@ -92,7 +92,7 @@ class Lwo2 void _generate_statesets_from_surfaces(); }; -// makes 4-byte integer tag from four chars +// makes 4-byte integer tag from four chars // used in IFF standard unsigned long make_id(const char* tag); diff --git a/src/osgPlugins/lwo/old_Lwo2Layer.cpp b/src/osgPlugins/lwo/old_Lwo2Layer.cpp index 23067ca60..dcdd0ac85 100644 --- a/src/osgPlugins/lwo/old_Lwo2Layer.cpp +++ b/src/osgPlugins/lwo/old_Lwo2Layer.cpp @@ -18,8 +18,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ @@ -56,7 +56,7 @@ Lwo2Layer::notify(NotifySeverity severity) { OSG_NOTIFY(severity) << " \t" << (*itr).coord << "\t\t" << (*itr).texcoord << endl; } - + // polygons OSG_NOTIFY(severity) << " polygons:\t" << _polygons.size() << endl; OSG_NOTIFY(severity) << "\tcoord\t\t\t\ttexcoord" << endl; @@ -89,7 +89,7 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping& // variable used to track using textures bool have_texture_coords; - + // create diffirent geomerty for each tag for (short current_tag = 0; current_tag < tags_count; current_tag++) { @@ -150,12 +150,12 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping& (*coords).push_back((*itr).coord); (*texcoords).push_back((*itr).texcoord); - if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) + if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) { have_texture_coords = true; } } - + unsigned int points_start = (*coords).size() - (*polygon_iterator).size(); unsigned int points_count = (*polygon_iterator).size(); if (points_count == 3) @@ -166,7 +166,7 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping& { geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS, points_start, points_count)); } - else + else { geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::POLYGON, points_start, points_count)); } @@ -187,12 +187,12 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping& (*coords).push_back((*itr).coord); (*texcoords).push_back((*itr).texcoord); - if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) + if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) { have_texture_coords = true; } } - + unsigned int points_start = (*coords).size() - (*polygon_iterator).size(); unsigned int points_count = (*polygon_iterator).size(); geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::TRIANGLE_FAN, points_start, points_count)); @@ -212,19 +212,19 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping& (*coords).push_back((*itr).coord); (*texcoords).push_back((*itr).texcoord); - if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) + if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) { have_texture_coords = true; } } - + unsigned int points_start = (*coords).size() - (*polygon_iterator).size(); unsigned int points_count = (*polygon_iterator).size(); geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::TRIANGLE_STRIP, points_start, points_count)); } // add geometry if it contains any points - if (coords->size() != 0) + if (coords->size() != 0) { geometry->setVertexArray(coords.get()); @@ -246,12 +246,12 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping& } } -bool +bool Lwo2Layer::_find_triangle_fans(PolygonsList& polygons, PolygonsList& triangle_fans) { bool found = false; - while (_find_triangle_fan(polygons, triangle_fans)) + while (_find_triangle_fan(polygons, triangle_fans)) { found = true; } @@ -264,12 +264,12 @@ Lwo2Layer::_find_triangle_fans(PolygonsList& polygons, PolygonsList& triangle_fa return found; } -bool +bool Lwo2Layer::_find_triangle_strips(PolygonsList& polygons, PolygonsList& triangle_strips) { bool found = false; - while (_find_triangle_strip(polygons, triangle_strips)) + while (_find_triangle_strip(polygons, triangle_strips)) { found = true; } @@ -282,7 +282,7 @@ Lwo2Layer::_find_triangle_strips(PolygonsList& polygons, PolygonsList& triangle_ return found; } -bool +bool Lwo2Layer::_find_triangle_fan(PolygonsList& polygons, PolygonsList& triangle_fans) { bool found = false; @@ -297,7 +297,7 @@ Lwo2Layer::_find_triangle_fan(PolygonsList& polygons, PolygonsList& triangle_fan PointData c = points_list[2]; int next_polygon_index = _find_triangle_begins_with(polygons, a, c); - while (next_polygon_index >= 0) + while (next_polygon_index >= 0) { found = true; PointData d = polygons[next_polygon_index][2]; @@ -325,7 +325,7 @@ Lwo2Layer::_find_triangle_fan(PolygonsList& polygons, PolygonsList& triangle_fan c = d; } - + triangle_fans.push_back(point_list); } } @@ -334,7 +334,7 @@ Lwo2Layer::_find_triangle_fan(PolygonsList& polygons, PolygonsList& triangle_fan return found; } -bool +bool Lwo2Layer::_find_triangle_strip(PolygonsList& polygons, PolygonsList& triangle_strips) { bool found = false; @@ -351,7 +351,7 @@ Lwo2Layer::_find_triangle_strip(PolygonsList& polygons, PolygonsList& triangle_s int next_polygon_index = _find_triangle_begins_with(polygons, c, b); - while (next_polygon_index >= 0) + while (next_polygon_index >= 0) { found = true; PointData d = polygons[next_polygon_index][2]; @@ -381,7 +381,7 @@ Lwo2Layer::_find_triangle_strip(PolygonsList& polygons, PolygonsList& triangle_s { strip_a = d; } - else + else { strip_b = d; } @@ -390,7 +390,7 @@ Lwo2Layer::_find_triangle_strip(PolygonsList& polygons, PolygonsList& triangle_s // delete next triangle (mark as deleted) (*(polygons.begin() + next_polygon_index))[0].point_index = -1; } - + triangle_strips.push_back(point_list); } } @@ -400,7 +400,7 @@ Lwo2Layer::_find_triangle_strip(PolygonsList& polygons, PolygonsList& triangle_s return found; } -int +int Lwo2Layer::_find_triangle_begins_with(PolygonsList& polygons, PointData& a, PointData& b) { int result = -1; diff --git a/src/osgPlugins/lwo/old_Lwo2Layer.h b/src/osgPlugins/lwo/old_Lwo2Layer.h index 1e1a582b8..d4979b88d 100644 --- a/src/osgPlugins/lwo/old_Lwo2Layer.h +++ b/src/osgPlugins/lwo/old_Lwo2Layer.h @@ -18,8 +18,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ @@ -53,9 +53,9 @@ struct PointData Vec3 coord; Vec2 texcoord; - inline bool operator == (const PointData& p) const - { - return coord == p.coord && texcoord == p.texcoord; + inline bool operator == (const PointData& p) const + { + return coord == p.coord && texcoord == p.texcoord; } }; @@ -108,5 +108,5 @@ class Lwo2Layer PolygonsList _polygons; vector< short > _polygons_tag; }; - + #endif diff --git a/src/osgPlugins/lwo/old_lw.cpp b/src/osgPlugins/lwo/old_lw.cpp index e65a2c111..691885878 100644 --- a/src/osgPlugins/lwo/old_lw.cpp +++ b/src/osgPlugins/lwo/old_lw.cpp @@ -260,7 +260,7 @@ static void read_surf(FILE *f, gint nbytes, lwObject *lwo) static void read_pols(FILE *f, int nbytes, lwObject *lwo) { int guess_cnt = lwo->face_cnt; - + while (nbytes > 0) { lwFace *face; int i; @@ -280,17 +280,17 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo) /* allocate space for points */ face->index = (int*) g_malloc0(sizeof(int)*face->index_cnt); - + /* read points in */ for (i=0; iindex_cnt; i++) { face->index[i] = read_short(f); nbytes -= 2; } - + /* read surface material */ face->material = read_short(f); nbytes -= 2; - + /* skip over detail polygons */ if (face->material < 0) { printf("face->material=%i ",face->material); @@ -454,7 +454,7 @@ lwObject *lw_object_read(const char *lw_file, std::ostream& output) void lw_object_free(lwObject *lw_object) { g_return_if_fail(lw_object != NULL); - + if (lw_object->face) { int i; for (i=0; iface_cnt; i++) { diff --git a/src/osgPlugins/lwo/old_lw.h b/src/osgPlugins/lwo/old_lw.h index 7198b52c9..a24d2e34d 100644 --- a/src/osgPlugins/lwo/old_lw.h +++ b/src/osgPlugins/lwo/old_lw.h @@ -65,7 +65,7 @@ struct lwMaterial char name[LW_MAX_NAME_LEN]; GLfloat r,g,b; struct lwTexture ctex; - + lwMaterial() { r=1.0f; @@ -82,7 +82,7 @@ struct lwFace int index_cnt; /* number of vertices */ int *index; /* index to vertex */ float *texcoord; /* u,v texture coordinates */ - + void init() { material = 0; /* material of this face */ @@ -90,7 +90,7 @@ struct lwFace index = 0; /* index to vertex */ texcoord = 0; /* u,v texture coordinates */ } - + }; struct lwObject @@ -103,7 +103,7 @@ struct lwObject int vertex_cnt; GLfloat *vertex; - + void init() { face_cnt = 0; diff --git a/src/osgPlugins/lws/ReaderWriterLWS.cpp b/src/osgPlugins/lws/ReaderWriterLWS.cpp index 372426d65..f05ecd683 100644 --- a/src/osgPlugins/lws/ReaderWriterLWS.cpp +++ b/src/osgPlugins/lws/ReaderWriterLWS.cpp @@ -36,13 +36,13 @@ public: virtual ReadResult readNode(const std::string &file, const osgDB::ReaderWriter::Options *options) const { - std::string ext = osgDB::getLowerCaseFileExtension(file); + std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; std::string fileName = osgDB::findDataFile(file, options); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -61,7 +61,7 @@ public: protected: - + }; diff --git a/src/osgPlugins/lws/SceneLoader.cpp b/src/osgPlugins/lws/SceneLoader.cpp index 85604be47..f5d737cbf 100644 --- a/src/osgPlugins/lws/SceneLoader.cpp +++ b/src/osgPlugins/lws/SceneLoader.cpp @@ -43,10 +43,10 @@ namespace osg::Quat rotate_ypr(const osg::Vec3 &ypr, const osg::Vec3 pivot_rot = osg::Vec3(0, 0, 0)) { - osg::Quat Q1(ypr.z(), osg::Vec3(0, -1, 0)); + osg::Quat Q1(ypr.z(), osg::Vec3(0, -1, 0)); osg::Quat Q2(ypr.y(), osg::Vec3(-1, 0, 0)); osg::Quat Q3(ypr.x(), osg::Vec3(0, 0, -1)); - osg::Quat Q4(pivot_rot.z(), osg::Vec3(0, -1, 0)); + osg::Quat Q4(pivot_rot.z(), osg::Vec3(0, -1, 0)); osg::Quat Q5(pivot_rot.y(), osg::Vec3(-1, 0, 0)); osg::Quat Q6(pivot_rot.x(), osg::Vec3(0, 0, -1)); return Q1 * Q2 * Q3 * Q4 * Q5 * Q6; @@ -62,7 +62,7 @@ namespace //std::cout<<" removing control character "<<(int)str[str.size()-1]< objnode; @@ -258,7 +258,7 @@ bool SceneLoader::parse_block(const std::string &name, const std::string &data) oss << filename << "." << layer; so.name = oss.str(); so.layer_node = objnode->getChild(layer-1); - if (so.layer_node.valid()) { + if (so.layer_node.valid()) { scene_objects_.push_back(so); } } @@ -318,7 +318,7 @@ bool SceneLoader::parse_block(const std::string &name, const std::vector= 2)) { Motion_envelope::Key_map &keys = capture_obj_motion_ ? scene_objects_.back().motion.keys : scene_cameras_.back().motion.keys; diff --git a/src/osgPlugins/lws/SceneLoader.h b/src/osgPlugins/lws/SceneLoader.h index be67367c4..e74ab1042 100644 --- a/src/osgPlugins/lws/SceneLoader.h +++ b/src/osgPlugins/lws/SceneLoader.h @@ -113,7 +113,7 @@ namespace lwosg typedef std::vector Scene_object_list; Scene_object_list scene_objects_; - + typedef std::vector Scene_camera_list; Scene_camera_list scene_cameras_; diff --git a/src/osgPlugins/md2/ReaderWriterMD2.cpp b/src/osgPlugins/md2/ReaderWriterMD2.cpp index cd326bff8..12a14fd16 100644 --- a/src/osgPlugins/md2/ReaderWriterMD2.cpp +++ b/src/osgPlugins/md2/ReaderWriterMD2.cpp @@ -67,7 +67,7 @@ ReaderWriterMD2::readNode (const std::string& file, const osgDB::ReaderWriter::O std::string fileName = osgDB::findDataFile( file, options ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -172,7 +172,7 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options) close (file_fd); return NULL; } - + if (read(file_fd, mapbase, st.st_size)==0) { close (file_fd); @@ -416,7 +416,7 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options) base_switch->setSingleChildOn(0); result = base_switch; - + #if 0 munamp (mapbase); #else diff --git a/src/osgPlugins/md2/anorms.h b/src/osgPlugins/md2/anorms.h index 5fcab04a1..f400adaed 100644 --- a/src/osgPlugins/md2/anorms.h +++ b/src/osgPlugins/md2/anorms.h @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -17,165 +17,165 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -{-0.525731f, 0.000000f, 0.850651f}, -{-0.442863f, 0.238856f, 0.864188f}, -{-0.295242f, 0.000000f, 0.955423f}, -{-0.309017f, 0.500000f, 0.809017f}, -{-0.162460f, 0.262866f, 0.951056f}, -{0.000000f, 0.000000f, 1.000000f}, -{0.000000f, 0.850651f, 0.525731f}, -{-0.147621f, 0.716567f, 0.681718f}, -{0.147621f, 0.716567f, 0.681718f}, -{0.000000f, 0.525731f, 0.850651f}, -{0.309017f, 0.500000f, 0.809017f}, -{0.525731f, 0.000000f, 0.850651f}, -{0.295242f, 0.000000f, 0.955423f}, -{0.442863f, 0.238856f, 0.864188f}, -{0.162460f, 0.262866f, 0.951056f}, -{-0.681718f, 0.147621f, 0.716567f}, -{-0.809017f, 0.309017f, 0.500000f}, -{-0.587785f, 0.425325f, 0.688191f}, -{-0.850651f, 0.525731f, 0.000000f}, -{-0.864188f, 0.442863f, 0.238856f}, -{-0.716567f, 0.681718f, 0.147621f}, -{-0.688191f, 0.587785f, 0.425325f}, -{-0.500000f, 0.809017f, 0.309017f}, -{-0.238856f, 0.864188f, 0.442863f}, -{-0.425325f, 0.688191f, 0.587785f}, -{-0.716567f, 0.681718f, -0.147621f}, -{-0.500000f, 0.809017f, -0.309017f}, -{-0.525731f, 0.850651f, 0.000000f}, -{0.000000f, 0.850651f, -0.525731f}, -{-0.238856f, 0.864188f, -0.442863f}, -{0.000000f, 0.955423f, -0.295242f}, -{-0.262866f, 0.951056f, -0.162460f}, -{0.000000f, 1.000000f, 0.000000f}, -{0.000000f, 0.955423f, 0.295242f}, -{-0.262866f, 0.951056f, 0.162460f}, -{0.238856f, 0.864188f, 0.442863f}, -{0.262866f, 0.951056f, 0.162460f}, -{0.500000f, 0.809017f, 0.309017f}, -{0.238856f, 0.864188f, -0.442863f}, -{0.262866f, 0.951056f, -0.162460f}, -{0.500000f, 0.809017f, -0.309017f}, -{0.850651f, 0.525731f, 0.000000f}, -{0.716567f, 0.681718f, 0.147621f}, -{0.716567f, 0.681718f, -0.147621f}, -{0.525731f, 0.850651f, 0.000000f}, -{0.425325f, 0.688191f, 0.587785f}, -{0.864188f, 0.442863f, 0.238856f}, -{0.688191f, 0.587785f, 0.425325f}, -{0.809017f, 0.309017f, 0.500000f}, -{0.681718f, 0.147621f, 0.716567f}, -{0.587785f, 0.425325f, 0.688191f}, -{0.955423f, 0.295242f, 0.000000f}, -{1.000000f, 0.000000f, 0.000000f}, -{0.951056f, 0.162460f, 0.262866f}, -{0.850651f, -0.525731f, 0.000000f}, -{0.955423f, -0.295242f, 0.000000f}, -{0.864188f, -0.442863f, 0.238856f}, -{0.951056f, -0.162460f, 0.262866f}, -{0.809017f, -0.309017f, 0.500000f}, -{0.681718f, -0.147621f, 0.716567f}, -{0.850651f, 0.000000f, 0.525731f}, -{0.864188f, 0.442863f, -0.238856f}, -{0.809017f, 0.309017f, -0.500000f}, -{0.951056f, 0.162460f, -0.262866f}, -{0.525731f, 0.000000f, -0.850651f}, -{0.681718f, 0.147621f, -0.716567f}, -{0.681718f, -0.147621f, -0.716567f}, -{0.850651f, 0.000000f, -0.525731f}, -{0.809017f, -0.309017f, -0.500000f}, -{0.864188f, -0.442863f, -0.238856f}, -{0.951056f, -0.162460f, -0.262866f}, -{0.147621f, 0.716567f, -0.681718f}, -{0.309017f, 0.500000f, -0.809017f}, -{0.425325f, 0.688191f, -0.587785f}, -{0.442863f, 0.238856f, -0.864188f}, -{0.587785f, 0.425325f, -0.688191f}, -{0.688191f, 0.587785f, -0.425325f}, -{-0.147621f, 0.716567f, -0.681718f}, -{-0.309017f, 0.500000f, -0.809017f}, -{0.000000f, 0.525731f, -0.850651f}, -{-0.525731f, 0.000000f, -0.850651f}, -{-0.442863f, 0.238856f, -0.864188f}, -{-0.295242f, 0.000000f, -0.955423f}, -{-0.162460f, 0.262866f, -0.951056f}, -{0.000000f, 0.000000f, -1.000000f}, -{0.295242f, 0.000000f, -0.955423f}, -{0.162460f, 0.262866f, -0.951056f}, -{-0.442863f, -0.238856f, -0.864188f}, -{-0.309017f, -0.500000f, -0.809017f}, -{-0.162460f, -0.262866f, -0.951056f}, -{0.000000f, -0.850651f, -0.525731f}, -{-0.147621f, -0.716567f, -0.681718f}, -{0.147621f, -0.716567f, -0.681718f}, -{0.000000f, -0.525731f, -0.850651f}, -{0.309017f, -0.500000f, -0.809017f}, -{0.442863f, -0.238856f, -0.864188f}, -{0.162460f, -0.262866f, -0.951056f}, -{0.238856f, -0.864188f, -0.442863f}, -{0.500000f, -0.809017f, -0.309017f}, -{0.425325f, -0.688191f, -0.587785f}, -{0.716567f, -0.681718f, -0.147621f}, -{0.688191f, -0.587785f, -0.425325f}, -{0.587785f, -0.425325f, -0.688191f}, -{0.000000f, -0.955423f, -0.295242f}, -{0.000000f, -1.000000f, 0.000000f}, -{0.262866f, -0.951056f, -0.162460f}, -{0.000000f, -0.850651f, 0.525731f}, -{0.000000f, -0.955423f, 0.295242f}, -{0.238856f, -0.864188f, 0.442863f}, -{0.262866f, -0.951056f, 0.162460f}, -{0.500000f, -0.809017f, 0.309017f}, -{0.716567f, -0.681718f, 0.147621f}, -{0.525731f, -0.850651f, 0.000000f}, -{-0.238856f, -0.864188f, -0.442863f}, -{-0.500000f, -0.809017f, -0.309017f}, -{-0.262866f, -0.951056f, -0.162460f}, -{-0.850651f, -0.525731f, 0.000000f}, -{-0.716567f, -0.681718f, -0.147621f}, -{-0.716567f, -0.681718f, 0.147621f}, -{-0.525731f, -0.850651f, 0.000000f}, -{-0.500000f, -0.809017f, 0.309017f}, -{-0.238856f, -0.864188f, 0.442863f}, -{-0.262866f, -0.951056f, 0.162460f}, -{-0.864188f, -0.442863f, 0.238856f}, -{-0.809017f, -0.309017f, 0.500000f}, -{-0.688191f, -0.587785f, 0.425325f}, -{-0.681718f, -0.147621f, 0.716567f}, -{-0.442863f, -0.238856f, 0.864188f}, -{-0.587785f, -0.425325f, 0.688191f}, -{-0.309017f, -0.500000f, 0.809017f}, -{-0.147621f, -0.716567f, 0.681718f}, -{-0.425325f, -0.688191f, 0.587785f}, -{-0.162460f, -0.262866f, 0.951056f}, -{0.442863f, -0.238856f, 0.864188f}, -{0.162460f, -0.262866f, 0.951056f}, -{0.309017f, -0.500000f, 0.809017f}, -{0.147621f, -0.716567f, 0.681718f}, -{0.000000f, -0.525731f, 0.850651f}, -{0.425325f, -0.688191f, 0.587785f}, -{0.587785f, -0.425325f, 0.688191f}, -{0.688191f, -0.587785f, 0.425325f}, -{-0.955423f, 0.295242f, 0.000000f}, -{-0.951056f, 0.162460f, 0.262866f}, -{-1.000000f, 0.000000f, 0.000000f}, -{-0.850651f, 0.000000f, 0.525731f}, -{-0.955423f, -0.295242f, 0.000000f}, -{-0.951056f, -0.162460f, 0.262866f}, -{-0.864188f, 0.442863f, -0.238856f}, -{-0.951056f, 0.162460f, -0.262866f}, -{-0.809017f, 0.309017f, -0.500000f}, -{-0.864188f, -0.442863f, -0.238856f}, -{-0.951056f, -0.162460f, -0.262866f}, -{-0.809017f, -0.309017f, -0.500000f}, -{-0.681718f, 0.147621f, -0.716567f}, -{-0.681718f, -0.147621f, -0.716567f}, -{-0.850651f, 0.000000f, -0.525731f}, -{-0.688191f, 0.587785f, -0.425325f}, -{-0.587785f, 0.425325f, -0.688191f}, -{-0.425325f, 0.688191f, -0.587785f}, -{-0.425325f, -0.688191f, -0.587785f}, -{-0.587785f, -0.425325f, -0.688191f}, +{-0.525731f, 0.000000f, 0.850651f}, +{-0.442863f, 0.238856f, 0.864188f}, +{-0.295242f, 0.000000f, 0.955423f}, +{-0.309017f, 0.500000f, 0.809017f}, +{-0.162460f, 0.262866f, 0.951056f}, +{0.000000f, 0.000000f, 1.000000f}, +{0.000000f, 0.850651f, 0.525731f}, +{-0.147621f, 0.716567f, 0.681718f}, +{0.147621f, 0.716567f, 0.681718f}, +{0.000000f, 0.525731f, 0.850651f}, +{0.309017f, 0.500000f, 0.809017f}, +{0.525731f, 0.000000f, 0.850651f}, +{0.295242f, 0.000000f, 0.955423f}, +{0.442863f, 0.238856f, 0.864188f}, +{0.162460f, 0.262866f, 0.951056f}, +{-0.681718f, 0.147621f, 0.716567f}, +{-0.809017f, 0.309017f, 0.500000f}, +{-0.587785f, 0.425325f, 0.688191f}, +{-0.850651f, 0.525731f, 0.000000f}, +{-0.864188f, 0.442863f, 0.238856f}, +{-0.716567f, 0.681718f, 0.147621f}, +{-0.688191f, 0.587785f, 0.425325f}, +{-0.500000f, 0.809017f, 0.309017f}, +{-0.238856f, 0.864188f, 0.442863f}, +{-0.425325f, 0.688191f, 0.587785f}, +{-0.716567f, 0.681718f, -0.147621f}, +{-0.500000f, 0.809017f, -0.309017f}, +{-0.525731f, 0.850651f, 0.000000f}, +{0.000000f, 0.850651f, -0.525731f}, +{-0.238856f, 0.864188f, -0.442863f}, +{0.000000f, 0.955423f, -0.295242f}, +{-0.262866f, 0.951056f, -0.162460f}, +{0.000000f, 1.000000f, 0.000000f}, +{0.000000f, 0.955423f, 0.295242f}, +{-0.262866f, 0.951056f, 0.162460f}, +{0.238856f, 0.864188f, 0.442863f}, +{0.262866f, 0.951056f, 0.162460f}, +{0.500000f, 0.809017f, 0.309017f}, +{0.238856f, 0.864188f, -0.442863f}, +{0.262866f, 0.951056f, -0.162460f}, +{0.500000f, 0.809017f, -0.309017f}, +{0.850651f, 0.525731f, 0.000000f}, +{0.716567f, 0.681718f, 0.147621f}, +{0.716567f, 0.681718f, -0.147621f}, +{0.525731f, 0.850651f, 0.000000f}, +{0.425325f, 0.688191f, 0.587785f}, +{0.864188f, 0.442863f, 0.238856f}, +{0.688191f, 0.587785f, 0.425325f}, +{0.809017f, 0.309017f, 0.500000f}, +{0.681718f, 0.147621f, 0.716567f}, +{0.587785f, 0.425325f, 0.688191f}, +{0.955423f, 0.295242f, 0.000000f}, +{1.000000f, 0.000000f, 0.000000f}, +{0.951056f, 0.162460f, 0.262866f}, +{0.850651f, -0.525731f, 0.000000f}, +{0.955423f, -0.295242f, 0.000000f}, +{0.864188f, -0.442863f, 0.238856f}, +{0.951056f, -0.162460f, 0.262866f}, +{0.809017f, -0.309017f, 0.500000f}, +{0.681718f, -0.147621f, 0.716567f}, +{0.850651f, 0.000000f, 0.525731f}, +{0.864188f, 0.442863f, -0.238856f}, +{0.809017f, 0.309017f, -0.500000f}, +{0.951056f, 0.162460f, -0.262866f}, +{0.525731f, 0.000000f, -0.850651f}, +{0.681718f, 0.147621f, -0.716567f}, +{0.681718f, -0.147621f, -0.716567f}, +{0.850651f, 0.000000f, -0.525731f}, +{0.809017f, -0.309017f, -0.500000f}, +{0.864188f, -0.442863f, -0.238856f}, +{0.951056f, -0.162460f, -0.262866f}, +{0.147621f, 0.716567f, -0.681718f}, +{0.309017f, 0.500000f, -0.809017f}, +{0.425325f, 0.688191f, -0.587785f}, +{0.442863f, 0.238856f, -0.864188f}, +{0.587785f, 0.425325f, -0.688191f}, +{0.688191f, 0.587785f, -0.425325f}, +{-0.147621f, 0.716567f, -0.681718f}, +{-0.309017f, 0.500000f, -0.809017f}, +{0.000000f, 0.525731f, -0.850651f}, +{-0.525731f, 0.000000f, -0.850651f}, +{-0.442863f, 0.238856f, -0.864188f}, +{-0.295242f, 0.000000f, -0.955423f}, +{-0.162460f, 0.262866f, -0.951056f}, +{0.000000f, 0.000000f, -1.000000f}, +{0.295242f, 0.000000f, -0.955423f}, +{0.162460f, 0.262866f, -0.951056f}, +{-0.442863f, -0.238856f, -0.864188f}, +{-0.309017f, -0.500000f, -0.809017f}, +{-0.162460f, -0.262866f, -0.951056f}, +{0.000000f, -0.850651f, -0.525731f}, +{-0.147621f, -0.716567f, -0.681718f}, +{0.147621f, -0.716567f, -0.681718f}, +{0.000000f, -0.525731f, -0.850651f}, +{0.309017f, -0.500000f, -0.809017f}, +{0.442863f, -0.238856f, -0.864188f}, +{0.162460f, -0.262866f, -0.951056f}, +{0.238856f, -0.864188f, -0.442863f}, +{0.500000f, -0.809017f, -0.309017f}, +{0.425325f, -0.688191f, -0.587785f}, +{0.716567f, -0.681718f, -0.147621f}, +{0.688191f, -0.587785f, -0.425325f}, +{0.587785f, -0.425325f, -0.688191f}, +{0.000000f, -0.955423f, -0.295242f}, +{0.000000f, -1.000000f, 0.000000f}, +{0.262866f, -0.951056f, -0.162460f}, +{0.000000f, -0.850651f, 0.525731f}, +{0.000000f, -0.955423f, 0.295242f}, +{0.238856f, -0.864188f, 0.442863f}, +{0.262866f, -0.951056f, 0.162460f}, +{0.500000f, -0.809017f, 0.309017f}, +{0.716567f, -0.681718f, 0.147621f}, +{0.525731f, -0.850651f, 0.000000f}, +{-0.238856f, -0.864188f, -0.442863f}, +{-0.500000f, -0.809017f, -0.309017f}, +{-0.262866f, -0.951056f, -0.162460f}, +{-0.850651f, -0.525731f, 0.000000f}, +{-0.716567f, -0.681718f, -0.147621f}, +{-0.716567f, -0.681718f, 0.147621f}, +{-0.525731f, -0.850651f, 0.000000f}, +{-0.500000f, -0.809017f, 0.309017f}, +{-0.238856f, -0.864188f, 0.442863f}, +{-0.262866f, -0.951056f, 0.162460f}, +{-0.864188f, -0.442863f, 0.238856f}, +{-0.809017f, -0.309017f, 0.500000f}, +{-0.688191f, -0.587785f, 0.425325f}, +{-0.681718f, -0.147621f, 0.716567f}, +{-0.442863f, -0.238856f, 0.864188f}, +{-0.587785f, -0.425325f, 0.688191f}, +{-0.309017f, -0.500000f, 0.809017f}, +{-0.147621f, -0.716567f, 0.681718f}, +{-0.425325f, -0.688191f, 0.587785f}, +{-0.162460f, -0.262866f, 0.951056f}, +{0.442863f, -0.238856f, 0.864188f}, +{0.162460f, -0.262866f, 0.951056f}, +{0.309017f, -0.500000f, 0.809017f}, +{0.147621f, -0.716567f, 0.681718f}, +{0.000000f, -0.525731f, 0.850651f}, +{0.425325f, -0.688191f, 0.587785f}, +{0.587785f, -0.425325f, 0.688191f}, +{0.688191f, -0.587785f, 0.425325f}, +{-0.955423f, 0.295242f, 0.000000f}, +{-0.951056f, 0.162460f, 0.262866f}, +{-1.000000f, 0.000000f, 0.000000f}, +{-0.850651f, 0.000000f, 0.525731f}, +{-0.955423f, -0.295242f, 0.000000f}, +{-0.951056f, -0.162460f, 0.262866f}, +{-0.864188f, 0.442863f, -0.238856f}, +{-0.951056f, 0.162460f, -0.262866f}, +{-0.809017f, 0.309017f, -0.500000f}, +{-0.864188f, -0.442863f, -0.238856f}, +{-0.951056f, -0.162460f, -0.262866f}, +{-0.809017f, -0.309017f, -0.500000f}, +{-0.681718f, 0.147621f, -0.716567f}, +{-0.681718f, -0.147621f, -0.716567f}, +{-0.850651f, 0.000000f, -0.525731f}, +{-0.688191f, 0.587785f, -0.425325f}, +{-0.587785f, 0.425325f, -0.688191f}, +{-0.425325f, 0.688191f, -0.587785f}, +{-0.425325f, -0.688191f, -0.587785f}, +{-0.587785f, -0.425325f, -0.688191f}, {-0.688191f, -0.587785f, -0.425325f}, diff --git a/src/osgPlugins/mdl/MDLReader.cpp b/src/osgPlugins/mdl/MDLReader.cpp index 20bb079eb..8883d65c5 100644 --- a/src/osgPlugins/mdl/MDLReader.cpp +++ b/src/osgPlugins/mdl/MDLReader.cpp @@ -163,7 +163,7 @@ ref_ptr MDLReader::readTextureFile(std::string textureName) // Check for a leading slash and concatenate appropriately texPath = findFileInPath("materials", textureName, ".vtf"); - // Check up one directory if we don't find it here (the map file is + // Check up one directory if we don't find it here (the map file is // usually located in the "maps" directory, adjacent to the materials // directory) if (texPath.empty()) @@ -363,7 +363,7 @@ ref_ptr MDLReader::readMaterialFile(std::string materialName) if (!token.empty()) texture = readTextureFile(token); } - else if (equalCaseInsensitive(token, "$basetexture2")) + else if (equalCaseInsensitive(token, "$basetexture2")) { // Get the second base texture name token = getToken(line, " \t\n\r\"", start); @@ -396,7 +396,7 @@ ref_ptr MDLReader::readMaterialFile(std::string materialName) alpha = osg::asciiToDouble(token.c_str()); } } - + // Try the next token token = getToken(line, " \t\n\r\"", start); } @@ -649,7 +649,7 @@ bool MDLReader::readFile(const std::string & file) { mdlFile->get(texPath[j]); j++; - } + } while ((j < sizeof(texPath)) && (texPath[j-1] != 0)); // Store this path @@ -674,7 +674,7 @@ bool MDLReader::readFile(const std::string & file) { mdlFile->get(texName[j]); j++; - } + } while ((j < sizeof(texName)) && (texName[j-1] != 0)); // Load this texture diff --git a/src/osgPlugins/mdl/ReaderWriterMDL.cpp b/src/osgPlugins/mdl/ReaderWriterMDL.cpp index 5d27ac9d1..541922c4f 100644 --- a/src/osgPlugins/mdl/ReaderWriterMDL.cpp +++ b/src/osgPlugins/mdl/ReaderWriterMDL.cpp @@ -39,9 +39,9 @@ ReaderWriter::ReadResult ReaderWriterMDL::readNode( // See if we can find the requested file std::string fileName = osgDB::findDataFile(file, options, CASE_INSENSITIVE); - if (fileName.empty()) + if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - + // Read the file (pass the base name and not the file that was found, this // allows us to also find the .vvd and .vtx files without the leading // path confusing things) diff --git a/src/osgPlugins/mdl/ReaderWriterMDL.h b/src/osgPlugins/mdl/ReaderWriterMDL.h index 799efa461..d9e2e29ff 100644 --- a/src/osgPlugins/mdl/ReaderWriterMDL.h +++ b/src/osgPlugins/mdl/ReaderWriterMDL.h @@ -14,10 +14,10 @@ class ReaderWriterMDL : public osgDB::ReaderWriter public: virtual const char* className() const; - + virtual bool acceptsExtension(const std::string& extension) const; - - virtual ReadResult readNode(const std::string& file, + + virtual ReadResult readNode(const std::string& file, const Options* options) const; }; diff --git a/src/osgPlugins/mdl/VTXReader.cpp b/src/osgPlugins/mdl/VTXReader.cpp index 01b473d2a..5400dfc1e 100644 --- a/src/osgPlugins/mdl/VTXReader.cpp +++ b/src/osgPlugins/mdl/VTXReader.cpp @@ -65,7 +65,7 @@ ref_ptr VTXReader::processBodyPart(std::istream * str, int offset, currentModel = currentPart->getModel(i); // Process the model - modelGroup = processModel(str, + modelGroup = processModel(str, offset + part.model_offset + (i * sizeof(VTXModel)), currentModel); @@ -400,7 +400,7 @@ bool VTXReader::readFile(const std::string & file) currentPart = mdl_root->getBodyPart(i); // Process the body part - partGroup = processBodyPart(vtxFile, + partGroup = processBodyPart(vtxFile, header.body_part_offset + (i * sizeof(VTXBodyPart)), currentPart); diff --git a/src/osgPlugins/mdl/VVDReader.cpp b/src/osgPlugins/mdl/VVDReader.cpp index f358c6bb0..78101f229 100644 --- a/src/osgPlugins/mdl/VVDReader.cpp +++ b/src/osgPlugins/mdl/VVDReader.cpp @@ -82,7 +82,7 @@ bool VVDReader::readFile(const std::string & file) // Create the vertex buffers for (i = 0; i < header.num_lods; i++) - { + { // Create the vertex buffer for this LOD vertex_buffer[i] = new VVDVertex[header.num_lod_verts[i]]; vertex_buffer_size[i] = header.num_lod_verts[i]; @@ -99,7 +99,7 @@ bool VVDReader::readFile(const std::string & file) if (fixup_table[j].lod_number >= i) { // Seek to the vertex indicated by the fixup table entry - vvdFile->seekg(header.vertex_data_offset + + vvdFile->seekg(header.vertex_data_offset + fixup_table[j].source_vertex_id * sizeof(VVDVertex)); diff --git a/src/osgPlugins/normals/Normals.cpp b/src/osgPlugins/normals/Normals.cpp index 63fbd3142..ba4925f9b 100644 --- a/src/osgPlugins/normals/Normals.cpp +++ b/src/osgPlugins/normals/Normals.cpp @@ -31,7 +31,7 @@ Normals::Normals( Node *node, float scale, Mode mode ) -Normals::MakeNormalsVisitor::MakeNormalsVisitor( float normalScale, Mode mode): +Normals::MakeNormalsVisitor::MakeNormalsVisitor( float normalScale, Mode mode): NodeVisitor(NodeVisitor::TRAVERSE_ALL_CHILDREN), _normal_scale(normalScale), _mode(mode) @@ -79,7 +79,7 @@ void Normals::MakeNormalsVisitor::apply( Geode &geode ) Vec3Array::iterator coord_index = coords->begin(); while( coord_index != coords->end() ) v += *(coord_index++) * _mat; - v /= (float)(coords->size()); + v /= (float)(coords->size()); n *= _normal_scale; _local_coords->push_back( v ); @@ -101,7 +101,7 @@ void Normals::MakeNormalsVisitor::apply( Geode &geode ) if( binding == Geometry::BIND_PER_PRIMITIVE_SET ) { Vec3 v(0,0,0); - Vec3 n = *(normals_index++); + Vec3 n = *(normals_index++); int ni = (*itr)->getNumIndices(); for( int i = 0; i < ni; i++ ) v += *(coord_index++) * _mat; @@ -111,7 +111,7 @@ void Normals::MakeNormalsVisitor::apply( Geode &geode ) _local_coords->push_back( v ); _local_coords->push_back( (v + n)); } - else + else { switch((*itr)->getMode()) { @@ -123,7 +123,7 @@ void Normals::MakeNormalsVisitor::apply( Geode &geode ) coord_index += 3; if( binding == Geometry::BIND_PER_PRIMITIVE ) normals_index++; - else + else normals_index+=3; } break; @@ -152,7 +152,7 @@ void Normals::MakeNormalsVisitor::apply( Geode &geode ) coord_index += 4; if( binding == Geometry::BIND_PER_PRIMITIVE ) normals_index++; - else + else normals_index+=4; } break; @@ -192,7 +192,7 @@ void Normals::MakeNormalsVisitor::apply( Geode &geode ) void Normals::MakeNormalsVisitor::_processPrimitive( unsigned int nv, - Vec3Array::iterator coords, + Vec3Array::iterator coords, Vec3Array::iterator normals, Geometry::AttributeBinding binding ) { @@ -208,7 +208,7 @@ void Normals::MakeNormalsVisitor::_processPrimitive( unsigned int nv, { for( unsigned int i = 0; i < nv; i++ ) n += *(normals++); - n /= (float)(nv); + n /= (float)(nv); } for( unsigned int i = 0; i < nv; i++ ) diff --git a/src/osgPlugins/normals/Normals.h b/src/osgPlugins/normals/Normals.h index 44c929099..ae57c6e59 100644 --- a/src/osgPlugins/normals/Normals.h +++ b/src/osgPlugins/normals/Normals.h @@ -13,7 +13,7 @@ #include #include -class Normals: public osg::Geode +class Normals: public osg::Geode { public: enum Mode { @@ -48,7 +48,7 @@ class Normals: public osg::Geode void _processPrimitive( unsigned int nv, - osg::Vec3Array::iterator coords, + osg::Vec3Array::iterator coords, osg::Vec3Array::iterator normals, osg::Geometry::AttributeBinding binding ); }; diff --git a/src/osgPlugins/normals/ReaderWriterNormals.cpp b/src/osgPlugins/normals/ReaderWriterNormals.cpp index aaa6ef1a1..58f6e69d4 100644 --- a/src/osgPlugins/normals/ReaderWriterNormals.cpp +++ b/src/osgPlugins/normals/ReaderWriterNormals.cpp @@ -86,7 +86,7 @@ class NormalsReader: public osgDB::ReaderWriter const osg::BoundingSphere& bsph = group->getBound(); scale = bsph.radius() * 0.05f * scale; // default is 5% of bounding-sphere radius - if( mode == Normals::VertexNormals ) + if( mode == Normals::VertexNormals ) group->addChild( new VertexNormals( node.get(), scale )); else if( mode == Normals::SurfaceNormals ) group->addChild( new SurfaceNormals( node.get(), scale )); @@ -99,7 +99,7 @@ class NormalsReader: public osgDB::ReaderWriter private: void usage() const { - OSG_INFO << + OSG_INFO << "Normals Plugin usage: [-O options] .normals\n" " options: \"scale=\" (default = 1.0)\n" " \"mode=\" (default = VertexNormals)" << std::endl; diff --git a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp index 0e78077b0..c253dee27 100644 --- a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp +++ b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp @@ -8,66 +8,66 @@ * Modified by Robert Osfield to support per Drawable coord, normal and * texture coord arrays, bug fixes, and support for texture mapping. * - * Writing support added 2007 by Stephan Huber, http://digitalmind.de, + * Writing support added 2007 by Stephan Huber, http://digitalmind.de, * some ideas taken from the dae-plugin * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ #include #include "OBJWriterNodeVisitor.h" - + /** writes all values of an array out to a stream, applies a matrix beforehand if necessary */ class ValueVisitor : public osg::ValueVisitor { public: - ValueVisitor(std::ostream& fout, const osg::Matrix& m = osg::Matrix::identity(), bool isNormal = false) : - osg::ValueVisitor(), - _fout(fout), - _m(m), + ValueVisitor(std::ostream& fout, const osg::Matrix& m = osg::Matrix::identity(), bool isNormal = false) : + osg::ValueVisitor(), + _fout(fout), + _m(m), _isNormal(isNormal) - { + { _applyMatrix = (_m != osg::Matrix::identity()); if (_isNormal) _origin = osg::Vec3(0,0,0) * _m; } - - virtual void apply (osg::Vec2 & inv) - { - _fout << inv[0] << ' ' << inv[1]; + + virtual void apply (osg::Vec2 & inv) + { + _fout << inv[0] << ' ' << inv[1]; } - - virtual void apply (osg::Vec3 & inv) - { + + virtual void apply (osg::Vec3 & inv) + { osg::Vec3 v(inv); if (_applyMatrix) v = (_isNormal) ? (v * _m) - _origin : v * _m; - _fout << v[0] << ' ' << v[1] << ' ' << v[2]; + _fout << v[0] << ' ' << v[1] << ' ' << v[2]; } - + virtual void apply (osg::Vec2b & inv) - { - _fout << inv[0] << ' ' << inv[1]; + { + _fout << inv[0] << ' ' << inv[1]; } - - virtual void apply (osg::Vec3b & inv) - { + + virtual void apply (osg::Vec3b & inv) + { osg::Vec3 v(inv[0], inv[1], inv[2]); if (_applyMatrix) v = (_isNormal) ? (v * _m) - _origin : v * _m; - _fout << v[0] << ' ' << v[1] << ' ' << v[2]; + _fout << v[0] << ' ' << v[1] << ' ' << v[2]; } - - virtual void apply (osg::Vec2s & inv) - { - _fout << inv[0] << ' ' << inv[1]; + + virtual void apply (osg::Vec2s & inv) + { + _fout << inv[0] << ' ' << inv[1]; } - - virtual void apply (osg::Vec3s & inv) - { + + virtual void apply (osg::Vec3s & inv) + { osg::Vec3 v(inv[0], inv[1], inv[2]); if (_applyMatrix) v = (_isNormal) ? (v * _m) - _origin : v * _m; - _fout << v[0] << ' ' << v[1] << ' ' << v[2]; + _fout << v[0] << ' ' << v[1] << ' ' << v[2]; } private: @@ -81,10 +81,10 @@ class ValueVisitor : public osg::ValueVisitor { /** writes all primitives of a primitive-set out to a stream, decomposes quads to triangles, line-strips to lines etc */ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { - + public: - ObjPrimitiveIndexWriter(std::ostream& fout,osg::Geometry* geo, unsigned int normalIndex, unsigned int lastVertexIndex, unsigned int lastNormalIndex, unsigned int lastTexIndex) : - osg::PrimitiveIndexFunctor(), + ObjPrimitiveIndexWriter(std::ostream& fout,osg::Geometry* geo, unsigned int normalIndex, unsigned int lastVertexIndex, unsigned int lastNormalIndex, unsigned int lastTexIndex) : + osg::PrimitiveIndexFunctor(), _fout(fout), _lastVertexIndex(lastVertexIndex), _lastNormalIndex(lastNormalIndex), @@ -95,29 +95,29 @@ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { _normalIndex(normalIndex) { } - + virtual void setVertexArray(unsigned int,const osg::Vec2*) {} virtual void setVertexArray(unsigned int ,const osg::Vec3* ) {} virtual void setVertexArray(unsigned int,const osg::Vec4* ) {} - + virtual void setVertexArray(unsigned int,const osg::Vec2d*) {} virtual void setVertexArray(unsigned int ,const osg::Vec3d* ) {} virtual void setVertexArray(unsigned int,const osg::Vec4d* ) {} - - void write(unsigned int i) + + void write(unsigned int i) { _fout << (i + _lastVertexIndex) << "/"; - - if (_hasTexCoords || _hasNormalCoords) + + if (_hasTexCoords || _hasNormalCoords) { if (_hasTexCoords) _fout << (i + _lastTexIndex); _fout << "/"; - if (_hasNormalCoords) + if (_hasNormalCoords) { if (_geo->getNormalBinding() == osg::Geometry::BIND_PER_VERTEX) _fout << (i+_lastNormalIndex); @@ -127,7 +127,7 @@ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { } _fout << " "; } - + // operator for triangles void writeTriangle(unsigned int i1, unsigned int i2, unsigned int i3) { @@ -139,9 +139,9 @@ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { // not sure if this is correct? if(_geo->getNormalBinding() && _geo->getNormalBinding() == osg::Geometry::BIND_PER_PRIMITIVE) ++_normalIndex; } - + // operator for lines - void writeLine(unsigned int i1, unsigned int i2) + void writeLine(unsigned int i1, unsigned int i2) { _fout << "l "; write(i1); @@ -150,9 +150,9 @@ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { // not sure if this is correct? if(_geo->getNormalBinding() && _geo->getNormalBinding() == osg::Geometry::BIND_PER_PRIMITIVE) ++_normalIndex; } - + // operator for points - void writePoint(unsigned int i1) + void writePoint(unsigned int i1) { _fout << "p "; write(i1); @@ -180,8 +180,8 @@ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { } } - virtual void drawArrays(GLenum mode,GLint first,GLsizei count); - + virtual void drawArrays(GLenum mode,GLint first,GLsizei count); + virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) { drawElementsImplementation(mode, count, indices); @@ -189,21 +189,21 @@ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) { drawElementsImplementation(mode, count, indices); - } + } virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) { drawElementsImplementation(mode, count, indices); - } + } protected: - - templatevoid drawElementsImplementation(GLenum mode, GLsizei count, const T* indices) + + templatevoid drawElementsImplementation(GLenum mode, GLsizei count, const T* indices) { if (indices==0 || count==0) return; typedef const T* IndexPointer; - + switch(mode) { case(GL_TRIANGLES): @@ -211,7 +211,7 @@ class ObjPrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { IndexPointer ilast = &indices[count]; for(IndexPointer iptr=indices;iptrgetDiffuse(osg::Material::FRONT); ambient = mat->getAmbient(osg::Material::FRONT); specular = mat->getSpecular(osg::Material::FRONT); } - + if (tex) { osg::Image* img = tex->getImage(0); if ((img) && (!img->getFileName().empty())) image = img->getFileName(); - + } - + } std::ostream& operator<<(std::ostream& fout, const OBJWriterNodeVisitor::OBJMaterial& mat) { - + fout << "newmtl " << mat.name << std::endl; fout << " " << "Ka " << mat.ambient << std::endl; fout << " " << "Kd " << mat.diffuse << std::endl; fout << " " << "Ks " << mat.specular << std::endl; - + if(!mat.image.empty()) fout << " " << "map_Kd " << mat.image << std::endl; - + return fout; - + } -void OBJWriterNodeVisitor::writeMaterials(std::ostream& fout) +void OBJWriterNodeVisitor::writeMaterials(std::ostream& fout) { for(MaterialMap::iterator i = _materialMap.begin(); i != _materialMap.end(); ++i) { @@ -464,19 +464,19 @@ void OBJWriterNodeVisitor::writeMaterials(std::ostream& fout) std::string OBJWriterNodeVisitor::getUniqueName(const std::string& defaultvalue) { - + std::string name = ""; for(std::list::iterator i = _nameStack.begin(); i != _nameStack.end(); ++i) { if (!name.empty()) name+="_"; name += (*i); } - + if (!defaultvalue.empty()) name += "_" +defaultvalue; - + if (_nameMap.find(name) == _nameMap.end()) _nameMap.insert(std::make_pair(name, 0u)); - + std::stringstream ss; ss << name << "_" << _nameMap[name]; ++(_nameMap[name]); @@ -488,7 +488,7 @@ void OBJWriterNodeVisitor::processArray(const std::string& key, osg::Array* arra { if (array == NULL) return; - + ValueVisitor vv(_fout, m, isNormal); _fout << std::endl; for(unsigned int i = 0; i < array->getNumElements(); ++i) { @@ -496,57 +496,57 @@ void OBJWriterNodeVisitor::processArray(const std::string& key, osg::Array* arra array->accept(i, vv); _fout << std::endl; } - + _fout << "# " << array->getNumElements() << " elements written" << std::endl; - + } -void OBJWriterNodeVisitor::processStateSet(osg::StateSet* ss) +void OBJWriterNodeVisitor::processStateSet(osg::StateSet* ss) { if (_materialMap.find(ss) != _materialMap.end()) { _fout << "usemtl " << _materialMap[ss].name << std::endl; return; } - + osg::Material* mat = dynamic_cast(ss->getAttribute(osg::StateAttribute::MATERIAL)); osg::Texture* tex = dynamic_cast(ss->getTextureAttribute(0, osg::StateAttribute::TEXTURE)); - - if (mat || tex) + + if (mat || tex) { _materialMap.insert(std::make_pair(osg::ref_ptr(ss), OBJMaterial(mat, tex))); _fout << "usemtl " << _materialMap[ss].name << std::endl; } - + } void OBJWriterNodeVisitor::processGeometry(osg::Geometry* geo, osg::Matrix& m) { _fout << std::endl; _fout << "o " << getUniqueName( geo->getName().empty() ? geo->className() : geo->getName() ) << std::endl; - + processStateSet(_currentStateSet.get()); - + processArray("v", geo->getVertexArray(), m, false); processArray("vn", geo->getNormalArray(), m, true); processArray("vt", geo->getTexCoordArray(0)); // we support only tex-unit 0 unsigned int normalIndex = 0; - for(unsigned int i = 0; i < geo->getNumPrimitiveSets(); ++i) + for(unsigned int i = 0; i < geo->getNumPrimitiveSets(); ++i) { osg::PrimitiveSet* ps = geo->getPrimitiveSet(i); - + ObjPrimitiveIndexWriter pif(_fout, geo, normalIndex, _lastVertexIndex, _lastNormalIndex, _lastTexIndex); ps->accept(pif); - + if(geo->getNormalArray() && geo->getNormalBinding() == osg::Geometry::BIND_PER_PRIMITIVE_SET) ++normalIndex; } - if (geo->getVertexArray()) + if (geo->getVertexArray()) _lastVertexIndex += geo->getVertexArray()->getNumElements(); if (geo->getNormalArray()) _lastNormalIndex += geo->getNormalArray()->getNumElements(); if(geo->getTexCoordArray(0)) _lastTexIndex += geo->getTexCoordArray(0)->getNumElements(); - + } void OBJWriterNodeVisitor::apply( osg::Geode &node ) @@ -562,9 +562,9 @@ void OBJWriterNodeVisitor::apply( osg::Geode &node ) if ( g != NULL ) { pushStateSet(g->getStateSet()); - + processGeometry(g,m); - + popStateSet(g->getStateSet()); } } diff --git a/src/osgPlugins/obj/OBJWriterNodeVisitor.h b/src/osgPlugins/obj/OBJWriterNodeVisitor.h index f39fc59c7..eb62b078f 100644 --- a/src/osgPlugins/obj/OBJWriterNodeVisitor.h +++ b/src/osgPlugins/obj/OBJWriterNodeVisitor.h @@ -8,14 +8,14 @@ * Modified by Robert Osfield to support per Drawable coord, normal and * texture coord arrays, bug fixes, and support for texture mapping. * - * Writing support added 2007 by Stephan Huber, http://digitalmind.de, + * Writing support added 2007 by Stephan Huber, http://digitalmind.de, * some ideas taken from the dae-plugin * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ - + #ifndef OBJ_WRITER_NODE_VISITOR_HEADER__ #define OBJ_WRITER_NODE_VISITOR_HEADER__ @@ -50,33 +50,33 @@ class OBJWriterNodeVisitor: public osg::NodeVisitor { public: - OBJWriterNodeVisitor(std::ostream& fout, const std::string materialFileName = "") : - osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), - _fout(fout), + OBJWriterNodeVisitor(std::ostream& fout, const std::string materialFileName = "") : + osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), + _fout(fout), _currentStateSet(new osg::StateSet()), _lastVertexIndex(1), _lastNormalIndex(1), _lastTexIndex(1) { _fout << "# file written by OpenSceneGraph" << std::endl << std::endl; - + if (!materialFileName.empty()) { _fout << "mtllib " << materialFileName << std::endl << std::endl; } } - + virtual void apply(osg::Geode &node); - - virtual void apply(osg::Group &node) + + virtual void apply(osg::Group &node) { _nameStack.push_back( node.getName().empty() ? node.className() : node.getName() ); _fout << std::endl; _fout << "g " << getUniqueName() << std::endl; - + osg::NodeVisitor::traverse( node ); _nameStack.pop_back(); } - + void traverse (osg::Node &node) { pushStateSet(node.getStateSet()); @@ -91,10 +91,10 @@ class OBJWriterNodeVisitor: public osg::NodeVisitor { if (NULL!=ss) { // Save our current stateset _stateSetStack.push(_currentStateSet.get()); - + // merge with node stateset _currentStateSet = static_cast(_currentStateSet->clone(osg::CopyOp::SHALLOW_COPY)); - _currentStateSet->merge(*ss); + _currentStateSet->merge(*ss); } } @@ -107,22 +107,22 @@ class OBJWriterNodeVisitor: public osg::NodeVisitor { _stateSetStack.pop(); } } - - + + void writeMaterials(std::ostream& fout); - - - + + + class OBJMaterial { public: OBJMaterial() {} OBJMaterial(osg::Material* mat, osg::Texture* tex); - + osg::Vec4 diffuse, ambient, specular; std::string image; std::string name; }; - + protected: struct CompareStateSet { @@ -133,18 +133,18 @@ class OBJWriterNodeVisitor: public osg::NodeVisitor { } }; - + private: - + OBJWriterNodeVisitor& operator = (const OBJWriterNodeVisitor&) { return *this; } void processGeometry(osg::Geometry* geo, osg::Matrix& m); void processArray(const std::string& key, osg::Array* array, const osg::Matrix& m = osg::Matrix::identity(), bool isNormal = false); - + void processStateSet(osg::StateSet* stateset); std::string getUniqueName(const std::string& defaultValue = ""); - + typedef std::stack > StateSetStack; typedef std::map< osg::ref_ptr, OBJMaterial, CompareStateSet> MaterialMap; @@ -155,7 +155,7 @@ class OBJWriterNodeVisitor: public osg::NodeVisitor { osg::ref_ptr _currentStateSet; std::map _nameMap; unsigned int _lastVertexIndex, _lastNormalIndex, _lastTexIndex; - MaterialMap _materialMap; + MaterialMap _materialMap; }; diff --git a/src/osgPlugins/obj/ReaderWriterOBJ.cpp b/src/osgPlugins/obj/ReaderWriterOBJ.cpp index 9c01c81ba..05dfe2014 100644 --- a/src/osgPlugins/obj/ReaderWriterOBJ.cpp +++ b/src/osgPlugins/obj/ReaderWriterOBJ.cpp @@ -8,11 +8,11 @@ * Modified by Robert Osfield to support per Drawable coord, normal and * texture coord arrays, bug fixes, and support for texture mapping. * - * Writing support added 2007 by Stephan Huber, http://digitalmind.de, + * Writing support added 2007 by Stephan Huber, http://digitalmind.de, * some ideas taken from the dae-plugin * - * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for - * real-time rendering of large 3D photo-realistic models. + * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for + * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ @@ -78,54 +78,54 @@ public: virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const; virtual ReadResult readNode(std::istream& fin, const Options* options) const; - - virtual WriteResult writeObject(const osg::Object& obj,const std::string& fileName,const Options* options=NULL) const + + virtual WriteResult writeObject(const osg::Object& obj,const std::string& fileName,const Options* options=NULL) const { const osg::Node* node = dynamic_cast(&obj); if (node) return writeNode(*node, fileName, options); - else - return WriteResult(WriteResult::FILE_NOT_HANDLED); + else + return WriteResult(WriteResult::FILE_NOT_HANDLED); } - - virtual WriteResult writeNode(const osg::Node& node,const std::string& fileName,const Options* options =NULL) const - { + + virtual WriteResult writeNode(const osg::Node& node,const std::string& fileName,const Options* options =NULL) const + { if (!acceptsExtension(osgDB::getFileExtension(fileName))) - return WriteResult(WriteResult::FILE_NOT_HANDLED); - + return WriteResult(WriteResult::FILE_NOT_HANDLED); + osgDB::ofstream f(fileName.c_str()); std::string materialFile = osgDB::getNameLessExtension(fileName) + ".mtl"; OBJWriterNodeVisitor nv(f, osgDB::getSimpleFileName(materialFile)); - + // we must cast away constness (const_cast(&node))->accept(nv); - + osgDB::ofstream mf(materialFile.c_str()); nv.writeMaterials(mf); - - return WriteResult(WriteResult::FILE_SAVED); + + return WriteResult(WriteResult::FILE_SAVED); } - - virtual WriteResult writeObject(const osg::Object& obj,std::ostream& fout,const Options* options=NULL) const + + virtual WriteResult writeObject(const osg::Object& obj,std::ostream& fout,const Options* options=NULL) const { const osg::Node* node = dynamic_cast(&obj); if (node) return writeNode(*node, fout, options); - else - return WriteResult(WriteResult::FILE_NOT_HANDLED); + else + return WriteResult(WriteResult::FILE_NOT_HANDLED); } - virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout,const Options* =NULL) const - { + virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout,const Options* =NULL) const + { // writing to a stream does not support materials - + OBJWriterNodeVisitor nv(fout); - + // we must cast away constness (const_cast(&node))->accept(nv); - - return WriteResult(WriteResult::FILE_SAVED); + + return WriteResult(WriteResult::FILE_SAVED); } @@ -145,16 +145,16 @@ protected: }; typedef std::map< std::string, osg::ref_ptr > MaterialToStateSetMap; - + void buildMaterialToStateSetMap(obj::Model& model, MaterialToStateSetMap& materialToSetSetMapObj, ObjOptionsStruct& localOptions, const Options* options) const; - + osg::Geometry* convertElementListToGeometry(obj::Model& model, obj::Model::ElementList& elementList, ObjOptionsStruct& localOptions) const; - + osg::Node* convertModelToSceneGraph(obj::Model& model, ObjOptionsStruct& localOptions, const Options* options) const; inline osg::Vec3 transformVertex(const osg::Vec3& vec, const bool rotate) const ; inline osg::Vec3 transformNormal(const osg::Vec3& vec, const bool rotate) const ; - + ObjOptionsStruct parseOptions(const Options* options) const; @@ -198,12 +198,12 @@ static void load_material_texture( obj::Model &model, if (!filename.empty()) { osg::ref_ptr< osg::Image > image; - if ( !model.getDatabasePath().empty() ) + if ( !model.getDatabasePath().empty() ) { - // first try with database path of parent. + // first try with database path of parent. image = osgDB::readRefImageFile(model.getDatabasePath()+'/'+filename, options); } - + if ( !image.valid() ) { // if not already set then try the filename as is. @@ -230,14 +230,14 @@ static void load_material_texture( obj::Model &model, texture->setWrap(osg::Texture2D::WRAP_S, textureWrapMode); texture->setWrap(osg::Texture2D::WRAP_T, textureWrapMode); stateset->setTextureAttributeAndModes( texture_unit, texture,osg::StateAttribute::ON ); - + if ( map.type == obj::Material::Map::REFLECTION ) { osg::TexGen* texgen = new osg::TexGen; texgen->setMode(osg::TexGen::SPHERE_MAP); stateset->setTextureAttributeAndModes( texture_unit,texgen,osg::StateAttribute::ON ); } - + if ( image->isImageTranslucent()) { OSG_INFO<<"Found transparent image"<second; - + osg::ref_ptr< osg::StateSet > stateset = new osg::StateSet; bool isTransparent = false; @@ -337,7 +337,7 @@ void ReaderWriterOBJ::buildMaterialToStateSetMap(obj::Model& model, MaterialToSt osg_material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(0,0,0,1)); } osg_material->setShininess(osg::Material::FRONT_AND_BACK,(material.Ns/1000.0f)*128.0f ); // note OBJ shiniess is 0..1000. - + if (material.ambient[3]!=1.0 || material.diffuse[3]!=1.0 || material.specular[3]!=1.0|| @@ -347,8 +347,8 @@ void ReaderWriterOBJ::buildMaterialToStateSetMap(obj::Model& model, MaterialToSt isTransparent = true; } } - - // If the user has explicitly set the required texture type to unit map via the options + + // If the user has explicitly set the required texture type to unit map via the options // string, then we load ONLY those textures that are in the map. if(localOptions.textureUnitAllocation.size()>0) { @@ -395,7 +395,7 @@ void ReaderWriterOBJ::buildMaterialToStateSetMap(obj::Model& model, MaterialToSt } } } - + if (isTransparent) { stateset->setMode(GL_BLEND, osg::StateAttribute::ON); @@ -408,17 +408,17 @@ void ReaderWriterOBJ::buildMaterialToStateSetMap(obj::Model& model, MaterialToSt osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, obj::Model::ElementList& elementList, ObjOptionsStruct& localOptions) const { - + unsigned int numVertexIndices = 0; unsigned int numNormalIndices = 0; unsigned int numTexCoordIndices = 0; - + unsigned int numPointElements = 0; unsigned int numPolylineElements = 0; unsigned int numPolygonElements = 0; obj::Model::ElementList::iterator itr; - + if (localOptions.generateFacetNormals == true) { for(itr=elementList.begin(); itr!=elementList.end(); @@ -427,7 +427,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, obj::Element& element = *(*itr); if (element.dataType==obj::Element::POINTS || element.dataType==obj::Element::POLYLINE) continue; - + if (element.normalIndices.size() == 0) { // fill in the normals int a = element.vertexIndices[0]; @@ -450,9 +450,9 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, } } } - - - + + + for(itr=elementList.begin(); itr!=elementList.end(); ++itr) @@ -470,27 +470,27 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, } if (numVertexIndices==0) return 0; - + if (numNormalIndices!=0 && numNormalIndices!=numVertexIndices) { OSG_NOTICE<<"Incorrect number of normals, ignore them"<reserve(numVertexIndices); if (normals) normals->reserve(numNormalIndices); if (texcoords) texcoords->reserve(numTexCoordIndices); - + osg::Geometry* geometry = new osg::Geometry; if (vertices) geometry->setVertexArray(vertices); if (normals) @@ -502,7 +502,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, { geometry->setTexCoordArray(0,texcoords); } - + if (numPointElements>0) { @@ -546,7 +546,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, osg::DrawArrays* drawArrays = new osg::DrawArrays(GL_POINTS,startPos,numPoints); geometry->addPrimitiveSet(drawArrays); } - + if (numPolylineElements>0) { unsigned int startPos = vertices->size(); @@ -597,7 +597,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, if (numPolygonElements>0) { unsigned int startPos = vertices->size(); - + #ifdef USE_DRAWARRAYLENGTHS osg::DrawArrayLengths* drawArrayLengths = new osg::DrawArrayLengths(GL_POLYGON,startPos); geometry->addPrimitiveSet(drawArrayLengths); @@ -611,7 +611,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, if (element.dataType==obj::Element::POLYGON) { - + @@ -633,7 +633,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, } #endif - + if (model.needReverse(element)) { // need to reverse so add to OSG arrays in same order as in OBJ, as OSG assume anticlockwise ordering. @@ -697,7 +697,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, } - + return geometry; } @@ -717,7 +717,7 @@ osg::Node* ReaderWriterOBJ::convertModelToSceneGraph(obj::Model& model, ObjOptio itr!=model.elementStateMap.end(); ++itr) { - + const obj::ElementState& es = itr->first; obj::Model::ElementList& el = itr->second; @@ -733,21 +733,21 @@ osg::Node* ReaderWriterOBJ::convertModelToSceneGraph(obj::Model& model, ObjOptio osg::StateSet* stateset = materialToStateSetMap[es.materialName].get(); geometry->setStateSet(stateset); - + // tesseleate any large polygons if (!localOptions.noTesselateLargePolygons) { osgUtil::Tessellator tessellator; tessellator.retessellatePolygons(*geometry); } - + // tri strip polygons to improve graphics peformance if (!localOptions.noTriStripPolygons) { osgUtil::TriStripVisitor tsv; tsv.stripify(*geometry); } - + // if no normals present add them. if (localOptions.generateFacetNormals==false && (!geometry->getNormalArray() || geometry->getNormalArray()->getNumElements()==0)) { @@ -758,7 +758,7 @@ osg::Node* ReaderWriterOBJ::convertModelToSceneGraph(obj::Model& model, ObjOptio osg::Geode* geode = new osg::Geode; geode->addDrawable(geometry); - + if (es.objectName.empty()) { geode->setName(es.groupName); @@ -804,7 +804,7 @@ ReaderWriterOBJ::ObjOptionsStruct ReaderWriterOBJ::parseOptions(const osgDB::Rea { pre_equals = opt.substr(0,found); post_equals = opt.substr(found+1); - } + } else { pre_equals = opt; @@ -813,11 +813,11 @@ ReaderWriterOBJ::ObjOptionsStruct ReaderWriterOBJ::parseOptions(const osgDB::Rea if (pre_equals == "noRotation") { localOptions.rotate = false; - } + } else if (pre_equals == "noTesselateLargePolygons") { localOptions.noTesselateLargePolygons = true; - } + } else if (pre_equals == "noTriStripPolygons") { localOptions.noTriStripPolygons = true; @@ -827,8 +827,8 @@ ReaderWriterOBJ::ObjOptionsStruct ReaderWriterOBJ::parseOptions(const osgDB::Rea localOptions.generateFacetNormals = true; } else if (post_equals.length()>0) - { - obj::Material::Map::TextureMapType type = obj::Material::Map::UNKNOWN; + { + obj::Material::Map::TextureMapType type = obj::Material::Map::UNKNOWN; // Now we check to see if we have anything forcing a texture allocation if (pre_equals == "DIFFUSE") type = obj::Material::Map::DIFFUSE; else if (pre_equals == "AMBIENT") type = obj::Material::Map::AMBIENT; @@ -838,7 +838,7 @@ ReaderWriterOBJ::ObjOptionsStruct ReaderWriterOBJ::parseOptions(const osgDB::Rea else if (pre_equals == "BUMP") type = obj::Material::Map::BUMP; else if (pre_equals == "DISPLACEMENT") type = obj::Material::Map::DISPLACEMENT; else if (pre_equals == "REFLECTION") type = obj::Material::Map::REFLECTION; - + if (type!=obj::Material::Map::UNKNOWN) { int unit = atoi(post_equals.c_str()); // (probably should use istringstream rather than atoi) @@ -860,13 +860,13 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil std::string fileName = osgDB::findDataFile( file, options ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - - + + osgDB::ifstream fin(fileName.c_str()); if (fin) { - - // code for setting up the database path so that internally referenced file are searched for on relative paths. + + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -879,7 +879,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil osg::Node* node = convertModelToSceneGraph(model, localOptions, options); return node; } - + return ReadResult::FILE_NOT_HANDLED; } @@ -891,12 +891,12 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(std::istream& fin, con obj::Model model; model.readOBJ(fin, options); - + ObjOptionsStruct localOptions = parseOptions(options); - + osg::Node* node = convertModelToSceneGraph(model, localOptions, options); return node; } - + return ReadResult::FILE_NOT_HANDLED; } diff --git a/src/osgPlugins/obj/obj.cpp b/src/osgPlugins/obj/obj.cpp index 979b7fdd0..313954397 100644 --- a/src/osgPlugins/obj/obj.cpp +++ b/src/osgPlugins/obj/obj.cpp @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -47,7 +47,7 @@ static Material::Map parseTextureMap( const std::string& ss, Material::Map::Text { if (s[0] != '-') break; - + int n; if (s[1] == 's' || s[1] == 'o') { @@ -136,7 +136,7 @@ bool Model::readline(std::istream& fin, char* line, const int LINE_SIZE) // OSG_NOTICE<<"We have dos line ending"<line && *(ptr-1)==' ') { @@ -189,16 +189,16 @@ bool Model::readline(std::istream& fin, char* line, const int LINE_SIZE) } *ptr = 0; - + if (changeTabsToSpaces) { - + for(ptr = line; *ptr != 0; ++ptr) { if (*ptr == '\t') *ptr=' '; } } - + return true; } @@ -447,7 +447,7 @@ bool Model::readMTL(std::istream& fin) } // map_opacity doesn't exist in the spec, but was already in the plugin // so leave it or plugin will break for some users - else if (strncmp(line,"map_opacity ",12)==0) + else if (strncmp(line,"map_opacity ",12)==0) { material->maps.push_back(parseTextureMap(strip(line+12),Material::Map::OPACITY)); } @@ -495,7 +495,7 @@ bool Model::readMTL(std::istream& fin) { OSG_NOTICE <<"*** line not handled *** :"< lock(_serializerMutex); @@ -144,7 +144,7 @@ public: bool useRandomColorByFeature = false; bool addGroupPerFeature = false; - if (options) + if (options) { if (options->getOptionString().find("UseRandomColorByFeature") != std::string::npos) useRandomColorByFeature = true; @@ -156,7 +156,7 @@ public: osg::Group* group = new osg::Group; - for (int i = 0; i < file->GetLayerCount(); i++) + for (int i = 0; i < file->GetLayerCount(); i++) { osg::Group* node = readLayer(file->GetLayer(i), file->GetName(), useRandomColorByFeature, addGroupPerFeature); if (node) @@ -176,7 +176,7 @@ public: ogrLayer->ResetReading(); OGRFeature* ogrFeature = NULL; - while ((ogrFeature = ogrLayer->GetNextFeature()) != NULL) + while ((ogrFeature = ogrLayer->GetNextFeature()) != NULL) { osg::Geode* feature = readFeature(ogrFeature, useRandomColorByFeature); if (feature) @@ -227,7 +227,7 @@ public: osg::Geometry* contourGeom = new osg::Geometry(); osg::Vec3Array* vertices = new osg::Vec3Array(); OGRPoint point; - for(int j = 0; j < lineString->getNumPoints(); j++) + for(int j = 0; j < lineString->getNumPoints(); j++) { lineString->getPoint(j, &point); vertices->push_back(osg::Vec3(point.getX(), point.getY(), point.getZ())); @@ -244,9 +244,9 @@ public: osg::Geometry* pointGeom = new osg::Geometry(); osg::Vec3Array* vertices = new osg::Vec3Array(); - + vertices->reserve(mpoint->getNumGeometries()); - for (int i = 0; i < mpoint->getNumGeometries(); i++ ) + for (int i = 0; i < mpoint->getNumGeometries(); i++ ) { OGRGeometry* ogrGeom = mpoint->getGeometryRef(i); OGRwkbGeometryType ogrGeomType = ogrGeom->getGeometryType(); @@ -255,13 +255,13 @@ public: continue; // skip OGRPoint* points = static_cast(ogrGeom); - + vertices->push_back(osg::Vec3(points->getX(), points->getY(), points->getZ())); } - + pointGeom->setVertexArray(vertices); pointGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, vertices->size())); - + if (pointGeom->getVertexArray()) { OSG_INFO << "osgOgrFeature::multiPointToDrawable " << geom->getVertexArray()->getNumElements() << " vertexes"<< std::endl; @@ -274,7 +274,7 @@ public: { osg::Geometry* geom = new osg::Geometry; - for (int i = 0; i < mpolygon->getNumGeometries(); i++ ) + for (int i = 0; i < mpolygon->getNumGeometries(); i++ ) { OGRGeometry* ogrGeom = mpolygon->getGeometryRef(i); OGRwkbGeometryType ogrGeomType = ogrGeom->getGeometryType(); @@ -285,31 +285,31 @@ public: OGRPolygon* polygon = static_cast(ogrGeom); osg::ref_ptr drw = polygonToDrawable(polygon); osg::ref_ptr geometry = drw->asGeometry(); - if (geometry.valid() && geometry->getVertexArray() && - geometry->getVertexArray()->getNumElements() && + if (geometry.valid() && geometry->getVertexArray() && + geometry->getVertexArray()->getNumElements() && geometry->getNumPrimitiveSets() && - geometry->getVertexArray()->getType() == osg::Array::Vec3ArrayType ) + geometry->getVertexArray()->getType() == osg::Array::Vec3ArrayType ) { - if (!geom->getVertexArray()) + if (!geom->getVertexArray()) { // no yet data we put the first in geom->setVertexArray(geometry->getVertexArray()); geom->setPrimitiveSetList(geometry->getPrimitiveSetList()); - } - else + } + else { // already a polygon then append int size = geom->getVertexArray()->getNumElements(); osg::Vec3Array* arrayDst = static_cast(geom->getVertexArray()); osg::ref_ptr triangulized = triangulizeGeometry(geometry.get()); - if (triangulized.valid()) + if (triangulized.valid()) { arrayDst->insert(arrayDst->end(), triangulized->begin(), triangulized->end()); - // shift index + // shift index geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, size, triangulized->size())); } } - } + } else { OSG_WARN << "Warning something wrong with a polygon in a multi polygon" << std::endl; @@ -340,13 +340,13 @@ public: geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP, 0, vertices->size())); } - if (polygon->getNumInteriorRings()) + if (polygon->getNumInteriorRings()) { for (int i = 0; i < polygon->getNumInteriorRings(); i++) { OGRLinearRing *ring = polygon->getInteriorRing(i); OGRPoint point; - for (int j = 0; j < ring->getNumPoints(); j++) + for (int j = 0; j < ring->getNumPoints(); j++) { ring->getPoint(j, &point); vertices->push_back(osg::Vec3(point.getX(), point.getY(), point.getZ())); @@ -363,14 +363,14 @@ public: geom->setVertexArray(array); geom->removePrimitiveSet(0,geom->getNumPrimitiveSets()); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, array->size())); - + return geom; } osg::Geometry* multiLineStringToDrawable(OGRMultiLineString* mlineString) const { osg::Geometry* geom = new osg::Geometry; - for (int i = 0; i < mlineString->getNumGeometries(); i++ ) + for (int i = 0; i < mlineString->getNumGeometries(); i++ ) { OGRGeometry* ogrGeom = mlineString->getGeometryRef(i); OGRwkbGeometryType ogrGeomType = ogrGeom->getGeometryType(); @@ -380,10 +380,10 @@ public: OGRLineString* lineString = static_cast(ogrGeom); osg::ref_ptr geometry = lineStringToDrawable(lineString); - if (geometry.valid() && - geometry->getVertexArray() && + if (geometry.valid() && + geometry->getVertexArray() && geometry->getNumPrimitiveSets() && - geometry->getVertexArray()->getType() == osg::Array::Vec3ArrayType) + geometry->getVertexArray()->getType() == osg::Array::Vec3ArrayType) { if (!geom->getVertexArray()) @@ -391,15 +391,15 @@ public: geom->setVertexArray(geometry->getVertexArray()); geom->setPrimitiveSetList(geometry->getPrimitiveSetList()); - } - else + } + else { int size = geom->getVertexArray()->getNumElements(); osg::Vec3Array* arraySrc = static_cast(geometry->getVertexArray()); osg::Vec3Array* arrayDst = static_cast(geom->getVertexArray()); arrayDst->insert(arrayDst->end(), arraySrc->begin(), arraySrc->end()); - // shift index + // shift index geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, size, arraySrc->size())); } } @@ -412,7 +412,7 @@ public: if (!ogrFeature || !ogrFeature->GetGeometryRef()) return 0; - + osg::Geometry* drawable = 0; bool disableCulling = false; @@ -423,7 +423,7 @@ public: // point to drawable drawable = pointsToDrawable(static_cast(ogrFeature->GetGeometryRef())); disableCulling = true; - break; + break; case wkbLinearRing: drawable = linearRingToDrawable(static_cast(ogrFeature->GetGeometryRef())); diff --git a/src/osgPlugins/osg/AsciiStreamOperator.h b/src/osgPlugins/osg/AsciiStreamOperator.h index 9fca5768b..f0207deeb 100644 --- a/src/osgPlugins/osg/AsciiStreamOperator.h +++ b/src/osgPlugins/osg/AsciiStreamOperator.h @@ -13,51 +13,51 @@ public: _out = ostream; if (precision>0) _out->precision(precision); } - + virtual ~AsciiOutputIterator() {} - + virtual bool isBinary() const { return false; } - + virtual void writeBool( bool b ) { indentIfRequired(); if ( b ) *_out << "TRUE "; else *_out << "FALSE "; } - + virtual void writeChar( char c ) { indentIfRequired(); *_out << (short)c << ' '; } - + virtual void writeUChar( unsigned char c ) { indentIfRequired(); *_out << (unsigned short)c << ' '; } - + virtual void writeShort( short s ) { indentIfRequired(); *_out << s << ' '; } - + virtual void writeUShort( unsigned short s ) { indentIfRequired(); *_out << s << ' '; } - + virtual void writeInt( int i ) { indentIfRequired(); *_out << i << ' '; } - + virtual void writeUInt( unsigned int i ) { indentIfRequired(); *_out << i << ' '; } - + virtual void writeLong( long l ) { indentIfRequired(); *_out << l << ' '; } - + virtual void writeULong( unsigned long l ) { indentIfRequired(); *_out << l << ' '; } - + virtual void writeFloat( float f ) { indentIfRequired(); *_out << f << ' '; } - + virtual void writeDouble( double d ) { indentIfRequired(); *_out << d << ' '; } - + virtual void writeString( const std::string& s ) { indentIfRequired(); *_out << s << ' '; } - + virtual void writeStream( std::ostream& (*fn)(std::ostream&) ) { indentIfRequired(); *_out << fn; @@ -66,19 +66,19 @@ public: _readyForIndent = true; } } - + virtual void writeBase( std::ios_base& (*fn)(std::ios_base&) ) { indentIfRequired(); *_out << fn; } - + virtual void writeGLenum( const osgDB::ObjectGLenum& value ) { GLenum e = value.get(); const std::string& enumString = osgDB::Registry::instance()->getObjectWrapperManager()->getString("GL", e); indentIfRequired(); *_out << enumString << ' '; } - + virtual void writeProperty( const osgDB::ObjectProperty& prop ) { std::string enumString = prop._name; @@ -88,15 +88,15 @@ public: } indentIfRequired(); *_out << enumString << ' '; } - + virtual void writeMark( const osgDB::ObjectMark& mark ) { _indent += mark._indentDelta; indentIfRequired(); *_out << mark._name; } - + virtual void writeCharArray( const char* s, unsigned int size ) {} - + virtual void writeWrappedString( const std::string& str ) { std::string wrappedStr; @@ -108,14 +108,14 @@ public: else if ( ch=='\\' ) wrappedStr += '\\'; wrappedStr += ch; } - + wrappedStr.insert( std::string::size_type(0), 1, '\"' ); wrappedStr += '\"'; indentIfRequired(); writeString( wrappedStr ); } - + protected: inline void indentIfRequired() @@ -127,7 +127,7 @@ protected: _readyForIndent = false; } } - + bool _readyForIndent; int _indent; }; @@ -137,9 +137,9 @@ class AsciiInputIterator : public osgDB::InputIterator public: AsciiInputIterator( std::istream* istream ) { _in = istream; } virtual ~AsciiInputIterator() {} - + virtual bool isBinary() const { return false; } - + virtual void readBool( bool& b ) { std::string boolString; @@ -147,52 +147,52 @@ public: if ( boolString=="TRUE" ) b = true; else b = false; } - + virtual void readChar( char& c ) { short s = 0; readShort( s ); c = (char)s; } - + virtual void readSChar( signed char& c ) { short s = 0; readShort( s ); c = (signed char)s; } - + virtual void readUChar( unsigned char& c ) { short s = 0; readShort( s ); c = (unsigned char)s; } - + virtual void readShort( short& s ) { std::string str; readString(str); s = static_cast(strtol(str.c_str(), NULL, 0)); } - + virtual void readUShort( unsigned short& s ) { std::string str; readString(str); s = static_cast(strtoul(str.c_str(), NULL, 0)); } - + virtual void readInt( int& i ) { std::string str; readString(str); i = static_cast(strtol(str.c_str(), NULL, 0)); } - + virtual void readUInt( unsigned int& i ) { std::string str; readString(str); i = static_cast(strtoul(str.c_str(), NULL, 0)); } - + virtual void readLong( long& l ) { std::string str; readString(str); l = strtol(str.c_str(), NULL, 0); } - + virtual void readULong( unsigned long& l ) { std::string str; readString(str); l = strtoul(str.c_str(), NULL, 0); } - + virtual void readFloat( float& f ) { std::string str; readString(str); f = osg::asciiToFloat(str.c_str()); } - + virtual void readDouble( double& d ) { std::string str; readString(str); d = osg::asciiToDouble(str.c_str()); } - + virtual void readString( std::string& s ) { if ( _preReadString.empty() ) @@ -203,13 +203,13 @@ public: _preReadString.clear(); } } - + virtual void readStream( std::istream& (*fn)(std::istream&) ) { *_in >> fn; } - + virtual void readBase( std::ios_base& (*fn)(std::ios_base&) ) { *_in >> fn; } - + virtual void readGLenum( osgDB::ObjectGLenum& value ) { GLenum e = 0; @@ -218,7 +218,7 @@ public: e = osgDB::Registry::instance()->getObjectWrapperManager()->getValue("GL", enumString); value.set( e ); } - + virtual void readProperty( osgDB::ObjectProperty& prop ) { int value = 0; @@ -239,15 +239,15 @@ public: } prop.set( value ); } - + virtual void readMark( osgDB::ObjectMark& mark ) { std::string markString; readString( markString ); } - + virtual void readCharArray( char* s, unsigned int size ) {} - + virtual void readWrappedString( std::string& str ) { char ch; @@ -290,7 +290,7 @@ public: { if ( _preReadString.empty() ) *_in >> _preReadString; - + if ( _preReadString==str ) { _preReadString.clear(); @@ -298,7 +298,7 @@ public: } return false; } - + virtual void advanceToCurrentEndBracket() { std::string passString; @@ -307,7 +307,7 @@ public: { passString.clear(); readString( passString ); - + if ( passString=="}" ) { if ( blocks<=0 ) return; @@ -317,7 +317,7 @@ public: blocks++; } } - + protected: void getCharacter( char& ch ) { @@ -332,7 +332,7 @@ protected: checkStream(); } } - + std::string _preReadString; }; diff --git a/src/osgPlugins/osg/BinaryStreamOperator.h b/src/osgPlugins/osg/BinaryStreamOperator.h index 7519462f3..329ec579a 100644 --- a/src/osgPlugins/osg/BinaryStreamOperator.h +++ b/src/osgPlugins/osg/BinaryStreamOperator.h @@ -16,30 +16,30 @@ class BinaryOutputIterator : public osgDB::OutputIterator public: BinaryOutputIterator( std::ostream* ostream ) { _out = ostream; } virtual ~BinaryOutputIterator() {} - + virtual bool isBinary() const { return true; } - + virtual void writeBool( bool b ) { char c = b?1:0; _out->write( &c, osgDB::CHAR_SIZE ); } - + virtual void writeChar( char c ) { _out->write( &c, osgDB::CHAR_SIZE ); } - + virtual void writeUChar( unsigned char c ) { _out->write( (char*)&c, osgDB::CHAR_SIZE ); } - + virtual void writeShort( short s ) { _out->write( (char*)&s, osgDB::SHORT_SIZE ); } - + virtual void writeUShort( unsigned short s ) { _out->write( (char*)&s, osgDB::SHORT_SIZE ); } - + virtual void writeInt( int i ) { _out->write( (char*)&i, osgDB::INT_SIZE ); } - + virtual void writeUInt( unsigned int i ) { _out->write( (char*)&i, osgDB::INT_SIZE ); } - + virtual void writeLong( long l ) { // On 64-bit systems a long may not be the same size as the file value @@ -53,35 +53,35 @@ public: uint32_t value=(int32_t)l; _out->write( (char*)&value, osgDB::LONG_SIZE ); } - + virtual void writeFloat( float f ) { _out->write( (char*)&f, osgDB::FLOAT_SIZE ); } - + virtual void writeDouble( double d ) { _out->write((char*)&d, osgDB::DOUBLE_SIZE); } - + virtual void writeString( const std::string& s ) { int size = s.size(); _out->write( (char*)&size, osgDB::INT_SIZE ); _out->write( s.c_str(), s.size() ); } - + virtual void writeStream( std::ostream& (*fn)(std::ostream&) ) {} - + virtual void writeBase( std::ios_base& (*fn)(std::ios_base&) ) {} - + virtual void writeGLenum( const osgDB::ObjectGLenum& value ) { GLenum e = value.get(); _out->write((char*)&e, osgDB::GLENUM_SIZE); } - + virtual void writeProperty( const osgDB::ObjectProperty& prop ) { if (prop._mapProperty) _out->write((char*)&(prop._value), osgDB::INT_SIZE); } - + virtual void writeMark( const osgDB::ObjectMark& mark ) {} - + virtual void writeCharArray( const char* s, unsigned int size ) { if ( size>0 ) _out->write( s, size ); } - + virtual void writeWrappedString( const std::string& str ) { writeString( str ); } }; @@ -94,51 +94,51 @@ public: _in = istream; setByteSwap(byteSwap); } - + virtual ~BinaryInputIterator() {} virtual bool isBinary() const { return true; } - + virtual void readBool( bool& b ) { char c = 0; _in->read( &c, osgDB::CHAR_SIZE ); b = (c!=0); } - + virtual void readChar( char& c ) { _in->read( &c, osgDB::CHAR_SIZE ); } - + virtual void readSChar( signed char& c ) { _in->read( (char*)&c, osgDB::CHAR_SIZE ); } - + virtual void readUChar( unsigned char& c ) { _in->read( (char*)&c, osgDB::CHAR_SIZE ); } - + virtual void readShort( short& s ) { _in->read( (char*)&s, osgDB::SHORT_SIZE ); if ( _byteSwap ) osg::swapBytes( (char*)&s, osgDB::SHORT_SIZE ); } - + virtual void readUShort( unsigned short& s ) { _in->read( (char*)&s, osgDB::SHORT_SIZE ); if ( _byteSwap ) osg::swapBytes( (char*)&s, osgDB::SHORT_SIZE ); } - + virtual void readInt( int& i ) { _in->read( (char*)&i, osgDB::INT_SIZE ); if ( _byteSwap ) osg::swapBytes( (char*)&i, osgDB::INT_SIZE ); } - + virtual void readUInt( unsigned int& i ) { _in->read( (char*)&i, osgDB::INT_SIZE ); if ( _byteSwap ) osg::swapBytes( (char*)&i, osgDB::INT_SIZE ); } - + virtual void readLong( long& l ) { // On 64-bit systems a long may not be the same size as the file value @@ -147,7 +147,7 @@ public: if ( _byteSwap ) osg::swapBytes( (char*)&value, osgDB::LONG_SIZE ); l = (long)value; } - + virtual void readULong( unsigned long& l ) { uint32_t value; @@ -155,19 +155,19 @@ public: if ( _byteSwap ) osg::swapBytes( (char*)&value, osgDB::LONG_SIZE ); l = (unsigned long)value; } - + virtual void readFloat( float& f ) { _in->read( (char*)&f, osgDB::FLOAT_SIZE ); if ( _byteSwap ) osg::swapBytes( (char*)&f, osgDB::FLOAT_SIZE ); } - + virtual void readDouble( double& d ) { _in->read( (char*)&d, osgDB::DOUBLE_SIZE ); if ( _byteSwap ) osg::swapBytes( (char*)&d, osgDB::DOUBLE_SIZE ); } - + virtual void readString( std::string& s ) { int size = 0; @@ -177,16 +177,16 @@ public: s.resize( size ); _in->read( (char*)s.c_str(), size ); } - else if ( size<0 ) + else if ( size<0 ) { throwException( "InputStream::readString() error, negative string size read." ); } } - + virtual void readStream( std::istream& (*fn)(std::istream&) ) {} - + virtual void readBase( std::ios_base& (*fn)(std::ios_base&) ) {} - + virtual void readGLenum( osgDB::ObjectGLenum& value ) { GLenum e = 0; @@ -194,7 +194,7 @@ public: if ( _byteSwap ) osg::swapBytes( (char*)&e, osgDB::GLENUM_SIZE ); value.set( e ); } - + virtual void readProperty( osgDB::ObjectProperty& prop ) { int value = 0; @@ -205,15 +205,15 @@ public: } prop.set( value ); } - + virtual void readMark( osgDB::ObjectMark& mark ) {} - + virtual void readCharArray( char* s, unsigned int size ) - { if ( size>0 ) _in->read( s, size ); } + { if ( size>0 ) _in->read( s, size ); } virtual void readWrappedString( std::string& str ) { readString( str ); } - + protected: }; diff --git a/src/osgPlugins/osg/ReaderWriterOSG.cpp b/src/osgPlugins/osg/ReaderWriterOSG.cpp index 484ece5d3..422992726 100644 --- a/src/osgPlugins/osg/ReaderWriterOSG.cpp +++ b/src/osgPlugins/osg/ReaderWriterOSG.cpp @@ -155,20 +155,20 @@ class OSGReaderWriter : public ReaderWriter virtual ReadResult readObject(const std::string& file, const Options* opt) const { std::string ext = osgDB::getLowerCaseFileExtension(file); - + if (equalCaseInsensitive(ext,"osgs")) - { + { std::istringstream fin(osgDB::getNameLessExtension(file)); if (fin) return readNode(fin,opt); return ReadResult::ERROR_IN_READING_FILE; - } - + } + if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; std::string fileName = osgDB::findDataFile( file, opt ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = opt ? static_cast(opt->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); @@ -178,7 +178,7 @@ class OSGReaderWriter : public ReaderWriter return readObject(fin, local_opt.get()); } return 0L; - } + } virtual ReadResult readObject(std::istream& fin, const Options* options) const { @@ -189,7 +189,7 @@ class OSGReaderWriter : public ReaderWriter Input fr; fr.attach(&fin); fr.setOptions(options); - + typedef std::vector ObjectList; ObjectList objectList; @@ -220,18 +220,18 @@ class OSGReaderWriter : public ReaderWriter std::string ext = osgDB::getLowerCaseFileExtension(file); if (equalCaseInsensitive(ext,"osgs")) - { + { std::istringstream fin(osgDB::getNameLessExtension(file)); if (fin) return readNode(fin,opt); return ReadResult::ERROR_IN_READING_FILE; - } - + } + if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; std::string fileName = osgDB::findDataFile( file, opt ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = opt ? static_cast(opt->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); @@ -241,9 +241,9 @@ class OSGReaderWriter : public ReaderWriter return readNode(fin, local_opt.get()); } return 0L; - + } - + virtual ReadResult readNode(std::istream& fin, const Options* options) const { loadWrappers(); @@ -253,7 +253,7 @@ class OSGReaderWriter : public ReaderWriter Input fr; fr.attach(&fin); fr.setOptions(options); - + typedef std::vector NodeList; NodeList nodeList; @@ -296,7 +296,7 @@ class OSGReaderWriter : public ReaderWriter std::string opt; while (iss >> opt) { - if(opt=="PRECISION" || opt=="precision") + if(opt=="PRECISION" || opt=="precision") { int prec; iss >> prec; @@ -312,7 +312,7 @@ class OSGReaderWriter : public ReaderWriter } } } - } + } virtual WriteResult writeObject(const Object& obj, const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { diff --git a/src/osgPlugins/osg/ReaderWriterOSG2.cpp b/src/osgPlugins/osg/ReaderWriterOSG2.cpp index d4865cedf..da15ce459 100644 --- a/src/osgPlugins/osg/ReaderWriterOSG2.cpp +++ b/src/osgPlugins/osg/ReaderWriterOSG2.cpp @@ -37,7 +37,7 @@ InputIterator* readInputIterator( std::istream& fin, const Options* options ) if ( optionString.find("Ascii")!=std::string::npos ) extensionIsAscii = true; else if ( optionString.find("XML")!=std::string::npos ) extensionIsXML = true; } - + if ( !extensionIsAscii && !extensionIsXML ) { unsigned int headerLow = 0, headerHigh = 0; @@ -53,10 +53,10 @@ InputIterator* readInputIterator( std::istream& fin, const Options* options ) OSG_INFO<<"Reading OpenSceneGraph binary file with the different endian to this computer, doing byte swap."<> header; @@ -66,7 +66,7 @@ InputIterator* readInputIterator( std::istream& fin, const Options* options ) } fin.seekg( 0, std::ios::beg ); } - + if ( 1 ) { std::string header; std::getline( fin, header ); @@ -88,7 +88,7 @@ OutputIterator* writeOutputIterator( std::ostream& fout, const Options* options std::string opt; while (iss >> opt) { - if(opt=="PRECISION" || opt=="precision") + if(opt=="PRECISION" || opt=="precision") { iss >> precision; } @@ -123,7 +123,7 @@ public: supportsExtension( "osgt", "OpenSceneGraph extendable ascii format" ); supportsExtension( "osgb", "OpenSceneGraph extendable binary format" ); supportsExtension( "osgx", "OpenSceneGraph extendable XML format" ); - + supportsOption( "Ascii", "Import/Export option: Force reading/writing ascii file" ); supportsOption( "XML", "Import/Export option: Force reading/writing XML file" ); supportsOption( "ForceReadingImage", "Import option: Load an empty image instead if required file missed" ); @@ -161,10 +161,10 @@ public: if ( ext=="osgt" ) local_opt->setOptionString( local_opt->getOptionString() + " Ascii" ); else if ( ext=="osgx" ) local_opt->setOptionString( local_opt->getOptionString() + " XML" ); else mode |= std::ios::binary; - + return local_opt.release(); } - + virtual ReadResult readObject( const std::string& file, const Options* options ) const { ReadResult result = ReadResult::FILE_LOADED; @@ -176,7 +176,7 @@ public: osgDB::ifstream istream( fileName.c_str(), mode ); return readObject( istream, local_opt ); } - + virtual ReadResult readObject( std::istream& fin, const Options* options ) const { osg::ref_ptr ii = readInputIterator(fin, options); @@ -195,7 +195,7 @@ public: osg::Object* obj = is.readObject(); CATCH_EXCEPTION(is); return obj; } - + virtual ReadResult readImage( const std::string& file, const Options* options ) const { ReadResult result = ReadResult::FILE_LOADED; @@ -203,16 +203,16 @@ public: std::ios::openmode mode = std::ios::in; Options* local_opt = prepareReading( result, fileName, mode, options ); if ( !result.success() ) return result; - + osgDB::ifstream istream( fileName.c_str(), mode ); return readImage( istream, local_opt ); } - + virtual ReadResult readImage( std::istream& fin, const Options* options ) const { osg::ref_ptr ii = readInputIterator(fin, options); if ( !ii ) return ReadResult::FILE_NOT_HANDLED; - + InputStream is( options ); if ( is.start(ii.get())!=InputStream::READ_IMAGE ) { @@ -223,7 +223,7 @@ public: osg::Image* image = is.readImage(); CATCH_EXCEPTION(is); return image; } - + virtual ReadResult readNode( const std::string& file, const Options* options ) const { ReadResult result = ReadResult::FILE_LOADED; @@ -231,67 +231,67 @@ public: std::ios::openmode mode = std::ios::in; Options* local_opt = prepareReading( result, fileName, mode, options ); if ( !result.success() ) return result; - + osgDB::ifstream istream( fileName.c_str(), mode ); return readNode( istream, local_opt ); } - + virtual ReadResult readNode( std::istream& fin, const Options* options ) const { osg::ref_ptr ii = readInputIterator(fin, options); if ( !ii ) return ReadResult::FILE_NOT_HANDLED; - + InputStream is( options ); if ( is.start(ii.get())!=InputStream::READ_SCENE ) { CATCH_EXCEPTION(is); return ReadResult::FILE_NOT_HANDLED; } - + is.decompress(); CATCH_EXCEPTION(is); osg::Node* node = dynamic_cast(is.readObject()); CATCH_EXCEPTION(is); return node; } - + Options* prepareWriting( WriteResult& result, const std::string& fileName, std::ios::openmode& mode, const Options* options ) const { std::string ext = osgDB::getFileExtension( fileName ); if ( !acceptsExtension(ext) ) result = WriteResult::FILE_NOT_HANDLED; - + osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); if ( ext=="osgt" ) local_opt->setOptionString( local_opt->getOptionString() + " Ascii" ); else if ( ext=="osgx" ) local_opt->setOptionString( local_opt->getOptionString() + " XML" ); else mode |= std::ios::binary; - + return local_opt.release(); } - + virtual WriteResult writeObject( const osg::Object& object, const std::string& fileName, const Options* options ) const { WriteResult result = WriteResult::FILE_SAVED; std::ios::openmode mode = std::ios::out; osg::ref_ptr local_opt = prepareWriting( result, fileName, mode, options ); if ( !result.success() ) return result; - + osgDB::ofstream fout( fileName.c_str(), mode ); if ( !fout ) return WriteResult::ERROR_IN_WRITING_FILE; - + result = writeObject( object, fout, local_opt.get() ); fout.close(); return result; } - + virtual WriteResult writeObject( const osg::Object& object, std::ostream& fout, const Options* options ) const { osg::ref_ptr oi = writeOutputIterator(fout, options); - + OutputStream os( options ); os.start( oi.get(), OutputStream::WRITE_OBJECT ); CATCH_EXCEPTION(os); os.writeObject( &object ); CATCH_EXCEPTION(os); os.compress( &fout ); CATCH_EXCEPTION(os); - + oi->flush(); if ( !os.getSchemaName().empty() ) { @@ -299,35 +299,35 @@ public: if ( !schemaStream.fail() ) os.writeSchema( schemaStream ); schemaStream.close(); } - + if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE; return WriteResult::FILE_SAVED; } - + virtual WriteResult writeImage( const osg::Image& image, const std::string& fileName, const Options* options ) const { WriteResult result = WriteResult::FILE_SAVED; std::ios::openmode mode = std::ios::out; osg::ref_ptr local_opt = prepareWriting( result, fileName, mode, options ); if ( !result.success() ) return result; - + osgDB::ofstream fout( fileName.c_str(), mode ); if ( !fout ) return WriteResult::ERROR_IN_WRITING_FILE; - + result = writeImage( image, fout, local_opt.get() ); fout.close(); return result; } - + virtual WriteResult writeImage( const osg::Image& image, std::ostream& fout, const Options* options ) const { osg::ref_ptr oi = writeOutputIterator(fout, options); - + OutputStream os( options ); os.start( oi.get(), OutputStream::WRITE_IMAGE ); CATCH_EXCEPTION(os); os.writeImage( &image ); CATCH_EXCEPTION(os); os.compress( &fout ); CATCH_EXCEPTION(os); - + oi->flush(); if ( !os.getSchemaName().empty() ) { @@ -335,35 +335,35 @@ public: if ( !schemaStream.fail() ) os.writeSchema( schemaStream ); schemaStream.close(); } - + if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE; return WriteResult::FILE_SAVED; } - + virtual WriteResult writeNode( const osg::Node& node, const std::string& fileName, const Options* options ) const { WriteResult result = WriteResult::FILE_SAVED; std::ios::openmode mode = std::ios::out; osg::ref_ptr local_opt = prepareWriting( result, fileName, mode, options ); if ( !result.success() ) return result; - + osgDB::ofstream fout( fileName.c_str(), mode ); if ( !fout ) return WriteResult::ERROR_IN_WRITING_FILE; - + result = writeNode( node, fout, local_opt.get() ); fout.close(); return result; } - + virtual WriteResult writeNode( const osg::Node& node, std::ostream& fout, const Options* options ) const { osg::ref_ptr oi = writeOutputIterator(fout, options); - + OutputStream os( options ); os.start( oi.get(), OutputStream::WRITE_SCENE ); CATCH_EXCEPTION(os); os.writeObject( &node ); CATCH_EXCEPTION(os); os.compress( &fout ); CATCH_EXCEPTION(os); - + oi->flush(); if ( !os.getSchemaName().empty() ) { @@ -371,7 +371,7 @@ public: if ( !schemaStream.fail() ) os.writeSchema( schemaStream ); schemaStream.close(); } - + if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE; return WriteResult::FILE_SAVED; } diff --git a/src/osgPlugins/osg/XmlStreamOperator.h b/src/osgPlugins/osg/XmlStreamOperator.h index 16fc4fe41..097c37d34 100644 --- a/src/osgPlugins/osg/XmlStreamOperator.h +++ b/src/osgPlugins/osg/XmlStreamOperator.h @@ -18,7 +18,7 @@ public: END_BRACKET_LINE, // A line starting with a '}' TEXT_LINE // A text line, e.g. recording array elements }; - + XmlOutputIterator( std::ostream* ostream, int precision ) : _readLineType(FIRST_LINE), _prevReadLineType(FIRST_LINE), _hasSubProperty(false) { @@ -27,44 +27,44 @@ public: _root = new osgDB::XmlNode; _root->type = osgDB::XmlNode::GROUP; } - + virtual ~XmlOutputIterator() {} - + virtual bool isBinary() const { return false; } - + virtual void writeBool( bool b ) { addToCurrentNode( b ? std::string("TRUE") : std::string("FALSE") ); } - + virtual void writeChar( char c ) { _sstream << (short)c; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeUChar( unsigned char c ) { _sstream << (unsigned short)c; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeShort( short s ) { _sstream << s; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeUShort( unsigned short s ) { _sstream << s; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeInt( int i ) { _sstream << i; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeUInt( unsigned int i ) { _sstream << i; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeLong( long l ) { _sstream << l; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeULong( unsigned long l ) { _sstream << l; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeFloat( float f ) { _sstream << f; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeDouble( double d ) { _sstream << d; addToCurrentNode( _sstream.str() ); _sstream.str(""); } - + virtual void writeString( const std::string& s ) { addToCurrentNode( s, true ); } @@ -89,25 +89,25 @@ public: } else if ( _readLineType==TEXT_LINE ) addToCurrentNode( fn ); - + setLineType( NEW_LINE ); } else addToCurrentNode( fn ); } - + virtual void writeBase( std::ios_base& (*fn)(std::ios_base&) ) { _sstream << fn; } - + virtual void writeGLenum( const osgDB::ObjectGLenum& value ) { - GLenum e = value.get(); + GLenum e = value.get(); const std::string& enumString = osgDB::Registry::instance()->getObjectWrapperManager()->getString("GL", e); addToCurrentNode( enumString, true ); } - + virtual void writeProperty( const osgDB::ObjectProperty& prop ) { std::string enumString = prop._name; @@ -136,7 +136,7 @@ public: } } } - + virtual void writeMark( const osgDB::ObjectMark& mark ) { int delta = mark._indentDelta; @@ -149,9 +149,9 @@ public: setLineType( END_BRACKET_LINE ); } } - + virtual void writeCharArray( const char* s, unsigned int size ) {} - + virtual void writeWrappedString( const std::string& str ) { std::string realStr; @@ -166,7 +166,7 @@ public: realStr += '\"'; addToCurrentNode( realStr ); } - + virtual void flush() { osg::ref_ptr xmlRoot = new osgDB::XmlNode; @@ -174,7 +174,7 @@ public: xmlRoot->children.push_back( _root.get() ); xmlRoot->write( *_out ); } - + protected: void addToCurrentNode( const std::string& str, bool isString=false ) { @@ -183,7 +183,7 @@ protected: _root->name = str; return; } - + if ( _readLineType==NEW_LINE ) { if ( isString ) @@ -195,7 +195,7 @@ protected: else setLineType( TEXT_LINE ); } - + if ( _readLineType==TEXT_LINE ) { std::string& text = _nodePath.back()->properties["text"]; @@ -213,7 +213,7 @@ protected: setLineType( PROP_LINE ); } } - + void addToCurrentNode( std::ostream& (*fn)(std::ostream&) ) { if ( _nodePath.size()>0 ) @@ -225,12 +225,12 @@ protected: _sstream.str(""); } } - + osgDB::XmlNode* pushNode( const std::string& name ) { osg::ref_ptr node = new osgDB::XmlNode; node->type = osgDB::XmlNode::ATOM; - + // Set element name without '#' and '::' characters std::string realName; if ( name.length()>0 && name[0]=='#' ) @@ -238,13 +238,13 @@ protected: else { realName = name; - + std::string::size_type pos = realName.find("::"); if ( pos!=std::string::npos ) realName.replace( pos, 2, "--" ); } node->name = realName; - + if ( _nodePath.size()>0 ) { _nodePath.back()->type = osgDB::XmlNode::GROUP; @@ -252,11 +252,11 @@ protected: } else _root->children.push_back(node); - + _nodePath.push_back( node.get() ); return node.get(); } - + osgDB::XmlNode* popNode() { osgDB::XmlNode* node = NULL; @@ -269,12 +269,12 @@ protected: } return node; } - + void trimEndMarkers( osgDB::XmlNode* node, const std::string& name ) { osgDB::XmlNode::Properties::iterator itr = node->properties.find(name); if ( itr==node->properties.end() ) return; - + std::string& str = itr->second; if ( !str.empty() ) { @@ -282,23 +282,23 @@ protected: if ( end==std::string::npos ) return; str.erase( end+1 ); } - + if ( str.empty() ) node->properties.erase(itr); } - + void setLineType( ReadLineType type ) { _prevReadLineType = _readLineType; _readLineType = type; } - + typedef std::vector XmlNodePath; XmlNodePath _nodePath; - + osg::ref_ptr _root; std::stringstream _sstream; - + ReadLineType _readLineType; ReadLineType _prevReadLineType; bool _hasSubProperty; @@ -311,15 +311,15 @@ public: { _in = istream; _root = osgDB::readXmlStream( *istream ); - + if ( _root.valid() && _root->children.size()>0 ) _nodePath.push_back( _root->children[0] ); } - + virtual ~XmlInputIterator() {} - + virtual bool isBinary() const { return false; } - + virtual void readBool( bool& b ) { std::string boolString; @@ -327,68 +327,68 @@ public: if ( boolString=="TRUE" ) b = true; else b = false; } - + virtual void readChar( char& c ) { short s = 0; if ( prepareStream() ) _sstream >> s; c = (char)s; } - + virtual void readSChar( signed char& c ) { short s = 0; if ( prepareStream() ) _sstream >> s; c = (signed char)s; } - + virtual void readUChar( unsigned char& c ) { unsigned short s = 0; if ( prepareStream() ) _sstream >> s; c = (unsigned char)s; } - + virtual void readShort( short& s ) { std::string str; if (prepareStream()) _sstream >> str; s = static_cast(strtol(str.c_str(), NULL, 0)); } - + virtual void readUShort( unsigned short& s ) { std::string str; if (prepareStream()) _sstream >> str; s = static_cast(strtoul(str.c_str(), NULL, 0)); } - + virtual void readInt( int& i ) { std::string str; if (prepareStream()) _sstream >> str; i = static_cast(strtol(str.c_str(), NULL, 0)); } - + virtual void readUInt( unsigned int& i ) { std::string str; if (prepareStream()) _sstream >> str; i = static_cast(strtoul(str.c_str(), NULL, 0)); } - + virtual void readLong( long& l ) { std::string str; if (prepareStream()) _sstream >> str; l = strtol(str.c_str(), NULL, 0); } - + virtual void readULong( unsigned long& l ) { std::string str; if (prepareStream()) _sstream >> str; l = strtoul(str.c_str(), NULL, 0); } - + virtual void readFloat( float& f ) { std::string str; if (prepareStream()) _sstream >> str; f = osg::asciiToFloat(str.c_str()); } - + virtual void readDouble( double& d ) { std::string str; if (prepareStream()) _sstream >> str; d = osg::asciiToDouble(str.c_str()); } - + virtual void readString( std::string& s ) { if ( prepareStream() ) _sstream >> s; - + // Replace '--' to '::' to get correct wrapper class std::string::size_type pos = s.find("--"); if ( pos!=std::string::npos ) s.replace( pos, 2, "::" ); } - + virtual void readStream( std::istream& (*fn)(std::istream&) ) { if ( prepareStream() ) _sstream >> fn; } - + virtual void readBase( std::ios_base& (*fn)(std::ios_base&) ) { _sstream >> fn; } - + virtual void readGLenum( osgDB::ObjectGLenum& value ) { GLenum e = 0; @@ -397,7 +397,7 @@ public: e = osgDB::Registry::instance()->getObjectWrapperManager()->getValue("GL", enumString); value.set( e ); } - + virtual void readProperty( osgDB::ObjectProperty& prop ) { int value = 0; @@ -413,7 +413,7 @@ public: std::string::size_type pos = enumString.find("--"); if ( pos!=std::string::npos ) enumString.replace( pos, 2, "::" ); - + if ( prop._name!=enumString ) { if ( prop._name[0]=='#' ) @@ -428,20 +428,20 @@ public: } prop.set( value ); } - + virtual void readMark( osgDB::ObjectMark& mark ) {} - + virtual void readCharArray( char* s, unsigned int size ) {} - + virtual void readWrappedString( std::string& str ) { if ( !prepareStream() ) return; - + // Read available string in the stream buffer unsigned int availSize = _sstream.rdbuf()->in_avail(); std::string realStr = _sstream.str(); _sstream.str(""); - + // Find the first quot or valid character bool hasQuot = false; std::string::iterator itr = realStr.begin() + (realStr.size() - availSize); @@ -479,7 +479,7 @@ public: _sstream << std::string(itr, realStr.end()); } } - + virtual bool matchString( const std::string& str ) { prepareStream(); @@ -491,18 +491,18 @@ public: } return false; } - + virtual void advanceToCurrentEndBracket() {} - + protected: bool isReadable() const { return _sstream.rdbuf()->in_avail()>0; } - + bool prepareStream() { if ( !_nodePath.size() ) return false; if ( isReadable() ) return true; _sstream.clear(); - + osgDB::XmlNode* current = _nodePath.back().get(); if ( current->type!=osgDB::XmlNode::COMMENT ) { @@ -512,13 +512,13 @@ protected: current->name.clear(); return true; } - + if ( current->properties.size()>0 ) { if ( applyPropertyToStream(current, "attribute") ) return true; else if ( applyPropertyToStream(current, "text") ) return true; } - + if ( current->children.size()>0 ) { _nodePath.push_back( current->children.front() ); @@ -529,7 +529,7 @@ protected: _nodePath.pop_back(); return prepareStream(); } - + bool applyPropertyToStream( osgDB::XmlNode* node, const std::string& name ) { osgDB::XmlNode::Properties::iterator itr = node->properties.find(name); @@ -541,10 +541,10 @@ protected: } return false; } - + typedef std::vector< osg::ref_ptr > XmlNodePath; XmlNodePath _nodePath; - + osg::ref_ptr _root; std::stringstream _sstream; }; diff --git a/src/osgPlugins/osga/OSGA_Archive.cpp b/src/osgPlugins/osga/OSGA_Archive.cpp index 3ed7d42a7..09b384ad6 100644 --- a/src/osgPlugins/osga/OSGA_Archive.cpp +++ b/src/osgPlugins/osga/OSGA_Archive.cpp @@ -10,9 +10,9 @@ using namespace osgDB; /* Functions to convert between - std::streampos ( typedef'ed as iostream::pos_type + std::streampos ( typedef'ed as iostream::pos_type used as seekp,seekg argument and tellp,tellg return value ) -and +and OSGA_Archive::pos_type (64 bit file position index) Purpose: @@ -21,40 +21,40 @@ Purpose: std::streampos is used as argument to iostreams seekp and seekg methods and is returned as result from iostream tellp and tellg methods. - std::streampos can be implicitly cast from/to std::streamoff as + std::streampos can be implicitly cast from/to std::streamoff as std::streampos class defines appropriate constructor and cast operator. - Since std::streamoff is usually defined as simple int, + Since std::streamoff is usually defined as simple int, it is possible to call seekp( ), seekg( ) with int argument and assign tellp(), tellg() result to int type. - But this implicit methods fail when std::streamoff is 32 bit and + But this implicit methods fail when std::streamoff is 32 bit and std::streampos actually points past 32 bit addressable range (2 GiB). Even if std::streamoff is 32 bit and incapable of representing 64 bit file positions, original std::streampos may be prefectly able to handle them. - - But, when such situation occurs more elaborate conversion methods from/to - std::streampos are needed. Functions below employ such methods. - - I made this fix for use with 32 bit Windows OSG. Acutally this - solution is not dependent on OS but standard C++ library. - Microsoft SDKs always use some version of Dinkumware libs. - Practically this tweak is made for Dinkumware C++ libs. I hope it can + But, when such situation occurs more elaborate conversion methods from/to + std::streampos are needed. Functions below employ such methods. + + I made this fix for use with 32 bit Windows OSG. Acutally this + solution is not dependent on OS but standard C++ library. + Microsoft SDKs always use some version of Dinkumware libs. + + Practically this tweak is made for Dinkumware C++ libs. I hope it can be easily extended to other 32bit systems supporting 64bit files, provided their std::streampos implementations are similar. I based my solution on a small portion of boost iostreams code. - For additional reference look at: + For additional reference look at: http://boost.org/boost/iostreams/positioning.hpp */ -/* - Recognize Dinkumware std C++ lib implementation. Its used by Microsoft, +/* + Recognize Dinkumware std C++ lib implementation. Its used by Microsoft, but method is more generic - should work in all Dinkumware environments. - Complex condition below was taken from + Complex condition below was taken from http://boost.org/boost/iostreams/positioning.hpp Great thanks to J.Tukanis and G. Sylvester-Bradley for figuring it out. @@ -64,12 +64,12 @@ Purpose: && !defined(__QNX__) inline std::streampos STREAM_POS( const OSGA_Archive::pos_type pos ) -{ +{ return std::streampos( std::mbstate_t(), pos ); } inline OSGA_Archive::pos_type ARCHIVE_POS( const std::streampos & pos ) -{ +{ #if defined(_CPPLIB_VER)//newer Dinkumware(eg: one included with VC++ 2003,2005) fpos_t position = pos.seekpos(); #else // older Dinkumware (eg: one included in Win Server 2003 Platform SDK ) @@ -79,18 +79,18 @@ inline OSGA_Archive::pos_type ARCHIVE_POS( const std::streampos & pos ) return OSGA_Archive::pos_type( position + offset ); } -#else // non Dinkumware std C++ lib implementations +#else // non Dinkumware std C++ lib implementations // do the old school streampos <-> streamoff casts inline std::streampos STREAM_POS( const OSGA_Archive::pos_type pos ) -{ +{ return std::streampos( pos ); } inline OSGA_Archive::pos_type ARCHIVE_POS( const std::streampos & pos ) -{ +{ return OSGA_Archive::pos_type( pos ); } -#endif // Dinkumware std C++ lib +#endif // Dinkumware std C++ lib //////////////////////////////////////////////////////////////////////////////// float OSGA_Archive::s_currentSupportedVersion = 0.0; const unsigned int ENDIAN_TEST_NUMBER = 0x00000001; @@ -117,7 +117,7 @@ void OSGA_Archive::IndexBlock::allocateData(unsigned int blockSize) if (_data) { _blockSize = blockSize; - + // initialize the array char* end = _data + _blockSize; for(char* ptr=_data; ptr < end; ++ptr) *ptr = 0; @@ -137,7 +137,7 @@ OSGA_Archive::IndexBlock* OSGA_Archive::IndexBlock::read(std::istream& in, bool in.read(reinterpret_cast(&indexBlock->_blockSize), sizeof(indexBlock->_blockSize)); in.read(reinterpret_cast(&indexBlock->_filePositionNextIndexBlock), sizeof(indexBlock->_filePositionNextIndexBlock)); in.read(reinterpret_cast(&indexBlock->_offsetOfNextAvailableSpace), sizeof(indexBlock-> _offsetOfNextAvailableSpace)); - + if (doEndianSwap) { osg::swapBytes(reinterpret_cast(&indexBlock->_blockSize), sizeof(indexBlock->_blockSize)); @@ -160,13 +160,13 @@ OSGA_Archive::IndexBlock* OSGA_Archive::IndexBlock::read(std::istream& in, bool char* end_ptr = indexBlock->_data + indexBlock->_offsetOfNextAvailableSpace; while (ptr(ptr)); _read(ptr, filename_size); ptr += sizeof(unsigned int); @@ -184,9 +184,9 @@ OSGA_Archive::IndexBlock* OSGA_Archive::IndexBlock::read(std::istream& in, bool } OSG_INFO<<"Read index block"<(ptr)); + pos_type position; // = *(reinterpret_cast(ptr)); _read(ptr, position); ptr += sizeof(pos_type); - - size_type size; // = *(reinterpret_cast(ptr)); + + size_type size; // = *(reinterpret_cast(ptr)); _read(ptr, size); ptr += sizeof(size_type); unsigned int filename_size; // = *(reinterpret_cast(ptr)); _read(ptr, filename_size); ptr += sizeof(unsigned int); - + std::string filename(ptr, ptr+filename_size); - - // record this entry into the FileNamePositionMap. + + // record this entry into the FileNamePositionMap. // Requests for files will be in unix style even on Win32 so need unix style keys in map. indexMap[osgDB::convertFileNameToUnixStyle(filename)] = PositionSizePair(position,size); - + ptr += filename_size; - + valuesAdded = true; } return valuesAdded; @@ -266,9 +266,9 @@ void OSGA_Archive::IndexBlock::write(std::ostream& out) out.write(reinterpret_cast(_data),_blockSize); - if( _filePosition < currentPos ) // move file ptr to the end of file + if( _filePosition < currentPos ) // move file ptr to the end of file out.seekp( STREAM_POS( currentPos ) ); - + OSG_INFO<<"OSGA_Archive::IndexBlock::write() end"<(ptr)) = position; + + //*(reinterpret_cast(ptr)) = position; _write(ptr, position); ptr += sizeof(pos_type); - - //*(reinterpret_cast(ptr)) = size; + + //*(reinterpret_cast(ptr)) = size; _write(ptr, size); ptr += sizeof(size_type); - + //*(reinterpret_cast(ptr)) = filename.size(); _write(ptr, static_cast(filename.size())); ptr += sizeof(unsigned int); - + for(unsigned int i=0;i 4 GiB - size_t BlockHeaderSize = - sizeof( unsigned int /*_blockSize*/ ) + + size_t BlockHeaderSize = + sizeof( unsigned int /*_blockSize*/ ) + sizeof( pos_type /*_filePositionNextIndexBlock*/ ) + sizeof( unsigned int /*_offsetOfNextAvailableSpace*/ ); - + for(IndexBlockList::iterator itr=_indexBlockList.begin(); itr!=_indexBlockList.end(); ++itr) @@ -377,7 +377,7 @@ bool OSGA_Archive::open(const std::string& filename, ArchiveStatus status, unsig OSG_INFO<<"File position after open = "<setPositionNextIndexBlock( ARCHIVE_POS( _output.tellp() ) ); - + indexBlock = new IndexBlock(blockSize); indexBlock->write(_output); _indexBlockList.push_back(indexBlock.get()); } - + if (indexBlock.valid()) { return indexBlock->addFileReference(position, size, fileName); @@ -604,13 +604,13 @@ bool OSGA_Archive::addFileReference(pos_type position, size_type size, const std class proxy_streambuf : public std::streambuf { public: - + proxy_streambuf(std::streambuf* streambuf, unsigned int numChars): _streambuf(streambuf), _numChars(numChars) { setg(&oneChar, (&oneChar)+1, (&oneChar)+1); } - + /// Destructor deallocates no buffer space. virtual ~proxy_streambuf() {} @@ -618,24 +618,24 @@ class proxy_streambuf : public std::streambuf protected: - unsigned int _numChars; + unsigned int _numChars; char_type oneChar; - + virtual int_type underflow() { if ( gptr() == &oneChar ) return traits_type::to_int_type(oneChar); - - if ( _numChars==0 ) return traits_type::eof(); + + if ( _numChars==0 ) return traits_type::eof(); --_numChars; int_type next_value = _streambuf->sbumpc(); - + if ( !traits_type::eq_int_type(next_value,traits_type::eof()) ) { setg(&oneChar, &oneChar, (&oneChar)+1); oneChar = traits_type::to_char_type(next_value); } - + return next_value; } }; @@ -643,19 +643,19 @@ class proxy_streambuf : public std::streambuf struct OSGA_Archive::ReadObjectFunctor : public OSGA_Archive::ReadFunctor { ReadObjectFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {} - virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw, std::istream& input) const { return rw.readObject(input, _options); } + virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw, std::istream& input) const { return rw.readObject(input, _options); } }; struct OSGA_Archive::ReadImageFunctor : public OSGA_Archive::ReadFunctor { ReadImageFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {} - virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw, std::istream& input)const { return rw.readImage(input, _options); } + virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw, std::istream& input)const { return rw.readImage(input, _options); } }; struct OSGA_Archive::ReadHeightFieldFunctor : public OSGA_Archive::ReadFunctor { ReadHeightFieldFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {} - virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw, std::istream& input) const { return rw.readHeightField(input, _options); } + virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw, std::istream& input) const { return rw.readHeightField(input, _options); } }; struct OSGA_Archive::ReadNodeFunctor : public OSGA_Archive::ReadFunctor @@ -674,28 +674,28 @@ ReaderWriter::ReadResult OSGA_Archive::read(const ReadFunctor& readFunctor) { SERIALIZER(); - if (_status!=READ) + if (_status!=READ) { OSG_INFO<<"OSGA_Archive::readObject(obj, "<getReaderWriterForExtension(getLowerCaseFileExtension(readFunctor._filename)); if (!rw) { OSG_INFO<<"OSGA_Archive::readObject(obj, "<second.first ) ); // set up proxy stream buffer to provide the faked ending. @@ -706,7 +706,7 @@ ReaderWriter::ReadResult OSGA_Archive::read(const ReadFunctor& readFunctor) ReaderWriter::ReadResult result = readFunctor.doRead(*rw, _input); ins.rdbuf(mystreambuf._streambuf); - + return result; } @@ -742,8 +742,8 @@ struct OSGA_Archive::WriteObjectFunctor : public OSGA_Archive::WriteFunctor WriteFunctor(filename,options), _object(object) {} const osg::Object& _object; - - virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { return rw.writeObject(_object, output, _options); } + + virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { return rw.writeObject(_object, output, _options); } }; struct OSGA_Archive::WriteImageFunctor : public OSGA_Archive::WriteFunctor @@ -753,7 +753,7 @@ struct OSGA_Archive::WriteImageFunctor : public OSGA_Archive::WriteFunctor _object(object) {} const osg::Image& _object; - virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { return rw.writeImage(_object, output, _options); } + virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { return rw.writeImage(_object, output, _options); } }; struct OSGA_Archive::WriteHeightFieldFunctor : public OSGA_Archive::WriteFunctor @@ -763,7 +763,7 @@ struct OSGA_Archive::WriteHeightFieldFunctor : public OSGA_Archive::WriteFunctor _object(object) {} const osg::HeightField& _object; - virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { return rw.writeHeightField(_object, output, _options); } + virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { return rw.writeHeightField(_object, output, _options); } }; struct OSGA_Archive::WriteNodeFunctor : public OSGA_Archive::WriteFunctor @@ -790,7 +790,7 @@ ReaderWriter::WriteResult OSGA_Archive::write(const WriteFunctor& writeFunctor) { SERIALIZER(); - if (_status!=WRITE) + if (_status!=WRITE) { OSG_INFO<<"OSGA_Archive::write(obj, "< #include -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) class OSGA_Archive : public osgDB::Archive { public: OSGA_Archive(); - virtual ~OSGA_Archive(); + virtual ~OSGA_Archive(); virtual const char* libraryName() const { return "osga"; } @@ -34,7 +34,7 @@ class OSGA_Archive : public osgDB::Archive { return osgDB::equalCaseInsensitive(extension,"osga"); } - + /** open the archive.*/ virtual bool open(const std::string& filename, ArchiveStatus status, unsigned int indexBlockSizeHint=4096); @@ -46,10 +46,10 @@ class OSGA_Archive : public osgDB::Archive /** Get the file name which represents the archived file.*/ virtual std::string getArchiveFileName() const { return _archiveFileName; } - + /** Get the file name which represents the master file recorded in the Archive.*/ virtual std::string getMasterFileName() const; - + /** return true if file exists in archive.*/ virtual bool fileExists(const std::string& filename) const; @@ -89,7 +89,7 @@ class OSGA_Archive : public osgDB::Archive /** Write an osg::Shader with specified file name to the Archive.*/ virtual WriteResult writeShader(const osg::Shader& shader,const std::string& fileName,const Options* options=NULL) const; - + #if defined(_MSC_VER) typedef __int64 pos_type; typedef __int64 size_type; @@ -97,12 +97,12 @@ class OSGA_Archive : public osgDB::Archive typedef unsigned long long pos_type; typedef unsigned long long size_type; #endif - + typedef std::pair PositionSizePair; typedef std::map FileNamePositionMap; - + protected: - + mutable OpenThreads::ReentrantMutex _serializerMutex; class IndexBlock; @@ -112,42 +112,42 @@ class OSGA_Archive : public osgDB::Archive { public: IndexBlock(unsigned int blockSize=0); - + inline pos_type getPosition() const { return _filePosition; } inline unsigned int getBlockSize() const { return _blockSize; } void setPositionNextIndexBlock(pos_type position); - + inline pos_type getPositionNextIndexBlock() const { return _filePositionNextIndexBlock; } static IndexBlock* read(std::istream& in, bool doEndianSwap); - + std::string getFirstFileName() const; bool getFileReferences(FileNamePositionMap& indexMap) const; - + inline bool requiresWrite() const { return _requiresWrite; } - + void write(std::ostream& out); - + inline bool spaceAvailable(pos_type, size_type, const std::string& filename) const { unsigned requiredSize = sizeof(pos_type)+sizeof(size_type)+sizeof(unsigned int)+filename.size(); return (_offsetOfNextAvailableSpace + requiredSize)<_blockSize; } - + bool addFileReference(pos_type position, size_type size, const std::string& filename); - + protected: - + void allocateData(unsigned int blockSize); - + virtual ~IndexBlock(); bool _requiresWrite; pos_type _filePosition; @@ -157,8 +157,8 @@ class OSGA_Archive : public osgDB::Archive unsigned int _offsetOfNextAvailableSpace; char* _data; }; - - public: + + public: /** Functor used in internal implementations.*/ struct ReadFunctor { @@ -186,7 +186,7 @@ class OSGA_Archive : public osgDB::Archive std::string _filename; const osgDB::ReaderWriter::Options* _options; }; - + protected: struct ReadObjectFunctor; struct ReadImageFunctor; @@ -204,15 +204,15 @@ class OSGA_Archive : public osgDB::Archive osgDB::ReaderWriter::ReadResult read(const ReadFunctor& readFunctor); osgDB::ReaderWriter::WriteResult write(const WriteFunctor& writeFunctor); - + typedef std::list< osg::ref_ptr > IndexBlockList; - + bool _open(std::istream& fin); void writeIndexBlocks(); - + bool addFileReference(pos_type position, size_type size, const std::string& fileName); - + static float s_currentSupportedVersion; float _version; ArchiveStatus _status; @@ -223,14 +223,14 @@ class OSGA_Archive : public osgDB::Archive std::string _masterFileName; IndexBlockList _indexBlockList; FileNamePositionMap _indexMap; - + template static inline void _write(char* ptr, const T& value) { std::copy(reinterpret_cast(&value),reinterpret_cast(&value)+sizeof(value),ptr); } - + template static inline void _read(char* ptr, T& value) { diff --git a/src/osgPlugins/osga/ReaderWriterOSGA.cpp b/src/osgPlugins/osga/ReaderWriterOSGA.cpp index bcb2e3dc4..a5a705bd5 100644 --- a/src/osgPlugins/osga/ReaderWriterOSGA.cpp +++ b/src/osgPlugins/osga/ReaderWriterOSGA.cpp @@ -18,17 +18,17 @@ public: virtual ReadResult openArchive(const std::string& file,ArchiveStatus status, unsigned int indexBlockSize = 4096, const Options* options=NULL) const { - + std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; std::string fileName = osgDB::findDataFile( file, options ); - if (fileName.empty()) + if (fileName.empty()) { if (status==READ) return ReadResult::FILE_NOT_FOUND; fileName = file; } - + osg::ref_ptr archive = new OSGA_Archive; if (!archive->open(fileName, status, indexBlockSize)) { @@ -38,7 +38,7 @@ public: return archive.get(); } - /** open an archive for reading.*/ + /** open an archive for reading.*/ virtual ReadResult openArchive(std::istream& fin,const Options*) const { osg::ref_ptr archive = new OSGA_Archive; @@ -53,13 +53,13 @@ public: virtual ReadResult readImage(const std::string& file,const Options* options) const { ReadResult result = openArchive(file,osgDB::Archive::READ); - + if (!result.validArchive()) return result; // copy the incoming options if possible so that plugin options can be applied to files // inside the archive - osg::ref_ptr local_options = + osg::ref_ptr local_options = options? new osgDB::ReaderWriter::Options( *options ) : new osgDB::ReaderWriter::Options; @@ -67,7 +67,7 @@ public: local_options->setDatabasePath(file); ReadResult result_2 = result.getArchive()->readImage(result.getArchive()->getMasterFileName(),local_options.get()); - + if (!options || (options->getObjectCacheHint() & osgDB::ReaderWriter::Options::CACHE_ARCHIVES)) { @@ -81,13 +81,13 @@ public: virtual ReadResult readNode(const std::string& file,const Options* options) const { ReadResult result = openArchive(file,osgDB::Archive::READ); - + if (!result.validArchive()) return result; // copy the incoming options if possible so that plugin options can be applied to files // inside the archive - osg::ref_ptr local_options = + osg::ref_ptr local_options = options? new osgDB::ReaderWriter::Options( *options ) : new osgDB::ReaderWriter::Options; @@ -95,7 +95,7 @@ public: local_options->setDatabasePath(file); ReadResult result_2 = result.getArchive()->readNode(result.getArchive()->getMasterFileName(),local_options.get()); - + if (!options || (options->getObjectCacheHint() & osgDB::ReaderWriter::Options::CACHE_ARCHIVES)) { @@ -108,7 +108,7 @@ public: protected: - + }; diff --git a/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp b/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp index 48c8c9945..afbb20071 100644 --- a/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp +++ b/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp @@ -25,12 +25,12 @@ using namespace osg; class sgReaderWriterOSGTGZ : public osgDB::ReaderWriter { public: - + sgReaderWriterOSGTGZ() { supportsExtension("osgtgz","OpenSceneGraph tar gzid'd archive format"); } - + virtual const char* className() const { return "OSGTGZ Database Reader/Writer"; } virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const @@ -79,7 +79,7 @@ class sgReaderWriterOSGTGZ : public osgDB::ReaderWriter } osg::ref_ptr grp = new osg::Group; - + osg::ref_ptr local_options = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new osgDB::ReaderWriter::Options; local_options->getDatabasePathList().push_front(dirname); diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index 3665f474f..4915a5b8c 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -1,12 +1,12 @@ - /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield + /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -66,7 +66,7 @@ public: _alignmentMap["RIGHT_TOP"] = osgText::Text::RIGHT_TOP; _alignmentMap["RIGHT_CENTER"] = osgText::Text::RIGHT_CENTER; _alignmentMap["RIGHT_BOTTOM"] = osgText::Text::RIGHT_BOTTOM; - + _alignmentMap["LEFT_BASE_LINE"] = osgText::Text::LEFT_BASE_LINE; _alignmentMap["CENTER_BASE_LINE"] = osgText::Text::CENTER_BASE_LINE; _alignmentMap["RIGHT_BASE_LINE"] = osgText::Text::RIGHT_BASE_LINE; @@ -101,14 +101,14 @@ public: _notifyLevel = osg::INFO; } - + virtual const char* className() const { return "present3D XML Reader/Writer"; } virtual bool acceptsExtension(const std::string& extension) const - { + { return osgDB::equalCaseInsensitive(extension,"p3d") || osgDB::equalCaseInsensitive(extension,"xml") ; } @@ -130,12 +130,12 @@ public: void parseStereoPair(osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur) const; void parseLayer(osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur) const; - + void parseBullets(osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const; void parseText(osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const; void parsePage (osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur) const; - + void parseSlide (osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur, bool parseTitles=true, bool parseLayers=true) const; void parsePdfDocument (osgPresentation::SlideShowConstructor& constructor, osgDB::XmlNode*cur) const; @@ -148,7 +148,7 @@ public: if (read(str,color)) return color; else return osg::Vec4(0.0f,0.0f,0.0f,1.0f); } - + inline osg::Vec4 accumulateRotation(const osg::Vec4& lhs, const osg::Vec4& rhs) const { osg::Quat qlhs,qrhs; @@ -168,7 +168,7 @@ public: inline bool read(const char* str, osg::Vec2& value) const; inline bool read(const char* str, osg::Vec3& value) const; inline bool read(const char* str, osg::Vec4& value) const; - + inline bool read(const std::string& str, int& value) const; inline bool read(const std::string& str, float& value) const; inline bool read(const std::string& str, double& value) const; @@ -190,13 +190,13 @@ public: bool getProperty(osgDB::XmlNode*cur, const char* token, osgText::Text::Layout& value) const; bool getProperty(osgDB::XmlNode*cur, const char* token, osgText::Text::AlignmentType& value) const; bool getProperty(osgDB::XmlNode*cur, const char* token, osgText::Text::CharacterSizeMode& value) const; - + bool getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::PositionData& value) const; bool getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::FontData& value) const; bool getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::ModelData& value) const; bool getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::ImageData& value) const; bool getJumpProperties(osgDB::XmlNode*cur, bool& relativeJump, int& slideNum, int& layerNum) const; - + bool getKeyPositionInner(osgDB::XmlNode*cur, osgPresentation::KeyPosition& keyPosition) const; bool getKeyPosition(osgDB::XmlNode*cur, osgPresentation::KeyPosition& keyPosition) const; @@ -206,7 +206,7 @@ public: typedef std::map CharacterSizeModeMap; typedef std::map StringKeyMap; - std::string expandEnvVarsInFileName(const std::string& filename) const; + std::string expandEnvVarsInFileName(const std::string& filename) const; ColorMap _colorMap; @@ -214,7 +214,7 @@ public: AlignmentMap _alignmentMap; CharacterSizeModeMap _characterSizeModeMap; StringKeyMap _stringKeyMap; - + typedef std::map > TemplateMap; mutable TemplateMap _templateMap; @@ -230,9 +230,9 @@ std::string ReaderWriterP3DXML::expandEnvVarsInFileName(const std::string& filen { std::string argument(filename); std::string::size_type start_pos = argument.find("${"); - + while (start_pos != std::string::npos) - { + { std::string::size_type end_pos = argument.find("}",start_pos); if (start_pos != std::string::npos) { @@ -482,7 +482,7 @@ bool ReaderWriterP3DXML::getProperty(osgDB::XmlNode*cur, const char* token, osgT bool ReaderWriterP3DXML::getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::PositionData& value) const { - bool propertiesRead=false; + bool propertiesRead=false; osg::Vec3 position(0.0f,1.0f,0.0f); osg::Vec4 rotate(0.0f,0.0f,0.0f,1.0f); @@ -500,13 +500,13 @@ bool ReaderWriterP3DXML::getProperties(osgDB::XmlNode*cur, osgPresentation::Slid if (str=="model") value.frame = osgPresentation::SlideShowConstructor::MODEL; else if (str=="slide") value.frame = osgPresentation::SlideShowConstructor::SLIDE; else OSG_NOTIFY(_notifyLevel)<<"Parser error - coordinate_frame=\""<getTrimmedContents(); - if (!filename.empty()) + if (!filename.empty()) { constructor.addVolume(filename, positionRead ? positionData : constructor.getModelPositionData(), @@ -1100,7 +1100,7 @@ void ReaderWriterP3DXML::parseStereoPair(osgPresentation::SlideShowConstructor& OSG_INFO<<" filenameRight="<getTrimmedContents(), + constructor.addGraph(cur->getTrimmedContents(), positionRead ? positionData : constructor.getImagePositionData(), imageData); } @@ -1610,7 +1610,7 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons { int layerNum; if (getProperty(cur, "layer", layerNum)) - { + { constructor.selectLayer(layerNum); } else @@ -1715,7 +1715,7 @@ class MyReadFileCallback : public virtual osgDB::ReadFileCallback return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED; } - + osgDB::ReaderWriter::ReadResult readFileCache(ObjectType type, const std::string& filename, const osgDB::Options* options) { @@ -2218,7 +2218,7 @@ osg::Node* ReaderWriterP3DXML::parseXmlGraph(osgDB::XmlNode* root, bool readOnly else if (cur->name == "title-settings") { bool fontRead = getProperties(cur,constructor.getTitleFontDataDefault()); - if (fontRead) + if (fontRead) { OSG_INFO<<"Title font details read"<name == "text-settings") { bool fontRead = getProperties(cur,constructor.getTextFontDataDefault()); - if (fontRead) + if (fontRead) { OSG_INFO<<"Text font details read"<data() && width==_image->s() && height==_image->t()) + if (_image->data() && width==_image->s() && height==_image->t()) { return; } @@ -43,19 +43,19 @@ class CairoImage : public osg::Referenced // allocate the image data _image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE); _image->setPixelFormat(GL_BGRA); - _image->setDataVariance(osg::Object::DYNAMIC); + _image->setDataVariance(osg::Object::DYNAMIC); _image->setOrigin(osg::Image::TOP_LEFT); // create a cairo surface for this image data _surface = cairo_image_surface_create_for_data( _image->data(), - CAIRO_FORMAT_ARGB32, - width, height, + CAIRO_FORMAT_ARGB32, + width, height, _image->getRowSizeInBytes()); // create a context for the surface - _context = cairo_create(_surface); + _context = cairo_create(_surface); } void destroy() @@ -71,7 +71,7 @@ class CairoImage : public osg::Referenced const cairo_t* getContext() const { return _context; } protected: - + virtual ~CairoImage() { destroy(); @@ -137,7 +137,7 @@ class PopplerPdfImage : public osgWidget::PdfImage #endif PopplerDocument* doc = poppler_document_new_from_file(uri.c_str(), NULL, NULL); - if (!doc) + if (!doc) { OSG_NOTICE<<" could not open("<setNormalIndices(osg_indices); - - + + } else { osg::Vec3Array* osg_norms = new osg::Vec3Array; osg_norms->reserve(nv); - + int ni=0; for( i = 0; i < np; ++i) { @@ -780,7 +780,7 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* } } - geom->setNormalArray(osg_norms); + geom->setNormalArray(osg_norms); } } @@ -813,7 +813,7 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* (*osg_norms)[i][1] = norms[i][1]; (*osg_norms)[i][2] = norms[i][2]; } - geom->setNormalArray(osg_norms); + geom->setNormalArray(osg_norms); if(ilist) { @@ -847,7 +847,7 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* if( ilist[i] > cc ) cc = ilist[i]; cc++; - // straight forward mapping of normals across. + // straight forward mapping of normals across. osg::Vec4Array* osg_colors = new osg::Vec4Array(cc); for( i = 0; i < cc; i++ ) { @@ -856,11 +856,11 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* (*osg_colors)[i][2] = colors[i][2]; (*osg_colors)[i][3] = colors[i][3]; } - geom->setColorArray(osg_colors); + geom->setColorArray(osg_colors); osg::UShortArray* osg_indices = new osg::UShortArray; osg_indices->reserve(nv); - + int ni=0; for( i = 0; i < np; ++i) { @@ -873,21 +873,21 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* osg_indices->push_back(ilist[ni++]); } } - - if (ni!=nn) + + if (ni!=nn) { OSG_INFO << "1 ni!=nn"<setColorIndices(osg_indices); - - + + } else { osg::Vec4Array* osg_colors = new osg::Vec4Array; osg_colors->reserve(nv); - + int ni=0; for( i = 0; i < np; ++i) { @@ -902,7 +902,7 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* } } - geom->setColorArray(osg_colors); + geom->setColorArray(osg_colors); } } else @@ -948,11 +948,11 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* else { } - - - + + + visitGeoState(geom,geoset->getGState()); - + if (flat_shaded_skip_per_primitive) { osg::StateSet* stateset = geom->getOrCreateStateSet(); @@ -1203,9 +1203,9 @@ osg::StateSet* ConvertFromPerformer::visitGeoState(osg::Drawable* osgDrawable,pf // default: osgStateSet->setMode(osg::StateSet::TEXGEN,osg::StateAttribute::OFF);break; // } // } - // - - + // + + pfMaterial* front_mat = (pfMaterial*)geostate->getAttr(PFSTATE_FRONTMTL); pfMaterial* back_mat = (pfMaterial*)geostate->getAttr(PFSTATE_BACKMTL); visitMaterial(osgStateSet,front_mat,back_mat); @@ -1214,15 +1214,15 @@ osg::StateSet* ConvertFromPerformer::visitGeoState(osg::Drawable* osgDrawable,pf visitTexture(osgStateSet,tex); pfTexEnv* texenv = (pfTexEnv*)geostate->getAttr(PFSTATE_TEXENV); - + if(texenv) { osg::TexEnv* osgTexEnv = new osg::TexEnv(); int mode = texenv->getMode(); - + float r,g,b,a; texenv->getBlendColor(&r, &g, &b, &a); - + switch(mode) { case(PFTE_MODULATE) : @@ -1447,7 +1447,7 @@ static osg::Texture2D::FilterMode getTexfilter(int filter, int pftype) // not quite sure what is supposed to be interpret the Peformer // filter modes here so will simple go with OpenGL default. - + return osg::Texture2D::LINEAR; } } diff --git a/src/osgPlugins/pic/ReaderWriterPIC.cpp b/src/osgPlugins/pic/ReaderWriterPIC.cpp index 94b5c5804..9e00830b4 100644 --- a/src/osgPlugins/pic/ReaderWriterPIC.cpp +++ b/src/osgPlugins/pic/ReaderWriterPIC.cpp @@ -195,7 +195,7 @@ class ReaderWriterPIC : public osgDB::ReaderWriter { supportsExtension("pic","PIC Image format"); } - + virtual const char* className() const { return "PIC Image Reader"; } virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const diff --git a/src/osgPlugins/ply/ReaderWriterPLY.cpp b/src/osgPlugins/ply/ReaderWriterPLY.cpp index b0873056a..13686122a 100644 --- a/src/osgPlugins/ply/ReaderWriterPLY.cpp +++ b/src/osgPlugins/ply/ReaderWriterPLY.cpp @@ -4,13 +4,13 @@ * All rights reserved. * * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or (at + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License @@ -56,17 +56,17 @@ REGISTER_OSGPLUGIN(ply, ReaderWriterPLY) //! //! \brief Function which is called when any ply file is requested to load in //! \osgDB. Load read ply file and if it successes return the osg::Node -//! +//! /////////////////////////////////////////////////////////////////////////////// osgDB::ReaderWriter::ReadResult ReaderWriterPLY::readNode(const std::string& filename, const osgDB::ReaderWriter::Options* options) const { // Get the file extension std::string ext = osgDB::getFileExtension(filename); - + // If the file extension does not support then return that file is not handled if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; - // Check whether or not file exist or not + // Check whether or not file exist or not std::string fileName = osgDB::findDataFile(filename, options); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; @@ -74,7 +74,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterPLY::readNode(const std::string& fil ply::VertexData vertexData; osg::Node* node = vertexData.readPlyFile(filename.c_str()); - if (node) + if (node) return node; return ReadResult::FILE_NOT_HANDLED; diff --git a/src/osgPlugins/ply/ply.h b/src/osgPlugins/ply/ply.h index cc9c8f539..ed0f03cc1 100644 --- a/src/osgPlugins/ply/ply.h +++ b/src/osgPlugins/ply/ply.h @@ -17,16 +17,16 @@ chars for red, green and blue. --------------------------------------------------------------- Copyright (c) 1994 The Board of Trustees of The Leland Stanford -Junior University. All rights reserved. - -Permission to use, copy, modify and distribute this software and its -documentation for any purpose is hereby granted without fee, provided -that the above copyright notice and this permission notice appear in -all copies of this software and that you do not sell the software. - -THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, -EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY -WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +Junior University. All rights reserved. + +Permission to use, copy, modify and distribute this software and its +documentation for any purpose is hereby granted without fee, provided +that the above copyright notice and this permission notice appear in +all copies of this software and that you do not sell the software. + +THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */ diff --git a/src/osgPlugins/ply/plyfile.cpp b/src/osgPlugins/ply/plyfile.cpp index 7c85468a1..ac90d0238 100644 --- a/src/osgPlugins/ply/plyfile.cpp +++ b/src/osgPlugins/ply/plyfile.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2005-2007, Stefan Eilemann +/* Copyright (c) 2005-2007, Stefan Eilemann All rights reserved. - Cleaned up code for 64 bit, little and big endian support - Added new ply data types (uint8, float32, int32) @@ -25,16 +25,16 @@ chars representing red, green and blue. --------------------------------------------------------------- Copyright (c) 1994 The Board of Trustees of The Leland Stanford -Junior University. All rights reserved. - -Permission to use, copy, modify and distribute this software and its -documentation for any purpose is hereby granted without fee, provided -that the above copyright notice and this permission notice appear in -all copies of this software and that you do not sell the software. - -THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, -EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY -WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +Junior University. All rights reserved. + +Permission to use, copy, modify and distribute this software and its +documentation for any purpose is hereby granted without fee, provided +that the above copyright notice and this permission notice appear in +all copies of this software and that you do not sell the software. + +THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */ @@ -135,7 +135,7 @@ void swap2Bytes( void* ptr ) { unsigned char* bytes = (unsigned char*)ptr; unsigned short* result = (unsigned short*)ptr; - + *result = (bytes[0]<<8) | bytes[1]; } @@ -145,13 +145,13 @@ void swap4Bytes( void* ptr ) unsigned int* result = (unsigned int*)ptr; *result = (bytes[0]<<24) | (bytes[1]<<16) | (bytes[2]<<8) | bytes[3]; -} +} void swap8Bytes( void* ptr ) { unsigned char* bytes = (unsigned char*)ptr; unsigned long long* result = (unsigned long long*)ptr; - + *result = ((unsigned long long)(bytes[0])) << 56 | ((unsigned long long)(bytes[1])) << 48 | ((unsigned long long)(bytes[2])) << 40 | @@ -306,7 +306,7 @@ PlyFile *ply_open_for_writing( /* tack on the extension .ply, if necessary */ - name = (char *) myalloc (sizeof (char) * + name = (char *) myalloc (sizeof (char) * (static_cast(strlen (filename)) + 5)); strcpy (name, filename); if (strlen (name) < 4 || @@ -753,7 +753,7 @@ void ply_put_comment(PlyFile *plyfile, const char *comment) plyfile->comments = (char **) realloc (plyfile->comments, sizeof (char *) * (plyfile->num_comments + 1)); } - + /* add comment to list */ plyfile->comments[plyfile->num_comments] = strdup (comment); plyfile->num_comments++; @@ -781,7 +781,7 @@ void ply_put_obj_info(PlyFile *plyfile, const char *obj_info) plyfile->obj_info = (char **) realloc (plyfile->obj_info, sizeof (char *) * (plyfile->num_obj_info + 1)); } - + /* add info to list */ plyfile->obj_info[plyfile->num_obj_info] = strdup (obj_info); plyfile->num_obj_info++; @@ -829,7 +829,7 @@ PlyFile *ply_read(FILE *fp, int *nelems, char ***elem_names) plyfile = (PlyFile *) myalloc (sizeof (PlyFile)); if (!plyfile) return (NULL); - + plyfile->nelems = 0; plyfile->comments = NULL; plyfile->num_comments = 0; @@ -894,7 +894,7 @@ PlyFile *ply_read(FILE *fp, int *nelems, char ***elem_names) words = get_words (plyfile->fp, &nwords, &orig_line); } - + /* create tags for each property of each element, to be used */ /* later to say whether or not to store each property for the user */ @@ -950,7 +950,7 @@ PlyFile *ply_open_for_reading( /* tack on the extension .ply, if necessary */ - name = (char *) myalloc (sizeof (char) * + name = (char *) myalloc (sizeof (char) * (static_cast(strlen (filename) + 5))); strcpy (name, filename); if (strlen (name) < 4 || @@ -1055,13 +1055,13 @@ void ply_get_element_setup( PlyFile *plyfile, char *elem_name, int nprops, plyfile->which_elem = elem; /* deposit the property information into the element's description */ - for (i = 0; i < nprops; i++) + for (i = 0; i < nprops; i++) { /* look for actual property */ prop = find_property (elem, prop_list[i].name, &index); - if (prop == NULL) + if (prop == NULL) { - fprintf ( stderr, + fprintf ( stderr, "Warning: Can't find property '%s' in element '%s'\n", prop_list[i].name, elem_name ); continue; @@ -1303,7 +1303,7 @@ PlyOtherProp *ply_get_other_properties( #endif other->size = elem->other_size; other->props = (PlyProperty **) myalloc (sizeof(PlyProperty*) * elem->nprops); - + /* save descriptions of each "other" property */ nprops = 0; for (i = 0; i < elem->nprops; i++) { @@ -1322,7 +1322,7 @@ PlyOtherProp *ply_get_other_properties( elem->other_offset = NO_OTHER_PROPS; } #endif - + /* return structure */ return (other); } @@ -1534,13 +1534,13 @@ void ply_close(PlyFile *plyfile) free (plyfile->comments[i]); } free (plyfile->comments); - + for (i=0; inum_obj_info; i++) { free (plyfile->obj_info[i]); } free (plyfile->obj_info); - + free (plyfile); } @@ -1601,7 +1601,7 @@ PlyElement *find_element(PlyFile *plyfile, const char *element) for (i = 0; i < plyfile->nelems; i++) if (equal_strings (element, plyfile->elems[i]->name)) return (plyfile->elems[i]); - + return (NULL); } @@ -1621,14 +1621,14 @@ Exit: PlyProperty *find_property(PlyElement *elem, const char *prop_name, int *index) { int i; - + for( i = 0; i < elem->nprops; i++) if (equal_strings (prop_name, elem->props[i]->name)) { *index = i; return (elem->props[i]); } - + *index = -1; return (NULL); } @@ -1827,7 +1827,7 @@ void binary_get_element(PlyFile *plyfile, char *elem_ptr) /* The "if" was added by Afra Zomorodian 8/22/95 * so that zipper won't crash reading plies that have additional * properties. - */ + */ if (store_it) { item_size = ply_type_size[prop->internal_type]; } @@ -2760,8 +2760,8 @@ char *my_alloc(int size, int lnum, const char *fname) ptr = (char *) malloc (size); - if (ptr == 0) - fprintf( stderr, "Memory allocation bombed on line %d in %s\n", + if (ptr == 0) + fprintf( stderr, "Memory allocation bombed on line %d in %s\n", lnum, fname); return (ptr); diff --git a/src/osgPlugins/ply/typedefs.h b/src/osgPlugins/ply/typedefs.h index 22337aac5..4d6c833d1 100644 --- a/src/osgPlugins/ply/typedefs.h +++ b/src/osgPlugins/ply/typedefs.h @@ -1,8 +1,8 @@ -/* +/* typedefs.h Copyright (c) 2007, Tobias Wolf - All rights reserved. - + All rights reserved. + Type definitions for the mesh classes. */ @@ -48,15 +48,15 @@ typedef SSIZE_T ssize_t; #include #include -namespace ply +namespace ply { - - + + typedef size_t Index; // typedef unsigned short ShortIndex; - - + + // mesh exception struct MeshException : public std::exception { @@ -66,7 +66,7 @@ namespace ply private: std::string _message; }; - + // null output stream that discards everything written to it struct NullOStream : std::ostream { @@ -74,10 +74,10 @@ namespace ply { int overflow( int c ) { return traits_type::not_eof( c ); } } _nullBuf; - + NullOStream() : std::ios( &_nullBuf ), std::ostream( &_nullBuf ) {} }; - + // wrapper to enable array use where arrays would not be allowed otherwise template< class T, size_t d > struct ArrayWrapper @@ -87,22 +87,22 @@ namespace ply MESHASSERT( i < d ); return data[i]; } - + const T& operator[]( const size_t i ) const { MESHASSERT( i < d ); return data[i]; } - + private: T data[d]; }; - - + + // binary mesh file version, increment if changing the file format const unsigned short FILE_VERSION ( 0x0114 ); - - + + // enumeration for the sort axis enum Axis { diff --git a/src/osgPlugins/ply/vertexData.cpp b/src/osgPlugins/ply/vertexData.cpp index 8c84c667a..7f43695e8 100644 --- a/src/osgPlugins/ply/vertexData.cpp +++ b/src/osgPlugins/ply/vertexData.cpp @@ -1,8 +1,8 @@ -/* +/* vertexData.cpp Copyright (c) 2007, Tobias Wolf - All rights reserved. - + All rights reserved. + Implementation of the VertexData class. */ @@ -52,7 +52,7 @@ VertexData::VertexData() /* Read the vertex and (if available/wanted) color data from the open file. */ -void VertexData::readVertices( PlyFile* file, const int nVertices, +void VertexData::readVertices( PlyFile* file, const int nVertices, const int fields ) { // temporary vertex structure for ply loading @@ -80,7 +80,7 @@ void VertexData::readVertices( PlyFile* file, const int nVertices, float specular_power; } vertex; - PlyProperty vertexProps[] = + PlyProperty vertexProps[] = { { "x", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, x ), 0, 0, 0, 0 }, { "y", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, y ), 0, 0, 0, 0 }, @@ -103,41 +103,41 @@ void VertexData::readVertices( PlyFile* file, const int nVertices, { "specular_coeff", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, specular_coeff ), 0, 0, 0, 0 }, { "specular_power", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, specular_power ), 0, 0, 0, 0 }, }; - + // use all 6 properties when reading colors, only the first 3 otherwise - for( int i = 0; i < 3; ++i ) + for( int i = 0; i < 3; ++i ) ply_get_property( file, "vertex", &vertexProps[i] ); - + if (fields & NORMALS) - for( int i = 3; i < 6; ++i ) + for( int i = 3; i < 6; ++i ) ply_get_property( file, "vertex", &vertexProps[i] ); if (fields & RGB) - for( int i = 6; i < 9; ++i ) + for( int i = 6; i < 9; ++i ) ply_get_property( file, "vertex", &vertexProps[i] ); if (fields & AMBIENT) - for( int i = 9; i < 12; ++i ) + for( int i = 9; i < 12; ++i ) ply_get_property( file, "vertex", &vertexProps[i] ); if (fields & DIFFUSE) - for( int i = 12; i < 15; ++i ) + for( int i = 12; i < 15; ++i ) ply_get_property( file, "vertex", &vertexProps[i] ); if (fields & SPECULAR) - for( int i = 15; i < 20; ++i ) + for( int i = 15; i < 20; ++i ) ply_get_property( file, "vertex", &vertexProps[i] ); // check whether array is valid otherwise allocate the space if(!_vertices.valid()) - _vertices = new osg::Vec3Array; + _vertices = new osg::Vec3Array; if( fields & NORMALS ) { if(!_normals.valid()) _normals = new osg::Vec3Array; } - + // If read colors allocate space for color array if( fields & RGB ) { @@ -156,7 +156,7 @@ void VertexData::readVertices( PlyFile* file, const int nVertices, if(!_diffuse.valid()) _diffuse = new osg::Vec4Array; } - + if( fields & SPECULAR ) { if(!_specular.valid()) @@ -202,20 +202,20 @@ void VertexData::readTriangles( PlyFile* file, const int nFaces ) int* vertices; } face; - PlyProperty faceProps[] = + PlyProperty faceProps[] = { - { "vertex_indices", PLY_INT, PLY_INT, offsetof( _Face, vertices ), + { "vertex_indices", PLY_INT, PLY_INT, offsetof( _Face, vertices ), 1, PLY_UCHAR, PLY_UCHAR, offsetof( _Face, nVertices ) } }; - + ply_get_property( file, "face", &faceProps[0] ); - + //triangles.clear(); //triangles.reserve( nFaces ); if(!_triangles.valid()) _triangles = new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, 0); - + // read in the faces, asserting that they are only triangles int ind1 = _invertFaces ? 2 : 0; int ind3 = _invertFaces ? 0 : 2; @@ -233,7 +233,7 @@ void VertexData::readTriangles( PlyFile* file, const int nFaces ) _triangles->push_back( face.vertices[ind1]); _triangles->push_back( face.vertices[1]); _triangles->push_back( face.vertices[ind3] ); - + // free the memory that was allocated by ply_get_element free( face.vertices ); } @@ -250,38 +250,38 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor bool result = false; int nComments; char** comments; - + PlyFile* file = NULL; // Try to open ply file as for reading try{ - file = ply_open_for_reading( const_cast< char* >( filename ), - &nPlyElems, &elemNames, + file = ply_open_for_reading( const_cast< char* >( filename ), + &nPlyElems, &elemNames, &fileType, &version ); } // Catch the if any exception thrown catch( exception& e ) { - MESHERROR << "Unable to read PLY file, an exception occured: " + MESHERROR << "Unable to read PLY file, an exception occured: " << e.what() << endl; } if( !file ) { - MESHERROR << "Unable to open PLY file " << filename + MESHERROR << "Unable to open PLY file " << filename << " for reading." << endl; return NULL; } MESHASSERT( elemNames != 0 ); - + nComments = file->num_comments; comments = file->comments; - - + + #ifndef NDEBUG - MESHINFO << filename << ": " << nPlyElems << " elements, file type = " + MESHINFO << filename << ": " << nPlyElems << " elements, file type = " << fileType << ", version = " << version << endl; #endif @@ -297,19 +297,19 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor { int nElems; int nProps; - + PlyProperty** props = NULL; try{ - props = ply_get_element_description( file, elemNames[i], + props = ply_get_element_description( file, elemNames[i], &nElems, &nProps ); } catch( exception& e ) { - MESHERROR << "Unable to get PLY file description, an exception occured: " + MESHERROR << "Unable to get PLY file description, an exception occured: " << e.what() << endl; } MESHASSERT( props != 0 ); - + #ifndef NDEBUG MESHINFO << "element " << i << ": name = " << elemNames[i] << ", " << nProps << " properties, " << nElems << " elements" << endl; @@ -319,7 +319,7 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor << "name = " << props[j]->name << endl; } #endif - + // if the string is vertex means vertex data is started if( equal_strings( elemNames[i], "vertex" ) ) { @@ -348,7 +348,7 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor MESHINFO << "Colors in PLY file ignored per request." << endl; } - try { + try { // Read vertices and store in a std::vector array readVertices( file, nElems, fields ); // Check whether all vertices are loaded or not @@ -380,12 +380,12 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor } catch( exception& e ) { - MESHERROR << "Unable to read vertex in PLY file, an exception occured: " + MESHERROR << "Unable to read vertex in PLY file, an exception occured: " << e.what() << endl; // stop for loop by setting the loop variable to break condition // this way resources still get released even on error cases i = nPlyElems; - + } } // If the string is face means triangle info started @@ -400,21 +400,21 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor } catch( exception& e ) { - MESHERROR << "Unable to read PLY file, an exception occured: " + MESHERROR << "Unable to read PLY file, an exception occured: " << e.what() << endl; // stop for loop by setting the loop variable to break condition // this way resources still get released even on error cases i = nPlyElems; } - + // free the memory that was allocated by ply_get_element_description for( int j = 0; j < nProps; ++j ) free( props[j] ); free( props ); } - + ply_close( file ); - + // free the memory that was allocated by ply_open_for_reading for( int i = 0; i < nPlyElems; ++i ) free( elemNames[i] ); @@ -442,7 +442,7 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor geom->setNormalArray(_normals.get()); geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); } - + // Add the primitive set if (_triangles.valid() && _triangles->size() > 0 ) geom->addPrimitiveSet(_triangles.get()); @@ -477,13 +477,13 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor // set flage true to activate the vertex buffer object of drawable geom->setUseVertexBufferObjects(true); - + osg::Geode* geode = new osg::Geode; geode->addDrawable(geom); return geode; } - + return NULL; } @@ -501,9 +501,9 @@ void VertexData::_calculateNormals( const bool vertexNormals ) if(!_normals.valid()) { - _normals = new osg::Vec3Array; + _normals = new osg::Vec3Array; } - + //normals.clear(); if( vertexNormals ) { @@ -514,7 +514,7 @@ void VertexData::_calculateNormals( const bool vertexNormals ) } } - + for( size_t i = 0; i < ((_triangles->size())); i += 3 ) { // iterate over all triangles and add their normals to adjacent vertices @@ -526,31 +526,31 @@ void VertexData::_calculateNormals( const bool vertexNormals ) triangleNormal.normal((*_vertices)[i0], (*_vertices)[i1], (*_vertices)[i2] ); - + // count emtpy normals in debug mode #ifndef NDEBUG if( triangleNormal.triNormal.length() == 0.0f ) ++wrongNormals; #endif - + if( vertexNormals ) { - (*_normals)[i0] += triangleNormal.triNormal; - (*_normals)[i1] += triangleNormal.triNormal; + (*_normals)[i0] += triangleNormal.triNormal; + (*_normals)[i1] += triangleNormal.triNormal; (*_normals)[i2] += triangleNormal.triNormal; } else - _normals->push_back( triangleNormal.triNormal ); + _normals->push_back( triangleNormal.triNormal ); } - + // normalize all the normals if( vertexNormals ) for( size_t i = 0; i < _normals->size(); ++i ) (*_normals)[i].normalize(); - + #ifndef NDEBUG if( wrongNormals > 0 ) MESHINFO << wrongNormals << " faces had no valid normal." << endl; - #endif + #endif } diff --git a/src/osgPlugins/ply/vertexData.h b/src/osgPlugins/ply/vertexData.h index 978986a09..7c4eda25d 100644 --- a/src/osgPlugins/ply/vertexData.h +++ b/src/osgPlugins/ply/vertexData.h @@ -1,8 +1,8 @@ -/* +/* vertexData.h Copyright (c) 2007, Tobias Wolf - All rights reserved. - + All rights reserved. + Header file of the VertexData class. */ @@ -28,7 +28,7 @@ // defined elsewhere struct PlyFile; -namespace ply +namespace ply { /* Holds the flat data and offers routines to read, scale and sort it. */ class VertexData @@ -37,13 +37,13 @@ namespace ply // Default constructor VertexData(); - + // Reads ply file and convert in to osg::Node and returns the same osg::Node* readPlyFile( const char* file, const bool ignoreColors = false ); - + // to set the flag for using inverted face void useInvertedFaces() { _invertFaces = true; } - + private: enum VertexFields @@ -59,7 +59,7 @@ namespace ply // Function which reads all the vertices and colors if color info is // given and also if the user wants that information - void readVertices( PlyFile* file, const int nVertices, + void readVertices( PlyFile* file, const int nVertices, const int vertexFields ); // Reads the triangle indices from the ply file @@ -69,7 +69,7 @@ namespace ply // if vertexNormals is true then computes normal per vertices // otherwise per triangle means per face void _calculateNormals( const bool vertexNormals = true ); - + bool _invertFaces; // Vertex array in osg format diff --git a/src/osgPlugins/png/ReaderWriterPNG.cpp b/src/osgPlugins/png/ReaderWriterPNG.cpp index 8ab3da3d4..4d9121a5d 100644 --- a/src/osgPlugins/png/ReaderWriterPNG.cpp +++ b/src/osgPlugins/png/ReaderWriterPNG.cpp @@ -40,7 +40,7 @@ public: _message = "PNG lib error : "; _message += message; } - friend std::ostream& operator<<(std::ostream& stream, const PNGError& err) + friend std::ostream& operator<<(std::ostream& stream, const PNGError& err) { stream << err._message; return stream; @@ -88,7 +88,7 @@ class ReaderWriterPNG : public osgDB::ReaderWriter { supportsExtension("png","PNG Image format"); } - + virtual const char* className() const { return "PNG Image Reader/Writer"; } WriteResult::WriteStatus writePngStream(std::ostream& fout, const osg::Image& img, int compression_level) const @@ -120,7 +120,7 @@ class ReaderWriterPNG : public osgDB::ReaderWriter case(GL_RGBA): color = PNG_COLOR_TYPE_RGB_ALPHA; break; case(GL_BGR): color = PNG_COLOR_TYPE_RGB; png_set_bgr(png); break; case(GL_BGRA): color = PNG_COLOR_TYPE_RGB_ALPHA; png_set_bgr(png); break; - default: return WriteResult::ERROR_IN_WRITING_FILE; break; + default: return WriteResult::ERROR_IN_WRITING_FILE; break; } //Create row data @@ -168,7 +168,7 @@ class ReaderWriterPNG : public osgDB::ReaderWriter png_uint_32 i; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - + // Set custom error handlers png_set_error_fn(png, png_get_error_ptr(png), user_error_fn, user_warning_fn); @@ -284,7 +284,7 @@ class ReaderWriterPNG : public osgDB::ReaderWriter case(PNG_COLOR_TYPE_RGB): pixelFormat = GL_RGB; break; case(PNG_COLOR_TYPE_PALETTE): pixelFormat = GL_RGB; break; case(PNG_COLOR_TYPE_RGB_ALPHA): pixelFormat = GL_RGBA; break; - default: break; + default: break; } // Some paletted images contain alpha information. To be @@ -301,14 +301,14 @@ class ReaderWriterPNG : public osgDB::ReaderWriter // delete [] data; - if (pixelFormat==0) + if (pixelFormat==0) return ReadResult::FILE_NOT_HANDLED; osg::Image* pOsgImage = new osg::Image(); pOsgImage->setImage(width, height, 1, internalFormat, - pixelFormat, + pixelFormat, dataType, data, osg::Image::USE_NEW_DELETE); diff --git a/src/osgPlugins/pnm/ReaderWriterPNM.cpp b/src/osgPlugins/pnm/ReaderWriterPNM.cpp index adb99009b..499b745fb 100644 --- a/src/osgPlugins/pnm/ReaderWriterPNM.cpp +++ b/src/osgPlugins/pnm/ReaderWriterPNM.cpp @@ -223,7 +223,7 @@ class ReaderWriterPNM : public osgDB::ReaderWriter supportsExtension("pgm","PNM Image format"); supportsExtension("pbm","PNM Image format"); } - + virtual const char* className() const { return "PNM Image Reader/Writer"; } virtual ReadResult readImage(std::istream& fin, const osgDB::ReaderWriter::Options* options=NULL) const @@ -417,7 +417,7 @@ class ReaderWriterPNM : public osgDB::ReaderWriter } else { - // binary ppm format + // binary ppm format fout<<"P6"< inline void swapBytes( T &s ) { - if( sizeof( T ) == 1 ) + if( sizeof( T ) == 1 ) return; - + T d = s; BytePtr sptr = (BytePtr)&s; BytePtr dptr = &(((BytePtr)&d)[sizeof(T)-1]); - + for( unsigned int i = 0; i < sizeof(T); i++ ) *(sptr++) = *(dptr--); } @@ -117,28 +117,28 @@ typedef struct _PVRTexHeader class ReaderWriterPVR : public osgDB::ReaderWriter { public: - + ReaderWriterPVR() { supportsExtension("pvr","PVR image format"); } - + virtual const char* className() const { return "PVR Image Reader/Writer"; } - + ReadResult readPVRStream(std::istream& fin) const { PVRTexHeader header; - + fin.read((char*)&header, sizeof(PVRTexHeader)); if(!fin.good()){ osg::notify(osg::WARN) << "Failed to read pvr header." << std::endl; return ReadResult::ERROR_IN_READING_FILE; } - + if(header.needsBytesSwapped()) header.swapBytes(); - + if(gPVRTexIdentifier[0] != static_cast((header.pvrTag >> 0) & 0xff) || gPVRTexIdentifier[1] != static_cast((header.pvrTag >> 8) & 0xff) || gPVRTexIdentifier[2] != static_cast((header.pvrTag >> 16) & 0xff) || @@ -147,12 +147,12 @@ public: osg::notify(osg::WARN) << "Failed to verify pvr header: " << ((header.pvrTag >> 0) & 0xff) << ", " << ((header.pvrTag >> 8) & 0xff) << ", " << ((header.pvrTag >> 16) & 0xff) << ", " << ((header.pvrTag >> 24) & 0xff) << std::endl; return ReadResult::FILE_NOT_HANDLED; } - - + + uint32_t formatFlags = header.flags & PVR_TEXTURE_FLAG_TYPE_MASK; GLenum internalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; uint32_t width, height; - + if(formatFlags == kPVRTextureFlagTypePVRTC_4 || formatFlags == kPVRTextureFlagTypePVRTC_2 || formatFlags == kPVRTextureFlagTypeOGLPVRTC_4 || formatFlags == kPVRTextureFlagTypeOGLPVRTC_2 || formatFlags == kPVRTextureFlagTypeETC){ @@ -162,35 +162,35 @@ public: internalFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; else if(formatFlags == kPVRTextureFlagTypeETC) internalFormat = GL_ETC1_RGB8_OES; - + width = header.width; height = header.height; osg::ref_ptr image = new osg::Image; if (!image) return ReadResult::INSUFFICIENT_MEMORY_TO_LOAD; - + unsigned char *imageData = new unsigned char[header.dataLength]; if (!imageData) return ReadResult::INSUFFICIENT_MEMORY_TO_LOAD; - + fin.read((char*)imageData, header.dataLength); if(!fin.good()) { delete [] imageData; return ReadResult::ERROR_IN_READING_FILE; } - + image->setImage(header.width, header.height, 1, internalFormat, internalFormat, GL_UNSIGNED_BYTE, imageData, osg::Image::USE_NEW_DELETE); - + uint32_t dataOffset = 0; uint32_t blockSize = 0, widthBlocks = 0, heightBlocks = 0; uint32_t bpp = 4; - + osg::Image::MipmapDataType mipmapdata; - + // Calculate the data size for each texture level and respect the minimum number of blocks while(dataOffset < header.dataLength){ if(formatFlags == kPVRTextureFlagTypePVRTC_4 || formatFlags == kPVRTextureFlagTypeOGLPVRTC_4){ @@ -209,32 +209,32 @@ public: heightBlocks = height / 4; bpp = 2; } - + // Clamp to minimum number of blocks if(widthBlocks < 2) widthBlocks = 2; if(heightBlocks < 2) heightBlocks = 2; - + if(dataOffset > 0) mipmapdata.push_back(dataOffset); - + dataOffset += widthBlocks * heightBlocks * ((blockSize * bpp) / 8); - + width = osg::maximum(width >> 1, (uint32_t)1); height = osg::maximum(height >> 1, (uint32_t)1); } - + if(!mipmapdata.empty()) image->setMipmapLevels(mipmapdata); - + return image.get(); } - + osg::notify(osg::WARN) << "Failed to read pvr data." << std::endl; - return ReadResult::FILE_NOT_HANDLED; + return ReadResult::FILE_NOT_HANDLED; } - + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const { return readImage(fin, options); @@ -249,17 +249,17 @@ public: { return readPVRStream(fin); } - + virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); if(!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; - + std::string fileName = osgDB::findDataFile(file, options); if(fileName.empty()) return ReadResult::FILE_NOT_FOUND; - + std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); if(!istream) return ReadResult::FILE_NOT_HANDLED; ReadResult rr = readPVRStream(istream); diff --git a/src/osgPlugins/qfont/ReaderQFont.cpp b/src/osgPlugins/qfont/ReaderQFont.cpp index 45382d91a..481f1a54f 100644 --- a/src/osgPlugins/qfont/ReaderQFont.cpp +++ b/src/osgPlugins/qfont/ReaderQFont.cpp @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 2009-2010 Mathias Froehlich * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -30,9 +30,9 @@ class ReaderQFont : public osgDB::ReaderWriter { supportsExtension("qfont", "Qt font meta loader"); } - + virtual const char* className() const { return "QFont Font Reader"; } - + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const { if (!acceptsExtension(osgDB::getLowerCaseFileExtension(file))) diff --git a/src/osgPlugins/quicktime/MovieData.cpp b/src/osgPlugins/quicktime/MovieData.cpp index 1268b88b4..23f2dec34 100644 --- a/src/osgPlugins/quicktime/MovieData.cpp +++ b/src/osgPlugins/quicktime/MovieData.cpp @@ -16,7 +16,7 @@ - + MovieData::MovieData() : _pointer(NULL), _movie(NULL), _gw(NULL), _fError(false), _isLooping(false) { @@ -24,7 +24,7 @@ MovieData::MovieData() : _pointer(NULL), _movie(NULL), _gw(NULL), _fError(false) MovieData::~MovieData() -{ +{ if (_pointer) free(_pointer); if (_gw) DisposeGWorld(_gw); @@ -32,22 +32,22 @@ MovieData::~MovieData() DisposeMovie(_movie); } } - - - - + + + + void MovieData::load(osg::Image* image, std::string afilename, double startTime) { bool isUrl( osgDB::containsServerAddress(afilename) ); - + std::string filename = afilename; if (!isUrl) { - if (!osgDB::isFileNameNativeStyle(filename)) + if (!osgDB::isFileNameNativeStyle(filename)) filename = osgDB::convertFileNameToNativeStyle(filename); } - + image->setFileName(filename); - + QTNewMoviePropertyElement newMovieProperties[2]; CFStringRef movieLocation = CFStringCreateWithCString(NULL, filename.c_str(), kCFStringEncodingUTF8); @@ -55,21 +55,21 @@ void MovieData::load(osg::Image* image, std::string afilename, double startTime) Boolean trueValue = true; newMovieProperties[0].propClass = kQTPropertyClass_DataLocation; - if (!isUrl) + if (!isUrl) { #ifdef __APPLE__ newMovieProperties[0].propID = kQTDataLocationPropertyID_CFStringPosixPath; #else newMovieProperties[0].propID = kQTDataLocationPropertyID_CFStringWindowsPath; #endif - + newMovieProperties[0].propValueSize = sizeof(CFStringRef); newMovieProperties[0].propValueAddress = &movieLocation; - } - else + } + else { movieURL = CFURLCreateWithString(kCFAllocatorDefault, movieLocation, NULL); - + newMovieProperties[0].propID = kQTDataLocationPropertyID_CFURL; newMovieProperties[0].propValueSize = sizeof(movieURL); newMovieProperties[0].propValueAddress = (void*)&movieURL; @@ -80,21 +80,21 @@ void MovieData::load(osg::Image* image, std::string afilename, double startTime) newMovieProperties[1].propID = kQTNewMoviePropertyID_Active; newMovieProperties[1].propValueSize = sizeof(trueValue); newMovieProperties[1].propValueAddress = &trueValue; - + // Instantiate the Movie OSStatus status = NewMovieFromProperties(2, newMovieProperties, 0, NULL, &_movie); CFRelease(movieLocation); if (movieURL) CFRelease(movieURL); - + if (status !=0) { _fError = true; OSG_FATAL << " MovieData :: NewMovieFromProperties failed with err " << status<< std::endl; return; } - - + + Rect bounds; - + #ifdef __APPLE__ GetRegionBounds(GetMovieBoundsRgn(_movie), &bounds); #else @@ -109,22 +109,22 @@ void MovieData::load(osg::Image* image, std::string afilename, double startTime) _movieWidth = bounds.right; _movieHeight = bounds.bottom; - + _timescale = GetMovieTimeScale(_movie); _initImage(image); if (!_fError) _initGWorldStuff(image); - + if (!_fError) { - + if ( startTime == 0.0) GoToBeginningOfMovie(_movie); else { TimeValue t = (TimeValue) (startTime*_timescale); SetMovieTimeValue(_movie,t); } - + UpdateMovie(_movie); SetMovieRate(_movie,0.0); SetMovieActive(_movie, true); @@ -143,12 +143,12 @@ void MovieData::_initImage(osg::Image* image) { void* buffer; - + _textureWidth = ((_movieWidth + 7) >> 3) << 3; _textureHeight = _movieHeight; - - // some magic alignment... + + // some magic alignment... _pointer = (char*)malloc(4 * _textureWidth * _textureHeight + 32); if (_pointer == NULL) { @@ -188,7 +188,7 @@ void MovieData::_initGWorldStuff(osg::Image * image) { textureBounds.right = image->s(); textureBounds.bottom = image->t(); err = QTNewGWorldFromPtr(&_gw, k32ARGBPixelFormat, &textureBounds, NULL, NULL, 0, image->data(), 4 * image->s()); - + if (err !=0 ) { OSG_FATAL << "MovieData : Could not create gWorld" << std::endl; @@ -197,7 +197,7 @@ void MovieData::_initGWorldStuff(osg::Image * image) { GetGWorld (&origPort, &origDevice); SetGWorld(_gw, NULL); // set current graphics port to offscreen SetMovieGWorld(_movie, (CGrafPtr)_gw, NULL); - + _checkMovieError("SetMovieGWorld failed"); pixmap = GetGWorldPixMap (_gw); @@ -221,14 +221,14 @@ void MovieData::_initGWorldStuff(osg::Image * image) { void MovieData::setMovieTime(double atime) { double time = (atime > getMovieDuration()) ? getMovieDuration() : atime; - + TimeValue t = (TimeValue) (time * _timescale); SetMovieTimeValue(_movie,t); _checkMovieError("setMovieTime failed"); UpdateMovie(_movie); MoviesTask(_movie,0); - - + + } void MovieData::setMovieRate(double rate) { @@ -239,12 +239,12 @@ void MovieData::setMovieRate(double rate) { _checkMovieError("PrerollMovie failed"); _preRolled = true; } - - SetMovieRate(_movie, X2Fix(rate)); + + SetMovieRate(_movie, X2Fix(rate)); _checkMovieError("setMovieRate failed"); MoviesTask(_movie, 0); _checkMovieError("MoviesTask failed"); - + UpdateMovie(_movie); _checkMovieError("UpdateMovie failed"); diff --git a/src/osgPlugins/quicktime/MovieData.h b/src/osgPlugins/quicktime/MovieData.h index ebc0b0276..54e8010df 100644 --- a/src/osgPlugins/quicktime/MovieData.h +++ b/src/osgPlugins/quicktime/MovieData.h @@ -19,57 +19,57 @@ #include - /** + /** * the class MovieData encapsulates all quicktime-related stuff, so it doesn't polute the namespaces - * it handles all calls to quicktime etc... It is mainly used by the QuicktimeImageStream, it is - * rarely needed in other contexts + * it handles all calls to quicktime etc... It is mainly used by the QuicktimeImageStream, it is + * rarely needed in other contexts */ class MovieData { - + public: /** default constructor */ MovieData(); - + /** default destructor */ ~MovieData(); - - /** + + /** * loads a movie, start it playing at startTime, use Image for the storage * @param image the image, to use as storage * @param fileName the movie to open * @param startTime the starttime to begin with */ void load(osg::Image* image, std::string fileName, double startTime = 0.0); - + /** @return the duration for this movie in seconds */ inline double getMovieDuration() { return GetMovieDuration(_movie)/_timescale;} - + /** @return the current position for this movie in seconds */ inline double getMovieTime() {return GetMovieTime(_movie,NULL)/_timescale; } - + /** stes the movietime */ void setMovieTime(double atime); - + /** @return the Movie-handle, to use it with other quicktime-calls */ inline Movie &getMovie() { return _movie; } - + /** @return the current movieRate */ inline double getMovieRate() { return Fix2X(GetMovieRate(_movie)); } /** @return returns the cached movierate, may differ to the real movierate */ inline double getCachedMovieRate() { return _movieRate; } - + /** sets the MovieRate for this movie */ void setMovieRate(double rate); - + /** sets the volume for the soundtrack of this movie */ void setVolume(float volume) { SetMovieVolume(_movie,(short)(ceil(volume*255.0f)));} float getVolume() const { return GetMovieVolume(_movie) / 255.0f; } - + void setAudioBalance(float f) { Float32 balance = f; SetMovieAudioBalance(_movie, balance, 0); } - + float getAudioBalance() { Float32 balance; float f; @@ -77,10 +77,10 @@ f = balance; return f; } - + /** @return true, if this movie is looping */ bool isLooping() const { return _isLooping; } - + /** sets the looping mode */ void setLooping(bool loop) { if (_isLooping != loop) { @@ -95,29 +95,29 @@ } } } - - + + protected: char* _pointer; Movie _movie; GWorldPtr _gw; - + unsigned int _movieWidth, _movieHeight, _textureWidth, _textureHeight; double _timescale; bool _fError; double _movieRate; bool _preRolled; bool _isLooping; - + /** inits the image for storage */ void _initImage(osg::Image* image); - + /** inits the gWorld, where the movie gets drawn into */ void _initGWorldStuff(osg::Image * image); - + /** inits the texture */ void _initTexture(); - + /** checks for an movie-error */ inline void _checkMovieError(std::string msg) { if (GetMoviesError()) { @@ -125,7 +125,7 @@ OSG_ALWAYS << "MovieData: GetMoviesError fails at " << msg << std::endl; } } - + }; diff --git a/src/osgPlugins/quicktime/QTImportExport.cpp b/src/osgPlugins/quicktime/QTImportExport.cpp index 6d98362bd..4082775a3 100644 --- a/src/osgPlugins/quicktime/QTImportExport.cpp +++ b/src/osgPlugins/quicktime/QTImportExport.cpp @@ -20,19 +20,19 @@ class QTImportExportException : public std::exception { public: QTImportExportException(int err, const std::string& msg) : std::exception(), _err(err), _msg(msg) {} - + virtual const char* what() { return _msg.c_str(); } int getErrorCode() { return _err; } - + virtual ~QTImportExportException() throw () {} - + private: int _err; std::string _msg; }; -QuicktimeImportExport::QuicktimeImportExport() -: _error(0), +QuicktimeImportExport::QuicktimeImportExport() +: _error(0), _lastError("") { } @@ -42,7 +42,7 @@ QuicktimeImportExport::QuicktimeImportExport() // flipImage // ---------------------------------------------------------------------------------------------------------- -void QuicktimeImportExport::flipImage(unsigned char* pixels, int bytesPerPixel, unsigned int width, unsigned height) +void QuicktimeImportExport::flipImage(unsigned char* pixels, int bytesPerPixel, unsigned int width, unsigned height) { // Flip the image unsigned imageSize = width * height * bytesPerPixel; @@ -69,11 +69,11 @@ unsigned char* QuicktimeImportExport::pepareBufferForOSG(unsigned char * buffer, unsigned char *dstp = pixels; unsigned char *srcp = buffer; unsigned int i, j; - + int roffset, goffset, boffset, aoffset; aoffset = -1; int sourceStep; - + switch (bytesPerPixel) { case 1: sourceStep = 1; @@ -92,12 +92,12 @@ unsigned char* QuicktimeImportExport::pepareBufferForOSG(unsigned char * buffer, goffset = 3; boffset = 0; break; - + } - - for (i = 0; i < height; ++i ) + + for (i = 0; i < height; ++i ) { - for (j = 0; j < width; ++j ) + for (j = 0; j < width; ++j ) { dstp[0] = (aoffset < 0) ? 0 : srcp[aoffset]; dstp[1] = srcp[roffset]; @@ -105,10 +105,10 @@ unsigned char* QuicktimeImportExport::pepareBufferForOSG(unsigned char * buffer, dstp[3] = srcp[boffset]; srcp+=sourceStep; dstp+=4; - + } } - + flipImage(pixels, bytesPerPixel, width, height); return pixels; @@ -120,17 +120,17 @@ unsigned char* QuicktimeImportExport::pepareBufferForOSG(unsigned char * buffer, // prepareBufferForQuicktime // ---------------------------------------------------------------------------------------------------------- -unsigned char* QuicktimeImportExport::prepareBufferForQuicktime(unsigned char* buffer, GLenum pixelFormat, int bytesPerPixel, unsigned int width, unsigned int height) +unsigned char* QuicktimeImportExport::prepareBufferForQuicktime(unsigned char* buffer, GLenum pixelFormat, int bytesPerPixel, unsigned int width, unsigned int height) { unsigned char *pixels = new unsigned char [height * width * 4]; unsigned char *dstp = pixels; unsigned char *srcp = buffer; unsigned int i, j; - + int roffset, goffset, boffset, aoffset; aoffset = -1; int sourceStep; - + switch (bytesPerPixel) { case 1: sourceStep = 1; @@ -151,7 +151,7 @@ unsigned char* QuicktimeImportExport::prepareBufferForQuicktime(unsigned char* b goffset = 1; boffset = 2; break; - + case GL_BGRA: aoffset = 0; roffset = 1; @@ -160,11 +160,11 @@ unsigned char* QuicktimeImportExport::prepareBufferForQuicktime(unsigned char* b break; } } - - - for (i = 0; i < height; ++i ) + + + for (i = 0; i < height; ++i ) { - for (j = 0; j < width; ++j ) + for (j = 0; j < width; ++j ) { dstp[0] = (aoffset < 0) ? 0 : srcp[aoffset]; dstp[1] = srcp[roffset]; @@ -172,12 +172,12 @@ unsigned char* QuicktimeImportExport::prepareBufferForQuicktime(unsigned char* b dstp[3] = srcp[boffset]; srcp+=sourceStep; dstp+=4; - + } } - + flipImage(pixels, 4, width, height); - + return pixels; } @@ -186,31 +186,31 @@ unsigned char* QuicktimeImportExport::prepareBufferForQuicktime(unsigned char* b // readFromStream // ---------------------------------------------------------------------------------------------------------- -osg::Image* QuicktimeImportExport::readFromStream(std::istream & inStream, const std::string& fileTypeHint, long sizeHint) +osg::Image* QuicktimeImportExport::readFromStream(std::istream & inStream, const std::string& fileTypeHint, long sizeHint) { char* content = NULL; long length = 0; - if (sizeHint != 0) + if (sizeHint != 0) { length = sizeHint; content = new char[length]; inStream.read (content,length); } - else + else { int readBytes(0), newBytes(0); - + char buffer[10240]; - + while (!inStream.eof()) { inStream.read(buffer, 10240); newBytes = inStream.gcount(); if (newBytes > 0) { char* newcontent = new char[readBytes + newBytes]; - + if (readBytes > 0) memcpy(newcontent, content, readBytes); - + memcpy(&newcontent[readBytes], &buffer, newBytes); readBytes += newBytes; if (content) delete[] content; @@ -219,14 +219,14 @@ osg::Image* QuicktimeImportExport::readFromStream(std::istream & inStream, const } length = readBytes; } - + osg::Image* img = doImport(reinterpret_cast(content), length, fileTypeHint); - + if (content) delete[] content; return img; } - - + + Handle getPtrDataRef(unsigned char *data, unsigned int size, const std::string &filename) { // Load Data Reference @@ -235,16 +235,16 @@ Handle getPtrDataRef(unsigned char *data, unsigned int size, const std::string & PointerDataRefRecord ptrDataRefRec; ComponentInstance dataRefHandler; unsigned char pstr[255]; - + ptrDataRefRec.data = data; ptrDataRefRec.dataLength = size; - + /*err = */PtrToHand(&ptrDataRefRec, &dataRef, sizeof(PointerDataRefRecord)); - + // Open a Data Handler for the Data Reference /*err = */OpenADataHandler(dataRef, PointerDataHandlerSubType, NULL, (OSType)0, NULL, kDataHCanRead, &dataRefHandler); - + // Convert From CString in filename to a PascalString in pstr if (filename.length() > 255) { //hmm...not good, pascal string limit is 255! @@ -252,21 +252,21 @@ Handle getPtrDataRef(unsigned char *data, unsigned int size, const std::string & throw QTImportExportException(0, "filename length limit exceeded"); } CopyCStringToPascal(filename.c_str(), pstr); - + // Add filename extension /*err = */PtrToHand(pstr, &fileNameHandle, filename.length() + 1); /*err = */DataHSetDataRefExtension(dataRefHandler, fileNameHandle, kDataRefExtensionFileName); DisposeHandle(fileNameHandle); - + // Release old handler which does not have the extensions DisposeHandle(dataRef); - + // Grab the SAFE_NEW version of the data ref from the data handler /*err = */ DataHGetDataRef(dataRefHandler, &dataRef); - + CloseComponent(dataRefHandler); - + return dataRef; } @@ -284,13 +284,13 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si int depth = 32; unsigned int xsize, ysize; unsigned char* imageData = 0; - + // Data Handle for file data ( & load data from file ) Handle dataRef = getPtrDataRef(data, sizeData, fileTypeHint); - + try { OSErr err = noErr; - + // GraphicsImporter - Get Importer for our filetype GetGraphicsImporterForDataRef(dataRef, 'ptr ', &gicomp); @@ -298,7 +298,7 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si err = GraphicsImportGetNaturalBounds(gicomp, &rectImage); if (err != noErr) { throw QTImportExportException(err, "GraphicsImportGetNaturalBounds failed"); - + } xsize = (unsigned int)(rectImage.right - rectImage.left); ysize = (unsigned int)(rectImage.bottom - rectImage.top); @@ -311,7 +311,7 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si // ImageDescription - Get Bit Depth HLock(reinterpret_cast(desc)); - + // GWorld - Pixel Format stuff pixelFormat = k32ARGBPixelFormat; // Make sure its forced...NOTE: i'm pretty sure this cannot be RGBA! @@ -347,11 +347,11 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si if (!GetGWorldPixMap(gworld) || !LockPixels(GetGWorldPixMap(gworld))) { throw QTImportExportException(0, "GetGWorldPixMap failed"); } - - + + //*** Draw GWorld into our Memory Texture! GraphicsImportDraw(gicomp); - + // Clean up UnlockPixels(GetGWorldPixMap(gworld)); SetGWorld(origPort, origDevice); // set graphics port to offscreen (we don't need it now) @@ -359,11 +359,11 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si CloseComponent(gicomp); DisposeHandle(reinterpret_cast(desc)); DisposeHandle(dataRef); - } - catch (QTImportExportException& e) + } + catch (QTImportExportException& e) { setError(e.what()); - + if (gworld) { UnlockPixels(GetGWorldPixMap(gworld)); SetGWorld(origPort, origDevice); // set graphics port to offscreen (we don't need it now) @@ -371,19 +371,19 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si } if (gicomp) CloseComponent(gicomp); - if (desc) + if (desc) DisposeHandle(reinterpret_cast(desc)); - - if (imageData) + + if (imageData) delete[] imageData; if (dataRef) DisposeHandle(dataRef); - + return NULL; } - - + + unsigned int bytesPerPixel = depth / 8; unsigned int glpixelFormat; switch(bytesPerPixel) { @@ -399,11 +399,11 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si return NULL; break; } - + unsigned char* swizzled = pepareBufferForOSG(imageData, bytesPerPixel, xsize, ysize); - + delete[] imageData; - + osg::Image* image = new osg::Image(); image->setFileName(fileTypeHint.c_str()); image->setImage(xsize,ysize,1, @@ -412,13 +412,13 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si GL_UNSIGNED_BYTE, swizzled, osg::Image::USE_NEW_DELETE ); - - + + return image; } - void QuicktimeImportExport::writeToStream(std::ostream& outStream, osg::Image* image, const std::string& fileTypeHint) + void QuicktimeImportExport::writeToStream(std::ostream& outStream, osg::Image* image, const std::string& fileTypeHint) { std::string ext = osgDB::getFileExtension(fileTypeHint); @@ -438,23 +438,23 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si extmap["rgba"] = kQTFileTypeSGIImage; } - + std::map::iterator cur = extmap.find(ext); - + // can not handle this type of file, perhaps a movie? if (cur == extmap.end()) return; - + unsigned int numBytes = image->computeNumComponents(image->getPixelFormat()); unsigned char* pixels = prepareBufferForQuicktime( image->data(), - image->getPixelFormat(), + image->getPixelFormat(), numBytes, image->s(), image->t() ); - - + + OSType desiredType = cur->second; GraphicsExportComponent geComp = NULL; GWorldPtr gw = 0; @@ -464,22 +464,22 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si try { OSErr err = OpenADefaultComponent(GraphicsExporterComponentType, desiredType, &geComp); Rect bounds = {0,0, image->t(), image->s()}; - + err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &bounds, 0,0,0, pixels, image->s()*4); if (err != noErr) { throw QTImportExportException(err, "could not create gworld for type " + ext); } - + err = GraphicsExportSetInputGWorld(geComp, gw); if (err != noErr) { throw QTImportExportException(err, "could not set input gworld for type " + ext); } - + err = GraphicsExportSetOutputHandle( geComp, dataHandle); if (err != noErr) { throw QTImportExportException(err, "could not set output file for type " + ext); - } - + } + // Set the compression quality (needed for JPEG, not necessarily for other formats) if (desiredType == kQTFileTypeJPEG) { err = GraphicsExportSetCompressionQuality(geComp, codecLosslessQuality); @@ -487,38 +487,38 @@ osg::Image* QuicktimeImportExport::doImport(unsigned char* data, unsigned int si throw QTImportExportException(err, "could not set compression for type " + ext); } } - + if(4 == numBytes) { err = GraphicsExportSetDepth( geComp, k32ARGBPixelFormat ); // depth } // else k24RGBPixelFormat??? - + // do the export err = GraphicsExportDoExport(geComp, NULL); if (err != noErr) { throw QTImportExportException(err, "could not do the export for type " + ext); - } - + } + if (geComp != NULL) CloseComponent(geComp); - + if (gw) DisposeGWorld (gw); if (pixels) free(pixels); - + outStream.write(*dataHandle, GetHandleSize(dataHandle)); DisposeHandle(dataHandle); } - - - catch (QTImportExportException& e) + + + catch (QTImportExportException& e) { setError(e.what()); - - if (geComp != NULL) CloseComponent(geComp); + + if (geComp != NULL) CloseComponent(geComp); if (gw != NULL) DisposeGWorld (gw); if (pixels) free(pixels); - + DisposeHandle(dataHandle); } diff --git a/src/osgPlugins/quicktime/QTImportExport.h b/src/osgPlugins/quicktime/QTImportExport.h index 8c089db19..bed318d9b 100644 --- a/src/osgPlugins/quicktime/QTImportExport.h +++ b/src/osgPlugins/quicktime/QTImportExport.h @@ -18,41 +18,41 @@ class QuicktimeImportExport { public: /** ctor */ QuicktimeImportExport(); - - /** readFromString tries to read a chunk of bytes and interpret it as an image. + + /** readFromString tries to read a chunk of bytes and interpret it as an image. * @param istream the input stream * @param fileTypeHint you can speed up the conversion by providing a filename with extension, so quicktime has not to guess the image's type * @param sizeHint useful, if you are streaming data, if you provide a sizeHint ony sizeHint bytes are read from the stream */ osg::Image* readFromStream(std::istream & inStream, const std::string& fileTypeHint, long sizeHint = 0); - + /** writes an osg::Image to a stream, using fileTypeHint as a hint whar format you want to write. */ void writeToStream(std::ostream& outStream, osg::Image* image, const std::string& fileTypeHint) ; - + /** get the last error-message */ const std::string getLastErrorString() { return _lastError; } - + /** return true if no error occured */ bool success() { return (_error == false); } - + protected: - + /** flips an image */ void flipImage(unsigned char* buffer, int bytesPerPixel, unsigned int width, unsigned height); - + /** do some swizzling, so osg can use the image */ unsigned char* pepareBufferForOSG(unsigned char * buffer, int bytesPerPixel, unsigned int width, unsigned height); - + /** do some swizzling, so quicktime can use the image */ unsigned char* prepareBufferForQuicktime(unsigned char* buffer, GLenum pixelFormat, int bytesPerPixel, unsigned int width, unsigned int height) ; - + /** sets an error-msg */ void setError(const std::string& msg) { _lastError = msg; _error = true; } - + /** do the import */ osg::Image* doImport(unsigned char* buffer, unsigned int dataSize, const std::string& fileTypeHint); - - + + private: bool _error; std::string _lastError; diff --git a/src/osgPlugins/quicktime/QTLiveUtils.cpp b/src/osgPlugins/quicktime/QTLiveUtils.cpp index 093f6a642..9c86e1551 100644 --- a/src/osgPlugins/quicktime/QTLiveUtils.cpp +++ b/src/osgPlugins/quicktime/QTLiveUtils.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -79,7 +79,7 @@ void terminite_quicktime_qtml() #ifndef __APPLE__ TerminateQTML(); #endif - OSG_NOTICE << "QT QTML: Closed successfully" << std::endl; + OSG_NOTICE << "QT QTML: Closed successfully" << std::endl; } void enter_quicktime_movies() @@ -103,7 +103,7 @@ void leave_quicktime_movies() #ifndef __APPLE__ ExitMovies(); #endif - OSG_NOTICE << "QT Movies: closed successfully" << std::endl; + OSG_NOTICE << "QT Movies: closed successfully" << std::endl; } #if TARGET_OS_MAC @@ -128,7 +128,7 @@ void leave_quicktime_movies_mt() #ifndef __APPLE__ ExitMoviesOnThread(); #endif - OSG_NOTICE << "QT Movies MT: closed successfully" << std::endl; + OSG_NOTICE << "QT Movies MT: closed successfully" << std::endl; } #endif @@ -320,8 +320,8 @@ OSG_SGDeviceList print_sequence_grabber_device_list(SGDeviceList deviceList) { short count = (*deviceList)->count; short selectedIndex = (*deviceList)->selectedIndex; - OSG_NOTICE << "DeviceList : " << count << " devices in total" << std::endl; - OSG_NOTICE << "DeviceList : " << selectedIndex << " is current device" << std::endl; + OSG_NOTICE << "DeviceList : " << count << " devices in total" << std::endl; + OSG_NOTICE << "DeviceList : " << selectedIndex << " is current device" << std::endl; // Create List OSG_SGDeviceList device_list; @@ -329,11 +329,11 @@ OSG_SGDeviceList print_sequence_grabber_device_list(SGDeviceList deviceList) for (short i=0; ientry[i]; Str63 deviceNameStr; memcpy(deviceNameStr, deviceNameRec.name, sizeof(Str63)); - OSG_NOTICE << " " << "Device ID : " << i << " : DeviceNameStr : " << pstr_printable(deviceNameStr) << std::endl; + OSG_NOTICE << " " << "Device ID : " << i << " : DeviceNameStr : " << pstr_printable(deviceNameStr) << std::endl; SGDeviceInputList deviceInputList = deviceNameRec.inputs; if (deviceInputList) { @@ -359,7 +359,7 @@ OSG_SGDeviceList print_sequence_grabber_device_list(SGDeviceList deviceList) } else { - OSG_NOTICE << " InputList is empty!" << std::endl; + OSG_NOTICE << " InputList is empty!" << std::endl; } } return device_list; @@ -463,7 +463,7 @@ std::vector probe_sequence_grabber_components() // result = SGInitChannel(gVideoChannel, gSeqGrabber); // if (result != noErr) // { -// OSG_NOTICE << "SGInitChannel - failed!" << std::endl; +// OSG_NOTICE << "SGInitChannel - failed!" << std::endl; // } // Usage result = SGSetChannelUsage (gVideoChannel, seqGrabPreview); @@ -476,18 +476,18 @@ std::vector probe_sequence_grabber_components() result = SGGetChannelDeviceAndInputNames( gVideoChannel, deviceName, inputName, &inputNumber); if (result != noErr) { - OSG_NOTICE << "Could not get DeviceAndInput names from Video SG" << std::endl; + OSG_NOTICE << "Could not get DeviceAndInput names from Video SG" << std::endl; } OSG_NOTICE << "ChannelDeviceAndInputNamesNumber: " << pstr_printable(deviceName) << " : " << pstr_printable(inputName) << " : " << inputNumber << std::endl; SGDeviceList deviceList; result = SGGetChannelDeviceList( gVideoChannel, sgDeviceListIncludeInputs, &deviceList); if (result != noErr) { - OSG_NOTICE << "Could not get DeviceList from Video SG" << std::endl; + OSG_NOTICE << "Could not get DeviceList from Video SG" << std::endl; } else { - OSG_NOTICE << "DeviceList from Video SG ok" << std::endl; + OSG_NOTICE << "DeviceList from Video SG ok" << std::endl; device_list = print_sequence_grabber_device_list(deviceList); devices_list.push_back(device_list); } @@ -504,18 +504,18 @@ std::vector probe_sequence_grabber_components() result = SGGetChannelDeviceAndInputNames( gVideoChannel, deviceName, inputName, &inputNumber); if (result != noErr) { - OSG_NOTICE << "Could not get DeviceAndInput names from Sound SG" << std::endl; + OSG_NOTICE << "Could not get DeviceAndInput names from Sound SG" << std::endl; } OSG_NOTICE << "ChannelDeviceAndInputNamesNumber: " << pstr_printable(deviceName) << " : " << pstr_printable(inputName) << " : " << inputNumber << std::endl; SGDeviceList deviceList; result = SGGetChannelDeviceList( gSoundChannel, sgDeviceListIncludeInputs, &deviceList); if (result != noErr) { - OSG_NOTICE << "Could not get DeviceList from Sound SG" << std::endl; + OSG_NOTICE << "Could not get DeviceList from Sound SG" << std::endl; } else { - OSG_NOTICE << "DeviceList from Sound SG ok" << std::endl; + OSG_NOTICE << "DeviceList from Sound SG ok" << std::endl; device_list = print_sequence_grabber_device_list(deviceList); devices_list.push_back(device_list); } @@ -775,7 +775,7 @@ void get_sound_device_idstr(short soundDeviceID, short soundDeviceInputID, Str63 // You can use the VDSetDigitizerRect function to set the size and location of the digitizer rectangle. // The VDGetDigitizerRect function lets you retrieve the size and location of this rectangle. -// Imput Source +// Imput Source // Some of these functions provide information about the available video inputs. Applications can use // the VDGetNumberOfInputs function to determine the number of video inputs supported by the digitizer component. // The VDGetInputFormat function allows applications to find out the video format (composite, s-video, or component) employed by a specified input. @@ -784,58 +784,58 @@ void get_sound_device_idstr(short soundDeviceID, short soundDeviceInputID, Str63 // The VDSetInputStandard function allows you to specify the video signaling standard to be used by the video digitizer component. /* -QTVideoOutputRestoreState -QTVideoOutputSaveState +QTVideoOutputRestoreState +QTVideoOutputSaveState Selecting an Input Source -VDGetInput -VDGetInputFormat -VDGetNumberOfInputs -VDSetInput -VDSetInputStandard +VDGetInput +VDGetInputFormat +VDGetNumberOfInputs +VDSetInput +VDSetInputStandard Setting Source Characteristics -VDGetActiveSrcRect -VDGetDigitizerRect -VDGetMaxSrcRect -VDGetVBlankRect -VDSetDigitizerRect +VDGetActiveSrcRect +VDGetDigitizerRect +VDGetMaxSrcRect +VDGetVBlankRect +VDSetDigitizerRect Setting Video Destinations -VDGetMaxAuxBuffer -VDGetPlayThruDestination -VDPreflightDestination -VDPreflightGlobalRect -VDSetPlayThruDestination -VDSetPlayThruGlobalRect +VDGetMaxAuxBuffer +VDGetPlayThruDestination +VDPreflightDestination +VDPreflightGlobalRect +VDSetPlayThruDestination +VDSetPlayThruGlobalRect Video Clipping -VDClearClipRgn -VDGetClipState -VDSetClipRgn -VDSetClipState +VDClearClipRgn +VDGetClipState +VDSetClipRgn +VDSetClipState */ /* -QTVideoOutputCopyIndAudioOutputDeviceUID -QTVideoOutputGetIndImageDecompressor -VDGetInputGammaRecord -VDGetInputName -VDGetPreferredImageDimensions -VDIIDCGetCSRData -VDIIDCGetDefaultFeatures -VDIIDCGetFeatures -VDIIDCGetFeaturesForSpecifier -VDIIDCSetCSRData -VDIIDCSetFeatures -VDSetDestinationPort -VDSetInputGammaRecord -VDSetPreferredImageDimensions -VDUseSafeBuffers +QTVideoOutputCopyIndAudioOutputDeviceUID +QTVideoOutputGetIndImageDecompressor +VDGetInputGammaRecord +VDGetInputName +VDGetPreferredImageDimensions +VDIIDCGetCSRData +VDIIDCGetDefaultFeatures +VDIIDCGetFeatures +VDIIDCGetFeaturesForSpecifier +VDIIDCSetCSRData +VDIIDCSetFeatures +VDSetDestinationPort +VDSetInputGammaRecord +VDSetPreferredImageDimensions +VDUseSafeBuffers */ //void test () //{ //if ((i == count-1) && (inp == inputCount-1)) //{ -// OSG_NOTICE << " * TEST SGSetChannelDevice(..) : " << pstr_printable(deviceNameRec.name) << std::endl; +// OSG_NOTICE << " * TEST SGSetChannelDevice(..) : " << pstr_printable(deviceNameRec.name) << std::endl; // result = SGSetChannelDevice (gVideoChannel, deviceNameStr); // if (result == noErr) // { @@ -850,20 +850,20 @@ VDUseSafeBuffers // result = SGGetChannelDeviceList( gVideoChannel, sgDeviceListIncludeInputs, &deviceList); // if (result != noErr) // { -// OSG_NOTICE << "Could not get DeviceList from Video SG" << std::endl; +// OSG_NOTICE << "Could not get DeviceList from Video SG" << std::endl; // } // else // { -// OSG_NOTICE << "DeviceList from Video SG ok" << std::endl; +// OSG_NOTICE << "DeviceList from Video SG ok" << std::endl; // short count = (*deviceList)->count; // short selectedIndex = (*deviceList)->selectedIndex; -// OSG_NOTICE << "DeviceList : " << count << " devices in total" << std::endl; -// OSG_NOTICE << "DeviceList : " << selectedIndex << " is current device" << std::endl; +// OSG_NOTICE << "DeviceList : " << count << " devices in total" << std::endl; +// OSG_NOTICE << "DeviceList : " << selectedIndex << " is current device" << std::endl; // } // } // else // { -// OSG_NOTICE << "SGSetChannelDevice - failed!" << std::endl; +// OSG_NOTICE << "SGSetChannelDevice - failed!" << std::endl; // } // OSG_NOTICE << " * TEST SGSetChannelDevice(..) end" << std::endl; //} diff --git a/src/osgPlugins/quicktime/QTLiveUtils.h b/src/osgPlugins/quicktime/QTLiveUtils.h index 8efd2bada..62901556b 100644 --- a/src/osgPlugins/quicktime/QTLiveUtils.h +++ b/src/osgPlugins/quicktime/QTLiveUtils.h @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -94,7 +94,7 @@ void probe_video_digitizer_components(); // Capability Sequence Grabber OSG_SGDeviceList print_sequence_grabber_device_list(SGDeviceList deviceList); std::vector probe_sequence_grabber_components(); -// +// void get_video_device_bounds_idstr(short videoDeviceID, short videoDeviceInputID, short& out_width, short& out_height, Str63& out_videoDeviceIDStr); void get_sound_device_idstr(short soundDeviceID, short soundDeviceInputID, Str63& out_soundDeviceIDStr); diff --git a/src/osgPlugins/quicktime/QTUtils.h b/src/osgPlugins/quicktime/QTUtils.h index 8e7248984..499c84b3c 100644 --- a/src/osgPlugins/quicktime/QTUtils.h +++ b/src/osgPlugins/quicktime/QTUtils.h @@ -10,11 +10,11 @@ #ifndef QTUTILS_HEADER_ #define QTUTILS_HEADER_ -// Quicktime plugin is able to load regular 2D images -// besides movie streams. +// Quicktime plugin is able to load regular 2D images +// besides movie streams. // It is used as default image loader on __APPLE__ // Uncomment this define to use it as image loader -// on other platforms. +// on other platforms. // #define QT_HANDLE_IMAGES_ALSO #ifdef __APPLE__ @@ -42,14 +42,14 @@ inline PixMapHandle GetPortPixMap (CGrafPtr port) { return port->portPixMap; } - + } #define SetRect MacSetRect #define OffsetRect MacOffsetRect #endif - + #endif diff --git a/src/osgPlugins/quicktime/QuicktimeImageStream.cpp b/src/osgPlugins/quicktime/QuicktimeImageStream.cpp index ead6f6bb9..422dcb064 100644 --- a/src/osgPlugins/quicktime/QuicktimeImageStream.cpp +++ b/src/osgPlugins/quicktime/QuicktimeImageStream.cpp @@ -4,10 +4,10 @@ * Copyright (C) 2004 Stephan Huber http://digitalmind.de * * -* The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for -* real-time rendering of large 3D photo-realistic models. +* The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for +* real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ -* +* * This software is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -70,10 +70,10 @@ QuicktimeImageStream::~QuicktimeImageStream() quit(true); } - + // clean up quicktime movies. delete _movieData; - + } @@ -152,14 +152,14 @@ void QuicktimeImageStream::run() ThreadCommand cmd = getCmd(); - OSG_DEBUG << "movietime: " << _movieData->getMovieTime() << " rate: " << _movieData->getMovieRate() << " state " << cmd << " playing: " << playing << " done " << done << " " << _wrIndex << "/" << _rdIndex << std::endl; - // Handle commands + OSG_DEBUG << "movietime: " << _movieData->getMovieTime() << " rate: " << _movieData->getMovieRate() << " state " << cmd << " playing: " << playing << " done " << done << " " << _wrIndex << "/" << _rdIndex << std::endl; + // Handle commands { if (cmd != THREAD_IDLE) { OSG_DEBUG << "new cmd: " << cmd << std::endl; switch (cmd) { case THREAD_START: // Start or continue stream - applyLoopingMode(); + applyLoopingMode(); _movieData->setMovieRate(1.0); playing = true; @@ -212,7 +212,7 @@ void QuicktimeImageStream::run() } - if (_lastUpdate!= _current) + if (_lastUpdate!= _current) { // force the texture to update the image dirty(); diff --git a/src/osgPlugins/quicktime/QuicktimeImageStream.h b/src/osgPlugins/quicktime/QuicktimeImageStream.h index 21aaa162a..b4c322e45 100644 --- a/src/osgPlugins/quicktime/QuicktimeImageStream.h +++ b/src/osgPlugins/quicktime/QuicktimeImageStream.h @@ -3,8 +3,8 @@ /* * Copyright (C) 2004 Stephan Huber http://digitalmind.de * -* The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for -* real-time rendering of large 3D photo-realistic models. +* The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for +* real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ * * This software is free software; you can redistribute it and/or modify @@ -70,9 +70,9 @@ public: } /// Pause stream at current position. - virtual void pause() + virtual void pause() { - setCmd(THREAD_STOP); + setCmd(THREAD_STOP); // ricky _status = ImageStream::PAUSED; } @@ -83,16 +83,16 @@ public: /// forward stream to the end virtual void forward() { setCmd(THREAD_FORWARD); } - /// stop playing + /// stop playing virtual void quit(bool wiatForThreadToExit); /// Get total length in seconds. virtual double getLength() const - { + { return double(_len); } - /// jumps to a specific position + /// jumps to a specific position void jumpTo(double pos) { setCmd(THREAD_SEEK, pos); } @@ -116,19 +116,19 @@ public: } /// Return the current position in the stream. virtual double getReferenceTime() const - { + { return double(getCurrentTime()); } - + // Set the time multiplier if you want to speed up, // slow down, or go normal speed. virtual void setTimeMultiplier(double multiplier) { setMovieRate(multiplier); } - + virtual double getTimeMultiplier() - { + { return 0.0; } diff --git a/src/osgPlugins/quicktime/QuicktimeLiveImageStream.cpp b/src/osgPlugins/quicktime/QuicktimeLiveImageStream.cpp index b8b407beb..bc3ad7994 100644 --- a/src/osgPlugins/quicktime/QuicktimeLiveImageStream.cpp +++ b/src/osgPlugins/quicktime/QuicktimeLiveImageStream.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,7 +43,7 @@ QuicktimeLiveImageStream::QuicktimeLiveImageStream(std::string fileName) : Image // Initialise QT // initialize_quicktime_qtml(); // enter_quicktime_movies(); - // + // load(fileName); } @@ -73,7 +73,7 @@ void QuicktimeLiveImageStream::pause() { OSG_DEBUG<<"Sending pause"<getOptionString()); std::string opt; - while (iss >> opt) + while (iss >> opt) { int index = opt.find( "=" ); if( opt.substr( 0, index ) == "filename" || @@ -389,17 +389,17 @@ public: } _qtExitObserver.init(); - + QuicktimeImportExport importer; osg::ref_ptr image = importer.readFromStream(is, filename, sizeHint); - + if (!importer.success() || (image == NULL)) { OSG_WARN << "Error reading from stream " << importer.getLastErrorString() << std::endl; return ReadResult::ERROR_IN_READING_FILE; } _qtExitObserver.addMedia(image.get()); return image.release(); - + } virtual WriteResult writeImage(const osg::Image &img,const std::string& fileName, const osgDB::ReaderWriter::Options*) const @@ -421,7 +421,7 @@ public: extmap.insert(std::pair("gif", kQTFileTypeGIF)); extmap.insert(std::pair("psd", kQTFileTypePhotoShop)); extmap.insert(std::pair("sgi", kQTFileTypeSGIImage)); - + std::map::iterator cur = extmap.find(ext); // can not handle this type of file, perhaps a movie? @@ -429,26 +429,26 @@ public: return WriteResult::FILE_NOT_HANDLED; osgDB::ofstream os(fileName.c_str(), std::ios::binary | std::ios::trunc | std::ios::out); - if(os.good()) + if(os.good()) { QuicktimeImportExport exporter; exporter.writeToStream(os, const_cast(&img), fileName); - - if (exporter.success()) - return WriteResult::FILE_SAVED; - } - return WriteResult::ERROR_IN_WRITING_FILE; + if (exporter.success()) + return WriteResult::FILE_SAVED; + } + + return WriteResult::ERROR_IN_WRITING_FILE; } - + virtual WriteResult writeImage (const osg::Image& img, std::ostream& os, const Options* options=NULL) const { std::string filename = "file.jpg"; // use jpeg if not otherwise specified - + if (options) { std::istringstream iss(options->getOptionString()); std::string opt; - while (iss >> opt) + while (iss >> opt) { int index = opt.find( "=" ); if( opt.substr( 0, index ) == "filename" || @@ -458,16 +458,16 @@ public: } } } - + _qtExitObserver.init(); QuicktimeImportExport exporter; exporter.writeToStream(os, const_cast(&img), filename); - - if (exporter.success()) + + if (exporter.success()) return WriteResult::FILE_SAVED; - - return WriteResult::ERROR_IN_WRITING_FILE; + + return WriteResult::ERROR_IN_WRITING_FILE; } protected: @@ -494,7 +494,7 @@ protected: r->addFileExtensionAlias("mpv", "qt"); r->addFileExtensionAlias("dv", "qt"); r->addFileExtensionAlias("mp4", "qt"); - r->addFileExtensionAlias("m4v", "qt"); + r->addFileExtensionAlias("m4v", "qt"); #endif } diff --git a/src/osgPlugins/rgb/ReaderWriterRGB.cpp b/src/osgPlugins/rgb/ReaderWriterRGB.cpp index 1125d48de..fae67a6c2 100644 --- a/src/osgPlugins/rgb/ReaderWriterRGB.cpp +++ b/src/osgPlugins/rgb/ReaderWriterRGB.cpp @@ -55,7 +55,7 @@ typedef struct _rawImageRec GLint *rowSize; GLenum swapFlag; short bpc; - + typedef unsigned char * BytePtr; bool needsBytesSwapped() @@ -63,7 +63,7 @@ typedef struct _rawImageRec union { int testWord; char testByte[sizeof(int)]; - }endianTest; + }endianTest; endianTest.testWord = 1; if( endianTest.testByte[0] == 1 ) return true; @@ -74,7 +74,7 @@ typedef struct _rawImageRec template inline void swapBytes( T &s ) { - if( sizeof( T ) == 1 ) + if( sizeof( T ) == 1 ) return; T d = s; @@ -135,15 +135,15 @@ static void RawImageClose(rawImageRec *raw) { if (raw) { - + if (raw->tmp) delete [] raw->tmp; if (raw->tmpR) delete [] raw->tmpR; if (raw->tmpG) delete [] raw->tmpG; if (raw->tmpB) delete [] raw->tmpB; if (raw->tmpA) delete [] raw->tmpA; - if (raw->rowStart) delete [] raw->rowStart; - if (raw->rowSize) delete [] raw->rowSize; + if (raw->rowStart) delete [] raw->rowStart; + if (raw->rowSize) delete [] raw->rowSize; delete raw; } @@ -238,7 +238,7 @@ static rawImageRec *RawImageOpen(std::istream& fin) return NULL; } } - + if ((raw->type & 0xFF00) == 0x0100) { unsigned int ybyz = raw->sizeY * raw->sizeZ; @@ -295,24 +295,24 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) tempShort++; iPtr = reinterpret_cast(tempShort); } - + if(raw->bpc != 1) ConvertShort(&pixel, 1); count = (int)(pixel & 0x7F); - + // limit the count value to the remiaing row size if (raw->sizeX*raw->bpc <= (oPtr - buf)) { count = raw->sizeX - (oPtr - buf) / raw->bpc; } - + if (count<=0) { done = 1; return; } - + if (pixel & 0x80) { while (count--) @@ -324,7 +324,7 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) pixel = *tempShort; tempShort++; iPtr = reinterpret_cast(tempShort); - + ConvertShort(&pixel, 1); tempShort = reinterpret_cast(oPtr); @@ -386,12 +386,12 @@ static void RawImageGetData(rawImageRec *raw, unsigned char **data ) // if (width!=raw->sizeX) width += 4; // byte aligned. - + OSG_INFO<<"raw->sizeX = "<sizeX<sizeY = "<sizeY<sizeZ = "<sizeZ<bpc = "<bpc<sizeX)*(raw->sizeY)*(raw->sizeZ)*(raw->bpc)]; ptr = *data; @@ -456,7 +456,7 @@ static void RawImageGetData(rawImageRec *raw, unsigned char **data ) class ReaderWriterRGB : public osgDB::ReaderWriter { public: - + ReaderWriterRGB() { supportsExtension("rgb","rgb image format"); @@ -466,9 +466,9 @@ class ReaderWriterRGB : public osgDB::ReaderWriter supportsExtension("inta","inta image format"); supportsExtension("bw","bw image format"); } - + virtual const char* className() const { return "RGB Image Reader/Writer"; } - + ReadResult readRGBStream(std::istream& fin) const { rawImageRec *raw; @@ -629,7 +629,7 @@ class ReaderWriterRGB : public osgDB::ReaderWriter } } - + if( raw.needsBytesSwapped() ) raw.swapBytes(); @@ -670,7 +670,7 @@ class ReaderWriterRGB : public osgDB::ReaderWriter OSG_NOTICE<<"Warning: RGB plugin does not supporting writing non contiguous imagery."<getOrCreateStateSet(); ss->setMode( GL_NORMALIZE, osg::StateAttribute::ON ); #endif - + return xform; } }; diff --git a/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp b/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp index a45fbad31..a72e51119 100644 --- a/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp +++ b/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp @@ -1,9 +1,9 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -77,7 +77,7 @@ public: supportsExtension("osgShadow","OpenSceneGraph osgShadow extension to .osg ascii format"); supportsExtension("shadow","OpenSceneGraph osgShadow extension pseudo loader"); } - + virtual const char* className() const { return "osgShadow pseudo-loader"; } virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const @@ -97,7 +97,7 @@ public: { return ReadResult::FILE_NOT_HANDLED; } - + if( subFileName.empty()) { OSG_WARN << "Missing subfilename for " EXTENSION_NAME " pseudo-loader" << std::endl; @@ -130,7 +130,7 @@ public: } osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene; - shadowedScene->setShadowTechnique(technique.get()); + shadowedScene->setShadowTechnique(technique.get()); shadowedScene->addChild( node ); return shadowedScene; } diff --git a/src/osgPlugins/shp/ESRIShape.cpp b/src/osgPlugins/shp/ESRIShape.cpp index 492f1acac..dd01c6aeb 100644 --- a/src/osgPlugins/shp/ESRIShape.cpp +++ b/src/osgPlugins/shp/ESRIShape.cpp @@ -2,12 +2,12 @@ #if defined(_MSC_VER) || defined(__MINGW32__) #include #include - + namespace esri { int read(int fd, void * buf, size_t nbytes) { return _read(fd, buf, static_cast(nbytes)); } } - + #else #include @@ -16,7 +16,7 @@ int read(int fd, void * buf, size_t nbytes) { return ::read(fd, buf, nbytes); } } -#endif +#endif #include "ESRIShape.h" @@ -51,7 +51,7 @@ template inline bool readVal( int fd, T &val, ByteOrder bo = LittleEndian ) { int nbytes = 0; - if( (nbytes = esri::read( fd, &val, sizeof(T))) <= 0 ) + if( (nbytes = esri::read( fd, &val, sizeof(T))) <= 0 ) return false; if( getByteOrder() != bo ) @@ -128,9 +128,9 @@ void ShapeHeader::print() bbox.print(); } -RecordHeader::RecordHeader(): - recordNumber(-1), - contentLength(0) +RecordHeader::RecordHeader(): + recordNumber(-1), + contentLength(0) { } @@ -149,8 +149,8 @@ void RecordHeader::print() -NullRecord::NullRecord(): - shapeType(ShapeTypeNullShape) +NullRecord::NullRecord(): + shapeType(ShapeTypeNullShape) {} bool NullRecord::read( int fd ) @@ -188,7 +188,7 @@ bool Range::read( int fd ) } ShapeObject::ShapeObject(ShapeType s): - shapeType(s) + shapeType(s) {} ShapeObject::~ShapeObject() @@ -196,16 +196,16 @@ ShapeObject::~ShapeObject() -Point::Point(): - ShapeObject(ShapeTypePoint), +Point::Point(): + ShapeObject(ShapeTypePoint), x(0.0), - y(0.0) + y(0.0) {} -Point::Point(const Point &p): - ShapeObject(ShapeTypePoint), - x(p.x), - y(p.y) +Point::Point(const Point &p): + ShapeObject(ShapeTypePoint), + x(p.x), + y(p.y) {} Point::~Point() {} @@ -240,13 +240,13 @@ void Point::print() printf( " %G %G\n", x, y ); } -MultiPoint::MultiPoint(): - ShapeObject(ShapeTypeMultiPoint), - numPoints(0), - points(0L) +MultiPoint::MultiPoint(): + ShapeObject(ShapeTypeMultiPoint), + numPoints(0), + points(0L) {} -MultiPoint::MultiPoint( const struct MultiPoint &mpoint ): ShapeObject(ShapeTypeMultiPoint), +MultiPoint::MultiPoint( const struct MultiPoint &mpoint ): ShapeObject(ShapeTypeMultiPoint), bbox(mpoint.bbox), numPoints(mpoint.numPoints) { @@ -265,7 +265,7 @@ bool MultiPoint::read( int fd ) RecordHeader rh; if( rh.read(fd) == false ) return false; - + SAFE_DELETE_ARRAY( points ); Integer shapeType; @@ -280,7 +280,7 @@ bool MultiPoint::read( int fd ) if( readVal(fd, numPoints, LittleEndian ) == false ) return false; - + points = new struct Point[numPoints]; for( Integer i = 0; i < numPoints; i++ ) { @@ -299,15 +299,15 @@ void MultiPoint::print() -PolyLine::PolyLine(): - ShapeObject(ShapeTypePolyLine), - numParts(0), - numPoints(0), - parts(0L), +PolyLine::PolyLine(): + ShapeObject(ShapeTypePolyLine), + numParts(0), + numPoints(0), + parts(0L), points(0L) {} PolyLine::PolyLine( const PolyLine &p ): - ShapeObject(ShapeTypePolyLine), + ShapeObject(ShapeTypePolyLine), numParts(p.numParts), numPoints(p.numPoints) { @@ -321,7 +321,7 @@ PolyLine::PolyLine( const PolyLine &p ): points[i] = p.points[i]; } -PolyLine::~PolyLine() +PolyLine::~PolyLine() { delete [] parts; delete [] points; @@ -370,15 +370,15 @@ bool PolyLine::read( int fd ) } -Polygon::Polygon(): - ShapeObject(ShapeTypePolygon), - numParts(0), - numPoints(0), - parts(0L), +Polygon::Polygon(): + ShapeObject(ShapeTypePolygon), + numParts(0), + numPoints(0), + parts(0L), points(0L) {} Polygon::Polygon( const Polygon &p ): - ShapeObject(ShapeTypePolygon), + ShapeObject(ShapeTypePolygon), numParts(p.numParts), numPoints(p.numPoints) { @@ -442,18 +442,18 @@ bool Polygon::read( int fd ) ////////////////////////////////////////////////////////////////////// -PointM::PointM(): - ShapeObject(ShapeTypePointM), +PointM::PointM(): + ShapeObject(ShapeTypePointM), x(0.0), - y(0.0), - m(0.0) + y(0.0), + m(0.0) {} -PointM::PointM(const PointM &p): - ShapeObject(ShapeTypePointM), - x(p.x), - y(p.y), - m(p.m) +PointM::PointM(const PointM &p): + ShapeObject(ShapeTypePointM), + x(p.x), + y(p.y), + m(p.m) {} PointM::~PointM() {} @@ -489,15 +489,15 @@ bool PointMRecord::read( int fd ) } -MultiPointM::MultiPointM(): - ShapeObject(ShapeTypeMultiPointM), - numPoints(0), +MultiPointM::MultiPointM(): + ShapeObject(ShapeTypeMultiPointM), + numPoints(0), points(0L), mArray(0L) {} - MultiPointM::MultiPointM( const struct MultiPointM &mpointm ): - ShapeObject(ShapeTypeMultiPointM), + MultiPointM::MultiPointM( const struct MultiPointM &mpointm ): + ShapeObject(ShapeTypeMultiPointM), bbox(mpointm.bbox), numPoints(mpointm.numPoints), mRange(mpointm.mRange) @@ -538,7 +538,7 @@ bool MultiPointM::read( int fd ) if( readVal(fd, numPoints, LittleEndian ) == false ) return false; - + points = new struct Point[numPoints]; Integer i; for( i = 0; i < numPoints; i++ ) @@ -571,22 +571,22 @@ void MultiPointM::print() points[i].print(); } -PolyLineM::PolyLineM(): - ShapeObject(ShapeTypePolyLineM), - numParts(0), - numPoints(0), - parts(0L), +PolyLineM::PolyLineM(): + ShapeObject(ShapeTypePolyLineM), + numParts(0), + numPoints(0), + parts(0L), points(0L), - mArray(0L) + mArray(0L) {} -PolyLineM::PolyLineM(const PolyLineM &p): - ShapeObject(ShapeTypePolyLineM), - numParts(p.numParts), - numPoints(p.numPoints), - parts(0L), +PolyLineM::PolyLineM(const PolyLineM &p): + ShapeObject(ShapeTypePolyLineM), + numParts(p.numParts), + numPoints(p.numPoints), + parts(0L), points(0L), - mArray(0L) + mArray(0L) { parts = new Integer[numParts]; Integer i; @@ -668,20 +668,20 @@ bool PolyLineM::read( int fd ) } -PolygonM::PolygonM(): - ShapeObject(ShapeTypePolygonM), - numParts(0), - numPoints(0), - parts(0L), +PolygonM::PolygonM(): + ShapeObject(ShapeTypePolygonM), + numParts(0), + numPoints(0), + parts(0L), points(0L) , mArray(0L) {} -PolygonM::PolygonM(const PolygonM &p): - ShapeObject(ShapeTypePolygonM), - numParts(p.numParts), - numPoints(p.numPoints), - parts(0L), +PolygonM::PolygonM(const PolygonM &p): + ShapeObject(ShapeTypePolygonM), + numParts(p.numParts), + numPoints(p.numPoints), + parts(0L), points(0L) , mArray(0L) { @@ -769,20 +769,20 @@ bool PolygonM::read( int fd ) ////////////////////////////////////////////////////////////////////// -PointZ::PointZ(): - ShapeObject(ShapeTypePointZ), +PointZ::PointZ(): + ShapeObject(ShapeTypePointZ), x(0.0), - y(0.0), + y(0.0), z(0.0), - m(0.0) + m(0.0) {} -PointZ::PointZ(const PointZ &p): - ShapeObject(ShapeTypePointZ), - x(p.x), - y(p.y), +PointZ::PointZ(const PointZ &p): + ShapeObject(ShapeTypePointZ), + x(p.x), + y(p.y), z(p.z), - m(p.m) + m(p.m) {} PointZ::~PointZ() {} @@ -822,16 +822,16 @@ void PointZ::print() printf( " %G %G %G (%G)\n", x, y, z, m ); } -MultiPointZ::MultiPointZ(): - ShapeObject(ShapeTypeMultiPointZ), - numPoints(0), +MultiPointZ::MultiPointZ(): + ShapeObject(ShapeTypeMultiPointZ), + numPoints(0), points(0L), zArray(0L), mArray(0L) {} -MultiPointZ::MultiPointZ( const struct MultiPointZ &mpointm ): - ShapeObject(ShapeTypeMultiPointZ), +MultiPointZ::MultiPointZ( const struct MultiPointZ &mpointm ): + ShapeObject(ShapeTypeMultiPointZ), bbox(mpointm.bbox), numPoints(mpointm.numPoints), zRange(mpointm.zRange), @@ -877,7 +877,7 @@ bool MultiPointZ::read( int fd ) if( readVal(fd, numPoints, LittleEndian ) == false ) return false; - + points = new struct Point[numPoints]; Integer i; for( i = 0; i < numPoints; i++ ) @@ -922,24 +922,24 @@ void MultiPointZ::print() } -PolyLineZ::PolyLineZ(): - ShapeObject(ShapeTypePolyLineZ), - numParts(0), - numPoints(0), - parts(0L), +PolyLineZ::PolyLineZ(): + ShapeObject(ShapeTypePolyLineZ), + numParts(0), + numPoints(0), + parts(0L), points(0L), zArray(0L) , - mArray(0L) + mArray(0L) {} -PolyLineZ::PolyLineZ(const PolyLineZ &p): - ShapeObject(ShapeTypePolyLineZ), - numParts(p.numParts), - numPoints(p.numPoints), - parts(0L), +PolyLineZ::PolyLineZ(const PolyLineZ &p): + ShapeObject(ShapeTypePolyLineZ), + numParts(p.numParts), + numPoints(p.numPoints), + parts(0L), points(0L), zArray(0L) , - mArray(0L) + mArray(0L) { parts = new Integer[numParts]; Integer i; @@ -1026,7 +1026,7 @@ bool PolyLineZ::read( int fd ) int Z = Y + 16 + (8 * numPoints); if( rh.contentLength != Z ) - { + { mRange.read(fd); mArray = new Double[numPoints]; for( i = 0; i < numPoints; i++ ) @@ -1040,21 +1040,21 @@ bool PolyLineZ::read( int fd ) } -PolygonZ::PolygonZ(): - ShapeObject(ShapeTypePolygonZ), - numParts(0), - numPoints(0), - parts(0L), +PolygonZ::PolygonZ(): + ShapeObject(ShapeTypePolygonZ), + numParts(0), + numPoints(0), + parts(0L), points(0L), zArray(0L), mArray(0L) {} -PolygonZ::PolygonZ(const PolygonZ &p): - ShapeObject(ShapeTypePolygonZ), - numParts(p.numParts), - numPoints(p.numPoints), - parts(0L), +PolygonZ::PolygonZ(const PolygonZ &p): + ShapeObject(ShapeTypePolygonZ), + numParts(p.numParts), + numPoints(p.numPoints), + parts(0L), points(0L) , mArray(0L) { @@ -1064,14 +1064,14 @@ PolygonZ::PolygonZ(const PolygonZ &p): parts[i] = p.parts[i]; points = new Point[numPoints]; - zArray = new Double[numPoints]; // jcm + zArray = new Double[numPoints]; // jcm mArray = new Double[numPoints]; for( i = 0; i < numPoints; i++ ) { points[i] = p.points[i]; - zArray[i] = p.zArray[i]; // jcm + zArray[i] = p.zArray[i]; // jcm // M-Array seems to be missing sometimes - if(p.mArray) + if(p.mArray) mArray[i] = p.mArray[i]; } } @@ -1089,7 +1089,7 @@ bool PolygonZ::read( int fd ) RecordHeader rh; if( rh.read(fd) == false ) return false; - + SAFE_DELETE_ARRAY( parts ); SAFE_DELETE_ARRAY( points ); SAFE_DELETE_ARRAY( zArray ); diff --git a/src/osgPlugins/shp/ESRIShape.h b/src/osgPlugins/shp/ESRIShape.h index 6e7214458..1f1467429 100644 --- a/src/osgPlugins/shp/ESRIShape.h +++ b/src/osgPlugins/shp/ESRIShape.h @@ -44,7 +44,7 @@ enum ShapeType { }; -struct BoundingBox +struct BoundingBox { Double Xmin; Double Ymin; @@ -62,7 +62,7 @@ struct BoundingBox /////////////// -struct ShapeHeader +struct ShapeHeader { Integer fileCode; Byte _unused_0[20]; @@ -76,7 +76,7 @@ struct ShapeHeader void print(); }; -struct RecordHeader +struct RecordHeader { Integer recordNumber; Integer contentLength; @@ -169,7 +169,7 @@ struct PolyLine: public ShapeObject PolyLine(); - PolyLine( const PolyLine &p ); + PolyLine( const PolyLine &p ); virtual ~PolyLine(); @@ -225,7 +225,7 @@ struct MultiPointM: public ShapeObject Box bbox; Integer numPoints; struct Point *points; - struct Range mRange; + struct Range mRange; Double *mArray; MultiPointM(); @@ -247,7 +247,7 @@ struct PolyLineM: public ShapeObject Integer numPoints; Integer *parts; struct Point *points; - struct Range mRange; + struct Range mRange; Double *mArray; PolyLineM(); @@ -267,7 +267,7 @@ struct PolygonM : public ShapeObject Integer numPoints; Integer *parts; Point *points; - struct Range mRange; + struct Range mRange; Double *mArray; PolygonM(); @@ -305,9 +305,9 @@ struct MultiPointZ: public ShapeObject Box bbox; Integer numPoints; struct Point *points; - struct Range zRange; + struct Range zRange; Double *zArray; - struct Range mRange; + struct Range mRange; Double *mArray; MultiPointZ(); @@ -330,14 +330,14 @@ struct PolyLineZ: public ShapeObject Integer numPoints; Integer *parts; struct Point *points; - struct Range zRange; + struct Range zRange; Double *zArray; - struct Range mRange; + struct Range mRange; Double *mArray; PolyLineZ(); - PolyLineZ( const PolyLineZ &p ); + PolyLineZ( const PolyLineZ &p ); virtual ~PolyLineZ(); @@ -352,9 +352,9 @@ struct PolygonZ : public ShapeObject Integer numPoints; Integer *parts; Point *points; - struct Range zRange; + struct Range zRange; Double *zArray; - struct Range mRange; + struct Range mRange; Double *mArray; PolygonZ(); diff --git a/src/osgPlugins/shp/ESRIShapeParser.cpp b/src/osgPlugins/shp/ESRIShapeParser.cpp index c601036bf..f043517ed 100644 --- a/src/osgPlugins/shp/ESRIShapeParser.cpp +++ b/src/osgPlugins/shp/ESRIShapeParser.cpp @@ -6,7 +6,7 @@ #if defined(_MSC_VER) #include #include -#endif +#endif #include "ESRIShapeParser.h" @@ -44,7 +44,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): { case ESRIShape::ShapeTypeNullShape : break; - + case ESRIShape::ShapeTypePoint : { std::vector pts; @@ -67,7 +67,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): } break; - case ESRIShape::ShapeTypePolyLine : + case ESRIShape::ShapeTypePolyLine : { std::vector plines; ESRIShape::PolyLine pline; @@ -113,7 +113,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process( mptms ); } break; - + case ESRIShape::ShapeTypePolyLineM : { std::vector plinems; @@ -125,7 +125,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process( plinems ); } break; - + case ESRIShape::ShapeTypePolygonM : { std::vector polyms; @@ -137,7 +137,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process( polyms ); } break; - + case ESRIShape::ShapeTypePointZ : { @@ -148,7 +148,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process( ptzs ); } break; - + case ESRIShape::ShapeTypeMultiPointZ : { std::vector mptzs; @@ -160,7 +160,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process( mptzs ); } break; - + case ESRIShape::ShapeTypePolyLineZ : { std::vector plinezs; @@ -172,7 +172,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process( plinezs ); } break; - + case ESRIShape::ShapeTypePolygonZ : { std::vector polyzs; @@ -184,8 +184,8 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process( polyzs ); } break; - - + + case ESRIShape::ShapeTypeMultiPatch : { std::vector mpatches; @@ -197,7 +197,7 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): _process(mpatches); } break; - + default: break; } @@ -209,15 +209,15 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): } } -osg::Geode *ESRIShapeParser::getGeode() -{ - return _geode.get(); +osg::Geode *ESRIShapeParser::getGeode() +{ + return _geode.get(); } void ESRIShapeParser::_combinePointToMultipoint() { if( !_valid ) return; - + OSG_NOTICE<<"_combinePointToMultipoint()"< &lines ) for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; - int len = i < p->numParts - 1 ? + int len = i < p->numParts - 1 ? p->parts[i+1] - p->parts[i] : p->numPoints - p->parts[i]; - geometry->addPrimitiveSet( + geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, index, len)); } _geode->addDrawable( geometry.get() ); @@ -329,11 +329,11 @@ void ESRIShapeParser::_process( const std::vector &polys ) for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; - int len = i < p->numParts - 1 ? + int len = i < p->numParts - 1 ? p->parts[i+1] - p->parts[i] : p->numPoints - p->parts[i]; - geometry->addPrimitiveSet( + geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POLYGON, index, len)); } @@ -407,11 +407,11 @@ void ESRIShapeParser::_process(const std::vector &linems ) for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; - int len = i < p->numParts - 1 ? + int len = i < p->numParts - 1 ? p->parts[i+1] - p->parts[i] : p->numPoints - p->parts[i]; - geometry->addPrimitiveSet( + geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, index, len)); } _geode->addDrawable( geometry.get() ); @@ -436,11 +436,11 @@ void ESRIShapeParser::_process( const std::vector &polyms ) for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; - int len = i < p->numParts - 1 ? + int len = i < p->numParts - 1 ? p->parts[i+1] - p->parts[i] : p->numPoints - p->parts[i]; - geometry->addPrimitiveSet( + geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POLYGON, index, len)); } _geode->addDrawable( geometry.get() ); @@ -505,11 +505,11 @@ void ESRIShapeParser::_process(const std::vector &linezs ) for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; - int len = i < p->numParts - 1 ? + int len = i < p->numParts - 1 ? p->parts[i+1] - p->parts[i] : p->numPoints - p->parts[i]; - geometry->addPrimitiveSet( + geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, index, len)); } _geode->addDrawable( geometry.get() ); @@ -524,7 +524,7 @@ void ESRIShapeParser::_process( const std::vector &polyzs ) for( p = polyzs.begin(); p != polyzs.end(); p++ ) { osg::ref_ptr coords = new osg::Vec3Array; - + int i; for( i = 0; i < p->numPoints; i++ ) coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, p->zArray[i] )); @@ -535,11 +535,11 @@ void ESRIShapeParser::_process( const std::vector &polyzs ) for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; - int len = i < p->numParts - 1 ? + int len = i < p->numParts - 1 ? p->parts[i+1] - p->parts[i] : p->numPoints - p->parts[i]; - geometry->addPrimitiveSet( + geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POLYGON, index, len)); } _geode->addDrawable( geometry.get() ); @@ -554,7 +554,7 @@ void ESRIShapeParser::_process( const std::vector &mpatch for( p = mpatches.begin(); p != mpatches.end(); p++ ) { osg::ref_ptr coords = new osg::Vec3Array; - + int i; for( i = 0; i < p->numPoints; i++ ) coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, p->zArray[i] )); @@ -570,38 +570,38 @@ void ESRIShapeParser::_process( const std::vector &mpatch for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; - int len = i < p->numParts - 1 ? + int len = i < p->numParts - 1 ? p->parts[i+1] - p->parts[i] : p->numPoints - p->parts[i]; - int mode = + int mode = p->partTypes[i] == TriangleStrip ? osg::PrimitiveSet::TRIANGLE_STRIP : p->partTypes[i] == TriangleFan ? osg::PrimitiveSet::TRIANGLE_FAN : // HACK for now p->partTypes[i] == OuterRing ? osg::PrimitiveSet::LINE_STRIP : p->partTypes[i] == InnerRing ? osg::PrimitiveSet::LINE_STRIP : p->partTypes[i] == FirstRing ? osg::PrimitiveSet::LINE_STRIP : - p->partTypes[i] == Ring ? osg::PrimitiveSet::LINE_STRIP : - osg::PrimitiveSet::POINTS ; + p->partTypes[i] == Ring ? osg::PrimitiveSet::LINE_STRIP : + osg::PrimitiveSet::POINTS ; if( p->partTypes[i] == OuterRing || - p->partTypes[i] == InnerRing || + p->partTypes[i] == InnerRing || p->partTypes[i] == FirstRing || p->partTypes[i] == Ring ) { - OSG_WARN << "ESRIShapeParser - MultiPatch type " << + OSG_WARN << "ESRIShapeParser - MultiPatch type " << (p->partTypes[i] == TriangleStrip ? "TriangleStrip": p->partTypes[i] == TriangleFan ? "TriangleFan": p->partTypes[i] == OuterRing ? "OuterRing": p->partTypes[i] == InnerRing ? "InnerRing": p->partTypes[i] == FirstRing ? "FirstRing": - p->partTypes[i] == Ring ? "Ring": "Dunno") << + p->partTypes[i] == Ring ? "Ring": "Dunno") << " poorly supported. Will be represented by a red line strip" << std::endl; } - - + + // Lets mark poorly supported primitives with red, otherwise white - osg::Vec4 color = + osg::Vec4 color = p->partTypes[i] == TriangleStrip ? osg::Vec4(1.0,1.0,1.0,1.0) : p->partTypes[i] == TriangleFan ? osg::Vec4(1.0,1.0,1.0,1.0) : // HACK for now @@ -613,7 +613,7 @@ void ESRIShapeParser::_process( const std::vector &mpatch for( int j = 0; j < len; j++ ) colors->push_back( color ); - geometry->addPrimitiveSet( new osg::DrawArrays(mode, index, len )); + geometry->addPrimitiveSet( new osg::DrawArrays(mode, index, len )); } _geode->addDrawable( geometry.get() ); diff --git a/src/osgPlugins/shp/ESRIShapeParser.h b/src/osgPlugins/shp/ESRIShapeParser.h index ca10e74fa..f980520cc 100644 --- a/src/osgPlugins/shp/ESRIShapeParser.h +++ b/src/osgPlugins/shp/ESRIShapeParser.h @@ -17,12 +17,12 @@ class ArrayHelper else _vec3farray = new osg::Vec3Array; } - osg::Array* get() { return _vec3farray.valid() ? - static_cast(_vec3farray.get()) : + osg::Array* get() { return _vec3farray.valid() ? + static_cast(_vec3farray.get()) : static_cast(_vec3darray.get()); } - unsigned int size() { return _vec3farray.valid() ? - _vec3farray->size() : + unsigned int size() { return _vec3farray.valid() ? + _vec3farray->size() : _vec3darray->size(); } void add(double x, double y, double z) @@ -47,7 +47,7 @@ class ArrayHelper { osg::Vec3Array* vec3Array = dynamic_cast(array); if (vec3Array && indexsize()) add((*vec3Array)[index]); - + osg::Vec3dArray* vec3dArray = dynamic_cast(array); if (vec3dArray && indexsize()) add((*vec3dArray)[index]); } @@ -60,7 +60,7 @@ class ArrayHelper class ESRIShapeParser { public: - + ESRIShapeParser( const std::string fileName, bool useDouble); osg::Geode *getGeode(); @@ -76,12 +76,12 @@ class ESRIShapeParser #endif private: - - - + + + bool _valid; bool _useDouble; - + osg::ref_ptr _geode; void _combinePointToMultipoint(); diff --git a/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp b/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp index 3ddbd9597..a00ea8b83 100644 --- a/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp +++ b/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp @@ -23,7 +23,7 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter } virtual const char* className() { return "ESRI Shape ReaderWriter"; } - + virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"shp"); @@ -35,7 +35,7 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter virtual ReadResult readNode(const std::string& file, const Options* options) const { std::string ext = osgDB::getFileExtension(file); - if (!acceptsExtension(ext)) + if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; std::string fileName = osgDB::findDataFile(file, options); @@ -46,15 +46,15 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter { useDouble = true; } - - + + ESRIShape::ESRIShapeParser sp(fileName, useDouble); - + std::string xbaseFileName(osgDB::getNameLessExtension(fileName) + ".dbf"); ESRIShape::XBaseParser xbp(xbaseFileName); - - + + if (sp.getGeode() && (xbp.getAttributeList().empty() == false)) { if (sp.getGeode()->getNumDrawables() != xbp.getAttributeList().size()) @@ -66,18 +66,18 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter { osg::Geode * geode = sp.getGeode(); unsigned int i = 0; - + ESRIShape::XBaseParser::ShapeAttributeListList::iterator it, end = xbp.getAttributeList().end(); for (it = xbp.getAttributeList().begin(); it != end; ++it, ++i) { geode->getDrawable(i)->setUserData(it->get()); } } - } + } if (sp.getGeode()) { - + std::string projFileName(osgDB::getNameLessExtension(fileName) + ".prj"); if (osgDB::fileExists(projFileName)) { @@ -97,7 +97,7 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter projstring += readline; } - + if (!projstring.empty()) { osgTerrain::Locator* locator = new osgTerrain::Locator; @@ -108,7 +108,7 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter locator->setDefinedInFile(false); } } - + } diff --git a/src/osgPlugins/shp/XBaseParser.cpp b/src/osgPlugins/shp/XBaseParser.cpp index f93d319c7..d9c563c6b 100644 --- a/src/osgPlugins/shp/XBaseParser.cpp +++ b/src/osgPlugins/shp/XBaseParser.cpp @@ -10,7 +10,7 @@ #include #else #include -#endif +#endif #include #include @@ -25,7 +25,7 @@ void XBaseHeader::print() << "LastUpdate = " << 1900 + (int) _lastUpdate[0] << "/" << (int) _lastUpdate[1] << "/" << (int) _lastUpdate[2] << std::endl << "NumRecord = " << _numRecord << std::endl << "HeaderLength = " << _headerLength << std::endl - << "RecordLength = " << _recordLength << std::endl; + << "RecordLength = " << _recordLength << std::endl; } bool XBaseHeader::read(int fd) @@ -45,10 +45,10 @@ bool XBaseHeader::read(int fd) if ((nbytes = ::read( fd, &_mdxflag, sizeof(_mdxflag))) <= 0) return false; if ((nbytes = ::read( fd, &_languageDriver, sizeof(_languageDriver))) <= 0) return false; if ((nbytes = ::read( fd, &_reserved2, sizeof(_reserved2))) <= 0) return false; - + return true; } - + void XBaseFieldDescriptor::print() { OSG_INFO << "name = " << _name << std::endl @@ -63,7 +63,7 @@ void XBaseFieldDescriptor::print() bool XBaseFieldDescriptor::read(int fd) { int nbytes = 0; - + if ((nbytes = ::read( fd, &_name, sizeof(_name))) <= 0) return false; if ((nbytes = ::read( fd, &_fieldType, sizeof(_fieldType))) <= 0) return false; if ((nbytes = ::read( fd, &_fieldDataAddress, sizeof(_fieldDataAddress))) <= 0) return false; @@ -75,7 +75,7 @@ bool XBaseFieldDescriptor::read(int fd) if ((nbytes = ::read( fd, &_setFieldFlag, sizeof(_setFieldFlag))) <= 0) return false; if ((nbytes = ::read( fd, &_reserved, sizeof(_reserved))) <= 0) return false; if ((nbytes = ::read( fd, &_indexFieldFlag, sizeof(_indexFieldFlag))) <= 0) return false; - + return true; } @@ -97,63 +97,63 @@ XBaseParser::XBaseParser(const std::string fileName): return; } } - + _valid = parse(fd); } - + bool XBaseParser::parse(int fd) -{ +{ int nbytes; XBaseHeader _xBaseHeader; std::vector _xBaseFieldDescriptorList; XBaseFieldDescriptor _xBaseFieldDescriptorTmp; - + // ** read the header if (_xBaseHeader.read(fd) == false) return false; // _xBaseHeader.print(); - - + + // ** read field descriptor bool fieldDescriptorDone = false; Byte nullTerminator; - + while (fieldDescriptorDone == false) { // ** store the field descriptor if (_xBaseFieldDescriptorTmp.read(fd) == false) return false; _xBaseFieldDescriptorList.push_back(_xBaseFieldDescriptorTmp); // _xBaseFieldDescriptorTmp.print(); - - // ** check the terminator - if ((nbytes = ::read( fd, &nullTerminator, sizeof(nullTerminator))) <= 0) return false; - if (nullTerminator == 0x0D) + + // ** check the terminator + if ((nbytes = ::read( fd, &nullTerminator, sizeof(nullTerminator))) <= 0) return false; + if (nullTerminator == 0x0D) fieldDescriptorDone = true; else ::lseek( fd, -1, SEEK_CUR); } - + // ** move to the end of the Header ::lseek( fd, _xBaseHeader._headerLength + 1, SEEK_SET); - - + + // ** reserve AttributeListList _shapeAttributeListList.reserve(_xBaseHeader._numRecord); - - + + // ** read each record and store them in the ShapeAttributeListList char* record = new char[_xBaseHeader._recordLength]; - + std::vector::iterator it, end = _xBaseFieldDescriptorList.end(); for (Integer i = 0; i < _xBaseHeader._numRecord; ++i) { - if ((nbytes = ::read( fd, record, _xBaseHeader._recordLength)) <= 0) return false; - + if ((nbytes = ::read( fd, record, _xBaseHeader._recordLength)) <= 0) return false; + char * recordPtr = record; osgSim::ShapeAttributeList * shapeAttributeList = new osgSim::ShapeAttributeList; shapeAttributeList->reserve(_xBaseFieldDescriptorList.size()); - + for (it = _xBaseFieldDescriptorList.begin(); it != end; ++it) { switch (it->_fieldType) @@ -163,7 +163,7 @@ bool XBaseParser::parse(int fd) char* str = new char[it->_fieldLength + 1]; memcpy(str, recordPtr, it->_fieldLength); str[it->_fieldLength] = 0; - shapeAttributeList->push_back(osgSim::ShapeAttribute((const char *) it->_name, (char*) str)); + shapeAttributeList->push_back(osgSim::ShapeAttribute((const char *) it->_name, (char*) str)); delete [] str; break; } @@ -197,20 +197,20 @@ bool XBaseParser::parse(int fd) shapeAttributeList->push_back(osgSim::ShapeAttribute((const char *) it->_name, (double) 0)); break; } - - + + } - + recordPtr += it->_fieldLength; } - + _shapeAttributeListList.push_back(shapeAttributeList); } - + delete [] record; - + close (fd); - + return true; } diff --git a/src/osgPlugins/shp/XBaseParser.h b/src/osgPlugins/shp/XBaseParser.h index 9703f1730..94fcfc0a3 100644 --- a/src/osgPlugins/shp/XBaseParser.h +++ b/src/osgPlugins/shp/XBaseParser.h @@ -32,7 +32,7 @@ struct XBaseHeader Byte _mdxflag; Byte _languageDriver; Short _reserved2; - + void print(); bool read(int fd); }; @@ -50,7 +50,7 @@ struct XBaseFieldDescriptor Byte _setFieldFlag; Byte _reserved[7]; Byte _indexFieldFlag; - + void print(); bool read(int fd); }; @@ -59,9 +59,9 @@ struct XBaseFieldDescriptor class XBaseParser { public: - + typedef std::vector< osg::ref_ptr > ShapeAttributeListList; - + XBaseParser(const std::string fileName); ~XBaseParser() {} ShapeAttributeListList & getAttributeList() { return _shapeAttributeListList; } @@ -69,9 +69,9 @@ class XBaseParser private: XBaseParser(); - + bool parse(int fd); - + ShapeAttributeListList _shapeAttributeListList; bool _valid; }; diff --git a/src/osgPlugins/stl/ReaderWriterSTL.cpp b/src/osgPlugins/stl/ReaderWriterSTL.cpp index 1bbf793e8..185af3b64 100644 --- a/src/osgPlugins/stl/ReaderWriterSTL.cpp +++ b/src/osgPlugins/stl/ReaderWriterSTL.cpp @@ -90,7 +90,7 @@ private: { OSG_INFO << "ReaderWriterSTL::writeNode: Files are separated written" << std::endl; } else { - m_f = new osgDB::ofstream(m_fout.c_str()); + m_f = new osgDB::ofstream(m_fout.c_str()); *m_f << "solid " << counter << std::endl; } }; @@ -101,31 +101,31 @@ private: return buf; } - virtual void apply( osg::Geode& node ){ + virtual void apply( osg::Geode& node ){ osg::Matrix mat = osg::computeLocalToWorld( getNodePath() ); - + if (m_options && (m_options->getOptionString() == "separateFiles")) { std::string sepFile = m_fout + i2s(counter); m_f = new osgDB::ofstream(sepFile.c_str()); *m_f << "solid " << std::endl; } - + for ( unsigned int i = 0; i < node.getNumDrawables(); ++i ) { osg::TriangleFunctor tf; tf.m_stream = m_f; tf.m_mat = mat; node.getDrawable( i )->accept( tf ); } - + if (m_options && (m_options->getOptionString() == "separateFiles")) { *m_f << "endsolid " << std::endl; m_f->close(); delete m_f; } - + ++counter; traverse(node); - + } // nHandle->SetLocation( Frame( mat ) ); ~CreateStlVisitor() { @@ -137,17 +137,17 @@ private: delete m_f; } } - + const std::string& getErrorString() const { return m_ErrorString; } - + private: int counter; std::ofstream* m_f; std::string m_fout; osgDB::ReaderWriter::Options const * m_options; std::string m_ErrorString; - - + + struct PushPoints { std::ofstream* m_stream; osg::Matrix m_mat; @@ -166,14 +166,14 @@ private: *m_stream << "endloop" << std::endl; *m_stream << "endfacet " << std::endl; } - + }; - - + + }; - - - + + + }; @@ -238,7 +238,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterSTL::readNode(const std::string& fil osg::swapBytes4((char*) &expectFacets); } off_t expectLen = sizeof_StlHeader + expectFacets * sizeof_StlFacet; - + struct stat stb; if (fstat(fileno(fp), &stb) < 0) { @@ -264,7 +264,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterSTL::readNode(const std::string& fil return ReadResult::ERROR_IN_READING_FILE; } - if (!isBinary) + if (!isBinary) { fclose(fp); fp = osgDB::fopen(fileName.c_str(), "r"); @@ -279,7 +279,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterSTL::readNode(const std::string& fil { return ReadResult::FILE_NOT_HANDLED; } - + OSG_INFO << "STL loader found " << readerObject._numFacets << " facets" << std::endl; /* @@ -301,7 +301,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterSTL::readNode(const std::string& fil osg::Geode* geode = new osg::Geode; geode->addDrawable(geom); - + if (options && (options->getOptionString() == "smooth")) { osgUtil::SmoothingVisitor smooter; geode->accept(smooter); @@ -476,7 +476,7 @@ osgDB::ReaderWriter::WriteResult ReaderWriterSTL::writeNode(const osg::Node& nod OSG_INFO << "ReaderWriterSTL::writeNode: Only STL-ASCII-files supported'" << std::endl; return WriteResult::FILE_NOT_HANDLED; } - + CreateStlVisitor createStlVisitor( fileName, opts ); const_cast(node).accept( createStlVisitor ); diff --git a/src/osgPlugins/svg/ReaderWriterSVG.cpp b/src/osgPlugins/svg/ReaderWriterSVG.cpp index f44447b85..1fb3b5cb7 100644 --- a/src/osgPlugins/svg/ReaderWriterSVG.cpp +++ b/src/osgPlugins/svg/ReaderWriterSVG.cpp @@ -1,6 +1,6 @@ /* -*-c++-*- Copyright (C) 2008 Miguel Escriva Gregori * - * 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 * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. @@ -32,7 +32,7 @@ class ReaderWriterSVG : public osgDB::ReaderWriter ReaderWriterSVG() { - supportsExtension("svg","Scalar Vector Graphics format"); + supportsExtension("svg","Scalar Vector Graphics format"); rsvg_init(); } @@ -59,7 +59,7 @@ class ReaderWriterSVG : public osgDB::ReaderWriter if (options) { unsigned int w=0, h=0; - std::string op = options->getOptionString(); + std::string op = options->getOptionString(); size_t i = op.find("x"); std::stringstream ss1(op.substr(0, i)); @@ -100,7 +100,7 @@ class ReaderWriterSVG : public osgDB::ReaderWriter cairo_t *cr = cairo_create(cairo_surface); cairo_scale(cr,((float)width)/dimensionData.width, ((float)height)/dimensionData.height); rsvg_handle_render_cairo(handle, cr); - + cairo_destroy(cr); cairo_surface_destroy(cairo_surface); diff --git a/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp b/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp index c4a5cdb65..1ddd972df 100644 --- a/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp +++ b/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp @@ -22,19 +22,19 @@ class ReaderWriterTerrain : public osgDB::ReaderWriter supportsExtension("osgTerrain","OpenSceneGraph terrain extension to .osg ascii format"); supportsExtension("terrain","OpenSceneGraph terrain ascii format"); } - + virtual const char* className() const { return "Terrain ReaderWriter"; } virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* opt) const { std::string ext = osgDB::getLowerCaseFileExtension(file); - + if (osgDB::equalCaseInsensitive(ext,"terrain")) { -#if 0 +#if 0 KeywordValueMap keywordValueMap; parseTerrainString(osgDB::getNameLessExtension(file), keywordValueMap); - + for(KeywordValueMap::iterator itr = keywordValueMap.begin(); itr != keywordValueMap.end(); ++itr) @@ -53,7 +53,7 @@ class ReaderWriterTerrain : public osgDB::ReaderWriter std::string fileName = osgDB::findDataFile( file, opt ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = opt ? static_cast(opt->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -63,7 +63,7 @@ class ReaderWriterTerrain : public osgDB::ReaderWriter return readNode(fin, local_opt.get()); } return 0L; - + } virtual osgDB::ReaderWriter::ReadResult readNode(std::istream& fin, const Options* options) const @@ -119,7 +119,7 @@ class ReaderWriterTerrain : public osgDB::ReaderWriter { pos = str.find_first_not_of(' ',pos); if (pos == std::string::npos) break; - + std::string::size_type semicolon = str.find_first_of(';', pos); std::string::size_type startstatement = pos; std::string::size_type endstatement = std::string::npos; @@ -133,7 +133,7 @@ class ReaderWriterTerrain : public osgDB::ReaderWriter endstatement = str.length()-1; pos = std::string::npos; } - + if (startstatementsetFileName(file); return rr; } - + bool saveTGAStream(const osg::Image& image, std::ostream& fout) const { if (!image.data()) return false; @@ -555,7 +555,7 @@ class ReaderWriterTGA : public osgDB::ReaderWriter int width = image.s(), height = image.t(); int numPerPixel = image.computeNumComponents(pixelFormat); int pixelMultiplier = (image.getDataType()==GL_FLOAT ? 255 : 1); - + // Headers fout.put(0); // Identification field size fout.put(0); // Color map type @@ -569,7 +569,7 @@ class ReaderWriterTGA : public osgDB::ReaderWriter fout.put(height&0xff); fout.put((height&0xff00)>>8); // Height of image fout.put(numPerPixel * 8); // Image pixel size fout.put(0); // Image descriptor - + // Swap red/blue channels for BGR images int r = 0, g = 1, b = 2; if( pixelFormat == GL_BGR || pixelFormat == GL_BGRA ) @@ -602,7 +602,7 @@ class ReaderWriterTGA : public osgDB::ReaderWriter } return true; } - + virtual WriteResult writeImage(const osg::Image& image, std::ostream& fout, const Options*) const { if (saveTGAStream(image, fout)) @@ -610,12 +610,12 @@ class ReaderWriterTGA : public osgDB::ReaderWriter else return WriteResult::ERROR_IN_WRITING_FILE; } - + virtual WriteResult writeImage(const osg::Image& image, const std::string& fileName, const Options* options) const { std::string ext = osgDB::getFileExtension(fileName); if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; - + osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); if (!fout) return WriteResult::ERROR_IN_WRITING_FILE; return writeImage(image, fout, options); diff --git a/src/osgPlugins/tgz/ReaderWriterTGZ.cpp b/src/osgPlugins/tgz/ReaderWriterTGZ.cpp index 7543ed6b4..dcfaf207b 100644 --- a/src/osgPlugins/tgz/ReaderWriterTGZ.cpp +++ b/src/osgPlugins/tgz/ReaderWriterTGZ.cpp @@ -82,17 +82,17 @@ class ReaderWriterTGZ : public osgDB::ReaderWriter fileName.c_str(), dirname, dirname, fileName.c_str()); #endif - + OSG_NOTICE<<"Running command '"< grp = new osg::Group; - + OSG_NOTICE<<"Done"< local_options = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new osgDB::ReaderWriter::Options; local_options->getDatabasePathList().push_front(dirname); @@ -109,8 +109,8 @@ class ReaderWriterTGZ : public osgDB::ReaderWriter ++itr) { std::string file_ext = osgDB::getFileExtension(*itr); - if (!acceptsExtension(file_ext) && - *itr!=std::string(".") && + if (!acceptsExtension(file_ext) && + *itr!=std::string(".") && *itr!=std::string("..")) { osg::Node *node = osgDB::readNodeFile(*itr, local_options.get()); diff --git a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp index 901c845cb..6f61dcd5e 100644 --- a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp +++ b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp @@ -347,7 +347,7 @@ invert_row(unsigned char *ptr, unsigned char *data, int n, int invert, uint16 bi { unsigned short *ptr1 = (unsigned short *)ptr; unsigned short *data1 = (unsigned short *)data; - + while (n--) { if (invert) *ptr1++ = 65535 - *data1++; @@ -358,7 +358,7 @@ invert_row(unsigned char *ptr, unsigned char *data, int n, int invert, uint16 bi { float *ptr1 = (float *)ptr; float *data1 = (float *)data; - + while (n--) { if (invert) *ptr1++ = 1.0 - *data1++; @@ -404,7 +404,7 @@ static void interleave_row(unsigned char *ptr, unsigned short *red1 = (unsigned short *)red; unsigned short *green1 = (unsigned short *)green; unsigned short *blue1 = (unsigned short *)blue; - + while (n--) { *ptr1++ = *red1++; @@ -419,7 +419,7 @@ static void interleave_row(unsigned char *ptr, float *red1 = (float *)red; float *green1 = (float *)green; float *blue1 = (float *)blue; - + while (n--) { *ptr1++ = *red1++; @@ -452,7 +452,7 @@ static void interleave_row(unsigned char *ptr, unsigned short *green1 = (unsigned short *)green; unsigned short *blue1 = (unsigned short *)blue; unsigned short *alpha1 = (unsigned short *)alpha; - + while (n--) { *ptr1++ = *red1++; @@ -468,7 +468,7 @@ static void interleave_row(unsigned char *ptr, float *green1 = (float *)green; float *blue1 = (float *)blue; float *alpha1 = (float *)alpha; - + while (n--) { *ptr1++ = *red1++; @@ -595,7 +595,7 @@ simage_tiff_load(std::istream& fin, TIFFClose(in); return NULL; } - + if (TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w) != 1 || TIFFGetField(in, TIFFTAG_IMAGELENGTH, &h) != 1 || TIFFGetField(in, TIFFTAG_PLANARCONFIG, &config) != 1) @@ -605,7 +605,7 @@ simage_tiff_load(std::istream& fin, return NULL; } - + TIFFGetField(in, TIFFTAG_DATATYPE, &dataType); OSG_INFO<<"TIFFTAG_DATATYPE="< glyphs; @@ -248,7 +248,7 @@ TXFFont::loadFont(std::istream& stream) _chars[' '] = glyph; addGlyph(fontResolution, ' ', glyph); } - + for (unsigned i = 0; i < glyphs.size(); ++i) { // have a special one for that @@ -274,7 +274,7 @@ TXFFont::loadFont(std::istream& stream) glyph->setWidth(float(width)*coord_scale); glyph->setHeight(float(height)*coord_scale); - + // OSG_NOTICE<<"char="<getTileInfo(x,y,lod,info)) return ReadResult::ERROR_IN_READING_FILE; std::vector childrenLoc; osg::ref_ptr tileContent = getTileContent(info,x,y,lod,archive.get(), childrenLoc); - + tileContent->setName("TileContent"); bool asChildren = false; @@ -192,7 +192,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterTXP::local_readNode(const std::strin return tileContent.get(); } - + // For 2.0 and lower we load subtilesLOD_XxY_ID.txp // For 2.1 and over we load subtilesLOD_XxY_ID_NBCHILD_{X_Y_FID_FOFFSET_ZMIN_ZMAX_X_Y_ADDR ....}.txp else if (strncmp(name.c_str(),"sub",3)==0) @@ -442,7 +442,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterTXP::local_readNode(const std::strin //OSG_NOTICE << "Subtiles for " << x << " " << y << " " << lod << " lodaded" << std::endl; return subtiles.get(); } - + return ReadResult::ERROR_IN_READING_FILE; } @@ -457,19 +457,19 @@ void ReaderWriterTXP::createChildrenLocationString(const std::vector ReaderWriterTXP::getArchive(int id, const std::string osg::ref_ptr< TXPArchive > archive = NULL; std::map< int,osg::ref_ptr >::iterator iter = _archives.find(id); - + if (iter != _archives.end()) { archive = iter->second.get(); @@ -663,7 +663,7 @@ class SeamFinder: public osg::NodeVisitor public: SeamFinder(int x, int y, int lod, const TXPArchive::TileInfo& info, TXPArchive *archive ): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), - _x(x), _y(y), _lod(lod), _info(info), _archive(archive) + _x(x), _y(y), _lod(lod), _info(info), _archive(archive) {} virtual void apply(osg::Group& group) @@ -685,7 +685,7 @@ public: protected: osg::Node* seamReplacement(osg::Node* node); - + SeamFinder& operator = (const SeamFinder&) { return *this; } int _x, _y, _lod; @@ -830,11 +830,11 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node) TXPSeamLOD* seam = new TXPSeamLOD(_x, _y, lod, dx, dy); seam->setCenter(loRes->getCenter()); seam->addChild(loRes->getChild(0)); // low res - if (hiRes) + if (hiRes) { seam->addChild(hiRes->getChild(0)); // high res } - + if (nonSeamChildren.empty()) { return seam; @@ -844,10 +844,10 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node) osg::Group* newGroup = new osg::Group; newGroup->addChild(seam); - + for (unsigned int i = 0; i < nonSeamChildren.size(); i++) newGroup->addChild(nonSeamChildren[i]); - + return newGroup; } } @@ -869,12 +869,12 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int osg::Vec3 tileCenter; osg::Group* tileGroup = archive->getTileContent(x,y,lod,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); - // if group has only one child, then simply use its child. + // if group has only one child, then simply use its child. while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) { tileGroup = tileGroup->getChild(0)->asGroup(); } - + bool doSeam = false; if(majorVersion == 2 && minorVersion >= 1) doSeam = (childrenLoc.size() > 0); @@ -905,12 +905,12 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, con osg::Vec3 tileCenter; osg::Group* tileGroup = archive->getTileContent(loc,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); - // if group has only one child, then simply use its child. + // if group has only one child, then simply use its child. while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) { tileGroup = tileGroup->getChild(0)->asGroup(); } - + // Handle seams if (childrenLoc.size() > 0) { diff --git a/src/osgPlugins/txp/ReaderWriterTXP.h b/src/osgPlugins/txp/ReaderWriterTXP.h index a49beb98e..17ca4a5f2 100644 --- a/src/osgPlugins/txp/ReaderWriterTXP.h +++ b/src/osgPlugins/txp/ReaderWriterTXP.h @@ -1,17 +1,17 @@ -/*************************************************************************** +/*************************************************************************** * December 2003 * - * This TerraPage loader was re-written in a fashion to use PagedLOD - * to manage paging entirely, also includes a version of Terrex's smart mesh - * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, + * This TerraPage loader was re-written in a fashion to use PagedLOD + * to manage paging entirely, also includes a version of Terrex's smart mesh + * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, * slight modified. * nick at terrex dot com - * + * * Ported to PagedLOD technology by Trajce Nikolov (Nick) & Robert Osfield *****************************************************************************/ /*************************************************************************** - * OpenSceneGraph loader for Terrapage format database + * OpenSceneGraph loader for Terrapage format database * by Boris Bralo 2002 * * based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh @@ -63,19 +63,19 @@ public: { return "TXP Reader/Writer"; } - + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { if( !acceptsExtension(osgDB::getFileExtension(file) )) return ReadResult::FILE_NOT_HANDLED; - + OpenThreads::ScopedLock lock(_serializerMutex); return const_cast(this)->local_readNode(file, options); } bool removeArchive( int id ); - + protected: @@ -84,14 +84,14 @@ protected: std::string getArchiveName(const std::string& dir); osg::ref_ptr< TXPArchive > createArchive(int id, const std::string& dir); osg::ref_ptr< TXPArchive > getArchive(int id, const std::string&); - + osg::Node* getTileContent(const TXPArchive::TileInfo &info, int x, int y, int lod, TXPArchive* archive, std::vector& childrenLoc); osg::Node* getTileContent(const TXPArchive::TileInfo &info, const TXPArchive::TileLocationInfo& loc, TXPArchive* archive, std::vector& childrenLoc); void createChildrenLocationString(const std::vector& locs, std::string& locString) const; bool extractChildrenLocations(const std::string& name, int parentLod, std::vector& locs, int nbChild) const; mutable OpenThreads::ReentrantMutex _serializerMutex; - + std::map< int,osg::ref_ptr > _archives; static int _archiveId; }; diff --git a/src/osgPlugins/txp/TXPArchive.cpp b/src/osgPlugins/txp/TXPArchive.cpp index 75f4b9bb1..3fa00f25e 100644 --- a/src/osgPlugins/txp/TXPArchive.cpp +++ b/src/osgPlugins/txp/TXPArchive.cpp @@ -91,13 +91,13 @@ void TXPArchive::getExtents(osg::BoundingBox& extents) extents.set(sw.bbox._min, sw.bbox._max); extents.expandBy(ne.bbox); } - + bool TXPArchive::openFile(const std::string& archiveName) { std::string path = osgDB::getFilePath(archiveName); std::string name = osgDB::getSimpleFileName(archiveName); - + if(path.empty()) { SetDirectory("."); @@ -109,7 +109,7 @@ bool TXPArchive::openFile(const std::string& archiveName) osgDB::getDataFilePathList().push_front(path); SetDirectory(path.c_str()); } - + if (!OpenFile(name.c_str())) { TXPArchiveERROR("openFile()") << "couldn't open archive: " << archiveName << std::endl; @@ -153,14 +153,14 @@ bool TXPArchive::loadMaterial(int ix) return true; osg::StateSet* osg_state_set = new osg::StateSet; - + const trpgMaterial *mat; mat = materialTable.GetMaterialRef(0,i); // Set texture int numMatTex; mat->GetNumTexture(numMatTex); - + // TODO : multitextuting // also note that multitexturing in terrapage can came from two sides // - multiple textures per material, and multiple materials per geometry @@ -169,32 +169,32 @@ bool TXPArchive::loadMaterial(int ix) if( numMatTex ) { osg::Material *osg_material = new osg::Material; - + float64 alpha; mat->GetAlpha(alpha); - + trpgColor color; mat->GetAmbient(color); - osg_material->setAmbient( osg::Material::FRONT_AND_BACK , + osg_material->setAmbient( osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); mat->GetDiffuse(color); - osg_material->setDiffuse(osg::Material::FRONT_AND_BACK , + osg_material->setDiffuse(osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); - + mat->GetSpecular(color); - osg_material->setSpecular(osg::Material::FRONT_AND_BACK , + osg_material->setSpecular(osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); mat->GetEmission(color); - osg_material->setEmission(osg::Material::FRONT_AND_BACK , + osg_material->setEmission(osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); float64 shinines; mat->GetShininess(shinines); osg_material->setShininess(osg::Material::FRONT_AND_BACK , (float)shinines); - + osg_material->setAlpha(osg::Material::FRONT_AND_BACK ,(float)alpha); osg_state_set->setAttributeAndModes(osg_material, osg::StateAttribute::ON); - + SetUserDataToMaterialAttributes(*osg_state_set, *mat); if( alpha < 1.0f ) @@ -202,7 +202,7 @@ bool TXPArchive::loadMaterial(int ix) osg_state_set->setMode(GL_BLEND,osg::StateAttribute::ON); osg_state_set->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); } - + int alphaFunc; mat->GetAlphaFunc(alphaFunc); if( alphaFunc>=GL_NEVER && alphaFunc<=GL_ALWAYS) @@ -213,13 +213,13 @@ bool TXPArchive::loadMaterial(int ix) osg_alpha_func->setFunction((osg::AlphaFunc::ComparisonFunction)alphaFunc,(float)ref); osg_state_set->setAttributeAndModes(osg_alpha_func, osg::StateAttribute::ON); } - + for (int ntex = 0; ntex < numMatTex; ntex ++ ) { int texId; trpgTextureEnv texEnv; mat->GetTexture(ntex,texId,texEnv); - + // Set up texture environment osg::TexEnv *osg_texenv = new osg::TexEnv(); int32 te_mode; @@ -239,10 +239,10 @@ bool TXPArchive::loadMaterial(int ix) osg_texenv->setMode(osg::TexEnv::MODULATE); break; } - + osg_state_set->setTextureAttribute(ntex,osg_texenv); - int wrap_s, wrap_t; + int wrap_s, wrap_t; texEnv.GetWrap(wrap_s, wrap_t); loadTexture(texId); @@ -302,20 +302,20 @@ bool TXPArchive::loadMaterial(int ix) break; } - // pass on to the stateset. + // pass on to the stateset. osg_state_set->setTextureAttributeAndModes(ntex,osg_texture, osg::StateAttribute::ON); if(osg_texture->getImage() && osg_texture->getImage()->isImageTranslucent()) - { + { osg_state_set->setMode(GL_BLEND,osg::StateAttribute::ON); osg_state_set->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); } - } + } } - + int cullMode; mat->GetCullMode(cullMode); - + // Culling mode in txp means opposite from osg i.e. Front-> show front face if( cullMode != trpgMaterial::FrontAndBack) { @@ -345,8 +345,8 @@ bool TXPArchive::loadMaterials() bool TXPArchive::loadTexture(int i) { if (GetTexMapEntry(i).get()) - return true; - + return true; + bool separateGeo = false; int majorVer,minorVer; GetVersion(majorVer,minorVer); @@ -358,7 +358,7 @@ bool TXPArchive::loadTexture(int i) const trpgTexture *tex; tex = texTable.GetTextureRef(i); - if (!tex) + if (!tex) return false; trpgTexture::ImageMode mode; @@ -372,9 +372,9 @@ bool TXPArchive::loadTexture(int i) // Create a texture by name. osg::ref_ptr osg_texture = new osg::Texture2D(); - // make sure the Texture unref's the Image after apply, when it is no longer needed. + // make sure the Texture unref's the Image after apply, when it is no longer needed. osg_texture->setUnRefImageDataAfterApply(true); - + // Load Texture and Create Texture State std::string filename = osgDB::getSimpleFileName(texName); std::string path(getDir()); @@ -385,11 +385,11 @@ bool TXPArchive::loadTexture(int i) #else const char _PATHD = '/'; #endif - if( path == "." ) + if( path == "." ) path = ""; else path += _PATHD ; - + std::string theFile = path + filename ; osg::ref_ptr image = osgDB::readRefImageFile(theFile); if (image.valid()) @@ -450,7 +450,7 @@ bool TXPArchive::loadModel(int ix) trpgMemReadBuffer buf(GetEndian()); mod->Read(buf); Group *osg_model = parse->ParseScene(buf, m_gstates , m_models); - m_models.push_back(osg_model); + m_models.push_back(osg_model); } */ return true; @@ -506,7 +506,7 @@ bool TXPArchive::loadLightAttributes() //osgPoint->setSize(perfAttr.actualSize); osgPoint->setSize(5); osgPoint->setMaxSize(perfAttr.maxPixelSize); - osgPoint->setMinSize(perfAttr.minPixelSize); + osgPoint->setMinSize(perfAttr.minPixelSize); osgPoint->setFadeThresholdSize(perfAttr.transparentFallofExp); //numbers that are going to appear are "experimental" osgPoint->setDistanceAttenuation(osg::Vec3(0.0001, 0.0005, 0.00000025)); @@ -519,7 +519,7 @@ bool TXPArchive::loadLightAttributes() stateSet->setAttributeAndModes(new osg::BlendFunc, osg::StateAttribute::ON); osgLight->setMaxPixelSize(perfAttr.maxPixelSize); - osgLight->setMinPixelSize(perfAttr.minPixelSize); + osgLight->setMinPixelSize(perfAttr.minPixelSize); // float64 clamp; // ref->GetPerformerTpClamp(clamp); @@ -567,7 +567,7 @@ bool TXPArchive::loadLightAttributes() back->setElevationRange(0,tmp, tmpfade); lp._sector = back; osgLight->addLightPoint(lp); - } + } else { osgLight->addLightPoint(lp); @@ -625,15 +625,15 @@ bool TXPArchive::loadTextStyles() } else { - OSG_NOTICE << "txp:: No font map file found: " << fmapfname << std::endl; - OSG_NOTICE << "txp:: All fonts defaulted to arial.ttf" << std::endl; + OSG_NOTICE << "txp:: No font map file found: " << fmapfname << std::endl; + OSG_NOTICE << "txp:: All fonts defaulted to arial.ttf" << std::endl; } const trpgTextStyleTable::StyleMapType *smap = textStyleTable->getStyleMap(); trpgTextStyleTable::StyleMapType::const_iterator itr = smap->begin(); for ( ; itr != smap->end(); itr++) { - const trpgTextStyle *textStyle = &itr->second; + const trpgTextStyle *textStyle = &itr->second; if ( !textStyle ) continue; @@ -722,7 +722,7 @@ bool TXPArchive::getTileInfo(const TileLocationInfo& loc, TileInfo& info) info.radius = osg::Vec3(size.x/2.f, size.y/2.f,0.f).length() * 1.3; return true; - + } bool TXPArchive::getTileInfo(int x, int y, int lod, TileInfo& info) @@ -739,8 +739,8 @@ bool TXPArchive::getTileInfo(int x, int y, int lod, TileInfo& info) osg::Group* TXPArchive::getTileContent( int x, int y, int lod, - double realMinRange, - double realMaxRange, + double realMinRange, + double realMaxRange, double usedMaxRange, osg::Vec3& tileCenter, std::vector& childInfoList) @@ -777,7 +777,7 @@ public: _archive(archive), _tileInfo(loc) { } - + virtual void apply(osg::MatrixTransform& xform) { const trpgHeader* header = _archive->GetHeader(); @@ -816,14 +816,14 @@ public: osg::Group* TXPArchive::getTileContent( const TileLocationInfo& loc, - double realMinRange, - double realMaxRange, + double realMinRange, + double realMaxRange, double usedMaxRange, osg::Vec3& tileCenter, std::vector& childInfoList) { - if (_parser.get() == 0) + if (_parser.get() == 0) { _parser = new TXPParser(); _parser->setArchive(this); @@ -861,12 +861,12 @@ osg::Group* TXPArchive::getTileContent( tileCenter = _parser->getTileCenter(); int nbChild = _parser->GetNbChildrenRef(); - + childInfoList.clear(); for(int idx = 0; idx < nbChild; idx++) { const trpgChildRef *childRef = _parser->GetChildRef(idx); - + if(childRef) { TileLocationInfo loc; @@ -891,10 +891,10 @@ osg::Group* TXPArchive::getTileContent( { // unreference it. itr->second = NULL; - + OSGStatesMapType::iterator toRemove = itr; ++itr; - + // remove it from the map _statesMap.erase( toRemove ); } @@ -912,10 +912,10 @@ osg::Group* TXPArchive::getTileContent( { // unreference it. mitr->second = NULL; - + OSGTexMapType::iterator toRemove = mitr; ++mitr; - + // remove it from the map _texmap.erase( toRemove ); } @@ -940,6 +940,6 @@ bool TXPArchive::getLODSize(int lod, int& x, int& y) x = size.x; y = size.y; } - + return true; } diff --git a/src/osgPlugins/txp/TXPArchive.h b/src/osgPlugins/txp/TXPArchive.h index 550d4b75b..bc7d3c6ca 100644 --- a/src/osgPlugins/txp/TXPArchive.h +++ b/src/osgPlugins/txp/TXPArchive.h @@ -1,17 +1,17 @@ -/*************************************************************************** +/*************************************************************************** * December 2003 * - * This TerraPage loader was re-written in a fashion to use PagedLOD - * to manage paging entirely, also includes a version of Terrex's smart mesh - * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, + * This TerraPage loader was re-written in a fashion to use PagedLOD + * to manage paging entirely, also includes a version of Terrex's smart mesh + * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, * slight modified. * nick at terrex dot com - * + * * Ported to PagedLOD technology by Trajce Nikolov (Nick) & Robert Osfield *****************************************************************************/ /*************************************************************************** - * OpenSceneGraph loader for Terrapage format database + * OpenSceneGraph loader for Terrapage format database * by Boris Bralo 2002 * * based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh diff --git a/src/osgPlugins/txp/TXPIO.cpp b/src/osgPlugins/txp/TXPIO.cpp index 6b1501fbf..ca0457a34 100644 --- a/src/osgPlugins/txp/TXPIO.cpp +++ b/src/osgPlugins/txp/TXPIO.cpp @@ -41,7 +41,7 @@ bool TXPNode_readLocalData(osg::Object &obj, osgDB::Input &fr) //this function now takes the archive to load as a parameter //passing in NULL will have the same effect as before. txpNode.loadArchive(NULL); - + fr += 2; itrAdvanced = true; } @@ -62,7 +62,7 @@ public: NodeVisitor::apply(node); } osgDB::Output &_fw; - + protected: Dump2Osg& operator = (const Dump2Osg&) { return *this; } @@ -82,7 +82,7 @@ bool TXPNode_writeLocalData(const osg::Object &obj, osgDB::Output &fw) Dump2Osg wrt(fw); grp->accept(wrt); - + return true; } diff --git a/src/osgPlugins/txp/TXPNode.cpp b/src/osgPlugins/txp/TXPNode.cpp index b55b16533..8e914a035 100644 --- a/src/osgPlugins/txp/TXPNode.cpp +++ b/src/osgPlugins/txp/TXPNode.cpp @@ -35,7 +35,7 @@ public: virtual void operator () ( osg::Node * node, osg::NodeVisitor * nv ) { - osg::Group *pLOD = (osg::Group *) node; + osg::Group *pLOD = (osg::Group *) node; osg::Group *n = NULL; if ((pLOD->getNumChildren() > 0) && (n = (osg::Group *) pLOD->getChild(0)) && @@ -69,7 +69,7 @@ _originY(0.0) setNumChildrenRequiringUpdateTraversal(1); setCullingActive(false); } - + TXPNode::TXPNode(const TXPNode& txpNode,const osg::CopyOp& copyop): osg::Group(txpNode,copyop), _originX(txpNode._originX), @@ -106,7 +106,7 @@ void TXPNode::traverse(osg::NodeVisitor& nv) { OpenThreads::ScopedLock lock(_mutex); - + osgUtil::CullVisitor* cv = dynamic_cast(&nv); if (cv) { @@ -116,7 +116,7 @@ void TXPNode::traverse(osg::NodeVisitor& nv) osg::Timer_t start = timer.tick(); std::cout<<"Doing visible tile search"< tileMapper = new TileMapper; tileMapper->setLODScale(cv->getLODScale()); tileMapper->pushReferenceViewPoint(cv->getReferenceViewPoint()); @@ -133,15 +133,15 @@ void TXPNode::traverse(osg::NodeVisitor& nv) tileMapper->popReferenceViewPoint(); //std::cout<<" found " << tileMapper._tileMap.size() << std::endl; - + cv->setUserData(tileMapper.get()); -#ifdef PRINT_TILEMAPP_TIMEINFO +#ifdef PRINT_TILEMAPP_TIMEINFO std::cout<<"Completed visible tile search in "<getOrigin(_originX,_originY); _archive->getExtents(_extents); @@ -283,7 +283,7 @@ void TXPNode::updateEye(osg::NodeVisitor& nv) //OSG_NOTICE << "Tile load: " << x << " " << y << " " << lod << std::endl; } _pageManager->AckLoad(); - + } } } @@ -354,8 +354,8 @@ void TXPNode::updateSceneGraph() addChild(_nodesToAdd[i]); } _nodesToAdd.clear(); - - } + + } } diff --git a/src/osgPlugins/txp/TXPNode.h b/src/osgPlugins/txp/TXPNode.h index 891a250f2..d3f60a04e 100644 --- a/src/osgPlugins/txp/TXPNode.h +++ b/src/osgPlugins/txp/TXPNode.h @@ -1,18 +1,18 @@ -// -*-c++-*- -/*************************************************************************** +// -*-c++-*- +/*************************************************************************** * December 2003 * - * This TerraPage loader was re-written in a fashion to use PagedLOD - * to manage paging entirely, also includes a version of Terrex's smart mesh - * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, + * This TerraPage loader was re-written in a fashion to use PagedLOD + * to manage paging entirely, also includes a version of Terrex's smart mesh + * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, * slight modified. * nick at terrex dot com - * + * * Ported to PagedLOD technology by Trajce Nikolov (Nick) & Robert Osfield *****************************************************************************/ /*************************************************************************** - * OpenSceneGraph loader for Terrapage format database + * OpenSceneGraph loader for Terrapage format database * by Boris Bralo 2002 * * based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh @@ -51,60 +51,60 @@ class TXPNode : public osg::Group public: TXPNode(); - + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ TXPNode(const TXPNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - + META_Node(txp, TXPNode); - + virtual void traverse(osg::NodeVisitor& nv); - + void setArchiveName(const std::string& archiveName); void setOptions(const std::string& options); - + const std::string& getOptions() const; const std::string& getArchiveName() const; - + //modified by Brad Anderegg on May-27-08 //because the TXPArchives are kept in an std::map and referenced later //we do not want to create a new one, so we pass it in. //If NULL is passed into loadArchive it will do the same thing it used to. bool loadArchive(TXPArchive*); - + TXPArchive* getArchive() { return _archive.get(); } void setArchive( TXPArchive* archive ) { _archive = archive; } - + virtual osg::BoundingSphere computeBound() const; - + protected: virtual ~TXPNode(); - + void updateEye(osg::NodeVisitor& nv); void updateSceneGraph(); - + // Create a page lod for lod 0 with givin grid location (x,y) osg::Node* addPagedLODTile(int x, int y); - + std::string _archiveName; std::string _options; - + OpenThreads::Mutex _mutex; - + osg::ref_ptr _archive; osg::ref_ptr _pageManager; - + double _originX; double _originY; osg::BoundingBox _extents; - + std::vector _nodesToAdd; std::vector _nodesToRemove; - + }; diff --git a/src/osgPlugins/txp/TXPPageManager.cpp b/src/osgPlugins/txp/TXPPageManager.cpp index 3a1f1d6d3..fcc75ca9c 100644 --- a/src/osgPlugins/txp/TXPPageManager.cpp +++ b/src/osgPlugins/txp/TXPPageManager.cpp @@ -1,6 +1,6 @@ #include "TXPPageManager.h" using namespace txp; - + TXPPageManager::TXPPageManager(): trpgPageManager() { diff --git a/src/osgPlugins/txp/TXPPageManager.h b/src/osgPlugins/txp/TXPPageManager.h index 45b024a79..40aed0a38 100644 --- a/src/osgPlugins/txp/TXPPageManager.h +++ b/src/osgPlugins/txp/TXPPageManager.h @@ -1,17 +1,17 @@ -/*************************************************************************** +/*************************************************************************** * December 2003 * - * This TerraPage loader was re-written in a fashion to use PagedLOD - * to manage paging entirely, also includes a version of Terrex's smart mesh - * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, + * This TerraPage loader was re-written in a fashion to use PagedLOD + * to manage paging entirely, also includes a version of Terrex's smart mesh + * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, * slight modified. * nick at terrex dot com - * + * * Ported to PagedLOD technology by Trajce Nikolov (Nick) & Robert Osfield *****************************************************************************/ /*************************************************************************** - * OpenSceneGraph loader for Terrapage format database + * OpenSceneGraph loader for Terrapage format database * by Boris Bralo 2002 * * based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh @@ -46,10 +46,10 @@ class TXPPageManager : public trpgPageManager, public osg::Referenced { public: TXPPageManager(); - + protected: virtual ~TXPPageManager(); - + }; } // namespace diff --git a/src/osgPlugins/txp/TXPPagedLOD.cpp b/src/osgPlugins/txp/TXPPagedLOD.cpp index ed9b205b5..3317cdc94 100644 --- a/src/osgPlugins/txp/TXPPagedLOD.cpp +++ b/src/osgPlugins/txp/TXPPagedLOD.cpp @@ -25,7 +25,7 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv) //TileMapper* tileMapper = dynamic_cast(nv.getUserData()); //Modified by Brad Anderegg (May-27-08) because the black listing process appears to make tiles switch lods - //when they clearly shouldnt, in the worst cases a tile will page out that is right in front of you. + //when they clearly shouldnt, in the worst cases a tile will page out that is right in front of you. bool forceUseOfFirstChild = /*tileMapper ? (tileMapper->isNodeBlackListed(this)) :*/ false; double timeStamp = nv.getFrameStamp()?nv.getFrameStamp()->getReferenceTime():0.0; @@ -34,8 +34,8 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv) // set the frame number of the traversal so that external nodes can find out how active this // node is. - if (nv.getFrameStamp() && - nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR) + if (nv.getFrameStamp() && + nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR) { setFrameNumberOfLastTraversal(nv.getFrameStamp()->getFrameNumber()); } @@ -58,7 +58,7 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv) for(unsigned int i=0;iaccept(nv); } diff --git a/src/osgPlugins/txp/TXPPagedLOD.h b/src/osgPlugins/txp/TXPPagedLOD.h index 6ab08b2a5..a248a22e3 100644 --- a/src/osgPlugins/txp/TXPPagedLOD.h +++ b/src/osgPlugins/txp/TXPPagedLOD.h @@ -1,18 +1,18 @@ // -*-c++-*- -/*************************************************************************** +/*************************************************************************** * December 2003 * - * This TerraPage loader was re-written in a fashion to use PagedLOD - * to manage paging entirely, also includes a version of Terrex's smart mesh - * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, + * This TerraPage loader was re-written in a fashion to use PagedLOD + * to manage paging entirely, also includes a version of Terrex's smart mesh + * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, * slight modified. * nick at terrex dot com - * + * * Ported to PagedLOD technology by Trajce Nikolov (Nick) & Robert Osfield *****************************************************************************/ /*************************************************************************** - * OpenSceneGraph loader for Terrapage format database + * OpenSceneGraph loader for Terrapage format database * by Boris Bralo 2002 * * based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh @@ -49,7 +49,7 @@ namespace txp TXPPagedLOD(const TXPPagedLOD&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); META_Node(txp, TXPPagedLOD); - + virtual void traverse(osg::NodeVisitor& nv); inline void setTileId(int x, int y, int lod) diff --git a/src/osgPlugins/txp/TXPParser.cpp b/src/osgPlugins/txp/TXPParser.cpp index 85d2b0647..3edc3f523 100644 --- a/src/osgPlugins/txp/TXPParser.cpp +++ b/src/osgPlugins/txp/TXPParser.cpp @@ -38,11 +38,11 @@ class LayerGroup : public osg::Group { public: LayerGroup() : osg::Group() {} - + LayerGroup(const LayerGroup& gg,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): osg::Group(gg, copyop) {}; - + META_Node(txp, LayerGroup); protected: virtual ~LayerGroup() {} @@ -99,12 +99,12 @@ TXPParser::TXPParser(): AddCallback(TRPGTILEHEADER, new tileHeaderRead(this)); _childRefCB = dynamic_cast(GetCallback(TRPG_CHILDREF)); - + if (getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY")) { _defaultMaxAnisotropy = osg::asciiToFloat(getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY")); } - + } TXPParser::~TXPParser() @@ -112,7 +112,7 @@ TXPParser::~TXPParser() } osg::Group *TXPParser::parseScene( - trpgReadBuffer &buf, + trpgReadBuffer &buf, std::map > &materials, std::map > &models, double realMinRange, double realMaxRange, double usedMaxRange) @@ -158,7 +158,7 @@ osg::Group *TXPParser::parseScene( _root->accept(lv); //modified by Brad Anderegg May-27-08 - //running the optimizer on the terrain fixes some major preformance issues, unfortunately the texture atlas builder seems to get messed up + //running the optimizer on the terrain fixes some major preformance issues, unfortunately the texture atlas builder seems to get messed up //on some of the textures (usually around buildings) and the tri stripper seems to occasionally crash and also mess up the indices on certain buildings. osgUtil::Optimizer opt; opt.optimize(_root.get(), (osgUtil::Optimizer::ALL_OPTIMIZATIONS ^ osgUtil::Optimizer::TEXTURE_ATLAS_BUILDER) ^ osgUtil::Optimizer::TRISTRIP_GEOMETRY); @@ -231,7 +231,7 @@ bool TXPParser::StartChildren(void * /*in*/) _parents.push(_currentTop); _currentTop = _currentNode->asGroup(); } - + return true; } @@ -274,8 +274,8 @@ bool TXPParser::EndChildren(void *) } DeferredLightAttribute& TXPParser::getLightAttribute(int ix) -{ - return _archive->getLightAttribute(ix); +{ + return _archive->getLightAttribute(ix); } class FindEmptyGroupsVisitor : public osg::NodeVisitor @@ -342,7 +342,7 @@ osg::Geode* TXPParser::createBoundingBox(int x,int y, int lod) ), hints ); - + if (lod==0) { sd->setColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); @@ -402,10 +402,10 @@ void TXPParser::loadLocalMaterials() for (int i = 0; i < n_materials; i++) { osg::StateSet* osg_state_set = new osg::StateSet; - + trpgLocalMaterial locmat; tile_head->GetLocalMaterial(i,locmat); - + const trpgMaterial* mat = 0; const trpgTexture *tex = 0; @@ -439,17 +439,17 @@ void TXPParser::loadLocalMaterials() osg_texenv->setMode(osg::TexEnv::MODULATE); break; } - + osg_state_set->setTextureAttribute(texNo,osg_texenv); image_helper.GetNthImageInfoForLocalMat(&locmat, texNo, &mat,&tex,size); - + trpgTexture::ImageMode mode; tex->GetImageMode(mode); osg::Texture2D* osg_texture = 0L; - if(mode == trpgTexture::Template) + if(mode == trpgTexture::Template) osg_texture = getTemplateTexture(image_helper,&locmat, tex, texNo); - else if(mode == trpgTexture::Local) + else if(mode == trpgTexture::Local) osg_texture = getLocalTexture(image_helper,tex); else if(mode == trpgTexture::Global) osg_texture = _archive->getGlobalTexture(texId); @@ -471,11 +471,11 @@ void TXPParser::loadLocalMaterials() } osg_state_set->setTextureAttributeAndModes(texNo,osg_texture, osg::StateAttribute::ON); - int wrap_s, wrap_t; + int wrap_s, wrap_t; texEnv.GetWrap(wrap_s, wrap_t); osg_texture->setWrap(osg::Texture2D::WRAP_S, wrap_s == trpgTextureEnv::Repeat ? osg::Texture2D::REPEAT: osg::Texture2D::CLAMP_TO_EDGE ); osg_texture->setWrap(osg::Texture2D::WRAP_T, wrap_t == trpgTextureEnv::Repeat ? osg::Texture2D::REPEAT: osg::Texture2D::CLAMP_TO_EDGE ); - + // by default is anisotropic filtering. osg_texture->setMaxAnisotropy(_defaultMaxAnisotropy); } @@ -486,29 +486,29 @@ void TXPParser::loadLocalMaterials() } osg::Material *osg_material = new osg::Material; - + float64 alpha; mat->GetAlpha(alpha); - + trpgColor color; mat->GetAmbient(color); - osg_material->setAmbient( osg::Material::FRONT_AND_BACK , + osg_material->setAmbient( osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); mat->GetDiffuse(color); - osg_material->setDiffuse(osg::Material::FRONT_AND_BACK , + osg_material->setDiffuse(osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); - + mat->GetSpecular(color); - osg_material->setSpecular(osg::Material::FRONT_AND_BACK , + osg_material->setSpecular(osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); mat->GetEmission(color); - osg_material->setEmission(osg::Material::FRONT_AND_BACK , + osg_material->setEmission(osg::Material::FRONT_AND_BACK , osg::Vec4(color.red, color.green, color.blue, alpha)); - + float64 shinines; mat->GetShininess(shinines); osg_material->setShininess(osg::Material::FRONT_AND_BACK , (float)shinines); - + osg_material->setAlpha(osg::Material::FRONT_AND_BACK ,(float)alpha); osg_state_set->setAttributeAndModes(osg_material, osg::StateAttribute::ON); @@ -519,8 +519,8 @@ void TXPParser::loadLocalMaterials() osg_state_set->setMode(GL_BLEND,osg::StateAttribute::ON); osg_state_set->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); } - - + + /* This controls what alpha values in a texture mean. It can take the values: None,Always,Equal,GreaterThanOrEqual,GreaterThan, LessThanOrEqual,LessThan,Never,NotEqual @@ -538,7 +538,7 @@ void TXPParser::loadLocalMaterials() int cullMode; mat->GetCullMode(cullMode); - + // Culling mode in txp means opposite from osg i.e. Front-> show front face if( cullMode != trpgMaterial::FrontAndBack) { @@ -559,9 +559,9 @@ void TXPParser::loadLocalMaterials() } } -bool TXPParser::requestModel(int ix) +bool TXPParser::requestModel(int ix) { - return _archive->loadModel(ix); + return _archive->loadModel(ix); } //---------------------------------------------------------------------------- @@ -600,11 +600,11 @@ void* lodRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) #else osgLod->setRange( 0, - _parse->checkAndGetMinRange(minRange), + _parse->checkAndGetMinRange(minRange), _parse->checkAndGetMaxRange(maxRange) ); #endif - + // Our LODs are binary so we need to add a group under this LOD and attach stuff // to that instead of the LOD // Add it into the scene graph @@ -650,7 +650,7 @@ void *modelRefRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) (float)mat[8], (float)mat[9], (float)mat[10],(float)mat[11], (float)mat[12],(float)mat[13],(float)mat[14],(float)mat[15] ); - + // Note: Array check before you do this osg::Node *osg_Model = NULL; std::map >*modelList = _parse->getModels(); @@ -749,7 +749,7 @@ void* attachRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) void* childRefRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) { - + // This object contribute nothing to the scenegraph, except // where the children tile should connect. // It only contain location info of the children tile @@ -804,7 +804,7 @@ void* lightRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) ref->GetPerformerAttr(perfAttr); lpNode->setMaxPixelSize(perfAttr.maxPixelSize); - lpNode->setMinPixelSize(perfAttr.minPixelSize); + lpNode->setMinPixelSize(perfAttr.minPixelSize); trpg3dPoint norm; ref->GetNormal(norm); @@ -817,10 +817,10 @@ void* lightRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) trpg3dPoint pt; light.GetVertex(i, pt); - osgSim::LightPoint lp( - true, - osg::Vec3(pt.x,pt.y,pt.z), - osg::Vec4(col.red, col.green,col.blue, 1.0), + osgSim::LightPoint lp( + true, + osg::Vec3(pt.x,pt.y,pt.z), + osg::Vec4(col.red, col.green,col.blue, 1.0), inten ); @@ -833,10 +833,10 @@ void* lightRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) ref->GetHLobeAngle(tmp); lobeHorz = osg::DegreesToRadians( tmp ); - + ref->GetVLobeAngle(tmp); lobeVert = osg::DegreesToRadians( tmp ); - + ref->GetLobeRollAngle(tmp); lobeRoll = osg::DegreesToRadians( tmp ); @@ -851,10 +851,10 @@ void* lightRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) ref->GetHLobeAngle(tmp); lobeHorz = osg::DegreesToRadians( tmp ); - + ref->GetVLobeAngle(tmp); lobeVert = osg::DegreesToRadians( tmp ); - + ref->GetLobeRollAngle(tmp); lobeRoll = osg::DegreesToRadians( tmp ); @@ -864,10 +864,10 @@ void* lightRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) ref->GetBackColor(col); ref->GetBackIntensity(inten); - osgSim::LightPoint lp2( - true, - osg::Vec3(pt.x,pt.y,pt.z), - osg::Vec4(col.red, col.green,col.blue, 1.0), + osgSim::LightPoint lp2( + true, + osg::Vec3(pt.x,pt.y,pt.z), + osg::Vec4(col.red, col.green,col.blue, 1.0), inten ); @@ -888,7 +888,7 @@ void* lightRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) #if 0 - DefferedLightAttribute& dla = _parse->getLightAttribute(attr_index); + DefferedLightAttribute& dla = _parse->getLightAttribute(attr_index); osgSim::LightPointNode* node = dla.lightPoint.get(); uint32 nvert; @@ -1000,7 +1000,7 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) os << '\\' << sub; break; } - + } if (lb.length()) os << lb; text->setText(os.str()); @@ -1023,9 +1023,9 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) text->setAxisAlignment(osgText::Text::XZ_PLANE); const trpgLabelPropertyTable *labelPropertyTable = _parse->getArchive()->GetLabelPropertyTable(); - const trpgLabelProperty *labelProperty = labelPropertyTable ? + const trpgLabelProperty *labelProperty = labelPropertyTable ? labelPropertyTable->GetPropertyRef(label.GetProperty()) : 0; - + bool addTextGeodeIntoSceneGraph = true; if (labelProperty) { @@ -1172,7 +1172,7 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) supLineColor = osg::Vec4(faceColor.red, faceColor.green, faceColor.blue, alpha ); } } - + switch (supStyle->GetType()) { case trpgSupportStyle::Line: @@ -1194,7 +1194,7 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) colors->push_back(supLineColor); linesGeom->setColorArray(colors); linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL); - + osg::Vec3Array* normals = new osg::Vec3Array; normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f)); linesGeom->setNormalArray(normals); @@ -1215,7 +1215,7 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) for (unsigned int i = 0; i < supports->size(); i++) { const trpg3dPoint& supPt = (*supports)[i]; - + osg::Vec3 supPos(supPt.x,supPt.y,supPt.z); osg::Vec3 supCenter = (supPos+pos)/2.f; float supHeight = (supPos-pos).length(); @@ -1236,7 +1236,7 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) supGeode->addDrawable(cylinderDrawable); } - + _parse->getCurrTop()->addChild(supGeode.get()); } break; @@ -1244,7 +1244,7 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) break; } - + } } } @@ -1275,7 +1275,7 @@ public: _m = m; _im.invert(_m); } - + virtual ~TransformFunctor() {} virtual void apply(osg::Drawable::AttributeType type,unsigned int count,osg::Vec3* begin) @@ -1288,7 +1288,7 @@ public: (*itr) = (*itr)*_m; } } - else + else if (type == osg::Drawable::NORMALS) { osg::Vec3* end = begin+count; @@ -1323,14 +1323,14 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) geom.GetNumPrims(numPrims); geom.GetNumVertex(numVert); geom.GetNumNormal(numNorm); - + // Get vertices osg::ref_ptr vertices = new osg::Vec3Array(numVert); geom.GetVertices((float *)&(vertices->front())); - + // Turn the trpgGeometry into something osg can understand osg::ref_ptr geometry; - + // Get texture coordinates ; int num_tex; @@ -1342,7 +1342,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) if (td) { tex_coords[texno] = new osg::Vec2Array(numVert); - const float* sourcePtr = &(td->floatData[0]); + const float* sourcePtr = &(td->floatData[0]); float* destinationPtr = (float*)&((*tex_coords[texno])[0]); for (int i=0 ;i < numVert; ++i) { @@ -1351,7 +1351,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) } } } - + // The normals osg::ref_ptr normals; if (numNorm == numVert) @@ -1359,7 +1359,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) normals = new osg::Vec3Array(numVert); geom.GetNormals((float*)&(normals->front())); } - + // Set up the primitive type switch (primType) { @@ -1422,8 +1422,8 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) default: break; }; - - + + // Add it to the current parent group osg::Group *top = _parse->getCurrTop(); @@ -1434,7 +1434,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) { //modifed by Brad Anderegg on May-27-08 - //using display lists actually increases our framerate by + //using display lists actually increases our framerate by //a fair amount, on certain laptops it increased by as much as 1000% geometry->setUseDisplayList(true); @@ -1461,15 +1461,15 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) _parse->loadMaterial(matId); tmp_ss = (*_parse->getMaterials())[matId]; } - if(sset.valid()) + if(sset.valid()) { if(tmp_ss.valid()) { osg::StateAttribute* texenv0 = tmp_ss->getTextureAttribute(0,osg::StateAttribute::TEXENV); - if(texenv0) + if(texenv0) sset->setTextureAttribute(n_mat,texenv0); osg::StateAttribute* tex0 = tmp_ss->getTextureAttribute(0,osg::StateAttribute::TEXTURE); - if(tex0) + if(tex0) sset->setTextureAttributeAndModes(n_mat,tex0,osg::StateAttribute::ON); // submitted by a. danklefsen // Alion science and Technology 2/12/07 @@ -1478,7 +1478,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) } // sset->merge(*tmp_ss.get()); } - else + else sset = tmp_ss; } @@ -1500,7 +1500,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) osg::ref_ptr billboard = new osg::Billboard; billboard->setAxis(osg::Vec3(0.0f,0.0,1.0f) ); billboard->setNormal(osg::Vec3(0.0f,-1.0,0.0f)); - + geometry->setUseDisplayList(true); switch (info.mode) @@ -1604,14 +1604,14 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) _parse->getCurrTop()->addChild(geode); } } -#endif - +#endif + } else { OSG_WARN<<"Detected potential memory leak in TXPParser.cpp"<GetImageDepth(depth); trpgTexture::ImageType type; tex->GetImageType(type); - + GLenum internalFormat = (GLenum)-1; GLenum pixelFormat = (GLenum)-1; GLenum dataType = GL_UNSIGNED_BYTE; check_format(type,depth,internalFormat , pixelFormat , dataType); - + if(pixelFormat!=(GLenum)-1) { osg_texture = new osg::Texture2D(); - // make sure the Texture unref's the Image after apply, when it is no longer needed. + // make sure the Texture unref's the Image after apply, when it is no longer needed. osg_texture->setUnRefImageDataAfterApply(true); osg::Image* image = new osg::Image; @@ -1745,7 +1745,7 @@ osg::Texture2D* txp::getLocalTexture(trpgrImageHelper& image_helper, const trpgT // now set mipmap data (offsets into image raw data) osg::Image::MipmapDataType mipmaps; // number of offsets in osg is one less than num_mipmaps - // because it's assumed that first offset iz 0 + // because it's assumed that first offset iz 0 mipmaps.resize(num_mipmaps-1); for( int k = 1 ; k < num_mipmaps;k++ ) { @@ -1773,18 +1773,18 @@ osg::Texture2D* txp::getTemplateTexture(trpgrImageHelper& image_helper, trpgLoca tex->GetImageDepth(depth); trpgTexture::ImageType type; tex->GetImageType(type); - + GLenum internalFormat = (GLenum)-1; GLenum pixelFormat = (GLenum)-1; GLenum dataType = GL_UNSIGNED_BYTE; check_format(type,depth,internalFormat , pixelFormat , dataType); - + if(pixelFormat!=(GLenum)-1) { osg_texture = new osg::Texture2D(); - // make sure the Texture unref's the Image after apply, when it is no longer needed. + // make sure the Texture unref's the Image after apply, when it is no longer needed. osg_texture->setUnRefImageDataAfterApply(true); osg::Image* image = new osg::Image; @@ -1821,7 +1821,7 @@ osg::Texture2D* txp::getTemplateTexture(trpgrImageHelper& image_helper, trpgLoca // now set mipmap data (offsets into image raw data) osg::Image::MipmapDataType mipmaps; // number of offsets in osg is one less than num_mipmaps - // because it's assumed that first offset iz 0 + // because it's assumed that first offset iz 0 mipmaps.resize(num_mipmaps-1); for( int k = 1 ; k < num_mipmaps;k++ ) { diff --git a/src/osgPlugins/txp/TXPSeamLOD.cpp b/src/osgPlugins/txp/TXPSeamLOD.cpp index 57c1c6c76..b43df56c5 100644 --- a/src/osgPlugins/txp/TXPSeamLOD.cpp +++ b/src/osgPlugins/txp/TXPSeamLOD.cpp @@ -35,7 +35,7 @@ void TXPSeamLOD::traverse(osg::NodeVisitor& nv) { if (nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR && getNumChildren()==2) { - + TileMapper* tileMapper = dynamic_cast(nv.getUserData()); if (tileMapper && !tileMapper->isTileNeighbourALowerLODLevel(_tid,_dx,_dy)) @@ -46,7 +46,7 @@ void TXPSeamLOD::traverse(osg::NodeVisitor& nv) { getChild(0)->accept(nv); } - + } else { diff --git a/src/osgPlugins/txp/TXPSeamLOD.h b/src/osgPlugins/txp/TXPSeamLOD.h index 3f75845ac..4a4f3f893 100644 --- a/src/osgPlugins/txp/TXPSeamLOD.h +++ b/src/osgPlugins/txp/TXPSeamLOD.h @@ -1,18 +1,18 @@ // -*-c++-*- -/*************************************************************************** +/*************************************************************************** * December 2003 * - * This TerraPage loader was re-written in a fashion to use PagedLOD - * to manage paging entirely, also includes a version of Terrex's smart mesh - * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, + * This TerraPage loader was re-written in a fashion to use PagedLOD + * to manage paging entirely, also includes a version of Terrex's smart mesh + * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, * slight modified. * nick at terrex dot com - * + * * Ported to PagedLOD technology by Trajce Nikolov (Nick) & Robert Osfield *****************************************************************************/ /*************************************************************************** - * OpenSceneGraph loader for Terrapage format database + * OpenSceneGraph loader for Terrapage format database * by Boris Bralo 2002 * * based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh diff --git a/src/osgPlugins/txp/TileMapper.cpp b/src/osgPlugins/txp/TileMapper.cpp index 1dbd97e13..c1c47229a 100644 --- a/src/osgPlugins/txp/TileMapper.cpp +++ b/src/osgPlugins/txp/TileMapper.cpp @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,7 +43,7 @@ float TileMapper::getDistanceFromEyePoint(const osg::Vec3& pos, bool withLODScal { const osg::Matrix& matrix = *_modelviewStack.back(); float dist = distance(pos,matrix); - + if (withLODScale) return dist*getLODScale(); else @@ -52,7 +52,7 @@ float TileMapper::getDistanceFromEyePoint(const osg::Vec3& pos, bool withLODScal void TileMapper::apply(osg::Node& node) { - if (node.getName()=="TileContent") + if (node.getName()=="TileContent") { _containsGeode = true; return; @@ -72,7 +72,7 @@ void TileMapper::apply(osg::Node& node) void TileMapper::apply(osg::Group& node) { - if (node.getName()=="TileContent") + if (node.getName()=="TileContent") { _containsGeode = true; return; @@ -85,7 +85,7 @@ void TileMapper::apply(osg::Group& node) pushCurrentMask(); TileIdentifier* tid = dynamic_cast(node.getUserData()); - + if (tid) { _containsGeode = false; @@ -102,7 +102,7 @@ void TileMapper::apply(osg::Group& node) _containsGeode = false; } - + } // pop the culling mode. @@ -171,18 +171,18 @@ bool TileMapper::isTileNeighbourALowerLODLevel(const TileIdentifier& tid, int dx return true; } TileIdentifier parent_tid(tid.x/2,tid.y/2,tid.lod-1); - + bool parentHasNorthNeighour = _tileMap.count(TileIdentifier(parent_tid.x, parent_tid.y+1,parent_tid.lod))!=0; bool parentHasEastNeighour = _tileMap.count(TileIdentifier(parent_tid.x+1,parent_tid.y, parent_tid.lod))!=0; bool parentHasSouthNeighour = _tileMap.count(TileIdentifier(parent_tid.x, parent_tid.y-1,parent_tid.lod))!=0; bool parentHasWestNeighour = _tileMap.count(TileIdentifier(parent_tid.x-1,parent_tid.y, parent_tid.lod))!=0; - + // identify whether the tile is a NE/SE/SW/NW tile relative to its parent. osg::Vec3 delta(tid.x%2,tid.y%2,0); - + if (delta.y()>0.0f) // noth side - { + { if (delta.x()>0.0f) { // NE @@ -191,7 +191,7 @@ bool TileMapper::isTileNeighbourALowerLODLevel(const TileIdentifier& tid, int dx else if (dx==1) return parentHasEastNeighour; } - else + else { // NW if (dy==1) @@ -210,7 +210,7 @@ bool TileMapper::isTileNeighbourALowerLODLevel(const TileIdentifier& tid, int dx else if (dx==1) return parentHasEastNeighour; } - else + else { // SW if (dy==-1) @@ -219,6 +219,6 @@ bool TileMapper::isTileNeighbourALowerLODLevel(const TileIdentifier& tid, int dx return parentHasWestNeighour; } } - + return false; } diff --git a/src/osgPlugins/txp/TileMapper.h b/src/osgPlugins/txp/TileMapper.h index 5de39eba0..91dec96a6 100644 --- a/src/osgPlugins/txp/TileMapper.h +++ b/src/osgPlugins/txp/TileMapper.h @@ -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 - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -42,7 +42,7 @@ struct TileIdentifier : public osg::Referenced y(ay), lod(alod) {} - + TileIdentifier(const TileIdentifier& rhs): osg::Referenced(), x(rhs.x), @@ -90,14 +90,14 @@ struct TileIdentifier : public osg::Referenced class TileMapper : public osg::NodeVisitor, public osg::CullStack { public: - + typedef osg::Matrix::value_type value_type; TileMapper(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) {} - + virtual osg::Vec3 getEyePoint() const { return getEyeLocal(); @@ -109,17 +109,17 @@ public: virtual void apply(osg::Group& node); virtual void apply(osg::Geode& node); virtual void apply(osg::PagedLOD& node); - + void insertTile(const TileIdentifier& tid); - + bool isTileNeighbourALowerLODLevel(const TileIdentifier& tid, int dx, int dy) const; - + protected: typedef std::map< TileIdentifier, int> TileMap; TileMap _tileMap; bool _containsGeode; - + }; } // namespace diff --git a/src/osgPlugins/txp/trpage_compat.cpp b/src/osgPlugins/txp/trpage_compat.cpp index b2e2d074f..53827a21a 100644 --- a/src/osgPlugins/txp/trpage_compat.cpp +++ b/src/osgPlugins/txp/trpage_compat.cpp @@ -21,7 +21,7 @@ This file and the accompanying trpage_compat.h contain objects and procedures used to maintain compatibility between versions of TerraPage. In particular, the ability to read older versions of TerraPage and newer applications. - + */ #include diff --git a/src/osgPlugins/txp/trpage_geom.h b/src/osgPlugins/txp/trpage_geom.h index 293cf9c59..282a32bc0 100644 --- a/src/osgPlugins/txp/trpage_geom.h +++ b/src/osgPlugins/txp/trpage_geom.h @@ -147,9 +147,9 @@ public: Each of these terrain LODs is accessed seperately (as are the tiles within them). This returns the number of terrain LODs in the file. It will be at least 1. See trpgAttach for instructions on how to hook the terrain LODs together. - - For version 2.1 and over, this number represent the depest lod that was found - in the gaming area. With variable lod, tiles will not ncessarily fill out all of + + For version 2.1 and over, this number represent the depest lod that was found + in the gaming area. With variable lod, tiles will not ncessarily fill out all of the gaming area for all of the lods. trpgAttach node are no longer used, instead see trpgChildRef */ @@ -190,7 +190,7 @@ public: } } bool GetIsMaster() const - { + { return ((flags & ISMASTER)==ISMASTER); } void SetLocal(bool isLocal) @@ -258,7 +258,7 @@ public: // Set the application mode for the texture. void SetEnvMode(int); // Values used by SetMinFilter and SetMagFilter - enum {Point, Linear, MipmapPoint, MipmapLinear, + enum {Point, Linear, MipmapPoint, MipmapLinear, MipmapBilinear, MipmapTrilinear, Nearest}; // Set the Minification filter for a texture void SetMinFilter(int); @@ -284,7 +284,7 @@ public: bool GetEnvMode(int32 &) const; /* The Minification and Magnification filters control how texture mipmap levels are used. We support the values: Point, Linear, - MipmapPoint, MipmapLinear, + MipmapPoint, MipmapLinear, MipmapBilinear, MipmapTrilinear, Nearest */ bool GetMinFilter(int32 &) const; @@ -493,7 +493,7 @@ public: bool Print(trpgPrintBuffer &) const; // Note: Need to do equality operator - + protected: bool isBump; trpgColor color; @@ -717,7 +717,7 @@ public: // Set the transparent scale for Performer Lights void SetPerformerTpScale( float64 ); - + // Set the transparent clamp for Performer Lights void SetPerformerTpClamp( float64 ); @@ -944,7 +944,7 @@ public: // operator trpgLightTable & operator = (const trpgLightTable &); - + typedef std::map LightMapType; LightMapType *getLightMap() { return &lightMap; } protected: @@ -1022,10 +1022,10 @@ protected: /* The Range Table is new to 2.0. The goal is to provide information about certain classes of features within a TerraPage database. It's intended - to solve the following problem. - + to solve the following problem. + Let's say that you have an Image Generator that must draw a given TerraPage - database at 60Hz. However, it's only hitting 30Hz reliably. Often, some + database at 60Hz. However, it's only hitting 30Hz reliably. Often, some feature set (e.g. bushes) must be sacrified in order to reach the target frame rate. Determining which features can be throttled back can often be very difficult. Scaling all of the LODs will often work, but it's not very elegant. It's @@ -1045,8 +1045,8 @@ protected: and sub-category as well as an integer priority. The category data is there to allow run-time systems to tell users what they're dropping (or allow them to pick). The priority is there to tell systems what to get rid of first (according to the - user who build the TerraPage archive). - + user who build the TerraPage archive). + Priorities are relative to each other within the Range Table. There can be duplicates and there may be holes in the numbering. @@ -1058,7 +1058,7 @@ public: trpgRangeTable(void); ~trpgRangeTable(void); - // Get the given range info + // Get the given range info bool GetRange(int id,trpgRange &) const; // Get the number of entries in the table @@ -1108,7 +1108,7 @@ protected: If you're doing a TerraPage reader you'll get a trpgMatTable from the trpgr_Archive. This is your central index for materials. If you can handle the multiple channels/sub-tables then you can access those as you need. If you can't, just use 0 for the sub-table index where appropriate. - + If you're doing a TerraPage writer you'll need to build up a trpgMatTable to pass to trpgwArchive. If you're only doing a single sub-table (i.e. visible materials only) just use AddMaterial and add them as you go. The trpgMaterial object you build up @@ -1137,7 +1137,7 @@ public: */ //void SetMaterial(int subTable,int mat,const trpgMaterial &); void SetMaterial(int,const trpgMaterial &); - + /* This function should be used if you only have a single material sub-table. It searches for a matching material and then adds a new one if it doesn't find a match. The new (or old) ID is returned. @@ -1357,7 +1357,7 @@ public: // Returns the size of a given mip level int32 MipLevelSize(int miplevel); - // Returns the offset of the mip level in the whole texture data buffer + // Returns the offset of the mip level in the whole texture data buffer int32 MipLevelOffset(int miplevel); // Validity check @@ -1500,7 +1500,7 @@ public: return &textureMap; } protected: - + TextureMapType textureMap; //These are used to initialize the row/col values for //multi-archive archives @@ -1664,7 +1664,7 @@ public: return &modelsMap; } protected: - + ModelMapType modelsMap; }; @@ -1682,7 +1682,7 @@ TX_EXDECL class TX_CLDECL trpgTileTable : public trpgReadWriteable public: // Tiles can be stored individually (External and ExternalSaved) or in grouped files (Local). // ExternalSaved still have an entry in the table. In this case the addess data is not valid. - + enum TileMode {Local,External, ExternalSaved}; trpgTileTable(); @@ -1702,7 +1702,7 @@ public: // Local or external tiles bool GetMode(TileMode &) const; // Get the disk reference (local) - bool GetTile(int x,int y,int lod,trpgwAppAddress &,float32 &min,float32 &max) const; + bool GetTile(int x,int y,int lod,trpgwAppAddress &,float32 &min,float32 &max) const; // Validity check bool isValid(void) const; @@ -1863,14 +1863,14 @@ protected: textures from the non-pageable ones by looking at the tile reference count in the trpgTexture object. - The second way of doing texture paging (in version 2.0) is more complex, but + The second way of doing texture paging (in version 2.0) is more complex, but much more powerful. One of the big problems we encountered with v1.0 was the enormous proliferation of texture files. In addition, much information was - duplicated between the different terrain resolutions. Lastly, we (TERREX) have + duplicated between the different terrain resolutions. Lastly, we (TERREX) have had a lot of success with wavelet compressed image pyramids for solving quite a few interesting problems. This second approach to texture paging makes use of what we've learned from all of this. The idea is that instead of having lots of - little textures, we have a small number of very large images which can support + little textures, we have a small number of very large images which can support extraction at any resolution. In this way we re-use information between terrain levels of detail and we cut down on our disk usage, both in terms of number of files as well as data size. @@ -1886,7 +1886,7 @@ protected: If you want to page models, you can do so by looking at the list of model IDs used in a tile. - + If you're doing a TerraPage writer you will need to construct one of these for each tile that you build (remember that tiles are per-terrain LOD). You'll want to call AddMaterial for every material that you use in a tile and AddModel @@ -2486,15 +2486,15 @@ public: // Get the tile grid location bool GetTileLoc(int &gx,int &gy,int &glod) const; - + void SetTileAddress(const trpgwAppAddress& gAddr); void SetTileAddress(int32 file, int32 offset); void SetTileZValue( float gZmin, float gZmax); bool GetTileAddress(int32& file, int32& offset) const; - bool GetTileAddress(trpgwAppAddress& gAddr) const; + bool GetTileAddress(trpgwAppAddress& gAddr) const; bool GetTileZValue( float& gZmin, float& gZmax) const; - + // Validity check bool isValid(void) const; @@ -2510,7 +2510,7 @@ protected: int x,y,lod; // File Location trpgwAppAddress addr; - + float zmin, zmax; }; @@ -2891,7 +2891,7 @@ public: const StyleMapType *getStyleMap()const { return &styleMap; } protected: //std::vector styles; - + StyleMapType styleMap; }; @@ -3019,7 +3019,7 @@ public: void SetSupport(int); // Get the font style ID. Points into trpgSupportTable int GetSupport(void) const; - + // Write this class to a write buffer bool Write(trpgWriteBuffer &); // Reads this class from a read buffer @@ -3091,7 +3091,7 @@ public: bool isValid(void) const; - + typedef enum {Left,Center,Right,MaxAlignmentType} AlignmentType; // Set the label property ID. This is an index into a tprgLabelPropertyTable diff --git a/src/osgPlugins/txp/trpage_header.cpp b/src/osgPlugins/txp/trpage_header.cpp index a91b9ddd9..3c267f699 100644 --- a/src/osgPlugins/txp/trpage_header.cpp +++ b/src/osgPlugins/txp/trpage_header.cpp @@ -43,7 +43,7 @@ trpgHeader::~trpgHeader() bool trpgHeader::isValid() const { // We also need to check that this is a 'master' archive here. - if((verMajor>=TRPG_NOMERGE_VERSION_MAJOR) && (verMinor>=TRPG_NOMERGE_VERSION_MINOR)) + if((verMajor>=TRPG_NOMERGE_VERSION_MAJOR) && (verMinor>=TRPG_NOMERGE_VERSION_MINOR)) { return true; } diff --git a/src/osgPlugins/txp/trpage_io.h b/src/osgPlugins/txp/trpage_io.h index 7265b9971..469614c07 100644 --- a/src/osgPlugins/txp/trpage_io.h +++ b/src/osgPlugins/txp/trpage_io.h @@ -48,7 +48,7 @@ typedef long TeAttrHdl; // Current TerraPage minor version #define TRPG_VERSION_MINOR 2 -// defined values for the version that doesn't need +// defined values for the version that doesn't need // a merge #define TRPG_NOMERGE_VERSION_MAJOR 2 #define TRPG_NOMERGE_VERSION_MINOR 2 @@ -78,10 +78,10 @@ typedef short trpgToken; #define TRPGMATTABLE 300 // Added 11/14/98 - New material table // {secret} -#define TRPGMATTABLE2 301 +#define TRPGMATTABLE2 301 // Added 11/14/98 // {secret} -#define TRPGSHORTMATTABLE 302 +#define TRPGSHORTMATTABLE 302 // {secret} #define TRPGMATERIAL 400 @@ -380,11 +380,11 @@ public: trpgMemWriteBuffer(trpgEndian); virtual ~trpgMemWriteBuffer(void); // Return the current length of buffer - virtual int length(void) const; + virtual int length(void) const; // Return the raw data (if you want to write to disk, for example) - virtual const char *getData(void) const; + virtual const char *getData(void) const; // Allocate the given amount of space for the buffer - virtual void setLength(unsigned int); + virtual void setLength(unsigned int); // Add a 32 bit integer to the buffer virtual void Add(int32); @@ -517,7 +517,7 @@ protected: virtual bool GetDataRef(char **,int)=0; /* This virtual method must be filled in by the subclass so that SkipToLimit will work correctly. */ - virtual bool Skip(int) = 0; + virtual bool Skip(int) = 0; /* Utility function that must be called after a successfull read to update the outside imposed read limits. */ virtual void UpdateLimits(int); @@ -535,7 +535,7 @@ public: trpgMemReadBuffer(trpgEndian); ~trpgMemReadBuffer(void); // Return true if we're out of data - bool isEmpty(void); + bool isEmpty(void); // Sets the size of this read buffer. void SetLength(int); // Gets the size of the buffer. @@ -564,9 +564,9 @@ public: virtual ~trpgCheckable(void); // Returns the state of the valid flag, or can be overriden by a subclass to do a more complex check. bool isValid(void) const; - + virtual TeAttrHdl GetHandle() const { - return handle; + return handle; } virtual void SetHandle(TeAttrHdl hdl) { writeHandle = true; @@ -612,7 +612,7 @@ public: virtual bool Read(trpgReadBuffer &) { return false;}; /* Every read/writeable must be able to reset itself to a pristine state so that, for example, multiple objects of the same type can be read into - it, one after the other. */ + it, one after the other. */ virtual void Reset(void) = 0; /* The print method is optional. If it's not there, it won't do anything. */ @@ -692,7 +692,7 @@ protected: }; /* Archive File Cache. - This class keeps + This class keeps */ TX_EXDECL class TX_CLDECL trpgrAppFileCache { public: diff --git a/src/osgPlugins/txp/trpage_label.cpp b/src/osgPlugins/txp/trpage_label.cpp index 2dbb1ffa2..62419e076 100644 --- a/src/osgPlugins/txp/trpage_label.cpp +++ b/src/osgPlugins/txp/trpage_label.cpp @@ -203,8 +203,8 @@ bool trpgTextStyle::operator == (const trpgTextStyle& in) const if (font != in.font) return false; - if (bold != in.bold || - italic != in.italic || + if (bold != in.bold || + italic != in.italic || underline != in.underline) return false; @@ -238,7 +238,7 @@ bool trpgTextStyleTable::isValid() const { //for (int i=0;isecond.isValid()) return false; @@ -258,7 +258,7 @@ int trpgTextStyleTable::AddStyle(const trpgTextStyle &style) int trpgTextStyleTable::FindAddStyle(const trpgTextStyle &style) { StyleMapType::const_iterator itr = styleMap.begin(); - for ( ; itr != styleMap.end( ); itr++) + for ( ; itr != styleMap.end( ); itr++) if (itr->second == style) return itr->first; @@ -504,7 +504,7 @@ int trpgSupportStyleTable::AddStyle(const trpgSupportStyle &style) int trpgSupportStyleTable::FindAddStyle(const trpgSupportStyle &style) { SupportStyleMapType::const_iterator itr = supportStyleMap.begin(); - for ( ; itr != supportStyleMap.end( ); itr++) + for ( ; itr != supportStyleMap.end( ); itr++) if (itr->second == style) return itr->first; @@ -539,7 +539,7 @@ bool trpgSupportStyleTable::Write(trpgWriteBuffer &buf) // Write the styles SupportStyleMapType::iterator itr = supportStyleMap.begin(); - for ( ; itr != supportStyleMap.end( ); itr++) + for ( ; itr != supportStyleMap.end( ); itr++) itr->second.Write(buf); buf.End(); diff --git a/src/osgPlugins/txp/trpage_light.cpp b/src/osgPlugins/txp/trpage_light.cpp index de214b8c8..5c1fa5f12 100644 --- a/src/osgPlugins/txp/trpage_light.cpp +++ b/src/osgPlugins/txp/trpage_light.cpp @@ -585,7 +585,7 @@ bool trpgLightAttr::Read(trpgReadBuffer &buf) parse.AddCallback(TRPGLIGHTATTR_CALLIGRAPHIC,&lightAttrCb,false); parse.AddCallback(TRPGLIGHTATTR_ANIMATION,&lightAttrCb,false); parse.AddCallback(TRPGLIGHTATTR_COMMENT,&lightAttrCb,false); - parse.AddCallback(TRPGLIGHTATTR_HANDLE,&lightAttrCb,false); + parse.AddCallback(TRPGLIGHTATTR_HANDLE,&lightAttrCb,false); parse.Parse(buf); return isValid(); @@ -944,7 +944,7 @@ trpgLightTable::~trpgLightTable() bool trpgLightTable::isValid() const { LightMapType::const_iterator itr = lightMap.begin(); - for ( ; itr != lightMap.end( ); itr++) + for ( ; itr != lightMap.end( ); itr++) { if (!itr->second.isValid()) { @@ -965,7 +965,7 @@ int trpgLightTable::AddLightAttr(const trpgLightAttr& inLight) handle = lightMap.size(); } lightMap[handle] = inLight; - return handle; + return handle; } int trpgLightTable::FindAddLightAttr(const trpgLightAttr& inLight) { @@ -1004,8 +1004,8 @@ bool trpgLightTable::Write(trpgWriteBuffer &buf) numLights = lightMap.size(); buf.Add(numLights); LightMapType::iterator itr = lightMap.begin(); - for ( ; itr != lightMap.end( ); itr++) - itr->second.Write(buf); + for ( ; itr != lightMap.end( ); itr++) + itr->second.Write(buf); //for (unsigned int i=0;i= (int)childLocationInfo.size()) throw std::invalid_argument( "trpgManagedTile::GetChildLocationInfo(): index argument out of bound."); - + return childLocationInfo[childIdx]; } @@ -160,13 +160,13 @@ bool trpgManagedTile::GetChildTileLoc(int childIdx, int &x,int &y,int &lod) cons "trpgManagedTile::GetChildTileLoc(): index argument out of bound."); TileLocationInfo const& info = childLocationInfo[childIdx]; - x = info.x; - y = info.y; + x = info.x; + y = info.y; lod = info.lod; return true; } - + const trpgwAppAddress& trpgManagedTile::GetChildTileAddress(int childIdx) const { if(childIdx < 0 || childIdx >= (int)childLocationInfo.size()) @@ -192,7 +192,7 @@ const trpgLocalMaterial *trpgManagedTile::GetLocMaterial(int id) const if (id <0 || id >= (int)matList->size()) return NULL; - + return &(*matList)[id]; } @@ -240,7 +240,7 @@ void trpgManagedTile::Print(trpgPrintBuffer &buf) sprintf(line,"x = %d, y = %d, lod = %d",location.x, location.y, location.lod); buf.prnLine(line); // Note: Should print the rest too, probably. } - + /* Page Manager LOD Page Info class. Used by the page manager to keep track of paging information for a single terrain LOD. See the header file for details. @@ -300,7 +300,7 @@ bool trpgPageManager::LodPageInfo::Init(trpgr_Archive *archive, int myLod, doubl pageDist *= scale; head->GetVersion(majorVersion, minorVersion); - + // Area of interest size (in cells) aoiSize.x = (int)(pageDist/cellSize.x); @@ -315,7 +315,7 @@ bool trpgPageManager::LodPageInfo::Init(trpgr_Archive *archive, int myLod, doubl Version 2.1 now support variable lods, it might be overkill to allocate a free list by supposing that the tiles exist. So only for version 2.1 an over we will use the divider to allocate less - */ + */ maxNumTiles = (int)(1.15*(2*aoiSize.x+1)*(2*aoiSize.y+1)); if(majorVersion == 2 && minorVersion >= 1) maxNumTiles = (int)(1.15*(2*aoiSize.x+1)*(2*aoiSize.y+1)/freeListDivider); @@ -323,7 +323,7 @@ bool trpgPageManager::LodPageInfo::Init(trpgr_Archive *archive, int myLod, doubl maxNumTiles = (int)(1.15*(2*aoiSize.x+1)*(2*aoiSize.y+1)); - + // Allocate 'em for (int i=0;iGetTileLoc(tileX,tileY,tileLod); - if (tileX >= sw.x && + if (tileX >= sw.x && tileX <= ne.x && - tileY >= sw.y && + tileY >= sw.y && tileY <= ne.y) return true; else @@ -456,11 +456,11 @@ void trpgPageManager::LodPageInfo::AddChildrenToLoadList(std::vectorGetNbChildren(); @@ -516,27 +516,27 @@ void trpgPageManager::LodPageInfo::AddChildrenToLoadList(std::vector= sw.x && x <= ne.x && y >= sw.y && y <= ne.y) { - + trpgManagedTile *tile = 0; if(freeList.size() > 0){ @@ -617,7 +617,7 @@ void trpgPageManager::LodPageInfo::Update() } } current.resize(curPos); - + bool doUpdate = true; if(majorVersion == 2 && minorVersion >= 1) { @@ -682,13 +682,13 @@ void trpgPageManager::LodPageInfo::GetLoadedTileWithin(double pagingDistance, st // Calculate the area that we must check, in parent cell coordinate trpg2iPoint sw, ne; - sw.x = cell.x - aoi_size.x; + sw.x = cell.x - aoi_size.x; sw.y = cell.y - aoi_size.y; - ne.x = cell.x + aoi_size.x; + ne.x = cell.x + aoi_size.x; ne.y = cell.y + aoi_size.y; - sw.x = MAX(0,sw.x); + sw.x = MAX(0,sw.x); sw.y = MAX(0,sw.y); - ne.x = MIN(lodSize.x-1,ne.x); + ne.x = MIN(lodSize.x-1,ne.x); ne.y = MIN(lodSize.y-1,ne.y); tileList.clear(); @@ -764,7 +764,7 @@ void trpgPageManager::Init(trpgr_Archive *inArch) int numLod; head->GetNumLods(numLod); head->GetVersion(majorVersion, minorVersion); - + // Reset the terrain LOD paging classes. valid = true; pageInfo.resize(numLod); @@ -798,7 +798,7 @@ void trpgPageManager::Init(trpgr_Archive *inArch, int maxLod) if(maxLod > numLod) maxLod = numLod; - + // Reset the terrain LOD paging classes. valid = true; pageInfo.resize(maxLod); @@ -921,7 +921,7 @@ void trpgPageManager::AckLoad(std::vector const& children) } } } - + pageInfo[lastLod].AckLoad(); lastLoad = None; lastTile = NULL; diff --git a/src/osgPlugins/txp/trpage_managers.h b/src/osgPlugins/txp/trpage_managers.h index 01479ea22..5f8fd8c91 100644 --- a/src/osgPlugins/txp/trpage_managers.h +++ b/src/osgPlugins/txp/trpage_managers.h @@ -51,7 +51,7 @@ public: /* Call this when you hit a tile header in your own Scene parser callback. The managed tile - can then keep track of which textures and models + can then keep track of which textures and models go with this tile. */ bool ParseTileHeader(trpgReadBuffer &); @@ -68,7 +68,7 @@ public: // In version 2.1 we no longer have the tile table to // find the tiles, only by traversing the parent can it be - // found. So when we have this info, this is were to save it. + // found. So when we have this info, this is were to save it. void SetTileAddress(const trpgwAppAddress& gAddr); void SetTileAddress(int32 file, int32 offset); const trpgwAppAddress& GetTileAddress() const; @@ -143,8 +143,8 @@ public: const TileLocationInfo& GetChildLocationInfo(int childIdx) const; bool GetChildTileLoc(int childIdx, int &x,int &y,int &lod) const; const trpgwAppAddress& GetChildTileAddress(int childIdx) const; - - + + protected: // Set if a tile is currently loaded bool isLoaded; @@ -217,7 +217,7 @@ public: and pass it on to AckLoad() which will add to the appropriate lod list the children info. If this is not done then only lod 0 will be pageable. */ - + virtual void AckLoad(std::vector const& children); // Using this call with version 2.1 and over will only page lod 0 tiles @@ -269,7 +269,7 @@ protected: trpg2dPoint pagePt; /* Information associated with each terrain level of - detail as related to paging. + detail as related to paging. */ TX_EXDECL class TX_CLDECL LodPageInfo { friend class trpgPageManager; @@ -471,17 +471,17 @@ public: void Reset(); protected: // typedef std::vector ChildList; -// The const in the template parameter was removed because it causes GCC to -// freak out. I am of the opinion that const doesn't make sense in a template -// parameter for std::vector anyway... const prevents you from changing the -// value, so what exactly is the point? How does one add entries to the vector +// The const in the template parameter was removed because it causes GCC to +// freak out. I am of the opinion that const doesn't make sense in a template +// parameter for std::vector anyway... const prevents you from changing the +// value, so what exactly is the point? How does one add entries to the vector // without giving them a value? -ADS typedef std::vector ChildList; ChildList childList; }; /* Page Manager Tester. This class tests a given paging manager - by applying likely + by applying likely */ TX_EXDECL class TX_CLDECL trpgPageManageTester { @@ -496,7 +496,7 @@ public: /* Feeds the paging manager coordinates starting from the lower left to upper right of the database in the - given increment. + given increment. */ void Fly_LL_to_UR(double dist=100.0); diff --git a/src/osgPlugins/txp/trpage_material.cpp b/src/osgPlugins/txp/trpage_material.cpp index 6e1b368bb..2140cfbea 100644 --- a/src/osgPlugins/txp/trpage_material.cpp +++ b/src/osgPlugins/txp/trpage_material.cpp @@ -82,7 +82,7 @@ void trpgMatTable::SetNumMaterial(int /*no*/) void trpgMatTable::SetMaterial(int nm,const trpgMaterial &mat) -{ +{ materialMap[nm] = mat; numMat = materialMap.size(); } @@ -92,7 +92,7 @@ void trpgMatTable::SetMaterial(int nm,const trpgMaterial &mat) int trpgMatTable::AddMaterial(const trpgMaterial &mat,bool lookForExisting) { trpgMaterial cmat = mat; // necessary? - + // having a shadeModel of 999 indicates that the entry is free. I thought this would // work fine, until I realized that evidently most of the time the shademodel isn't set // at all. Now my kludge takes so much work it's almost worth doing it right. @@ -102,7 +102,7 @@ int trpgMatTable::AddMaterial(const trpgMaterial &mat,bool lookForExisting) int baseMat=0; //bool spaceInTable=false; //int offset=baseMat; - + if (lookForExisting) { // Look for a matching base material minus the textures //for (baseMat = 0;baseMat < numMat;baseMat++) { @@ -192,7 +192,7 @@ bool trpgMatTable::Write(trpgWriteBuffer &buf) bool trpgMatTable::GetNumTable(int &no) const { if (!isValid()) { - no = 0; // otherwise this causes errors because it is uninitialized. + no = 0; // otherwise this causes errors because it is uninitialized. return false; } no = numTable; @@ -201,9 +201,9 @@ bool trpgMatTable::GetNumTable(int &no) const bool trpgMatTable::GetNumMaterial(int &no) const { if (!isValid()) { - no = 0; + no = 0; return false; - } + } no = numMat; return true; } @@ -252,7 +252,7 @@ bool trpgMatTable::Read(trpgReadBuffer &buf) status = mat.Read(buf); buf.PopLimit(); if (!status) throw 1; - AddMaterial(mat,false); + AddMaterial(mat,false); } numTable += nTable; numMat = materialMap.size(); @@ -1103,7 +1103,7 @@ void trpgTexture::SetName(const char *inName) // Get Name bool trpgTexture::GetName(char *outName,int outLen) const { - if (!isValid()) + if (!isValid()) return false; int len = (name) ? strlen(name) : 0; @@ -1225,7 +1225,7 @@ void trpgTexture::SetNumLayer(int layers) bool trpgTexture::GetNumLayer(int &layers) const { - if (!isValid()) + if (!isValid()) return false; GetImageDepth(layers); return true; @@ -1242,7 +1242,7 @@ void trpgTexture::AddTile() } bool trpgTexture::GetNumTile(int &num) const { - if (!isValid()) + if (!isValid()) return false; num = useCount; return true; @@ -1258,7 +1258,7 @@ trpgTexture &trpgTexture::operator = (const trpgTexture &in) SetName(in.name); useCount = in.useCount; - + sizeX = in.sizeX; sizeY = in.sizeY; @@ -1267,7 +1267,7 @@ trpgTexture &trpgTexture::operator = (const trpgTexture &in) isMipmap = in.isMipmap; addr = in.addr; - + writeHandle = in.writeHandle; handle = in.handle; @@ -1341,7 +1341,7 @@ int32 trpgTexture::CalcTotalSize() const // Calculate the size of a given mip level int32 trpgTexture::MipLevelSize(int miplevel) { - + if ( miplevel >= 0 && miplevel < CalcNumMipmaps() ) { if ( !storageSize.size() ) CalcMipLevelSizes(); @@ -1634,7 +1634,7 @@ bool trpgTexTable::isValid() const } TextureMapType::const_iterator itr = textureMap.begin(); - for ( ; itr != textureMap.end( ); itr++) { + for ( ; itr != textureMap.end( ); itr++) { if(!itr->second.isValid()) { strcpy(errMess, "A texture in the texture table is invalid"); return false; @@ -1652,7 +1652,7 @@ void trpgTexTable::SetNumTextures(int /*no*/) } int trpgTexTable::AddTexture(const trpgTexture &inTex) { - + TeAttrHdl hdl = inTex.GetHandle(); if(hdl==-1) { // if no handle is specified, we will use an index as the handle (just like before 2.3) @@ -1729,9 +1729,9 @@ bool trpgTexTable::GetNumTextures(int &no) const } bool trpgTexTable::GetTexture(int id,trpgTexture &ret) const { - if (!isValid()) + if (!isValid()) return false; - if (id < 0) + if (id < 0) return false; TextureMapType::const_iterator itr = textureMap.find(id); if(itr == textureMap.end()) { @@ -1743,7 +1743,7 @@ bool trpgTexTable::GetTexture(int id,trpgTexture &ret) const } const trpgTexture *trpgTexTable::GetTextureRef(int id) const { - if (id < 0) + if (id < 0) return false; TextureMapType::const_iterator itr = textureMap.find(id); if(itr == textureMap.end()) { diff --git a/src/osgPlugins/txp/trpage_model.cpp b/src/osgPlugins/txp/trpage_model.cpp index dc4eb3b73..acf09a08e 100644 --- a/src/osgPlugins/txp/trpage_model.cpp +++ b/src/osgPlugins/txp/trpage_model.cpp @@ -258,7 +258,7 @@ bool trpgModel::Read(trpgReadBuffer &buf, bool hasHandle) handle = -1; } } - else + else handle = -1; if (type == Local) { diff --git a/src/osgPlugins/txp/trpage_nodes.cpp b/src/osgPlugins/txp/trpage_nodes.cpp index bb16cf59c..7ff5a3a52 100644 --- a/src/osgPlugins/txp/trpage_nodes.cpp +++ b/src/osgPlugins/txp/trpage_nodes.cpp @@ -474,7 +474,7 @@ bool trpgLayer::Write(trpgWriteBuffer &buf) buf.Add(name); } - buf.End(); + buf.End(); return true; } @@ -665,7 +665,7 @@ bool trpgModelRef::Write(trpgWriteBuffer &buf) { if (!isValid()) return false; - + buf.Begin(TRPG_MODELREF); buf.Add(modelRef); for (int i=0;i<4;i++) @@ -891,7 +891,7 @@ bool trpgChildRef::GetTileZValue( float& gZmin, float& gZmax) const // Validity check bool trpgChildRef::isValid() const { - if (lod < 0) + if (lod < 0) return false; return true; } diff --git a/src/osgPlugins/txp/trpage_parse.cpp b/src/osgPlugins/txp/trpage_parse.cpp index b10a4a577..8e577a679 100644 --- a/src/osgPlugins/txp/trpage_parse.cpp +++ b/src/osgPlugins/txp/trpage_parse.cpp @@ -23,7 +23,7 @@ If you want to parse data out of a different structure instead, look at subclassing trpgReadBuffer and replacing its virtual methods. That's what trpgMemReadBuffer is doing. - + This file also contains the implementation of trpgSceneParser(). That class implements a set of callbacks for handling the Pushes and Pops in an archive. You fill in the Start/EndChildren callbacks and register @@ -97,7 +97,7 @@ void trpgr_Parser::AddCallback(trpgToken tok,trpgr_Callback *cb,bool in_dest) class WriteWrapper : public trpgr_Callback { public: WriteWrapper(trpgReadWriteable *in_wr) { wr = in_wr; }; - void *Parse(trpgToken,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) { if (wr->Read(buf)) return wr; else @@ -131,7 +131,7 @@ trpgr_Callback *trpgr_Parser::GetCallback(trpgToken tok) else return 0; } - + // Remove Callback void trpgr_Parser::RemoveCallback(trpgToken tok) @@ -240,7 +240,7 @@ class trpgSceneHelperPush : public trpgr_Callback public: trpgSceneHelperPush(trpgSceneParser *in_parse) { parse = in_parse; }; - + void *Parse(trpgToken /*tok*/,trpgReadBuffer& /*buf*/) { // Call the start children callback diff --git a/src/osgPlugins/txp/trpage_pparse.cpp b/src/osgPlugins/txp/trpage_pparse.cpp index 066055d80..a233b7266 100644 --- a/src/osgPlugins/txp/trpage_pparse.cpp +++ b/src/osgPlugins/txp/trpage_pparse.cpp @@ -42,16 +42,16 @@ namespace // Save the list // std::vector childRefList; -// The const in the template parameter was removed because it causes GCC to -// freak out. I am of the opinion that const doesn't make sense in a template -// parameter for std::vector anyway... const prevents you from changing the -// value, so what exactly is the point? How does one add entries to the vector +// The const in the template parameter was removed because it causes GCC to +// freak out. I am of the opinion that const doesn't make sense in a template +// parameter for std::vector anyway... const prevents you from changing the +// value, so what exactly is the point? How does one add entries to the vector // without giving them a value? -ADS std::vector childRefList; for(unsigned int idx =0; idx < parser.GetNbChildrenRef(); idx++) childRefList.push_back(*parser.GetChildRef(idx)); - + for(unsigned int idx =0; idx < childRefList.size(); idx++) { const trpgChildRef& childRef = childRefList[idx]; @@ -72,7 +72,7 @@ namespace if(status) printBuf(glod, gx, gy, archive, parser, childBuf, pBuf); - + } } } // end namespace @@ -104,7 +104,7 @@ trpgPrintGraphParser::trpgPrintGraphParser(trpgr_Archive *inArch,trpgrImageHelpe AddCallback(TRPG_LIGHT,new ReadHelper(this,printBuf)); AddCallback(TRPG_LABEL,new ReadHelper(this,printBuf)); AddCallback(TRPGTILEHEADER,new ReadHelper(this,printBuf)); - + childRefCB = dynamic_cast(GetCallback(TRPG_CHILDREF)); } @@ -145,7 +145,7 @@ const trpgChildRef* trpgPrintGraphParser::GetChildRef(unsigned int idx) const return childRefCB->GetChildRef(idx); else return 0; - + } @@ -264,7 +264,7 @@ void *trpgPrintGraphParser::ReadHelper::Parse(trpgToken tok,trpgReadBuffer &buf) // Fetch the individual mipmap levels { - + bool hasMipmap = false; baseTex->GetIsMipmap(hasMipmap); int numMipmap = hasMipmap ? baseTex->CalcNumMipmaps() : 0; @@ -342,8 +342,8 @@ bool trpgPrintArchive(trpgr_Archive *archive,trpgPrintBuffer &pBuf,int flags) { char ls[1024]; - if (!archive->isValid()) return false; - + if (!archive->isValid()) return false; + pBuf.prnLine("====Header Structures===="); // Print out the header portion @@ -362,7 +362,7 @@ bool trpgPrintArchive(trpgr_Archive *archive,trpgPrintBuffer &pBuf,int flags) // Read the local images and do the math for the templates // Now do the tiles - if (!archive->isValid()) return false; + if (!archive->isValid()) return false; int majorVersion, minorVersion; archive->GetHeader()->GetVersion(majorVersion, minorVersion); @@ -383,7 +383,7 @@ bool trpgPrintArchive(trpgr_Archive *archive,trpgPrintBuffer &pBuf,int flags) if(majorVersion == 2 && minorVersion >= 1) { // Version 2.1 - // Because of variable lod support in version 2.1 and over, we can + // Because of variable lod support in version 2.1 and over, we can // no longer suppose that all lod level are all populated with tiles // in all of the gaming area. We have to parse the parent to know that. // Also the tile table only contains lod 0 tiles so we can no longer access @@ -396,7 +396,7 @@ bool trpgPrintArchive(trpgr_Archive *archive,trpgPrintBuffer &pBuf,int flags) printBuf(0, x, y, archive, parser, buf, pBuf); } - + } else { diff --git a/src/osgPlugins/txp/trpage_range.cpp b/src/osgPlugins/txp/trpage_range.cpp index e34f17f92..27225d493 100644 --- a/src/osgPlugins/txp/trpage_range.cpp +++ b/src/osgPlugins/txp/trpage_range.cpp @@ -193,7 +193,7 @@ bool trpgRange::Read(trpgReadBuffer &buf) // Read the handle if we can.. try { int32 tempHandle; - if(buf.Get(tempHandle)) + if(buf.Get(tempHandle)) { handle = tempHandle; } @@ -348,7 +348,7 @@ trpgRangeTable & trpgRangeTable::operator = (const trpgRangeTable &inTab) { Reset(); RangeMapType::const_iterator itr = inTab.rangeMap.begin(); - for ( ; itr != inTab.rangeMap.end( ); itr++) + for ( ; itr != inTab.rangeMap.end( ); itr++) rangeMap[itr->first] = itr->second; #if 0 diff --git a/src/osgPlugins/txp/trpage_rarchive.cpp b/src/osgPlugins/txp/trpage_rarchive.cpp index 324615e36..4c895827e 100644 --- a/src/osgPlugins/txp/trpage_rarchive.cpp +++ b/src/osgPlugins/txp/trpage_rarchive.cpp @@ -135,7 +135,7 @@ bool trpgr_Archive::ReadSubArchive(int row, int col, trpgEndian cpuNess) int ret; trpgHeader blockHeader; trpgr_Parser bparser; - + char blockpath[1024]; //open the block archive // the block archive will be in the base dir + \\cols\\row\\archive.txp @@ -151,26 +151,26 @@ bool trpgr_Archive::ReadSubArchive(int row, int col, trpgEndian cpuNess) // The block archive will always be the same endianness as the master if ( (bmagic != GetMagicNumber()) && (trpg_byteswap_int(bmagic) != GetMagicNumber()) ) return false; - + int32 bheaderSize=0; - if (fread(&bheaderSize,sizeof(int32),1,bfp) != 1) + if (fread(&bheaderSize,sizeof(int32),1,bfp) != 1) return false; if (ness != cpuNess) bheaderSize = trpg_byteswap_int(bheaderSize); int bheadLen = bheaderSize; - if (bheadLen < 0) + if (bheadLen < 0) return false; // Read in the header whole trpgMemReadBuffer bbuf(ness); bbuf.SetLength(bheadLen); char *bdata = bbuf.GetDataPtr(); - if ((ret = GetHeaderData(bdata,bheadLen,bfp)) != bheadLen) + if ((ret = GetHeaderData(bdata,bheadLen,bfp)) != bheadLen) return false; - //keep track of where this came from in the master table. + //keep track of where this came from in the master table. tileTable.SetCurrentBlock(row,col,true); texTable.SetCurrentBlock(row,col); - + bparser.AddCallback(TRPGHEADER,&blockHeader); bparser.AddCallback(TRPGMATTABLE,&materialTable); // Went back to oldest style for 2.0 //if(!headerHasTexTable) { @@ -180,8 +180,8 @@ bool trpgr_Archive::ReadSubArchive(int row, int col, trpgEndian cpuNess) bparser.AddCallback(TRPGLIGHTTABLE,&lightTable); // Added for 2.0 bparser.AddCallback(TRPGRANGETABLE,&rangeTable); // Added for 2.0 bparser.AddCallback(TRPG_TEXT_STYLE_TABLE,&textStyleTable); // Added for 2.1 - bparser.AddCallback(TRPG_SUPPORT_STYLE_TABLE,&supportStyleTable); - bparser.AddCallback(TRPG_LABEL_PROPERTY_TABLE,&labelPropertyTable); + bparser.AddCallback(TRPG_SUPPORT_STYLE_TABLE,&supportStyleTable); + bparser.AddCallback(TRPG_LABEL_PROPERTY_TABLE,&labelPropertyTable); // Don't read the tile table for v1.0 archives // It's only really used for 2.0 archives bparser.AddCallback(TRPGTILETABLE2,&tileTable); @@ -216,19 +216,19 @@ bool trpgr_Archive::ReadHeader(bool readAllBlocks) // Next int64 should be the header size trpgEndian cpuNess = trpg_cpu_byte_order(); int32 headerSize; - if (fread(&headerSize,sizeof(int32),1,fp) != 1) + if (fread(&headerSize,sizeof(int32),1,fp) != 1) return false; if (ness != cpuNess) headerSize = trpg_byteswap_int(headerSize); int headLen = headerSize; - if (headLen < 0) + if (headLen < 0) return false; // Read in the header whole trpgMemReadBuffer buf(ness); buf.SetLength(headLen); char *data = buf.GetDataPtr(); - if ((ret = GetHeaderData(data,headLen,fp)) != headLen) + if ((ret = GetHeaderData(data,headLen,fp)) != headLen) return false; // Set up a parser @@ -245,8 +245,8 @@ bool trpgr_Archive::ReadHeader(bool readAllBlocks) parser.AddCallback(TRPGLIGHTTABLE,&lightTable); // Added for 2.0 parser.AddCallback(TRPGRANGETABLE,&rangeTable); // Added for 2.0 parser.AddCallback(TRPG_TEXT_STYLE_TABLE,&textStyleTable); // Added for 2.1 - parser.AddCallback(TRPG_SUPPORT_STYLE_TABLE,&supportStyleTable); - parser.AddCallback(TRPG_LABEL_PROPERTY_TABLE,&labelPropertyTable); + parser.AddCallback(TRPG_SUPPORT_STYLE_TABLE,&supportStyleTable); + parser.AddCallback(TRPG_LABEL_PROPERTY_TABLE,&labelPropertyTable); // Don't read the tile table for v1.0 archives // It's only really used for 2.0 archives parser.AddCallback(TRPGTILETABLE2,&tileTable); @@ -255,7 +255,7 @@ bool trpgr_Archive::ReadHeader(bool readAllBlocks) if (!parser.Parse(buf)) return false; - if(header.GetIsMaster()) + if(header.GetIsMaster()) { // bool firstBlock = true; //if the master has textures, we want to use them instead of the tables in the @@ -315,17 +315,17 @@ bool trpgr_Archive::ReadHeader(bool readAllBlocks) // error will be returned if you try to use the table with a differrent lod. bool trpgr_Archive::ReadTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf) { - if (!isValid()) + if (!isValid()) return false; // Reality check the address int32 numLods; header.GetNumLods(numLods); - if (static_cast(lod) >= numLods) + if (static_cast(lod) >= numLods) return false; trpg2iPoint lodSize; header.GetLodSize(lod,lodSize); - if (static_cast(x) >= lodSize.x || static_cast(y) >= lodSize.y) + if (static_cast(x) >= lodSize.x || static_cast(y) >= lodSize.y) return false; trpgTileTable::TileMode tileMode; @@ -334,7 +334,7 @@ bool trpgr_Archive::ReadTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf bool status = true; if (tileMode == trpgTileTable::External || tileMode == trpgTileTable::ExternalSaved) { status = ReadExternalTile(x, y, lod, buf); - + } else { // Local tile. Figure out where it is (which file) int majorVersion, minorVersion; @@ -386,18 +386,18 @@ bool trpgr_Archive::ReadExternalTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuf throw 1; } // Find the file end - if (fseek(fp,0,SEEK_END)) + if (fseek(fp,0,SEEK_END)) throw 1; // Note: This means tile is capped at 2 gigs long pos = ftell(fp); - if (fseek(fp,0,SEEK_SET)) + if (fseek(fp,0,SEEK_SET)) throw 1; // Now we know the size. Read the whole file buf.SetLength(pos); char *data = buf.GetDataPtr(); - if (fread(data,pos,1,fp) != 1) + if (fread(data,pos,1,fp) != 1) throw 1; - fclose(fp); + fclose(fp); fp = NULL; } catch (...) { @@ -412,7 +412,7 @@ bool trpgr_Archive::ReadTile(const trpgwAppAddress& addr, trpgMemReadBuffer &buf { // Fetch the appendable file from the cache trpgrAppFile *tf = tileCache->GetFile(ness,addr.file,addr.col,addr.row); - if (!tf) + if (!tf) return false; // Fetch the tile @@ -431,7 +431,7 @@ const trpgMatTable *trpgr_Archive::GetMaterialTable() const { return &materialTable; } -trpgTexTable *trpgr_Archive::GetTexTable() +trpgTexTable *trpgr_Archive::GetTexTable() { return &texTable; } @@ -531,7 +531,7 @@ void trpgrImageHelper::Init(trpgEndian inNess,char *inDir, else { geotypCache = texCache; } - + } trpgrImageHelper::~trpgrImageHelper() @@ -613,22 +613,22 @@ bool trpgrImageHelper::GetNthImageInfoForLocalMat(const trpgLocalMaterial *locMa // Eventually, either store multiple base materials for each local material, // or overhaul this in some other fashion. int numTables; - if (!matTable->GetNumTable(numTables)) + if (!matTable->GetNumTable(numTables)) return false; - if (index>=numTables) + if (index>=numTables) return false; if (index>0) matSubTable=index; // otherwise, leave it alone - could be nonzero const trpgMaterial *mat = matTable->GetMaterialRef(matSubTable,matID); - if (!mat) + if (!mat) return false; // Now get the texture (always the first one) trpgTextureEnv texEnv; int32 texID; - if (!mat->GetTexture(0,texID,texEnv)) + if (!mat->GetTexture(0,texID,texEnv)) return false; const trpgTexture *tex = texTable->GetTextureRef(texID); - if (!tex) + if (!tex) return false; totSize = tex->CalcTotalSize(); @@ -645,7 +645,7 @@ bool trpgrImageHelper::GetImageForLocalMat(const trpgLocalMaterial *locMat,char bool trpgrImageHelper::GetNthImageForLocalMat(const trpgLocalMaterial *locMat,int index, char *data,int dataSize) { - if (!locMat->isValid()) + if (!locMat->isValid()) return false; const trpgMaterial *mat; @@ -664,7 +664,7 @@ bool trpgrImageHelper::GetNthImageForLocalMat(const trpgLocalMaterial *locMat,in trpgwAppAddress addr; if (!locMat->GetNthAddr(index,addr)) return false; trpgrAppFile *af = texCache->GetFile(ness,addr.file,addr.col,addr.row); - if (!af) + if (!af) return false; if (!af->Read(data,addr.offset,0,dataSize)) return false; diff --git a/src/osgPlugins/txp/trpage_read.h b/src/osgPlugins/txp/trpage_read.h index f1dc8f9b8..fed7400fd 100644 --- a/src/osgPlugins/txp/trpage_read.h +++ b/src/osgPlugins/txp/trpage_read.h @@ -194,7 +194,7 @@ public: virtual bool ReadHeader(void); // Read header (materials, tile table. etc..) //overload that lets you specify if you want to read all the blocks now, //or defer reading them for later. - virtual bool ReadHeader(bool readAllBlocks); + virtual bool ReadHeader(bool readAllBlocks); bool ReadSubArchive(int row, int col, trpgEndian cpuNess); // In version 2.1, only tile at lod 0 are fetchable via the tile table virtual bool ReadTile(uint32 x, uint32 y, uint32 lod,trpgMemReadBuffer &); diff --git a/src/osgPlugins/txp/trpage_readbuf.cpp b/src/osgPlugins/txp/trpage_readbuf.cpp index 6864b8872..4d75f508e 100644 --- a/src/osgPlugins/txp/trpage_readbuf.cpp +++ b/src/osgPlugins/txp/trpage_readbuf.cpp @@ -27,7 +27,7 @@ trpgMemReadBuffer is a subclass of that which implements methods for reading out of a chunk of memory. Data is read off of disk and then dumped into a read buffer for parsing. - If you wanted to read directly from disk, for example, you could + If you wanted to read directly from disk, for example, you could implement a trpgDiskReadBuffer as a subclass of trpgReadBuffer. */ diff --git a/src/osgPlugins/txp/trpage_scene.cpp b/src/osgPlugins/txp/trpage_scene.cpp index 7956241ae..bbf6ec6f4 100644 --- a/src/osgPlugins/txp/trpage_scene.cpp +++ b/src/osgPlugins/txp/trpage_scene.cpp @@ -351,7 +351,7 @@ public: top->AddChild(childRef); else delete childRef; - + return childRef; } protected: diff --git a/src/osgPlugins/txp/trpage_swap.cpp b/src/osgPlugins/txp/trpage_swap.cpp index 48f1908db..bc1adf932 100644 --- a/src/osgPlugins/txp/trpage_swap.cpp +++ b/src/osgPlugins/txp/trpage_swap.cpp @@ -202,7 +202,7 @@ TX_CPPDECL trpgEndian trpg_cpu_byte_order(void) { if (osg::getCpuByteOrder()==osg::BigEndian) return BigEndian; - else + else return LittleEndian; } diff --git a/src/osgPlugins/txp/trpage_tile.cpp b/src/osgPlugins/txp/trpage_tile.cpp index 7db2fdf68..81921d053 100644 --- a/src/osgPlugins/txp/trpage_tile.cpp +++ b/src/osgPlugins/txp/trpage_tile.cpp @@ -47,7 +47,7 @@ void trpgTileTable::Reset() valid = true; currentRow = -1; currentCol = -1; - + } // Destructor @@ -71,7 +71,7 @@ void trpgTileTable::SetNumLod(int numLod) void trpgTileTable::SetNumTiles(int nx,int ny,int lod) { - + if(localBlock) { LodInfo &li = lodInfo[lod]; li.numX = nx; li.numY = ny; @@ -114,7 +114,7 @@ void trpgTileTable::SetNumTiles(int nx,int ny,int lod) } void trpgTileTable::SetTile(int x,int y,int lod,trpgwAppAddress &ref,float32 zmin,float32 zmax) { - if (lod < 0 || lod >= static_cast(lodInfo.size())) + if (lod < 0 || lod >= static_cast(lodInfo.size())) return; if (mode == External) return; @@ -159,14 +159,14 @@ bool trpgTileTable::GetTile(int x,int y,int lod,trpgwAppAddress &ref,float32 &zm const LodInfo &li = lodInfo[lod]; int loc; if(localBlock) { - loc = 0; + loc = 0; } else { if (x < 0 || x >= li.numX || y < 0 || y >= li.numY) return false; loc = y*li.numX + x; } - + ref = li.addr[loc]; zmin = li.elev_min[loc]; zmax = li.elev_max[loc]; @@ -181,7 +181,7 @@ bool trpgTileTable::Write(trpgWriteBuffer &buf) return false; buf.Begin(TRPGTILETABLE2); - + // Write the mode buf.Add(mode); @@ -270,7 +270,7 @@ bool trpgTileTable::Read(trpgReadBuffer &buf) ref.offset = offset; ref.col = currentCol; ref.row = currentRow; - + float emin,emax; buf.Get(emin); buf.Get(emax); @@ -281,7 +281,7 @@ bool trpgTileTable::Read(trpgReadBuffer &buf) else { buf.Get(li.numX); buf.Get(li.numY); - if (li.numX <= 0 || li.numY <= 0) + if (li.numX <= 0 || li.numY <= 0) throw 1; int numTile = li.numX*li.numY; li.addr.resize(numTile); @@ -487,7 +487,7 @@ bool trpgTileHeader::Write(trpgWriteBuffer &buf) } // Tile Header CB -// Used to aid in parsing tile header +// Used to aid in parsing tile header // We want the tile header to be expandable, so be careful here class tileHeaderCB : public trpgr_Callback { public: diff --git a/src/osgPlugins/txp/trpage_warchive.cpp b/src/osgPlugins/txp/trpage_warchive.cpp index 2442c7d46..07ad78bd5 100644 --- a/src/osgPlugins/txp/trpage_warchive.cpp +++ b/src/osgPlugins/txp/trpage_warchive.cpp @@ -183,7 +183,7 @@ void trpgwArchive::Init(char *inDir,char *inFile,trpg2dPoint &sw, trpg2dPoint &n labelPropertyTable = *inArch->GetLabelPropertyTable(); // Need to resize the tile table (maybe) - // NOTE: Starting with version 2.1, the tile tables will contain only + // NOTE: Starting with version 2.1, the tile tables will contain only // the lod 0 tiles trpgTileTable::TileMode tileTableMode; if (!extentsUnchanged) { @@ -486,7 +486,7 @@ bool trpgwArchive::CheckpointHeader() // External tiles are easy tileTable.SetMode(trpgTileTable::External); } else if( tileMode == TileExternalSaved) { - + if(!isRegenerate && firstHeaderWrite) { // Set up the sizes @@ -524,7 +524,7 @@ bool trpgwArchive::CheckpointHeader() trpg2iPoint lodSize; header.GetLodSize(0,lodSize); tileTable.SetNumTiles(lodSize.x, lodSize.y, 0); - + } else { @@ -538,11 +538,11 @@ bool trpgwArchive::CheckpointHeader() header.GetLodSize(i,lodSize); tileTable.SetNumTiles(lodSize.x,lodSize.y,i); } - + } firstHeaderWrite = false; } - + // Now set the individual tile locations // Nothing special need to be done with version 2.1 since @@ -558,11 +558,11 @@ bool trpgwArchive::CheckpointHeader() } tf.tiles.clear(); - - + + } } - + // Write all the headers into a buffer if (!header.Write(buf)) @@ -611,8 +611,8 @@ bool trpgwArchive::CheckpointHeader() return false; } } - - + + if(!modelTable.Write(buf) ) { strcpy(errMess, "Error writing model table"); @@ -1323,7 +1323,7 @@ void trpgwGeomHelper::Optimize() else isStrip = (c[0] == b[2] && c[1] == b[1]); b[0] = c[0]; b[1] = c[1]; b[2] = c[2]; - } + } flip = !flip; } while (triId < numTri && isStrip); @@ -1497,7 +1497,7 @@ trpgwAppFile * trpgwImageHelper::IncrementTextureFile(bool geotyp) { char filename[1024]; trpgwAppFile *thefile = texFile; - + if(geotyp && separateGeoTypical) { thefile = geotypFile; sprintf(filename,"%s" PATHSEPERATOR "geotypFile_%d.txf",dir,static_cast(geotypFileIDs.size())); @@ -1510,7 +1510,7 @@ trpgwAppFile * trpgwImageHelper::IncrementTextureFile(bool geotyp) if (thefile) delete thefile; thefile = NULL; - // Open the next one + // Open the next one thefile = GetNewWAppFile(ness,filename,true); if (!thefile->isValid()) return NULL; @@ -1559,7 +1559,7 @@ bool trpgwImageHelper::DesignateTextureFile(int id) return false; geotypFileIDs.push_back(id); - + return true; } @@ -1584,7 +1584,7 @@ bool trpgwImageHelper::WriteToArchive(const trpgTexture &tex,char *data,trpgwApp if (! (thefile=IncrementTextureFile(geotyp && separateGeoTypical))) return false; } - + while (maxTexFileLen > 0 && thefile->GetLengthWritten() > maxTexFileLen) { if (!(thefile=IncrementTextureFile(geotyp && separateGeoTypical))) return false; diff --git a/src/osgPlugins/txp/trpage_write.h b/src/osgPlugins/txp/trpage_write.h index 18759cd61..2055d77aa 100644 --- a/src/osgPlugins/txp/trpage_write.h +++ b/src/osgPlugins/txp/trpage_write.h @@ -207,11 +207,11 @@ public: // Get a new appendable file virtual trpgwAppFile* GetNewWAppFile(trpgEndian inNess,const char *fileName,bool reuse=false); - + // Write the given texture data into one our local archives bool WriteToArchive(const trpgTexture &tex,char *data,trpgwAppAddress &addr,bool geotyp=false); // Merge block textable into a master. - + protected: diff --git a/src/osgPlugins/txp/trpage_writebuf.cpp b/src/osgPlugins/txp/trpage_writebuf.cpp index 33f5dbeda..d6e739bee 100644 --- a/src/osgPlugins/txp/trpage_writebuf.cpp +++ b/src/osgPlugins/txp/trpage_writebuf.cpp @@ -355,7 +355,7 @@ void trpgwAppFile::Init(trpgEndian inNess,const char *fileName,bool reuse) fseek(fp,0,SEEK_END); lengthSoFar = ftell(fp); valid = true; - } + } } trpgwAppFile::~trpgwAppFile() @@ -446,7 +446,7 @@ int64 trpgwAppFile::Pos() const { if (!isValid()) return 0; - + // Note: This means an appendable file is capped at 2GB long pos = ftell(fp); diff --git a/src/osgPlugins/view/ReaderWriterOsgViewer.cpp b/src/osgPlugins/view/ReaderWriterOsgViewer.cpp index 338cf8af9..e1269b415 100644 --- a/src/osgPlugins/view/ReaderWriterOsgViewer.cpp +++ b/src/osgPlugins/view/ReaderWriterOsgViewer.cpp @@ -1,9 +1,9 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield * - * This application is open source and may be redistributed and/or modified + * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial * applications, as long as this copyright notice is maintained. - * + * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -30,7 +30,7 @@ public: supportsOption("precision","Set the floating point precision of output"); supportsOption("OutputTextureFiles","Output texture image to file"); } - + virtual const char* className() const { return "osgViewer configuration loader"; } void setPrecision(osgDB::Output& fout, const osgDB::ReaderWriter::Options* options) const @@ -41,7 +41,7 @@ public: std::string opt; while (iss >> opt) { - if(opt=="PRECISION" || opt=="precision") + if(opt=="PRECISION" || opt=="precision") { int prec; iss >> prec; @@ -53,7 +53,7 @@ public: } } } - } + } virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const @@ -65,7 +65,7 @@ public: std::string fileName = osgDB::findDataFile( file, options ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osgDB::ifstream fin(fileName.c_str()); if (fin) { diff --git a/src/osgPlugins/vnc/ReaderWriterVNC.cpp b/src/osgPlugins/vnc/ReaderWriterVNC.cpp index 46bd52918..c0496da17 100644 --- a/src/osgPlugins/vnc/ReaderWriterVNC.cpp +++ b/src/osgPlugins/vnc/ReaderWriterVNC.cpp @@ -1,12 +1,12 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1999-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1999-2008 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -25,13 +25,13 @@ extern "C" { class LibVncImage : public osgWidget::VncImage { public: - + LibVncImage(); bool connect(const std::string& hostname); void close(); - + virtual bool sendPointerEvent(int x, int y, int buttonMask); double getTimeOfLastUpdate() const { return _timeOfLastUpdate; } @@ -46,16 +46,16 @@ class LibVncImage : public osgWidget::VncImage void updated(); static rfbBool resizeImage(rfbClient* client); - + static void updateImage(rfbClient* client,int x,int y,int w,int h); - + static void passwordCheck(rfbClient* client,const char* encryptedPassWord,int len); static char* getPassword(rfbClient* client); std::string _optionString; std::string _username; std::string _password; - + double _timeOfLastUpdate; double _timeOfLastRender; @@ -63,7 +63,7 @@ class LibVncImage : public osgWidget::VncImage osg::ref_ptr _inactiveBlock; protected: - + virtual ~LibVncImage(); class RfbThread : public osg::Referenced, public OpenThreads::Thread @@ -78,7 +78,7 @@ class LibVncImage : public osgWidget::VncImage virtual ~RfbThread() { _done = true; - while(isRunning()) + while(isRunning()) { OpenThreads::Thread::YieldCurrentThread(); } @@ -89,7 +89,7 @@ class LibVncImage : public osgWidget::VncImage do { if (_image->_active) - { + { int i=WaitForMessage(_client,5000); if(i<0) return; @@ -97,7 +97,7 @@ class LibVncImage : public osgWidget::VncImage if(i) { OSG_INFO<<"VNC Handling "<_inactiveBlock->block(); } - - + + double deltaTime = _image->getTimeOfLastRender() - _image->getTimeOfLastUpdate(); if (deltaTime<-0.01) { @@ -135,7 +135,7 @@ class LibVncImage : public osgWidget::VncImage rfbClient* _client; osg::ref_ptr _rfbThread; - + }; LibVncImage::LibVncImage(): @@ -233,7 +233,7 @@ bool LibVncImage::connect(const std::string& hostname) if (!_password.empty()) _client->GetPassword = getPassword; rfbClientSetClientData(_client, 0, this); - + _client->serverHost = strdup(hostname.c_str()); // _client->serverPort = ; @@ -246,13 +246,13 @@ bool LibVncImage::connect(const std::string& hostname) { _rfbThread = new RfbThread(_client, this); _rfbThread->startThread(); - + return true; } else { close(); - + return false; } } @@ -277,10 +277,10 @@ void LibVncImage::close() } -rfbBool LibVncImage::resizeImage(rfbClient* client) +rfbBool LibVncImage::resizeImage(rfbClient* client) { LibVncImage* image = (LibVncImage*)(rfbClientGetClientData(client, 0)); - + int width = client->width; int height = client->height; int depth = client->format.bitsPerPixel; @@ -294,7 +294,7 @@ rfbBool LibVncImage::resizeImage(rfbClient* client) { if (image->_optionString.find("swap")!=std::string::npos || image->_optionString.find("swop")!=std::string::npos) swap = true; } - + GLenum gl_pixelFormat = swap ? GL_BGRA : GL_RGBA; if (!image->_optionString.empty()) @@ -309,9 +309,9 @@ rfbBool LibVncImage::resizeImage(rfbClient* client) image->setInternalTextureFormat(GL_RGBA); - + client->frameBuffer= (uint8_t*)(image->data()); - + return TRUE; } @@ -358,11 +358,11 @@ void LibVncImage::updated() class ReaderWriterVNC : public osgDB::ReaderWriter { public: - + ReaderWriterVNC() { supportsExtension("vnc","VNC plugin"); - + supportsOption("swap","Swaps the pixel format order, exchanging the red and blue channels."); supportsOption("swop","American spelling, same effect as swap."); supportsOption("RGB","Use RGBA pixel format for the vnc image"); @@ -370,7 +370,7 @@ class ReaderWriterVNC : public osgDB::ReaderWriter supportsOption("BGR","Use BGRA pixel format for the vnc image"); supportsOption("BGRA","Use BGRA pixel format for the vnc image"); } - + virtual const char* className() const { return "VNC plugin"; } virtual osgDB::ReaderWriter::ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const @@ -386,11 +386,11 @@ class ReaderWriterVNC : public osgDB::ReaderWriter } std::string hostname = osgDB::getNameLessExtension(fileName); - + OSG_NOTICE<<"Hostname = "< image = new LibVncImage; - image->setDataVariance(osg::Object::DYNAMIC); + image->setDataVariance(osg::Object::DYNAMIC); image->setOrigin(osg::Image::TOP_LEFT); const osgDB::AuthenticationMap* authenticationMap = (options && options->getAuthenticationMap()) ? @@ -419,15 +419,15 @@ class ReaderWriterVNC : public osgDB::ReaderWriter { return "Could not connect to "+hostname; } - + return image.get(); } - + virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { osgDB::ReaderWriter::ReadResult result = readImage(fileName, options); if (!result.validImage()) return result; - + osg::ref_ptr vncClient = new osgWidget::VncClient(); if (vncClient->assign(dynamic_cast(result.getImage()))) { diff --git a/src/osgPlugins/vrml/ConvertToVRML.cpp b/src/osgPlugins/vrml/ConvertToVRML.cpp index d45819b59..ef309aacd 100644 --- a/src/osgPlugins/vrml/ConvertToVRML.cpp +++ b/src/osgPlugins/vrml/ConvertToVRML.cpp @@ -3,7 +3,7 @@ * OSG to VRML2 converter for OpenSceneGraph. * * authors : - * Johan Nouvel (johan_nouvel@yahoo.com) + * Johan Nouvel (johan_nouvel@yahoo.com) * * */ diff --git a/src/osgPlugins/vrml/ConvertToVRML.h b/src/osgPlugins/vrml/ConvertToVRML.h index bf176ebe2..21b9f9620 100644 --- a/src/osgPlugins/vrml/ConvertToVRML.h +++ b/src/osgPlugins/vrml/ConvertToVRML.h @@ -3,7 +3,7 @@ * OSG to VRML2 converter for OpenSceneGraph. * * authors : - * Johan Nouvel (johan_nouvel@yahoo.com) + * Johan Nouvel (johan_nouvel@yahoo.com) * * */ diff --git a/src/osgPlugins/vrml/ReaderWriterVRML2.cpp b/src/osgPlugins/vrml/ReaderWriterVRML2.cpp index a3335829b..84d16b69c 100644 --- a/src/osgPlugins/vrml/ReaderWriterVRML2.cpp +++ b/src/osgPlugins/vrml/ReaderWriterVRML2.cpp @@ -5,7 +5,7 @@ * VRML2 file converter for OpenSceneGraph. * * authors : - * Johan Nouvel (johan_nouvel@yahoo.com) for the writeNode function. + * Johan Nouvel (johan_nouvel@yahoo.com) for the writeNode function. * * Jan Ciger (jan.ciger@gmail.com), * Tolga Abaci (tolga.abaci@gmail.com), @@ -334,22 +334,22 @@ osg::Node* ReaderWriterVRML2::convertFromVRML(openvrml::node *obj) const // is it indexed_face_set_node ? if (node_ptr->type().id()=="IndexedFaceSet") osg_geom = convertVRML97IndexedFaceSet(node_ptr.get()); - + else if (node_ptr->type().id()=="IndexedLineSet") osg_geom = convertVRML97IndexedLineSet(node_ptr.get()); - + else if (node_ptr->type().id() == "Box") osg_geom = convertVRML97Box(node_ptr.get()); - + else if (node_ptr->type().id() == "Sphere") osg_geom = convertVRML97Sphere(node_ptr.get()); - + else if (node_ptr->type().id() == "Cone") osg_geom = convertVRML97Cone(node_ptr.get()); - + else if (node_ptr->type().id() == "Cylinder") osg_geom = convertVRML97Cylinder(node_ptr.get()); - + else { // other geometry types not handled yet @@ -433,9 +433,9 @@ osg::Node* ReaderWriterVRML2::convertFromVRML(openvrml::node *obj) const std::auto_ptr texture_url_fv = vrml_texture_node->field("url"); const openvrml::mfstring *mfs = dynamic_cast(texture_url_fv.get()); const std::string &url = mfs->value()[0]; - + image = osgDB::readRefImageFile(url); - + if (!image.valid()) { std::cerr << "texture file " << url << " not found !" << std::endl << std::flush; diff --git a/src/osgPlugins/vrml/ReaderWriterVRML2.h b/src/osgPlugins/vrml/ReaderWriterVRML2.h index 91e7e7ed5..d5e6fc835 100644 --- a/src/osgPlugins/vrml/ReaderWriterVRML2.h +++ b/src/osgPlugins/vrml/ReaderWriterVRML2.h @@ -5,7 +5,7 @@ * VRML2 file converter for OpenSceneGraph. * * authors : - * Johan Nouvel (johan_nouvel@yahoo.com) for the writeNode function. + * Johan Nouvel (johan_nouvel@yahoo.com) for the writeNode function. * * Jan Ciger (jan.ciger@gmail.com), * Tolga Abaci (tolga.abaci@gmail.com), diff --git a/src/osgPlugins/vtf/ReaderWriterVTF.cpp b/src/osgPlugins/vtf/ReaderWriterVTF.cpp index 078dca025..ff3df33b6 100644 --- a/src/osgPlugins/vtf/ReaderWriterVTF.cpp +++ b/src/osgPlugins/vtf/ReaderWriterVTF.cpp @@ -5,7 +5,7 @@ * DESCRIPTION: Class for reading a Valve Texture Format (VTF) file * into an osg::Image. * -* Borrows heavily from the DDS plugin for OSG, as well +* Borrows heavily from the DDS plugin for OSG, as well * as the Valve Source SDK * * CREATED BY: Jason Daly (jdaly@ist.ucf.edu) @@ -361,7 +361,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) int mip; int mipSize; int mipOffset; - + // Validate the file with the 'VTF\0' magic number _istream.read(&vtf_header.magic_number[0], 4); if ((vtf_header.magic_number[0] != 'V') || @@ -394,7 +394,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) // No depth in textures earlier than version 7.2 if ((vtf_header.file_version[0] < 7) || - ((vtf_header.file_version[0] == 7) && + ((vtf_header.file_version[0] == 7) && (vtf_header.file_version[1] < 2))) { // No depth in header, set it to 1 @@ -484,7 +484,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) } // Allocate an osg::Image for the lo-res image metadata - osg::ref_ptr loResImage = new osg::Image(); + osg::ref_ptr loResImage = new osg::Image(); // Set the image metadata, and figure out how many bytes to read loResImage->setImage(s, t, r, internalFormat, pixelFormat, dataType, @@ -503,7 +503,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) // full-size image format, and check whether the format is supported supported = ConvertImageFormat(vtf_header.image_format, internalFormat, pixelFormat, dataType); - + // Bail if the format isn't supported if (!supported) { @@ -527,7 +527,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) // are ignored. Same for cube maps (only one face is loaded). // Create the mipmap offsets vector - osg::Image::MipmapDataType mipmaps; + osg::Image::MipmapDataType mipmaps; // Deal with mipmaps, if necessary if (vtf_header.num_mip_levels > 1) @@ -547,7 +547,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) int width = vtf_header.image_width; int height = vtf_header.image_height; int blockSize; - + if ((vtf_header.image_format == VTF_FORMAT_DXT1) || (vtf_header.image_format == VTF_FORMAT_DXT1_ONEBITALPHA)) blockSize = 8; @@ -607,7 +607,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) } // Allocate the resulting osg::Image - osg::ref_ptr osgImage = new osg::Image(); + osg::ref_ptr osgImage = new osg::Image(); // Set the image meta-data, including dimensions, format, data type, // and mipmap levels. Everything but the image data itself. We'll use @@ -696,7 +696,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) osgImage->setImage(s,t,r, internalFormat, pixelFormat, dataType, imageData, osg::Image::USE_NEW_DELETE); if (mipmaps.size()>0) osgImage->setMipmapLevels(mipmaps); - + // Finally, return the image return osgImage.release(); } @@ -705,7 +705,7 @@ osg::Image* ReadVTFFile(std::istream& _istream) bool WriteVTFFile(const osg::Image *img, std::ostream& fout) { // Not supported - return false; + return false; } @@ -713,13 +713,13 @@ class ReaderWriterVTF : public osgDB::ReaderWriter { public: virtual const char* className() const - { - return "VTF Image Reader/Writer"; + { + return "VTF Image Reader/Writer"; } virtual bool acceptsExtension(const std::string& extension) const - { - return osgDB::equalCaseInsensitive(extension, "vtf"); + { + return osgDB::equalCaseInsensitive(extension, "vtf"); } virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const @@ -738,9 +738,9 @@ public: if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; std::string fileName = osgDB::findDataFile( file, options ); - + if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - + osgDB::ifstream stream(fileName.c_str(), std::ios::in | std::ios::binary); if(!stream) return ReadResult::FILE_NOT_HANDLED; ReadResult rr = readImage(stream, options); @@ -752,12 +752,12 @@ public: { osg::Image* osgImage = ReadVTFFile(fin); if (osgImage==NULL) return ReadResult::FILE_NOT_HANDLED; - + if (options && options->getOptionString().find("vtf_flip")!=std::string::npos) { osgImage->flipVertical(); } - + return osgImage; } diff --git a/src/osgPlugins/x/ReaderWriterDirectX.cpp b/src/osgPlugins/x/ReaderWriterDirectX.cpp index cf7e1017c..f22a3ff18 100644 --- a/src/osgPlugins/x/ReaderWriterDirectX.cpp +++ b/src/osgPlugins/x/ReaderWriterDirectX.cpp @@ -93,7 +93,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterDirectX::readNode(const std::string& return ReadResult::ERROR_IN_READING_FILE; } - // code for setting up the database path so that internally referenced file are searched for on relative paths. + // code for setting up the database path so that internally referenced file are searched for on relative paths. osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->setDatabasePath(osgDB::getFilePath(fileName)); @@ -109,15 +109,15 @@ osgDB::ReaderWriter::ReadResult ReaderWriterDirectX::readNode(std::istream& fin, } // Options? - bool flipTexture = true; + bool flipTexture = true; bool switchToLeftHanded = true; // when true: swap y and z for incoming files float creaseAngle = 80.0f; if (options) { const std::string option = options->getOptionString(); - if (option.find("rightHanded") != std::string::npos) { + if (option.find("rightHanded") != std::string::npos) { switchToLeftHanded = false; } - if (option.find("leftHanded") != std::string::npos) { + if (option.find("leftHanded") != std::string::npos) { switchToLeftHanded = true; } if (option.find("flipTexture") != std::string::npos) { @@ -204,7 +204,7 @@ osg::Geode* ReaderWriterDirectX::convertFromDX(DX::Mesh & mesh, bool switchToLef // Texture-for-Image map std::map texForImage; - + unsigned int i; for (i = 0; i < meshMaterial->material.size(); i++) { diff --git a/src/osgPlugins/x/mesh.cpp b/src/osgPlugins/x/mesh.cpp index f1c8128b6..ccbf38d33 100644 --- a/src/osgPlugins/x/mesh.cpp +++ b/src/osgPlugins/x/mesh.cpp @@ -243,7 +243,7 @@ void Mesh::parseMeshMaterialList(std::istream& fin) continue; // check for "{ }" for a - // material which was declared globally + // material which was declared globally string materialName = token[0]; // could be given as "{ someName }" which more than 1 tokens if (materialName == "{" && token.size()>1) diff --git a/src/osgPlugins/xine/ReaderWriterXine.cpp b/src/osgPlugins/xine/ReaderWriterXine.cpp index 5e5188765..5d8fa8011 100644 --- a/src/osgPlugins/xine/ReaderWriterXine.cpp +++ b/src/osgPlugins/xine/ReaderWriterXine.cpp @@ -41,17 +41,17 @@ class XineImageStream : public osg::ImageStream ImageStream(image,copyop) {} META_Object(osgXine,XineImageStream); - + void setVolume(float volume) { _volume = osg::minimum(osg::maximum(volume,0.0f),1.0f); - if (_stream) + if (_stream) { xine_set_param(_stream, XINE_PARAM_AUDIO_VOLUME, static_cast(_volume*100.0f)); OSG_NOTICE<<"Setting volume "<<_volume<levels = PXLEVEL_ALL; @@ -82,11 +82,11 @@ class XineImageStream : public osg::ImageStream OSG_NOTICE<<"XineImageStream::open() : Failed to create video driver"< archive = new ZipArchive; diff --git a/src/osgPlugins/zip/ZipArchive.cpp b/src/osgPlugins/zip/ZipArchive.cpp index a86d528f6..d4d1d8aea 100644 --- a/src/osgPlugins/zip/ZipArchive.cpp +++ b/src/osgPlugins/zip/ZipArchive.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * -* This library is open source and may be redistributed and/or modified under -* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or +* This library is open source and may be redistributed and/or modified under +* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -123,7 +123,7 @@ bool ZipArchive::open(const std::string& file, ArchiveStatus status, const osgDB std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED; - // save the filename + password so other threads can open the file + // save the filename + password so other threads can open the file _filename = osgDB::findDataFile( file, options ); if (_filename.empty()) return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; diff --git a/src/osgPlugins/zip/unzip.cpp b/src/osgPlugins/zip/unzip.cpp index 540bb596f..e9a5f4380 100644 --- a/src/osgPlugins/zip/unzip.cpp +++ b/src/osgPlugins/zip/unzip.cpp @@ -527,7 +527,7 @@ int inflateEnd (z_streamp strm); // was inconsistent. In the error case, msg may be set but then points to a // static string (which must not be deallocated). - // Advanced functions + // Advanced functions // The following functions are needed only in some special applications. @@ -544,7 +544,7 @@ int inflateSetDictionary (z_streamp strm, // if this call returned Z_NEED_DICT. The dictionary chosen by the compressor // can be determined from the Adler32 value returned by this call of // inflate. The compressor and decompressor must use exactly the same -// dictionary. +// dictionary. // // inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a // parameter is invalid (such as NULL dictionary) or the stream state is @@ -555,7 +555,7 @@ int inflateSetDictionary (z_streamp strm, int inflateSync (z_streamp strm); -// +// // Skips invalid compressed data until a full flush point can be found, or until all // available input is skipped. No output is provided. // @@ -646,7 +646,7 @@ const char * const z_errmsg[10] = { // indexed by 2-zlib_error #define ERR_RETURN(strm,err) \ return (strm->msg = (char*)ERR_MSG(err), (err)) -// To be used only when the state is known to be valid +// To be used only when the state is known to be valid // common constants @@ -654,21 +654,21 @@ const char * const z_errmsg[10] = { // indexed by 2-zlib_error #define STORED_BLOCK 0 #define STATIC_TREES 1 #define DYN_TREES 2 -// The three kinds of block type +// The three kinds of block type #define MIN_MATCH 3 #define MAX_MATCH 258 -// The minimum and maximum match lengths +// The minimum and maximum match lengths -#define PRESET_DICT 0x20 // preset dictionary flag in zlib header +#define PRESET_DICT 0x20 // preset dictionary flag in zlib header - // target dependencies + // target dependencies #define OS_CODE 0x0b // Window 95 & Windows NT - // functions + // functions #define zmemzero(dest, len) memset(dest, 0, len) @@ -813,71 +813,71 @@ typedef enum { IBM_DTREE, // get length, distance trees for a dynamic block IBM_CODES, // processing fixed or dynamic block IBM_DRY, // output remaining window bytes - IBM_DONE, // finished last block, done - IBM_BAD} // got a data error--stuck here + IBM_DONE, // finished last block, done + IBM_BAD} // got a data error--stuck here inflate_block_mode; -// inflate blocks semi-private state +// inflate blocks semi-private state struct inflate_blocks_state { - // mode - inflate_block_mode mode; // current inflate_block mode + // mode + inflate_block_mode mode; // current inflate_block mode - // mode dependent information + // mode dependent information union { - uInt left; // if STORED, bytes left to copy + uInt left; // if STORED, bytes left to copy struct { - uInt table; // table lengths (14 bits) + uInt table; // table lengths (14 bits) uInt index; // index into blens (or border) uInt *blens; // bit lengths of codes - uInt bb; // bit length tree depth - inflate_huft *tb; // bit length decoding tree - } trees; // if DTREE, decoding info for trees + uInt bb; // bit length tree depth + inflate_huft *tb; // bit length decoding tree + } trees; // if DTREE, decoding info for trees struct { - inflate_codes_statef + inflate_codes_statef *codes; - } decode; // if CODES, current state + } decode; // if CODES, current state } sub; // submode - uInt last; // true if this block is the last block + uInt last; // true if this block is the last block - // mode independent information - uInt bitk; // bits in bit buffer - uLong bitb; // bit buffer - inflate_huft *hufts; // single malloc for tree space - Byte *window; // sliding window - Byte *end; // one byte after sliding window - Byte *read; // window read pointer - Byte *write; // window write pointer - check_func checkfn; // check function - uLong check; // check on output + // mode independent information + uInt bitk; // bits in bit buffer + uLong bitb; // bit buffer + inflate_huft *hufts; // single malloc for tree space + Byte *window; // sliding window + Byte *end; // one byte after sliding window + Byte *read; // window read pointer + Byte *write; // window write pointer + check_func checkfn; // check function + uLong check; // check on output }; // defines for inflate input/output -// update pointers and return +// update pointers and return #define UPDBITS {s->bitb=b;s->bitk=k;} #define UPDIN {z->avail_in=n;z->total_in+=(uLong)(p-z->next_in);z->next_in=p;} #define UPDOUT {s->write=q;} #define UPDATE {UPDBITS UPDIN UPDOUT} #define LEAVE {UPDATE return inflate_flush(s,z,r);} -// get bytes and bits +// get bytes and bits #define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;} #define NEEDBYTE {if(n)r=Z_OK;else LEAVE} #define NEXTBYTE (n--,*p++) #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<>=(j);k-=(j);} -// output bytes +// output bytes #define WAVAIL (uInt)(qread?s->read-q-1:s->end-q) #define LOADOUT {q=s->write;m=(uInt)WAVAIL;} #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}} #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} #define OUTBYTE(a) {*q++=(Byte)(a);m--;} -// load local pointers +// load local pointers #define LOAD {LOADIN LOADOUT} -// masks for lower bits (size given to avoid silly warnings with Visual C++) +// masks for lower bits (size given to avoid silly warnings with Visual C++) // And'ing with mask[n] masks the lower n bits const uInt inflate_mask[17] = { 0x0000, @@ -1048,11 +1048,11 @@ int inflate_flush(inflate_blocks_statef *s,z_streamp z,int r) Byte *p; Byte *q; - // local copies of source and destination pointers + // local copies of source and destination pointers p = z->next_out; q = s->read; - // compute number of bytes to copy as far as end of window + // compute number of bytes to copy as far as end of window n = (uInt)((q <= s->write ? s->write : s->end) - q); if (n > z->avail_out) n = z->avail_out; if (n && r == Z_BUF_ERROR) r = Z_OK; @@ -1061,11 +1061,11 @@ int inflate_flush(inflate_blocks_statef *s,z_streamp z,int r) z->avail_out -= n; z->total_out += n; - // update check information + // update check information if (s->checkfn != Z_NULL) z->adler = s->check = (*s->checkfn)(s->check, q, n); - // copy as far as end of window + // copy as far as end of window if (n!=0) // check for n!=0 to avoid waking up CodeGuard { memcpy(p, q, n); p += n; @@ -1075,21 +1075,21 @@ int inflate_flush(inflate_blocks_statef *s,z_streamp z,int r) // see if more to copy at beginning of window if (q == s->end) { - // wrap pointers + // wrap pointers q = s->window; if (s->write == s->end) s->write = s->window; - // compute bytes to copy + // compute bytes to copy n = (uInt)(s->write - q); if (n > z->avail_out) n = z->avail_out; if (n && r == Z_BUF_ERROR) r = Z_OK; - // update counters + // update counters z->avail_out -= n; z->total_out += n; - // update check information + // update check information if (s->checkfn != Z_NULL) z->adler = s->check = (*s->checkfn)(s->check, q, n); @@ -1114,42 +1114,42 @@ int inflate_flush(inflate_blocks_statef *s,z_streamp z,int r) #define exop word.what.Exop #define bits word.what.Bits -typedef enum { // waiting for "i:"=input, "o:"=output, "x:"=nothing - START, // x: set up for LEN - LEN, // i: get length/literal/eob next - LENEXT, // i: getting length extra (have base) - DIST, // i: get distance next - DISTEXT, // i: getting distance extra +typedef enum { // waiting for "i:"=input, "o:"=output, "x:"=nothing + START, // x: set up for LEN + LEN, // i: get length/literal/eob next + LENEXT, // i: getting length extra (have base) + DIST, // i: get distance next + DISTEXT, // i: getting distance extra COPY, // o: copying bytes in window, waiting for space - LIT, // o: got literal, waiting for output space - WASH, // o: got eob, possibly still output waiting - END, // x: got eob and all data flushed - BADCODE} // x: got error + LIT, // o: got literal, waiting for output space + WASH, // o: got eob, possibly still output waiting + END, // x: got eob and all data flushed + BADCODE} // x: got error inflate_codes_mode; // inflate codes private state struct inflate_codes_state { - // mode - inflate_codes_mode mode; // current inflate_codes mode + // mode + inflate_codes_mode mode; // current inflate_codes mode - // mode dependent information + // mode dependent information uInt len; union { struct { - const inflate_huft *tree; // pointer into tree - uInt need; // bits needed - } code; // if LEN or DIST, where in tree - uInt lit; // if LIT, literal + const inflate_huft *tree; // pointer into tree + uInt need; // bits needed + } code; // if LEN or DIST, where in tree + uInt lit; // if LIT, literal struct { - uInt get; // bits to get for extra - uInt dist; // distance back to copy from - } copy; // if EXT or COPY, where and how much + uInt get; // bits to get for extra + uInt dist; // distance back to copy from + } copy; // if EXT or COPY, where and how much } sub; // submode - // mode independent information - Byte lbits; // ltree bits decoded per branch - Byte dbits; // dtree bits decoder per branch + // mode independent information + Byte lbits; // ltree bits decoded per branch + Byte dbits; // dtree bits decoder per branch const inflate_huft *ltree; // literal/length/eob tree const inflate_huft *dtree; // distance tree @@ -1221,7 +1221,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r) t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); DUMPBITS(t->bits) e = (uInt)(t->exop); - if (e == 0) // literal + if (e == 0) // literal { c->sub.lit = t->base; LuTracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? @@ -1230,30 +1230,30 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r) c->mode = LIT; break; } - if (e & 16) // length + if (e & 16) // length { c->sub.copy.get = e & 15; c->len = t->base; c->mode = LENEXT; break; } - if ((e & 64) == 0) // next table + if ((e & 64) == 0) // next table { c->sub.code.need = e; c->sub.code.tree = t + t->base; break; } - if (e & 32) // end of block + if (e & 32) // end of block { LuTracevv((stderr, "inflate: end of block\n")); c->mode = WASH; break; } - c->mode = BADCODE; // invalid code + c->mode = BADCODE; // invalid code z->msg = (char*)"invalid literal/length code"; r = Z_DATA_ERROR; LEAVE - case LENEXT: // i: getting length extra (have base) + case LENEXT: // i: getting length extra (have base) j = c->sub.copy.get; NEEDBITS(j) c->len += (uInt)b & inflate_mask[j]; @@ -1262,40 +1262,40 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r) c->sub.code.tree = c->dtree; LuTracevv((stderr, "inflate: length %u\n", c->len)); c->mode = DIST; - case DIST: // i: get distance next + case DIST: // i: get distance next j = c->sub.code.need; NEEDBITS(j) t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); DUMPBITS(t->bits) e = (uInt)(t->exop); - if (e & 16) // distance + if (e & 16) // distance { c->sub.copy.get = e & 15; c->sub.copy.dist = t->base; c->mode = DISTEXT; break; } - if ((e & 64) == 0) // next table + if ((e & 64) == 0) // next table { c->sub.code.need = e; c->sub.code.tree = t + t->base; break; } - c->mode = BADCODE; // invalid code + c->mode = BADCODE; // invalid code z->msg = (char*)"invalid distance code"; r = Z_DATA_ERROR; LEAVE - case DISTEXT: // i: getting distance extra + case DISTEXT: // i: getting distance extra j = c->sub.copy.get; NEEDBITS(j) c->sub.copy.dist += (uInt)b & inflate_mask[j]; DUMPBITS(j) LuTracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); c->mode = COPY; - case COPY: // o: copying bytes in window, waiting for space + case COPY: // o: copying bytes in window, waiting for space f = q - c->sub.copy.dist; while (f < s->window) // modulo window size-"while" instead - f += s->end - s->window; // of "if" handles invalid distances + f += s->end - s->window; // of "if" handles invalid distances while (c->len) { NEEDOUT @@ -1306,18 +1306,18 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r) } c->mode = START; break; - case LIT: // o: got literal, waiting for output space + case LIT: // o: got literal, waiting for output space NEEDOUT OUTBYTE(c->sub.lit) c->mode = START; break; - case WASH: // o: got eob, possibly more output - if (k > 7) // return unused byte, if any + case WASH: // o: got eob, possibly more output + if (k > 7) // return unused byte, if any { //Assert(k < 16, "inflate_codes grabbed too many bytes") k -= 8; n++; - p--; // can always return one + p--; // can always return one } FLUSH if (s->read != s->write) @@ -1347,7 +1347,7 @@ void inflate_codes_free(inflate_codes_statef *c,z_streamp z) // Copyright (C) 1995-1998 Mark Adler // For conditions of distribution and use, see copyright notice in zlib.h -//struct inflate_codes_state {int dummy;}; // for buggy compilers +//struct inflate_codes_state {int dummy;}; // for buggy compilers @@ -1453,12 +1453,12 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r) Byte *p; // input data pointer uInt n; // bytes available there Byte *q; // output window write pointer - uInt m; // bytes to end of window or read pointer + uInt m; // bytes to end of window or read pointer - // copy input/output information to locals (UPDATE macro restores) + // copy input/output information to locals (UPDATE macro restores) LOAD - // process input based on current state + // process input based on current state for(;;) switch (s->mode) { case IBM_TYPE: @@ -1467,15 +1467,15 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r) s->last = t & 1; switch (t >> 1) { - case 0: // stored + case 0: // stored LuTracev((stderr, "inflate: stored block%s\n", s->last ? " (last)" : "")); DUMPBITS(3) - t = k & 7; // go to byte boundary + t = k & 7; // go to byte boundary DUMPBITS(t) s->mode = IBM_LENS; // get length of stored block break; - case 1: // fixed + case 1: // fixed LuTracev((stderr, "inflate: fixed codes block%s\n", s->last ? " (last)" : "")); { @@ -1493,7 +1493,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r) DUMPBITS(3) s->mode = IBM_CODES; break; - case 2: // dynamic + case 2: // dynamic LuTracev((stderr, "inflate: dynamic codes block%s\n", s->last ? " (last)" : "")); DUMPBITS(3) @@ -1517,7 +1517,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r) LEAVE } s->sub.left = (uInt)b & 0xffff; - b = k = 0; // dump bits + b = k = 0; // dump bits LuTracev((stderr, "inflate: stored length %u\n", s->sub.left)); s->mode = s->sub.left ? IBM_STORED : (s->last ? IBM_DRY : IBM_TYPE); break; @@ -1602,7 +1602,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r) DUMPBITS(t) s->sub.trees.blens[s->sub.trees.index++] = c; } - else // c == 16..18 + else // c == 16..18 { i = c == 18 ? 7 : c - 14; j = c == 18 ? 11 : 3; @@ -1634,7 +1634,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r) inflate_huft *tl, *td; inflate_codes_statef *c; - bl = 9; // must be <= 9 for lookahead assumptions + bl = 9; // must be <= 9 for lookahead assumptions bd = 6; // must be <= 9 for lookahead assumptions t = s->sub.trees.table; t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), @@ -1729,12 +1729,12 @@ int huft_build ( const uInt *, // list of base values for non-simple codes const uInt *, // list of extra bits for non-simple codes inflate_huft **,// result: starting table - uInt *, // maximum lookup bits (returns actual) - inflate_huft *, // space for trees - uInt *, // hufts used in space - uInt * ); // space for values + uInt *, // maximum lookup bits (returns actual) + inflate_huft *, // space for trees + uInt *, // hufts used in space + uInt * ); // space for values -// Tables for deflate from PKZIP's appnote.txt. +// Tables for deflate from PKZIP's appnote.txt. const uInt cplens[31] = { // Copy lengths for literal codes 257..285 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; @@ -1746,7 +1746,7 @@ const uInt cpdist[30] = { // Copy offsets for distance codes 0..29 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; -const uInt cpdext[30] = { // Extra bits for distance codes +const uInt cpdext[30] = { // Extra bits for distance codes 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; @@ -1784,7 +1784,7 @@ const uInt cpdext[30] = { // Extra bits for distance codes // -// If BMAX needs to be larger than 16, then h and x[] should be uLong. +// If BMAX needs to be larger than 16, then h and x[] should be uLong. #define BMAX 15 // maximum bit length of any code int huft_build( @@ -1806,28 +1806,28 @@ uInt *v) // working area: values in order of bit length uInt a; // counter for codes of length k uInt c[BMAX+1]; // bit length count table - uInt f; // i repeats in table every f entries - int g; // maximum code length - int h; // table level - register uInt i; // counter, current code + uInt f; // i repeats in table every f entries + int g; // maximum code length + int h; // table level + register uInt i; // counter, current code register uInt j; // counter - register int k; // number of bits in current code - int l; // bits per table (returned in m) - uInt mask; // (1 << w) - 1, to avoid cc -O bug on HP + register int k; // number of bits in current code + int l; // bits per table (returned in m) + uInt mask; // (1 << w) - 1, to avoid cc -O bug on HP register uInt *p; // pointer into c[], b[], or v[] - inflate_huft *q; // points to current table - struct inflate_huft_s r; // table entry for structure assignment - inflate_huft *u[BMAX]; // table stack - register int w; // bits before this table == (l * h) - uInt x[BMAX+1]; // bit offsets, then code stack - uInt *xp; // pointer into x - int y; // number of dummy codes added - uInt z; // number of entries in current table + inflate_huft *q; // points to current table + struct inflate_huft_s r; // table entry for structure assignment + inflate_huft *u[BMAX]; // table stack + register int w; // bits before this table == (l * h) + uInt x[BMAX+1]; // bit offsets, then code stack + uInt *xp; // pointer into x + int y; // number of dummy codes added + uInt z; // number of entries in current table // provide a default value r.base = 0; - // Generate counts for each bit length + // Generate counts for each bit length p = c; #define C0 *p++ = 0; #define C2 C0 C0 C0 C0 @@ -1835,9 +1835,9 @@ uInt *v) // working area: values in order of bit length C4; // clear c[]--assume BMAX+1 is 16 p = b; i = n; do { - c[*p++]++; // assume all entries <= BMAX + c[*p++]++; // assume all entries <= BMAX } while (--i); - if (c[0] == n) // null input--all zero length codes + if (c[0] == n) // null input--all zero length codes { *t = (inflate_huft *)Z_NULL; *m = 0; @@ -1845,24 +1845,24 @@ uInt *v) // working area: values in order of bit length } - // Find minimum and maximum length, bound *m by those + // Find minimum and maximum length, bound *m by those l = *m; for (j = 1; j <= BMAX; j++) if (c[j]) break; - k = j; // minimum code length + k = j; // minimum code length if ((uInt)l < j) l = j; for (i = BMAX; i; i--) if (c[i]) break; - g = i; // maximum code length + g = i; // maximum code length if ((uInt)l > i) l = i; *m = l; - // Adjust last length count to fill out codes, if needed + // Adjust last length count to fill out codes, if needed for (y = 1 << j; j < i; j++, y <<= 1) if ((y -= c[j]) < 0) return Z_DATA_ERROR; @@ -1871,94 +1871,94 @@ uInt *v) // working area: values in order of bit length c[i] += y; - // Generate starting offsets into the value table for each length + // Generate starting offsets into the value table for each length x[1] = j = 0; p = c + 1; xp = x + 2; - while (--i) { // note that i == g from above + while (--i) { // note that i == g from above *xp++ = (j += *p++); } - // Make a table of values in order of bit lengths + // Make a table of values in order of bit lengths p = b; i = 0; do { if ((j = *p++) != 0) v[x[j]++] = i; } while (++i < n); - n = x[g]; // set n to length of v + n = x[g]; // set n to length of v - // Generate the Huffman codes and for each, make the table entries - x[0] = i = 0; // first Huffman code is zero - p = v; // grab values in bit order - h = -1; // no tables yet--level -1 - w = -l; // bits decoded == (l * h) - u[0] = (inflate_huft *)Z_NULL; // just to keep compilers happy - q = (inflate_huft *)Z_NULL; // ditto - z = 0; // ditto + // Generate the Huffman codes and for each, make the table entries + x[0] = i = 0; // first Huffman code is zero + p = v; // grab values in bit order + h = -1; // no tables yet--level -1 + w = -l; // bits decoded == (l * h) + u[0] = (inflate_huft *)Z_NULL; // just to keep compilers happy + q = (inflate_huft *)Z_NULL; // ditto + z = 0; // ditto - // go through the bit lengths (k already is bits in shortest code) + // go through the bit lengths (k already is bits in shortest code) for (; k <= g; k++) { a = c[k]; while (a--) { - // here i is the Huffman code of length k bits for value *p - // make tables up to required level + // here i is the Huffman code of length k bits for value *p + // make tables up to required level while (k > w + l) { h++; - w += l; // previous table always l bits + w += l; // previous table always l bits // compute minimum size table less than or equal to l bits z = g - w; - z = z > (uInt)l ? l : z; // table size upper limit - if ((f = 1 << (j = k - w)) > a + 1) // try a k-w bit table - { // too few codes for k-w bit table - f -= a + 1; // deduct codes from patterns left + z = z > (uInt)l ? l : z; // table size upper limit + if ((f = 1 << (j = k - w)) > a + 1) // try a k-w bit table + { // too few codes for k-w bit table + f -= a + 1; // deduct codes from patterns left xp = c + k; if (j < z) - while (++j < z) // try smaller tables up to z bits + while (++j < z) // try smaller tables up to z bits { if ((f <<= 1) <= *++xp) - break; // enough codes to use up j bits + break; // enough codes to use up j bits f -= *xp; // else deduct codes from patterns } } - z = 1 << j; // table entries for j-bit table + z = 1 << j; // table entries for j-bit table - // allocate new table - if (*hn + z > MANY) // (note: doesn't matter for fixed) - return Z_DATA_ERROR; // overflow of MANY + // allocate new table + if (*hn + z > MANY) // (note: doesn't matter for fixed) + return Z_DATA_ERROR; // overflow of MANY u[h] = q = hp + *hn; *hn += z; - // connect to last table, if there is one + // connect to last table, if there is one if (h) { x[h] = i; // save pattern for backing up - r.bits = (Byte)l; // bits to dump before this table - r.exop = (Byte)j; // bits in this table + r.bits = (Byte)l; // bits to dump before this table + r.exop = (Byte)j; // bits in this table j = i >> (w - l); - r.base = (uInt)(q - u[h-1] - j); // offset to this table - u[h-1][j] = r; // connect to last table + r.base = (uInt)(q - u[h-1] - j); // offset to this table + u[h-1][j] = r; // connect to last table } else - *t = q; // first table is returned result + *t = q; // first table is returned result } - // set up table entry in r + // set up table entry in r r.bits = (Byte)(k - w); if (p >= v + n) - r.exop = 128 + 64; // out of values--invalid code + r.exop = 128 + 64; // out of values--invalid code else if (*p < s) { - r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); // 256 is end-of-block - r.base = *p++; // simple code is just the value + r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); // 256 is end-of-block + r.base = *p++; // simple code is just the value } else { - r.exop = (Byte)(e[*p - s] + 16 + 64);// non-simple--look up in lists + r.exop = (Byte)(e[*p - s] + 16 + 64);// non-simple--look up in lists r.base = d[*p++ - s]; } @@ -1967,13 +1967,13 @@ uInt *v) // working area: values in order of bit length for (j = i >> w; j < z; j += f) q[j] = r; - // backwards increment the k-bit code i + // backwards increment the k-bit code i for (j = 1 << (k - 1); i & j; j >>= 1) i ^= j; i ^= j; - // backup over finished tables - mask = (1 << w) - 1; // needed on HP, cc -O bug + // backup over finished tables + mask = (1 << w) - 1; // needed on HP, cc -O bug while ((i & mask) != x[h]) { h--; // don't need to update q @@ -1984,7 +1984,7 @@ uInt *v) // working area: values in order of bit length } - // Return Z_BUF_ERROR if we were given an incomplete table + // Return Z_BUF_ERROR if we were given an incomplete table return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK; } @@ -1997,8 +1997,8 @@ inflate_huft *hp, // space for trees z_streamp z) // for messages { int r; - uInt hn = 0; // hufts used in space - uInt *v; // work area for huft_build + uInt hn = 0; // hufts used in space + uInt *v; // work area for huft_build if ((v = (uInt*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL) return Z_MEM_ERROR; @@ -2028,14 +2028,14 @@ inflate_huft *hp, // space for trees z_streamp z) // for messages { int r; - uInt hn = 0; // hufts used in space - uInt *v; // work area for huft_build + uInt hn = 0; // hufts used in space + uInt *v; // work area for huft_build - // allocate work area + // allocate work area if ((v = (uInt*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) return Z_MEM_ERROR; - // build literal/length tree + // build literal/length tree r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v); if (r != Z_OK || *bl == 0) { @@ -2050,7 +2050,7 @@ z_streamp z) // for messages return r; } - // build distance tree + // build distance tree r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v); if (r != Z_OK || (*bd == 0 && nl > 257)) { @@ -2069,7 +2069,7 @@ z_streamp z) // for messages return r; } - // done + // done ZFREE(z, v); return Z_OK; } @@ -2099,17 +2099,17 @@ z_streamp ) // for memory allocation // -//struct inflate_codes_state {int dummy;}; // for buggy compilers +//struct inflate_codes_state {int dummy;}; // for buggy compilers -// macros for bit input with no checking and for returning unused bytes +// macros for bit input with no checking and for returning unused bytes #define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3;} // Called with number of bytes left to write in window at least 258 // (the maximum string length) and number of input bytes available // at least ten. The ten bytes are six bytes for the longest length/ -// distance pair plus four bytes for overloading the bit buffer. +// distance pair plus four bytes for overloading the bit buffer. int inflate_fast( uInt bl, uInt bd, @@ -2118,31 +2118,31 @@ const inflate_huft *td, // need separate declaration for Borland C++ inflate_blocks_statef *s, z_streamp z) { - const inflate_huft *t; // temporary pointer - uInt e; // extra bits or operation - uLong b; // bit buffer - uInt k; // bits in bit buffer - Byte *p; // input data pointer - uInt n; // bytes available there - Byte *q; // output window write pointer - uInt m; // bytes to end of window or read pointer + const inflate_huft *t; // temporary pointer + uInt e; // extra bits or operation + uLong b; // bit buffer + uInt k; // bits in bit buffer + Byte *p; // input data pointer + uInt n; // bytes available there + Byte *q; // output window write pointer + uInt m; // bytes to end of window or read pointer uInt ml; // mask for literal/length tree - uInt md; // mask for distance tree - uInt c; // bytes to copy - uInt d; // distance back to copy from - Byte *r; // copy source pointer + uInt md; // mask for distance tree + uInt c; // bytes to copy + uInt d; // distance back to copy from + Byte *r; // copy source pointer - // load input, output, bit values + // load input, output, bit values LOAD - // initialize masks + // initialize masks ml = inflate_mask[bl]; md = inflate_mask[bd]; - // do until not enough input or output space for fast loop - do { // assume called with m >= 258 && n >= 10 - // get literal/length code - GRABBITS(20) // max bits for literal/length code + // do until not enough input or output space for fast loop + do { // assume called with m >= 258 && n >= 10 + // get literal/length code + GRABBITS(20) // max bits for literal/length code if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) { DUMPBITS(t->bits) @@ -2157,22 +2157,22 @@ z_streamp z) DUMPBITS(t->bits) if (e & 16) { - // get extra bits for length + // get extra bits for length e &= 15; c = t->base + ((uInt)b & inflate_mask[e]); DUMPBITS(e) LuTracevv((stderr, "inflate: * length %u\n", c)); - // decode distance base of block to copy - GRABBITS(15); // max bits for distance code + // decode distance base of block to copy + GRABBITS(15); // max bits for distance code e = (t = td + ((uInt)b & md))->exop; for (;;) { DUMPBITS(t->bits) if (e & 16) { - // get extra bits to add to distance base + // get extra bits to add to distance base e &= 15; - GRABBITS(e) // get extra bits (up to 13) + GRABBITS(e) // get extra bits (up to 13) d = t->base + ((uInt)b & inflate_mask[e]); DUMPBITS(e) LuTracevv((stderr, "inflate: * distance %u\n", d)); @@ -2594,7 +2594,7 @@ int inflateInit2(z_streamp z) } LuTracev((stderr, "inflate: allocated\n")); - // reset state + // reset state inflateReset(z); return Z_OK; } @@ -2639,7 +2639,7 @@ int inflate(z_streamp z, int f) { z->state->mode = IM_BAD; z->msg = (char*)"incorrect header check"; - z->state->sub.marker = 5; // can't try inflateSync + z->state->sub.marker = 5; // can't try inflateSync break; } LuTracev((stderr, "inflate: zlib header ok\n")); @@ -2670,14 +2670,14 @@ int inflate(z_streamp z, int f) case IM_DICT0: z->state->mode = IM_BAD; z->msg = (char*)"need dictionary"; - z->state->sub.marker = 0; // can try inflateSync + z->state->sub.marker = 0; // can try inflateSync return Z_STREAM_ERROR; case IM_BLOCKS: r = inflate_blocks(z->state->blocks, z, r); if (r == Z_DATA_ERROR) { z->state->mode = IM_BAD; - z->state->sub.marker = 0; // can try inflateSync + z->state->sub.marker = 0; // can try inflateSync break; } if (r == Z_OK) @@ -2712,7 +2712,7 @@ int inflate(z_streamp z, int f) { z->state->mode = IM_BAD; z->msg = (char*)"incorrect data check"; - z->state->sub.marker = 5; // can't try inflateSync + z->state->sub.marker = 5; // can't try inflateSync break; } LuTracev((stderr, "inflate: zlib check ok\n")); @@ -2752,7 +2752,7 @@ typedef struct unz_file_info_internal_s { unz_file_info_internal_s(): offset_curfile(0) {} - + uLong offset_curfile;// relative offset of local header 4 bytes } unz_file_info_internal; @@ -2839,7 +2839,7 @@ long int luftell(LUFILE *stream) int lufseek(LUFILE *stream, long offset, int whence) { if (stream->is_handle && stream->canseek) - { + { #ifdef ZIP_STD return fseek(stream->h,stream->initial_offset+offset,whence); #else @@ -2863,7 +2863,7 @@ int lufseek(LUFILE *stream, long offset, int whence) size_t lufread(void *ptr,size_t size,size_t n,LUFILE *stream) { unsigned int toread = (unsigned int)(size*n); if (stream->is_handle) - { + { #ifdef ZIP_STD return fread(ptr,size,n,stream->h); #else @@ -3014,7 +3014,7 @@ int unzlocal_getLong (LUFILE *fin,uLong *pX) err = unzlocal_getByte(fin,&i); x = (uLong)i; - + if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; @@ -3026,7 +3026,7 @@ int unzlocal_getLong (LUFILE *fin,uLong *pX) if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<24; - + if (err==UNZ_OK) *pX = x; else @@ -3035,7 +3035,7 @@ int unzlocal_getLong (LUFILE *fin,uLong *pX) } -// My own strcmpi / strcasecmp +// My own strcmpi / strcasecmp int strcmpcasenosensitive_internal (const char* fileName1,const char *fileName2) { for (;;) @@ -3068,7 +3068,7 @@ int strcmpcasenosensitive_internal (const char* fileName1,const char *fileName2) int unzStringFileNameCompare (const char*fileName1,const char*fileName2,int iCaseSensitivity) { if (iCaseSensitivity==1) return strcmp(fileName1,fileName2); else return strcmpcasenosensitive_internal(fileName1,fileName2); -} +} #define BUFREADCOMMENT (0x400) @@ -3168,7 +3168,7 @@ unzFile unzOpenInternal(LUFILE *fin) // return UNZ_OK if there is no problem. int unzClose (unzFile file) { - + if (file==NULL) return UNZ_PARAMERROR; @@ -3185,7 +3185,7 @@ int unzClose (unzFile file) // Write info about the ZipFile in the *pglobal_info structure. // No preparation of the structure is needed -// return UNZ_OK if there is no problem. +// return UNZ_OK if there is no problem. int unzGetGlobalInfo (unzFile file,unz_global_info *pglobal_info) { unz_s* s; @@ -4178,7 +4178,7 @@ void EnsureDirectory(const TCHAR *rootdir, const TCHAR *dir) // make sure there rd is always null terminated rd[MAX_PATH] = 0; - + size_t len=_tcslen(rd); if (len>0 && (rd[len-1]=='/' || rd[len-1]=='\\')) rd[len-1]=0; #ifdef ZIP_STD @@ -4197,24 +4197,24 @@ void EnsureDirectory(const TCHAR *rootdir, const TCHAR *dir) EnsureDirectory(rootdir,tmp); name++; } - TCHAR cd[MAX_PATH]; *cd=0; - if (rootdir!=0) + TCHAR cd[MAX_PATH]; *cd=0; + if (rootdir!=0) #ifdef ZIP_STD strncpy(cd,rootdir,MAX_PATH); #else _tcsncpy_s(cd,MAX_PATH,rootdir,MAX_PATH); -#endif - +#endif + cd[MAX_PATH-1]=0; size_t len=_tcslen(cd); - + #ifdef ZIP_STD strncpy(cd+len,dir,MAX_PATH-len); #else _tcsncpy_s(cd+len,MAX_PATH-len,dir,MAX_PATH-len); -#endif - - +#endif + + cd[MAX_PATH-1]=0; #ifdef ZIP_STD if (!FileExists(cd)) lumkdir(cd); @@ -4239,7 +4239,7 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags) } bool reached_eof; int res = unzReadCurrentFile(uf,dst,len,&reached_eof); - if (res<=0) + if (res<=0) { unzCloseCurrentFile(uf); currentfile=-1; } @@ -4292,32 +4292,32 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags) // a malicious zip could unzip itself into c:\windows. Our solution is that GetZipItem (which // is how the user retrieve's the file's name within the zip) never returns absolute paths. const TCHAR *name=ufn; const TCHAR *c=name; while (*c!=0) {if (*c=='/' || *c=='\\') name=c+1; c++;} - TCHAR dir[MAX_PATH]; + TCHAR dir[MAX_PATH]; #ifdef ZIP_STD strncpy(dir,ufn,MAX_PATH); #else _tcsncpy_s(dir,MAX_PATH,ufn,MAX_PATH); -#endif - +#endif + if (name==ufn) *dir=0; else dir[name-ufn]=0; bool isabsolute = (dir[0]=='/' || dir[0]=='\\' || (dir[0]!=0 && dir[1]==':')); - if (isabsolute) + if (isabsolute) { - + #ifdef ZIP_STD size_t dirlen=_tcslen(dir); strncpy(fn,dir,MAX_PATH); strncpy(fn+dirlen,name,MAX_PATH-dirlen); #else _tsprintf(fn,MAX_PATH,_T("%s%s"),dir,name); -#endif +#endif EnsureDirectory(0,dir); - + } - else + else { #ifdef ZIP_STD size_t rootdirlen=_tcslen(rootdir); @@ -4340,7 +4340,7 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags) if (h==INVALID_HANDLE_VALUE) return ZR_NOFILE; unzOpenCurrentFile(uf,password); if (unzbuf==0) unzbuf=new char[16384]; DWORD haderr=0; - // + // for (; haderr==0;) { bool reached_eof; @@ -4414,11 +4414,11 @@ unsigned int FormatZipMessageU(ZRESULT code, TCHAR *buf,unsigned int len) strncpy(buf,msg,n); #else _tcsncpy_s(buf,_tcslen(buf),msg,n); -#endif - - - - +#endif + + + + buf[n]=0; return mlen; } diff --git a/src/osgPlugins/zip/unzip.h b/src/osgPlugins/zip/unzip.h index cdb6545eb..cc774ae33 100644 --- a/src/osgPlugins/zip/unzip.h +++ b/src/osgPlugins/zip/unzip.h @@ -179,7 +179,7 @@ unsigned int FormatZipMessage(ZRESULT code, TCHAR *buf,unsigned int len); #define ZR_ENDED 0x00050000 // the zip creation has already been closed #define ZR_MISSIZE 0x00060000 // the indicated input file size turned out mistaken #define ZR_PARTIALUNZ 0x00070000 // the file had already been partially unzipped -#define ZR_ZMODE 0x00080000 // tried to mix creating/opening a zip +#define ZR_ZMODE 0x00080000 // tried to mix creating/opening a zip // The following come from bugs within the zip library itself #define ZR_BUGMASK 0xFF000000 #define ZR_NOTINITED 0x01000000 // initialisation didn't work diff --git a/src/osgPresentation/AnimationMaterial.cpp b/src/osgPresentation/AnimationMaterial.cpp index 4680f0544..b09dffd35 100644 --- a/src/osgPresentation/AnimationMaterial.cpp +++ b/src/osgPresentation/AnimationMaterial.cpp @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -27,7 +27,7 @@ void AnimationMaterial::insert(double time,osg::Material* material) bool AnimationMaterial::getMaterial(double time,osg::Material& material) const { if (_timeControlPointMap.empty()) return false; - + switch(_loopMode) { case(SWING): @@ -35,7 +35,7 @@ bool AnimationMaterial::getMaterial(double time,osg::Material& material) const double modulated_time = (time - getFirstTime())/(getPeriod()*2.0); double fraction_part = modulated_time - floor(modulated_time); if (fraction_part>0.5) fraction_part = 1.0-fraction_part; - + time = getFirstTime()+(fraction_part*2.0) * getPeriod(); break; } @@ -50,8 +50,8 @@ bool AnimationMaterial::getMaterial(double time,osg::Material& material) const // no need to modulate the time. break; } - - + + TimeControlPointMap::const_iterator second = _timeControlPointMap.lower_bound(time); if (second==_timeControlPointMap.begin()) @@ -61,8 +61,8 @@ bool AnimationMaterial::getMaterial(double time,osg::Material& material) const else if (second!=_timeControlPointMap.end()) { TimeControlPointMap::const_iterator first = second; - --first; - + --first; + // we have both a lower bound and the next item. // deta_time = second.time - first.time @@ -73,7 +73,7 @@ bool AnimationMaterial::getMaterial(double time,osg::Material& material) const else { interpolate(material,(time - first->first)/delta_time, *first->second, *second->second); - } + } } else // (second==_timeControlPointMap.end()) { @@ -157,8 +157,8 @@ bool AnimationMaterial::requiresBlending() const void AnimationMaterialCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) { - if (_animationMaterial.valid() && - nv->getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR && + if (_animationMaterial.valid() && + nv->getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR && nv->getFrameStamp()) { double time = nv->getFrameStamp()->getReferenceTime(); @@ -173,10 +173,10 @@ void AnimationMaterialCallback::operator()(osg::Node* node, osg::NodeVisitor* nv _firstTime = time; } update(*node); - + } } - + // must call any nested node callbacks and continue subgraph traversal. NodeCallback::traverse(node,nv); } @@ -220,11 +220,11 @@ void AnimationMaterialCallback::setPause(bool pause) { return; } - + _pause = pause; - + if (_firstTime==DBL_MAX) return; - + if (_pause) { _pauseTime = _latestTime; diff --git a/src/osgPresentation/CompileSlideCallback.cpp b/src/osgPresentation/CompileSlideCallback.cpp index f95188da8..58db7f22a 100644 --- a/src/osgPresentation/CompileSlideCallback.cpp +++ b/src/osgPresentation/CompileSlideCallback.cpp @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -20,26 +20,26 @@ void CompileSlideCallback::operator()(const osg::Camera & camera) const { osg::GraphicsContext* context = const_cast(camera.getGraphicsContext()); if (!context) return; - + osg::State* state = context->getState(); if (!state) return; - + const osg::FrameStamp* fs = state->getFrameStamp(); if (!fs) return; if (_needCompile) { - _frameNumber = fs->getFrameNumber(); + _frameNumber = fs->getFrameNumber(); _needCompile = false; } if (_frameNumber!=fs->getFrameNumber()) return; - + osgUtil::GLObjectsVisitor globjVisitor(osgUtil::GLObjectsVisitor::COMPILE_DISPLAY_LISTS| osgUtil::GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES); - + globjVisitor.setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); - + globjVisitor.setNodeMaskOverride(0xffffffff); globjVisitor.setState(state); diff --git a/src/osgPresentation/PickEventHandler.cpp b/src/osgPresentation/PickEventHandler.cpp index e32457685..e9f5e8e23 100644 --- a/src/osgPresentation/PickEventHandler.cpp +++ b/src/osgPresentation/PickEventHandler.cpp @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -126,7 +126,7 @@ void PickEventHandler::doOperation() osgDB::FilePathList& paths = osgDB::getDataFilePathList(); if (!paths.empty()) { - #ifdef _WIN32 + #ifdef _WIN32 std::string delimintor(";"); #else std::string delimintor(":"); @@ -175,7 +175,7 @@ void PickEventHandler::doOperation() // rendering anything new before the new window opens. OpenThreads::Thread::microSleep(500000); // half second sleep. } - + break; } case(osgPresentation::LOAD): @@ -195,7 +195,7 @@ void PickEventHandler::doOperation() break; } } - + if (requiresJump()) { OSG_NOTICE<<"Requires jump "<<_relativeJump<<", "<<_slideNum<<", "<<_layerNum<getActiveLayer(); int newSlide = previousSlide + _slideNum; int newLayer = previousLayer + _layerNum; - if (newLayer<0) + if (newLayer<0) { newLayer = 0; } diff --git a/src/osgPresentation/SlideEventHandler.cpp b/src/osgPresentation/SlideEventHandler.cpp index 04ac6bc9e..1b1b17d35 100644 --- a/src/osgPresentation/SlideEventHandler.cpp +++ b/src/osgPresentation/SlideEventHandler.cpp @@ -1,12 +1,12 @@ -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -71,11 +71,11 @@ struct ImageStreamOperator : public ObjectOperator reset(); } - + virtual void maintain() { } - + virtual void leave() { OSG_INFO<<"leave() : _imageStream->pause()"<pause(); else _imageStream->play(); } - + virtual void reset() { osg::ImageStream::StreamStatus previousStatus = _imageStream->getStatus(); @@ -99,13 +99,13 @@ struct ImageStreamOperator : public ObjectOperator //_imageStream->setVolume(previousVolume); - + if(previousStatus==osg::ImageStream::PLAYING) { _imageStream->play(); } - // add a delay so that movie thread has a chance to do the rewind + // add a delay so that movie thread has a chance to do the rewind float microSecondsToDelay = SlideEventHandler::instance()->getTimeDelayOnNewSlideWithMovies() * 1000000.0f; OpenThreads::Thread::microSleep(static_cast(microSecondsToDelay)); } @@ -125,11 +125,11 @@ struct CallbackOperator : public ObjectOperator { reset(); } - + virtual void maintain() { } - + virtual void leave() { } @@ -207,7 +207,7 @@ struct LayerAttributesOperator : public ObjectOperator } OSG_INFO<<"}"<_runStrings.empty()) { for(LayerAttributes::RunStrings::iterator itr = _layerAttribute->_runStrings.begin(); @@ -234,11 +234,11 @@ struct LayerAttributesOperator : public ObjectOperator } } - + virtual void maintain() { } - + virtual void leave() { OSG_INFO<<"LayerAttribute leave"<accept(fov); - + OSG_INFO<<"ActiveOperators::collect("<filePathList); } - + traverse(node); } - + }; class UpdateLightVisitor : public osg::NodeVisitor @@ -500,12 +500,12 @@ public: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN), _viewMatrix(viewMatrix), _currentX(currentX), _currentY(currentY) {} - + void apply(osg::Node& node) { traverse(node); } - + void apply(osg::LightSource& lightsource) { if (lightsource.getLight()) @@ -519,7 +519,7 @@ public: apply(osg::computeEyeToLocal(_viewMatrix,_nodePath), lightsource.getLight()); } } - + traverse(lightsource); } @@ -530,9 +530,9 @@ public: osg::Vec3 direction; if (sum_x2_y2<1.0) direction.set(_currentX, _currentY, sqrtf(1.0-sum_x2_y2)); else direction.set(_currentX, _currentY, 0.0); - + direction.normalize(); - + direction = osg::Matrixd::transform3x3(matrix, direction); direction.normalize(); @@ -541,7 +541,7 @@ public: osg::Matrixd _viewMatrix; float _currentX, _currentY; - + }; class UpdateAlphaVisitor : public osg::NodeVisitor @@ -552,13 +552,13 @@ public: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN), _modAlphaFunc(modAlphaFunc), _modMaterial(modMaterial), _currentX(currentX), _currentY(currentY) {} - + void apply(osg::Node& node) { if (node.getStateSet()) apply(*node.getStateSet()); traverse(node); } - + void apply(osg::StateSet& stateset) { if (_modAlphaFunc) @@ -574,9 +574,9 @@ public: alphaFunc->setReferenceValue(alpha); } } - + if (_modMaterial) - { + { osg::Material* material = dynamic_cast(stateset.getAttribute(osg::StateAttribute::MATERIAL)); if (material) { @@ -589,7 +589,7 @@ public: bool _modAlphaFunc, _modMaterial; float _currentX, _currentY; - + }; @@ -651,19 +651,19 @@ void SlideEventHandler::set(osg::Node* model) FindNamedSwitchVisitor findPresentation("Presentation"); model->accept(findPresentation); - + if (findPresentation._switch) { OSG_INFO<<"Presentation '"<getName()<<"'"<=0.0) { OSG_INFO<<"Presentation time set to "<accept(findSlide); - + if (findSlide._switch) { OSG_INFO<<"Found presentation slide"<getName()<=0 ) { return duration; - } + } } - + return _timePerSlide; } @@ -757,7 +757,7 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction if (_autoSteppingActive && !_pause) { double time = ea.time(); - + if (_firstTraversal) { _firstTraversal = false; @@ -766,7 +766,7 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction else if (time-_previousTime>=getCurrentTimeDelayBetweenSlides()) { // _previousTime = time; - + if (!_hold) { // increment the previous by the required time delay, note relative to the current @@ -793,8 +793,8 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction if (deltaTime < _minimumTimeBetweenKeyPresses) { break; - } - + } + _timeLastKeyPresses = time; if (ea.getKey()=='g') @@ -851,7 +851,7 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction previousLayer(); return true; } - else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Page_Down || + else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Page_Down || ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Page_Down) { _autoSteppingActive = false; @@ -865,8 +865,8 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction previousLayerOrSlide(); return true; } - else if (ea.getKey()=='N' || - ea.getKey()==osgGA::GUIEventAdapter::KEY_Right || + else if (ea.getKey()=='N' || + ea.getKey()==osgGA::GUIEventAdapter::KEY_Right || ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Right) { _autoSteppingActive = false; @@ -874,7 +874,7 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction home(ea,aa); return true; } - else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Left || + else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Left || ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Left) { _autoSteppingActive = false; @@ -887,27 +887,27 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction if (!_pause) { _pause = true; -#if 0 +#if 0 resetUpdateCallbackActivity(ALL_OBJECTS); #endif _activeOperators.setPause(_pause); } - + return true; - + } else if (ea.getKey()=='o') { if (_pause) { _pause = false; -#if 0 +#if 0 resetUpdateCallbackActivity(ALL_OBJECTS); #endif _activeOperators.setPause(_pause); } return true; - + } else if (ea.getKey()=='h') { @@ -922,11 +922,11 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction _activeOperators.reset(); return true; } -/* +/* else if (ea.getKey()=='c') { _cursorOn = !_cursorOn; - + for( unsigned int i = 0; i < _viewer->getCameraConfig()->getNumberOfCameras(); i++ ) { Producer::Camera* cam = _viewer->getCameraConfig()->getCamera(i); @@ -994,7 +994,7 @@ bool SlideEventHandler::selectSlide(int slideNum,int layerNum) if (!_presentationSwitch) return false; OSG_INFO<<"selectSlide("<=static_cast(_presentationSwitch->getNumChildren())) { slideNum = LAST_POSITION; @@ -1004,7 +1004,7 @@ bool SlideEventHandler::selectSlide(int slideNum,int layerNum) { slideNum = _presentationSwitch->getNumChildren()-1; } - + if (slideNum>=static_cast(_presentationSwitch->getNumChildren())) return false; @@ -1018,9 +1018,9 @@ bool SlideEventHandler::selectSlide(int slideNum,int layerNum) } OSG_INFO<<"selectSlide("<delta_s(_tickAtFirstSlideOrLayerChange, tick)<<" seconds, length ="<delta_s(_tickAtLastSlideOrLayerChange, tick)<<" seconds"<getChild(_activeSlide)->getName()<<"'"<getChild(_activeSlide)->accept(findSlide); @@ -1048,24 +1048,24 @@ bool SlideEventHandler::selectSlide(int slideNum,int layerNum) result = selectLayer(layerNum); - + } else { //OSG_INFO<<"Not found slide"<getKeySwitchMatrixManipulator()->setMinimumDistance(0.001); - + _viewer->getCameraManipulator()->setNode(_slideSwitch.get()); - + _viewer->computeActiveCoordinateSystemNodePath(); - + // resetUpdateCallbacks(ALL_OBJECTS); - + bool _useSlideFilePaths = false; if (_useSlideFilePaths) { @@ -1073,14 +1073,14 @@ bool SlideEventHandler::selectSlide(int slideNum,int layerNum) FindFilePathDataVisitor ffpdv; _presentationSwitch->accept(ffpdv); } - + if (newSlide && _releaseAndCompileOnEachNewSlide) { compileSlide(slideNum); } return result; - + } bool SlideEventHandler::selectLayer(int layerNum) @@ -1101,7 +1101,7 @@ bool SlideEventHandler::selectLayer(int layerNum) } if (layerNum>=static_cast(_slideSwitch->getNumChildren())) return false; - + _activeLayer = layerNum; _slideSwitch->setSingleChildOn(_activeLayer); @@ -1143,7 +1143,7 @@ bool SlideEventHandler::nextSlide() int previousLayer = getActiveLayer(); int newSlide = previousSlide + la->getSlideNum(); int newLayer = previousLayer + la->getLayerNum(); - if (newLayer<0) + if (newLayer<0) { newLayer = 0; } @@ -1183,7 +1183,7 @@ bool SlideEventHandler::nextLayer() if (la) { la->callLeaveCallbacks(_slideSwitch->getChild(_activeLayer)); - + if (la->requiresJump()) { if (la->getRelativeJump()) @@ -1192,7 +1192,7 @@ bool SlideEventHandler::nextLayer() int previousLayer = getActiveLayer(); int newSlide = previousSlide + la->getSlideNum(); int newLayer = previousLayer + la->getLayerNum(); - if (newLayer<0) + if (newLayer<0) { newLayer = 0; } @@ -1267,7 +1267,7 @@ bool SlideEventHandler::home() void SlideEventHandler::updateAlpha(bool modAlphaFunc, bool modMaterial, float x, float y) { OSG_INFO<<"updateAlpha("<accept(uav); else if (_viewer->getSceneData()) _viewer->getSceneData()->accept(uav); @@ -1311,10 +1311,10 @@ void SlideEventHandler::compileSlide(unsigned int slideNum) (*itr)->setPreDrawCallback(_compileSlideCallback.get()); } - } - + } + _compileSlideCallback->needCompile(_presentationSwitch->getChild(slideNum)); - + } void SlideEventHandler::releaseSlide(unsigned int slideNum) @@ -1322,7 +1322,7 @@ void SlideEventHandler::releaseSlide(unsigned int slideNum) osgUtil::GLObjectsVisitor globjVisitor(osgUtil::GLObjectsVisitor::RELEASE_DISPLAY_LISTS| osgUtil::GLObjectsVisitor::RELEASE_STATE_ATTRIBUTES); globjVisitor.setNodeMaskOverride(0xffffffff); - + _presentationSwitch->getChild(slideNum)->accept(globjVisitor); } @@ -1332,18 +1332,18 @@ void SlideEventHandler::dispatchEvent(const KeyPosition& keyPosition) // reset the time of the last key press to ensure that the event is disgarded as a key repeat. _timeLastKeyPresses = -1.0; - + if (keyPosition._x!=FLT_MAX) { float xRescaled = eq->getCurrentEventState()->getXmin() + (keyPosition._x+1.0f)*0.5f*(eq->getCurrentEventState()->getXmax()-eq->getCurrentEventState()->getXmin()); eq->getCurrentEventState()->setX(xRescaled); } - + if (keyPosition._y!=FLT_MAX) { float y = (eq->getCurrentEventState()->getMouseYOrientation()==osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS) ? keyPosition._y : -keyPosition._y; - + float yRescaled = eq->getCurrentEventState()->getYmin() + (y+1.0f)*0.5f*(eq->getCurrentEventState()->getYmax()-eq->getCurrentEventState()->getYmin()); eq->getCurrentEventState()->setY(yRescaled); } diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index e650be854..9c535ed3e 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -1,12 +1,12 @@ /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield * - * This software is open source and may be redistributed and/or modified under + * This software is open source and may be redistributed and/or modified under * the terms of the GNU General Public License (GPL) version 2.0. * The full license is in LICENSE.txt file included with this distribution,. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * include LICENSE.txt for more details. */ @@ -63,7 +63,7 @@ public: SetToTransparentBin(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} - + virtual void appply(osg::Node& node) { if (node.getStateSet()) @@ -72,7 +72,7 @@ public: node.getStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); } } - + virtual void apply(osg::Geode& geode) { if (geode.getStateSet()) @@ -88,7 +88,7 @@ public: geode.getDrawable(i)->getStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); } } - } + } }; @@ -151,7 +151,7 @@ SlideShowConstructor::SlideShowConstructor(osgDB::Options* options): _options(options) { const osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); - + _slideHeight = ds->getScreenHeight(); _slideWidth = ds->getScreenWidth(); _slideDistance = ds->getScreenDistance(); @@ -227,7 +227,7 @@ void SlideShowConstructor::createPresentation() _textFontDataDefault.characterSize = 0.04f; _textFontDataDefault.maximumWidth = 0.8f; #endif - + OSG_INFO<<"_titlePositionDataDefault.position="<<_titlePositionDataDefault.position<setName(std::string("Presentation_")+_presentationName); - + _root->addChild(_presentationSwitch.get()); - + osg::Vec3 slideCenter = _slideOrigin + osg::Vec3(_slideWidth*0.5f,0.0f,_slideHeight*0.5f); - + HomePosition* hp = new HomePosition; hp->eye.set(0.0f,0.0f,0.0f); hp->center = slideCenter; hp->up.set(0.0f,0.0f,1.0f); - + OSG_INFO<<" slideCenter "<=0.0) { setDuration(_presentationSwitch.get(),_presentationDuration); } - + _root->setUserData(hp); - + if (_loopPresentation) _root->addDescription("loop"); if (_autoSteppingActive) _root->addDescription("auto"); } @@ -274,7 +274,7 @@ LayerAttributes* SlideShowConstructor::getOrCreateLayerAttributes(osg::Node* nod la = new LayerAttributes; node->setUserData(la); } - + return la; } @@ -321,30 +321,30 @@ void SlideShowConstructor::addSlide() _titlePositionData = _titlePositionDataDefault; _textPositionData = _textPositionDataDefault; _imagePositionData = _imagePositionDataDefault; - _modelPositionData = _modelPositionDataDefault; - + _modelPositionData = _modelPositionDataDefault; + _slide = new osg::Switch; _slide->setName(std::string("Slide_")+_slideTitle); - + _slideClearNode = new osg::ClearNode; _slideClearNode->setClearColor(_backgroundColor); _slideClearNode->addChild(_slide.get()); - + _presentationSwitch->addChild(_slideClearNode.get()); _previousLayer = 0; _currentLayer = 0; - - + + _filePathData = new FilePathData(osgDB::getDataFilePathList()); - + _slideClearNode->setUserData(_filePathData.get()); } void SlideShowConstructor::selectSlide(int slideNum) { if (slideNum<0) - { + { addSlide(); } else if (slideNum>=static_cast(_presentationSwitch->getNumChildren())) @@ -384,12 +384,12 @@ void SlideShowConstructor::addLayer(bool inheritPreviousLayers, bool defineAsBas _currentLayer = new osg::Group; // OSG_NOTICE<<"addLayer"<addDrawable(text); - + addToCurrentLayer( decorateSubgraphForPosition(geode, positionData) ); bool needToApplyPosition = (_textPositionData.position == positionData.position); @@ -668,7 +668,7 @@ void SlideShowConstructor::addParagraph(const std::string& paragraph, PositionDa text->setAlignment(fontData.alignment); text->setAxisAlignment(fontData.axisAlignment); text->setPosition(localPosition); - + if (positionData.autoRotate) { text->setAxisAlignment(osgText::Text::SCREEN); @@ -681,13 +681,13 @@ void SlideShowConstructor::addParagraph(const std::string& paragraph, PositionDa text->setText(paragraph); osg::BoundingBox bb = text->getBound(); - + // note, this increment is only "correct" when text is on the plane of the slide.. // will need to make this more general later. localPosition.z() = bb.zMin()-fontData.characterSize*_slideHeight*1.5; geode->addDrawable(text); - + addToCurrentLayer( decorateSubgraphForPosition(geode, positionData) ); bool needToApplyPosition = (_textPositionData.position == positionData.position); @@ -736,7 +736,7 @@ public: osg::Texture* texture = dynamic_cast(ss->getTextureAttribute(i,osg::StateAttribute::TEXTURE)); osg::Image* image = texture ? texture->getImage(0) : 0; osg::ImageStream* imageStream = image ? dynamic_cast(image) : 0; - if (imageStream) + if (imageStream) { texture->setDataVariance(osg::Object::DYNAMIC); texture->setUnRefImageDataAfterApply(false); @@ -772,7 +772,7 @@ osg::Geometry* SlideShowConstructor::createTexturedQuadGeometry(const osg::Vec3& heightVec = heightVec*rotationMatrix; osg::ImageStream* imageStream = dynamic_cast(image); - + bool flipYAxis = image->getOrigin()==osg::Image::TOP_LEFT; #ifdef __sgi @@ -792,15 +792,15 @@ osg::Geometry* SlideShowConstructor::createTexturedQuadGeometry(const osg::Vec3& 0.0f, flipYAxis ? image->t() : 0.0f, image->s(), flipYAxis ? 0.0f : image->t()); - stateset = pictureQuad->getOrCreateStateSet(); + stateset = pictureQuad->getOrCreateStateSet(); texture = new osg::TextureRectangle(image); stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); - - - + + + } else { @@ -809,11 +809,11 @@ osg::Geometry* SlideShowConstructor::createTexturedQuadGeometry(const osg::Vec3& heightVec, 0.0f, flipYAxis ? 1.0f : 0.0f, 1.0f, flipYAxis ? 0.0f : 1.0f); - - stateset = pictureQuad->getOrCreateStateSet(); + + stateset = pictureQuad->getOrCreateStateSet(); texture = new osg::Texture2D(image); - + stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); @@ -825,9 +825,9 @@ osg::Geometry* SlideShowConstructor::createTexturedQuadGeometry(const osg::Vec3& if (imageStream) { imageStream->pause(); - - OSG_INFO<<"Reading video "<getFileName()<getFileName()<setClientStorageHint(true); } @@ -959,7 +959,7 @@ void SlideShowConstructor::addImage(const std::string& filename, const PositionD animation_transform->setUpdateCallback(animation); - animation_transform->setReferenceFrame(positionData.absolute_path ? + animation_transform->setReferenceFrame(positionData.absolute_path ? osg::Transform::ABSOLUTE_RF: osg::Transform::RELATIVE_RF); @@ -1036,7 +1036,7 @@ void SlideShowConstructor::addStereoImagePair(const std::string& filenameLeft, c float s = imageLeft->s(); float t = imageLeft->t(); - + float sx = imageDataLeft.region_in_pixel_coords ? 1.0f : s; float sy = imageDataLeft.region_in_pixel_coords ? 1.0f : t; @@ -1044,7 +1044,7 @@ void SlideShowConstructor::addStereoImagePair(const std::string& filenameLeft, c float y1 = imageDataLeft.region[1]*sy; float x2 = imageDataLeft.region[2]*sx; float y2 = imageDataLeft.region[3]*sy; - + float aspectRatio = (y2-y1)/(x2-x1); float image_width = _slideWidth*positionData.scale.x(); @@ -1144,9 +1144,9 @@ void SlideShowConstructor::addStereoImagePair(const std::string& filenameLeft, c new osgUtil::TransformCallback(subgraph->getBound().center(), osg::Vec3(positionData.rotation[1],positionData.rotation[2],positionData.rotation[3]), osg::DegreesToRadians(positionData.rotation[0]))); - + animation_transform->addChild(subgraph); - + subgraph = animation_transform; } @@ -1156,18 +1156,18 @@ void SlideShowConstructor::addStereoImagePair(const std::string& filenameLeft, c if (animation) { OSG_INFO<<"Have animation path for image"<getBound().center(); - + osg::PositionAttitudeTransform* animation_transform = new osg::PositionAttitudeTransform; animation_transform->setDataVariance(osg::Object::DYNAMIC); animation_transform->setPivotPoint(pivot); animation->setPivotPoint(pivot); animation_transform->setUpdateCallback(animation); - animation_transform->setReferenceFrame(positionData.absolute_path ? + animation_transform->setReferenceFrame(positionData.absolute_path ? osg::Transform::ABSOLUTE_RF: osg::Transform::RELATIVE_RF); @@ -1263,7 +1263,7 @@ void SlideShowConstructor::addVNC(const std::string& hostname, const PositionDat if (!osgDB::Registry::instance()->getAuthenticationMap()) osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap); osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(hostname, new osgDB::AuthenticationDetails("", password)); } - + addInteractiveImage(hostname+".vnc", positionData, imageData); } @@ -1289,13 +1289,13 @@ public: virtual void operator() (osg::Node*) const { OSG_INFO<<"PDF Page to be updated "<<_pageNum<getPageNum()!=_pageNum) { _pdfImage->page(_pageNum); } } - + osg::observer_ptr _pdfImage; int _pageNum; }; @@ -1311,12 +1311,12 @@ osg::Image* SlideShowConstructor::addInteractiveImage(const std::string& filenam } osg::Image* image = osgDB::readImageFile(filename, options.get()); - + OSG_INFO<<"addInteractiveImage("<s(); float t = image->t(); @@ -1327,7 +1327,7 @@ osg::Image* SlideShowConstructor::addInteractiveImage(const std::string& filenam float y1 = imageData.region[1]*sy; float x2 = imageData.region[2]*sx; float y2 = imageData.region[3]*sy; - + float aspectRatio = (y2-y1)/(x2-x1); float image_width = _slideWidth*positionData.scale.x(); @@ -1383,9 +1383,9 @@ osg::Image* SlideShowConstructor::addInteractiveImage(const std::string& filenam new osgUtil::TransformCallback(subgraph->getBound().center(), osg::Vec3(positionData.rotation[1],positionData.rotation[2],positionData.rotation[3]), osg::DegreesToRadians(positionData.rotation[0]))); - + animation_transform->addChild(subgraph); - + subgraph = animation_transform; } @@ -1395,11 +1395,11 @@ osg::Image* SlideShowConstructor::addInteractiveImage(const std::string& filenam if (animation) { OSG_INFO<<"Have animation path for image"<getBound().center(); - + osg::PositionAttitudeTransform* animation_transform = new osg::PositionAttitudeTransform; animation_transform->setDataVariance(osg::Object::DYNAMIC); animation_transform->setPivotPoint(pivot); @@ -1407,7 +1407,7 @@ osg::Image* SlideShowConstructor::addInteractiveImage(const std::string& filenam animation_transform->setUpdateCallback(animation); - animation_transform->setReferenceFrame(positionData.absolute_path ? + animation_transform->setReferenceFrame(positionData.absolute_path ? osg::Transform::ABSOLUTE_RF: osg::Transform::RELATIVE_RF); @@ -1465,7 +1465,7 @@ std::string SlideShowConstructor::findFileAndRecordPath(const std::string& filen _filePathData->filePathList.push_front(path); } } - + return foundFile; } @@ -1487,14 +1487,14 @@ void SlideShowConstructor::addModel(const std::string& filename, const PositionD { osg::Geode* geode = new osg::Geode; geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere)); - + subgraph = geode; } else if (filename=="box") { osg::Geode* geode = new osg::Geode; geode->addDrawable(new osg::ShapeDrawable(new osg::Box)); - + subgraph = geode; } else @@ -1502,7 +1502,7 @@ void SlideShowConstructor::addModel(const std::string& filename, const PositionD subgraph = osgDB::readNodeFile(filename, options.get()); if (subgraph) recordOptionsFilePath(options.get()); } - + if (subgraph) { addModel(subgraph, positionData, modelData); @@ -1527,11 +1527,11 @@ void SlideShowConstructor::addModel(osg::Node* subgraph, const PositionData& pos } } - + if (positionData.frame==SLIDE) { osg::Vec3 pos = convertSlideToModel(positionData.position); - + const osg::BoundingSphere& bs = subgraph->getBound(); float slide_scale = _slideHeight*(1.0f-positionData.position.z())*0.7f/bs.radius(); @@ -1558,14 +1558,14 @@ void SlideShowConstructor::addModel(osg::Node* subgraph, const PositionData& pos osg::MatrixTransform* transform = new osg::MatrixTransform; transform->setDataVariance(defaultMatrixDataVariance); transform->setMatrix(osg::Matrix::inverse(matrix)); - + OSG_INFO<<"Position Matrix "<getMatrix()<addChild(subgraph); subgraph = transform; } - + float referenceSizeRatio = 0.707; float referenceSize = subgraph->getBound().radius() * referenceSizeRatio; @@ -1608,11 +1608,11 @@ void SlideShowConstructor::addModel(osg::Node* subgraph, const PositionData& pos OSG_INFO<<"**** Need to handle special wheel animation"<getTimeControlPointMap(); - + osg::AnimationPath::TimeControlPointMap::iterator curr_itr = controlPoints.begin(); osg::AnimationPath::TimeControlPointMap::iterator prev_itr=curr_itr; ++curr_itr; - + osg::AnimationPath::ControlPoint* prev_cp = &(prev_itr->second); osg::AnimationPath::ControlPoint* curr_cp = &(curr_itr->second); @@ -1622,7 +1622,7 @@ void SlideShowConstructor::addModel(osg::Node* subgraph, const PositionData& pos float rotation_z_axis = atan2f(delta_position.y(),delta_position.x()); osg::Quat quat_y_axis,quat_z_axis,quat_combined; - + quat_y_axis.makeRotate(rotation_y_axis,0.0f,1.0f,0.0f); quat_z_axis.makeRotate(rotation_z_axis,0.0f,0.0f,1.0f); quat_combined = quat_y_axis*quat_z_axis; @@ -1636,25 +1636,25 @@ void SlideShowConstructor::addModel(osg::Node* subgraph, const PositionData& pos { prev_cp = &(prev_itr->second); curr_cp = &(curr_itr->second); - + delta_position = curr_cp->getPosition() - prev_cp->getPosition(); - + totalLength += delta_position.length(); - + // rolling - rotation about the y axis. rotation_y_axis = totalLength/referenceSize; - - // direction - rotation about the z axis. + + // direction - rotation about the z axis. rotation_z_axis = atan2f(delta_position.y(),delta_position.x()); OSG_INFO<<" rotation_y_axis="<mapFromGlobal(globalPos); QContextMenuEvent* cme = new QContextMenuEvent(QContextMenuEvent::Mouse, localPos, globalPos); QCoreApplication::postEvent(targetWidget, cme); - } + } } } - + if (eventType==QEvent::MouseButtonPress) { _image->sendFocusHint(true); @@ -509,7 +509,7 @@ void QGraphicsViewAdapter::render() } OSG_INFO << "render image " << _currentWrite << " with size (" << _width << "," << _height << ")" < lock(_qresizeMutex); _width = width; diff --git a/src/osgShadow/ConvexPolyhedron.cpp b/src/osgShadow/ConvexPolyhedron.cpp index 7f995d024..72e342533 100644 --- a/src/osgShadow/ConvexPolyhedron.cpp +++ b/src/osgShadow/ConvexPolyhedron.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -32,13 +32,13 @@ using namespace osgShadow; #if defined( DEBUG ) || defined( _DEBUG ) || defined( _DEBUG_ ) // ConvexPolyhedron may produce tons of warnings when it becomes non convex. -// Unfortuantely this condition often happens in daily routine of shadow usage +// Unfortuantely this condition often happens in daily routine of shadow usage // due precision errors mixed with repeating frustum cuts performed by MinimalShadowClasses. // However, in most of above cases this condition is not fatal // because polyhedron becomes concave by very small margin (mesuring deep the hole). -// Unfortunately warnings are produced even for such small margin cases and can +// Unfortunately warnings are produced even for such small margin cases and can // easily flood the console. -// So I leave MAKE_CHECKS commented out. Its really useful only for a guy who debugs +// So I leave MAKE_CHECKS commented out. Its really useful only for a guy who debugs // larger concaveness issues which means most developers will want to keep it commented. // #define MAKE_CHECKS 1 #endif @@ -1615,7 +1615,7 @@ void ConvexPolyhedron::extrude( const osg::Vec3d & offset ) (dotOffset1 < 0.0 && dotOffset0 > 0.0) ) { Face & face = createFace(); - char ac[40] = "Side plane from edge extrude "; + char ac[40] = "Side plane from edge extrude "; sprintf(ac + strlen(ac), "%d", new_face_counter++); face.name = ac; diff --git a/src/osgShadow/DebugShadowMap.cpp b/src/osgShadow/DebugShadowMap.cpp index d5c6e4827..5bc2afad3 100644 --- a/src/osgShadow/DebugShadowMap.cpp +++ b/src/osgShadow/DebugShadowMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -35,38 +35,38 @@ using namespace osgShadow; #define DEFAULT_DEBUG_HUD_ORIGIN_X 8 #define DEFAULT_DEBUG_HUD_ORIGIN_Y 8 -DebugShadowMap::DebugShadowMap(): +DebugShadowMap::DebugShadowMap(): BaseClass(), _hudSize( 2, 2 ), _hudOrigin( -1, -1 ), _viewportSize( DEFAULT_DEBUG_HUD_SIZE_X, DEFAULT_DEBUG_HUD_SIZE_Y ), - _viewportOrigin( DEFAULT_DEBUG_HUD_ORIGIN_X, DEFAULT_DEBUG_HUD_ORIGIN_Y ), + _viewportOrigin( DEFAULT_DEBUG_HUD_ORIGIN_X, DEFAULT_DEBUG_HUD_ORIGIN_Y ), _orthoSize( 2, 2 ), _orthoOrigin( -1, -1 ), _doDebugDraw( false ) { - + // Why this fancy 24 bit depth to 24 bit rainbow colors shader ? // - // Depth values cannot be easily cast on color component because they are: - // a) 24 or 32 bit and we loose lots of precision when cast on 8 bit + // Depth values cannot be easily cast on color component because they are: + // a) 24 or 32 bit and we loose lots of precision when cast on 8 bit // b) depth value distribution is non linear due to projection division // when cast on componenent color there is usually very minor shade variety // and its often difficult to notice that there is anything in the buffer - // - // Shader looks complex but it is used only for debug head-up rectangle - // so performance impact is not significant. - + // + // Shader looks complex but it is used only for debug head-up rectangle + // so performance impact is not significant. + _depthColorFragmentShader = new osg::Shader( osg::Shader::FRAGMENT, -#if 0 +#if 0 "uniform sampler2D texture; \n" " \n" "void main(void) \n" "{ \n" " float f = texture2D( texture, vec3( gl_TexCoord[0].xy, 1.0).xy ).r; \n" " gl_FragColor = vec4( 0.0, 1.0 - f, 0.5 - f, 0.5 ); \n" - "} \n" -#else + "} \n" +#else "uniform sampler2D texture; \n" " \n" "void main(void) \n" @@ -74,10 +74,10 @@ DebugShadowMap::DebugShadowMap(): " float f = texture2D( texture, vec3( gl_TexCoord[0].xy, 1.0).xy ).r; \n" " \n" " f = 256.0 * f; \n" - " float fC = floor( f ) / 256.0; \n" + " float fC = floor( f ) / 256.0; \n" " \n" " f = 256.0 * fract( f ); \n" - " float fS = floor( f ) / 256.0; \n" + " float fS = floor( f ) / 256.0; \n" " \n" " f = 256.0 * fract( f ); \n" " float fH = floor( f ) / 256.0; \n" @@ -88,18 +88,18 @@ DebugShadowMap::DebugShadowMap(): " vec3 rgb = vec3( ( fC > 0.5 ? ( 1.0 - fC ) : fC ), \n" " abs( fC - 0.333333 ), \n" " abs( fC - 0.666667 ) ); \n" - " \n" + " \n" " rgb = min( vec3( 1.0, 1.0, 1.0 ), 3.0 * rgb ); \n" " \n" " float fMax = max( max( rgb.r, rgb.g ), rgb.b ); \n" - " fMax = 1.0 / fMax; \n" + " fMax = 1.0 / fMax; \n" " \n" " vec3 color = fMax * rgb; \n" " \n" " gl_FragColor = vec4( fS + fH * color, 1 ) * gl_Color; \n" - "} \n" + "} \n" #endif - ); // end _depthColorFragmentShader + ); // end _depthColorFragmentShader } DebugShadowMap::DebugShadowMap @@ -108,7 +108,7 @@ DebugShadowMap::DebugShadowMap _hudSize( copy._hudSize ), _hudOrigin( copy._hudOrigin ), _viewportSize( copy._viewportSize ), - _viewportOrigin( copy._viewportOrigin ), + _viewportOrigin( copy._viewportOrigin ), _orthoSize( copy._viewportOrigin ), _orthoOrigin( copy._viewportOrigin ), _doDebugDraw( copy._doDebugDraw ) @@ -119,7 +119,7 @@ DebugShadowMap::DebugShadowMap ( copy._depthColorFragmentShader->clone(copyop) ); } -DebugShadowMap::~DebugShadowMap() +DebugShadowMap::~DebugShadowMap() { } @@ -144,9 +144,9 @@ bool DebugShadowMap::ViewData::DebugBoundingBox result = bb.center() != bb_prev.center() || bb.radius() != bb_prev.radius(); if( result ) - std::cout << "Box<" << name << "> (" + std::cout << "Box<" << name << "> (" << ( bb._max._v[0] + bb._min._v[0] ) * 0.5 << " " - << ( bb._max._v[1] + bb._min._v[1] ) * 0.5 << " " + << ( bb._max._v[1] + bb._min._v[1] ) * 0.5 << " " << ( bb._max._v[2] + bb._min._v[2] ) * 0.5 << ") [" << ( bb._max._v[0] - bb._min._v[0] ) << " " << ( bb._max._v[1] - bb._min._v[1] ) << " " @@ -170,7 +170,7 @@ bool DebugShadowMap::ViewData::DebugPolytope result = ( p.getPlaneList() != p_prev.getPlaneList() ); if( result ) { - std::cout << "Polytope<" << name + std::cout << "Polytope<" << name << "> size(" << p.getPlaneList().size() << ")" << std::endl; @@ -179,13 +179,13 @@ bool DebugShadowMap::ViewData::DebugPolytope { if( p.getPlaneList()[i] != p_prev.getPlaneList()[i] ) { - std::cout << "Plane<" << i - << "> (" + std::cout << "Plane<" << i + << "> (" << p.getPlaneList()[i].asVec4()[0] << ", " << p.getPlaneList()[i].asVec4()[1] << ", " << p.getPlaneList()[i].asVec4()[2] << ", " << p.getPlaneList()[i].asVec4()[3] << ")" - << std::endl; + << std::endl; } } } @@ -208,7 +208,7 @@ bool DebugShadowMap::ViewData::DebugMatrix result = ( m != m_prev ); if( result ) - std::cout << "Matrix<" << name << "> " << std::endl + std::cout << "Matrix<" << name << "> " << std::endl <<"[ " << m(0,0) << " " << m(0,1) << " " << m(0,2) << " " << m(0,3) << " ] " << std::endl <<"[ " << m(1,0) << " " << m(1,1) << " " << m(1,2) << " " << m(1,3) << " ] " << std::endl <<"[ " << m(2,0) << " " << m(2,1) << " " << m(2,2) << " " << m(2,3) << " ] " << std::endl @@ -220,12 +220,12 @@ bool DebugShadowMap::ViewData::DebugMatrix } void DebugShadowMap::ViewData::setDebugPolytope - ( const char * name, const ConvexPolyhedron & polytope, + ( const char * name, const ConvexPolyhedron & polytope, osg::Vec4 colorOutline, osg::Vec4 colorInside ) { if( !getDebugDraw() ) return; - if( &polytope == NULL ) { // delete + if( &polytope == NULL ) { // delete PolytopeGeometry & pg = _polytopeGeometryMap[ std::string( name ) ]; for( unsigned int i = 0; i < VECTOR_LENGTH( pg._geometry ) ; i++ ) { @@ -256,14 +256,14 @@ void DebugShadowMap::ViewData::setDebugPolytope pg._geometry[i]->setSupportsDisplayList( false ); } - if( _geode[i].valid() && + if( _geode[i].valid() && !_geode[i]->containsDrawable( pg._geometry[i].get() ) ) { - osg::Geode::DrawableList & dl = + osg::Geode::DrawableList & dl = const_cast< osg::Geode::DrawableList &> ( _geode[i]->getDrawableList() ); dl.insert( dl.begin(), pg._geometry[i].get() ); - } - } + } + } } } @@ -274,14 +274,14 @@ void DebugShadowMap::ViewData::updateDebugGeometry if( _polytopeGeometryMap.empty() ) return; const int num = 2; // = VECTOR_LENGTH( PolytopeGeometry::_geometry ); - - osg::Matrix - transform[ num ] = - { viewCam->getViewMatrix() * + + osg::Matrix + transform[ num ] = + { viewCam->getViewMatrix() * // use near far clamped projection ( precomputed in cullDebugGeometry ) ( _viewCamera==viewCam ? _viewProjection : viewCam->getProjectionMatrix() ), - shadowCam->getViewMatrix() * shadowCam->getProjectionMatrix() }, - inverse[ num ] = + shadowCam->getViewMatrix() * shadowCam->getProjectionMatrix() }, + inverse[ num ] = { osg::Matrix::inverse( transform[0] ), osg::Matrix::inverse( transform[1] ) }; @@ -292,13 +292,13 @@ void DebugShadowMap::ViewData::updateDebugGeometry #if 1 frustum[i].transform( inverse[i], transform[i] ); #else - frustum[i].transform + frustum[i].transform ( osg::Matrix::inverse( camera[i]->getProjectionMatrix() ), camera[i]->getProjectionMatrix() ); - frustum[i].transform + frustum[i].transform ( osg::Matrix::inverse( camera[i]->getViewMatrix() ), camera[i]->getViewMatrix() ); -#endif +#endif }; #else osg::Polytope frustum[ num ]; @@ -320,7 +320,7 @@ void DebugShadowMap::ViewData::updateDebugGeometry for( int i = 0; i < num ; i++ ) { - ConvexPolyhedron cp( pg._polytope ); + ConvexPolyhedron cp( pg._polytope ); cp.cut( frustum[i] ); cp.transform( transform[i], inverse[i] ); @@ -331,13 +331,13 @@ void DebugShadowMap::ViewData::updateDebugGeometry } void DebugShadowMap::ViewData::cullDebugGeometry( ) -{ +{ if( !getDebugDraw() ) return; if( !_camera.valid() ) return; - // View camera may use clamping projection matrix after traversal. + // View camera may use clamping projection matrix after traversal. // Since we need to know exact matrix for drawing the frusta, - // we have to compute it here in exactly the same way as cull visitor + // we have to compute it here in exactly the same way as cull visitor // will after cull traversal completes view camera subgraph. { _viewProjection = *_cv->getProjectionMatrix(); @@ -346,15 +346,15 @@ void DebugShadowMap::ViewData::cullDebugGeometry( ) if( _cv->getComputeNearFarMode() ) { // Redo steps from CullVisitor::popProjectionMatrix() - // which clamps projection matrix when Camera & Projection + // which clamps projection matrix when Camera & Projection // completes traversal of their children - // We have to do this now manually - // because we did not complete camera traversal yet but + // We have to do this now manually + // because we did not complete camera traversal yet but // we need to know how this clamped projection matrix will be _cv->computeNearPlane(); - + osgUtil::CullVisitor::value_type n = _cv->getCalculatedNearPlane(); osgUtil::CullVisitor::value_type f = _cv->getCalculatedFarPlane(); @@ -362,10 +362,10 @@ void DebugShadowMap::ViewData::cullDebugGeometry( ) _cv->clampProjectionMatrix( _viewProjection, n, f ); } } - + updateDebugGeometry( _viewCamera.get(), _camera.get() ); - -#if 1 // Add geometries of polytopes to main cam Render Stage + +#if 1 // Add geometries of polytopes to main cam Render Stage _transform[0]->accept( *_cv ); #else for( PolytopeGeometryMap::iterator itr = _polytopeGeometryMap.begin(); @@ -400,7 +400,7 @@ void DebugShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv ) if( vp ) { // view can be a slave that covers only a fraction of the screen - // so adjust debug hud location to proper viewport location + // so adjust debug hud location to proper viewport location _viewportOrigin[0] += vp->x(); _viewportOrigin[1] += vp->y(); @@ -413,28 +413,28 @@ void DebugShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv ) _orthoSize = st->_orthoSize; _orthoOrigin = st->_orthoOrigin; - + _depthColorFragmentShader = st->_depthColorFragmentShader; // create placeholder geodeds for polytope geometries // rest of their initialization will be performed during camera hud init _geode[0] = new osg::Geode; _geode[1] = new osg::Geode; - + _cameraDebugHUD = NULL;//Force debug HUD rebuild ( if needed ) } // Callback used by debugging hud to display Shadow Map to color buffer -// Had to do it this way because OSG does not allow to use -// the same GL Texture Id with different glTexParams. -// Callback simply turns compare mode off via GL while rendering hud and -// restores it before rendering the scene with shadows. -class DebugShadowMap::DrawableDrawWithDepthShadowComparisonOffCallback: +// Had to do it this way because OSG does not allow to use +// the same GL Texture Id with different glTexParams. +// Callback simply turns compare mode off via GL while rendering hud and +// restores it before rendering the scene with shadows. +class DebugShadowMap::DrawableDrawWithDepthShadowComparisonOffCallback: public osg::Drawable::DrawCallback { public: - DrawableDrawWithDepthShadowComparisonOffCallback( osg::Texture *pTex ) + DrawableDrawWithDepthShadowComparisonOffCallback( osg::Texture *pTex ) : _pTexture( pTex ) { } @@ -450,8 +450,8 @@ public: drawable->drawImplementation(ri); // Turn it back on - glTexParameteri( _pTexture->getTextureTarget(), GL_TEXTURE_COMPARE_MODE_ARB, - GL_COMPARE_R_TO_TEXTURE_ARB ); + glTexParameteri( _pTexture->getTextureTarget(), GL_TEXTURE_COMPARE_MODE_ARB, + GL_COMPARE_R_TO_TEXTURE_ARB ); } osg::ref_ptr< osg::Texture > _pTexture; @@ -459,7 +459,7 @@ public: void DebugShadowMap::ViewData::dump( const std::string & filename ) { - osg::ref_ptr< osg::Group > root = new osg::Group; + osg::ref_ptr< osg::Group > root = new osg::Group; osgUtil::CullVisitor * cv = _cv.get(); #if 1 @@ -486,7 +486,7 @@ void DebugShadowMap::ViewData::dump( const std::string & filename ) int i = 0; { - ConvexPolyhedron cp( pg._polytope ); + ConvexPolyhedron cp( pg._polytope ); pg._geometry[i] = cp.buildGeometry ( pg._colorOutline, pg._colorInside, pg._geometry[i].get() ); @@ -504,7 +504,7 @@ void DebugShadowMap::ViewData::dump( const std::string & filename ) } void DebugShadowMap::ViewData::createDebugHUD( ) -{ +{ _cameraDebugHUD = new osg::Camera; { // Make sure default HUD layout makes sense @@ -518,7 +518,7 @@ void DebugShadowMap::ViewData::createDebugHUD( ) if( _orthoSize[1] <= 0 ) _orthoSize[1] = _viewportSize[1]; } - { // Initialize hud camera + { // Initialize hud camera osg::Camera * camera = _cameraDebugHUD.get(); camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); @@ -526,10 +526,10 @@ void DebugShadowMap::ViewData::createDebugHUD( ) camera->setViewport( _viewportOrigin[0], _viewportOrigin[1], _viewportSize[0], _viewportSize[1] ); - camera->setProjectionMatrixAsOrtho( - _orthoOrigin[0], _orthoOrigin[0] + _orthoSize[0], + camera->setProjectionMatrixAsOrtho( + _orthoOrigin[0], _orthoOrigin[0] + _orthoSize[0], _orthoOrigin[1], _orthoOrigin[1] + _orthoSize[1], - -10, 10 ); + -10, 10 ); camera->setClearMask(GL_DEPTH_BUFFER_BIT); camera->setRenderOrder(osg::Camera::POST_RENDER); @@ -540,12 +540,12 @@ void DebugShadowMap::ViewData::createDebugHUD( ) osg::Geode* geode = new osg::Geode; _cameraDebugHUD->addChild(geode); - // finally create and attach hud geometry + // finally create and attach hud geometry osg::Geometry* geometry = osg::createTexturedQuadGeometry ( osg::Vec3(_hudOrigin[0],_hudOrigin[1],0), - osg::Vec3(_hudSize[0],0,0), + osg::Vec3(_hudSize[0],0,0), osg::Vec3(0,_hudSize[1],0) ); - + osg::StateSet* stateset = _cameraDebugHUD->getOrCreateStateSet(); stateset->setTextureAttribute(0,_texture.get(),osg::StateAttribute::ON ); stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF); @@ -553,7 +553,7 @@ void DebugShadowMap::ViewData::createDebugHUD( ) stateset->setAttributeAndModes ( new osg::Depth( osg::Depth::ALWAYS, 0, 1, false ) ); stateset->setMode(GL_BLEND,osg::StateAttribute::ON); - + osg::Program* program = new osg::Program; program->addShader( _depthColorFragmentShader.get() ); stateset->setAttribute( program ); @@ -572,7 +572,7 @@ void DebugShadowMap::ViewData::createDebugHUD( ) stateset->setTextureMode(1, GL_TEXTURE_2D, osg::StateAttribute::OFF); stateset->setMode(GL_BLEND, osg::StateAttribute::ON); stateset->setMode(GL_CULL_FACE, osg::StateAttribute::OFF); - stateset->setAttribute( new osg::Program() ); + stateset->setAttribute( new osg::Program() ); stateset->setAttributeAndModes ( new osg::Depth( osg::Depth::LEQUAL, 0, 1, false ) ); @@ -585,9 +585,9 @@ void DebugShadowMap::ViewData::createDebugHUD( ) } _transform[1]->setMatrix - ( osg::Matrix::translate( 1, 1, 0 ) * + ( osg::Matrix::translate( 1, 1, 0 ) * osg::Matrix::scale( 0.5, 0.5, 1 ) * - osg::Matrix::scale( _hudSize[0], _hudSize[1], 1 ) * + osg::Matrix::scale( _hudSize[0], _hudSize[1], 1 ) * osg::Matrix::translate( _hudOrigin[0], _hudOrigin[1], 0 ) ); _cameraDebugHUD->addChild( _transform[1].get() ); @@ -597,7 +597,7 @@ void DebugShadowMap::ViewData::createDebugHUD( ) osg::Vec3d DebugShadowMap::ViewData::computeShadowTexelToPixelError ( const osg::Matrix & mvpwView, const osg::Matrix & mvpwShadow, - const osg::Vec3d & vWorld, + const osg::Vec3d & vWorld, const osg::Vec3d & vDelta ) { osg::Vec3d vS0 = mvpwShadow * vWorld; @@ -608,13 +608,13 @@ osg::Vec3d DebugShadowMap::ViewData::computeShadowTexelToPixelError osg::Vec3d dV = vV1 - vV0; osg::Vec3d dS = vS1 - vS0; - + return osg::Vec3( dS[0] / dV[0], dS[1] / dV[1], dS[2] / dV[2] ); } void DebugShadowMap::ViewData::displayShadowTexelToPixelErrors - ( const osg::Camera* viewCamera, - const osg::Camera* shadowCamera, + ( const osg::Camera* viewCamera, + const osg::Camera* shadowCamera, const ConvexPolyhedron* hull ) { osg::Matrix mvpwMain = @@ -627,7 +627,7 @@ void DebugShadowMap::ViewData::displayShadowTexelToPixelErrors shadowCamera->getProjectionMatrix() * shadowCamera->getViewport()->computeWindowMatrix(); - osg::BoundingBox bb = + osg::BoundingBox bb = hull->computeBoundingBox( viewCamera->getViewMatrix() ); osg::Matrix m = viewCamera->getInverseViewMatrix(); @@ -643,7 +643,7 @@ void DebugShadowMap::ViewData::displayShadowTexelToPixelErrors std::cout << std::setprecision( 3 ) << " " << "ne=(" << vne[0] << "," << vne[1] << "," << vne[2] << ") " << "fe=(" << vfe[0] << "," << vfe[1] << "," << vfe[2] << ") " - << "me=(" << vme[0] << "," << vme[1] << "," << vme[2] << ") " + << "me=(" << vme[0] << "," << vme[1] << "," << vme[2] << ") " << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" diff --git a/src/osgShadow/LightSpacePerspectiveShadowMap.cpp b/src/osgShadow/LightSpacePerspectiveShadowMap.cpp index 59ece6d5f..ba2c415dc 100644 --- a/src/osgShadow/LightSpacePerspectiveShadowMap.cpp +++ b/src/osgShadow/LightSpacePerspectiveShadowMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -35,7 +35,7 @@ using namespace osgShadow; //////////////////////////////////////////////////////////////////////////////// -// There are two slightly differing implemetations available on +// There are two slightly differing implemetations available on // "Light Space Perspective Shadow Maps" page. One from 2004 and other from 2006. // Our implementation is written in two versions based on these solutions. //////////////////////////////////////////////////////////////////////////////// @@ -47,16 +47,16 @@ using namespace osgShadow; //////////////////////////////////////////////////////////////////////////////// // This code is copyright Vienna University of Technology, 2004. // -// Please feel FREE to COPY and USE the code to include it in your own work, +// Please feel FREE to COPY and USE the code to include it in your own work, // provided you include this copyright notice. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// // Authors Code: // Daniel Scherzer (scherzer@cg.tuwien.ac.at) -// -// Authors Paper: +// +// Authors Paper: // Michael Wimmer (wimmer@cg.tuwien.ac.at) // Daniel Scherzer (scherzer@cg.tuwien.ac.at) // Werner Purgathofer @@ -87,14 +87,14 @@ void calcLispSMMtx(struct VecPoint* B) { //temporal light View //look from position(eyePos) - //into direction(lightDir) + //into direction(lightDir) //with up vector(up) look(lightView,eyePos,lightDir,up); //transform the light volume points from world into light space transformVecPoint(B,lightView); - //calculate the cubic hull (an AABB) + //calculate the cubic hull (an AABB) //of the light space extents of the intersection body B //and save the two extreme points min and max calcCubicHull(min,max,B->points,B->size); @@ -102,7 +102,7 @@ void calcLispSMMtx(struct VecPoint* B) { { //use the formulas of the paper to get n (and f) const double factor = 1.0/sinGamma; - const double z_n = factor*nearDist; //often 1 + const double z_n = factor*nearDist; //often 1 const double d = absDouble(max[1]-min[1]); //perspective transform depth //light space y extents const double z_f = z_n + d*sinGamma; const double n = (z_n+sqrt(z_f*z_n))/sinGamma; @@ -118,18 +118,18 @@ void calcLispSMMtx(struct VecPoint* B) { //one possibility for a simple perspective transformation matrix //with the two parameters n(near) and f(far) in y direction copyMatrix(lispMtx,IDENTITY); // a = (f+n)/(f-n); b = -2*f*n/(f-n); - lispMtx[ 5] = (f+n)/(f-n); // [ 1 0 0 0] + lispMtx[ 5] = (f+n)/(f-n); // [ 1 0 0 0] lispMtx[13] = -2*f*n/(f-n); // [ 0 a 0 b] lispMtx[ 7] = 1; // [ 0 0 1 0] lispMtx[15] = 0; // [ 0 1 0 0] //temporal arrangement for the transformation of the points to post-perspective space mult(lightProjection,lispMtx,lightView); // ligthProjection = lispMtx*lightView - + //transform the light volume points from world into the distorted light space transformVecPoint(&Bcopy,lightProjection); - //calculate the cubic hull (an AABB) + //calculate the cubic hull (an AABB) //of the light space extents of the intersection body B //and save the two extreme points min and max calcCubicHull(min,max,Bcopy.points,Bcopy.size); @@ -183,7 +183,7 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() const double dotProd = viewDir * lightDir; const double sinGamma = sqrt(1.0- dotProd*dotProd); const double factor = 1.0/sinGamma; - const double z_n = factor*nearDist; //often 1 + const double z_n = factor*nearDist; //often 1 //use the formulas of the paper to get n (and f) const double d = fabs( bb._max[1]-bb._min[1]); //perspective transform depth //light space y extents const double z_f = z_n + d*sinGamma; @@ -193,10 +193,10 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() #if PRINT_COMPUTED_N_OPT std::cout - << " N=" << std::setw(8) << n + << " N=" << std::setw(8) << n << " n=" << std::setw(8) << z_n << " f=" << std::setw(8) << z_f - << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" + << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" << std::flush; #endif @@ -215,7 +215,7 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() // lispProjection.makeIdentity( ); #if 0 { - osg::Matrix mvp = _camera->getViewMatrix() * + osg::Matrix mvp = _camera->getViewMatrix() * _camera->getProjectionMatrix(); extendScenePolytope( mvp, osg::Matrix::inverse( mvp ) ); @@ -231,12 +231,12 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() cameraShadow->setProjectionMatrix ( lightViewToWorld * lightView * lispProjection * fitToUnitFrustum ); - + #if 0 // DOUBLE CHECK! bb = computeScenePolytopeBounds ( cameraShadow->getViewMatrix() * cameraShadow->getProjectionMatrix() ); - + if( !osg::equivalent( 0.f, (bb._min - osg::Vec3d(-1,-1,-1)).length2() ) || !osg::equivalent( 0.f, (bb._max - osg::Vec3d( 1, 1, 1)).length2() ) ) { @@ -262,14 +262,14 @@ LightSpacePerspectiveShadowMapAlgorithm::~LightSpacePerspectiveShadowMapAlgorith } void LightSpacePerspectiveShadowMapAlgorithm::operator() - ( const osgShadow::ConvexPolyhedron* hullShadowedView, - const osg::Camera* cameraMain, + ( const osgShadow::ConvexPolyhedron* hullShadowedView, + const osg::Camera* cameraMain, osg::Camera* cameraShadow ) const { // all computations are done in post projection light space - // which means we are in left handed coordinate system - osg::Matrix mvpLight = + // which means we are in left handed coordinate system + osg::Matrix mvpLight = cameraShadow->getViewMatrix() * cameraShadow->getProjectionMatrix(); osg::Matrix m = cameraMain->getInverseViewMatrix() * mvpLight; @@ -297,24 +297,24 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() // infinte directional, omnidirectional and spot types may be treated as directional // as all computations are performed in post projection light space. // Frankly, I have my doubts if their error analysis and methodology still works - // in non directional lights post projective space. But since I can't prove it doesn't, - // I assume it does ;-). So I made an effort to modify their original directional algo + // in non directional lights post projective space. But since I can't prove it doesn't, + // I assume it does ;-). So I made an effort to modify their original directional algo // to work in true light post perspective space and compute all params in this space. - // And here is a snag. Although shadowed hull fits completely into light space, - // camera position may not, and after projective transform it may land outside - // light frustum and even on/or below infinity plane. I need camera pos to compute + // And here is a snag. Although shadowed hull fits completely into light space, + // camera position may not, and after projective transform it may land outside + // light frustum and even on/or below infinity plane. I need camera pos to compute // minimal distance to shadowed hull. If its not right rest of the computation may - // be completely off. So in the end this approach is not singulartity free. - // I guess this problem is solvable in other way but "this other - // way" looks like a topic for other scientific paper and I am definitely not that - // ambitious ;-). So for the time being I simply try to discover when this happens and - // apply workaround, I found works. This workaround may mean that adjusted projection - // may not be optimal in original LisPSM Lmax norm sense. But as I wrote above, - // I doubt they are optimal when Light is not directional, anyway. + // be completely off. So in the end this approach is not singulartity free. + // I guess this problem is solvable in other way but "this other + // way" looks like a topic for other scientific paper and I am definitely not that + // ambitious ;-). So for the time being I simply try to discover when this happens and + // apply workaround, I found works. This workaround may mean that adjusted projection + // may not be optimal in original LisPSM Lmax norm sense. But as I wrote above, + // I doubt they are optimal when Light is not directional, anyway. - // Seems that most nasty case when algorithm fails is when cam pos is - // below light frustum near plane but above infinity plane - when this occurs - // shadows simply disappear. My workaround is to find this case by + // Seems that most nasty case when algorithm fails is when cam pos is + // below light frustum near plane but above infinity plane - when this occurs + // shadows simply disappear. My workaround is to find this case by // checking light postperspective transform camera z ( negative value means this ) // and make sure min distance to shadow hull is clamped to positive value. @@ -326,7 +326,7 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() #if ROBERTS_TEST_CHANGES // OSG_NOTICE<<"LightSpacePerspectiveShadowMapAlgorithm::operator() adjusting eye"< Vertices; - void setProjectionMatrix( const osg::Matrix & projectionMatrix ) + void setProjectionMatrix( const osg::Matrix & projectionMatrix ) { _projectionMatrix = projectionMatrix; } - void setViewMatrix( const osg::Matrix & viewMatrix ) + void setViewMatrix( const osg::Matrix & viewMatrix ) { _viewMatrix = viewMatrix; } void setHull( const ConvexPolyhedron & hull ) @@ -435,59 +435,59 @@ public: const ConvexPolyhedron & getHull( ) const { return _hull; } - const osg::Matrix & getProjectionMatrix( void ) const + const osg::Matrix & getProjectionMatrix( void ) const { return _projectionMatrix; } - const osg::Matrix & getViewMatrix( void ) const + const osg::Matrix & getViewMatrix( void ) const { return _viewMatrix; } - - bool getUseLiSPSM() const + + bool getUseLiSPSM() const { return _useLiSPSM; } - void setUseLiSPSM( bool use ) + void setUseLiSPSM( bool use ) { _useLiSPSM = use; } bool getUseFormula() const { return _useFormula; } - void setUseFormula( bool use ) + void setUseFormula( bool use ) { _useFormula = use; } bool getUseOldFormula() const { return _useOldFormula; } - void setUseOldFormula( bool use ) + void setUseOldFormula( bool use ) { _useOldFormula = use; } - void setN(const double& n ) + void setN(const double& n ) { _N = n; } - const double getN() const - { return _N; } + const double getN() const + { return _N; } //for old LispSM formula from paper const double getNearDist() const { return _nearDist; } - void setNearDist( const double & nearDist ) + void setNearDist( const double & nearDist ) { _nearDist = nearDist; } const double getFarDist() const { return _farDist; } - void setFarDist( const double & farDist ) + void setFarDist( const double & farDist ) { _farDist = farDist; } - const osg::Vec3d & getEyeDir() const + const osg::Vec3d & getEyeDir() const { return _eyeDir; } - const osg::Vec3d & getLightDir() const + const osg::Vec3d & getLightDir() const { return _lightDir; } - void setEyeDir( const osg::Vec3d eyeDir ) + void setEyeDir( const osg::Vec3d eyeDir ) { _eyeDir = eyeDir; } - void setLightDir( const osg::Vec3d lightDir ) + void setLightDir( const osg::Vec3d lightDir ) { _lightDir = lightDir; } protected: @@ -511,7 +511,7 @@ protected: double getN(const osg::Matrix lightSpace, const osg::BoundingBox& B_ls) const; osg::Vec3d getNearCameraPointE() const; - + osg::Vec3d getZ0_ls (const osg::Matrix& lightSpace, const osg::Vec3d& e, const double& b_lsZmax, const osg::Vec3d& eyeDir) const; @@ -538,7 +538,7 @@ public: } -osg::Vec3d LispSM::getNearCameraPointE( ) const +osg::Vec3d LispSM::getNearCameraPointE( ) const { const osg::Matrix& eyeView = getViewMatrix(); @@ -565,9 +565,9 @@ osg::Vec3d LispSM::getNearCameraPointE( ) const //z0 is the point that lies on the plane A parallel to the near plane through e //and on the near plane of the C frustum (the plane z = bZmax) and on the line x = e.x osg::Vec3d LispSM::getZ0_ls - (const osg::Matrix& lightSpace, const osg::Vec3d& e, const double& b_lsZmax, const osg::Vec3d& eyeDir) const + (const osg::Matrix& lightSpace, const osg::Vec3d& e, const double& b_lsZmax, const osg::Vec3d& eyeDir) const { - //to calculate the parallel plane to the near plane through e we + //to calculate the parallel plane to the near plane through e we //calculate the plane A with the three points osg::Plane A(eyeDir,e); //to transform plane A into lightSpace @@ -575,12 +575,12 @@ osg::Vec3d LispSM::getZ0_ls //transform to light space const osg::Vec3d e_ls = e * lightSpace; - //z_0 has the x coordinate of e, the z coord of B_lsZmax + //z_0 has the x coordinate of e, the z coord of B_lsZmax //and the y coord of the plane A and plane (z==B_lsZmax) intersection #if 1 osg::Vec3d v = osg::Vec3d(e_ls.x(),0,b_lsZmax); - // x & z are given. We compute y from equations: + // x & z are given. We compute y from equations: // A.distance( x,y,z ) == 0 // A.distance( x,y,z ) == A.distance( x,0,z ) + A.normal.y * y // hence A.distance( x,0,z ) == -A.normal.y * y @@ -597,14 +597,14 @@ osg::Vec3d LispSM::getZ0_ls } -double LispSM::calcNoptGeneral(const osg::Matrix lightSpace, const osg::BoundingBox& B_ls) const +double LispSM::calcNoptGeneral(const osg::Matrix lightSpace, const osg::BoundingBox& B_ls) const { const osg::Matrix& eyeView = getViewMatrix(); const osg::Matrix invLightSpace = osg::Matrix::inverse( lightSpace ); const osg::Vec3d z0_ls = getZ0_ls(lightSpace, _E,B_ls.zMax(),getEyeDir()); const osg::Vec3d z1_ls = osg::Vec3d(z0_ls.x(),z0_ls.y(),B_ls.zMin()); - + //to world const osg::Vec4d z0_ws = osg::Vec4d( z0_ls, 1 ) * invLightSpace; const osg::Vec4d z1_ws = osg::Vec4d( z1_ls, 1 ) * invLightSpace; @@ -619,17 +619,17 @@ double LispSM::calcNoptGeneral(const osg::Matrix lightSpace, const osg::Bounding if( z1 / z0 <= 1.0 ) { // solve camera pos singularity in light space problem brutally: - // if extreme points of B projected to Light space extend beyond + // if extreme points of B projected to Light space extend beyond // camera frustum simply use B extents in camera frustum - // Its not optimal selection but ceratainly better than negative N + // Its not optimal selection but ceratainly better than negative N osg::BoundingBox bb = _hull.computeBoundingBox( eyeView ); z0 = -bb.zMax(); - if( z0 <= 0 ) + if( z0 <= 0 ) z0 = 0.1; z1 = -bb.zMin(); - if( z1 <= z0 ) + if( z1 <= z0 ) z1 = z0 + 0.1; } @@ -638,16 +638,16 @@ double LispSM::calcNoptGeneral(const osg::Matrix lightSpace, const osg::Bounding double N = d/( sqrt( z1 / z0 ) - 1.0 ); #if PRINT_COMPUTED_N_OPT std::cout - << " N=" << std::setw(8) << N + << " N=" << std::setw(8) << N << " n=" << std::setw(8) << z0 << " f=" << std::setw(8) << z1 - << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" + << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" << std::flush; #endif return N; } -double LispSM::calcNoptOld( const double gamma_ ) const +double LispSM::calcNoptOld( const double gamma_ ) const { const double& n = getNearDist(); const double& f = getFarDist(); @@ -664,16 +664,16 @@ double LispSM::calcNoptOld( const double gamma_ ) const double N = (n+sqrt(n*(n+d*sinGamma)))/sinGamma; #if PRINT_COMPUTED_N_OPT std::cout - << " N=" << std::setw(8) << N + << " N=" << std::setw(8) << N << " n=" << std::setw(8) << n << " f=" << std::setw(8) << f - << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" + << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" << std::flush; #endif return N; } -double LispSM::getN(const osg::Matrix lightSpace, const osg::BoundingBox& B_ls) const +double LispSM::getN(const osg::Matrix lightSpace, const osg::BoundingBox& B_ls) const { if( getUseFormula()) { if( getUseOldFormula() ) @@ -686,7 +686,7 @@ double LispSM::getN(const osg::Matrix lightSpace, const osg::BoundingBox& B_ls) } } //this is the algorithm discussed in the article -osg::Matrix LispSM::getLispSmMtx( const osg::Matrix& lightSpace ) const +osg::Matrix LispSM::getLispSmMtx( const osg::Matrix& lightSpace ) const { const osg::BoundingBox B_ls = _hull.computeBoundingBox( lightSpace ); @@ -694,7 +694,7 @@ osg::Matrix LispSM::getLispSmMtx( const osg::Matrix& lightSpace ) const //get the coordinates of the near camera point in light space const osg::Vec3d e_ls = _E * lightSpace; - //c start has the x and y coordinate of e, the z coord of B.min() + //c start has the x and y coordinate of e, the z coord of B.min() const osg::Vec3d Cstart_lp(e_ls.x(),e_ls.y(),B_ls.zMax()); if( n >= OSG_INFINITY ) { @@ -712,7 +712,7 @@ osg::Matrix LispSM::getLispSmMtx( const osg::Matrix& lightSpace ) const const double d = osg::absolute(B_ls.zMax()-B_ls.zMin()); //the lispsm perspective transformation - + //here done with a standard frustum call that maps P onto the unit cube with //corner points [-1,-1,-1] and [1,1,1]. //in directX you can use the same mapping and do a mapping to the directX post-perspective cube @@ -750,7 +750,7 @@ osg::Vec3d LispSM::getProjViewDir_ls(const osg::Matrix& lightSpace ) const { b_lp = v; } - osg::Vec3d projDir( osg::Vec3( b_lp[0], b_lp[1], b_lp[2] ) / b_lp[3] - + osg::Vec3d projDir( osg::Vec3( b_lp[0], b_lp[1], b_lp[2] ) / b_lp[3] - osg::Vec3( e_lp[0], e_lp[1], e_lp[2] ) / e_lp[3] ); projDir.normalize(); @@ -761,10 +761,10 @@ osg::Vec3d LispSM::getProjViewDir_ls(const osg::Matrix& lightSpace ) const { } void LispSM::updateLightMtx - ( osg::Matrix& lightView, osg::Matrix& lightProj ) const + ( osg::Matrix& lightView, osg::Matrix& lightProj ) const { //calculate standard light space for spot or directional lights - //this routine returns two matrices: + //this routine returns two matrices: //lightview contains the rotated translated frame //lightproj contains in the case of a spot light the spot light perspective transformation //in the case of a directional light a identity matrix @@ -790,14 +790,14 @@ void LispSM::updateLightMtx osg::Matrix L = lightView * lightProj; - osg::Vec3d projViewDir = getProjViewDir_ls(L); + osg::Vec3d projViewDir = getProjViewDir_ls(L); if( getUseLiSPSM() /* && projViewDir.z() < 0*/ ) { //do Light Space Perspective shadow mapping //rotate the lightspace so that the proj light view always points upwards //calculate a frame matrix that uses the projViewDir[light-space] as up vector //look(from position, into the direction of the projected direction, with unchanged up-vector) - lightProj = lightProj * + lightProj = lightProj * osg::Matrix::lookAt( osg::Vec3d(0,0,0), projViewDir, osg::Vec3d(0,1,0) ); osg::Matrix lispsm = getLispSmMtx( lightView * lightProj ); @@ -831,7 +831,7 @@ void LispSM::updateLightMtx void LightSpacePerspectiveShadowMapAlgorithm::operator() ( const osgShadow::ConvexPolyhedron* hullShadowedView, - const osg::Camera* cameraMain, + const osg::Camera* cameraMain, osg::Camera* cameraShadow ) const { lispsm->setHull( *hullShadowedView ); @@ -843,7 +843,7 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() osg::Vec3d eyeDir = osg::Matrix::transform3x3( osg::Vec3d( 0, 0, -1 ), osg::Matrix::inverse( cameraMain->getViewMatrix() ) ); #else - + osg::Vec3d lightDir = osg::Matrix::transform3x3( cameraShadow->getViewMatrix(), osg::Vec3d( 0.0, 0.0, -1.0 ) ); osg::Vec3d eyeDir = osg::Matrix::transform3x3( cameraMain->getViewMatrix(), osg::Vec3d( 0.0, 0.0, -1.0 ) ); @@ -859,9 +859,9 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() double l,r,b,t,n,f; if( proj.getOrtho( l,r,b,t,n,f ) ) { - osg::Vec3d camPosInLightSpace = - osg::Vec3d( 0, 0, 0 ) * - osg::Matrix::inverse( cameraMain->getViewMatrix() ) * + osg::Vec3d camPosInLightSpace = + osg::Vec3d( 0, 0, 0 ) * + osg::Matrix::inverse( cameraMain->getViewMatrix() ) * cameraShadow->getViewMatrix() * cameraShadow->getProjectionMatrix(); } @@ -870,7 +870,7 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() lispsm->setEyeDir( eyeDir ); - osg::BoundingBox bb = + osg::BoundingBox bb = hullShadowedView->computeBoundingBox( cameraMain->getViewMatrix() ); lispsm->setNearDist( -bb.zMax() ); diff --git a/src/osgShadow/MinimalCullBoundsShadowMap.cpp b/src/osgShadow/MinimalCullBoundsShadowMap.cpp index b4bfc6bbd..14725ab3d 100644 --- a/src/osgShadow/MinimalCullBoundsShadowMap.cpp +++ b/src/osgShadow/MinimalCullBoundsShadowMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -33,7 +33,7 @@ MinimalCullBoundsShadowMap::MinimalCullBoundsShadowMap { } -MinimalCullBoundsShadowMap::~MinimalCullBoundsShadowMap() +MinimalCullBoundsShadowMap::~MinimalCullBoundsShadowMap() { } @@ -47,7 +47,7 @@ void MinimalCullBoundsShadowMap::ViewData::init void MinimalCullBoundsShadowMap::ViewData::aimShadowCastingCamera ( const osg::Light *light, const osg::Vec4 &lightPos, - const osg::Vec3 &lightDir, + const osg::Vec3 &lightDir, const osg::Vec3 &lightUp ) { MinimalShadowMap::ViewData::aimShadowCastingCamera @@ -60,7 +60,7 @@ void MinimalCullBoundsShadowMap::ViewData::aimShadowCastingCamera void MinimalCullBoundsShadowMap::ViewData::cullShadowReceivingScene( ) { RenderLeafList rllOld, rllNew; - + GetRenderLeaves( _cv->getRenderStage(), rllOld ); MinimalShadowMap::ViewData::cullShadowReceivingScene( ); @@ -70,28 +70,28 @@ void MinimalCullBoundsShadowMap::ViewData::cullShadowReceivingScene( ) RemoveOldRenderLeaves( rllNew, rllOld ); RemoveIgnoredRenderLeaves( rllNew ); - osg::Matrix projectionToModelSpace = - osg::Matrix::inverse( *_modellingSpaceToWorldPtr * + osg::Matrix projectionToModelSpace = + osg::Matrix::inverse( *_modellingSpaceToWorldPtr * *_cv->getModelViewMatrix() * *_cv->getProjectionMatrix() ); osg::BoundingBox bb; if( *_cv->getProjectionMatrix() != _clampedProjection ) { osg::Polytope polytope; -#if 1 +#if 1 polytope.setToUnitFrustum(); #else polytope.add( osg::Plane( 0.0,0.0,-1.0,1.0 ) ); // only far plane #endif polytope.transformProvidingInverse( *_modellingSpaceToWorldPtr * *_cv->getModelViewMatrix() * _clampedProjection ); - + bb = ComputeRenderLeavesBounds( rllNew, projectionToModelSpace, polytope ); } else { bb = ComputeRenderLeavesBounds( rllNew, projectionToModelSpace ); } - - cutScenePolytope( *_modellingSpaceToWorldPtr, + + cutScenePolytope( *_modellingSpaceToWorldPtr, osg::Matrix::inverse( *_modellingSpaceToWorldPtr ), bb ); } @@ -101,7 +101,7 @@ void MinimalCullBoundsShadowMap::ViewData::GetRenderLeaves osgUtil::RenderBin::RenderBinList& bins = rb->getRenderBinList(); osgUtil::RenderBin::RenderBinList::const_iterator rbitr; - // scan pre render bins + // scan pre render bins for(rbitr = bins.begin(); rbitr!=bins.end() && rbitr->first<0; ++rbitr ) GetRenderLeaves( rbitr->second.get(), rll ); @@ -110,15 +110,15 @@ void MinimalCullBoundsShadowMap::ViewData::GetRenderLeaves osgUtil::RenderBin::RenderLeafList::const_iterator rlitr; for( rlitr= renderLeafList.begin(); rlitr!= renderLeafList.end(); ++rlitr ) { - rll.push_back( *rlitr ); + rll.push_back( *rlitr ); } // scan coarse grained ordering. osgUtil::RenderBin::StateGraphList& stateGraphList = rb->getStateGraphList(); - osgUtil::RenderBin::StateGraphList::const_iterator oitr; + osgUtil::RenderBin::StateGraphList::const_iterator oitr; for( oitr= stateGraphList.begin(); oitr!= stateGraphList.end(); ++oitr ) { - for( osgUtil::StateGraph::LeafList::const_iterator dw_itr = + for( osgUtil::StateGraph::LeafList::const_iterator dw_itr = (*oitr)->_leaves.begin(); dw_itr != (*oitr)->_leaves.end(); ++dw_itr) { rll.push_back( dw_itr->get() ); @@ -126,7 +126,7 @@ void MinimalCullBoundsShadowMap::ViewData::GetRenderLeaves } // scan post render bins - for(; rbitr!=bins.end(); ++rbitr ) + for(; rbitr!=bins.end(); ++rbitr ) GetRenderLeaves( rbitr->second.get(), rll ); } @@ -136,7 +136,7 @@ public: { if ( !a ) return false; // NULL render leaf goes last return !b || - a->_projection < b->_projection || + a->_projection < b->_projection || (a->_projection == b->_projection && a->_modelview < b->_modelview); } }; @@ -170,7 +170,7 @@ inline bool CheckAndMultiplyBoxIfWithinPolytope #if 1 for( int i = 0; i < 3; i ++ ) for( int j = 0; j < 3; j ++ ) - if( s[i][j] < 0 ) bb._min[j] += s[i][j]; else bb._max[j] += s[i][j]; + if( s[i][j] < 0 ) bb._min[j] += s[i][j]; else bb._max[j] += s[i][j]; #else b.expandBy( o + s[0] ); b.expandBy( o + s[1] ); @@ -215,7 +215,7 @@ unsigned MinimalCullBoundsShadowMap::ViewData::RemoveIgnoredRenderLeaves { unsigned count = 0; - for( RenderLeafList::iterator it = rll.begin(); it != rll.end(); ++it ) + for( RenderLeafList::iterator it = rll.begin(); it != rll.end(); ++it ) { if( !*it ) continue; @@ -225,10 +225,10 @@ unsigned MinimalCullBoundsShadowMap::ViewData::RemoveIgnoredRenderLeaves if( !name || name[0] != 'L' ) continue; if( !strcmp( name, "LightPointDrawable" ) || - !strcmp( name, "LightPointSpriteDrawable" ) ) + !strcmp( name, "LightPointSpriteDrawable" ) ) { *it = NULL; //ignored = invalidate this in new render leaves list - count++; + count++; } } @@ -237,7 +237,7 @@ unsigned MinimalCullBoundsShadowMap::ViewData::RemoveIgnoredRenderLeaves osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds ( RenderLeafList &rll, osg::Matrix & projectionToWorld ) -{ +{ osg::BoundingBox bbResult; if( rll.size() == 0 ) return bbResult; @@ -258,8 +258,8 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds // Don't trust already computed bounds for cull generated drawables // LightPointDrawable & LightPointSpriteDrawable are such examples - // they store wrong recorded bounds from very first pass - if( rl && rl->_modelview == NULL ) + // they store wrong recorded bounds from very first pass + if( rl && rl->_modelview == NULL ) rl->_drawable->dirtyBound(); // Stay as long as possible in model space to minimize matrix ops @@ -267,10 +267,10 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds bb.expandBy( rl->_drawable->getBound() ); } else { if( bb.valid() ) { - // Conditions to avoid matrix multiplications - if( projection.valid() ) + // Conditions to avoid matrix multiplications + if( projection.valid() ) { - if( projection.get() != ptrProjection ) + if( projection.get() != ptrProjection ) { ptrProjection = projection.get(); viewToWorld = *ptrProjection * projectionToWorld; @@ -280,7 +280,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds ptrViewToWorld = &projectionToWorld; } - if( modelview.valid() ) + if( modelview.valid() ) { modelToWorld = *modelview.get() * *ptrViewToWorld; ptrModelToWorld = &modelToWorld; @@ -291,7 +291,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds for( int i = 0; i < 8; i++ ) bbResult.expandBy( bb.corner( i ) * *ptrModelToWorld ); } - if( !rl ) break; + if( !rl ) break; bb = rl->_drawable->getBound(); modelview = rl->_modelview; projection = rl->_projection; @@ -305,7 +305,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds ( RenderLeafList &rll, osg::Matrix & projectionToWorld, osg::Polytope & p ) -{ +{ osg::BoundingBox bbResult, bb; if( rll.size() == 0 ) return bbResult; @@ -316,7 +316,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds osg::ref_ptr< osg::RefMatrix > projection; osg::Matrix viewToWorld, modelToWorld, *ptrProjection = NULL, - *ptrViewToWorld = &projectionToWorld, + *ptrViewToWorld = &projectionToWorld, *ptrModelToWorld = NULL; // compute bounding boxes but skip old ones (placed at the end as NULLs) @@ -327,20 +327,20 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds // Don't trust already computed bounds for cull generated drawables // LightPointDrawable & LightPointSpriteDrawable are such examples - // they store wrong recorded bounds from very first pass + // they store wrong recorded bounds from very first pass if(rl->_modelview == NULL ) rl->_drawable->dirtyBound(); bb = rl->_drawable->getBound(); if( !bb.valid() ) continue; - + // Stay as long as possible in model space to minimize matrix ops if( rl->_modelview != modelview || rl->_projection != projection ) { projection = rl->_projection; - if( projection.valid() ) + if( projection.valid() ) { - if( projection.get() != ptrProjection ) + if( projection.get() != ptrProjection ) { ptrProjection = projection.get(); viewToWorld = *ptrProjection * projectionToWorld; @@ -351,7 +351,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds } modelview = rl->_modelview; - if( modelview.valid() ) + if( modelview.valid() ) { modelToWorld = *modelview.get() * *ptrViewToWorld; ptrModelToWorld = &modelToWorld; diff --git a/src/osgShadow/MinimalDrawBoundsShadowMap.cpp b/src/osgShadow/MinimalDrawBoundsShadowMap.cpp index 4589d6c44..c5086e287 100644 --- a/src/osgShadow/MinimalDrawBoundsShadowMap.cpp +++ b/src/osgShadow/MinimalDrawBoundsShadowMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -47,7 +47,7 @@ MinimalDrawBoundsShadowMap::~MinimalDrawBoundsShadowMap() } void MinimalDrawBoundsShadowMap::ViewData::cullShadowReceivingScene( ) -{ +{ BaseClass::ViewData::cullShadowReceivingScene( ); ThisClass::ViewData::cullBoundAnalysisScene( ); } @@ -59,17 +59,17 @@ void MinimalDrawBoundsShadowMap::ViewData::cullBoundAnalysisScene( ) _boundAnalysisCamera->setProjectionMatrix( _clampedProjection ); osg::Matrixd::value_type l,r,b,t,n,f; - _boundAnalysisCamera->getProjectionMatrixAsFrustum( l,r,b,t,n,f ); + _boundAnalysisCamera->getProjectionMatrixAsFrustum( l,r,b,t,n,f ); _mainCamera = _cv->getRenderStage()->getCamera(); extendProjection( _boundAnalysisCamera->getProjectionMatrix(), - _boundAnalysisCamera->getViewport(), osg::Vec2( 2,2 ) ); + _boundAnalysisCamera->getViewport(), osg::Vec2( 2,2 ) ); // record the traversal mask on entry so we can reapply it later. unsigned int traversalMask = _cv->getTraversalMask(); - _cv->setTraversalMask( traversalMask & + _cv->setTraversalMask( traversalMask & _st->getShadowedScene()->getReceivesShadowTraversalMask() ); // do RTT camera traversal @@ -95,7 +95,7 @@ void MinimalDrawBoundsShadowMap::ViewData::createDebugHUD( ) osg::Geometry* geometry = osg::createTexturedQuadGeometry ( osg::Vec3(_hudOrigin[0]+_hudSize[0],_hudOrigin[1],0), - osg::Vec3(_hudSize[0],0,0), + osg::Vec3(_hudSize[0],0,0), osg::Vec3(0,_hudSize[1],0) ); geode->addDrawable(geometry); @@ -119,10 +119,10 @@ osg::BoundingBox MinimalDrawBoundsShadowMap::ViewData::scanImage { osg::BoundingBox bb, bbProj; - int components = osg::Image::computeNumComponents( image->getPixelFormat() ); + int components = osg::Image::computeNumComponents( image->getPixelFormat() ); if( image->getDataType() == GL_FLOAT ) { - float scale = 255.f / 254.f; + float scale = 255.f / 254.f; float * pf = (float *)image->data(); for( int y = 0; y < image->t(); y++ ) { float fY = ( 0.5f + y ) / image->t(); @@ -133,7 +133,7 @@ osg::BoundingBox MinimalDrawBoundsShadowMap::ViewData::scanImage float fMinZ = pf[0] * scale; bbProj.expandBy( osg::Vec3( fX, fY, fMinZ ) ); bb.expandBy( osg::Vec3( fX, fY, fMinZ ) * m ); - + if( components > 1 ) { float fMaxZ = scale * ( 1.f - pf[1] ); bbProj.expandBy( osg::Vec3( fX, fY, fMaxZ ) ); @@ -164,7 +164,7 @@ osg::BoundingBox MinimalDrawBoundsShadowMap::ViewData::scanImage if( components > 1 ) { float fMaxZ = scale * (255 - pb[1] + 0.5f); fMaxZ = osg::clampTo( fMaxZ, 0.f, 1.f ); - + bbProj.expandBy( osg::Vec3( fX, fY, fMaxZ ) ); bb.expandBy( osg::Vec3( fX, fY, fMaxZ ) * m ); } @@ -183,7 +183,7 @@ void MinimalDrawBoundsShadowMap::ViewData::performBoundAnalysis( const osg::Came if( !_projection.valid() ) return; - osg::Camera::BufferAttachmentMap & bam + osg::Camera::BufferAttachmentMap & bam = const_cast( camera ).getBufferAttachmentMap(); #if ANALYSIS_DEPTH osg::Camera::Attachment & attachment = bam[ osg::Camera::DEPTH_BUFFER ]; @@ -192,12 +192,12 @@ void MinimalDrawBoundsShadowMap::ViewData::performBoundAnalysis( const osg::Came #endif const osg::ref_ptr< osg::Image > image = attachment._image.get(); - if( !image.valid() ) + if( !image.valid() ) return; osg::Matrix m; - m.invert( *_modellingSpaceToWorldPtr * - camera.getViewMatrix() * + m.invert( *_modellingSpaceToWorldPtr * + camera.getViewMatrix() * camera.getProjectionMatrix() ); m.preMult( osg::Matrix::scale( osg::Vec3( 2.f, 2.f, 2.f ) ) * @@ -205,17 +205,17 @@ void MinimalDrawBoundsShadowMap::ViewData::performBoundAnalysis( const osg::Came osg::BoundingBox bb = scanImage( image.get(), m ); - if( getDebugDraw() ) { + if( getDebugDraw() ) { ConvexPolyhedron p; p.setToBoundingBox( bb ); - p.transform( *_modellingSpaceToWorldPtr, + p.transform( *_modellingSpaceToWorldPtr, osg::Matrix::inverse( *_modellingSpaceToWorldPtr ) ); setDebugPolytope( "scan", p, osg::Vec4( 0,0,0,1 ), osg::Vec4( 0,0,0,0.1 ) ); } - cutScenePolytope( *_modellingSpaceToWorldPtr, + cutScenePolytope( *_modellingSpaceToWorldPtr, osg::Matrix::inverse( *_modellingSpaceToWorldPtr ), bb ); frameShadowCastingCamera( _mainCamera.get(), _camera.get() ); @@ -233,12 +233,12 @@ void MinimalDrawBoundsShadowMap::ViewData::performBoundAnalysis( const osg::Came void MinimalDrawBoundsShadowMap::ViewData::recordShadowMapParams( ) { const osgUtil::RenderStage * rs = _cv->getCurrentRenderBin()->getStage(); - + setShadowCameraProjectionMatrixPtr( _cv->getProjectionMatrix() ); - if( !rs->getRenderBinList().empty() || rs->getBinNum() != 0 ) + if( !rs->getRenderBinList().empty() || rs->getBinNum() != 0 ) { - + } #if 0 MinimalShadowMap::RenderLeafList rll; @@ -248,17 +248,17 @@ void MinimalDrawBoundsShadowMap::ViewData::recordShadowMapParams( ) pass++; std::set< osg::ref_ptr< osg::RefMatrix > > projections; - + MinimalShadowMap::GetRenderLeaves( , rll ); - for( unsigned i =0; i < rll.size(); i++ ) { + for( unsigned i =0; i < rll.size(); i++ ) { if( rll[i]->_projection.get() != _projection.get() ) { osg::RefMatrix * projection = rll[i]->_projection.get(); - projections.insert( rll[i]->_projection ); + projections.insert( rll[i]->_projection ); c++; } } - if( projections.size() > 0 ) + if( projections.size() > 0 ) _projection = (*projections.begin()).get(); @@ -270,11 +270,11 @@ void MinimalDrawBoundsShadowMap::ViewData::init ( ThisClass *st, osgUtil::CullVisitor *cv ) { BaseClass::ViewData::init( st, cv ); - + _frameShadowCastingCameraPasses = 2; _camera->setCullCallback ( new CameraCullCallback( this, _camera->getCullCallback() ) ); - + _boundAnalysisTexture = new osg::Texture2D; _boundAnalysisTexture->setTextureSize ( _boundAnalysisSize[0], _boundAnalysisSize[1] ); @@ -287,7 +287,7 @@ void MinimalDrawBoundsShadowMap::ViewData::init _boundAnalysisSize[1], 1, GL_DEPTH_COMPONENT, GL_FLOAT ); - _boundAnalysisTexture->setInternalFormat(GL_DEPTH_COMPONENT); + _boundAnalysisTexture->setInternalFormat(GL_DEPTH_COMPONENT); // _boundAnalysisTexture->setShadowComparison(true); _boundAnalysisTexture->setShadowTextureMode(osg::Texture2D::LUMINANCE); @@ -298,14 +298,14 @@ void MinimalDrawBoundsShadowMap::ViewData::init #if USE_FLOAT_IMAGE _boundAnalysisImage->allocateImage( _boundAnalysisSize[0], - _boundAnalysisSize[1], 1, + _boundAnalysisSize[1], 1, GL_RGBA, GL_FLOAT ); _boundAnalysisImage->setInternalTextureFormat( GL_RGBA16F_ARB ); _boundAnalysisTexture->setInternalFormat(GL_RGBA16F_ARB); #else _boundAnalysisImage->allocateImage( _boundAnalysisSize[0], - _boundAnalysisSize[1], 1, + _boundAnalysisSize[1], 1, GL_RGBA, GL_UNSIGNED_BYTE ); _boundAnalysisImage->setInternalTextureFormat( GL_RGBA ); @@ -325,7 +325,7 @@ void MinimalDrawBoundsShadowMap::ViewData::init _boundAnalysisTexture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT); _boundAnalysisTexture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT); - // set up the render to texture camera. + // set up the render to texture camera. // create the camera _boundAnalysisCamera = new osg::Camera; _boundAnalysisCamera->setName( "AnalysisCamera" ); diff --git a/src/osgShadow/MinimalShadowMap.cpp b/src/osgShadow/MinimalShadowMap.cpp index e13dcad7e..5d99116bf 100644 --- a/src/osgShadow/MinimalShadowMap.cpp +++ b/src/osgShadow/MinimalShadowMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -24,13 +24,13 @@ using namespace osgShadow; #define PRINT_SHADOW_TEXEL_TO_PIXEL_ERROR 0 -MinimalShadowMap::MinimalShadowMap(): - BaseClass(), +MinimalShadowMap::MinimalShadowMap(): + BaseClass(), _maxFarPlane( FLT_MAX ), _minLightMargin( 0 ), _shadowReceivingCoarseBoundAccuracy( BOUNDING_BOX ) { - + } MinimalShadowMap::MinimalShadowMap @@ -42,7 +42,7 @@ MinimalShadowMap::MinimalShadowMap { } -MinimalShadowMap::~MinimalShadowMap() +MinimalShadowMap::~MinimalShadowMap() { } @@ -57,11 +57,11 @@ osg::BoundingBox MinimalShadowMap::ViewData::computeShadowReceivingCoarseBounds( if( accuracy == MinimalShadowMap::EMPTY_BOX ) { // One may skip coarse scene bounds computation if light is infinite. - // Empty box will be intersected with view frustum so in the end + // Empty box will be intersected with view frustum so in the end // view frustum will be used as bounds approximation. - // But if light is nondirectional and bounds come out too large - // they may bring the effect of almost 180 deg perspective set - // up for shadow camera. Such projection will significantly impact + // But if light is nondirectional and bounds come out too large + // they may bring the effect of almost 180 deg perspective set + // up for shadow camera. Such projection will significantly impact // precision of further math. return osg::BoundingBox(); @@ -86,22 +86,22 @@ osg::BoundingBox MinimalShadowMap::ViewData::computeShadowReceivingCoarseBounds( frustum.cut( box ); - // approximate sphere with octahedron. Ie first cut by box then + // approximate sphere with octahedron. Ie first cut by box then // additionaly cut with the same box rotated 45, 45, 45 deg. box.transform( // rotate box around its center osg::Matrix::translate( -bs.center() ) * - osg::Matrix::rotate( osg::PI_4, 0, 0, 1 ) * - osg::Matrix::rotate( osg::PI_4, 1, 1, 0 ) * + osg::Matrix::rotate( osg::PI_4, 0, 0, 1 ) * + osg::Matrix::rotate( osg::PI_4, 1, 1, 0 ) * osg::Matrix::translate( bs.center() ) ); frustum.cut( box ); - - return frustum.computeBoundingBox( ); + + return frustum.computeBoundingBox( ); } - + if( accuracy == MinimalShadowMap::BOUNDING_BOX ) // Default { - // more precise method but slower method - // bound visitor traversal takes lot of time for complex scenes + // more precise method but slower method + // bound visitor traversal takes lot of time for complex scenes // (note that this adds to cull time) osg::ComputeBoundsVisitor cbbv(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); @@ -114,12 +114,12 @@ osg::BoundingBox MinimalShadowMap::ViewData::computeShadowReceivingCoarseBounds( return osg::BoundingBox(); } -void MinimalShadowMap::ViewData::aimShadowCastingCamera( +void MinimalShadowMap::ViewData::aimShadowCastingCamera( const osg::BoundingSphere &bs, const osg::Light *light, const osg::Vec4 &lightPos, const osg::Vec3 &lightDir, - const osg::Vec3 &lightUpVector + const osg::Vec3 &lightUpVector /* by default = osg::Vec3( 0, 1 0 )*/ ) { BaseClass::ViewData::aimShadowCastingCamera( bs, light, lightPos, lightDir, lightUpVector ); @@ -128,7 +128,7 @@ void MinimalShadowMap::ViewData::aimShadowCastingCamera( void MinimalShadowMap::ViewData::aimShadowCastingCamera ( const osg::Light *light, const osg::Vec4 &lightPos, const osg::Vec3 &lightDir, const osg::Vec3 &lightUp ) -{ +{ osg::BoundingBox bb = computeScenePolytopeBounds(); if( !bb.valid() ) { // empty scene or looking at the sky - substitute something bb.expandBy( osg::BoundingSphere( _cv->getEyePoint(), 1 ) ); @@ -136,9 +136,9 @@ void MinimalShadowMap::ViewData::aimShadowCastingCamera osg::Vec3 up = lightUp; - if( up.length2() <= 0 ) + if( up.length2() <= 0 ) { - // This is extra step (not really needed but helpful in debuging) + // This is extra step (not really needed but helpful in debuging) // Compute such lightUp vector that shadow cam is intuitively aligned with eye // We compute this vector on -ZY view plane, perpendicular to light direction // Matrix m = ViewToWorld @@ -157,7 +157,7 @@ void MinimalShadowMap::ViewData::aimShadowCastingCamera // OpenGL std cam looks along -Z axis so Cam Fw = [ 0 0 -1 0 ] * m up.set( -m( 2, 0 ), -m( 2, 1 ), -m( 2, 2 ) ); #endif - } + } aimShadowCastingCamera( osg::BoundingSphere( bb ), light, lightPos, lightDir, up ); @@ -175,7 +175,7 @@ void MinimalShadowMap::ViewData::aimShadowCastingCamera void MinimalShadowMap::ViewData::frameShadowCastingCamera ( const osg::Camera* cameraMain, osg::Camera* cameraShadow, int pass ) { - osg::Matrix mvp = + osg::Matrix mvp = cameraShadow->getViewMatrix() * cameraShadow->getProjectionMatrix(); ConvexPolyhedron polytope = _sceneReceivingShadowPolytope; @@ -194,18 +194,18 @@ void MinimalShadowMap::ViewData::frameShadowCastingCamera // osg::Vec3d normal = osg::Matrix::transform3x3( osg::Vec3d( 0,0,-1)., transfrom ); // So I replaced it with safer code working with spot lights as well - osg::Vec3d normal = + osg::Vec3d normal = osg::Vec3d(0,0,-1) * transform - osg::Vec3d(0,0,1) * transform; normal.normalize(); _sceneReceivingShadowPolytope.extrude( normal * *_minLightMarginPtr ); // Zero pass does crude shadowed scene hull approximation. - // Its important to cut it to coarse light frustum properly + // Its important to cut it to coarse light frustum properly // at this stage. - // If not cut and polytope extends beyond shadow projection clip - // space (-1..1), it may get "twisted" by precisely adjusted shadow cam - // projection in second pass. + // If not cut and polytope extends beyond shadow projection clip + // space (-1..1), it may get "twisted" by precisely adjusted shadow cam + // projection in second pass. if ( pass == 0 && _frameShadowCastingCameraPasses > 1 ) { // Make sure extruded polytope does not extend beyond light frustum @@ -222,20 +222,20 @@ void MinimalShadowMap::ViewData::frameShadowCastingCamera bb = computeScenePolytopeBounds( mvp ); } - setDebugPolytope( "extended", + setDebugPolytope( "extended", _sceneReceivingShadowPolytope, osg::Vec4( 1, 0.5, 0, 1 ), osg::Vec4( 1, 0.5, 0, 0.1 ) ); _sceneReceivingShadowPolytope = polytope; _sceneReceivingShadowPolytopePoints = points; - - // Warning: Trim light projection at near plane may remove shadowing + + // Warning: Trim light projection at near plane may remove shadowing // from objects outside of view space but still casting shadows into it. // I have not noticed this issue so I left mask at default: all bits set. if( bb.valid() ) trimProjection( cameraShadow->getProjectionMatrix(), bb, 1|2|4|8|16|32 ); ///// Debuging stuff ////////////////////////////////////////////////////////// - setDebugPolytope( "scene", _sceneReceivingShadowPolytope, osg::Vec4(0,1,0,1) ); + setDebugPolytope( "scene", _sceneReceivingShadowPolytope, osg::Vec4(0,1,0,1) ); #if PRINT_SHADOW_TEXEL_TO_PIXEL_ERROR @@ -253,7 +253,7 @@ void MinimalShadowMap::ViewData::frameShadowCastingCamera frustum.setToUnitFrustum(); frustum.transform( osg::Matrix::inverse( mvp ), mvp ); - setDebugPolytope( "shadowCamFrustum", frustum, osg::Vec4(0,0,1,1) ); + setDebugPolytope( "shadowCamFrustum", frustum, osg::Vec4(0,0,1,1) ); } { @@ -270,7 +270,7 @@ void MinimalShadowMap::ViewData::frameShadowCastingCamera { dump( *filename ); filename->clear(); - } + } } } @@ -283,36 +283,36 @@ void MinimalShadowMap::ViewData::cullShadowReceivingScene( ) if( _cv->getComputeNearFarMode() ) { // Redo steps from CullVisitor::popProjectionMatrix() - // which clamps projection matrix when Camera & Projection + // which clamps projection matrix when Camera & Projection // completes traversal of their children - // We have to do this now manually - // because we did not complete camera traversal yet but + // We have to do this now manually + // because we did not complete camera traversal yet but // we need to know how this clamped projection matrix will be _cv->computeNearPlane(); - + osgUtil::CullVisitor::value_type n = _cv->getCalculatedNearPlane(); osgUtil::CullVisitor::value_type f = _cv->getCalculatedFarPlane(); if( n < f ) _cv->clampProjectionMatrix( _clampedProjection, n, f ); - } + } - // Aditionally clamp far plane if shadows don't need to be cast as - // far as main projection far plane + // Aditionally clamp far plane if shadows don't need to be cast as + // far as main projection far plane if( 0 < *_maxFarPlanePtr ) clampProjection( _clampedProjection, 0.f, *_maxFarPlanePtr ); - // Give derived classes chance to initialize _sceneReceivingShadowPolytope + // Give derived classes chance to initialize _sceneReceivingShadowPolytope osg::BoundingBox bb = computeShadowReceivingCoarseBounds( ); if( bb.valid() ) _sceneReceivingShadowPolytope.setToBoundingBox( bb ); - else + else _sceneReceivingShadowPolytope.clear(); - // Cut initial scene using main camera frustum. - // Cutting will work correctly on empty polytope too. + // Cut initial scene using main camera frustum. + // Cutting will work correctly on empty polytope too. // Take into consideration near far calculation and _maxFarPlane variable @@ -336,24 +336,24 @@ void MinimalShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv ) } void MinimalShadowMap::ViewData::cutScenePolytope - ( const osg::Matrix & transform, - const osg::Matrix & inverse, + ( const osg::Matrix & transform, + const osg::Matrix & inverse, const osg::BoundingBox & bb ) -{ +{ _sceneReceivingShadowPolytopePoints.clear(); if( bb.valid() ) { osg::Polytope polytope; polytope.setToBoundingBox( bb ); polytope.transformProvidingInverse( inverse ); - _sceneReceivingShadowPolytope.cut( polytope ); + _sceneReceivingShadowPolytope.cut( polytope ); _sceneReceivingShadowPolytope.getPoints ( _sceneReceivingShadowPolytopePoints ); } else _sceneReceivingShadowPolytope.clear(); } -osg::BoundingBox +osg::BoundingBox MinimalShadowMap::ViewData::computeScenePolytopeBounds( const osg::Matrix & m ) { osg::BoundingBox bb; @@ -361,7 +361,7 @@ osg::BoundingBox if( &m ) for( unsigned i = 0; i < _sceneReceivingShadowPolytopePoints.size(); ++i ) bb.expandBy( _sceneReceivingShadowPolytopePoints[i] * m ); - else + else for( unsigned i = 0; i < _sceneReceivingShadowPolytopePoints.size(); ++i ) bb.expandBy( _sceneReceivingShadowPolytopePoints[i] ); @@ -398,7 +398,7 @@ void MinimalShadowMap::ViewData::trimProjection #else if( !bb.valid() || !( trimMask & (1|2|4|8|16|32) ) ) return; double l, r, t, b, n, f; - bool ortho = projectionMatrix.getOrtho( l, r, b, t, n, f ); + bool ortho = projectionMatrix.getOrtho( l, r, b, t, n, f ); if( !ortho && !projectionMatrix.getFrustum( l, r, b, t, n, f ) ) return; // rotated or skewed or other crooked projection - give up @@ -409,7 +409,7 @@ void MinimalShadowMap::ViewData::trimProjection } osg::Matrix projectionToView = osg::Matrix::inverse( projectionMatrix ); - + osg::Vec3 min = osg::Vec3( bb._min[0], bb._min[1], bb._min[2] ) * projectionToView; @@ -452,9 +452,9 @@ void MinimalShadowMap::ViewData::trimProjection if( t < max[1] && ( trimMask & 8 ) ) t = max[1]; } - if( ortho ) + if( ortho ) projectionMatrix.makeOrtho( l, r, b, t, n, f ); - else + else projectionMatrix.makeFrustum( l, r, b, t, n, f ); #endif } @@ -479,24 +479,24 @@ void MinimalShadowMap::ViewData::clampProjection t *= new_near / n; } n = new_near; - } + } if( n < new_far && new_far < f ) { - f = new_far; + f = new_far; } if( perspective ) projection.makeFrustum( l, r, b, t, n, f ); else - projection.makeOrtho( l, r, b, t, n, f ); + projection.makeOrtho( l, r, b, t, n, f ); } } -// Imagine following scenario: +// Imagine following scenario: // We stand in the room and look through the window. // How should our view change if we were looking through larger window ? -// In other words how should projection be adjusted if -// window had grown by some margin ? +// In other words how should projection be adjusted if +// window had grown by some margin ? // Method computes such new projection which maintains perpective/world ratio void MinimalShadowMap::ViewData::extendProjection @@ -514,28 +514,28 @@ void MinimalShadowMap::ViewData::extendProjection } osg::Matrix window = viewport->computeWindowMatrix(); - - osg::Vec3 vMin( viewport->x() - margin.x(), - viewport->y() - margin.y(), + + osg::Vec3 vMin( viewport->x() - margin.x(), + viewport->y() - margin.y(), 0.0 ); - osg::Vec3 vMax( viewport->width() + margin.x() * 2 + vMin.x(), - viewport->height() + margin.y() * 2 + vMin.y(), + osg::Vec3 vMax( viewport->width() + margin.x() * 2 + vMin.x(), + viewport->height() + margin.y() * 2 + vMin.y(), 0.0 ); - + osg::Matrix inversePW = osg::Matrix::inverse( projection * window ); vMin = vMin * inversePW; vMax = vMax * inversePW; - - l = vMin.x(); + + l = vMin.x(); r = vMax.x(); - b = vMin.y(); + b = vMin.y(); t = vMax.y(); if( frustum ) projection.makeFrustum( l,r,b,t,n,f ); - else + else projection.makeOrtho( l,r,b,t,n,f ); } diff --git a/src/osgShadow/OccluderGeometry.cpp b/src/osgShadow/OccluderGeometry.cpp index 2cacf952b..0d14f6523 100644 --- a/src/osgShadow/OccluderGeometry.cpp +++ b/src/osgShadow/OccluderGeometry.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -33,7 +33,7 @@ OccluderGeometry::OccluderGeometry() OccluderGeometry::OccluderGeometry(const OccluderGeometry& oc, const osg::CopyOp& copyop): osg::Drawable(oc,copyop) { - + } @@ -53,30 +53,30 @@ public: void apply(osg::Node& node) { if (node.getStateSet()) pushState(node.getStateSet()); - + traverse(node); if (node.getStateSet()) popState(); } - + void apply(osg::Transform& transform) { if (transform.getStateSet()) pushState(transform.getStateSet()); - + osg::Matrix matrix; if (!_matrixStack.empty()) matrix = _matrixStack.back(); - + transform.computeLocalToWorldMatrix(matrix,this); - + pushMatrix(matrix); - + traverse(transform); - + popMatrix(); if (transform.getStateSet()) popState(); } - + void apply(osg::Geode& geode) { if (geode.getStateSet()) pushState(geode.getStateSet()); @@ -86,39 +86,39 @@ public: osg::Drawable* drawable = geode.getDrawable(i); if (drawable->getStateSet()) pushState(drawable->getStateSet()); - + apply(geode.getDrawable(i)); if (drawable->getStateSet()) popState(); } - + if (geode.getStateSet()) popState(); } - + void pushState(osg::StateSet* stateset) { osg::StateAttribute::GLModeValue prevBlendModeValue = _blendModeStack.empty() ? osg::StateAttribute::GLModeValue(osg::StateAttribute::INHERIT) : _blendModeStack.back(); osg::StateAttribute::GLModeValue newBlendModeValue = stateset->getMode(GL_BLEND); - - if (!(newBlendModeValue & osg::StateAttribute::PROTECTED) && + + if (!(newBlendModeValue & osg::StateAttribute::PROTECTED) && (prevBlendModeValue & osg::StateAttribute::OVERRIDE) ) { newBlendModeValue = prevBlendModeValue; } - + _blendModeStack.push_back(newBlendModeValue); } - + void popState() { _blendModeStack.pop_back(); } - + void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); } - + void popMatrix() { _matrixStack.pop_back(); @@ -132,22 +132,22 @@ public: // OSG_NOTICE<<"Ignoring transparent drawable."<processGeometry(drawable, (_matrixStack.empty() ? 0 : &_matrixStack.back()), _ratio); - + } - + protected: - + OccluderGeometry* _oc; - + typedef std::vector MatrixStack; typedef std::vector ModeStack; - + float _ratio; MatrixStack _matrixStack; ModeStack _blendModeStack; - + }; void OccluderGeometry::computeOccluderGeometry(osg::Node* subgraph, osg::Matrix* matrix, float sampleRatio) @@ -155,10 +155,10 @@ void OccluderGeometry::computeOccluderGeometry(osg::Node* subgraph, osg::Matrix* OSG_NOTICE<<"computeOccluderGeometry(osg::Node* subgraph, float sampleRatio)"<tick(); - + CollectOccludersVisitor cov(this, matrix, sampleRatio); subgraph->accept(cov); - + setUpInternalStructures(); osg::Timer_t endTick = osg::Timer::instance()->tick(); @@ -181,7 +181,7 @@ struct TriangleCollector typedef std::vector VertexPointers; VertexPointers _vertexPointers; - + OccluderGeometry::Vec3List _tempoaryTriangleVertices; TriangleCollector():_matrix(0) { } @@ -203,7 +203,7 @@ struct TriangleCollector _tempoaryTriangleVertices.push_back(v1); _tempoaryTriangleVertices.push_back(v2); _tempoaryTriangleVertices.push_back(v3); - + } else { @@ -214,15 +214,15 @@ struct TriangleCollector } } - + void copyToLocalData() { if ((_vertexPointers.size()+_tempoaryTriangleVertices.size())<3) return; - - + + const osg::Vec3* minVertex = _vertexPointers.empty() ? 0 : _vertexPointers.front(); const osg::Vec3* maxVertex = _vertexPointers.empty() ? 0 : _vertexPointers.front(); - + VertexPointers::iterator itr; for(itr = _vertexPointers.begin(); itr != _vertexPointers.end(); @@ -234,11 +234,11 @@ struct TriangleCollector unsigned int base = _vertices->size(); unsigned int numberNewVertices = _vertexPointers.empty() ? 0 : (maxVertex - minVertex) + 1; - + // OSG_NOTICE<<"base = "<normalize(); } - + } void OccluderGeometry::buildEdgeMaps() { // OSG_NOTICE<<"OccluderGeometry::buildEdgeMaps()"< EdgeSet; EdgeSet edgeSet; - + unsigned int numTriangleErrors = 0; unsigned int triNo=0; for(UIntList::iterator titr = _triangleIndices.begin(); @@ -561,11 +561,11 @@ void OccluderGeometry::buildEdgeMaps() GLuint p1 = *titr++; GLuint p2 = *titr++; GLuint p3 = *titr++; - + { Edge edge12(p1,p2); EdgeSet::iterator itr = edgeSet.find(edge12); - if (itr == edgeSet.end()) + if (itr == edgeSet.end()) { if (!edge12.addTriangle(triNo)) ++numTriangleErrors; edgeSet.insert(edge12); @@ -576,10 +576,10 @@ void OccluderGeometry::buildEdgeMaps() } } - { + { Edge edge23(p2,p3); EdgeSet::iterator itr = edgeSet.find(edge23); - if (itr == edgeSet.end()) + if (itr == edgeSet.end()) { if (!edge23.addTriangle(triNo)) ++numTriangleErrors; edgeSet.insert(edge23); @@ -589,14 +589,14 @@ void OccluderGeometry::buildEdgeMaps() if (!itr->addTriangle(triNo)) ++numTriangleErrors; } } - + { Edge edge31(p3,p1); EdgeSet::iterator itr = edgeSet.find(edge31); - if (itr == edgeSet.end()) + if (itr == edgeSet.end()) { if (!edge31.addTriangle(triNo)) ++numTriangleErrors; - + edgeSet.insert(edge31); } else @@ -608,11 +608,11 @@ void OccluderGeometry::buildEdgeMaps() _edges.clear(); _edges.reserve(edgeSet.size()); - + unsigned int numEdgesWithNoTriangles = 0; unsigned int numEdgesWithOneTriangles = 0; unsigned int numEdgesWithTwoTriangles = 0; - + for(EdgeSet::iterator eitr = edgeSet.begin(); eitr != edgeSet.end(); ++eitr) @@ -634,7 +634,7 @@ void OccluderGeometry::buildEdgeMaps() else if (p3 != edge._p1 && p3 != edge._p2) opposite = p3; pos = _vertices[opposite]; } - + if (edge._t2>=0) { ++numTriangles; @@ -655,17 +655,17 @@ void OccluderGeometry::buildEdgeMaps() ++numEdgesWithNoTriangles; edge._normal.set(0.0,0.0,0.0); OSG_NOTICE<<"Warning no triangles on edge."< 0.0) - { + { silhouetteIndices.push_back(edge._p1); silhouetteIndices.push_back(edge._p2); } @@ -714,7 +714,7 @@ void OccluderGeometry::computeLightDirectionSilhouetteEdges(const osg::Vec3& lig void OccluderGeometry::computeLightPositionSilhouetteEdges(const osg::Vec3& lightpos, UIntList& silhouetteIndices) const { silhouetteIndices.clear(); - + for(EdgeList::const_iterator eitr = _edges.begin(); eitr != _edges.end(); ++eitr) @@ -726,7 +726,7 @@ void OccluderGeometry::computeLightPositionSilhouetteEdges(const osg::Vec3& ligh const osg::Vec3& v2 = _vertices[edge._p2]; osg::Vec3 normal = (v2-v1) ^ (v1-lightpos); if (normal * edge._normal > 0.0) - { + { silhouetteIndices.push_back(edge._p1); silhouetteIndices.push_back(edge._p2); } @@ -764,9 +764,9 @@ void OccluderGeometry::computeShadowVolumeGeometry(const osg::Vec4& lightpos, Sh { // directional light. osg::Vec3 lightdirection( -lightpos.x(), -lightpos.y(), -lightpos.z()); - + // OSG_NOTICE<<"Directional light"<setUnits(units); stateset->setAttribute(polygon_offset.get(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); stateset->setMode(GL_POLYGON_OFFSET_FILL, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); - } + } ////////////////////////////////////////////////////////////////////////// @@ -746,7 +746,7 @@ const osg::Vec3d const_pointNearBL( -1.0, -1.0, -1.0); ////////////////////////////////////////////////////////////////////////// -void ParallelSplitShadowMap::calculateFrustumCorners(PSSMShadowSplitTexture &pssmShadowSplitTexture, osg::Vec3d *frustumCorners) +void ParallelSplitShadowMap::calculateFrustumCorners(PSSMShadowSplitTexture &pssmShadowSplitTexture, osg::Vec3d *frustumCorners) { // get user cameras double fovy,aspectRatio,camNear,camFar; @@ -775,7 +775,7 @@ void ParallelSplitShadowMap::calculateFrustumCorners(PSSMShadowSplitTexture &pss double maxFar = camFar; // double minNear = camNear; double camNearFar_Dist = maxFar - camNear; - if ( _SplitCalcMode == SPLIT_LINEAR ) + if ( _SplitCalcMode == SPLIT_LINEAR ) { camFar = camNear + (camNearFar_Dist) * ((double)(pssmShadowSplitTexture._splitID+1))/((double)(_number_of_splits)); camNear = camNear + (camNearFar_Dist) * ((double)(pssmShadowSplitTexture._splitID))/((double)(_number_of_splits)); @@ -790,7 +790,7 @@ void ParallelSplitShadowMap::calculateFrustumCorners(PSSMShadowSplitTexture &pss fSplitSchemeBias[1]=Clamp(fSplitSchemeBias[1],0.0,3.0); double* pSplitDistances =new double[_number_of_splits+1]; - for(int i=0;i<(int)_number_of_splits;i++) + for(int i=0;i<(int)_number_of_splits;i++) { double fIDM=(double)(i)/(double)(_number_of_splits); pSplitDistances[i]=camNearFar_Dist*(pow(fIDM,fSplitSchemeBias[1]+1))+camNear; @@ -839,7 +839,7 @@ void ParallelSplitShadowMap::calculateFrustumCorners(PSSMShadowSplitTexture &pss void ParallelSplitShadowMap::calculateLightInitialPosition(PSSMShadowSplitTexture &pssmShadowSplitTexture,osg::Vec3d *frustumCorners) { pssmShadowSplitTexture._frustumSplitCenter = frustumCorners[0]; - for(int i=1;i<8;i++) + for(int i=1;i<8;i++) { pssmShadowSplitTexture._frustumSplitCenter +=frustumCorners[i]; } diff --git a/src/osgShadow/ShadowMap.cpp b/src/osgShadow/ShadowMap.cpp index 2dd7c280f..1c559b1f9 100644 --- a/src/osgShadow/ShadowMap.cpp +++ b/src/osgShadow/ShadowMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -34,7 +34,7 @@ using namespace osgShadow; ////////////////////////////////////////////////////////////////// // fragment shader // -static const char fragmentShaderSource_noBaseTexture[] = +static const char fragmentShaderSource_noBaseTexture[] = "uniform sampler2DShadow osgShadow_shadowTexture; \n" "uniform vec2 osgShadow_ambientBias; \n" "\n" @@ -46,7 +46,7 @@ static const char fragmentShaderSource_noBaseTexture[] = ////////////////////////////////////////////////////////////////// // fragment shader // -static const char fragmentShaderSource_withBaseTexture[] = +static const char fragmentShaderSource_withBaseTexture[] = "uniform sampler2D osgShadow_baseTexture; \n" "uniform sampler2DShadow osgShadow_shadowTexture; \n" "uniform vec2 osgShadow_ambientBias; \n" @@ -216,7 +216,7 @@ void ShadowMap::init() #if 1 // cull front faces so that only backfaces contribute to depth map - + osg::ref_ptr cull_face = new osg::CullFace; cull_face->setMode(osg::CullFace::FRONT); @@ -251,7 +251,7 @@ void ShadowMap::init() } { - _stateset = new osg::StateSet; + _stateset = new osg::StateSet; _stateset->setTextureAttributeAndModes(_shadowTextureUnit,_texture.get(),osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); _stateset->setTextureMode(_shadowTextureUnit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON); _stateset->setTextureMode(_shadowTextureUnit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON); @@ -374,12 +374,12 @@ void ShadowMap::cull(osgUtil::CullVisitor& cv) selectLight = light; osg::RefMatrix* matrix = itr->second.get(); - if (matrix) + if (matrix) { lightpos = light->getPosition() * (*matrix); lightDir = osg::Matrix::transform3x3( light->getDirection(), *matrix ); } - else + else { lightpos = light->getPosition(); lightDir = light->getDirection(); @@ -391,7 +391,7 @@ void ShadowMap::cull(osgUtil::CullVisitor& cv) osg::Matrix eyeToWorld; eyeToWorld.invert(*cv.getModelViewMatrix()); - lightpos = lightpos * eyeToWorld; + lightpos = lightpos * eyeToWorld; lightDir = osg::Matrix::transform3x3( lightDir, eyeToWorld ); lightDir.normalize(); @@ -412,7 +412,7 @@ void ShadowMap::cull(osgUtil::CullVisitor& cv) } else { - // get the bounds of the model. + // get the bounds of the model. osg::ComputeBoundsVisitor cbbv(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); cbbv.setTraversalMask(getShadowedScene()->getCastsShadowTraversalMask()); @@ -463,7 +463,7 @@ void ShadowMap::cull(osgUtil::CullVisitor& cv) } - cv.setTraversalMask( traversalMask & + cv.setTraversalMask( traversalMask & getShadowedScene()->getCastsShadowTraversalMask() ); // do RTT camera traversal @@ -485,10 +485,10 @@ void ShadowMap::cull(osgUtil::CullVisitor& cv) cv.getRenderStage()->getPositionalStateContainer()-> addPositionedTextureAttribute( _shadowTextureUnit, refMatrix, _texgen.get() ); -#else +#else // compute the matrix which takes a vertex from local coords into tex coords // will use this later to specify osg::TexGen.. - osg::Matrix MVPT = _camera->getViewMatrix() * + osg::Matrix MVPT = _camera->getViewMatrix() * _camera->getProjectionMatrix() * osg::Matrix::translate(1.0,1.0,1.0) * osg::Matrix::scale(0.5f,0.5f,0.5f); @@ -512,15 +512,15 @@ void ShadowMap::cleanSceneGraph() //////////////////////////////////////////////////////////////////////////////// // Callback used by debugging hud to display Shadow Map in color buffer -// OSG does not allow to use the same GL Texture Id with different glTexParams. -// Callback simply turns shadow compare mode off via GL while rendering hud and -// restores it afterwards. +// OSG does not allow to use the same GL Texture Id with different glTexParams. +// Callback simply turns shadow compare mode off via GL while rendering hud and +// restores it afterwards. //////////////////////////////////////////////////////////////////////////////// -class ShadowMap::DrawableDrawWithDepthShadowComparisonOffCallback: +class ShadowMap::DrawableDrawWithDepthShadowComparisonOffCallback: public osg::Drawable::DrawCallback { public: - // + // DrawableDrawWithDepthShadowComparisonOffCallback ( osg::Texture2D * texture, unsigned stage = 0 ) : _texture( texture ), _stage( stage ) @@ -535,7 +535,7 @@ public: ri.getState()->applyTextureAttribute( _stage, _texture.get() ); // Turn off depth comparison mode - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE ); } @@ -543,7 +543,7 @@ public: if( _texture.valid() ) { // Turn it back on - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB ); } } @@ -564,7 +564,7 @@ osg::ref_ptr ShadowMap::makeDebugHUD() // set the projection matrix camera->setProjectionMatrix(osg::Matrix::ortho2D(0,size.x(),0,size.y())); - // set the view matrix + // set the view matrix camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera->setViewMatrix(osg::Matrix::identity()); @@ -582,7 +582,7 @@ osg::ref_ptr ShadowMap::makeDebugHUD() osg::Geode* geode = new osg::Geode; osg::Vec3 position(10.0f,size.y()-100.0f,0.0f); - osg::Vec3 delta(0.0f,-120.0f,0.0f); + osg::Vec3 delta(0.0f,-120.0f,0.0f); float length = 300.0f; // turn the text off to avoid linking with osgText diff --git a/src/osgShadow/ShadowTechnique.cpp b/src/osgShadow/ShadowTechnique.cpp index 4e73a7dc8..c2cff0556 100644 --- a/src/osgShadow/ShadowTechnique.cpp +++ b/src/osgShadow/ShadowTechnique.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -51,7 +51,7 @@ ShadowTechnique::~ShadowTechnique() void ShadowTechnique::init() { OSG_NOTICE<setTextureSize(tex_width, tex_height); _texture->setInternalFormat(GL_RGB); @@ -57,7 +57,7 @@ void ShadowTexture::init() _camera = new osg::Camera; _camera->setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); - + _camera->setCullCallback(new CameraCullCallback(this)); // set viewport @@ -81,20 +81,20 @@ void ShadowTexture::init() osg::StateSet* stateset = _camera->getOrCreateStateSet(); stateset->setAttribute(_material.get(),osg::StateAttribute::OVERRIDE); - + } - + { - _stateset = new osg::StateSet; + _stateset = new osg::StateSet; _stateset->setTextureAttributeAndModes(_textureUnit,_texture.get(),osg::StateAttribute::ON); _stateset->setTextureMode(_textureUnit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON); _stateset->setTextureMode(_textureUnit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON); _stateset->setTextureMode(_textureUnit,GL_TEXTURE_GEN_R,osg::StateAttribute::ON); _stateset->setTextureMode(_textureUnit,GL_TEXTURE_GEN_Q,osg::StateAttribute::ON); - + _texgen = new osg::TexGen; } - + _dirty = false; } @@ -113,7 +113,7 @@ void ShadowTexture::cull(osgUtil::CullVisitor& cv) // do traversal of shadow casting scene which does not need to be decorated by the shadow texture { - cv.setTraversalMask( traversalMask & + cv.setTraversalMask( traversalMask & getShadowedScene()->getCastsShadowTraversalMask() ); _shadowedScene->osg::Group::traverse(cv); @@ -122,16 +122,16 @@ void ShadowTexture::cull(osgUtil::CullVisitor& cv) // do traversal of shadow receiving scene which does need to be decorated by the shadow texture { cv.pushStateSet(_stateset.get()); - - cv.setTraversalMask( traversalMask & + + cv.setTraversalMask( traversalMask & getShadowedScene()->getReceivesShadowTraversalMask() ); _shadowedScene->osg::Group::traverse(cv); - + cv.popStateSet(); } - + // need to compute view frustum for RTT camera. // 1) get the light position // 2) get the center and extents of the view frustum @@ -154,23 +154,23 @@ void ShadowTexture::cull(osgUtil::CullVisitor& cv) selectLight = light; } } - + osg::Matrix eyeToWorld; eyeToWorld.invert(*cv.getModelViewMatrix()); - + lightpos = lightpos * eyeToWorld; if (selectLight) { - // get the bounds of the model. + // get the bounds of the model. osg::ComputeBoundsVisitor cbbv(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); cbbv.setTraversalMask(getShadowedScene()->getCastsShadowTraversalMask()); - + _shadowedScene->osg::Group::traverse(cbbv); - + osg::BoundingBox bb = cbbv.getBoundingBox(); - + if (lightpos[3]!=0.0) { osg::Vec3 position(lightpos.x(), lightpos.y(), lightpos.z()); @@ -188,15 +188,15 @@ void ShadowTexture::cull(osgUtil::CullVisitor& cv) _camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); _camera->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar); _camera->setViewMatrixAsLookAt(position,bb.center(),computeOrthogonalVector(bb.center()-position)); - + // compute the matrix which takes a vertex from local coords into tex coords // will use this later to specify osg::TexGen.. - osg::Matrix MVPT = _camera->getViewMatrix() * + osg::Matrix MVPT = _camera->getViewMatrix() * _camera->getProjectionMatrix() * osg::Matrix::translate(1.0,1.0,1.0) * osg::Matrix::scale(0.5f,0.5f,0.5f); - + _texgen->setMode(osg::TexGen::EYE_LINEAR); _texgen->setPlanesFromMatrix(MVPT); } @@ -222,21 +222,21 @@ void ShadowTexture::cull(osgUtil::CullVisitor& cv) _camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); _camera->setProjectionMatrixAsOrtho(-right, right, -top, top, znear, zfar); _camera->setViewMatrixAsLookAt(position,bb.center(),computeOrthogonalVector(lightDir)); - + // compute the matrix which takes a vertex from local coords into tex coords // will use this later to specify osg::TexGen.. - osg::Matrix MVPT = _camera->getViewMatrix() * + osg::Matrix MVPT = _camera->getViewMatrix() * _camera->getProjectionMatrix() * osg::Matrix::translate(1.0,1.0,1.0) * osg::Matrix::scale(0.5f,0.5f,0.5f); - + _texgen->setMode(osg::TexGen::EYE_LINEAR); _texgen->setPlanesFromMatrix(MVPT); } - cv.setTraversalMask( traversalMask & + cv.setTraversalMask( traversalMask & getShadowedScene()->getCastsShadowTraversalMask() ); // do RTT camera traversal @@ -244,9 +244,9 @@ void ShadowTexture::cull(osgUtil::CullVisitor& cv) orig_rs->getPositionalStateContainer()->addPositionedTextureAttribute(_textureUnit, cv.getModelViewMatrix(), _texgen.get()); } - - - + + + // reapply the original traversal mask diff --git a/src/osgShadow/ShadowVolume.cpp b/src/osgShadow/ShadowVolume.cpp index 569e5bce5..931a2fd2b 100644 --- a/src/osgShadow/ShadowVolume.cpp +++ b/src/osgShadow/ShadowVolume.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -38,7 +38,7 @@ ShadowVolume::ShadowVolume(): _dynamicShadowVolumes(false) { // _drawMode = osgShadow::ShadowVolumeGeometry::GEOMETRY; - + OSG_INFO<<"Warning: osgShadow::ShadowVolume technique is still in development, with current limitations that make it unsuitable for deployment. Please contact the osg-users for an update of developements."<osg::Group::traverse(cbbv); @@ -117,7 +117,7 @@ void ShadowVolume::init() ss_sv1->setRenderBinDetails(shadowVolumeBin, "RenderBin"); geode->addDrawable(_shadowVolume.get()); } - + { // first group, render the depth buffer + ambient light contribution @@ -132,7 +132,7 @@ void ShadowVolume::init() _ambientLight->setAmbient(ambient); _ambientLight->setDiffuse(zero_colour); _ss1->setAttributeAndModes(_ambientLight.get(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); - + _ss1->setMode(GL_LIGHTING, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); } @@ -148,7 +148,7 @@ void ShadowVolume::init() { _shadowVolumeStateSet = new osg::StateSet; - + osg::Depth* depth = new osg::Depth; depth->setWriteMask(false); depth->setFunction(osg::Depth::LEQUAL); @@ -227,7 +227,7 @@ void ShadowVolume::init() _shadowedSceneStateSet->setThreadSafeRefUnref(true); } - + _dirty = false; } @@ -263,7 +263,7 @@ void ShadowVolume::cull(osgUtil::CullVisitor& cv) } if (shadowVolumeBin.valid()) - { + { original_bin->setStateSet(_ss1.get()); osgUtil::RenderStage* orig_rs = cv.getRenderStage(); @@ -276,9 +276,9 @@ void ShadowVolume::cull(osgUtil::CullVisitor& cv) new_rs->setDrawBuffer(orig_rs->getDrawBuffer(), orig_rs->getDrawBufferApplyMask()); new_rs->setReadBuffer(orig_rs->getReadBuffer(), orig_rs->getReadBufferApplyMask()); new_rs->setColorMask(orig_rs->getColorMask()); - + osg::Vec4 lightpos; - + osg::ref_ptr ps = new osgUtil::PositionalStateContainer; new_rs->setPositionalStateContainer(ps.get()); @@ -295,24 +295,24 @@ void ShadowVolume::cull(osgUtil::CullVisitor& cv) osg::RefMatrix* matrix = itr->second.get(); if (matrix) lightpos = light->getPosition() * (*matrix); else lightpos = light->getPosition(); - + selectLight = light; } else { - ps->addPositionedAttribute(itr->second.get(), itr->first.get()); + ps->addPositionedAttribute(itr->second.get(), itr->first.get()); } } - + _ambientLight->setPosition(lightpos); orig_rs->addPositionedAttribute(0,_ambientLight.get()); - + _diffuseLight->setPosition(lightpos); if (selectLight) { _ambientLight->setAmbient(selectLight->getAmbient()); - + _diffuseLight->setDiffuse(selectLight->getDiffuse()); _diffuseLight->setSpecular(selectLight->getSpecular()); _diffuseLight->setDirection(selectLight->getDirection()); @@ -323,17 +323,17 @@ void ShadowVolume::cull(osgUtil::CullVisitor& cv) _diffuseLight->setSpotCutoff(selectLight->getSpotCutoff()); } ps->addPositionedAttribute(0, _diffuseLight.get()); - + if (_lightpos != lightpos && _dynamicShadowVolumes) { _lightpos = lightpos; osg::Matrix eyeToWorld; eyeToWorld.invert(*cv.getModelViewMatrix()); - + _occluder->computeShadowVolumeGeometry(lightpos * eyeToWorld, *_shadowVolume); } - + if (shadowVolumeBin.valid()) { // new_rs->setStateSet(_mainShadowStateSet.get()); @@ -346,7 +346,7 @@ void ShadowVolume::cull(osgUtil::CullVisitor& cv) } } - + } void ShadowVolume::cleanSceneGraph() diff --git a/src/osgShadow/ShadowedScene.cpp b/src/osgShadow/ShadowedScene.cpp index 43510e210..36234c055 100644 --- a/src/osgShadow/ShadowedScene.cpp +++ b/src/osgShadow/ShadowedScene.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -23,10 +23,10 @@ using namespace osgShadow; ShadowedScene::ShadowedScene(ShadowTechnique* st): _receivesShadowTraversalMask(0xffffffff), - _castsShadowTraversalMask(0xffffffff) + _castsShadowTraversalMask(0xffffffff) { setNumChildrenRequiringUpdateTraversal(1); - + setShadowSettings(new ShadowSettings); if (st) setShadowTechnique(st); @@ -38,7 +38,7 @@ ShadowedScene::ShadowedScene(const ShadowedScene& ss, const osg::CopyOp& copyop) _castsShadowTraversalMask(ss._castsShadowTraversalMask) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); - + if (ss._shadowTechnique.valid()) { setShadowTechnique( dynamic_cast(ss._shadowTechnique->clone(copyop)) ); @@ -52,7 +52,7 @@ ShadowedScene::ShadowedScene(const ShadowedScene& ss, const osg::CopyOp& copyop) { setShadowSettings(new ShadowSettings); } - + } ShadowedScene::~ShadowedScene() @@ -80,15 +80,15 @@ void ShadowedScene::setShadowSettings(ShadowSettings* ss) void ShadowedScene::setShadowTechnique(ShadowTechnique* technique) { if (_shadowTechnique == technique) return; - - if (_shadowTechnique.valid()) + + if (_shadowTechnique.valid()) { _shadowTechnique->cleanSceneGraph(); _shadowTechnique->_shadowedScene = 0; } - + _shadowTechnique = technique; - + if (_shadowTechnique.valid()) { _shadowTechnique->_shadowedScene = this; @@ -98,7 +98,7 @@ void ShadowedScene::setShadowTechnique(ShadowTechnique* technique) void ShadowedScene::cleanSceneGraph() { - if (_shadowTechnique.valid()) + if (_shadowTechnique.valid()) { _shadowTechnique->cleanSceneGraph(); } diff --git a/src/osgShadow/StandardShadowMap.cpp b/src/osgShadow/StandardShadowMap.cpp index 9fe360760..67af42549 100644 --- a/src/osgShadow/StandardShadowMap.cpp +++ b/src/osgShadow/StandardShadowMap.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -33,7 +33,7 @@ using namespace osgShadow; StandardShadowMap::StandardShadowMap(): - BaseClass(), + BaseClass(), _polygonOffsetFactor( 1.1f ), _polygonOffsetUnits( 4.0f ), _textureSize( 1024, 1024 ), @@ -42,7 +42,7 @@ StandardShadowMap::StandardShadowMap(): _baseTextureCoordIndex( 0 ), _shadowTextureCoordIndex( 1 ) -{ +{ #if FRAGMENT_SHADERS_ONLY _mainFragmentShader = new osg::Shader( osg::Shader::FRAGMENT, " // following expressions are auto modified - do not change them: \n" @@ -69,7 +69,7 @@ StandardShadowMap::StandardShadowMap(): // " float fog = clamp((gl_Fog.end - gl_FogFragCoord)*gl_Fog.scale, 0.,1.);\n" // " color.rgb = mix( gl_Fog.color.rgb, color.rgb, fog ); \n" " gl_FragColor = color; \n" - "} \n" ); + "} \n" ); _shadowFragmentShader = new osg::Shader( osg::Shader::FRAGMENT, " // following expressions are auto modified - do not change them: \n" @@ -81,8 +81,8 @@ StandardShadowMap::StandardShadowMap(): "{ \n" " return shadow2DProj( shadowTexture, gl_TexCoord[1] ).r; \n" "} \n" ); - - + + _shadowVertexShader = NULL; _mainVertexShader = NULL; @@ -111,9 +111,9 @@ StandardShadowMap::StandardShadowMap(): // " float fog = clamp((gl_Fog.end - gl_FogFragCoord)*gl_Fog.scale, 0.,1.);\n" // " color.rgb = mix( gl_Fog.color.rgb, color.rgb, fog ); \n" " gl_FragColor = color; \n" - "} \n" ); - - + "} \n" ); + + _shadowFragmentShader = new osg::Shader( osg::Shader::FRAGMENT, " // following expressions are auto modified - do not change them: \n" " // gl_TexCoord[1] 1 - can be subsituted with other index \n" @@ -125,8 +125,8 @@ StandardShadowMap::StandardShadowMap(): " return shadow2DProj( shadowTexture, gl_TexCoord[1] ).r; \n" "} \n" ); - - + + _shadowVertexShader = new osg::Shader( osg::Shader::VERTEX, " // following expressions are auto modified - do not change them: \n" " // gl_TexCoord[1] 1 - can be subsituted with other index \n" @@ -143,7 +143,7 @@ StandardShadowMap::StandardShadowMap(): " gl_TexCoord[1].p = dot( ecPosition, gl_EyePlaneR[1] ); \n" " gl_TexCoord[1].q = dot( ecPosition, gl_EyePlaneQ[1] ); \n" "} \n" ); - + _mainVertexShader = new osg::Shader( osg::Shader::VERTEX, " // following expressions are auto modified - do not change them: \n" " // gl_TexCoord[0] 0 - can be subsituted with other index \n" @@ -236,7 +236,7 @@ StandardShadowMap::StandardShadowMap(): " // Compute distance between surface and light position \n" " d = length(VP); \n" " \n" - " // Normalize the vector from surface to light position \n" + " // Normalize the vector from surface to light position \n" " VP = normalize(VP); \n" " \n" " // Compute attenuation \n" @@ -360,10 +360,10 @@ StandardShadowMap::StandardShadowMap(const StandardShadowMap& copy, const osg::C ( copy._shadowFragmentShader->clone(copyop) ); } -StandardShadowMap::~StandardShadowMap(void) -{ - -} +StandardShadowMap::~StandardShadowMap(void) +{ + +} void StandardShadowMap::updateTextureCoordIndices( unsigned int fromTextureCoordIndex, unsigned int toTextureCoordIndex ) { @@ -386,7 +386,7 @@ void StandardShadowMap::updateTextureCoordIndices( unsigned int fromTextureCoord { char acFrom[ 32 ], acTo[32]; - // its not elegant to mix stdio & stl strings + // its not elegant to mix stdio & stl strings // but in this context I do an exception for cleaner code sprintf( acFrom, "%s%d%s", expressions[i], fromTextureCoordIndex, expressions[i+1]); @@ -412,7 +412,7 @@ void StandardShadowMap::searchAndReplaceShaderSource std::string destString; std::string::size_type fromLength = fromString.length(); - std::string::size_type srceLength = srceString.length(); + std::string::size_type srceLength = srceString.length(); for( std::string::size_type pos = 0; pos < srceLength; ) { @@ -422,7 +422,7 @@ void StandardShadowMap::searchAndReplaceShaderSource end = srceLength; destString.append( srceString, pos, end - pos ); - + if( end == srceLength ) break; @@ -435,12 +435,12 @@ void StandardShadowMap::searchAndReplaceShaderSource void StandardShadowMap::ViewData::cull() { - // step 1: - // cull shadowed scene ie put into render bins and states into stage graphs + // step 1: + // cull shadowed scene ie put into render bins and states into stage graphs cullShadowReceivingScene( ); // step 2: - // find the light casting our shadows + // find the light casting our shadows osg::Vec4 lightPos; osg::Vec3 lightDir; osg::Vec3 lightUp( 0,0,0 ); // force computing most approprate dir @@ -454,11 +454,11 @@ void StandardShadowMap::ViewData::cull() aimShadowCastingCamera( light, lightPos, lightDir, lightUp ); // step 4: - // cull scene casting shadow and generate render + // cull scene casting shadow and generate render cullShadowCastingScene( ); // step 5: - // setup texgen generating shadow map coords for the shadow receiving scene + // setup texgen generating shadow map coords for the shadow receiving scene addShadowReceivingTexGen( ); BaseClass::ViewData::cull(); @@ -487,13 +487,13 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv texture->setBorderColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); _texture = texture; } - + _camera = new osg::Camera; - { // Setup shadow map camera + { // Setup shadow map camera _camera->setName( "ShadowCamera" ); #if 0 // Absolute reference frame INHERIT_VIEWPOINT works better than this _camera->setCullingMode - ( _camera->getCullingMode() & ~osg::CullSettings::SMALL_FEATURE_CULLING ); + ( _camera->getCullingMode() & ~osg::CullSettings::SMALL_FEATURE_CULLING ); #endif _camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF_INHERIT_VIEWPOINT); _camera->setCullCallback(new CameraCullCallback( st )); @@ -503,10 +503,10 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv _camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); _camera->setClearColor( osg::Vec4(1.0f,1.0f,1.0f,1.0f) ); #endif - _camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); + _camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); _camera->setViewport(0,0, st->_textureSize.x(), st->_textureSize.y() ); - _camera->setRenderOrder(osg::Camera::PRE_RENDER); - _camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); + _camera->setRenderOrder(osg::Camera::PRE_RENDER); + _camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); _camera->attach(osg::Camera::DEPTH_BUFFER, _texture.get()); } @@ -517,13 +517,13 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv osg::Image * image = new osg::Image; image->allocateImage( 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE ); *(osg::Vec4ub*)image->data() = osg::Vec4ub( 0xFF, 0xFF, 0xFF, 0xFF ); - + osg::Texture2D* fakeTex = new osg::Texture2D( image ); fakeTex->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT); fakeTex->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT); fakeTex->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST); fakeTex->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST); - + _stateset->setTextureAttribute(st->_baseTextureUnit,fakeTex,osg::StateAttribute::ON); _stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_2D,osg::StateAttribute::ON); _stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_3D,osg::StateAttribute::OFF); @@ -532,7 +532,7 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv #endif } - { // Add shadow texture + { // Add shadow texture _stateset->setTextureAttributeAndModes(st->_shadowTextureUnit,_texture.get(),osg::StateAttribute::ON); _stateset->setTextureMode(st->_shadowTextureUnit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON); _stateset->setTextureMode(st->_shadowTextureUnit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON); @@ -540,7 +540,7 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv _stateset->setTextureMode(st->_shadowTextureUnit,GL_TEXTURE_GEN_Q,osg::StateAttribute::ON); } - { // Setup shaders used in shadow casting + { // Setup shaders used in shadow casting osg::Program * program = new osg::Program(); _stateset->setAttribute( program ); @@ -564,8 +564,8 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv { // Setup states used for shadow map generation osg::StateSet * stateset = _camera->getOrCreateStateSet(); - - stateset->setAttribute( + + stateset->setAttribute( new osg::PolygonOffset( st->_polygonOffsetFactor, st->_polygonOffsetUnits ), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE ); @@ -573,7 +573,7 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE ); // agressive optimization - stateset->setRenderBinDetails( 0, "RenderBin", + stateset->setRenderBinDetails( 0, "RenderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS ); // Assure that AlphaTest/AlphaRef works when redirecting all drawables to single bin. @@ -588,22 +588,22 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE ); // note soft (attribute only no mode override) setting. When this works ? - // 1. for objects prepared for backface culling + // 1. for objects prepared for backface culling // because they usually also set CullFace and CullMode on in their state // For them we override CullFace but CullMode remains set by them - // 2. For one faced, trees, and similar objects which cannot use + // 2. For one faced, trees, and similar objects which cannot use // backface nor front face so they usually use CullMode off set here. // In this case we will draw them in their entirety. stateset->setAttribute( new osg::CullFace( osg::CullFace::FRONT ), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE ); - // make sure GL_CULL_FACE is off by default - // we assume that if object has cull face attribute set to back + // make sure GL_CULL_FACE is off by default + // we assume that if object has cull face attribute set to back // it will also set cull face mode ON so no need for override stateset->setMode( GL_CULL_FACE, osg::StateAttribute::OFF ); - // optimization attributes + // optimization attributes osg::Program* program = new osg::Program; stateset->setAttribute( program, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON ); stateset->setMode @@ -648,7 +648,7 @@ const osg::Light* StandardShadowMap::ViewData::selectLight //MR testing giving a specific light osgUtil::RenderStage * rs = _cv->getRenderStage(); - osgUtil::PositionalStateContainer::AttrMatrixList& aml = + osgUtil::PositionalStateContainer::AttrMatrixList& aml = rs->getPositionalStateContainer()->getAttrMatrixList(); osg::RefMatrix* matrix = 0; @@ -677,8 +677,8 @@ const osg::Light* StandardShadowMap::ViewData::selectLight if( lightPos[3] == 0 ) lightDir.set( -lightPos[0], -lightPos[1], -lightPos[2] ); - else - lightDir = light->getDirection(); + else + lightDir = light->getDirection(); lightPos = lightPos * localToWorld; lightDir = osg::Matrix::transform3x3( lightDir, localToWorld ); @@ -690,11 +690,11 @@ const osg::Light* StandardShadowMap::ViewData::selectLight void StandardShadowMap::ViewData::aimShadowCastingCamera( const osg::Light *light, const osg::Vec4 &lightPos, - const osg::Vec3 &lightDir, + const osg::Vec3 &lightDir, const osg::Vec3 &lightUp /* by default = osg::Vec3( 0, 1 0 )*/ ) { -#if 0 // less precise but faster +#if 0 // less precise but faster osg::BoundingSphere bs =_st->getShadowedScene()->getBound(); #else // get the bounds of the model. @@ -708,12 +708,12 @@ void StandardShadowMap::ViewData::aimShadowCastingCamera( const osg::Light *ligh ( bs, light, lightPos, lightDir, lightUp ); } -void StandardShadowMap::ViewData::aimShadowCastingCamera( +void StandardShadowMap::ViewData::aimShadowCastingCamera( const osg::BoundingSphere &bs, const osg::Light *light, const osg::Vec4 &lightPos, - const osg::Vec3 &lightDir, - const osg::Vec3 &lightUpVector + const osg::Vec3 &lightDir, + const osg::Vec3 &lightUpVector /* by default = osg::Vec3( 0, 1 0 )*/ ) { osg::Matrixd & view = _camera->getViewMatrix(); @@ -729,12 +729,12 @@ void StandardShadowMap::ViewData::aimShadowCastingCamera( // set the position far away along the light direction position = bs.center() - lightDir * bs.radius() * 2; } - + float centerDistance = (position-bs.center()).length(); float znear = centerDistance-bs.radius(); float zfar = centerDistance+bs.radius(); float zNearRatio = 0.001f; - if (znearpushStateSet( _stateset.get() ); - _st->getShadowedScene()->osg::Group::traverse( *_cv ); + _st->getShadowedScene()->osg::Group::traverse( *_cv ); _cv->popStateSet(); } void StandardShadowMap::ViewData::cullShadowCastingScene( ) -{ +{ // record the traversal mask on entry so we can reapply it later. unsigned int traversalMask = _cv->getTraversalMask(); - _cv->setTraversalMask( traversalMask & + _cv->setTraversalMask( traversalMask & _st->getShadowedScene()->getCastsShadowTraversalMask() ); // do RTT camera traversal @@ -785,7 +785,7 @@ void StandardShadowMap::ViewData::cullShadowCastingScene( ) } void StandardShadowMap::ViewData::addShadowReceivingTexGen( ) -{ +{ _texgen->setMode(osg::TexGen::EYE_LINEAR); // compute the matrix which takes a vertex from view coords into tex coords diff --git a/src/osgShadow/Version.cpp b/src/osgShadow/Version.cpp index df291760e..422634983 100644 --- a/src/osgShadow/Version.cpp +++ b/src/osgShadow/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgShadow/ViewDependentShadowMap.cpp b/src/osgShadow/ViewDependentShadowMap.cpp index 93df2c68c..62ba3c956 100644 --- a/src/osgShadow/ViewDependentShadowMap.cpp +++ b/src/osgShadow/ViewDependentShadowMap.cpp @@ -176,7 +176,7 @@ void VDSMCameraCullCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) if (!_polytope.empty()) { OSG_INFO<<"Pushing custom Polytope"<getProjectionCullingStack().back(); cs.setFrustum(_polytope); @@ -199,7 +199,7 @@ void VDSMCameraCullCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) _renderStage = cv->getCurrentRenderBin()->getStage(); OSG_INFO<<"VDSM second : _renderStage = "<<_renderStage<getComputeNearFarMode() != osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR) { // make sure that the near plane is computed correctly. @@ -255,16 +255,16 @@ public: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) { setCullingMode(osg::CullSettings::VIEW_FRUSTUM_CULLING); - + pushViewport(viewport); pushProjectionMatrix(new osg::RefMatrix(projectionMatrix)); pushModelViewMatrix(new osg::RefMatrix(viewMatrix),osg::Transform::ABSOLUTE_RF); } - + void apply(osg::Node& node) { if (isCulled(node)) return; - + // push the culling mode. pushCurrentMask(); @@ -304,7 +304,7 @@ public: // projection nodes won't affect a shadow map so their subgraphs should be ignored return; } - + void apply(osg::Transform& transform) { if (isCulled(transform)) return; @@ -323,10 +323,10 @@ public: popModelViewMatrix(); } - + // pop the culling mode. popCurrentMask(); - + } void apply(osg::Camera&) @@ -338,7 +338,7 @@ public: void updateBound(const osg::BoundingBox& bb) { if (!bb.valid()) return; - + const osg::Matrix& matrix = *getModelViewMatrix() * *getProjectionMatrix(); update(bb.corner(0) * matrix); @@ -369,7 +369,7 @@ public: osg::BoundingBox _bb; }; - + /////////////////////////////////////////////////////////////////////////////////////////////// // // LightData @@ -431,7 +431,7 @@ ViewDependentShadowMap::ShadowData::ShadowData(ViewDependentShadowMap::ViewDepen { const ShadowSettings* settings = vdd->getViewDependentShadowMap()->getShadowedScene()->getShadowSettings(); - + bool debug = settings->getDebugDraw(); // set up texgen @@ -442,7 +442,7 @@ ViewDependentShadowMap::ShadowData::ShadowData(ViewDependentShadowMap::ViewDepen osg::Vec2s textureSize = debug ? osg::Vec2s(512,512) : settings->getTextureSize(); _texture->setTextureSize(textureSize.x(), textureSize.y()); - + if (debug) { _texture->setInternalFormat(GL_RGB); @@ -453,7 +453,7 @@ ViewDependentShadowMap::ShadowData::ShadowData(ViewDependentShadowMap::ViewDepen _texture->setShadowComparison(true); _texture->setShadowTextureMode(osg::Texture2D::LUMINANCE); } - + _texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); _texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); @@ -462,7 +462,7 @@ ViewDependentShadowMap::ShadowData::ShadowData(ViewDependentShadowMap::ViewDepen _texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER); _texture->setBorderColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); //_texture->setBorderColor(osg::Vec4(0.0f,0.0f,0.0f,0.0f)); - + // set up the camera _camera = new osg::Camera; _camera->setName("ShadowCamera"); @@ -476,7 +476,7 @@ ViewDependentShadowMap::ShadowData::ShadowData(ViewDependentShadowMap::ViewDepen // switch off small feature culling as this can cull out geometry that will still be large enough once perspective correction takes effect. _camera->setCullingMode(_camera->getCullingMode() & ~osg::CullSettings::SMALL_FEATURE_CULLING); - + // set viewport _camera->setViewport(0,0,textureSize.x(),textureSize.y()); @@ -497,17 +497,17 @@ ViewDependentShadowMap::ShadowData::ShadowData(ViewDependentShadowMap::ViewDepen { // clear the depth and colour bufferson each clear. _camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - + // set the camera to render before the main camera. _camera->setRenderOrder(osg::Camera::PRE_RENDER); - + // tell the camera to use OpenGL frame buffer object where supported. _camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. _camera->attach(osg::Camera::DEPTH_BUFFER, _texture.get()); //_camera->attach(osg::Camera::COLOR_BUFFER, _texture.get()); - } + } } void ViewDependentShadowMap::ShadowData::releaseGLObjects(osg::State* state) const @@ -541,7 +541,7 @@ ViewDependentShadowMap::Frustum::Frustum(osgUtil::CullVisitor* cv, double minZNe OSG_INFO<<"zNear = "<getShadowSettings(); - + unsigned int pos_x = 0; unsigned int textureUnit = settings->getBaseShadowTextureUnit(); unsigned int numValidShadows = 0; @@ -860,7 +860,7 @@ void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv) if (/*numShadowMapsPerLight>1 &&*/ _shadowedScene->getCastsShadowTraversalMask()!=0xffffffff) { // osg::ElapsedTime timer; - + osg::ref_ptr viewport = new osg::Viewport(0,0,2048,2048); ComputeLightSpaceBounds clsb(viewport.get(), projectionMatrix, viewMatrix); clsb.setTraversalMask(_shadowedScene->getCastsShadowTraversalMask()); @@ -895,29 +895,29 @@ void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv) // OSG_NOTICE<<" xMid="<0) { - decoratorStateGraph->setStateSet(selectStateSetForRenderingShadow(*vdd)); + decoratorStateGraph->setStateSet(selectStateSetForRenderingShadow(*vdd)); } - + // OSG_NOTICE<<"End of shadow setup Projection matrix "<<*cv.getProjectionMatrix()<getLightDataList(); - + LightDataList previous_ldl; previous_ldl.swap(pll); @@ -1109,13 +1109,13 @@ bool ViewDependentShadowMap::selectActiveLights(osgUtil::CullVisitor* cv, ViewDe OSG_INFO<<"selectActiveLights osgUtil::RenderStage="<getModelViewMatrix()); - + osgUtil::PositionalStateContainer::AttrMatrixList& aml = rs->getPositionalStateContainer()->getAttrMatrixList(); const ShadowSettings* settings = getShadowedScene()->getShadowSettings(); - + for(osgUtil::PositionalStateContainer::AttrMatrixList::reverse_iterator itr = aml.rbegin(); itr != aml.rend(); ++itr) @@ -1125,7 +1125,7 @@ bool ViewDependentShadowMap::selectActiveLights(osgUtil::CullVisitor* cv, ViewDe { // is LightNum matched to that defined in settings if (settings && settings->getLightNum()>=0 && light->getLightNum()!=settings->getLightNum()) continue; - + LightDataList::iterator pll_itr = pll.begin(); for(; pll_itr != pll.end(); ++pll_itr) { @@ -1142,10 +1142,10 @@ bool ViewDependentShadowMap::selectActiveLights(osgUtil::CullVisitor* cv, ViewDe else { OSG_INFO<<"Light num "<getLightNum()<<" already used, ignore light"<getShadowSettings(); - + if (!settings->getDebugDraw()) { // note soft (attribute only no mode override) setting. When this works ? @@ -1177,7 +1177,7 @@ void ViewDependentShadowMap::createShaders() // it will also set cull face mode ON so no need for override _shadowCastingStateSet->setMode( GL_CULL_FACE, osg::StateAttribute::OFF ); } - + #if 1 float factor = 1.1; float units = 4.0; @@ -1189,7 +1189,7 @@ void ViewDependentShadowMap::createShaders() _shadowCastingStateSet->setAttribute(_polygonOffset.get(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); _shadowCastingStateSet->setMode(GL_POLYGON_OFFSET_FILL, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); - + _uniforms.clear(); osg::ref_ptr baseTextureSampler = new osg::Uniform("baseTexture",(int)_baseTextureUnit); _uniforms.push_back(baseTextureSampler.get()); @@ -1235,7 +1235,7 @@ void ViewDependentShadowMap::createShaders() { _program->addShader(new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource_withBaseTexture)); } - + break; } } @@ -1386,7 +1386,7 @@ bool ViewDependentShadowMap::computeShadowCameraSettings(Frustum& frustum, Light osg::Vec3d lightSide; const ShadowSettings* settings = getShadowedScene()->getShadowSettings(); - + double dotProduct_v = positionedLight.lightDir * frustum.frustumCenterLine; double gamma_v = acos(dotProduct_v); if (gamma_vgetPerspectiveShadowMapCutOffAngle()) || gamma_v>osg::DegreesToRadians(180.0-settings->getPerspectiveShadowMapCutOffAngle())) @@ -1410,7 +1410,7 @@ bool ViewDependentShadowMap::computeShadowCameraSettings(Frustum& frustum, Light OSG_NOTICE<<"lightUp="<getTraversalMask(); @@ -2321,7 +2321,7 @@ void ViewDependentShadowMap::cullShadowReceivingScene(osgUtil::CullVisitor* cv) void ViewDependentShadowMap::cullShadowCastingScene(osgUtil::CullVisitor* cv, osg::Camera* camera) const { OSG_INFO<<"cullShadowCastingScene()"<getTraversalMask(); @@ -2339,9 +2339,9 @@ osg::StateSet* ViewDependentShadowMap::selectStateSetForRenderingShadow(ViewDepe OSG_INFO<<" selectStateSetForRenderingShadow() "< stateset = vdd.getStateSet(); - + vdd.getStateSet()->clear(); - + vdd.getStateSet()->setTextureAttributeAndModes(0, _fallbackBaseTexture.get(), osg::StateAttribute::ON); for(Uniforms::const_iterator itr=_uniforms.begin(); @@ -2402,7 +2402,7 @@ osg::StateSet* ViewDependentShadowMap::selectStateSetForRenderingShadow(ViewDepe stateset->setTextureMode(sd._textureUnit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON); stateset->setTextureMode(sd._textureUnit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON); stateset->setTextureMode(sd._textureUnit,GL_TEXTURE_GEN_R,osg::StateAttribute::ON); - stateset->setTextureMode(sd._textureUnit,GL_TEXTURE_GEN_Q,osg::StateAttribute::ON); + stateset->setTextureMode(sd._textureUnit,GL_TEXTURE_GEN_Q,osg::StateAttribute::ON); } return vdd.getStateSet(); @@ -2410,7 +2410,7 @@ osg::StateSet* ViewDependentShadowMap::selectStateSetForRenderingShadow(ViewDepe void ViewDependentShadowMap::resizeGLObjectBuffers(unsigned int maxSize) { - // the way that ViewDependentData is mapped shouldn't + // the way that ViewDependentData is mapped shouldn't } void ViewDependentShadowMap::releaseGLObjects(osg::State* state) const diff --git a/src/osgShadow/ViewDependentShadowTechnique.cpp b/src/osgShadow/ViewDependentShadowTechnique.cpp index cbf1afc47..50ed8f3a7 100644 --- a/src/osgShadow/ViewDependentShadowTechnique.cpp +++ b/src/osgShadow/ViewDependentShadowTechnique.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. * * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski @@ -43,10 +43,10 @@ void ViewDependentShadowTechnique::traverse(osg::NodeVisitor& nv) } void ViewDependentShadowTechnique::dirty() -{ +{ OpenThreads::ScopedLock lock(_viewDataMapMutex); - osgShadow::ShadowTechnique::_dirty = true; + osgShadow::ShadowTechnique::_dirty = true; for( ViewDataMap::iterator mitr = _viewDataMap.begin(); mitr != _viewDataMap.end(); @@ -67,11 +67,11 @@ void ViewDependentShadowTechnique::update(osg::NodeVisitor& nv) //osgShadow::ShadowTechnique::update( nv ); osgShadow::ShadowTechnique::_shadowedScene->osg::Group::traverse(nv); } - + void ViewDependentShadowTechnique::cull(osgUtil::CullVisitor& cv) { //osgShadow::ShadowTechnique::cull( cv ); - + ViewData * vd = getViewDependentData( &cv ); if ( !vd || vd->_dirty || vd->_cv != &cv || vd->_st != this ) { @@ -86,28 +86,28 @@ void ViewDependentShadowTechnique::cull(osgUtil::CullVisitor& cv) osgShadow::ShadowTechnique::_shadowedScene->osg::Group::traverse(cv); } } - + void ViewDependentShadowTechnique::cleanSceneGraph() -{ +{ //osgShadow::ShadowTechnique::cleanSceneGraph( ); } ViewDependentShadowTechnique::ViewData * ViewDependentShadowTechnique::getViewDependentData( osgUtil::CullVisitor * cv ) -{ +{ OpenThreads::ScopedLock lock(_viewDataMapMutex); return _viewDataMap[ cv ].get(); } void ViewDependentShadowTechnique::setViewDependentData ( osgUtil::CullVisitor * cv, ViewData * data ) -{ +{ OpenThreads::ScopedLock lock(_viewDataMapMutex); _viewDataMap[ cv ] = data; } -void ViewDependentShadowTechnique::ViewData::dirty( bool flag ) -{ +void ViewDependentShadowTechnique::ViewData::dirty( bool flag ) +{ OpenThreads::ScopedLock lock(_mutex); _dirty = flag; } @@ -120,8 +120,8 @@ void ViewDependentShadowTechnique::ViewData::init dirty( false ); } -void ViewDependentShadowTechnique::ViewData::cull( void ) -{ +void ViewDependentShadowTechnique::ViewData::cull( void ) +{ } diff --git a/src/osgSim/BlinkSequence.cpp b/src/osgSim/BlinkSequence.cpp index d5b78c2a4..ce4b16e11 100644 --- a/src/osgSim/BlinkSequence.cpp +++ b/src/osgSim/BlinkSequence.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -18,7 +18,7 @@ using namespace osgSim; BlinkSequence::BlinkSequence(): - _pulsePeriod(0.0), + _pulsePeriod(0.0), _phaseShift(0.0), _pulseData(), _sequenceGroup(0) @@ -51,4 +51,4 @@ SequenceGroup::SequenceGroup(double baseTime): _baseTime(baseTime) { } - + diff --git a/src/osgSim/DOFTransform.cpp b/src/osgSim/DOFTransform.cpp index 2fcaf228d..2ef0ea797 100644 --- a/src/osgSim/DOFTransform.cpp +++ b/src/osgSim/DOFTransform.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -29,8 +29,8 @@ static const unsigned int SCALE_Z_LIMIT_BIT = 0x80000000u >> 8; DOFTransform::DOFTransform(): _previousTraversalNumber(osg::UNINITIALIZED_FRAME_NUMBER), _previousTime(0.0), - _limitationFlags(0), - _animationOn(false), + _limitationFlags(0), + _animationOn(false), _increasingFlags(0xffff), _multOrder(PRH) { @@ -59,7 +59,7 @@ DOFTransform::DOFTransform(const DOFTransform& dof, const osg::CopyOp& copyop): _increasingFlags(dof._increasingFlags), _multOrder(dof._multOrder) { - if (_animationOn) setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); + if (_animationOn) setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } void DOFTransform::traverse(osg::NodeVisitor& nv) @@ -76,7 +76,7 @@ void DOFTransform::traverse(osg::NodeVisitor& nv) animate((float)(newTime-_previousTime)); _previousTraversalNumber = nv.getTraversalNumber(); - _previousTime = newTime; + _previousTime = newTime; } } @@ -89,7 +89,7 @@ bool DOFTransform::computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisito osg::Matrix l2w(getPutMatrix()); //now the current matrix: - osg::Matrix current; + osg::Matrix current; current.makeTranslate(getCurrentTranslate()); //now create the local rotation: @@ -146,9 +146,9 @@ bool DOFTransform::computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisito } else { - matrix = l2w; + matrix = l2w; } - + return true; } @@ -159,7 +159,7 @@ bool DOFTransform::computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisito osg::Matrix w2l(getInversePutMatrix()); //now the current matrix: - osg::Matrix current; + osg::Matrix current; current.makeTranslate(-getCurrentTranslate()); //now create the local rotation: @@ -226,7 +226,7 @@ void DOFTransform::updateCurrentHPR(const osg::Vec3& hpr) //if there is constrain on animation if (_limitationFlags & ROTATION_ROLL_LIMIT_BIT) { - //if we have min == max, it is efective constrain, so don't change + //if we have min == max, it is efective constrain, so don't change if(_minHPR[2] != _maxHPR[2]) { _currentHPR[2] = hpr[2]; @@ -234,7 +234,7 @@ void DOFTransform::updateCurrentHPR(const osg::Vec3& hpr) if(_currentHPR[2] < _minHPR[2]) { - _currentHPR[2] = _minHPR[2]; + _currentHPR[2] = _minHPR[2]; //force increasing flag to 1 _increasingFlags |= this_flag; } @@ -283,12 +283,12 @@ void DOFTransform::updateCurrentHPR(const osg::Vec3& hpr) unsigned short this_flag = (unsigned short)1<<5;//heading - if(_currentHPR[0] < _minHPR[0]) + if(_currentHPR[0] < _minHPR[0]) { _currentHPR[0] = _minHPR[0]; _increasingFlags |= this_flag; } - else if(_currentHPR[0] > _maxHPR[0]) + else if(_currentHPR[0] > _maxHPR[0]) { _currentHPR[0] = _maxHPR[0]; _increasingFlags &= ~this_flag; @@ -318,7 +318,7 @@ void DOFTransform::updateCurrentTranslate(const osg::Vec3& translate) _currentTranslate[2] = _minTranslate[2]; _increasingFlags |= this_flag; } - else if(_currentTranslate[2] > _maxTranslate[2]) + else if(_currentTranslate[2] > _maxTranslate[2]) { _currentTranslate[2] = _maxTranslate[2]; _increasingFlags &= ~this_flag; @@ -342,7 +342,7 @@ void DOFTransform::updateCurrentTranslate(const osg::Vec3& translate) _currentTranslate[1] = _minTranslate[1]; _increasingFlags |= this_flag; } - else if(_currentTranslate[1] > _maxTranslate[1]) + else if(_currentTranslate[1] > _maxTranslate[1]) { _currentTranslate[1] = _maxTranslate[1]; _increasingFlags &= ~this_flag; @@ -361,18 +361,18 @@ void DOFTransform::updateCurrentTranslate(const osg::Vec3& translate) _currentTranslate[0] = translate[0]; unsigned short this_flag = (unsigned short)1; - if(_currentTranslate[0] < _minTranslate[0]) + if(_currentTranslate[0] < _minTranslate[0]) { _currentTranslate[0] = _minTranslate[0]; _increasingFlags |= this_flag; } - else if(_currentTranslate[0] > _maxTranslate[0]) + else if(_currentTranslate[0] > _maxTranslate[0]) { _currentTranslate[0] = _maxTranslate[0]; _increasingFlags &= ~this_flag; } } - } + } else { _currentTranslate[0] = translate[0]; @@ -387,16 +387,16 @@ void DOFTransform::updateCurrentScale(const osg::Vec3& scale) if (_limitationFlags & SCALE_Z_LIMIT_BIT) { if(_minScale[2] != _maxScale[2]) - { + { _currentScale[2] = scale[2]; unsigned short this_flag = (unsigned short)1<<8; - if(_currentScale[2] < _minScale[2]) + if(_currentScale[2] < _minScale[2]) { _currentScale[2] = _minScale[2]; _increasingFlags |= this_flag; } - else if(_currentScale[2] > _maxScale[2]) + else if(_currentScale[2] > _maxScale[2]) { _currentScale[2] = _maxScale[2]; _increasingFlags &= ~this_flag; @@ -415,12 +415,12 @@ void DOFTransform::updateCurrentScale(const osg::Vec3& scale) _currentScale[1] = scale[1]; unsigned short this_flag = (unsigned short)1<<7; - if(_currentScale[1] < _minScale[1]) + if(_currentScale[1] < _minScale[1]) { _currentScale[1] = _minScale[1]; _increasingFlags |= this_flag; } - else if(_currentScale[1] > _maxScale[1]) + else if(_currentScale[1] > _maxScale[1]) { _currentScale[1] = _maxScale[1]; _increasingFlags &= ~this_flag; @@ -439,12 +439,12 @@ void DOFTransform::updateCurrentScale(const osg::Vec3& scale) _currentScale[0] = scale[0]; unsigned short this_flag = (unsigned short)1<<6; - if(_currentScale[0] < _minScale[0]) + if(_currentScale[0] < _minScale[0]) { _currentScale[0] = _minScale[0]; _increasingFlags |= this_flag; } - else if(_currentScale[0] > _maxScale[0]) + else if(_currentScale[0] > _maxScale[0]) { _currentScale[0] = _maxScale[0]; _increasingFlags &= ~this_flag; @@ -462,14 +462,14 @@ void DOFTransform::updateCurrentScale(const osg::Vec3& scale) void DOFTransform::setAnimationOn(bool do_animate) { if (_animationOn == do_animate) return; - + int delta = 0; if (_animationOn) --delta; if (do_animate) ++delta; _animationOn = do_animate; - + if (_animationOn) setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+delta); } @@ -534,5 +534,5 @@ void DOFTransform::animate(float deltaTime) new_value[2] -= _incrementScale[2]*deltaTime; updateCurrentScale(new_value); - + } diff --git a/src/osgSim/ElevationSlice.cpp b/src/osgSim/ElevationSlice.cpp index f5f3b3145..3c6283426 100644 --- a/src/osgSim/ElevationSlice.cpp +++ b/src/osgSim/ElevationSlice.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -53,10 +53,10 @@ struct DistanceHeightCalculator normal.normalize(); _angleIncrement = 0.005; - - _radiusList.push_back(_startRadius); + + _radiusList.push_back(_startRadius); _distanceList.push_back(0.0); - + osg::Matrixd rotationMatrix; double angleBetweenStartEnd = acos( _startNormal * _endNormal ); double prevRadius = _startRadius; @@ -67,24 +67,24 @@ struct DistanceHeightCalculator { rotationMatrix.makeRotate(angle, normal); osg::Vec3d newVector = osg::Matrixd::transform3x3(_startPoint, rotationMatrix); - + _em->convertXYZToLatLongHeight(newVector.x(), newVector.y(), newVector.z(), latitude, longitude, height); double newRadius = newVector.length() - height; - + double distanceIncrement = _angleIncrement * (newRadius + prevRadius) *0.5; distance += distanceIncrement; - + _radiusList.push_back(newRadius); _distanceList.push_back(distance); - + // OSG_NOTICE<<" newVector = "<height<<" p2 = "<<_p2->distance<<" "<<_p2->height<height<<" p2 = "<distance<<" "<height< SegmentSet; LineConstructor() {} - - - + + + void add(double d, double h, const osg::Vec3d& pos) { osg::ref_ptr newPoint = new Point(d,h,pos); - - + + if (_previousPoint.valid() && newPoint->distance != _previousPoint->distance) { const double maxGradient = 100.0; double gradient = fabs( (newPoint->height - _previousPoint->height) / (newPoint->distance - _previousPoint->distance) ); - + if (gradient < maxGradient) { _segments.insert( Segment(_previousPoint.get(), newPoint.get()) ); } } - + _previousPoint = newPoint; } - + void endline() { _previousPoint = 0; } - + void report() { OSG_NOTICE<<"Number of segments = "<<_segments.size()<distance <= lhs._p2->distance) && (lhs._p2->distance <= rhs._p2->distance); if (rhs_p1_inside && lhs_p2_inside) - { - double distance_between = osg::Vec2d(lhs._p2->distance - rhs._p1->distance, + { + double distance_between = osg::Vec2d(lhs._p2->distance - rhs._p1->distance, lhs._p2->height - rhs._p1->height).length2(); if (distance_between < epsilon) @@ -499,9 +499,9 @@ struct LineConstructor Segment newSeg(lhs._p2.get(), rhs._p2.get()); _segments.insert(newSeg); - + _segments.erase(nextItr); - + nextItr = _segments.find(newSeg); } else @@ -525,7 +525,7 @@ struct LineConstructor Segment seg2( rhs._p1.get(), cp ); Segment seg3( cp, lhs._p2.get() ); Segment seg4( rhs.createPoint(lhs._p2->distance), lhs._p2.get() ); - + _segments.erase(nextItr); _segments.erase(itr); @@ -533,7 +533,7 @@ struct LineConstructor _segments.insert(seg2); _segments.insert(seg3); _segments.insert(seg4); - + itr = _segments.find(seg1); nextItr = itr; ++nextItr; @@ -564,8 +564,8 @@ struct LineConstructor // OSG_NOTICE<<" lhs_p2 "<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance)); _segments.erase(itr); @@ -619,20 +619,20 @@ struct LineConstructor } else if (dh1>=0.0 && dh2>=0.0) { - + double d_left = enclosed._p1->distance - enclosing._p1->distance; double d_right = enclosing._p2->distance - enclosed._p2->distance; if (d_left < epsilon && d_right < epsilon) { - // treat ENCLOSED as ENCLOSING. + // treat ENCLOSED as ENCLOSING. // OSG_NOTICE<<" Treat enclosed above as enclosing "<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance), enclosing._p2.get()); @@ -654,7 +654,7 @@ struct LineConstructor _segments.erase(itr); _segments.insert(newSeg); - + itr = nextItr; ++nextItr; @@ -664,12 +664,12 @@ struct LineConstructor else if (d_right < epsilon) { // OSG_NOTICE<<"ENCLOSING: ENCLOSING is below enclosed "<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance) ); @@ -684,15 +684,15 @@ struct LineConstructor // OSG_NOTICE<<" newSeg_p1 "<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance<<" "<height<> enclosing left side is above enclosed left side"<> enclosing left side is above enclosed left side"<> enclosing left side is above enclosed left side"<distance), enclosing._p2.get()); - + _segments.erase(itr); _segments.erase(nextItr); - + _segments.insert(newSegLeft); _segments.insert(newSegMid); _segments.insert(newSegRight); - + itr = _segments.find(newSegLeft); nextItr = itr; ++nextItr; } - else + else { // OSG_NOTICE<<" >> enclosing left side is above enclosed left side"<> enclosing left side is above enclosed left side"<> enclosing left side is above enclosed left side"<distance)); Segment newSegMid(enclosed._p1.get(), cp); Segment newSegRight(cp, enclosing._p2.get()); - + _segments.erase(itr); _segments.erase(nextItr); - + _segments.insert(newSegLeft); _segments.insert(newSegMid); _segments.insert(newSegRight); - + itr = _segments.find(newSegLeft); nextItr = itr; ++nextItr; } } - else + else { // OSG_NOTICE<<" >> Replace enclosing with left and right sections"<> enclosing left side is above enclosed left side"<distance), enclosing._p2.get()); - + _segments.erase(itr); _segments.erase(nextItr); - + _segments.insert(newSegLeft); _segments.insert(newSegMid); _segments.insert(newSegRight); - + itr = _segments.find(newSegLeft); nextItr = itr; ++nextItr; } - else + else { // OSG_NOTICE<<" >> enclosing left side is above enclosed left side"<distance)); Segment newSegMid(enclosed._p1.get(), cp); Segment newSegRight(cp, enclosing._p2.get()); - + _segments.erase(itr); _segments.erase(nextItr); - + _segments.insert(newSegLeft); _segments.insert(newSegMid); _segments.insert(newSegRight); - + itr = _segments.find(newSegLeft); nextItr = itr; ++nextItr; @@ -905,7 +905,7 @@ struct LineConstructor else { OSG_NOTICE<<"ENCLOSING: ENCLOSING - error case "<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance - enclosing._p1->distance; double d_right = enclosing._p2->distance - enclosed._p2->distance; - + if (d_left<=epsilon) { @@ -945,7 +945,7 @@ struct LineConstructor // OSG_NOTICE<<" enclosing_p2 "<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance), enclosed._p2.get())); _segments.erase(nextItr); @@ -959,7 +959,7 @@ struct LineConstructor // OSG_NOTICE<<" enclosing_p2 "<distance<<" "<height<distance<<" "<height<distance<<" "<height<distance), enclosing._p2.get()); - + _segments.erase(itr); _segments.erase(nextItr); - + _segments.insert(segLeft); _segments.insert(segMid); _segments.insert(segRight); - + itr = _segments.find(segLeft); nextItr = itr; ++nextItr; } - } + } } else { @@ -1052,24 +1052,24 @@ struct LineConstructor break; } - default: + default: OSG_NOTICE<<"** Not handled, advancing"<compare(*nextItr) : Segment::UNCLASSIFIED; } } } - + unsigned int numOverlapping(SegmentSet::const_iterator startItr) const { if (startItr==_segments.end()) return 0; - + SegmentSet::const_iterator nextItr = startItr; ++nextItr; - + unsigned int num = 0; while (nextItr!=_segments.end() && startItr->compare(*nextItr)>=Segment::OVERLAPPING) { @@ -1078,7 +1078,7 @@ struct LineConstructor } return num; } - + unsigned int totalNumOverlapping() const { unsigned int total = 0; @@ -1096,14 +1096,14 @@ struct LineConstructor SegmentSet::iterator prevItr = _segments.begin(); SegmentSet::iterator nextItr = prevItr; ++nextItr; - + intersections.push_back( prevItr->_p1->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(prevItr->_p1->distance, prevItr->_p1->height) ); - + intersections.push_back( prevItr->_p2->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(prevItr->_p2->distance, prevItr->_p2->height) ); - for(; + for(; nextItr != _segments.end(); ++nextItr,++prevItr) { @@ -1114,45 +1114,45 @@ struct LineConstructor { intersections.push_back( nextItr->_p1->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(nextItr->_p1->distance, nextItr->_p1->height) ); - + intersections.push_back( nextItr->_p2->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(nextItr->_p2->distance, nextItr->_p2->height) ); break; } - case(Segment::JOINED): + case(Segment::JOINED): { #if 1 intersections.push_back( nextItr->_p2->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(nextItr->_p2->distance, nextItr->_p2->height) ); -#else +#else intersections.push_back( nextItr->_p1->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(nextItr->_p1->distance, nextItr->_p1->height) ); - + intersections.push_back( nextItr->_p2->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(nextItr->_p2->distance, nextItr->_p2->height) ); #endif break; } - default: + default: { intersections.push_back( nextItr->_p1->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(nextItr->_p1->distance, nextItr->_p1->height) ); - + intersections.push_back( nextItr->_p2->position ); distanceHeightIntersections.push_back( ElevationSlice::DistanceHeight(nextItr->_p2->distance, nextItr->_p2->height) ); break; } } - + } - + } - + SegmentSet _segments; osg::ref_ptr _previousPoint; osg::Plane _plane; osg::ref_ptr _em; - + }; } @@ -1188,17 +1188,17 @@ void ElevationSlice::computeIntersections(osg::Node* scene, osg::Node::NodeMask end_latitude, end_longitude, end_height); OSG_NOTICE<<"end_lat = "< geode = new osg::Geode; - + for(itr = intersections.begin(); itr != intersections.end(); ++itr) @@ -1289,16 +1289,16 @@ void ElevationSlice::computeIntersections(osg::Node* scene, osg::Node::NodeMask geometry->setVertexArray( vertices ); geometry->addPrimitiveSet( new osg::DrawArrays(GL_LINE_STRIP, 0, vertices->size()) ); - + osg::Vec4Array* colours = new osg::Vec4Array; colours->push_back( osg::Vec4(1.0f,1.0f,1.0f,1.0f) ); - + geometry->setColorArray( colours ); geode->addDrawable( geometry ); geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); } - + osgDB::writeNodeFile(*geode, "raw.osg"); #endif @@ -1316,9 +1316,9 @@ void ElevationSlice::computeIntersections(osg::Node* scene, osg::Node::NodeMask ++itr) { osgUtil::PlaneIntersector::Intersection& intersection = *itr; - + if (intersection.attributes.size()!=intersection.polyline.size()) continue; - + Attributes::iterator aitr = intersection.attributes.begin(); for(Polyline::iterator pitr = intersection.polyline.begin(); pitr != intersection.polyline.end(); @@ -1327,9 +1327,9 @@ void ElevationSlice::computeIntersections(osg::Node* scene, osg::Node::NodeMask const osg::Vec3d& v = *pitr; double distance, height; dhc.computeDistanceHeight(v, distance, height); - + double pi_height = *aitr; - + // OSG_NOTICE<<"computed height = "<_point; osg::Vec3d upVector = em->computeLocalUpVector(start.x(), start.y(), start.z()); double latitude, longitude, height; em->convertXYZToLatLongHeight(start.x(), start.y(), start.z(), latitude, longitude, height); - osg::Vec3d end = start - upVector * (height - _lowestHeight); - + osg::Vec3d end = start - upVector * (height - _lowestHeight); + itr->_hat = height; OSG_NOTICE<<"lat = "<getTexture(); texture->setTextureSize(new_s, new_t); @@ -338,7 +338,7 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) Vec3* coords = impostorSprite->getCoords(); Vec2* texcoords = impostorSprite->getTexCoords(); - + coords[0] = c01; texcoords[0].set(0.0f,1.0f); @@ -350,11 +350,11 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) coords[3] = c11; texcoords[3].set(1.0f,1.0f); - + impostorSprite->dirtyBound(); - + Vec3* controlcoords = impostorSprite->getControlCoords(); - + if (isPerspectiveProjection) { // deal with projection issue by moving the coorners of the quad @@ -362,7 +362,7 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) float ratio = width/(center_local-eye_local).length(); float one_minus_ratio = 1.0f-ratio; Vec3 eye_local_ratio = eye_local*ratio; - + controlcoords[0] = coords[0]*one_minus_ratio + eye_local_ratio; controlcoords[1] = coords[1]*one_minus_ratio + eye_local_ratio; controlcoords[2] = coords[2]*one_minus_ratio + eye_local_ratio; @@ -386,7 +386,7 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) Vec3 eye_world(0.0,0.0,0.0); Vec3 center_world = bs.center()*matrix; - + osg::Camera* camera = impostorSprite->getCamera(); if (!camera) { @@ -395,31 +395,31 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) } camera->setCullCallback(new ImpostorTraverseNodeCallback(this)); - + osgUtil::RenderStage* previous_stage = cv->getRenderStage(); - + // set up the background color and clear mask. osg::Vec4 clear_color = previous_stage->getClearColor(); clear_color[3] = 0.0f; // set thae alpha to zero. camera->setClearColor(clear_color); camera->setClearMask(previous_stage->getClearMask()); - - + + // adjust camera left,right,up,down to fit (in world coords) Vec3 near_local ( center_local-lv_local*width ); Vec3 far_local ( center_local+lv_local*width ); Vec3 top_local ( center_local+up_local); Vec3 right_local ( center_local+sv_local); - + Vec3 near_world = near_local * matrix; Vec3 far_world = far_local * matrix; Vec3 top_world = top_local * matrix; Vec3 right_world = right_local * matrix; - + float znear = (near_world-eye_world).length(); float zfar = (far_world-eye_world).length(); - + float top = (top_world-center_world).length(); float right = (right_world-center_world).length(); @@ -444,15 +444,15 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) Vec3 rotate_from = bs.center()-eye_local; Vec3 rotate_to = cv-> getLookVectorLocal(); - osg::Matrix rotate_matrix = - osg::Matrix::translate(-eye_local)* + osg::Matrix rotate_matrix = + osg::Matrix::translate(-eye_local)* osg::Matrix::rotate(rotate_from,rotate_to)* osg::Matrix::translate(eye_local)* *cv->getModelViewMatrix(); camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera->setViewMatrix(rotate_matrix); - + camera->setViewport(0,0,new_s,new_t); // tell the camera to use OpenGL frame buffer object where supported. @@ -466,7 +466,7 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) // do the cull traversal on the subgraph camera->accept(*cv); - + return impostorSprite; } diff --git a/src/osgSim/ImpostorSprite.cpp b/src/osgSim/ImpostorSprite.cpp index 79cdd9a51..60aba7a40 100644 --- a/src/osgSim/ImpostorSprite.cpp +++ b/src/osgSim/ImpostorSprite.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #if defined(_MSC_VER) @@ -82,9 +82,9 @@ float ImpostorSprite::calcPixelError(const osg::Matrix& MVPW) const float dy = (projected_coord.y()-projected_control.y()); float error_sqrd = dx*dx+dy*dy; - + if (error_sqrd > max_error_sqrd) max_error_sqrd = error_sqrd; - + } return sqrtf(max_error_sqrd); @@ -154,7 +154,7 @@ void ImpostorSprite::accept(osg::PrimitiveFunctor& functor) const { functor.setVertexArray(4,_coords); functor.drawArrays( GL_QUADS, 0, 4); - + } @@ -171,7 +171,7 @@ ImpostorSpriteManager::ImpostorSpriteManager(): _alphafunc = new osg::AlphaFunc; _alphafunc->setFunction( osg::AlphaFunc::GREATER, 0.000f ); - + _reuseStateSetIndex = 0; } @@ -186,7 +186,7 @@ ImpostorSpriteManager::~ImpostorSpriteManager() _first->_next = NULL; _first = next; } - + } void ImpostorSpriteManager::push_back(ImpostorSprite* is) @@ -253,7 +253,7 @@ ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,u if (!empty()) { - // search for a valid impostor to reuse. + // search for a valid impostor to reuse. ImpostorSprite* curr = _first; while (curr) { @@ -273,7 +273,7 @@ ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,u } // creating new impostor sprite. - + osg::StateSet* stateset = new osg::StateSet; @@ -310,7 +310,7 @@ ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,u is->setTexture(texture,s,t); push_back(is); - + return is; } diff --git a/src/osgSim/InsertImpostorsVisitor.cpp b/src/osgSim/InsertImpostorsVisitor.cpp index 4d10c0948..a0a0ce1a7 100644 --- a/src/osgSim/InsertImpostorsVisitor.cpp +++ b/src/osgSim/InsertImpostorsVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #if defined(_MSC_VER) @@ -45,7 +45,7 @@ void InsertImpostorsVisitor::apply(Node& node) void InsertImpostorsVisitor::apply(Group& node) { _groupList.push_back(&node); - + ++_numNestedImpostors; if (_numNestedImpostors<_maximumNumNestedImpostors) { @@ -60,7 +60,7 @@ void InsertImpostorsVisitor::apply(LOD& node) { _lodList.push_back(&node); } - + ++_numNestedImpostors; if (_numNestedImpostors<_maximumNumNestedImpostors) { @@ -103,7 +103,7 @@ void InsertImpostorsVisitor::insertImpostors() // standard LOD settings impostor->addChild(group); impostor->setRange(0,0.0f,1e7f); - + // impostor specfic settings. impostor->setImpostorThresholdToBound(_impostorThresholdRatio); @@ -119,9 +119,9 @@ void InsertImpostorsVisitor::insertImpostors() } } } - - } - + + } + // handle LOD's if (_replaceLODsByImpostors) @@ -153,7 +153,7 @@ void InsertImpostorsVisitor::insertImpostors() impostor->addChild(lod->getChild(ci)); impostor->setRange(ci,lod->getMinRange(ci),lod->getMaxRange(ci)); } - + impostor->setCenter(lod->getCenter()); impostor->setCenterMode(lod->getCenterMode()); @@ -172,6 +172,6 @@ void InsertImpostorsVisitor::insertImpostors() } } } - - } + + } } diff --git a/src/osgSim/LightPoint.cpp b/src/osgSim/LightPoint.cpp index 4e177a9e2..2784451bf 100644 --- a/src/osgSim/LightPoint.cpp +++ b/src/osgSim/LightPoint.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,7 +37,7 @@ LightPoint::LightPoint(const osg::Vec3& position,const osg::Vec4& color): _blinkSequence(0), _blendingMode(BLENDED) { -} +} LightPoint::LightPoint(bool on, const osg::Vec3& position, @@ -80,6 +80,6 @@ LightPoint& LightPoint::operator = (const LightPoint& lp) _sector = lp._sector; _blinkSequence = lp._blinkSequence; _blendingMode = lp._blendingMode; - + return *this; } diff --git a/src/osgSim/LightPointDrawable.cpp b/src/osgSim/LightPointDrawable.cpp index 53a9875a7..552cdee4a 100644 --- a/src/osgSim/LightPointDrawable.cpp +++ b/src/osgSim/LightPointDrawable.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ LightPointDrawable::LightPointDrawable(): { setSupportsDisplayList(false); - + _depthOff = new osg::Depth; _depthOff->setWriteMask(false); @@ -34,7 +34,7 @@ LightPointDrawable::LightPointDrawable(): _blendOne = new osg::BlendFunc; _blendOne->setFunction(osg::BlendFunc::SRC_ALPHA,osg::BlendFunc::ONE); - + _blendOneMinusSrcAlpha = new osg::BlendFunc; _blendOneMinusSrcAlpha->setFunction(osg::BlendFunc::SRC_ALPHA,osg::BlendFunc::ONE_MINUS_SRC_ALPHA); @@ -64,7 +64,7 @@ void LightPointDrawable::reset() if (!itr->empty()) itr->erase(itr->begin(),itr->end()); } - + for(itr=_sizedAdditiveLightPointList.begin(); itr!=_sizedAdditiveLightPointList.end(); ++itr) @@ -93,7 +93,7 @@ void LightPointDrawable::drawImplementation(osg::RenderInfo& renderInfo) const state.applyMode(GL_LIGHTING,false); state.applyTextureMode(0,GL_TEXTURE_1D,false); state.applyTextureMode(0,GL_TEXTURE_2D,false); - + glHint(GL_POINT_SMOOTH_HINT,GL_NICEST); state.applyAttribute(_depthOn.get()); @@ -140,7 +140,7 @@ void LightPointDrawable::drawImplementation(osg::RenderInfo& renderInfo) const } - state.applyAttribute(_blendOne.get()); + state.applyAttribute(_blendOne.get()); for(pointsize=1,sitr=_sizedAdditiveLightPointList.begin(); sitr!=_sizedAdditiveLightPointList.end(); @@ -159,14 +159,14 @@ void LightPointDrawable::drawImplementation(osg::RenderInfo& renderInfo) const } glPointSize(1); - + glHint(GL_POINT_SMOOTH_HINT,GL_FASTEST); state.haveAppliedAttribute(osg::StateAttribute::POINT); - + state.dirtyAllVertexArrays(); state.disableAllVertexArrays(); - + // restore the state afterwards. state.apply(); #else diff --git a/src/osgSim/LightPointNode.cpp b/src/osgSim/LightPointNode.cpp index 03752739b..9b2704d91 100644 --- a/src/osgSim/LightPointNode.cpp +++ b/src/osgSim/LightPointNode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -106,7 +106,7 @@ osg::BoundingSphere LightPointNode::computeBound() const bsphere.set(_bbox.center(),0.0f); - + for(itr=_lightPointList.begin(); itr!=_lightPointList.end(); ++itr) @@ -135,22 +135,22 @@ void LightPointNode::traverse(osg::NodeVisitor& nv) osg::Timer_t t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0; #endif - + #ifdef USE_TIMER t1 = timer.tick(); #endif osgUtil::CullVisitor* cv = dynamic_cast(&nv); - + #ifdef USE_TIMER t2 = timer.tick(); #endif - + // should we disable small feature culling here? if (cv /*&& !cv->isCulled(_bbox)*/) { - + osg::Matrix matrix = *(cv->getModelViewMatrix()); osg::RefMatrix& projection = *(cv->getProjectionMatrix()); osgUtil::StateGraph* rg = cv->getCurrentStateGraph(); @@ -162,7 +162,7 @@ void LightPointNode::traverse(osg::NodeVisitor& nv) // so need to add it. cv->getCurrentRenderBin()->addStateGraph(rg); } - + #ifdef USE_TIMER t3 = timer.tick(); #endif @@ -193,7 +193,7 @@ void LightPointNode::traverse(osg::NodeVisitor& nv) { drawable = _pointSprites ? new LightPointSpriteDrawable : new LightPointDrawable; rg->setUserData(drawable); - + if (cv->getFrameStamp()) { drawable->setSimulationTime(cv->getFrameStamp()->getSimulationTime()); @@ -207,10 +207,10 @@ void LightPointNode::traverse(osg::NodeVisitor& nv) litr != rg->_leaves.end() && (*litr)->_drawable.get()!=drawable; ++litr) {} - + if (litr == rg->_leaves.end()) { - // haven't found the drawable added in the RenderLeaf list, therefore this may be the + // haven't found the drawable added in the RenderLeaf list, therefore this may be the // first time through LightPointNode in this frame, so need to add drawable into the StateGraph RenderLeaf list // and update its time signatures. @@ -234,17 +234,17 @@ void LightPointNode::traverse(osg::NodeVisitor& nv) t7 = timer.tick(); #endif - + if (cv->getComputeNearFarMode() != osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR) cv->updateCalculatedNearFar(matrix,_bbox); - - + + const float minimumIntensity = 1.0f/256.0f; const osg::Vec3 eyePoint = cv->getEyeLocal(); - + double time=drawable->getSimulationTime(); double timeInterval=drawable->getSimulationTimeInterval(); - + const osg::Polytope clipvol(cv->getCurrentCullingSet().getFrustum()); const bool computeClipping = false;//(clipvol.getCurrentMask()!=0); @@ -254,7 +254,7 @@ void LightPointNode::traverse(osg::NodeVisitor& nv) ++itr) { const LightPoint& lp = *itr; - + if (!lp._on) continue; const osg::Vec3& position = lp._position; @@ -392,11 +392,11 @@ void LightPointNode::traverse(osg::NodeVisitor& nv) } } } - + #ifdef USE_TIMER t8 = timer.tick(); #endif - + } #ifdef USE_TIMER cout << "compute"< lock(_mutex); - + FileNameSceneMap::iterator itr = _filenameSceneMap.find(filename); if (itr != _filenameSceneMap.end()) { OSG_INFO<<"Getting from cache "<second.get(); } } - + // now load the file. osg::ref_ptr node = osgDB::readNodeFile(filename); - + // insert into the cache. if (node.valid()) { OpenThreads::ScopedLock lock(_mutex); - + if (_filenameSceneMap.size() < _maxNumFilesToCache) { OSG_INFO<<"Inserting into cache "< intersector = new osgUtil::LineSegmentIntersector(itr->_start, itr->_end); intersectorGroup->addIntersector( intersector.get() ); } - + _intersectionVisitor.reset(); _intersectionVisitor.setTraversalMask(traversalMask); _intersectionVisitor.setIntersector( intersectorGroup.get() ); - + scene->accept(_intersectionVisitor); - + unsigned int index = 0; osgUtil::IntersectorGroup::Intersectors& intersectors = intersectorGroup->getIntersectors(); for(osgUtil::IntersectorGroup::Intersectors::iterator intersector_itr = intersectors.begin(); @@ -133,9 +133,9 @@ void LineOfSight::computeIntersections(osg::Node* scene, osg::Node::NodeMask tra { Intersections& intersectionsLOS = _LOSList[index]._intersections; _LOSList[index]._intersections.clear(); - + osgUtil::LineSegmentIntersector::Intersections& intersections = lsi->getIntersections(); - + for(osgUtil::LineSegmentIntersector::Intersections::iterator itr = intersections.begin(); itr != intersections.end(); ++itr) @@ -146,7 +146,7 @@ void LineOfSight::computeIntersections(osg::Node* scene, osg::Node::NodeMask tra } } } - + } LineOfSight::Intersections LineOfSight::computeIntersections(osg::Node* scene, const osg::Vec3d& start, const osg::Vec3d& end, osg::Node::NodeMask traversalMask) diff --git a/src/osgSim/MultiSwitch.cpp b/src/osgSim/MultiSwitch.cpp index 3fc8ddd62..50508f868 100644 --- a/src/osgSim/MultiSwitch.cpp +++ b/src/osgSim/MultiSwitch.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -35,7 +35,7 @@ void MultiSwitch::traverse(osg::NodeVisitor& nv) { if (nv.getTraversalMode()==osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) { - + if (_activeSwitchSet<_values.size()) { for(unsigned int pos=0;pos<_children.size();++pos) @@ -90,7 +90,7 @@ bool MultiSwitch::insertChild( unsigned int index, osg::Node *child) } } - + return true; } return false; @@ -101,7 +101,7 @@ bool MultiSwitch::removeChild( osg::Node *child ) // find the child's position. unsigned int pos=getChildIndex(child); if (pos==_children.size()) return false; - + for(SwitchSetList::iterator itr=_values.begin(); itr!=_values.end(); ++itr) @@ -109,8 +109,8 @@ bool MultiSwitch::removeChild( osg::Node *child ) ValueList& values = *itr; values.erase(values.begin()+pos); } - - return Group::removeChild(child); + + return Group::removeChild(child); } void MultiSwitch::setValue(unsigned int switchSet, unsigned int pos,bool value) @@ -129,7 +129,7 @@ void MultiSwitch::setChildValue(const osg::Node* child,unsigned int switchSet, b // find the child's position. unsigned int pos=getChildIndex(child); if (pos==_children.size()) return; - + ValueList& values = _values[switchSet]; values[pos]=value; } @@ -151,7 +151,7 @@ bool MultiSwitch::getChildValue(const osg::Node* child, unsigned int switchSet) // find the child's position. unsigned int pos=getChildIndex(child); if (pos==_children.size()) return false; - + const ValueList& values = _values[switchSet]; return values[pos]; } diff --git a/src/osgSim/OverlayNode.cpp b/src/osgSim/OverlayNode.cpp index 16ffb7a55..2bc57b3b0 100644 --- a/src/osgSim/OverlayNode.cpp +++ b/src/osgSim/OverlayNode.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -59,14 +59,14 @@ public: const osg::Vec3d v110(1.0,1.0,-1.0); const osg::Vec3d v101(1.0,-1.0,1.0); const osg::Vec3d v111(1.0,1.0,1.0); - + _faces.clear(); { // left plane. Face& face = createFace(); face.name = "left"; face.plane.set(1.0,0.0,0.0,1.0); - face.vertices.reserve(4); + face.vertices.reserve(4); face.vertices.push_back(v000); face.vertices.push_back(v001); face.vertices.push_back(v011); @@ -105,7 +105,7 @@ public: face.vertices.push_back(v010); face.vertices.push_back(v110); } - + if (withNear) { // near plane Face& face = createFace(); @@ -116,8 +116,8 @@ public: face.vertices.push_back(v010); face.vertices.push_back(v110); face.vertices.push_back(v100); - } - + } + if (withFar) { // far plane Face& face = createFace(); @@ -128,17 +128,17 @@ public: face.vertices.push_back(v101); face.vertices.push_back(v111); face.vertices.push_back(v011); - } + } } void setToBoundingBox(const osg::BoundingBox& bb) { -#if 0 +#if 0 OSG_NOTICE<<"setToBoundingBox xrange "< Edge; typedef std::map Edges; Edges edges; - double numVerticesAdded=0.0; + double numVerticesAdded=0.0; osg::Vec3d center; for(itr = removedFaces.begin(); itr != removedFaces.end(); @@ -278,23 +278,23 @@ public: osg::Vec3d& b = vertices[ (i+1) % vertices.size()]; if (a VertexSet; VertexSet uniqueVertices; - + for(Edges::iterator eitr = edges.begin(); eitr != edges.end(); ++eitr) { - if (eitr->second==1) + if (eitr->second==1) { // OSG_NOTICE<<" edge Ok"<first; @@ -306,7 +306,7 @@ public: face.vertices.push_back(edge.second); if (face.plane.distance(center)<0.0) face.plane.flip(); _faces.push_back(face); - + uniqueVertices.insert(edge.first); uniqueVertices.insert(edge.second); } @@ -328,7 +328,7 @@ public: normal.normalize(); baseVertices.push_back(point - normal * (height - minHeight)); } - + //compute centroid of the base vertices osg::Vec3d center; double totalArea = 0; @@ -345,12 +345,12 @@ public: center /= totalArea; osg::Vec3d normal(center); normal.normalize(); - + osg::Plane basePlane(normal, center); cut(basePlane,"basePlane"); } - + // OSG_NOTICE<<" Removed faces "< Edge; typedef std::map Edges; Edges edges; - double numVerticesAdded=0.0; + double numVerticesAdded=0.0; osg::Vec3d center; for(itr = removedFaces.begin(); itr != removedFaces.end(); @@ -399,33 +399,33 @@ public: osg::Vec3d& b = vertices[ (i+1) % vertices.size()]; if (a VertexSet; VertexSet uniqueVertices; - + for(Edges::iterator eitr = edges.begin(); eitr != edges.end(); ++eitr) { - if (eitr->second==1) + if (eitr->second==1) { // OSG_NOTICE<<" edge Ok"<first; - + double h_first = (edge.first-control) * normal; osg::Vec3d projected_first = edge.first - normal * h_first; - + double h_second = (edge.second-control) * normal; osg::Vec3d projected_second = edge.second - normal * h_second; - + Face face; face.name = "baseSide"; face.plane.set(projected_first, edge.first, edge.second); @@ -436,17 +436,17 @@ public: if (face.plane.distance(center)<0.0) face.plane.flip(); _faces.push_back(face); - + uniqueVertices.insert(projected_first); uniqueVertices.insert(projected_second); } } - + Face newFace; newFace.name = "basePlane"; newFace.plane.set(normal,control); - - osg::Vec3d side = ( fabs(normal.x()) < fabs(normal.y()) ) ? + + osg::Vec3d side = ( fabs(normal.x()) < fabs(normal.y()) ) ? osg::Vec3(1.0, 0.0, 0.0) : osg::Vec3(0.0, 1.0, 0.0); @@ -474,10 +474,10 @@ public: { newFace.vertices.push_back(aitr->second); } - + _faces.push_back(newFace); - + } void computeSilhoette(const osg::Vec3d& normal, Vertices& vertices) @@ -489,7 +489,7 @@ public: EdgeMap edgeMap; - + for(Faces::iterator itr = _faces.begin(); itr != _faces.end(); ++itr) @@ -503,10 +503,10 @@ public: else edgeMap[EdgePair(vb,va)].push_back(&face); } } - + typedef std::set VertexSet; VertexSet uniqueVertices; - + for(EdgeMap::iterator eitr = edgeMap.begin(); eitr != edgeMap.end(); ++eitr) @@ -519,7 +519,7 @@ public: } else if (edgeFaces.size()==2) { - + double dotProduct0 = edgeFaces[0]->plane.getNormal() * normal; double dotProduct1 = edgeFaces[1]->plane.getNormal() * normal; if (dotProduct0 * dotProduct1 <0.0) @@ -532,7 +532,7 @@ public: { // OSG_NOTICE<<" Non silhoette edge found "<name<<" "<name<second); } - - + + } @@ -617,7 +617,7 @@ public: typedef std::vector Distances; Distances distances; Vertices newVertices; - + for(Faces::iterator itr = _faces.begin(); itr != _faces.end(); ) @@ -626,13 +626,13 @@ public: int intersect = plane.intersect(face.vertices); if (intersect==1) { - // OSG_NOTICE<<" Face inside"<=0.0) newVertices.push_back(vertices[i]); // add point to new face if point exactly on a plane - if (distance_a==0.0) newFace.vertices.push_back(vertices[i]); + if (distance_a==0.0) newFace.vertices.push_back(vertices[i]); // does edge intersect plane if (distance_a * distance_b<0.0) @@ -665,24 +665,24 @@ public: osg::Vec3d intersection = (vb*distance_a - va*distance_b)/(distance_a-distance_b); newVertices.push_back(intersection); newFace.vertices.push_back(intersection); - - // OSG_NOTICE<<" intersection distance "<second); } - + newVertices.swap(vertices); - + // OSG_NOTICE<<" after angle sort "<push_back(*vitr); } } - + osg::Vec4Array* colours = new osg::Vec4Array; colours->push_back(colour); geometry->setColorArray(colours); geometry->setColorBinding(osg::Geometry::BIND_OVERALL); - + osg::StateSet* stateset = geometry->getOrCreateStateSet(); stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF); stateset->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::OFF); stateset->setTextureMode(1, GL_TEXTURE_2D, osg::StateAttribute::OFF); - + return geometry; } @@ -815,7 +815,7 @@ protected: typedef std::list Faces; Faces _faces; - + }; } @@ -849,7 +849,7 @@ OverlayNode::OverlayNode(const OverlayNode& copy, const osg::CopyOp& copyop): _updateCamera(false), _renderTargetImpl(copy._renderTargetImpl) { - setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); init(); } @@ -883,7 +883,7 @@ void OverlayNode::OverlayData::releaseGLObjects(osg::State* state) const void OverlayNode::setThreadSafeRefUnref(bool threadSafe) { osg::Group::setThreadSafeRefUnref(threadSafe); - + if (_overlaySubgraph.valid()) _overlaySubgraph->setThreadSafeRefUnref(threadSafe); for(OverlayDataMap::iterator itr = _overlayDataMap.begin(); @@ -911,7 +911,7 @@ void OverlayNode::resizeGLObjectBuffers(unsigned int maxSize) void OverlayNode::releaseGLObjects(osg::State* state) const { osg::Group::releaseGLObjects(state); - + if (_overlaySubgraph.valid()) _overlaySubgraph->releaseGLObjects(state); for(OverlayDataMap::const_iterator itr = _overlayDataMap.begin(); @@ -925,9 +925,9 @@ void OverlayNode::releaseGLObjects(osg::State* state) const void OverlayNode::setOverlayTechnique(OverlayTechnique technique) { if (_overlayTechnique==technique) return; - + _overlayTechnique = technique; - + init(); } @@ -951,17 +951,17 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) OpenThreads::ScopedLock lock(_overlayDataMapMutex); OverlayDataMap::iterator itr = _overlayDataMap.find(cv); if (itr != _overlayDataMap.end()) return itr->second.get(); - + _overlayDataMap[cv] = new OverlayData; - + OverlayData* overlayData = _overlayDataMap[cv].get(); - - + + unsigned int tex_width = _textureSizeHint; unsigned int tex_height = _textureSizeHint; - - if (!overlayData->_texture) - { + + if (!overlayData->_texture) + { // OSG_NOTICE<<" setting up texture"<setBorderColor(osg::Vec4(1.0,0.0,0.0,0.5)); #endif overlayData->_texture = texture; - } + } // set up the render to texture camera. if (!overlayData->_camera || overlayData->_camera->getRenderTargetImplementation() != _renderTargetImpl) @@ -986,14 +986,14 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) // create the camera overlayData->_camera = new osg::Camera; - + overlayData->_camera->setClearColor(_overlayClearColor); overlayData->_camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); // set viewport overlayData->_camera->setViewport(0,0,tex_width,tex_height); - + overlayData->_camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); // set the camera to render before the main camera. @@ -1004,7 +1004,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) // attach the texture and use it as the color buffer. overlayData->_camera->attach(osg::Camera::COLOR_BUFFER, overlayData->_texture.get()); - + if (_overlaySubgraph.valid()) overlayData->_camera->addChild(_overlaySubgraph.get()); } @@ -1017,7 +1017,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) if (!overlayData->_y0) overlayData->_y0 = new osg::Uniform("y0",0.0f); if (!overlayData->_lightingEnabled) overlayData->_lightingEnabled = new osg::Uniform("lightingEnabled",true); - if (!overlayData->_overlayStateSet) + if (!overlayData->_overlayStateSet) { overlayData->_overlayStateSet = new osg::StateSet; overlayData->_overlayStateSet->addUniform(overlayData->_y0.get()); @@ -1034,7 +1034,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) } else { - char vertexShaderSource[] = + char vertexShaderSource[] = "uniform float y0; \n" "uniform bool lightingEnabled; \n" " \n" @@ -1110,7 +1110,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) osg::Shader* vertex_shader = new osg::Shader(osg::Shader::VERTEX, vertexShaderSource); program->addShader(vertex_shader); } - + } if (!overlayData->_mainSubgraphProgram) @@ -1125,7 +1125,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) } else { - char fragmentShaderSource[] = + char fragmentShaderSource[] = "uniform sampler2D texture_0; \n" "uniform sampler2D texture_1; \n" " \n" @@ -1158,7 +1158,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) } } - if (!overlayData->_mainSubgraphStateSet) + if (!overlayData->_mainSubgraphStateSet) { overlayData->_mainSubgraphStateSet = new osg::StateSet; @@ -1172,7 +1172,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv) overlayData->_mainSubgraphStateSet->setTextureMode(_textureUnit, GL_TEXTURE_GEN_R, osg::StateAttribute::ON); overlayData->_mainSubgraphStateSet->setTextureMode(_textureUnit, GL_TEXTURE_GEN_Q, osg::StateAttribute::ON); - if (_texEnvMode!=GL_NONE) + if (_texEnvMode!=GL_NONE) { overlayData->_mainSubgraphStateSet->setTextureAttribute(_textureUnit, new osg::TexEnv((osg::TexEnv::Mode)_texEnvMode)); } @@ -1200,7 +1200,7 @@ void OverlayNode::init() void OverlayNode::init_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY() { OSG_INFO<<"OverlayNode::init() - OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY"<getNumChildren(); ++i) @@ -1266,7 +1266,7 @@ void OverlayNode::traverse_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeV osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0; - + if (em) { osg::Vec3d eyePoint(0.0,0.0,0.0); // center of the planet @@ -1306,7 +1306,7 @@ void OverlayNode::traverse_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeV // compute the matrix which takes a vertex from local coords into tex coords // will use this later to specify osg::TexGen.. - osg::Matrix MVP = camera->getViewMatrix() * + osg::Matrix MVP = camera->getViewMatrix() * camera->getProjectionMatrix(); osg::Matrix MVPT = MVP * @@ -1337,8 +1337,8 @@ void OverlayNode::traverse_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeV Group::traverse(nv); return; } - - + + unsigned int contextID = cv->getState()!=0 ? cv->getState()->getContextID() : 0; // if we need to redraw then do cull traversal on camera. @@ -1348,20 +1348,20 @@ void OverlayNode::traverse_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeV camera->accept(*cv); _textureObjectValidList[contextID] = 1; } - - + + // now set up the drawing of the main scene. { overlayData._texgenNode->accept(*cv); - + const osg::Matrix modelView = *(cv->getModelViewMatrix()); osg::Polytope viewTextureFrustum; viewTextureFrustum.setAndTransformProvidingInverse(overlayData._textureFrustum, osg::Matrix::inverse(modelView)); cv->getProjectionCullingStack().back().addStateFrustum(overlayData._mainSubgraphStateSet.get(), viewTextureFrustum); cv->getCurrentCullingSet().addStateFrustum(overlayData._mainSubgraphStateSet.get(), overlayData._textureFrustum); - + // push the stateset. // cv->pushStateSet(_mainSubgraphStateSet.get()); @@ -1391,11 +1391,11 @@ void OverlayNode::traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVis Group::traverse(nv); return; } - + OverlayData& overlayData = *getOverlayData(cv); osg::Camera* camera = overlayData._camera.get(); - if (_overlaySubgraph.valid()) + if (_overlaySubgraph.valid()) { #if 0 @@ -1403,7 +1403,7 @@ void OverlayNode::traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVis { overlayData._geode = new osg::Geode; } -#endif +#endif // see if we are within a coordinate system node. osg::CoordinateSystemNode* csn = 0; osg::NodePath& nodePath = nv.getNodePath(); @@ -1421,19 +1421,19 @@ void OverlayNode::traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVis // push the stateset. cv->pushStateSet(overlayData._mainSubgraphStateSet.get()); - Group::traverse(nv); + Group::traverse(nv); cv->popStateSet(); osg::Matrix pm = *(cv->getProjectionMatrix()); - + double znear = cv->getCalculatedNearPlane(); double zfar = cv->getCalculatedFarPlane(); - + // OSG_NOTICE<<" before znear ="<setTextureUnit(_textureUnit); osg::StateSet* mainSubgraphStateSet = itr->second->_mainSubgraphStateSet.get(); - if (mainSubgraphStateSet) + if (mainSubgraphStateSet) { mainSubgraphStateSet->clear(); mainSubgraphStateSet->setTextureAttributeAndModes(_textureUnit, itr->second->_texture.get(), osg::StateAttribute::ON); @@ -1885,7 +1885,7 @@ void OverlayNode::updateMainSubgraphStateSet() mainSubgraphStateSet->setTextureMode(_textureUnit, GL_TEXTURE_GEN_R, osg::StateAttribute::ON); mainSubgraphStateSet->setTextureMode(_textureUnit, GL_TEXTURE_GEN_Q, osg::StateAttribute::ON); - if (_texEnvMode!=GL_NONE) + if (_texEnvMode!=GL_NONE) { mainSubgraphStateSet->setTextureAttribute(_textureUnit, new osg::TexEnv((osg::TexEnv::Mode)_texEnvMode)); } diff --git a/src/osgSim/ScalarBar.cpp b/src/osgSim/ScalarBar.cpp index 9d3291f63..0f0fba889 100644 --- a/src/osgSim/ScalarBar.cpp +++ b/src/osgSim/ScalarBar.cpp @@ -122,9 +122,9 @@ void ScalarBar::createDrawables() { // Remove any existing Drawables _drawables.erase(_drawables.begin(), _drawables.end()); - + if (_numColors==0) return; - + osg::Matrix matrix; if(_orientation==HORIZONTAL) { diff --git a/src/osgSim/Sector.cpp b/src/osgSim/Sector.cpp index 0088dfc5b..c9141d75b 100644 --- a/src/osgSim/Sector.cpp +++ b/src/osgSim/Sector.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -18,7 +18,7 @@ using namespace osgSim; // -// Elevation Range +// Elevation Range // void AzimRange::setAzimuthRange(float minAzimuth,float maxAzimuth,float fadeAngle) @@ -58,7 +58,7 @@ void AzimRange::getAzimuthRange(float& minAzimuth, float& maxAzimuth, float& fad // -// Elevation Range +// Elevation Range // void ElevationRange::setElevationRange(float minElevation,float maxElevation,float fadeAngle) { @@ -286,7 +286,7 @@ void DirectionalSector::setFadeAngle(float angle) float ang = acos(_cosHorizAngle)+angle ; if ( ang > osg::PI ) _cosHorizFadeAngle = -1.0 ; else _cosHorizFadeAngle = cos(ang); - + ang = acos(_cosVertAngle)+angle ; if ( ang > osg::PI ) _cosVertFadeAngle = -1.0 ; else _cosVertFadeAngle = cos(ang); @@ -298,15 +298,15 @@ float DirectionalSector::getFadeAngle() const } float DirectionalSector::operator() (const osg::Vec3& eyeLocal) const -{ +{ float elev_intensity, azim_intensity ; - + // Tranform eyeLocal into the LightPoint frame osg::Vec3 EPlp = _local_to_LP * eyeLocal ; - + /*fprintf(stderr, " eyeLocal = %f, %f, %f\n", eyeLocal[0], eyeLocal[1], eyeLocal[2]) ; fprintf(stderr, " EPlp = %f, %f, %f\n", EPlp[0], EPlp[1], EPlp[2]) ;*/ - + // Elevation check // Project EPlp into LP YZ plane and dot with LPy osg::Vec2 EPyz(EPlp[1], EPlp[2]) ; @@ -330,7 +330,7 @@ float DirectionalSector::operator() (const osg::Vec3& eyeLocal) const //fprintf(stderr, " >> fully inside el range\n") ; } // Elevation check passed - + // Azimuth check // Project EPlp into LP XY plane and dot with LPy osg::Vec2 EPxy(EPlp[0], EPlp[1]) ; @@ -356,7 +356,7 @@ float DirectionalSector::operator() (const osg::Vec3& eyeLocal) const azim_intensity = 1.0 ; } // Azimuth check passed - + // We're good! Return full intensity //fprintf(stderr, " %%%% Returing intensity = %f\n", elev_intensity * azim_intensity) ; return elev_intensity * azim_intensity ; diff --git a/src/osgSim/ShapeAttribute.cpp b/src/osgSim/ShapeAttribute.cpp index 3af4be0c0..c18f70cd8 100644 --- a/src/osgSim/ShapeAttribute.cpp +++ b/src/osgSim/ShapeAttribute.cpp @@ -35,7 +35,7 @@ ShapeAttribute::ShapeAttribute(const char * name, int value) : _type(INTEGER), _integer(value) {} - + ShapeAttribute::ShapeAttribute(const char * name, double value) : _name(name), _type(DOUBLE), @@ -53,16 +53,16 @@ ShapeAttribute::ShapeAttribute(const ShapeAttribute & sa) { copy(sa); } - - + + ShapeAttribute::~ShapeAttribute() { - free(); + free(); } void ShapeAttribute::free() { - if ((_type == STRING) && (_string)) + if ((_type == STRING) && (_string)) { ::free(_string); _string = 0; @@ -71,8 +71,8 @@ void ShapeAttribute::free() void ShapeAttribute::setValue(const char * value) { - free(); - _type = STRING; + free(); + _type = STRING; _string = (value ? strdup(value) : 0); } @@ -110,10 +110,10 @@ void ShapeAttribute::copy(const ShapeAttribute& sa) ShapeAttribute& ShapeAttribute::operator = (const ShapeAttribute& sa) { if (&sa == this) return *this; - + free(); copy(sa); - + return *this; } @@ -122,13 +122,13 @@ int ShapeAttribute::compare(const osgSim::ShapeAttribute& sa) const { if (_namecompare(*salIt)) != 0) return ret; - + if ((ret = thisIt->compare(*salIt)) != 0) return ret; + return 0; } diff --git a/src/osgSim/SphereSegment.cpp b/src/osgSim/SphereSegment.cpp index 4446abf81..fdb4f87d1 100644 --- a/src/osgSim/SphereSegment.cpp +++ b/src/osgSim/SphereSegment.cpp @@ -229,7 +229,7 @@ protected: //getOrCreateStateSet()->setAttributeAndModes(new osg::LineWidth(2.0),osg::StateAttribute::OFF); } - + virtual osg::BoundingBox computeBound() const; private: @@ -304,7 +304,7 @@ void SphereSegment::setArea(const osg::Vec3& v, float azRange, float elevRange) _elevMin = elev - elevRange; _elevMax = elev + elevRange; - // Calculate the azimuth range, cater for trig ambiguities + // Calculate the azimuth range, cater for trig ambiguities float az = atan2(vec.x(), vec.y()); azRange /= 2.0f; @@ -908,7 +908,7 @@ struct ActivateTransparencyOnType } const std::type_info& _t; - + protected: ActivateTransparencyOnType& operator = (const ActivateTransparencyOnType&) { return *this; } @@ -930,7 +930,7 @@ struct DeactivateTransparencyOnType } const std::type_info& _t; - + protected: DeactivateTransparencyOnType& operator = (const DeactivateTransparencyOnType&) { return *this; } @@ -983,10 +983,10 @@ void SphereSegment::setAllColors(const osg::Vec4& c) class PolytopeVisitor : public osg::NodeVisitor { public: - + typedef std::pair MatrixPolytopePair; typedef std::vector PolytopeStack; - + struct Hit { Hit(const osg::Matrix& matrix, osg::NodePath& nodePath, osg::Drawable* drawable): @@ -998,7 +998,7 @@ class PolytopeVisitor : public osg::NodeVisitor osg::NodePath _nodePath; osg::ref_ptr _drawable; }; - + typedef std::vector HitList; @@ -1009,7 +1009,7 @@ class PolytopeVisitor : public osg::NodeVisitor _polytopeStack.back().first = matrix; _polytopeStack.back().second.setAndTransformProvidingInverse(polytope, _polytopeStack.back().first); } - + META_NodeVisitor("osgSim","PolytopeVisitor") void reset() @@ -1017,7 +1017,7 @@ class PolytopeVisitor : public osg::NodeVisitor _polytopeStack.clear(); _hits.clear(); } - + void apply(osg::Node& node) { if (_polytopeStack.back().second.contains(node.getBound())) @@ -1034,13 +1034,13 @@ class PolytopeVisitor : public osg::NodeVisitor osg::Matrix matrix = _polytopeStack.back().first; transform.computeLocalToWorldMatrix(matrix, this); - + _polytopeStack.push_back(MatrixPolytopePair()); _polytopeStack.back().first = matrix; _polytopeStack.back().second.setAndTransformProvidingInverse(polytope, matrix); traverse(transform); - + _polytopeStack.back(); } } @@ -1057,7 +1057,7 @@ class PolytopeVisitor : public osg::NodeVisitor } } - + traverse(node); } } @@ -1065,7 +1065,7 @@ class PolytopeVisitor : public osg::NodeVisitor HitList& getHits() { return _hits; } protected: - + PolytopeStack _polytopeStack; HitList _hits; @@ -1075,21 +1075,21 @@ class PolytopeVisitor : public osg::NodeVisitor SphereSegment::LineList SphereSegment::computeIntersection(const osg::Matrixd& transform, osg::Node* subgraph) { OSG_INFO<<"Creating line intersection between sphere segment and subgraph."<accept(polytopeVisitor); if (polytopeVisitor.getHits().empty()) @@ -1111,7 +1111,7 @@ SphereSegment::LineList SphereSegment::computeIntersection(const osg::Matrixd& t SphereSegment::LineList lines = computeIntersection(itr->_matrix, itr->_drawable.get()); all_lines.insert(all_lines.end(), lines.begin(), lines.end()); } - + // join all the lines that have ends that are close together.. return all_lines; @@ -1120,21 +1120,21 @@ SphereSegment::LineList SphereSegment::computeIntersection(const osg::Matrixd& t osg::Node* SphereSegment::computeIntersectionSubgraph(const osg::Matrixd& transform, osg::Node* subgraph) { OSG_INFO<<"Creating line intersection between sphere segment and subgraph."<accept(polytopeVisitor); if (polytopeVisitor.getHits().empty()) @@ -1155,7 +1155,7 @@ osg::Node* SphereSegment::computeIntersectionSubgraph(const osg::Matrixd& transf { group->addChild(computeIntersectionSubgraph(itr->_matrix, itr->_drawable.get())); } - + // join all the lines that have ends that are close together.. return group; @@ -1188,7 +1188,7 @@ namespace SphereSegmentIntersector VertexArray& _vertices; protected: - + SortFunctor& operator = (const SortFunctor&) { return *this; } }; @@ -1375,7 +1375,7 @@ namespace SphereSegmentIntersector double azimRange = (azimMax-azimMin)*0.5; double rad2 = vertex.length2(); - double length_xy = sqrtf(vertex.x()*vertex.x() + vertex.y()*vertex.y()); + double length_xy = sqrtf(vertex.x()*vertex.x() + vertex.y()*vertex.y()); double elevation = atan2((double)vertex.z(),length_xy); // radius surface @@ -1494,7 +1494,7 @@ namespace SphereSegmentIntersector // if all the vertices on all the sides and inside then we are completely inside if (_inside_radiusSurface==_numVertices && _inside_leftRightSurfaces==_numVertices && - _inside_topSurface==_numVertices && + _inside_topSurface==_numVertices && _inside_bottomSurface==_numVertices) return Region::INSIDE; return Region::INTERSECTS; @@ -1512,8 +1512,8 @@ namespace SphereSegmentIntersector // if all the vertices on all the sides and inside then we are completely inside if ((surfaceType!=RADIUS_SURFACE && _inside_radiusSurface!=0) && (surfaceType!=LEFT_SURFACE && _inside_leftSurface!=0) && - (surfaceType!=RIGHT_SURFACE && _inside_rightSurface!=0) && - (surfaceType!=TOP_SURFACE && _inside_topSurface!=0) && + (surfaceType!=RIGHT_SURFACE && _inside_rightSurface!=0) && + (surfaceType!=TOP_SURFACE && _inside_topSurface!=0) && (surfaceType!=BOTTOM_SURFACE && _inside_bottomSurface!=0)) return false; return true; @@ -1574,7 +1574,7 @@ namespace SphereSegmentIntersector EdgeSet _edges; osg::Vec3 _centre; - double _radius; + double _radius; double _azMin, _azMax, _elevMin, _elevMax; unsigned int _numOutside; @@ -1614,7 +1614,7 @@ namespace SphereSegmentIntersector if (classification==Region::OUTSIDE) { ++_numOutside; - return; + return; } if (rc.numberOfIntersectingSurfaces()==0) @@ -1789,7 +1789,7 @@ namespace SphereSegmentIntersector EdgeSet::iterator itr = _edges.find(edge); if (itr==_edges.end()) { - edge->addTriangle(tri); + edge->addTriangle(tri); _edges.insert(edge); return edge.get(); } @@ -1996,7 +1996,7 @@ namespace SphereSegmentIntersector } - // handle a paired of surfaces that work to enclose a convex region, which means that + // handle a paired of surfaces that work to enclose a convex region, which means that // points can be inside either surface to be valid, and be outside both surfaces to be invalid. template void trim(SphereSegment::LineList& lineList, osg::Vec3Array* sourceLine, I intersector1, I intersector2) @@ -2076,7 +2076,7 @@ namespace SphereSegmentIntersector possible1 = true; possible2 = false; } - else + else { OSG_INFO<<"start point, 2 near to end than 1"<size()-1; _distance = distance; } - } + } } }; @@ -2335,7 +2335,7 @@ namespace SphereSegmentIntersector while (unfusedLines.size()>=1) { - // generate a set of line pairs to establish which + // generate a set of line pairs to establish which // line pair has the minimum distance. typedef std::multiset LinePairSet; LinePairSet linePairs; @@ -2352,7 +2352,7 @@ namespace SphereSegmentIntersector linePairs.insert(linePair); } } - + if (linePairs.empty()) { OSG_INFO<<"Line Pairs empty"<push_back((*line1)[i]); @@ -2441,7 +2441,7 @@ namespace SphereSegmentIntersector // copy across from the next point in from fuseEnd2 to the openEnd2. for(int j=fuseEnd2 + direction2; - j != openEnd2 + direction2; + j != openEnd2 + direction2; j += direction2) { newline->push_back((*line2)[j]); @@ -2470,7 +2470,7 @@ namespace SphereSegmentIntersector _generatedLines = fusedLines; _generatedLines.insert(_generatedLines.end(), unfusedLines.begin(), unfusedLines.end()); - } + } } }; @@ -2555,7 +2555,7 @@ namespace SphereSegmentIntersector { double div = d2-d1; - if (div==0.0) + if (div==0.0) { edge->_intersectionType = TriangleIntersectOperator::Edge::NO_INTERSECTION; return false; @@ -2586,7 +2586,7 @@ namespace SphereSegmentIntersector double d2 = _plane.distance(v2); double div = d2-d1; - if (div==0.0) + if (div==0.0) { return v1; } @@ -2602,9 +2602,9 @@ namespace SphereSegmentIntersector { return _lowerOutside ? _plane.distance(v) : -_plane.distance(v) ; } - + protected: - + AzimPlaneIntersector& operator = (const AzimPlaneIntersector&) { return *this; } }; @@ -2743,9 +2743,9 @@ namespace SphereSegmentIntersector return _lowerOutside ? computedElev-_elev : _elev-computedElev ; } - + protected: - + ElevationIntersector& operator = (const ElevationIntersector&) { return *this; } }; @@ -2875,7 +2875,7 @@ namespace SphereSegmentIntersector protected: - + RadiusIntersector& operator = (const RadiusIntersector&) { return *this; } }; @@ -2888,14 +2888,14 @@ SphereSegment::LineList SphereSegment::computeIntersection(const osg::Matrixd& m // cast to Geometry, return empty handed if Drawable not a Geometry. osg::Geometry* geometry = dynamic_cast(drawable); if (!geometry) return SphereSegment::LineList(); - + // get vertices from geometry, return empty handed if a Vec3Array not present. osg::Vec3Array* vertices = dynamic_cast(geometry->getVertexArray()); if (!vertices) return SphereSegment::LineList(); - + typedef osg::TriangleIndexFunctor TriangleIntersectFunctor; TriangleIntersectFunctor tif; - + tif._centre = _centre; tif._radius = _radius; tif._azMin = _azMin; @@ -2904,10 +2904,10 @@ SphereSegment::LineList SphereSegment::computeIntersection(const osg::Matrixd& m tif._elevMax = _elevMax; tif.computePositionAndRegions(matrix, *vertices); - + // traverse the triangles in the Geometry dedicating intersections geometry->accept(tif); - + OSG_INFO<<"_numOutside = "<set(_filterMatrix); } @@ -96,7 +96,7 @@ void GeometryTechnique::setFilterMatrixAs(FilterType filterType) void GeometryTechnique::init(int dirtyMask, bool assumeMultiThreaded) { OSG_INFO<<"Doing GeometryTechnique::init()"< lock(_writeBufferMutex); @@ -161,14 +161,14 @@ Locator* GeometryTechnique::computeMasterLocator() Locator* elevationLocator = elevationLayer ? elevationLayer->getLocator() : 0; Locator* colorLocator = colorLayer ? colorLayer->getLocator() : 0; - + Locator* masterLocator = elevationLocator ? elevationLocator : colorLocator; if (!masterLocator) { OSG_NOTICE<<"Problem, no locator found in any of the terrain layers"<getLocator() : 0; Locator* colorLocator = colorLayer ? colorLayer->getLocator() : 0; - + if (!elevationLocator) elevationLocator = masterLocator; if (!colorLocator) colorLocator = masterLocator; osg::Vec3d bottomLeftNDC(DBL_MAX, DBL_MAX, 0.0); osg::Vec3d topRightNDC(-DBL_MAX, -DBL_MAX, 0.0); - + if (elevationLayer) { if (elevationLocator!= masterLocator) @@ -226,9 +226,9 @@ osg::Vec3d GeometryTechnique::computeCenterModel(BufferData& buffer, Locator* ma osg::Vec3d centerNDC = (bottomLeftNDC + topRightNDC)*0.5; osg::Vec3d centerModel = (bottomLeftNDC + topRightNDC)*0.5; masterLocator->convertLocalToModel(centerNDC, centerModel); - + buffer._transform->setMatrix(osg::Matrix::translate(centerModel)); - + return centerModel; } @@ -464,7 +464,7 @@ void VertexNormalGenerator::populateCenter(osgTerrain::Layer* elevationLayer, La if (elevationLayer) { float value = 0.0f; - if (sampled) validValue = elevationLayer->getInterpolatedValidValue(ndc.x(), ndc.y(), value); + if (sampled) validValue = elevationLayer->getInterpolatedValidValue(ndc.x(), ndc.y(), value); else validValue = elevationLayer->getValidValue(i,j,value); ndc.z() = value*_scaleHeight; } @@ -783,23 +783,23 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca { unsigned int originalNumColumns = numColumns; unsigned int originalNumRows = numRows; - + numColumns = std::max((unsigned int) (float(originalNumColumns)*sqrtf(sampleRatio)), minimumNumColumns); numRows = std::max((unsigned int) (float(originalNumRows)*sqrtf(sampleRatio)),minimumNumRows); } - - + + bool treatBoundariesToValidDataAsDefaultValue = _terrainTile->getTreatBoundariesToValidDataAsDefaultValue(); OSG_INFO<<"TreatBoundariesToValidDataAsDefaultValue="<(elevationLayer); - if (hfl && hfl->getHeightField()) + if (hfl && hfl->getHeightField()) { skirtHeight = hfl->getHeightField()->getSkirtHeight(); } - + bool createSkirt = skirtHeight != 0.0f; @@ -863,7 +863,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca // allocate and assign color osg::ref_ptr colors = new osg::Vec4Array(1); (*colors)[0].set(1.0f,1.0f,1.0f,1.0f); - + geometry->setColorArray(colors.get()); geometry->setColorBinding(osg::Geometry::BIND_OVERALL); @@ -1001,7 +1001,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca // OSG_NOTICE<<"smallTile = "< elements = smallTile ? + osg::ref_ptr elements = smallTile ? static_cast(new osg::DrawElementsUShort(GL_TRIANGLES)) : static_cast(new osg::DrawElementsUInt(GL_TRIANGLES)); @@ -1077,7 +1077,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca osg::ref_ptr vertices = VNG._vertices.get(); osg::ref_ptr normals = VNG._normals.get(); - osg::ref_ptr skirtDrawElements = smallTile ? + osg::ref_ptr skirtDrawElements = smallTile ? static_cast(new osg::DrawElementsUShort(GL_QUAD_STRIP)) : static_cast(new osg::DrawElementsUInt(GL_QUAD_STRIP)); @@ -1162,7 +1162,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca if (skirtDrawElements->getNumIndices()!=0) { geometry->addPrimitiveSet(skirtDrawElements.get()); - skirtDrawElements = smallTile ? + skirtDrawElements = smallTile ? static_cast(new osg::DrawElementsUShort(GL_QUAD_STRIP)) : static_cast(new osg::DrawElementsUInt(GL_QUAD_STRIP)); } @@ -1204,7 +1204,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca if (skirtDrawElements->getNumIndices()!=0) { geometry->addPrimitiveSet(skirtDrawElements.get()); - skirtDrawElements = smallTile ? + skirtDrawElements = smallTile ? static_cast(new osg::DrawElementsUShort(GL_QUAD_STRIP)) : static_cast(new osg::DrawElementsUInt(GL_QUAD_STRIP)); } @@ -1287,7 +1287,7 @@ void GeometryTechnique::applyColorLayers(BufferData& buffer) { typedef std::map LayerToTextureMap; LayerToTextureMap layerToTextureMap; - + for(unsigned int layerNum=0; layerNum<_terrainTile->getNumColorLayers(); ++layerNum) { osgTerrain::Layer* colorLayer = _terrainTile->getColorLayer(layerNum); @@ -1296,7 +1296,7 @@ void GeometryTechnique::applyColorLayers(BufferData& buffer) osgTerrain::SwitchLayer* switchLayer = dynamic_cast(colorLayer); if (switchLayer) { - if (switchLayer->getActiveLayer()<0 || + if (switchLayer->getActiveLayer()<0 || static_cast(switchLayer->getActiveLayer())>=switchLayer->getNumLayers()) { continue; @@ -1351,7 +1351,7 @@ void GeometryTechnique::applyColorLayers(BufferData& buffer) } stateset->setTextureAttributeAndModes(layerNum, texture2D, osg::StateAttribute::ON); - + } else if (contourLayer) { @@ -1368,7 +1368,7 @@ void GeometryTechnique::applyColorLayers(BufferData& buffer) layerToTextureMap[colorLayer] = texture1D; } - + stateset->setTextureAttributeAndModes(layerNum, texture1D, osg::StateAttribute::ON); } @@ -1477,7 +1477,7 @@ void GeometryTechnique::traverse(osg::NodeVisitor& nv) } - if (_terrainTile->getDirty()) + if (_terrainTile->getDirty()) { OSG_INFO<<"******* Doing init ***********"<init(_terrainTile->getDirtyMask(), false); diff --git a/src/osgTerrain/Layer.cpp b/src/osgTerrain/Layer.cpp index dd074ee97..b387131d7 100644 --- a/src/osgTerrain/Layer.cpp +++ b/src/osgTerrain/Layer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,14 +25,14 @@ void osgTerrain::extractSetNameAndFileName(const std::string& compoundstring, st filename = compoundstring; return; } - + if (compoundstring.size()==4) { setname = ""; filename = ""; return; } - + std::string::size_type secondcolonpos = compoundstring.find_first_of(':', setcolonpos+4); if (secondcolonpos==std::string::npos) { @@ -78,7 +78,7 @@ osg::BoundingSphere Layer::computeBound(bool treatAsElevationLayer) const { osg::BoundingSphere bs; if (!getLocator()) return bs; - + if (treatAsElevationLayer) { osg::BoundingBox bb; @@ -90,10 +90,10 @@ osg::BoundingSphere Layer::computeBound(bool treatAsElevationLayer) const { float value = 0.0f; bool validValue = getValidValue(c,r, value); - if (validValue) + if (validValue) { osg::Vec3d ndc, v; - ndc.x() = ((double)c)/(double)(numColumns-1), + ndc.x() = ((double)c)/(double)(numColumns-1), ndc.y() = ((double)r)/(double)(numRows-1); ndc.z() = value; @@ -108,7 +108,7 @@ osg::BoundingSphere Layer::computeBound(bool treatAsElevationLayer) const } else { - + osg::Vec3d v; if (getLocator()->convertLocalToModel(osg::Vec3d(0.5,0.5,0.0), v)) { @@ -121,7 +121,7 @@ osg::BoundingSphere Layer::computeBound(bool treatAsElevationLayer) const } } - + return bs; } @@ -146,7 +146,7 @@ void ImageLayer::setImage(osg::Image* image) _image = image; } -template +template void _processRow(unsigned int num, GLenum pixelFormat, T* data,const O& operation) { switch(pixelFormat) @@ -161,7 +161,7 @@ void _processRow(unsigned int num, GLenum pixelFormat, T* data,const O& operatio } } -template +template void processRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned char* data, const O& operation) { switch(dataType) @@ -176,11 +176,11 @@ void processRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned } } -template +template void processImage(osg::Image* image, const O& operation) { if (!image) return; - + for(int r=0;rr();++r) { for(int t=0;tt();++t) @@ -203,7 +203,7 @@ struct TransformOperator inline void operator() (short& v) const { v = (short)(_offset + (float)v * _scale); } inline void operator() (int& v) const { v = (int)(_offset + (float)v * _scale); } inline void operator() (float& v) const { v = _offset + v * _scale; } - + float _offset, _scale; }; @@ -215,7 +215,7 @@ bool ImageLayer::transform(float offset, float scale) OSG_INFO<<"ImageLayer::transform("<data(i,j); switch(_image->getDataType()) { - case(GL_BYTE): - value = *((const char*)data); + case(GL_BYTE): + value = *((const char*)data); // OSG_NOTICE<<"byte "<getFloatArray(); if (!heights) return false; - + OSG_INFO<<"HeightFieldLayer::transform("<begin(); @@ -446,7 +446,7 @@ bool HeightFieldLayer::transform(float offset, float scale) { *itr = offset + (*itr) * scale; } - + dirty(); return true; @@ -613,7 +613,7 @@ void CompositeLayer::setCompoundName(unsigned int i, const std::string& compound std::string setname; std::string filename; extractSetNameAndFileName(compoundname, setname, filename); - + _layers[i].setname = setname; _layers[i].filename = filename; } diff --git a/src/osgTerrain/Locator.cpp b/src/osgTerrain/Locator.cpp index 194bec5d4..cb403df97 100644 --- a/src/osgTerrain/Locator.cpp +++ b/src/osgTerrain/Locator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -51,7 +51,7 @@ void Locator::setTransformAsExtents(double minX, double minY, double maxX, doubl _transform.set(maxX-minX, 0.0, 0.0, 0.0, 0.0, maxY-minY, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, - minX, minY, 0.0, 1.0); + minX, minY, 0.0, 1.0); _inverse.invert(_transform); } @@ -101,7 +101,7 @@ bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::V topRight.x() = osg::maximum( topRight.x(), itr->x()); topRight.y() = osg::maximum( topRight.y(), itr->y()); } - + return true; } @@ -117,22 +117,22 @@ bool Locator::convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) co case(GEOCENTRIC): { osg::Vec3d geographic = local * _transform; - + _ellipsoidModel->convertLatLongHeightToXYZ(geographic.y(), geographic.x(), geographic.z(), world.x(), world.y(), world.z()); - return true; + return true; } case(GEOGRAPHIC): - { + { world = local * _transform; - return true; + return true; } case(PROJECTED): - { + { world = local * _transform; - return true; + return true; } - } + } return false; } @@ -142,7 +142,7 @@ bool Locator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) co switch(_coordinateSystemType) { case(GEOCENTRIC): - { + { double longitude, latitude, height; _ellipsoidModel->convertXYZToLatLongHeight(world.x(), world.y(), world.z(), @@ -150,20 +150,20 @@ bool Locator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) co local = osg::Vec3d(longitude, latitude, height) * _inverse; - return true; + return true; } case(GEOGRAPHIC): - { + { local = world * _inverse; - return true; + return true; } case(PROJECTED): - { + { local = world * _inverse; - return true; + return true; } - } + } return false; } diff --git a/src/osgTerrain/Terrain.cpp b/src/osgTerrain/Terrain.cpp index ee84c0f8d..e77f575a8 100644 --- a/src/osgTerrain/Terrain.cpp +++ b/src/osgTerrain/Terrain.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -129,7 +129,7 @@ TerrainTile* Terrain::getTile(const TileID& tileID) TerrainTileMap::iterator itr = _terrainTileMap.find(tileID); if (itr == _terrainTileMap.end()) return 0; - + return itr->second; } @@ -139,7 +139,7 @@ const TerrainTile* Terrain::getTile(const TileID& tileID) const TerrainTileMap::const_iterator itr = _terrainTileMap.find(tileID); if (itr == _terrainTileMap.end()) return 0; - + return itr->second; } @@ -184,7 +184,7 @@ void Terrain::unregisterTerrainTile(TerrainTile* tile) { _terrainTileMap.erase(tile->getTileID()); } - + _terrainTileSet.erase(tile); _updateTerrainTileSet.erase(tile); diff --git a/src/osgTerrain/TerrainTechnique.cpp b/src/osgTerrain/TerrainTechnique.cpp index b91be930b..f79fd4ff8 100644 --- a/src/osgTerrain/TerrainTechnique.cpp +++ b/src/osgTerrain/TerrainTechnique.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -119,8 +119,8 @@ void TerrainTechnique::traverse(osg::NodeVisitor& nv) { update(uv); return; - } - + } + } else if (nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR) { diff --git a/src/osgTerrain/TerrainTile.cpp b/src/osgTerrain/TerrainTile.cpp index 4754925bf..47ff2178a 100644 --- a/src/osgTerrain/TerrainTile.cpp +++ b/src/osgTerrain/TerrainTile.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -78,7 +78,7 @@ TerrainTile::TerrainTile(const TerrainTile& terrain,const osg::CopyOp& copyop): _treatBoundariesToValidDataAsDefaultValue(terrain._treatBoundariesToValidDataAsDefaultValue), _blendingPolicy(terrain._blendingPolicy) { - if (terrain.getTerrainTechnique()) + if (terrain.getTerrainTechnique()) { setTerrainTechnique(dynamic_cast(terrain.getTerrainTechnique()->cloneType())); } @@ -97,9 +97,9 @@ TerrainTile::~TerrainTile() void TerrainTile::setTerrain(Terrain* ts) { if (_terrain == ts) return; - + if (_terrain) _terrain->unregisterTerrainTile(this); - + _terrain = ts; if (_terrain) _terrain->registerTerrainTile(this); @@ -131,7 +131,7 @@ void TerrainTile::traverse(osg::NodeVisitor& nv) ++itr) { osgTerrain::Terrain* ts = dynamic_cast(*itr); - if (ts) + if (ts) { OSG_INFO<<"Assigning terrain system "<getTerrainTechniquePrototype()) - { + { osg::ref_ptr object = _terrain->getTerrainTechniquePrototype()->clone(osg::CopyOp::DEEP_COPY_ALL); setTerrainTechnique(dynamic_cast(object.get())); } @@ -187,23 +187,23 @@ void TerrainTile::init(int dirtyMask, bool assumeMultiThreaded) void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique) { - if (_terrainTechnique == terrainTechnique) return; + if (_terrainTechnique == terrainTechnique) return; int dirtyDelta = (_dirtyMask==NOT_DIRTY) ? 0 : -1; - if (_terrainTechnique.valid()) + if (_terrainTechnique.valid()) { _terrainTechnique->setTerrainTile(0); } _terrainTechnique = terrainTechnique; - - if (_terrainTechnique.valid()) + + if (_terrainTechnique.valid()) { _terrainTechnique->setTerrainTile(this); - ++dirtyDelta; + ++dirtyDelta; } - + if (dirtyDelta>0) setDirtyMask(ALL_DIRTY); else if (dirtyDelta<0) setDirtyMask(NOT_DIRTY); } @@ -248,14 +248,14 @@ void TerrainTile::setElevationLayer(Layer* layer) void TerrainTile::setColorLayer(unsigned int i, Layer* layer) { if (_colorLayers.size() <= i) _colorLayers.resize(i+1); - + _colorLayers[i] = layer; } osg::BoundingSphere TerrainTile::computeBound() const { osg::BoundingSphere bs; - + if (_elevationLayer.valid()) { bs.expandBy(_elevationLayer->computeBound(true)); @@ -269,7 +269,7 @@ osg::BoundingSphere TerrainTile::computeBound() const if (itr->valid()) bs.expandBy((*itr)->computeBound(false)); } } - + return bs; } @@ -300,7 +300,7 @@ bool WhiteListTileLoadedCallback::layerAcceptable(const std::string& setname) co bool WhiteListTileLoadedCallback::readImageLayer(osgTerrain::ImageLayer* imageLayer, const osgDB::ReaderWriter::Options* options) const { - if (!imageLayer->getImage() && + if (!imageLayer->getImage() && !imageLayer->getFileName().empty()) { if (layerAcceptable(imageLayer->getSetName())) @@ -340,8 +340,8 @@ void WhiteListTileLoadedCallback::loaded(osgTerrain::TerrainTile* tile, const os if (imageLayer) { if (readImageLayer(imageLayer, options)) - { - // replace SwitchLayer by + { + // replace SwitchLayer by if (_replaceSwitchLayer) tile->setColorLayer(i, imageLayer); else if (switchLayer->getActiveLayer()<0) switchLayer->setActiveLayer(si); diff --git a/src/osgTerrain/Version.cpp b/src/osgTerrain/Version.cpp index 87a791e13..5ab52e3a6 100644 --- a/src/osgTerrain/Version.cpp +++ b/src/osgTerrain/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgText/DefaultFont.cpp b/src/osgText/DefaultFont.cpp index 8fafbf554..87ca39322 100644 --- a/src/osgText/DefaultFont.cpp +++ b/src/osgText/DefaultFont.cpp @@ -1,16 +1,16 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY{ } without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -61,9 +61,9 @@ osgText::Glyph* DefaultFont::getGlyph(const FontResolution& fontRes, unsigned in } // new find the glyph for the required charcode. - GlyphMap& glyphmap = itr->second; + GlyphMap& glyphmap = itr->second; GlyphMap::iterator gitr = glyphmap.find(charcode); - + if (gitr!=glyphmap.end()) return gitr->second.get(); else return 0; } @@ -180,23 +180,23 @@ void DefaultFont::constructGlyphs() {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x49, 0x31, 0x00, 0x00}, {0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x00} }; - + unsigned int sourceWidth = 8; unsigned int sourceHeight = 12; - + FontResolution fontRes(sourceWidth,sourceHeight); // populate the glyph mp for(unsigned int i=32;i<127;i++) { osg::ref_ptr glyph = new Glyph(this, i); - + unsigned int dataSize = sourceWidth*sourceHeight; unsigned char* data = new unsigned char[dataSize]; // clear the image to zeros. for(unsigned char* p=data;psetImage(sourceWidth,sourceHeight,1, GL_ALPHA, GL_ALPHA,GL_UNSIGNED_BYTE, @@ -216,7 +216,7 @@ void DefaultFont::constructGlyphs() (*data++)=((*ptr)&128)?value_on:value_off; (*data++)=((*ptr)&64)?value_on:value_off; (*data++)=((*ptr)&32)?value_on:value_off; - (*data++)=((*ptr)&16)?value_on:value_off; + (*data++)=((*ptr)&16)?value_on:value_off; (*data++)=((*ptr)&8)?value_on:value_off; (*data++)=((*ptr)&4)?value_on:value_off; (*data++)=((*ptr)&2)?value_on:value_off; diff --git a/src/osgText/FadeText.cpp b/src/osgText/FadeText.cpp index 2dd44566e..206ff8a01 100644 --- a/src/osgText/FadeText.cpp +++ b/src/osgText/FadeText.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,12 +25,12 @@ struct FadeTextData : public osg::Referenced FadeTextData(FadeText* fadeText=0): _fadeText(fadeText), _visible(true) {} - + bool operator < (const FadeTextData& rhs) const { return _fadeText < rhs._fadeText; - } - + } + double getNearestZ() const { double nearestZ = _vertices[0].z(); @@ -58,15 +58,15 @@ struct FadeTextPolytopeData : public FadeTextData, public osg::Polytope _referenceVertexList.push_back(_vertices[2]); _referenceVertexList.push_back(_vertices[3]); } - + void addEdgePlane(const osg::Vec3& corner, const osg::Vec3& edge) { osg::Vec3 normal( edge.y(), -edge.x(), 0.0f); normal.normalize(); - + add(osg::Plane(normal, corner)); } - + void buildPolytope() { osg::Vec3d edge01 = _vertices[1] - _vertices[0]; @@ -82,7 +82,7 @@ struct FadeTextPolytopeData : public FadeTextData, public osg::Polytope add(osg::Plane( osg::Vec3d(0.0f,0.0f,0.0f), _vertices[1], _vertices[2])); add(osg::Plane( osg::Vec3d(0.0f,0.0f,0.0f), _vertices[2], _vertices[3])); add(osg::Plane( osg::Vec3d(0.0f,0.0f,0.0f), _vertices[3], _vertices[0])); - + #if 0 OSG_NOTICE<<" normalFrontFace = "<& vertices) { for(std::vector::const_iterator itr = vertices.begin(); @@ -118,7 +118,7 @@ struct FadeTextPolytopeData : public FadeTextData, public osg::Polytope } return false; } - + }; struct FadeTextUserData : public osg::Referenced @@ -144,11 +144,11 @@ struct GlobalFadeText : public osg::Referenced { } - + FadeTextUserData* createNewFadeTextUserData(osg::View* view) { OpenThreads::ScopedLock lock(_mutex); - + FadeTextUserData* userData = new FadeTextUserData; if (!userData) @@ -158,20 +158,20 @@ struct GlobalFadeText : public osg::Referenced } _viewMap[view].insert(userData); - + return userData; } - - + + void update(unsigned int frameNumber) { _frameNumber = frameNumber; - + for(GlobalFadeText::ViewUserDataMap::iterator vitr = _viewMap.begin(); vitr != _viewMap.end(); ++vitr) { - + osg::View* view = vitr->first; FadeTextSet& fadeTextSet = _viewFadeTextMap[view]; @@ -184,7 +184,7 @@ struct GlobalFadeText : public osg::Referenced ++uitr) { FadeTextUserData* userData = uitr->get(); - + int frameDelta = frameNumber - userData->_frameNumber; if (frameDelta<=1) { @@ -194,7 +194,7 @@ struct GlobalFadeText : public osg::Referenced { FadeTextData& fadeTextData = *fitr; if (fadeTextSet.count(fadeTextData._fadeText)==0) - { + { fadeTextSet.insert(fadeTextData._fadeText); fadeTextPolytopeMap.insert(FadeTextPolytopeMap::value_type( -fadeTextData.getNearestZ(), new FadeTextPolytopeData(fadeTextData))); @@ -203,14 +203,14 @@ struct GlobalFadeText : public osg::Referenced } } - // for each FadeTexPoltopeData + // for each FadeTexPoltopeData // create polytopes // test against all FTPD's later in the list // test all control points on FTPD against each plane of the current polytope // if all control points removed or outside then discard FTPD and make FT visible = false; - - FadeTextPolytopeMap::iterator outer_itr = fadeTextPolytopeMap.begin(); - while (outer_itr != fadeTextPolytopeMap.end()) + + FadeTextPolytopeMap::iterator outer_itr = fadeTextPolytopeMap.begin(); + while (outer_itr != fadeTextPolytopeMap.end()) { FadeTextPolytopeMap::iterator inner_itr = outer_itr; ++inner_itr; @@ -225,7 +225,7 @@ struct GlobalFadeText : public osg::Referenced while(inner_itr != fadeTextPolytopeMap.end()) { FadeTextPolytopeData& inner_ftpm = *(inner_itr->second); - + // OSG_NOTICE<<"Inner z "<(drawable); if (!fadeText) return; - + unsigned int frameNumber = nv->getFrameStamp()->getFrameNumber(); GlobalFadeText* gft = getGlobalFadeText(); gft->updateIfRequired(frameNumber); - + osgText::FadeText::ViewBlendColourMap& vbcm = fadeText->getViewBlendColourMap(); _ftd._fadeText = fadeText; - + float fadeSpeed = fadeText->getFadeSpeed(); GlobalFadeText::ViewFadeTextMap& vftm = gft->_viewFadeTextMap; @@ -361,9 +361,9 @@ void FadeText::drawImplementation(osg::RenderInfo& renderInfo) const { Text::drawImplementation(*renderInfo.getState(), osg::Vec4(1.0f,1.0f,1.0f,1.0f) ); } - - // now pass on new details + + // now pass on new details FadeTextUserData* userData = dynamic_cast(renderInfo.getUserData()); if (!userData) @@ -396,19 +396,19 @@ void FadeText::drawImplementation(osg::RenderInfo& renderInfo) const osgText::Text::AutoTransformCache& atc = _autoTransformCache[renderInfo.getContextID()]; - + osg::Matrix lmv = atc._matrix; lmv.postMult(state.getModelViewMatrix()); - + if (renderInfo.getView() && renderInfo.getView()->getCamera()) { // move from camera into the view space. lmv.postMult(state.getInitialInverseViewMatrix()); lmv.postMult(renderInfo.getView()->getCamera()->getViewMatrix()); } - + FadeTextData ftd(const_cast(this)); - + ftd._vertices[0].set(osg::Vec3d(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*lmv); ftd._vertices[1].set(osg::Vec3d(_textBB.xMax(),_textBB.yMin(),_textBB.zMin())*lmv); ftd._vertices[2].set(osg::Vec3d(_textBB.xMax(),_textBB.yMax(),_textBB.zMin())*lmv); diff --git a/src/osgText/Font.cpp b/src/osgText/Font.cpp index 5aafb33b1..2426ffdd5 100644 --- a/src/osgText/Font.cpp +++ b/src/osgText/Font.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -75,8 +75,8 @@ std::string osgText::findFontFile(const std::string& str) winFontPath += "\\fonts"; s_FontFilePath.push_back(winFontPath); } - #elif defined(__APPLE__) - osgDB::convertStringPathIntoFilePathList( + #elif defined(__APPLE__) + osgDB::convertStringPathIntoFilePathList( ".:/usr/share/fonts/ttf:/usr/share/fonts/ttf/western:/usr/share/fonts/ttf/decoratives:/Library/Fonts:/System/Library/Fonts", s_FontFilePath); #else @@ -103,7 +103,7 @@ std::string osgText::findFontFile(const std::string& str) } // Not found, return empty string - OSG_INFO<<"Warning: font file \""< lock(getFontFileMutex()); osg::ref_ptr localOptions; @@ -156,7 +156,7 @@ osgText::Font* osgText::readFontStream(std::istream& stream, const osgDB::Reader return 0; } if (!rr.validObject()) return 0; - + osg::Object *object = rr.takeObject(); // if the object is a font then return it. @@ -175,7 +175,7 @@ osg::ref_ptr osgText::readRefFontFile(const std::string& filename, const o std::string foundFile = findFontFile(filename); if (foundFile.empty()) foundFile = filename; - + OpenThreads::ScopedLock lock(getFontFileMutex()); osg::ref_ptr localOptions; @@ -215,7 +215,7 @@ osg::ref_ptr osgText::readRefFontStream(std::istream& stream, const osgDB: return 0; } if (!rr.validObject()) return 0; - + // if the object is a font then return it. osgText::Font* font = dynamic_cast(rr.getObject()); if (font) return osg::ref_ptr(font); @@ -322,7 +322,7 @@ unsigned int Font::getTextureWidthHint() const unsigned int Font::getTextureHeightHint() const { return _textureHeightHint; -} +} void Font::setMinFilterHint(osg::Texture::FilterMode mode) @@ -354,7 +354,7 @@ Glyph* Font::getGlyph(const FontResolution& fontRes, unsigned int charcode) FontResolution fontResUsed(0,0); if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes; - + { OpenThreads::ScopedLock lock(_glyphMapMutex); FontSizeGlyphMap::iterator itr = _sizeGlyphMap.find(fontResUsed); @@ -396,7 +396,7 @@ Glyph3D* Font::getGlyph3D(unsigned int charcode) void Font::setThreadSafeRefUnref(bool threadSafe) { osg::Object::setThreadSafeRefUnref(threadSafe); - + if (_texenv.valid()) _texenv->setThreadSafeRefUnref(threadSafe); if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe); @@ -405,7 +405,7 @@ void Font::setThreadSafeRefUnref(bool threadSafe) ++itr) { (*itr)->setThreadSafeRefUnref(threadSafe); - } + } } void Font::resizeGLObjectBuffers(unsigned int maxSize) @@ -417,7 +417,7 @@ void Font::resizeGLObjectBuffers(unsigned int maxSize) ++itr) { (*itr)->resizeGLObjectBuffers(maxSize); - } + } } void Font::releaseGLObjects(osg::State* state) const @@ -430,7 +430,7 @@ void Font::releaseGLObjects(osg::State* state) const { (*itr)->releaseGLObjects(state); } - + // const_cast(this)->_glyphTextureList.clear(); // const_cast(this)->_sizeGlyphMap.clear(); } @@ -454,9 +454,9 @@ void Font::addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph* OpenThreads::ScopedLock lock(_glyphMapMutex); _sizeGlyphMap[fontRes][charcode]=glyph; - + int posX=0,posY=0; - + GlyphTexture* glyphTexture = 0; for(GlyphTextureList::iterator itr=_glyphTextureList.begin(); itr!=_glyphTextureList.end() && !glyphTexture; @@ -464,17 +464,17 @@ void Font::addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph* { if ((*itr)->getSpaceForGlyph(glyph,posX,posY)) glyphTexture = itr->get(); } - + if (glyphTexture) { //cout << " found space for texture "<addGlyph(glyph,posX,posY); - + } diff --git a/src/osgText/Glyph.cpp b/src/osgText/Glyph.cpp index 3120e72d4..93501fa6a 100644 --- a/src/osgText/Glyph.cpp +++ b/src/osgText/Glyph.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -39,7 +39,7 @@ GlyphTexture::GlyphTexture(): setWrap(WRAP_T, CLAMP_TO_EDGE); } -GlyphTexture::~GlyphTexture() +GlyphTexture::~GlyphTexture() { } @@ -56,7 +56,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY) { int maxAxis = std::max(glyph->s(), glyph->t()); int margin = _margin + (int)((float)maxAxis * _marginRatio); - + int width = glyph->s()+2*margin; int height = glyph->t()+2*margin; @@ -68,7 +68,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY) // record the position in which the texture will be stored. posX = _partUsedX+margin; - posY = _usedY+margin; + posY = _usedY+margin; // move used markers on. _partUsedX += width; @@ -76,7 +76,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY) return true; } - + // start an new row. if (width <= getTextureWidth() && height <= (getTextureHeight()-_partUsedY)) @@ -86,7 +86,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY) _usedY = _partUsedY; posX = _partUsedX+margin; - posY = _usedY+margin; + posY = _usedY+margin; // move used markers on. _partUsedX += width; @@ -121,7 +121,7 @@ void GlyphTexture::addGlyph(Glyph* glyph, int posX, int posY) void GlyphTexture::apply(osg::State& state) const { - // get the contextID (user defined ID of 0 upwards) for the + // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); @@ -152,7 +152,7 @@ void GlyphTexture::apply(osg::State& state) const // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); - + bool newTextureObject = (textureObject == 0); #if defined(OSG_GLES2_AVAILABLE) @@ -183,7 +183,7 @@ void GlyphTexture::apply(osg::State& state) const OSG_WARN<<" Please set OSG_MAX_TEXTURE_SIZE lenvironment variable to "<bind(); - + if (getTextureParameterDirty(contextID)) { applyTexParameters(GL_TEXTURE_2D,state); @@ -244,7 +244,7 @@ void GlyphTexture::apply(osg::State& state) const } - + static const GLubyte* s_renderer = 0; static bool s_subloadAllGlyphsTogether = false; if (!s_renderer) @@ -259,9 +259,9 @@ void GlyphTexture::apply(osg::State& state) const // subloading bugs by loading all at once. s_subloadAllGlyphsTogether = true; } - - if (s_renderer && - ((strstr((const char*)s_renderer,"Radeon")!=0) || + + if (s_renderer && + ((strstr((const char*)s_renderer,"Radeon")!=0) || (strstr((const char*)s_renderer,"RADEON")!=0) || (strstr((const char*)s_renderer,"ALL-IN-WONDER")!=0))) { @@ -310,7 +310,7 @@ void GlyphTexture::apply(osg::State& state) const } } else // just subload the new entries. - { + { // default way of subloading as required. //std::cout<<"subloading"<subload(); } } - + // clear the list since we have now subloaded them. glyphsWereSubloading.clear(); - + } else { @@ -352,7 +352,7 @@ void GlyphTexture::apply(osg::State& state) const for( int s = 0; s < (*itr)->s(); s++ ) { int sindex = (t*(*itr)->s()+s); - int dindex = + int dindex = ((((*itr)->getTexturePositionY()+t) * getTextureWidth()) + ((*itr)->getTexturePositionX()+s)); @@ -368,7 +368,7 @@ void GlyphTexture::apply(osg::State& state) const glyphsWereSubloading.clear(); // Subload the image once - glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, getTextureWidth(), getTextureHeight(), GL_ALPHA, GL_UNSIGNED_BYTE, local_data ); @@ -407,7 +407,7 @@ void GlyphTexture::resizeGLObjectBuffers(unsigned int maxSize) unsigned int initialSize = _glyphsToSubload.size(); _glyphsToSubload.resize(maxSize); - + for(unsigned i=initialSize; i<_glyphsToSubload.size(); ++i) { for(GlyphRefList::iterator itr = _glyphs.begin(); @@ -502,7 +502,7 @@ void Glyph::subload() const } glPixelStorei(GL_UNPACK_ALIGNMENT,getPacking()); - + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) glPixelStorei(GL_UNPACK_ROW_LENGTH,getRowLength()); #endif @@ -513,7 +513,7 @@ void Glyph::subload() const (GLenum)getPixelFormat(), (GLenum)getDataType(), data()); - + errorNo = glGetError(); if (errorNo!=GL_NO_ERROR) { @@ -529,7 +529,7 @@ void Glyph::subload() const "\t 0x"<<(GLenum)getPixelFormat()<addPrimitiveSet(face.get()); } - + osg::DrawElementsUShort* bevel = new osg::DrawElementsUShort(GL_QUAD_STRIP); bevel->setName("bevel"); bevel->reserve(count*2); @@ -476,7 +476,7 @@ OSGTEXT_EXPORT osg::Geometry* computeGlyphGeometry(const osgText::Glyph3D* glyph boundaryOuter.removeAllSegmentsAboveThickness(-shellThickness); boundaryOuter.newAddBoundaryToGeometry(new_geometry.get(), -shellThickness, "", "shell"); } - + } osg::Vec3Array* vertices = dynamic_cast(new_geometry->getVertexArray()); @@ -953,7 +953,7 @@ OSGTEXT_EXPORT osg::Geometry* computeShellGeometry(osg::Geometry* glyphGeometry, front_indices[pi] = vertices->size(); vertices->push_back((*orig_vertices)[pi]+frontOffset); } - pi = front_indices[pi]; + pi = front_indices[pi]; } for(unsigned int i=0; isize()-1;) diff --git a/src/osgText/String.cpp b/src/osgText/String.cpp index fd7331818..393eda3d3 100644 --- a/src/osgText/String.cpp +++ b/src/osgText/String.cpp @@ -17,19 +17,19 @@ struct look_ahead_iterator _string(string), _index(0), _nullCharacter(0) {} - + bool valid() const { return _index<_string.length(); } - + look_ahead_iterator& operator ++ () { - if (_index<_string.length()) ++_index; + if (_index<_string.length()) ++_index; return *this; } - + look_ahead_iterator operator ++ (int) { - look_ahead_iterator tmp(*this); - if (_index<_string.length()) ++_index; + look_ahead_iterator tmp(*this); + if (_index<_string.length()) ++_index; return tmp; } @@ -38,7 +38,7 @@ struct look_ahead_iterator if (_index<_string.length()) _index = osg::minimum((unsigned int)(_index+offset),(unsigned int)_string.length()); return *this; } - + unsigned char operator * () const { if (_index<_string.length()) return _string[_index]; @@ -51,12 +51,12 @@ struct look_ahead_iterator if (_index+offset<_string.length()) return _string[_index+offset]; else return _nullCharacter; } - + const std::string& _string; unsigned int _index; unsigned char _nullCharacter; - + protected: look_ahead_iterator& operator = (const look_ahead_iterator&) { return *this; } @@ -124,7 +124,7 @@ String::Encoding findEncoding(look_ahead_iterator& charString,String::Encoding o unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding encoding) { - // For more info on unicode encodings see: + // For more info on unicode encodings see: // http://www-106.ibm.com/developerworks/unicode/library/u-encode.html switch(encoding) { @@ -168,7 +168,7 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e { int char2 = *charString++; int char3 = *charString++; - int highSurrogate = (char0<<8) | char1; + int highSurrogate = (char0<<8) | char1; int lowSurrogate = (char2<<8) | char3; if ((char2>=0xDC)&&(char2<=0xDF)) //only for the valid range of low surrogate { @@ -190,7 +190,7 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e { int char3 = *charString++; int char2 = *charString++; - int highSurrogate = (char0<<8) | char1; + int highSurrogate = (char0<<8) | char1; int lowSurrogate = (char2<<8) | char3; if ((char2>=0xDC)&&(char2<=0xDF)) //only for the valid range of low surrogate { @@ -205,9 +205,9 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e int character = ((((int)charString[0])<<24) | (((int)charString[1])<<16) | (((int)charString[2])<<8) | charString[3]); charString+=4; - if (character<0x110000) - { - // Character is constrained to the range set by the unicode standard + if (character<0x110000) + { + // Character is constrained to the range set by the unicode standard return character; } break; @@ -217,9 +217,9 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e int character = ((((int)charString[3])<<24) | (((int)charString[2])<<16) | (((int)charString[1])<<8) | charString[0]); charString+=4; - if (character<0x110000) - { - // Character is constrained to the range set by the unicode standard + if (character<0x110000) + { + // Character is constrained to the range set by the unicode standard return character; } break; @@ -249,10 +249,10 @@ String::String(const String& str): String& String::operator = (const String& str) { if (&str==this) return *this; - + clear(); std::copy(str.begin(),str.end(),std::back_inserter(*this)); - + return *this; } @@ -281,13 +281,13 @@ void String::set(const std::string& text,Encoding encoding) look_ahead_iterator itr(text); - if ((encoding == ENCODING_SIGNATURE) || - (encoding == ENCODING_UTF16) || + if ((encoding == ENCODING_SIGNATURE) || + (encoding == ENCODING_UTF16) || (encoding == ENCODING_UTF32)) { encoding = findEncoding(itr,encoding); } - + while(itr.valid()) { unsigned int c = getNextCharacter(itr,encoding); diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index e9bb820e8..0b70b7d51 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -106,7 +106,7 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite for(bool outOfSpace=false;lastChar!=last;++lastChar) { unsigned int charcode = *lastChar; - + if (charcode=='\n') { return lastChar; @@ -165,7 +165,7 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite if (_maximumHeight>0.0f && cursor.y()<-_maximumHeight) outOfSpace=true; break; } - + // => word boundary detection & wrapping if (outOfSpace) break; @@ -226,17 +226,17 @@ void Text::computeGlyphRepresentation() { Font* activefont = getActiveFont(); if (!activefont) return; - + _textureGlyphQuadMap.clear(); _lineCount = 0; - - if (_text.empty()) + + if (_text.empty()) { _textBB.set(0,0,0,0,0,0);//no size text TextBase::computePositions(); //to reset the origin return; } - + //OpenThreads::ScopedLock lock(*(activefont->getSerializeFontCallsMutex())); // initialize bounding box, it will be expanded during glyph position calculation @@ -245,12 +245,12 @@ void Text::computeGlyphRepresentation() osg::Vec2 startOfLine_coords(0.0f,0.0f); osg::Vec2 cursor(startOfLine_coords); osg::Vec2 local(0.0f,0.0f); - + unsigned int previous_charcode = 0; unsigned int linelength = 0; bool horizontal = _layout!=VERTICAL; bool kerning = true; - + unsigned int lineNumber = 0; float hr = _characterHeight; @@ -485,8 +485,8 @@ void Text::computeGlyphRepresentation() { ++itr; } - - + + // move to new line. switch(_layout) { @@ -516,11 +516,11 @@ void Text::computeGlyphRepresentation() } break; } - + ++lineNumber; } - + TextBase::computePositions(); computeBackdropBoundingBox(); computeBoundingBoxMargin(); @@ -529,7 +529,7 @@ void Text::computeGlyphRepresentation() // Returns false if there are no glyphs and the width/height values are invalid. // Also sets avg_width and avg_height to 0.0f if the value is invalid. -// This method is used several times in a loop for the same object which will produce the same values. +// This method is used several times in a loop for the same object which will produce the same values. // Further optimization may try saving these values instead of recomputing them. bool Text::computeAverageGlyphWidthAndHeight(float& avg_width, float& avg_height) const { @@ -543,10 +543,10 @@ bool Text::computeAverageGlyphWidthAndHeight(float& avg_width, float& avg_height unsigned int i; bool is_valid_size = true; // This section is going to try to compute the average width and height - // for a character among the text. The reason I shift by an - // average amount per-character instead of shifting each character - // by its per-instance amount is because it may look strange to see - // the individual backdrop text letters not space themselves the same + // for a character among the text. The reason I shift by an + // average amount per-character instead of shifting each character + // by its per-instance amount is because it may look strange to see + // the individual backdrop text letters not space themselves the same // way the foreground text does. Using one value gives uniformity. // Note: This loop is repeated for each context. I think it may produce // the same values regardless of context. This code be optimized by moving @@ -599,12 +599,12 @@ void Text::computePositions(unsigned int contextID) const case LEFT_BASE_LINE: _offset.set(0.0f,0.0f,0.0f); break; case CENTER_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,0.0f,0.0f); break; case RIGHT_BASE_LINE: _offset.set(_textBB.xMax(),0.0f,0.0f); break; - + case LEFT_BOTTOM_BASE_LINE: _offset.set(0.0f,-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break; case CENTER_BOTTOM_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break; case RIGHT_BOTTOM_BASE_LINE: _offset.set(_textBB.xMax(),-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break; } - + AutoTransformCache& atc = _autoTransformCache[contextID]; osg::Matrix& matrix = atc._matrix; @@ -613,8 +613,8 @@ void Text::computePositions(unsigned int contextID) const matrix.makeTranslate(-_offset); - osg::Matrix rotate_matrix; - if (_autoRotateToScreen) + osg::Matrix rotate_matrix; + if (_autoRotateToScreen) { osg::Vec3d trans(atc._modelview.getTrans()); atc._modelview.setTrans(0.0f,0.0f,0.0f); @@ -633,9 +633,9 @@ void Text::computePositions(unsigned int contextID) const M.postMultTranslate(_position); M.postMult(atc._modelview); osg::Matrix& P = atc._projection; - + // compute the pixel size vector. - + // pre adjust P00,P20,P23,P33 by multiplying them by the viewport window matrix. // here we do it in short hand with the knowledge of how the window matrix is formed // note P23,P33 are multiplied by an implicit 1 which would come from the window matrix. @@ -686,7 +686,7 @@ void Text::computePositions(unsigned int contextID) const } - if (_autoRotateToScreen) + if (_autoRotateToScreen) { matrix.postMult(rotate_matrix); } @@ -712,13 +712,13 @@ void Text::computePositions(unsigned int contextID) const GlyphQuads& glyphquad = titr->second; GlyphQuads::Coords2& coords2 = glyphquad._coords; GlyphQuads::Coords3& transformedCoords = glyphquad._transformedCoords[contextID]; - + unsigned int numCoords = coords2.size(); if (numCoords!=transformedCoords.size()) { transformedCoords.resize(numCoords); } - + for(unsigned int i=0;i(this)->dirtyBound(); + const_cast(this)->dirtyBound(); } // Presumes the atc matrix is already up-to-date @@ -745,7 +745,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const float avg_height = 0.0f; unsigned int i; bool is_valid_size; - + AutoTransformCache& atc = _autoTransformCache[contextID]; osg::Matrix& matrix = atc._matrix; @@ -755,7 +755,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const is_valid_size = computeAverageGlyphWidthAndHeight(avg_width, avg_height); if (!is_valid_size) return; - + // now apply matrix to the glyphs. for(TextureGlyphQuadMap::iterator titr=_textureGlyphQuadMap.begin(); titr!=_textureGlyphQuadMap.end(); @@ -831,7 +831,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const horizontal_shift_direction = 0.0f; vertical_shift_direction = 1.0f; break; - } + } case DROP_SHADOW_BOTTOM_LEFT: { horizontal_shift_direction = -1.0f; @@ -862,7 +862,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const } } -// This method adjusts the bounding box to account for the expanded area caused by the backdrop. +// This method adjusts the bounding box to account for the expanded area caused by the backdrop. // This assumes that the bounding box has already been computed for the text without the backdrop. void Text::computeBackdropBoundingBox() const { @@ -874,7 +874,7 @@ void Text::computeBackdropBoundingBox() const float avg_width = 0.0f; float avg_height = 0.0f; bool is_valid_size; - + // FIXME: OPTIMIZE: It is possible that this value has already been computed before // from previous calls to this function. This might be worth optimizing. is_valid_size = computeAverageGlyphWidthAndHeight(avg_width, avg_height); @@ -886,7 +886,7 @@ void Text::computeBackdropBoundingBox() const { return; } - + // Finally, we have one more issue to deal with. // Now that the text takes more space, we need // to adjust the size of the bounding box. @@ -951,7 +951,7 @@ void Text::computeBackdropBoundingBox() const _textBB.zMax() ); break; - } + } case DROP_SHADOW_BOTTOM_LEFT: { _textBB.set( @@ -1006,7 +1006,7 @@ void Text::computeBackdropBoundingBox() const } } -// This method expands the bounding box to a settable margin when a bounding box drawing mode is active. +// This method expands the bounding box to a settable margin when a bounding box drawing mode is active. void Text::computeBoundingBoxMargin() const { if(_drawMode & (BOUNDINGBOX | FILLEDBOUNDINGBOX)){ @@ -1057,7 +1057,7 @@ void Text::computeColorGradientsOverall() const const GlyphQuads::Coords2& coords2 = glyphquad._coords; for(i=0;i max_x) { @@ -1074,7 +1074,7 @@ void Text::computeColorGradientsOverall() const if(coords2[i].y() < min_y) { min_y = coords2[i].y(); - } + } } } @@ -1133,7 +1133,7 @@ void Text::computeColorGradientsOverall() const _colorGradientBottomRight[2], _colorGradientTopRight[2] ); - // Alpha does not convert to HSV + // Alpha does not convert to HSV float alpha = bilinearInterpolate( min_x, max_x, @@ -1145,7 +1145,7 @@ void Text::computeColorGradientsOverall() const _colorGradientTopLeft[3], _colorGradientBottomRight[3], _colorGradientTopRight[3] - ); + ); colorCoords[i] = osg::Vec4(red,green,blue,alpha); } @@ -1250,23 +1250,23 @@ void Text::drawImplementation(osg::State& state, const osg::Vec4& colorMultiplie doUpdate = true; } } - + atc._traversalNumber = frameNumber; atc._width = width; atc._height = height; - + if (doUpdate) - { + { atc._transformedPosition = newTransformedPosition; atc._projection = projection; atc._modelview = modelview; computePositions(contextID); } - + } - - + + // Ensure that the glyph coordinates have been transformed for // this context id. @@ -1344,7 +1344,7 @@ void Text::drawImplementation(osg::State& state, const osg::Vec4& colorMultiplie OSG_NOTICE<<"Warning: Text::drawImplementation() fillMode FILLEDBOUNDINGBOX not supported"<resizeGLObjectBuffers(maxSize); } @@ -1556,7 +1556,7 @@ void Text::drawForegroundText(osg::State& state, const GlyphQuads& glyphquad, co unsigned int contextID = state.getContextID(); const GlyphQuads::Coords3& transformedCoords = glyphquad._transformedCoords[contextID]; - if (!transformedCoords.empty()) + if (!transformedCoords.empty()) { state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedCoords.front())); state.setTexCoordPointer( 0, 2, GL_FLOAT, 0, &(glyphquad._texcoords.front())); @@ -1654,7 +1654,7 @@ void Text::drawTextWithBackdrop(osg::State& state, const osg::Vec4& colorMultipl for( ; backdrop_index < max_backdrop_index; backdrop_index++) { const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID]; - if (!transformedBackdropCoords.empty()) + if (!transformedBackdropCoords.empty()) { state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front())); state.drawQuads(0,transformedBackdropCoords.size()); @@ -1710,7 +1710,7 @@ void Text::renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMult for( ; backdrop_index < max_backdrop_index; backdrop_index++) { const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID]; - if (!transformedBackdropCoords.empty()) + if (!transformedBackdropCoords.empty()) { state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front())); glPolygonOffset(0.1f * osg::PolygonOffset::getFactorMultiplier(), @@ -1730,7 +1730,7 @@ void Text::renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMult OSG_NOTICE<<"Warning: Text::renderWithPolygonOffset(..) not implemented."<empty()) continue; //skip over spaces - + //pf.setVertexArray(it->_glyph->getVertexArray()->size(),&(it->_glyph->getVertexArray()->front())); ////////////////////////////////////////////////////////////////////////// // now apply matrix to the glyphs. diff --git a/src/osgText/TextBase.cpp b/src/osgText/TextBase.cpp index e2da209ed..c0ac6df89 100644 --- a/src/osgText/TextBase.cpp +++ b/src/osgText/TextBase.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -141,12 +141,12 @@ void TextBase::setLineSpacing(float lineSpacing) _lineSpacing = lineSpacing; computeGlyphRepresentation(); } - + void TextBase::setText(const String& text) { if (_text==text) return; - + _text = text; computeGlyphRepresentation(); } @@ -160,7 +160,7 @@ void TextBase::setText(const std::string& text,String::Encoding encoding) { setText(String(text,encoding)); } - + void TextBase::setText(const wchar_t* text) { @@ -178,7 +178,7 @@ void TextBase::setPosition(const osg::Vec3& pos) void TextBase::setAlignment(AlignmentType alignment) { if (_alignment==alignment) return; - + _alignment = alignment; computeGlyphRepresentation(); } @@ -191,19 +191,19 @@ void TextBase::setAxisAlignment(AxisAlignment axis) { case XZ_PLANE: setAutoRotateToScreen(false); - setRotation(osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))); + setRotation(osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))); break; case REVERSED_XZ_PLANE: setAutoRotateToScreen(false); setRotation(osg::Quat(osg::inDegrees(180.0f),osg::Vec3(0.0f,1.0f,0.0f))* - osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))); + osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))); break; - case YZ_PLANE: + case YZ_PLANE: setAutoRotateToScreen(false); setRotation(osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))* osg::Quat(osg::inDegrees(90.0f),osg::Vec3(0.0f,0.0f,1.0f))); break; - case REVERSED_YZ_PLANE: + case REVERSED_YZ_PLANE: setAutoRotateToScreen(false); setRotation(osg::Quat(osg::inDegrees(180.0f),osg::Vec3(0.0f,1.0f,0.0f))* osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))* @@ -235,7 +235,7 @@ void TextBase::setRotation(const osg::Quat& quat) void TextBase::setAutoRotateToScreen(bool autoRotateToScreen) { if (_autoRotateToScreen==autoRotateToScreen) return; - + _autoRotateToScreen = autoRotateToScreen; computePositions(); } @@ -250,8 +250,8 @@ void TextBase::setLayout(Layout layout) } -void TextBase::setDrawMode(unsigned int mode) -{ +void TextBase::setDrawMode(unsigned int mode) +{ if (_drawMode==mode) return; _drawMode=mode; @@ -317,14 +317,14 @@ osg::BoundingBox TextBase::computeBound() const void TextBase::computePositions() { unsigned int size = osg::maximum(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),_autoTransformCache.size()); - + // FIXME: OPTIMIZE: This would be one of the ideal locations to // call computeAverageGlyphWidthAndHeight(). It is out of the contextID loop // so the value would be computed fewer times. But the code will need changes // to get the value down to the locations it is needed. (Either pass through parameters // or member variables, but we would need a system to know if the values are stale.) - + for(unsigned int i=0;i @@ -22,7 +22,7 @@ CubeMapGenerator::CubeMapGenerator(int texture_size) texture_size_(texture_size) { for (int i=0; i<6; ++i) - { + { osg::ref_ptr image = new osg::Image; unsigned char* data = new unsigned char [texture_size*texture_size*4]; image->setImage(texture_size, texture_size, 1, 4, GL_RGBA, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE); @@ -44,7 +44,7 @@ CubeMapGenerator::CubeMapGenerator(const CubeMapGenerator ©, const osg::Copy void CubeMapGenerator::generateMap(bool use_osg_system) { osg::Matrix M; - + if (use_osg_system) { M = osg::Matrix::rotate(osg::PI_2, osg::Vec3(1, 0, 0)); } else { @@ -52,7 +52,7 @@ void CubeMapGenerator::generateMap(bool use_osg_system) } const float dst = 2.0f/(texture_size_-1); - + float t = -1; for (int i=0; i @@ -84,9 +84,9 @@ osg::ref_ptr& CullVisitor::prototype() CullVisitor* CullVisitor::create() { - return CullVisitor::prototype().valid() ? + return CullVisitor::prototype().valid() ? CullVisitor::prototype()->clone() : - new CullVisitor; + new CullVisitor; } @@ -95,9 +95,9 @@ void CullVisitor::reset() // // first unref all referenced objects and then empty the containers. // - + CullStack::reset(); - + _renderBinStack.clear(); _numberOfEncloseOverrideRenderBinDetails = 0; @@ -108,16 +108,16 @@ void CullVisitor::reset() // reset the calculated near far planes. _computed_znear = FLT_MAX; _computed_zfar = -FLT_MAX; - - + + osg::Vec3 lookVector(0.0,0.0,-1.0); - + _bbCornerFar = (lookVector.x()>=0?1:0) | (lookVector.y()>=0?2:0) | (lookVector.z()>=0?4:0); _bbCornerNear = (~_bbCornerFar)&7; - + // Only reset the RenderLeaf objects used last frame. for(RenderLeafList::iterator itr=_reuseRenderLeafList.begin(), iter_end=_reuseRenderLeafList.begin()+_currentReuseRenderLeafIndex; @@ -126,7 +126,7 @@ void CullVisitor::reset() { (*itr)->reset(); } - + // reset the resuse lists. _currentReuseRenderLeafIndex = 0; @@ -155,7 +155,7 @@ float CullVisitor::getDistanceFromEyePoint(const osg::Vec3& pos, bool withLODSca { const Matrix& matrix = *_modelviewStack.back(); float dist = distance(pos,matrix); - + if (withLODScale) return dist*getLODScale(); else return dist; } @@ -167,7 +167,7 @@ void CullVisitor::computeNearPlane() { #if 0 osg::Timer_t start_t = osg::Timer::instance()->tick(); -#endif +#endif // update near from defferred list of drawables unsigned int numTests = 0; for(DistanceMatrixDrawableMap::iterator itr=_nearPlaneCandidateMap.begin(); @@ -182,9 +182,9 @@ void CullVisitor::computeNearPlane() _computed_znear = d_near; #if 0 OSG_NOTICE<<" updating znear to "<tick(); @@ -221,7 +221,7 @@ void CullVisitor::computeNearPlane() } #if 0 OSG_NOTICE<<" result _computed_znear="<<_computed_znear<<", _computed_zfar="<<_computed_zfar< Polygon; Comparator _comparator; - + CullVisitor::value_type _znear; osg::Matrix _matrix; const osg::Polytope::PlaneList* _planes; Polygon _polygonOriginal; Polygon _polygonNew; - + Polygon _pointCache; // Handle Points @@ -403,8 +403,8 @@ struct ComputeNearFarFunctor return; } //OSG_NOTICE<<"Point ok w.r.t plane "<begin(); @@ -479,7 +479,7 @@ struct ComputeNearFarFunctor ++pitr) { if (active_mask & selector_mask) - { + { // clip line to plane const osg::Plane& plane = *pitr; @@ -496,7 +496,7 @@ struct ComputeNearFarFunctor // replace p2 with intersection float r = p1.first/(p1.first-p2.first); p2 = DistancePoint(0.0f, p1.second*(1.0f-r) + p2.second*r); - + } } else if (p2.first >= 0.0f) @@ -508,7 +508,7 @@ struct ComputeNearFarFunctor } // The case where both are out was handled above. } - selector_mask <<= 1; + selector_mask <<= 1; } n1 = distance(p1.second,_matrix); @@ -532,8 +532,8 @@ struct ComputeNearFarFunctor //OSG_NOTICE<<"Triangle totally beyond znear"<begin(); pitr != _planes->end() && !_polygonOriginal.empty(); ++pitr) { if (active_mask & selector_mask) - { + { // polygon bisects plane so need to divide it up. const osg::Plane& plane = *pitr; _polygonNew.clear(); @@ -612,8 +612,8 @@ struct ComputeNearFarFunctor { polyItr->first = plane.distance(polyItr->second); } - - // create the new polygon by clamping against the + + // create the new polygon by clamping against the unsigned int psize = _polygonOriginal.size(); for(unsigned int ci = 0; ci < psize; ++ci) @@ -623,7 +623,7 @@ struct ComputeNearFarFunctor if (_polygonOriginal[ci].first>=0.0f) { _polygonNew.push_back(_polygonOriginal[ci]); - + if (_polygonOriginal[ni].first<0.0f) computeIntersection = true; } else if (_polygonOriginal[ni].first>0.0f) computeIntersection = true; @@ -638,7 +638,7 @@ struct ComputeNearFarFunctor } _polygonOriginal.swap(_polygonNew); } - selector_mask <<= 1; + selector_mask <<= 1; } // now take the nearst points to the eye point. @@ -689,7 +689,7 @@ CullVisitor::value_type CullVisitor::computeNearestPointInFrustum(const osg::Mat osg::TemplatePrimitiveFunctor cnpf; cnpf.set(FLT_MAX, matrix, &planes); - + drawable.accept(cnpf); return cnpf._znear; @@ -717,7 +717,7 @@ bool CullVisitor::updateCalculatedNearFar(const osg::Matrix& matrix,const osg::B if (d_near>d_far) { std::swap(d_near,d_far); - if ( !EQUAL_F(d_near, d_far) ) + if ( !EQUAL_F(d_near, d_far) ) { OSG_WARN<<"Warning: CullVisitor::updateCalculatedNearFar(.) near>far in range calculation,"<< std::endl; OSG_WARN<<" correcting by swapping values d_near="<far in range calculation,"<< std::endl; OSG_WARN<<" correcting by swapping values d_near="<getStateSet(); if (stateset) pushStateSet(stateset); - + if (osg::isNaN(depth)) { OSG_NOTICE<<"CullVisitor::apply(Billboard&) detected NaN,"< matrix = createOrReuseMatrix(*getModelViewMatrix()); node.computeLocalToWorldMatrix(*matrix,this); pushModelViewMatrix(matrix.get(), node.getReferenceFrame()); - + handle_cull_callbacks_and_traverse(node); popModelViewMatrix(); - // pop the node's state off the render graph stack. + // pop the node's state off the render graph stack. if (node_state) popStateSet(); // pop the culling mode. @@ -1263,7 +1263,7 @@ void CullVisitor::apply(Projection& node) // record previous near and far values. float previous_znear = _computed_znear; float previous_zfar = _computed_zfar; - + // take a copy of the current near plane candidates DistanceMatrixDrawableMap previousNearPlaneCandidateMap; previousNearPlaneCandidateMap.swap(_nearPlaneCandidateMap); @@ -1277,9 +1277,9 @@ void CullVisitor::apply(Projection& node) ref_ptr matrix = createOrReuseMatrix(node.getMatrix()); pushProjectionMatrix(matrix.get()); - + //OSG_INFO<<"Push projection "<<*matrix< lock(_mutex); _renderStageMap[cv] = rs; - } + } RenderStage* getRenderStage(osgUtil::CullVisitor* cv) { OpenThreads::ScopedLock lock(_mutex); return _renderStageMap[cv].get(); } - + typedef std::map > RenderStageMap; - + /** Resize any per context GLObject buffers to specified size. */ virtual void resizeGLObjectBuffers(unsigned int maxSize) { @@ -1478,7 +1478,7 @@ void CullVisitor::apply(osg::Camera& camera) projection = createOrReuseMatrix(*getProjectionMatrix()*camera.getProjectionMatrix()); modelview = createOrReuseMatrix(*getModelViewMatrix()*camera.getViewMatrix()); } - else // pre multiply + else // pre multiply { projection = createOrReuseMatrix(camera.getProjectionMatrix()*(*getProjectionMatrix())); modelview = createOrReuseMatrix(camera.getViewMatrix()*(*getModelViewMatrix())); @@ -1497,7 +1497,7 @@ void CullVisitor::apply(osg::Camera& camera) // record previous near and far values. value_type previous_znear = _computed_znear; value_type previous_zfar = _computed_zfar; - + // take a copy of the current near plane candidates DistanceMatrixDrawableMap previousNearPlaneCandidateMap; previousNearPlaneCandidateMap.swap(_nearPlaneCandidateMap); @@ -1509,7 +1509,7 @@ void CullVisitor::apply(osg::Camera& camera) _computed_zfar = -FLT_MAX; pushProjectionMatrix(projection); - pushModelViewMatrix(modelview, camera.getReferenceFrame()); + pushModelViewMatrix(modelview, camera.getReferenceFrame()); if (camera.getRenderOrder()==osg::Camera::NESTED_RENDER) @@ -1533,12 +1533,12 @@ void CullVisitor::apply(osg::Camera& camera) rsCache = new osgUtil::RenderStageCache; camera.setRenderingCache(rsCache.get()); } - + osg::ref_ptr rtts = rsCache->getRenderStage(this); if (!rtts) { OpenThreads::ScopedLock lock(*(camera.getDataChangeMutex())); - + rtts = new osgUtil::RenderStage; rsCache->setRenderStage(this,rtts.get()); @@ -1553,7 +1553,7 @@ void CullVisitor::apply(osg::Camera& camera) { rtts->setDrawBuffer(camera.getDrawBuffer()); } - + if ( camera.getInheritanceMask() & READ_BUFFER ) { // inherit read buffer from above. @@ -1570,7 +1570,7 @@ void CullVisitor::apply(osg::Camera& camera) rtts->reset(); } - // set up clera masks/values + // set up clera masks/values rtts->setClearDepth(camera.getClearDepth()); rtts->setClearAccum(camera.getClearAccum()); rtts->setClearStencil(camera.getClearStencil()); @@ -1595,7 +1595,7 @@ void CullVisitor::apply(osg::Camera& camera) rtts->setClearMask(camera.getClearMask()); } - + // set the color mask. osg::ColorMask* colorMask = camera.getColorMask()!=0 ? camera.getColorMask() : previous_stage->getColorMask(); rtts->setColorMask(colorMask); @@ -1603,7 +1603,7 @@ void CullVisitor::apply(osg::Camera& camera) // set up the viewport. osg::Viewport* viewport = camera.getViewport()!=0 ? camera.getViewport() : previous_stage->getViewport(); rtts->setViewport( viewport ); - + // set initial view matrix rtts->setInitialViewMatrix(modelview); @@ -1628,7 +1628,7 @@ void CullVisitor::apply(osg::Camera& camera) // restore the previous renderbin. setCurrentRenderBin(previousRenderBin); - + if (rtts->getStateGraphList().size()==0 && rtts->getRenderBinList().size()==0) { @@ -1650,7 +1650,7 @@ void CullVisitor::apply(osg::Camera& camera) } } - + // restore the previous model view matrix. popModelViewMatrix(); @@ -1675,7 +1675,7 @@ void CullVisitor::apply(osg::Camera& camera) // restore the previous cull settings setCullSettings(saved_cull_settings); - // pop the node's state off the render graph stack. + // pop the node's state off the render graph stack. if (node_state) popStateSet(); } @@ -1685,7 +1685,7 @@ void CullVisitor::apply(osg::OccluderNode& node) // need to check if occlusion node is in the occluder // list, if so disable the appropriate ShadowOccluderVolume disableAndPushOccludersCurrentMask(_nodePath); - + if (isCulled(node)) { @@ -1704,7 +1704,7 @@ void CullVisitor::apply(osg::OccluderNode& node) handle_cull_callbacks_and_traverse(node); - // pop the node's state off the render graph stack. + // pop the node's state off the render graph stack. if (node_state) popStateSet(); // pop the culling mode. @@ -1727,7 +1727,7 @@ void CullVisitor::apply(osg::OcclusionQueryNode& node) osg::Camera* camera = getCurrentCamera(); - + // If previous query indicates visible, then traverse as usual. if (node.getPassed( camera, *this )) handle_cull_callbacks_and_traverse(node); @@ -1739,7 +1739,7 @@ void CullVisitor::apply(osg::OcclusionQueryNode& node) node.traverseDebug( *this ); - // pop the node's state off the render graph stack. + // pop the node's state off the render graph stack. if (node_state) popStateSet(); // pop the culling mode. diff --git a/src/osgUtil/DelaunayTriangulator.cpp b/src/osgUtil/DelaunayTriangulator.cpp index e06c693c6..b88445cba 100644 --- a/src/osgUtil/DelaunayTriangulator.cpp +++ b/src/osgUtil/DelaunayTriangulator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,12 +37,12 @@ namespace osgUtil // Compute the circumcircle of a triangle (only x and y coordinates are used), // return (Cx, Cy, r^2) inline osg::Vec3 compute_circumcircle( - const osg::Vec3 &a, - const osg::Vec3 &b, + const osg::Vec3 &a, + const osg::Vec3 &b, const osg::Vec3 &c) { - float D = - (a.x() - c.x()) * (b.y() - c.y()) - + float D = + (a.x() - c.x()) * (b.y() - c.y()) - (b.x() - c.x()) * (a.y() - c.y()); float cx, cy, r2; @@ -59,14 +59,14 @@ inline osg::Vec3 compute_circumcircle( } else { - cx = - (((a.x() - c.x()) * (a.x() + c.x()) + + cx = + (((a.x() - c.x()) * (a.x() + c.x()) + (a.y() - c.y()) * (a.y() + c.y())) / 2 * (b.y() - c.y()) - ((b.x() - c.x()) * (b.x() + c.x()) + (b.y() - c.y()) * (b.y() + c.y())) / 2 * (a.y() - c.y())) / D; - cy = - (((b.x() - c.x()) * (b.x() + c.x()) + + cy = + (((b.x() - c.x()) * (b.x() + c.x()) + (b.y() - c.y()) * (b.y() + c.y())) / 2 * (a.x() - c.x()) - ((a.x() - c.x()) * (a.x() + c.x()) + (a.y() - c.y()) * (a.y() + c.y())) / 2 * (b.x() - c.x())) / D; @@ -84,8 +84,8 @@ inline osg::Vec3 compute_circumcircle( inline bool point_in_circle(const osg::Vec3 &point, const osg::Vec3 &circle) { - float r2 = - (point.x() - circle.x()) * (point.x() - circle.x()) + + float r2 = + (point.x() - circle.x()) * (point.x() - circle.x()) + (point.y() - circle.y()) * (point.y() - circle.y()); return r2 <= circle.z()*circle.z(); // return r2 <= circle.z(); @@ -157,12 +157,12 @@ public: a_(0), b_(0), c_(0) {} - - + + Triangle(Vertex_index a, Vertex_index b, Vertex_index c, osg::Vec3Array *points) - : a_(a), - b_(b), - c_(c), + : a_(a), + b_(b), + c_(c), cc_(compute_circumcircle((*points)[a_], (*points)[b_], (*points)[c_])) { edge_[0] = Edge(a_, b_); @@ -173,7 +173,7 @@ public: Triangle& operator = (const Triangle& rhs) { if (&rhs==this) return *this; - + a_ = rhs.a_; b_ = rhs.b_; c_ = rhs.c_; @@ -181,7 +181,7 @@ public: edge_[0] = rhs.edge_[0]; edge_[1] = rhs.edge_[1]; edge_[2] = rhs.edge_[2]; - + return *this; } @@ -240,15 +240,15 @@ public: { ie1=c(); ie2=a(); - } + } if (ip1==ie1 || ip2==ie1) return false; if (ip1==ie2 || ip2==ie2) return false; - + osg::Vec2 tp1((*points)[ie1].x(),(*points)[ie1].y()); osg::Vec2 tp2((*points)[ie2].x(),(*points)[ie2].y()); return intersect(tp1,tp2,p1,p2); } - + bool intersectedby(const osg::Vec2 p1,const osg::Vec2 p2,osg::Vec3Array *points) const { // true if line [p1,p2] cuts at least one edge of this triangle osg::Vec2 tp1((*points)[a()].x(),(*points)[a()].y()); @@ -289,7 +289,7 @@ public: } int lineBisectTest(const osg::Vec3 apt,const osg::Vec3 bpt,const osg::Vec3 cpt, const osg::Vec2 p2) const - { + { osg::Vec2 vp2tp=p2-osg::Vec2(apt.x(), apt.y()); // vector from p1 to a. // test is: cross product (z component) with ab,ac is opposite signs // AND dot product with ab,ac has at least one positive value. @@ -309,9 +309,9 @@ public: } return 0; } - + int lineBisects(osg::Vec3Array *points, const unsigned int ip1, const osg::Vec2 p2) const - { + { // return true if line starts at vertex and lies between the 2 edges which meet at vertex // is that which uses index ip1. // line is to p2 @@ -342,7 +342,7 @@ public: } return 0; } - + private: @@ -354,7 +354,7 @@ private: float det=((p4.y()-p3.y())*(p2.x()-p1.x())-(p4.x()-p3.x())*(p2.y()-p1.y())); if (det!=0) { - // point on line is P=p1+ua.(p2-p1) and Q=p3+ub.(p4-p3) + // point on line is P=p1+ua.(p2-p1) and Q=p3+ub.(p4-p3) float ua=((p4.x()-p3.x())*(p1.y()-p3.y())-(p4.y()-p3.y())*(p1.x()-p3.x()))/det; float ub=((p2.x()-p1.x())*(p1.y()-p3.y())-(p2.y()-p1.y())*(p1.x()-p3.x()))/det; if (ua> 0.00 && ua< 1 && ub> 0.0000 && ub< 1) @@ -364,11 +364,11 @@ private: } return false; } - + Vertex_index a_; Vertex_index b_; Vertex_index c_; - osg::Vec3 cc_; + osg::Vec3 cc_; Edge edge_[3]; }; @@ -451,13 +451,13 @@ Triangle_list fillHole(osg::Vec3Array *points, std::vector vind osg::ref_ptr gtess=new osg::Geometry; // add all the contours to this for analysis osg::ref_ptr constraintverts=new osg::Vec3Array; osg::ref_ptr tscx=new osgUtil::Tessellator; // this assembles all the constraints - + for (std::vector::iterator itint=vindexlist.begin(); itint!=vindexlist.end(); itint++) { // OSG_WARN<< "add point " << (*itint) << " at " << (*points)[*itint].x() << ","<< (*points)[*itint].y() <push_back((*points)[*itint]); } - + unsigned int npts=vindexlist.size(); gtess->setVertexArray(constraintverts.get()); @@ -469,7 +469,7 @@ Triangle_list fillHole(osg::Vec3Array *points, std::vector vind tscx->retessellatePolygons(*(gtess.get())); // this should insert extra vertices where constraints overlap // extract triangles from gtess - + unsigned int ipr; for (ipr=0; iprgetNumPrimitiveSets(); ipr++) { @@ -492,7 +492,7 @@ Triangle_list fillHole(osg::Vec3Array *points, std::vector vind { pidx=vindexlist[prset->index(ic)]; } - + if (prset->index(ic+1)>=npts) { // this is an added point. @@ -503,7 +503,7 @@ Triangle_list fillHole(osg::Vec3Array *points, std::vector vind { pidx1=vindexlist[prset->index(ic+1)]; } - + if (prset->index(ic+2)>=npts) { // this is an added point. @@ -540,18 +540,18 @@ Triangle_list fillHole(osg::Vec3Array *points, std::vector vind { pidx1=vindexlist[prset->index(ic+1)]; } - + if (prset->index(ic+2)>=npts) { // this is an added point. points->push_back((*constraintverts)[prset->index(ic+2)]); pidx2=points->size()-1; } - else + else { pidx2=vindexlist[prset->index(ic+2)]; } - + if (ic%2==0) { triangles.push_back(Triangle(pidx, pidx1, pidx2, points)); @@ -563,7 +563,7 @@ Triangle_list fillHole(osg::Vec3Array *points, std::vector vind // OSG_WARN<< "vert " << prset->index(ic) << " in array"<index(0)>=npts) @@ -589,7 +589,7 @@ Triangle_list fillHole(osg::Vec3Array *points, std::vector vind { pidx1=vindexlist[prset->index(ic)]; } - + if (prset->index(ic+1)>=npts) { // this is an added point. points->push_back((*constraintverts)[prset->index(ic+1)]); @@ -636,7 +636,7 @@ void DelaunayConstraint::removeVerticesInside(const DelaunayConstraint *dco) * defined as edge of dco subtends>acs(0.999999) */ int nrem=0; - osg::Vec3Array *vertices= dynamic_cast< osg::Vec3Array*>(getVertexArray()); + osg::Vec3Array *vertices= dynamic_cast< osg::Vec3Array*>(getVertexArray()); if (vertices) { for (osg::Vec3Array::iterator vitr=vertices->begin(); vitr!=vertices->end(); ) @@ -792,7 +792,7 @@ bool DelaunayTriangulator::triangulate() // initialize storage structures Triangle_list triangles; - Triangle_list discarded_tris; + Triangle_list discarded_tris; // GWM July 2005 add constraint vertices to terrain linelist::iterator linitr; @@ -824,22 +824,22 @@ bool DelaunayTriangulator::triangulate() // pre-sort sample points OSG_INFO << "DelaunayTriangulator: pre-sorting sample points\n"; - std::sort(points->begin(), points->end(), Sample_point_compare); + std::sort(points->begin(), points->end(), Sample_point_compare); // 24.12.06 add convex hull of points to force sensible outline. osg::ref_ptr dcconvexhull=getconvexhull(points); addInputConstraint(dcconvexhull.get()); // set the last valid index for the point list - GLuint last_valid_index = points->size() - 1; + GLuint last_valid_index = points->size() - 1; // find the minimum and maximum x values in the point list float minx = (*points)[0].x(); float maxx = (*points)[last_valid_index].x(); - // find the minimum and maximum y values in the point list + // find the minimum and maximum y values in the point list float miny = (*points)[0].y(); float maxy = miny; - + OSG_INFO << "DelaunayTriangulator: finding minimum and maximum Y values\n"; osg::Vec3Array::const_iterator mmi; for (mmi=points->begin(); mmi!=points->end(); ++mmi) @@ -847,7 +847,7 @@ bool DelaunayTriangulator::triangulate() if (mmi->y() < miny) miny = mmi->y(); if (mmi->y() > maxy) maxy = mmi->y(); } - + // add supertriangle vertices to the point list // gwm added 1.05* to ensure that supervertices are outside the domain of points. // original value could make 2 coincident points for regular arrays of x,y,h data. @@ -859,17 +859,17 @@ bool DelaunayTriangulator::triangulate() points_->push_back(osg::Vec3(maxx + .10*(maxx - minx), miny - .10*(maxy - miny), 0)); points_->push_back(osg::Vec3(maxx + .10*(maxx - minx), maxy + .10*(maxy - miny), 0)); points_->push_back(osg::Vec3(minx - .10*(maxx - minx), maxy + .10*(maxy - miny), 0)); - - // add supertriangles to triangle list + + // add supertriangles to triangle list triangles.push_back(Triangle(last_valid_index+1, last_valid_index+2, last_valid_index+3, points)); triangles.push_back(Triangle(last_valid_index+4, last_valid_index+1, last_valid_index+3, points)); - - // begin triangulation + + // begin triangulation GLuint pidx = 0; - osg::Vec3Array::const_iterator i; - - OSG_INFO << "DelaunayTriangulator: triangulating vertex grid (" << (points->size()-3) <<" points)\n"; + osg::Vec3Array::const_iterator i; + + OSG_INFO << "DelaunayTriangulator: triangulating vertex grid (" << (points->size()-3) <<" points)\n"; for (i=points->begin(); i!=points->end(); ++i, ++pidx) { @@ -921,7 +921,7 @@ bool DelaunayTriangulator::triangulate() // edge.set_duplicate(true); edge.set_duplicate(!edge.get_duplicate()); } - } + } triangles.erase(j); } } @@ -981,7 +981,7 @@ bool DelaunayTriangulator::triangulate() //check that the edge ip1-ip2 is not already part of the triangulation. if (titr->isedge(ip1,ip2)) edgused=true; if (titr->isedge(ip2,ip1)) edgused=true; - // if (edgused) OSG_WARN << "Edge used in triangle " << it << " " << + // if (edgused) OSG_WARN << "Edge used in triangle " << it << " " << // titr->a()<<","<< titr->b()<<","<< titr->c()<< std::endl; it++; } @@ -1006,7 +1006,7 @@ bool DelaunayTriangulator::triangulate() if (icut>0) { // triangle titr starts the constraint edge - std::vector edgeRight, edgeLeft; + std::vector edgeRight, edgeLeft; edgeRight.push_back(ip1); edgeLeft.push_back(ip1); // OSG_WARN << "hole first " << edgeLeft.back()<< " rt " << edgeRight.back()<< std::endl; @@ -1037,7 +1037,7 @@ bool DelaunayTriangulator::triangulate() trisToDelete.push_back(tradj); icut=tradj->whichEdge(points_.get(),p1,p2,e1,e2); // OSG_WARN << ntr << " cur triedge " << icut << " " << ip1 << - // " to " << ip2 << " tadj " << tradj->a()<< ","<b() <<"," + // " to " << ip2 << " tadj " << tradj->a()<< ","<b() <<"," // <c() <b(); e2=tradj->c();} // icut=1 implies vertex a is not involved else if (icut==2) {e1=tradj->c(); e2=tradj->a();} @@ -1079,7 +1079,7 @@ bool DelaunayTriangulator::triangulate() for (tri=triangles.begin(); tri!=triangles.end(); ) { bool deleted=false; - for (std::vector::iterator deleteTri=trisToDelete.begin(); + for (std::vector::iterator deleteTri=trisToDelete.begin(); deleteTri!=trisToDelete.end(); ) { if (&(*tri)==*deleteTri) @@ -1158,18 +1158,18 @@ bool DelaunayTriangulator::triangulate() pt_indices.push_back(ti->c()); } } - + // LF August 2011 fix crash when no triangle is created if (!pt_indices.size()) { OSG_WARN << "Warning: DelaunayTriangulator::triangulate(): no triangle generated" << std::endl; - return false; - } - + return false; + } + prim_tris_ = new osg::DrawElementsUInt(GL_TRIANGLES, pt_indices.size(), &(pt_indices.front())); OSG_INFO << "DelaunayTriangulator: process done, " << prim_tris_->getNumPrimitives() << " triangles remain\n"; - + return true; } @@ -1264,37 +1264,37 @@ float DelaunayConstraint::windingNumber(const osg::Vec3 &testpoint) const } } } - + return theta/osg::PI/2.0; // should be 0 or 2 pi. } osg::DrawElementsUInt *DelaunayConstraint::makeDrawable() -{ +{ // initialize index storage vector for internal triangles. std::vector pt_indices; pt_indices.reserve(_interiorTris.size() * 3); trilist::const_iterator ti; for (ti=_interiorTris.begin(); ti!=_interiorTris.end(); ++ti) { - + // if (normals_.valid()) { // (normals_.get())->push_back(ti->compute_normal(points)); // } - + pt_indices.push_back((*ti)[0]); pt_indices.push_back((*ti)[1]); pt_indices.push_back((*ti)[2]); } prim_tris_ = new osg::DrawElementsUInt(GL_TRIANGLES, pt_indices.size(), &(pt_indices.front())); - + return prim_tris_.get(); } -bool DelaunayConstraint::contains(const osg::Vec3 &testpoint) const +bool DelaunayConstraint::contains(const osg::Vec3 &testpoint) const { // true if point is internal to the loop. float theta=windingNumber(testpoint); // sum of angles subtended by the line array - the winding number return fabs(theta)>0.9; // should be 0 or 1 (or 2,3,4 for very complex not permitted loops). } -bool DelaunayConstraint::outside(const osg::Vec3 &testpoint) const +bool DelaunayConstraint::outside(const osg::Vec3 &testpoint) const { // true if point is outside the loop. float theta=windingNumber(testpoint); // sum of angles subtended by the line array - the winding number @@ -1364,11 +1364,11 @@ void DelaunayConstraint::handleOverlaps(void) osg::ref_ptr tscx=new osgUtil::Tessellator; // this assembles all the constraints tscx->setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY); tscx->setBoundaryOnly(true); - tscx->setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD); + tscx->setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD); // ODD chooses the winding =1, NOT overlapping areas of constraints. // nb this includes all the edges where delaunay constraints meet // draw a case to convince yourself!. - + tscx->retessellatePolygons(*this); // find all edges } diff --git a/src/osgUtil/DisplayRequirementsVisitor.cpp b/src/osgUtil/DisplayRequirementsVisitor.cpp index ec3dcf7de..2d6dfc094 100644 --- a/src/osgUtil/DisplayRequirementsVisitor.cpp +++ b/src/osgUtil/DisplayRequirementsVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #if defined(_MSC_VER) @@ -34,7 +34,7 @@ void DisplayRequirementsVisitor::applyStateSet(StateSet& stateset) if (!_ds) _ds = new osg::DisplaySettings; unsigned int min = 0; // assume stencil not needed by this stateset. - + if (stateset.getMode(GL_STENCIL_TEST) & StateAttribute::ON) { min = 1; // number stencil bits we need at least. @@ -44,12 +44,12 @@ void DisplayRequirementsVisitor::applyStateSet(StateSet& stateset) { min = 1; // number stencil bits we need at least. } - + if (min>_ds->getMinimumNumStencilBits()) { // only update if new minimum exceeds previous minimum. _ds->setMinimumNumStencilBits(min); - } + } } void DisplayRequirementsVisitor::apply(Node& node) @@ -76,7 +76,7 @@ void DisplayRequirementsVisitor::apply(Geode& geode) { osg::StateSet* geode_stateset = geode.getStateSet(); if (geode_stateset) applyStateSet(*geode_stateset); - + for(unsigned int i = 0; i < geode.getNumDrawables(); i++ ) { osg::StateSet* stateset = geode.getDrawable(i)->getStateSet(); diff --git a/src/osgUtil/DrawElementTypeSimplifier.cpp b/src/osgUtil/DrawElementTypeSimplifier.cpp index 8ac8c45a3..0102bc2a5 100644 --- a/src/osgUtil/DrawElementTypeSimplifier.cpp +++ b/src/osgUtil/DrawElementTypeSimplifier.cpp @@ -3,24 +3,24 @@ #include template -OutType * copy(InType& array) +OutType * copy(InType& array) { unsigned int size = array.size(); OutType * newArray = new OutType(array.getMode(), size); OutType & na = *newArray; - + for (unsigned int i = 0; i < size; ++i) na[i] = array[i]; - + return newArray; } template -unsigned int getMax(InType& array) +unsigned int getMax(InType& array) { unsigned int max = 0; unsigned int size = array.size(); - - for (unsigned int i = 0; i < size; ++i) + + for (unsigned int i = 0; i < size; ++i) { if (array[i] > max) max = array[i]; } @@ -35,9 +35,9 @@ void DrawElementTypeSimplifier::simplify(osg::Geometry & geometry) const { osg::Geometry::PrimitiveSetList & psl = geometry.getPrimitiveSetList(); osg::Geometry::PrimitiveSetList::iterator it, end = psl.end(); - + unsigned int max = 0; - + for (it = psl.begin(); it!=end; ++it) { switch ((*it)->getType()) @@ -45,39 +45,39 @@ void DrawElementTypeSimplifier::simplify(osg::Geometry & geometry) const case osg::PrimitiveSet::DrawElementsUShortPrimitiveType: { osg::DrawElementsUShort & de = *static_cast(it->get()); - + max = getMax(de); if (max < 255) *it = copy(de); - + break; } case osg::PrimitiveSet::DrawElementsUIntPrimitiveType: { osg::DrawElementsUInt & de = *static_cast(it->get()); - + max = getMax(de); if (max < 256) *it = copy(de); else if (max < 65536) *it = copy(de); - + break; } default: break; } } } - + void DrawElementTypeSimplifierVisitor::apply(osg::Geode& node) { DrawElementTypeSimplifier dets; - + unsigned int numDrawables = node.getNumDrawables(); for (unsigned int i = 0; i != numDrawables; ++i) { osg::Geometry * geom = dynamic_cast(node.getDrawable(i)); if (geom) dets.simplify(*geom); - } - - osg::NodeVisitor::apply((osg::Node&)node); + } + + osg::NodeVisitor::apply((osg::Node&)node); } } diff --git a/src/osgUtil/EdgeCollector.cpp b/src/osgUtil/EdgeCollector.cpp index 33550136e..94a5265e5 100644 --- a/src/osgUtil/EdgeCollector.cpp +++ b/src/osgUtil/EdgeCollector.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -31,7 +31,7 @@ bool EdgeCollector::Point::isBoundaryPoint() const if ((triangle->_e1->_p1==this || triangle->_e1->_p2==this) && triangle->_e1->isBoundaryEdge()) return true; if ((triangle->_e2->_p1==this || triangle->_e2->_p2==this) && triangle->_e2->isBoundaryEdge()) return true; if ((triangle->_e3->_p1==this || triangle->_e3->_p2==this) && triangle->_e3->isBoundaryEdge()) return true; - + //if ((*itr)->isBoundaryTriangle()) return true; } return false; @@ -46,13 +46,13 @@ void EdgeCollector::Edge::clear() _triangles.clear(); } - - + + bool EdgeCollector::Edge::operator < ( const Edge& rhs) const { if (dereference_check_less(_p1,rhs._p1)) return true; if (dereference_check_less(rhs._p1,_p1)) return false; - + return dereference_check_less(_p2,rhs._p2); } @@ -95,7 +95,7 @@ void EdgeCollector::Triangle::clear() _op1 = 0; _op2 = 0; _op3 = 0; - + _e1 = 0; _e2 = 0; _e3 = 0; @@ -107,14 +107,14 @@ bool EdgeCollector::Triangle::operator < (const Triangle& rhs) const if (dereference_check_less(rhs._p1,_p1)) return false; - const Point* lhs_lower = dereference_check_less(_p2,_p3) ? _p2.get() : _p3.get(); - const Point* rhs_lower = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p2.get() : rhs._p3.get(); + const Point* lhs_lower = dereference_check_less(_p2,_p3) ? _p2.get() : _p3.get(); + const Point* rhs_lower = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p2.get() : rhs._p3.get(); if (dereference_check_less(lhs_lower,rhs_lower)) return true; if (dereference_check_less(rhs_lower,lhs_lower)) return false; - const Point* lhs_upper = dereference_check_less(_p2,_p3) ? _p3.get() : _p2.get(); - const Point* rhs_upper = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p3.get() : rhs._p2.get(); + const Point* lhs_upper = dereference_check_less(_p2,_p3) ? _p3.get() : _p2.get(); + const Point* rhs_upper = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p3.get() : rhs._p2.get(); return dereference_check_less(lhs_upper,rhs_upper); } @@ -123,7 +123,7 @@ bool EdgeCollector::Triangle::operator < (const Triangle& rhs) const void EdgeCollector::Triangle::setOrderedPoints(Point* p1, Point* p2, Point* p3) { Point* points[3]; - + _op1 = points[0] = p1; _op2 = points[1] = p2; _op3 = points[2] = p3; @@ -136,45 +136,45 @@ void EdgeCollector::Triangle::setOrderedPoints(Point* p1, Point* p2, Point* p3) _p1 = points[lowest]; _p2 = points[(lowest+1)%3]; _p3 = points[(lowest+2)%3]; - + _plane.set(_op1->_vertex,_op2->_vertex,_op3->_vertex); } - + osg::UIntArray * EdgeCollector::Edgeloop::toIndexArray() const { osg::UIntArray * indexArray = new osg::UIntArray; - + EdgeList::const_iterator it = _edgeList.begin(), end = _edgeList.end(); - - for (;it != end; ++it) + + for (;it != end; ++it) indexArray->push_back((*it)->_op1->_index); - + return indexArray; } - + EdgeCollector::Triangle* EdgeCollector::addTriangle(unsigned int p1, unsigned int p2, unsigned int p3) { //OSG_NOTICE<<"addTriangle("<_vertex == _originalPointList[p2]->_vertex) || + if ((_originalPointList[p1]->_vertex == _originalPointList[p2]->_vertex) || (_originalPointList[p2]->_vertex == _originalPointList[p3]->_vertex) || (_originalPointList[p3]->_vertex == _originalPointList[p1]->_vertex)) return 0; - + Triangle* triangle = new Triangle; triangle->setOrderedPoints(addPoint(triangle, p1), addPoint(triangle, p2), addPoint(triangle, p3)); - + triangle->_e1 = addEdge(triangle, triangle->_op1.get(), triangle->_op2.get()); triangle->_e2 = addEdge(triangle, triangle->_op2.get(), triangle->_op3.get()); triangle->_e3 = addEdge(triangle, triangle->_op3.get(), triangle->_op1.get()); - + _triangleSet.insert(triangle); - + return triangle; } @@ -184,10 +184,10 @@ EdgeCollector::Triangle* EdgeCollector::addTriangle(Point* p1, Point* p2, Point* // detect if triangle is degenerate. if (p1==p2 || p2==p3 || p1==p3) return 0; - if ((p1->_vertex == p2->_vertex) || + if ((p1->_vertex == p2->_vertex) || (p2->_vertex == p3->_vertex) || (p3->_vertex == p1->_vertex)) return 0; - + Triangle* triangle = new Triangle; triangle->setOrderedPoints(addPoint(triangle, p1), addPoint(triangle, p2), addPoint(triangle, p3)); @@ -195,19 +195,19 @@ EdgeCollector::Triangle* EdgeCollector::addTriangle(Point* p1, Point* p2, Point* triangle->_e1 = addEdge(triangle, triangle->_op1.get(), triangle->_op2.get()); triangle->_e2 = addEdge(triangle, triangle->_op2.get(), triangle->_op3.get()); triangle->_e3 = addEdge(triangle, triangle->_op3.get(), triangle->_op1.get()); - + _triangleSet.insert(triangle); return triangle; } - + EdgeCollector::Edge* EdgeCollector::addEdge(Triangle* triangle, Point* p1, Point* p2) { // OSG_NOTICE<<" addEdge("< edge = new Edge; edge->setOrderedPoints(p1,p2); - + EdgeSet::iterator itr = _edgeSet.find(edge); if (itr==_edgeSet.end()) { @@ -219,9 +219,9 @@ EdgeCollector::Edge* EdgeCollector::addEdge(Triangle* triangle, Point* p1, Point // OSG_NOTICE<<" reuseEdge("<_p1="<_p1.get()<<" _p2="<_p2.get()<addTriangle(triangle); - + return edge.get(); } @@ -230,7 +230,7 @@ EdgeCollector::Edge* EdgeCollector::addEdge(Triangle* triangle, Point* p1, Point EdgeCollector::Point* EdgeCollector::addPoint(Triangle* triangle, Point* point) { - + PointSet::iterator itr = _pointSet.find(point); if (itr==_pointSet.end()) { @@ -244,7 +244,7 @@ EdgeCollector::Point* EdgeCollector::addPoint(Triangle* triangle, Point* point) } point->_triangles.insert(triangle); - + return point; } @@ -259,16 +259,16 @@ void EdgeCollector::getBoundaryEdgeList(EdgeList & el) bool EdgeCollector::extractBoundaryEdgeloop(EdgeList & el, Edgeloop & edgeloop) { if (el.empty()) return false; - - + + osg::ref_ptr current = el.back(); el.pop_back(); - + // ** init the Edgeloop edgeloop._edgeList.push_back(current.get()); - - - + + + bool done = false; while (!done) { @@ -285,7 +285,7 @@ bool EdgeCollector::extractBoundaryEdgeloop(EdgeList & el, Edgeloop & edgeloop) ++it; } } - + if (!found) { OSG_WARN << "extractBoundaryEdgeloop : unable to close edge loop" << std::endl; @@ -296,7 +296,7 @@ bool EdgeCollector::extractBoundaryEdgeloop(EdgeList & el, Edgeloop & edgeloop) edgeloop._edgeList.push_back(it->get()); current = it->get(); el.erase(it); - + if (edgeloop.isClosed()) done = true; } } @@ -308,7 +308,7 @@ bool EdgeCollector::extractBoundaryEdgeloopList(EdgeList & el, EdgeloopList & ed while (!el.empty()) { osg::ref_ptr edgeloop(new Edgeloop); - + if (extractBoundaryEdgeloop(el, *edgeloop)) edgeloopList.push_back(edgeloop); else @@ -316,12 +316,12 @@ bool EdgeCollector::extractBoundaryEdgeloopList(EdgeList & el, EdgeloopList & ed } return true; } - - - + + + struct CollectTriangleOperator { @@ -329,8 +329,8 @@ struct CollectTriangleOperator CollectTriangleOperator():_ec(0) {} void setEdgeCollector(EdgeCollector* ec) { _ec = ec; } - - EdgeCollector* _ec; + + EdgeCollector* _ec; // for use in the triangle functor. inline void operator()(unsigned int p1, unsigned int p2, unsigned int p3) @@ -348,89 +348,89 @@ class CopyVertexArrayToPointsVisitor : public osg::ArrayVisitor public: CopyVertexArrayToPointsVisitor(EdgeCollector::PointList& pointList): _pointList(pointList) {} - + virtual void apply(osg::Vec2Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollector::Point; _pointList[i]->_index = i; - - osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); + + osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); } } virtual void apply(osg::Vec3Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollector::Point; _pointList[i]->_index = i; - + _pointList[i]->_vertex = array[i]; } } - + virtual void apply(osg::Vec4Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollector::Point; _pointList[i]->_index = i; - - osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); + + osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); } } virtual void apply(osg::Vec2dArray& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollector::Point; _pointList[i]->_index = i; - - osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); + + osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); } } - + virtual void apply(osg::Vec3dArray& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollector::Point; _pointList[i]->_index = i; - + _pointList[i]->_vertex = array[i]; } } - + virtual void apply(osg::Vec4dArray& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollector::Point; _pointList[i]->_index = i; - - osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); + + osgUtil::ConvertVec::convert(array[i], _pointList[i]->_vertex); } } - + EdgeCollector::PointList& _pointList; - + protected: - + CopyVertexArrayToPointsVisitor& operator = (const CopyVertexArrayToPointsVisitor&) { return *this; } }; @@ -447,7 +447,7 @@ EdgeCollector::~EdgeCollector() void EdgeCollector::setGeometry(osg::Geometry* geometry) { _geometry = geometry; - + // check to see if vertex attributes indices exists, if so expand them to remove them if (_geometry->suitableForOptimization()) { @@ -457,27 +457,27 @@ void EdgeCollector::setGeometry(osg::Geometry* geometry) } unsigned int numVertices = geometry->getVertexArray()->getNumElements(); - + _originalPointList.resize(numVertices); - + // copy vertices across to local point list CopyVertexArrayToPointsVisitor copyVertexArrayToPoints(_originalPointList); _geometry->getVertexArray()->accept(copyVertexArrayToPoints); - + CollectTriangleIndexFunctor collectTriangles; collectTriangles.setEdgeCollector(this); - + _geometry->accept(collectTriangles); } - + // ** search BoundaryEdgeloop in the geometry, extrude this loop // ** and create primitiveSet to link original loop and extruded loop void EdgeCollector::getEdgeloopIndexList(IndexArrayList & ial) -{ +{ // ** collect Boundary Edge EdgeList edgeList; getBoundaryEdgeList(edgeList); - + // ** collect Edgeloop EdgeloopList edgeloopList; if (extractBoundaryEdgeloopList(edgeList, edgeloopList) == false) @@ -485,7 +485,7 @@ void EdgeCollector::getEdgeloopIndexList(IndexArrayList & ial) OSG_WARN << "EdgeCollector: fail to collect Edgeloop.\n\n\n" << std::endl; return; } - + // ** get IndexArray of each Edgeloop EdgeloopList::iterator elIt, elEnd = edgeloopList.end(); for (elIt = edgeloopList.begin(); elIt != elEnd; ++elIt) diff --git a/src/osgUtil/GLObjectsVisitor.cpp b/src/osgUtil/GLObjectsVisitor.cpp index c9f5b0948..6a686f2cf 100644 --- a/src/osgUtil/GLObjectsVisitor.cpp +++ b/src/osgUtil/GLObjectsVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -16,7 +16,7 @@ #include #include -namespace osgUtil +namespace osgUtil { ///////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ void GLObjectsVisitor::apply(osg::Geode& node) void GLObjectsVisitor::apply(osg::Drawable& drawable) { if (_drawablesAppliedSet.count(&drawable)!=0) return; - + _drawablesAppliedSet.insert(&drawable); if (_mode&SWITCH_OFF_DISPLAY_LISTS) @@ -104,18 +104,18 @@ void GLObjectsVisitor::apply(osg::Drawable& drawable) void GLObjectsVisitor::apply(osg::StateSet& stateset) { if (_stateSetAppliedSet.count(&stateset)!=0) return; - + _stateSetAppliedSet.insert(&stateset); if (_mode & COMPILE_STATE_ATTRIBUTES && _renderInfo.getState()) { stateset.compileGLObjects(*_renderInfo.getState()); - + osg::Program* program = dynamic_cast(stateset.getAttribute(osg::StateAttribute::PROGRAM)); if (program) { if( program->isFixedFunction() ) _lastCompiledProgram = NULL; // It does not make sense to apply uniforms on fixed pipe - else + else _lastCompiledProgram = program; } @@ -125,9 +125,9 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset) if (pcp) { pcp->useProgram(); - + _renderInfo.getState()->setLastAppliedProgramObject(pcp); - + osg::StateSet::UniformList& ul = stateset.getUniformList(); for(osg::StateSet::UniformList::iterator itr = ul.begin(); itr != ul.end(); @@ -138,19 +138,19 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset) } } else if(_renderInfo.getState()->getLastAppliedProgramObject()){ - + osg::GL2Extensions* extensions = osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true); extensions->glUseProgram(0); _renderInfo.getState()->setLastAppliedProgramObject(0); } - + } if (_mode & RELEASE_STATE_ATTRIBUTES) { stateset.releaseGLObjects(_renderInfo.getState()); } - + if (_mode & CHECK_BLACK_LISTED_MODES) { stateset.checkValidityOfAssociatedModes(*_renderInfo.getState()); @@ -178,11 +178,11 @@ GLObjectsOperation::GLObjectsOperation(osg::Node* subgraph, GLObjectsVisitor::Mo void GLObjectsOperation::operator () (osg::GraphicsContext* context) { GLObjectsVisitor glObjectsVisitor(_mode); - + context->getState()->initializeExtensionProcs(); glObjectsVisitor.setState(context->getState()); - + // OSG_NOTICE<<"GLObjectsOperation::before <<<<<<<<<<<"< diff --git a/src/osgUtil/HighlightMapGenerator.cpp b/src/osgUtil/HighlightMapGenerator.cpp index 3fce87de1..e0bd52eee 100644 --- a/src/osgUtil/HighlightMapGenerator.cpp +++ b/src/osgUtil/HighlightMapGenerator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osgUtil/IncrementalCompileOperation.cpp b/src/osgUtil/IncrementalCompileOperation.cpp index 84c74bca3..a65175aec 100644 --- a/src/osgUtil/IncrementalCompileOperation.cpp +++ b/src/osgUtil/IncrementalCompileOperation.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -27,7 +27,7 @@ #include #include -namespace osgUtil +namespace osgUtil { @@ -343,7 +343,7 @@ double IncrementalCompileOperation::CompileList::estimatedTimeForCompile(Compile bool IncrementalCompileOperation::CompileList::compile(CompileInfo& compileInfo) { //#define USE_TIME_ESTIMATES - + for(CompileOps::iterator itr = _compileOps.begin(); itr != _compileOps.end() && compileInfo.okToCompile(); ) @@ -581,7 +581,7 @@ void IncrementalCompileOperation::add(CompileSet* compileSet, bool callBuildComp // and reducing the change of frame drop. compileSet->_subgraphToCompile->getBound(); } - + if (callBuildCompileMap) compileSet->buildCompileMap(_contexts); OSG_INFO<<"IncrementalCompileOperation::add(CompileSet = "<addChild(cs->_subgraphToCompile.get()); } } - + _compiled.clear(); } @@ -658,21 +658,21 @@ void IncrementalCompileOperation::operator () (osg::GraphicsContext* context) //glFinish(); //glFlush(); - + double targetFrameRate = _targetFrameRate; double minimumTimeAvailableForGLCompileAndDeletePerFrame = _minimumTimeAvailableForGLCompileAndDeletePerFrame; double targetFrameTime = 1.0/targetFrameRate; - + const osg::FrameStamp* fs = context->getState()->getFrameStamp(); double currentTime = fs ? fs->getReferenceTime() : 0.0; double currentElapsedFrameTime = context->getTimeSinceLastClear(); - + OSG_NOTIFY(level)<<"IncrementalCompileOperation()"<valid()) { OSG_WARN<<"Warning: invalid line segment passed to IntersectVisitor::addLineSegment(..)"<start()<<" "<end()<<" segment ignored.."<< std::endl; return; } - + IntersectState* cis = _intersectStateStack.back().get(); - + if (cis->_segList.size()>=32) { OSG_WARN<<"Warning: excessive number of line segmenets passed to IntersectVisitor::addLineSegment(..), maximum permitted is 32 line segments."<_view_matrix = cis->_view_matrix; nis->_view_inverse = cis->_view_inverse; - + // set up new model matrix nis->_model_matrix = matrix; if (cis->_model_matrix.valid()) @@ -372,11 +372,11 @@ bool IntersectVisitor::enterNode(Node& node) else { IntersectState* cis = _intersectStateStack.back().get(); - if (!cis->_segmentMaskStack.empty()) + if (!cis->_segmentMaskStack.empty()) cis->_segmentMaskStack.push_back(cis->_segmentMaskStack.back()); else cis->_segmentMaskStack.push_back(0xffffffff); - + return true; } } @@ -406,20 +406,20 @@ struct TriangleHit _index(index), _normal(normal), _r1(r1), - _v1(v1), + _v1(v1), _r2(r2), - _v2(v2), + _v2(v2), _r3(r3), _v3(v3) {} unsigned int _index; const osg::Vec3 _normal; float _r1; - const osg::Vec3* _v1; + const osg::Vec3* _v1; float _r2; - const osg::Vec3* _v2; + const osg::Vec3* _v2; float _r3; - const osg::Vec3* _v3; + const osg::Vec3* _v3; protected: @@ -439,11 +439,11 @@ struct TriangleIntersect int _index; float _ratio; bool _hit; - - + + typedef std::multimap TriangleHitList; - + TriangleHitList _thl; TriangleIntersect(): @@ -458,7 +458,7 @@ struct TriangleIntersect { set(seg,ratio); } - + void set(const LineSegment& seg,float ratio=FLT_MAX) { _seg=new LineSegment(seg); @@ -523,18 +523,18 @@ struct TriangleIntersect if (ds31>0.0f) return; if (ds31(r,TriangleHit(_index-1,normal,r1,0,r2,0,r3,0))); @@ -604,15 +604,15 @@ bool IntersectVisitor::intersect(Drawable& drawable) drawable.accept(ti); if (ti._hit) { - + osg::Geometry* geometry = drawable.asGeometry(); - + for(TriangleIntersect::TriangleHitList::iterator thitr=ti._thl.begin(); thitr!=ti._thl.end(); ++thitr) { - + Hit hit; hit._nodePath = _nodePath; hit._matrix = cis->_model_matrix; @@ -622,7 +622,7 @@ bool IntersectVisitor::intersect(Drawable& drawable) else hit._geode = dynamic_cast(_nodePath.back()); TriangleHit& triHit = thitr->second; - + hit._ratio = thitr->first; hit._primitiveIndex = triHit._index; hit._originalLineSegment = sitr->first; @@ -632,7 +632,7 @@ bool IntersectVisitor::intersect(Drawable& drawable) sitr->second->end()*hit._ratio; hit._intersectNormal = triHit._normal; - + if (geometry) { osg::Vec3Array* vertices = dynamic_cast(geometry->getVertexArray()); @@ -644,7 +644,7 @@ bool IntersectVisitor::intersect(Drawable& drawable) if (triHit._v3) hit._vecIndexList.push_back(triHit._v3-first); } } - + _segHitList[sitr->first.get()].push_back(hit); @@ -669,7 +669,7 @@ void IntersectVisitor::apply(Geode& geode) { intersect(*geode.getDrawable(i)); } - + leaveNode(); } @@ -746,8 +746,8 @@ PickVisitor::PickVisitor(const osg::Viewport* viewport, const osg::Matrixd& proj { setLODSelectionMode(USE_SEGMENT_START_POINT_AS_EYE_POINT_FOR_LOD_LEVEL_SELECTION); - if (viewport && - mx >= static_cast(viewport->x()) && + if (viewport && + mx >= static_cast(viewport->x()) && my >= static_cast(viewport->y()) && mx < static_cast(viewport->x()+viewport->width()) && my < static_cast(viewport->y()+viewport->height())) @@ -777,7 +777,7 @@ PickVisitor::PickVisitor(const osg::Viewport* viewport, const osg::Matrixd& proj { OSG_NOTICE<<"Warning: PickVisitor not set up correctly, picking errors likely"<enter(node)) foundIntersections = true; else (*itr)->incrementDisabledCount(); } - - if (!foundIntersections) + + if (!foundIntersections) { // need to call leave to clean up the DisabledCount's. leave(); return false; } - + // we have found at least one suitable intersector, so return true return true; } @@ -113,11 +113,11 @@ void IntersectorGroup::intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable if (!(*itr)->disabled()) { (*itr)->intersect(iv, drawable); - + ++numTested; } } - + // OSG_NOTICE<<"Number testing "<(intersector); - if (ls) + if (ls) { setReferenceEyePoint(ls->getStart()); setReferenceEyePointCoordinateFrame(ls->getCoordinateFrame()); @@ -175,7 +175,7 @@ IntersectionVisitor::IntersectionVisitor(Intersector* intersector, ReadCallback* } setIntersector(intersector); - + setReadCallback(readCallback); } @@ -195,7 +195,7 @@ void IntersectionVisitor::reset() { osg::ref_ptr intersector = _intersectorStack.front(); intersector->reset(); - + _intersectorStack.clear(); _intersectorStack.push_back(intersector); } @@ -308,7 +308,7 @@ void IntersectionVisitor::apply(osg::PagedLOD& plod) targetRangeValue = 1e6; // Init high to find min value else targetRangeValue = 0; // Init low to find max value - + const osg::LOD::RangeList rl = plod.getRangeList(); osg::LOD::RangeList::const_iterator rit; for( rit = rl.begin(); @@ -363,17 +363,17 @@ void IntersectionVisitor::apply(osg::PagedLOD& plod) child->accept(*this); } } -#else +#else // older code than above block, that assumes that the PagedLOD is ordered correctly // i.e. low res children first, no duplicate ranges. - + osg::ref_ptr highestResChild; if (plod.getNumFileNames() != plod.getNumChildren() && _readCallback.valid()) { highestResChild = _readCallback->readNodeFile( plod.getDatabasePath() + plod.getFileName(plod.getNumFileNames()-1) ); } - + if ( !highestResChild.valid() && plod.getNumChildren()>0) { highestResChild = plod.getChild( plod.getNumChildren()-1 ); @@ -403,10 +403,10 @@ void IntersectionVisitor::apply(osg::Transform& transform) push_clone(); traverse(transform); - + // pop the clone. pop_clone(); - + popModelMatrix(); // tidy up an cached cull variables in the current intersector. @@ -424,10 +424,10 @@ void IntersectionVisitor::apply(osg::Projection& projection) push_clone(); traverse(projection); - + // pop the clone. pop_clone(); - + popProjectionMatrix(); leave(); @@ -440,7 +440,7 @@ void IntersectionVisitor::apply(osg::Camera& camera) // note, commenting out right now because default Camera setup is with the culling active. Should this be changed? // if (!enter(camera)) return; - + // OSG_NOTICE<<"inside apply(Camera&)"<accept(av); } } - + ArrayList _arrayList; // True if geometry contains bindings that are compatible with // DrawElements. @@ -113,7 +113,7 @@ struct VertexAttribComparitor : public GeometryArrayGatherer : GeometryArrayGatherer(geometry) { } - + bool operator() (unsigned int lhs, unsigned int rhs) const { for(ArrayList::const_iterator itr=_arrayList.begin(); @@ -125,7 +125,7 @@ struct VertexAttribComparitor : public GeometryArrayGatherer if (compare==1) return false; } return false; - } + } int compare(unsigned int lhs, unsigned int rhs) { @@ -141,7 +141,7 @@ struct VertexAttribComparitor : public GeometryArrayGatherer } protected: - VertexAttribComparitor& operator = (const VertexAttribComparitor&) { return *this; } + VertexAttribComparitor& operator = (const VertexAttribComparitor&) { return *this; } }; @@ -150,9 +150,9 @@ class RemapArray : public osg::ArrayVisitor { public: RemapArray(const IndexList& remapping):_remapping(remapping) {} - + const IndexList& _remapping; - + template inline void remap(T& array) { @@ -165,7 +165,7 @@ class RemapArray : public osg::ArrayVisitor } array.erase(array.begin()+_remapping.size(),array.end()); } - + virtual void apply(osg::Array&) {} virtual void apply(osg::ByteArray& array) { remap(array); } virtual void apply(osg::ShortArray& array) { remap(array); } @@ -179,12 +179,12 @@ class RemapArray : public osg::ArrayVisitor virtual void apply(osg::Vec2Array& array) { remap(array); } virtual void apply(osg::Vec3Array& array) { remap(array); } virtual void apply(osg::Vec4Array& array) { remap(array); } - + virtual void apply(osg::Vec4ubArray& array) { remap(array); } - virtual void apply(osg::Vec2bArray& array) { remap(array); } - virtual void apply(osg::Vec3bArray& array) { remap(array); } - virtual void apply(osg::Vec4bArray& array) { remap(array); } + virtual void apply(osg::Vec2bArray& array) { remap(array); } + virtual void apply(osg::Vec3bArray& array) { remap(array); } + virtual void apply(osg::Vec4bArray& array) { remap(array); } virtual void apply(osg::Vec2sArray& array) { remap(array); } virtual void apply(osg::Vec3sArray& array) { remap(array); } @@ -193,7 +193,7 @@ class RemapArray : public osg::ArrayVisitor virtual void apply(osg::Vec2dArray& array) { remap(array); } virtual void apply(osg::Vec3dArray& array) { remap(array); } virtual void apply(osg::Vec4dArray& array) { remap(array); } - + virtual void apply(osg::MatrixfArray& array) { remap(array); } protected: @@ -236,7 +236,7 @@ void IndexMeshVisitor::makeMesh(Geometry& geom) if (geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE || geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return; - + if (geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE || geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return; @@ -275,7 +275,7 @@ void IndexMeshVisitor::makeMesh(Geometry& geom) || type == PrimitiveSet::DrawElementsUIntPrimitiveType)) numNonIndexedPrimitives++; } - + // nothing to index if (!numSurfacePrimitives || !numNonIndexedPrimitives) return; @@ -289,7 +289,7 @@ void IndexMeshVisitor::makeMesh(Geometry& geom) // compute duplicate vertices - + typedef std::vector IndexList; unsigned int numVertices = geom.getVertexArray()->getNumElements(); IndexList indices(numVertices); @@ -298,7 +298,7 @@ void IndexMeshVisitor::makeMesh(Geometry& geom) { indices[i] = i; } - + VertexAttribComparitor arrayComparitor(geom); std::sort(indices.begin(),indices.end(),arrayComparitor); @@ -311,7 +311,7 @@ void IndexMeshVisitor::makeMesh(Geometry& geom) lastUnique = i; ++numUnique; } - + } IndexList remapDuplicatesToOrignals(numVertices); lastUnique = 0; @@ -332,7 +332,7 @@ void IndexMeshVisitor::makeMesh(Geometry& geom) } lastUnique = i; } - + } unsigned int min_index = indices[lastUnique]; for(j=lastUnique+1;jscore > 0.0); // Add triangle vertices, and remove triangle from the - // vertices that use it. + // vertices that use it. triToAdd->score = -1.0f; unsigned triToAddIdx = triToAdd - &triangles[0]; for (unsigned i = 0; i < 3; ++i) @@ -1055,12 +1055,12 @@ public: virtual void apply(osg::Vec2Array& array) { remap(array); } virtual void apply(osg::Vec3Array& array) { remap(array); } virtual void apply(osg::Vec4Array& array) { remap(array); } - + virtual void apply(osg::Vec4ubArray& array) { remap(array); } - virtual void apply(osg::Vec2bArray& array) { remap(array); } - virtual void apply(osg::Vec3bArray& array) { remap(array); } - virtual void apply(osg::Vec4bArray& array) { remap(array); } + virtual void apply(osg::Vec2bArray& array) { remap(array); } + virtual void apply(osg::Vec3bArray& array) { remap(array); } + virtual void apply(osg::Vec4bArray& array) { remap(array); } virtual void apply(osg::Vec2sArray& array) { remap(array); } virtual void apply(osg::Vec3sArray& array) { remap(array); } @@ -1069,7 +1069,7 @@ public: virtual void apply(osg::Vec2dArray& array) { remap(array); } virtual void apply(osg::Vec3dArray& array) { remap(array); } virtual void apply(osg::Vec4dArray& array) { remap(array); } - + virtual void apply(osg::MatrixfArray& array) { remap(array); } }; @@ -1081,10 +1081,10 @@ struct VertexReorderOperator unsigned seq; vector remap; - VertexReorderOperator() : seq(0) + VertexReorderOperator() : seq(0) { } - + void inline doVertex(unsigned v) { if (remap[v] == Remapper::invalidIndex) @@ -1104,7 +1104,7 @@ struct VertexReorder : public TriangleIndexFunctor { remap.resize(numVerts, Remapper::invalidIndex); } - + }; } diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 95f818b02..58a9ba1a5 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -1,13 +1,13 @@ /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -60,8 +60,8 @@ static osg::ApplicationUsageProxy Optimizer_e0(osg::ApplicationUsage::ENVIRONMEN void Optimizer::optimize(osg::Node* node) { unsigned int options = 0; - - + + const char* env = getenv("OSG_OPTIMIZER"); if (env) { @@ -116,13 +116,13 @@ void Optimizer::optimize(osg::Node* node) if(str.find("~MAKE_FAST_GEOMETRY")!=std::string::npos) options ^= MAKE_FAST_GEOMETRY; else if(str.find("MAKE_FAST_GEOMETRY")!=std::string::npos) options |= MAKE_FAST_GEOMETRY; - + if(str.find("~FLATTEN_BILLBOARDS")!=std::string::npos) options ^= FLATTEN_BILLBOARDS; else if(str.find("FLATTEN_BILLBOARDS")!=std::string::npos) options |= FLATTEN_BILLBOARDS; - + if(str.find("~TEXTURE_ATLAS_BUILDER")!=std::string::npos) options ^= TEXTURE_ATLAS_BUILDER; else if(str.find("TEXTURE_ATLAS_BUILDER")!=std::string::npos) options |= TEXTURE_ATLAS_BUILDER; - + if(str.find("~STATIC_OBJECT_DETECTION")!=std::string::npos) options ^= STATIC_OBJECT_DETECTION; else if(str.find("STATIC_OBJECT_DETECTION")!=std::string::npos) options |= STATIC_OBJECT_DETECTION; @@ -148,7 +148,7 @@ void Optimizer::optimize(osg::Node* node) void Optimizer::optimize(osg::Node* node, unsigned int options) { StatsVisitor stats; - + if (osg::getNotifyLevel()>=osg::INFO) { node->accept(stats); @@ -168,9 +168,9 @@ void Optimizer::optimize(osg::Node* node, unsigned int options) OSG_INFO<<"Optimizer::optimize() doing TESSELLATE_GEOMETRY"<accept(tsv); + node->accept(tsv); } - + if (options & REMOVE_LOADED_PROXY_NODES) { OSG_INFO<<"Optimizer::optimize() doing REMOVE_LOADED_PROXY_NODES"<accept(clv); + node->accept(clv); clv.combineLODs(); } - + if (options & OPTIMIZE_TEXTURE_SETTINGS) { OSG_INFO<<"Optimizer::optimize() doing OPTIMIZE_TEXTURE_SETTINGS"<accept(osv); osv.optimize(); } - + if (options & TEXTURE_ATLAS_BUILDER) { OSG_INFO<<"Optimizer::optimize() doing TEXTURE_ATLAS_BUILDER"<accept(tav); @@ -232,7 +232,7 @@ void Optimizer::optimize(osg::Node* node, unsigned int options) node->accept(osv); osv.optimize(); } - + if (options & COPY_SHARED_NODES) { OSG_INFO<<"Optimizer::optimize() doing COPY_SHARED_NODES"<accept(cssv); cssv.copySharedNodes(); } - + if (options & FLATTEN_STATIC_TRANSFORMS) { OSG_INFO<<"Optimizer::optimize() doing FLATTEN_STATIC_TRANSFORMS"<accept(visitor); osg::Timer_t endTick = osg::Timer::instance()->tick(); - + OSG_INFO<<"MERGE_GEODES took "<delta_s(startTick,endTick)<delta_s(startTick,endTick)< -struct LessDerefFunctor +struct LessDerefFunctor { bool operator () (const T* lhs,const T* rhs) const { - return (*lhs<*rhs); + return (*lhs<*rhs); } }; @@ -426,7 +426,7 @@ struct LessStateSetFunctor { bool operator () (const osg::StateSet* lhs,const osg::StateSet* rhs) const { - return (*lhs<*rhs); + return (*lhs<*rhs); } }; @@ -444,9 +444,9 @@ void Optimizer::StateVisitor::addStateSet(osg::StateSet* stateset,osg::Object* o void Optimizer::StateVisitor::apply(osg::Node& node) { - + osg::StateSet* ss = node.getStateSet(); - if (ss && ss->getDataVariance()==osg::Object::STATIC) + if (ss && ss->getDataVariance()==osg::Object::STATIC) { if (isOperationPermissibleForObject(&node) && isOperationPermissibleForObject(ss)) @@ -463,8 +463,8 @@ void Optimizer::StateVisitor::apply(osg::Geode& geode) if (!isOperationPermissibleForObject(&geode)) return; osg::StateSet* ss = geode.getStateSet(); - - + + if (ss && ss->getDataVariance()==osg::Object::STATIC) { if (isOperationPermissibleForObject(ss)) @@ -504,9 +504,9 @@ void Optimizer::StateVisitor::optimize() // create map from uniforms to stateset when contain them. typedef std::set StateSetSet; typedef std::map UniformToStateSetMap; - + const unsigned int NON_TEXTURE_ATTRIBUTE = 0xffffffff; - + UniformToStateSetMap uniformToStateSetMap; // NOTE - TODO will need to track state attribute override value too. @@ -606,8 +606,8 @@ void Optimizer::StateVisitor::optimize() else first_unique = current; } } - - + + if (uniformToStateSetMap.size()>=2) { // create unique set of uniform pointers. @@ -636,7 +636,7 @@ void Optimizer::StateVisitor::optimize() OSG_INFO << "searching for duplicate uniforms"<< std::endl; // find the duplicates. UniformList::iterator first_unique_uniform = uniformList.begin(); - UniformList::iterator current_uniform = first_unique_uniform; + UniformList::iterator current_uniform = first_unique_uniform; ++current_uniform; for(; current_uniform!=uniformList.end();++current_uniform) { @@ -658,7 +658,7 @@ void Optimizer::StateVisitor::optimize() } } - + // duplicate state attributes removed. // now need to look at duplicate state sets. if (_statesets.size()>=2) @@ -699,7 +699,7 @@ void Optimizer::StateVisitor::optimize() { drawable->setStateSet(*first_unique); } - else + else { osg::Node* node = dynamic_cast(obj); if (node) @@ -712,7 +712,7 @@ void Optimizer::StateVisitor::optimize() else first_unique = current; } } - + } //////////////////////////////////////////////////////////////////////////// @@ -758,36 +758,36 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor // for all current objects associated this transform with them. registerWithCurrentObjects(&transform); } - + virtual void apply(osg::Geode& geode) { traverse(geode); } - + virtual void apply(osg::Billboard& geode) { traverse(geode); } - + void collectDataFor(osg::Node* node) { _currentObjectList.push_back(node); - + node->accept(*this); - + _currentObjectList.pop_back(); } void collectDataFor(osg::Billboard* billboard) { _currentObjectList.push_back(billboard); - + billboard->accept(*this); - + _currentObjectList.pop_back(); } - + void collectDataFor(osg::Drawable* drawable) { _currentObjectList.push_back(drawable); @@ -811,7 +811,7 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor { const osg::Drawable* drawable = dynamic_cast(object); if (drawable) return isOperationPermissibleForObject(drawable); - + const osg::Node* node = dynamic_cast(object); if (node) return isOperationPermissibleForObject(node); @@ -824,7 +824,7 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor if (drawable && !drawable->supports(_transformFunctor)) return false; return BaseOptimizerVisitor::isOperationPermissibleForObject(drawable); } - + inline bool isOperationPermissibleForObject(const osg::Node* node) const { // disable if object is a light point node. @@ -834,7 +834,7 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor return BaseOptimizerVisitor::isOperationPermissibleForObject(node); } - protected: + protected: struct TransformStruct { @@ -876,7 +876,7 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor } else { - if (!_transformSet.empty()) + if (!_transformSet.empty()) { if (!_firstMatrix.isIdentity()) _moreThanOneMatrixRequired=true; } @@ -889,7 +889,7 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor bool _moreThanOneMatrixRequired; osg::Matrix _firstMatrix; TransformSet _transformSet; - }; + }; void registerWithCurrentObjects(osg::Transform* transform) @@ -913,7 +913,7 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor void disableObject(ObjectMap::iterator itr); void doTransform(osg::Object* obj,osg::Matrix& matrix); - + osgUtil::TransformAttributeFunctor _transformFunctor; TransformMap _transformMap; ObjectMap _objectMap; @@ -940,20 +940,20 @@ void CollectLowestTransformsVisitor::doTransform(osg::Object* obj,osg::Matrix& m { osg::Matrix matrix_no_trans = matrix; matrix_no_trans.setTrans(0.0f,0.0f,0.0f); - + osg::Vec3 v111(1.0f,1.0f,1.0f); osg::Vec3 new_v111 = v111*matrix_no_trans; float ratio = new_v111.length()/v111.length(); // move center point. lod->setCenter(lod->getCenter()*matrix); - + // adjust ranges to new scale. for(unsigned int i=0;igetNumRanges();++i) { lod->setRange(i,lod->getMinRange(i)*ratio,lod->getMaxRange(i)*ratio); } - + lod->dirtyBound(); return; } @@ -963,7 +963,7 @@ void CollectLowestTransformsVisitor::doTransform(osg::Object* obj,osg::Matrix& m { osg::Matrix matrix_no_trans = matrix; matrix_no_trans.setTrans(0.0f,0.0f,0.0f); - + osgUtil::TransformAttributeFunctor tf(matrix_no_trans); osg::Vec3 axis = osg::Matrix::transform3x3(tf._im,billboard->getAxis()); @@ -981,7 +981,7 @@ void CollectLowestTransformsVisitor::doTransform(osg::Object* obj,osg::Matrix& m billboard->getDrawable(i)->accept(tf); billboard->getDrawable(i)->dirtyBound(); } - + billboard->dirtyBound(); return; @@ -993,7 +993,7 @@ void CollectLowestTransformsVisitor::disableObject(ObjectMap::iterator itr) if (itr==_objectMap.end()) { return; - } + } if (itr->second._canBeApplied) { @@ -1016,11 +1016,11 @@ void CollectLowestTransformsVisitor::disableTransform(osg::Transform* transform) if (itr==_transformMap.end()) { return; - } + } if (itr->second._canBeApplied) { - + // we havn't been disabled yet so we need to disable, itr->second._canBeApplied = false; // and then inform everybody we have been disabled. @@ -1043,7 +1043,7 @@ void CollectLowestTransformsVisitor::setUpMaps() { osg::Object* object = oitr->first; ObjectStruct& os = oitr->second; - + for(ObjectStruct::TransformSet::iterator titr = os._transformSet.begin(); titr != os._transformSet.end(); ++titr) @@ -1052,10 +1052,10 @@ void CollectLowestTransformsVisitor::setUpMaps() } } - // disable all the objects which have more than one matrix associated - // with them, and then disable all transforms which have an object associated + // disable all the objects which have more than one matrix associated + // with them, and then disable all transforms which have an object associated // them that can't be applied, and then disable all objects which have - // disabled transforms associated, recursing until all disabled + // disabled transforms associated, recursing until all disabled // associativity. // and disable all objects that the operation is not permisable for) for(oitr=_objectMap.begin(); @@ -1142,13 +1142,13 @@ bool CollectLowestTransformsVisitor::removeTransforms(osg::Node* nodeWeCannotRem OSG_WARN<<" model will appear in the incorrect position."<asTransform()->asMatrixTransform()); if (itr!=_transformSet.end()) _transformSet.erase(itr); } - + bool transformRemoved = false; while (!_transformSet.empty()) @@ -1295,7 +1295,7 @@ bool Optimizer::CombineStaticTransformsVisitor::removeTransforms(osg::Node* node // get the first available transform to combine. osg::ref_ptr transform = *_transformSet.begin(); _transformSet.erase(_transformSet.begin()); - + if (transform->getNumChildren()==1 && transform->getChild(0)->asTransform()!=0 && transform->getChild(0)->asTransform()->asMatrixTransform()!=0 && @@ -1303,7 +1303,7 @@ bool Optimizer::CombineStaticTransformsVisitor::removeTransforms(osg::Node* node { // now combine with its child. osg::MatrixTransform* child = transform->getChild(0)->asTransform()->asMatrixTransform(); - + osg::Matrix newMatrix = child->getMatrix()*transform->getMatrix(); child->setMatrix(newMatrix); if (transform->getStateSet()) @@ -1311,7 +1311,7 @@ bool Optimizer::CombineStaticTransformsVisitor::removeTransforms(osg::Node* node if(child->getStateSet()) child->getStateSet()->merge(*transform->getStateSet()); else child->setStateSet(transform->getStateSet()); } - + transformRemoved = true; osg::Node::ParentList parents = transform->getParents(); @@ -1321,9 +1321,9 @@ bool Optimizer::CombineStaticTransformsVisitor::removeTransforms(osg::Node* node { (*pitr)->replaceChild(transform.get(),child); } - + } - + } return transformRemoved; } @@ -1354,7 +1354,7 @@ void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Group& group) if (group.getNumParents()>0) { // only remove empty groups, but not empty occluders. - if (group.getNumChildren()==0 && isOperationPermissibleForObject(&group) && + if (group.getNumChildren()==0 && isOperationPermissibleForObject(&group) && (typeid(group)==typeid(osg::Group) || (dynamic_cast(&group) && !dynamic_cast(&group)))) { _redundantNodeList.insert(&group); @@ -1375,9 +1375,9 @@ void Optimizer::RemoveEmptyNodesVisitor::removeEmptyNodes() itr!=_redundantNodeList.end(); ++itr) { - + osg::ref_ptr nodeToRemove = (*itr); - + // take a copy of parents list since subsequent removes will modify the original one. osg::Node::ParentList parents = nodeToRemove->getParents(); @@ -1387,13 +1387,13 @@ void Optimizer::RemoveEmptyNodesVisitor::removeEmptyNodes() { osg::Group* parent = *pitr; if (!dynamic_cast(parent) && - !dynamic_cast(parent) && + !dynamic_cast(parent) && strcmp(parent->className(),"MultiSwitch")!=0) { parent->removeChild(nodeToRemove.get()); if (parent->getNumChildren()==0) newEmptyGroups.insert(*pitr); } - } + } } _redundantNodeList.clear(); @@ -1415,12 +1415,12 @@ bool Optimizer::RemoveRedundantNodesVisitor::isOperationPermissible(osg::Node& n !node.getEventCallback() && !node.getUpdateCallback() && node.getDescriptions().empty() && - isOperationPermissibleForObject(&node); + isOperationPermissibleForObject(&node); } void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Group& group) { - if (group.getNumChildren()==1 && + if (group.getNumChildren()==1 && typeid(group)==typeid(osg::Group) && isOperationPermissible(group)) { @@ -1477,7 +1477,7 @@ void Optimizer::RemoveRedundantNodesVisitor::removeRedundantNodes() else { OSG_WARN<<"Optimizer::RemoveRedundantNodesVisitor::removeRedundantNodes() - failed dynamic_cast"< group = dynamic_cast(*itr); if (group.valid()) { - + // first check to see if data was attached to the ProxyNode that we need to keep. bool keepData = false; if (!group->getName().empty()) keepData = true; @@ -1523,7 +1523,7 @@ void Optimizer::RemoveLoadedProxyNodesVisitor::removeRedundantNodes() { // create a group to store all proxy's children and data. osg::ref_ptr newGroup = new osg::Group(*group,osg::CopyOp::SHALLOW_COPY); - + // take a copy of parents list since subsequent removes will modify the original one. osg::Node::ParentList parents = group->getParents(); @@ -1558,7 +1558,7 @@ void Optimizer::RemoveLoadedProxyNodesVisitor::removeRedundantNodes() else { OSG_WARN<<"Optimizer::RemoveLoadedProxyNodesVisitor::removeRedundantNodes() - failed dynamic_cast"<(&lod)==0) - { + { for(unsigned int i=0;igetStateSet()getStateSet()) return true; if (rhs->getStateSet()getStateSet()) return false; - + if (rhs->getVertexIndices()) { if (!lhs->getVertexIndices()) return true; } else if (lhs->getVertexIndices()) return false; - + if (lhs->getNormalBinding()getNormalBinding()) return true; if (rhs->getNormalBinding()getNormalBinding()) return false; @@ -1694,7 +1694,7 @@ struct LessGeometry if (lhs->getColorBinding()getColorBinding()) return true; if (rhs->getColorBinding()getColorBinding()) return false; - + if (rhs->getColorIndices()) { if (!lhs->getColorIndices()) return true; } else if (lhs->getColorIndices()) return false; @@ -1712,13 +1712,13 @@ struct LessGeometry if (lhs->getNumTexCoordArrays()getNumTexCoordArrays()) return true; if (rhs->getNumTexCoordArrays()getNumTexCoordArrays()) return false; - + // therefore lhs->getNumTexCoordArrays()==rhs->getNumTexCoordArrays() - + unsigned int i; for(i=0;igetNumTexCoordArrays();++i) { - if (rhs->getTexCoordArray(i)) + if (rhs->getTexCoordArray(i)) { if (!lhs->getTexCoordArray(i)) return true; } @@ -1727,10 +1727,10 @@ struct LessGeometry if (rhs->getTexCoordIndices(i)) { if (!lhs->getTexCoordIndices(i)) return true; } else if (lhs->getTexCoordIndices(i)) return false; } - + for(i=0;igetNumVertexAttribArrays();++i) { - if (rhs->getVertexAttribArray(i)) + if (rhs->getVertexAttribArray(i)) { if (!lhs->getVertexAttribArray(i)) return true; } @@ -1739,8 +1739,8 @@ struct LessGeometry if (rhs->getVertexAttribIndices(i)) { if (!lhs->getVertexAttribIndices(i)) return true; } else if (lhs->getVertexAttribIndices(i)) return false; } - - + + if (lhs->getNormalBinding()==osg::Geometry::BIND_OVERALL) { // assumes that the bindings and arrays are set up correctly, this @@ -1767,7 +1767,7 @@ struct LessGeometry break; } } - + if (lhs->getColorBinding()==osg::Geometry::BIND_OVERALL) { const osg::Array* lhs_colorArray = lhs->getColorArray(); @@ -1791,7 +1791,7 @@ struct LessGeometry default: break; } - + } return false; @@ -1900,9 +1900,9 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) if (geode.getNumDrawables()>=2) { - + // OSG_NOTICE<<"Before "< DuplicateList; typedef std::map GeometryDuplicateMap; @@ -1931,7 +1931,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) } } else - { + { standardDrawables.push_back(geode.getDrawable(i)); } } @@ -2018,7 +2018,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) unsigned int numVertices(duplicateList.front()->getVertexArray() ? duplicateList.front()->getVertexArray()->getNumElements() : 0); DuplicateList::iterator eachGeom(duplicateList.begin()+1); - // until all geometries have been checked or _targetMaximumNumberOfVertices is reached + // until all geometries have been checked or _targetMaximumNumberOfVertices is reached for (;eachGeom!=duplicateList.end(); ++eachGeom) { unsigned int numAddVertices((*eachGeom)->getVertexArray() ? (*eachGeom)->getVertexArray()->getNumElements() : 0); @@ -2049,7 +2049,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) if (duplicateListResult->size()>1) needToDoMerge = true; } } - + if (needToDoMerge) { // first take a reference to all the drawables to prevent them being deleted prematurely @@ -2059,10 +2059,10 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) { keepDrawables[i] = geode.getDrawable(i); } - + // now clear the drawable list of the Geode so we don't have to remove items one by one (which is slow) geode.removeDrawables(0, geode.getNumDrawables()); - + // add back in the standard drawables which arn't possible to merge. for(osg::Geode::DrawableList::iterator sitr = standardDrawables.begin(); sitr != standardDrawables.end(); @@ -2070,7 +2070,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) { geode.addDrawable(sitr->get()); } - + // now do the merging of geometries for(MergeList::iterator mitr = mergeList.begin(); mitr != mergeList.end(); @@ -2109,9 +2109,9 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) dupItr!=itr->second.end(); ++dupItr) { - + osg::Geometry* rhs = *dupItr; - + if (lhs->getVertexArray() && lhs->getVertexArray()->getNumElements()>=_targetMaximumNumberOfVertices) { lhs = rhs; @@ -2122,13 +2122,13 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) { continue; } - - if (lhs->getVertexArray() && rhs->getVertexArray() && + + if (lhs->getVertexArray() && rhs->getVertexArray() && (lhs->getVertexArray()->getNumElements()+rhs->getVertexArray()->getNumElements())>=_targetMaximumNumberOfVertices) { continue; } - + if (mergeGeometry(*lhs,*rhs)) { geode.removeDrawable(rhs); @@ -2186,7 +2186,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) geom->getSecondaryColorBinding()!=osg::Geometry::BIND_PER_PRIMITIVE_SET && geom->getFogCoordBinding()!=osg::Geometry::BIND_PER_PRIMITIVE_SET) { - + #if 1 bool doneCombine = false; @@ -2197,7 +2197,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) { osg::PrimitiveSet* lhs = primitives[lhsNo].get(); osg::PrimitiveSet* rhs = primitives[rhsNo].get(); - + bool combine = false; if (lhs->getType()==rhs->getType() && @@ -2210,15 +2210,15 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) case(osg::PrimitiveSet::LINES): case(osg::PrimitiveSet::TRIANGLES): case(osg::PrimitiveSet::QUADS): - combine = true; + combine = true; break; } - + } if (combine) { - + switch(lhs->getType()) { case(osg::PrimitiveSet::DrawArraysPrimitiveType): @@ -2256,7 +2256,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) } } - #if 1 + #if 1 if (doneCombine) { // now need to clean up primitiveset so it no longer contains the rhs combined primitives. @@ -2264,7 +2264,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) // first swap with a empty primitiveSet to empty it completely. osg::Geometry::PrimitiveSetList oldPrimitives; primitives.swap(oldPrimitives); - + // now add the active primitive sets for(osg::Geometry::PrimitiveSetList::iterator pitr = oldPrimitives.begin(); pitr != oldPrimitives.end(); @@ -2275,7 +2275,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) } #endif -#else +#else osg::Geometry::PrimitiveSetList& primitives = geom->getPrimitiveSetList(); unsigned int primNo=0; @@ -2283,7 +2283,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) { osg::PrimitiveSet* lhs = primitives[primNo].get(); osg::PrimitiveSet* rhs = primitives[primNo+1].get(); - + bool combine = false; if (lhs->getType()==rhs->getType() && @@ -2296,15 +2296,15 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) case(osg::PrimitiveSet::LINES): case(osg::PrimitiveSet::TRIANGLES): case(osg::PrimitiveSet::QUADS): - combine = true; + combine = true; break; } - + } if (combine) { - + switch(lhs->getType()) { case(osg::PrimitiveSet::DrawArraysPrimitiveType): @@ -2356,14 +2356,14 @@ bool Optimizer::MergeGeometryVisitor::geometryContainsSharedArrays(osg::Geometry if (geom.getColorArray() && geom.getColorArray()->referenceCount()>1) return true; if (geom.getSecondaryColorArray() && geom.getSecondaryColorArray()->referenceCount()>1) return true; if (geom.getFogCoordArray() && geom.getFogCoordArray()->referenceCount()>1) return true; - + for(unsigned int unit=0;unitreferenceCount()>1) return true; } - + // shift the indices of the incoming primitives to account for the pre existing geometry. for(osg::Geometry::PrimitiveSetList::iterator primItr=geom.getPrimitiveSetList().begin(); primItr!=geom.getPrimitiveSetList().end(); @@ -2371,8 +2371,8 @@ bool Optimizer::MergeGeometryVisitor::geometryContainsSharedArrays(osg::Geometry { if ((*primItr)->referenceCount()>1) return true; } - - + + return false; } @@ -2386,32 +2386,32 @@ class MergeArrayVisitor : public osg::ArrayVisitor MergeArrayVisitor() : _lhs(0), _offset(0) {} - - + + /// try to merge the content of two arrays. bool merge(osg::Array* lhs,osg::Array* rhs, int offset=0) { if (lhs==0 || rhs==0) return true; if (lhs->getType()!=rhs->getType()) return false; - + _lhs = lhs; _offset = offset; - + rhs->accept(*this); return true; } - + template void _merge(T& rhs) { - T* lhs = static_cast(_lhs); + T* lhs = static_cast(_lhs); lhs->insert(lhs->end(),rhs.begin(),rhs.end()); } - + template void _mergeAndOffset(T& rhs) { - T* lhs = static_cast(_lhs); + T* lhs = static_cast(_lhs); typename T::iterator itr; for(itr = rhs.begin(); @@ -2421,7 +2421,7 @@ class MergeArrayVisitor : public osg::ArrayVisitor lhs->push_back(*itr + _offset); } } - + virtual void apply(osg::Array&) { OSG_WARN << "Warning: Optimizer's MergeArrayVisitor cannot merge Array type." << std::endl; } virtual void apply(osg::ByteArray& rhs) { if (_offset) _mergeAndOffset(rhs); else _merge(rhs); } @@ -2436,15 +2436,15 @@ class MergeArrayVisitor : public osg::ArrayVisitor virtual void apply(osg::Vec2Array& rhs) { _merge(rhs); } virtual void apply(osg::Vec3Array& rhs) { _merge(rhs); } virtual void apply(osg::Vec4Array& rhs) { _merge(rhs); } - + virtual void apply(osg::DoubleArray& rhs) { _merge(rhs); } virtual void apply(osg::Vec2dArray& rhs) { _merge(rhs); } virtual void apply(osg::Vec3dArray& rhs) { _merge(rhs); } virtual void apply(osg::Vec4dArray& rhs) { _merge(rhs); } - + virtual void apply(osg::Vec2bArray& rhs) { _merge(rhs); } virtual void apply(osg::Vec3bArray& rhs) { _merge(rhs); } - virtual void apply(osg::Vec4bArray& rhs) { _merge(rhs); } + virtual void apply(osg::Vec4bArray& rhs) { _merge(rhs); } virtual void apply(osg::Vec2sArray& rhs) { _merge(rhs); } virtual void apply(osg::Vec3sArray& rhs) { _merge(rhs); } virtual void apply(osg::Vec4sArray& rhs) { _merge(rhs); } @@ -2454,9 +2454,9 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom { MergeArrayVisitor merger; - + unsigned int base = 0; - unsigned int vbase = lhs.getVertexArray() ? lhs.getVertexArray()->getNumElements() : 0; + unsigned int vbase = lhs.getVertexArray() ? lhs.getVertexArray()->getNumElements() : 0; if (lhs.getVertexArray() && rhs.getVertexArray()) { @@ -2471,7 +2471,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom base = 0; lhs.setVertexArray(rhs.getVertexArray()); } - + if (lhs.getVertexIndices() && rhs.getVertexIndices()) { @@ -2486,9 +2486,9 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom base = 0; lhs.setVertexIndices(rhs.getVertexIndices()); } - - unsigned int nbase = lhs.getNormalArray() ? lhs.getNormalArray()->getNumElements() : 0; + + unsigned int nbase = lhs.getNormalArray() ? lhs.getNormalArray()->getNumElements() : 0; if (lhs.getNormalArray() && rhs.getNormalArray() && lhs.getNormalBinding()!=osg::Geometry::BIND_OVERALL) { if (!merger.merge(lhs.getNormalArray(),rhs.getNormalArray())) @@ -2515,7 +2515,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom } - unsigned int cbase = lhs.getColorArray() ? lhs.getColorArray()->getNumElements() : 0; + unsigned int cbase = lhs.getColorArray() ? lhs.getColorArray()->getNumElements() : 0; if (lhs.getColorArray() && rhs.getColorArray() && lhs.getColorBinding()!=osg::Geometry::BIND_OVERALL) { if (!merger.merge(lhs.getColorArray(),rhs.getColorArray())) @@ -2527,7 +2527,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom { lhs.setColorArray(rhs.getColorArray()); } - + if (lhs.getColorIndices() && rhs.getColorIndices() && lhs.getColorBinding()!=osg::Geometry::BIND_OVERALL) { if (!merger.merge(lhs.getColorIndices(),rhs.getColorIndices(),cbase)) @@ -2541,7 +2541,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom lhs.setColorIndices(rhs.getColorIndices()); } - unsigned int scbase = lhs.getSecondaryColorArray() ? lhs.getSecondaryColorArray()->getNumElements() : 0; + unsigned int scbase = lhs.getSecondaryColorArray() ? lhs.getSecondaryColorArray()->getNumElements() : 0; if (lhs.getSecondaryColorArray() && rhs.getSecondaryColorArray() && lhs.getSecondaryColorBinding()!=osg::Geometry::BIND_OVERALL) { if (!merger.merge(lhs.getSecondaryColorArray(),rhs.getSecondaryColorArray())) @@ -2553,7 +2553,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom { lhs.setSecondaryColorArray(rhs.getSecondaryColorArray()); } - + if (lhs.getSecondaryColorIndices() && rhs.getSecondaryColorIndices() && lhs.getSecondaryColorBinding()!=osg::Geometry::BIND_OVERALL) { if (!merger.merge(lhs.getSecondaryColorIndices(),rhs.getSecondaryColorIndices(),scbase)) @@ -2567,7 +2567,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom lhs.setSecondaryColorIndices(rhs.getSecondaryColorIndices()); } - unsigned int fcbase = lhs.getFogCoordArray() ? lhs.getFogCoordArray()->getNumElements() : 0; + unsigned int fcbase = lhs.getFogCoordArray() ? lhs.getFogCoordArray()->getNumElements() : 0; if (lhs.getFogCoordArray() && rhs.getFogCoordArray() && lhs.getFogCoordBinding()!=osg::Geometry::BIND_OVERALL) { if (!merger.merge(lhs.getFogCoordArray(),rhs.getFogCoordArray())) @@ -2597,7 +2597,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom unsigned int unit; for(unit=0;unitgetNumElements() : 0; + unsigned int tcbase = lhs.getTexCoordArray(unit) ? lhs.getTexCoordArray(unit)->getNumElements() : 0; if (!merger.merge(lhs.getTexCoordArray(unit),rhs.getTexCoordArray(unit))) { OSG_DEBUG << "MergeGeometry: tex coord array not merged. Some data may be lost." <getNumElements() : 0; + unsigned int vabase = lhs.getVertexAttribArray(unit) ? lhs.getVertexAttribArray(unit)->getNumElements() : 0; if (!merger.merge(lhs.getVertexAttribArray(unit),rhs.getVertexAttribArray(unit))) { OSG_DEBUG << "MergeGeometry: vertex attrib array not merged. Some data may be lost." <get(); - + switch(primitive->getType()) { case(osg::PrimitiveSet::DrawElementsUBytePrimitiveType): @@ -2703,7 +2703,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom break; } } - + for(primItr=rhs.getPrimitiveSetList().begin(); primItr!=rhs.getPrimitiveSetList().end(); ++primItr) { lhs.addPrimitiveSet(primItr->get()); @@ -2711,7 +2711,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom lhs.dirtyBound(); lhs.dirtyDisplayList(); - + return true; } @@ -2794,21 +2794,21 @@ bool Optimizer::SpatializeGroupsVisitor::divide(unsigned int maxNumTreesPerCell) { if (divide(*itr,maxNumTreesPerCell)) divided = true; } - + for(GeodesToDivideList::iterator geode_itr=_geodesToDivideList.begin(); geode_itr!=_geodesToDivideList.end(); ++geode_itr) { if (divide(*geode_itr,maxNumTreesPerCell)) divided = true; } - + return divided; } bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int maxNumTreesPerCell) { if (group->getNumChildren()<=maxNumTreesPerCell) return false; - + // create the original box. osg::BoundingBox bb; unsigned int i; @@ -2816,7 +2816,7 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int { bb.expandBy(group->getChild(i)->getBound().center()); } - + float radius = bb.radius(); float divide_distance = radius*0.7f; bool xAxis = (bb.xMax()-bb.xMin())>divide_distance; @@ -2824,21 +2824,21 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int bool zAxis = (bb.zMax()-bb.zMin())>divide_distance; OSG_INFO<<"Dividing "<className()<<" num children = "<getNumChildren()<<" xAxis="<getNumChildren(); - + typedef std::pair< osg::BoundingBox, osg::ref_ptr > BoxGroupPair; typedef std::vector< BoxGroupPair > Boxes; Boxes boxes; boxes.push_back( BoxGroupPair(bb,new osg::Group) ); - // divide up on each axis + // divide up on each axis if (xAxis) { unsigned int numCellsToDivide=boxes.size(); @@ -2889,7 +2889,7 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int // create the groups to drop the children into - + // bin each child into associated bb group typedef std::vector< osg::ref_ptr > NodeList; @@ -2920,11 +2920,11 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int // first removing from the original group, // add in the bb groups // add then the unassigned children. - - + + // first removing from the original group, group->removeChildren(0,group->getNumChildren()); - + // add in the bb groups typedef std::vector< osg::ref_ptr > GroupList; GroupList groupsToDivideList; @@ -2950,8 +2950,8 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int } } } - - + + // add then the unassigned children. for(NodeList::iterator nitr=unassignedList.begin(); nitr!=unassignedList.end(); @@ -2969,14 +2969,14 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int } return (numChildrenOnEntrygetNumChildren()); - + } bool Optimizer::SpatializeGroupsVisitor::divide(osg::Geode* geode, unsigned int maxNumTreesPerCell) { if (geode->getNumDrawables()<=maxNumTreesPerCell) return false; - + // create the original box. osg::BoundingBox bb; unsigned int i; @@ -2984,7 +2984,7 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Geode* geode, unsigned int { bb.expandBy(geode->getDrawable(i)->getBound().center()); } - + float radius = bb.radius(); float divide_distance = radius*0.7f; bool xAxis = (bb.xMax()-bb.xMin())>divide_distance; @@ -2992,15 +2992,15 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Geode* geode, unsigned int bool zAxis = (bb.zMax()-bb.zMin())>divide_distance; OSG_INFO<<"INFO "<className()<<" num drawables = "<getNumDrawables()<<" xAxis="<getParents(); - if (parents.empty()) + if (parents.empty()) { OSG_INFO<<" Cannot perform spatialize on root Geode, add a Group above it to allow subdivision."<addDrawable(geode->getDrawable(i)); group->addChild(newGeode); } - + divide(group.get(), maxNumTreesPerCell); - + // keep reference around to prevent it being deleted. osg::ref_ptr keepRefGeode = geode; - + for(osg::Node::ParentList::iterator itr = parents.begin(); itr != parents.end(); ++itr) { (*itr)->replaceChild(geode, group.get()); } - + return true; } @@ -3059,10 +3059,10 @@ void Optimizer::CopySharedSubgraphsVisitor::copySharedNodes() // create a clone. osg::ref_ptr new_object = node->clone(osg::CopyOp::DEEP_COPY_NODES | osg::CopyOp::DEEP_COPY_DRAWABLES); - // cast it to node. + // cast it to node. osg::Node* new_node = dynamic_cast(new_object.get()); - // replace the node by new_new + // replace the node by new_new if (new_node) node->getParent(i)->replaceChild(node,new_node); } } @@ -3077,9 +3077,9 @@ void Optimizer::CopySharedSubgraphsVisitor::copySharedNodes() void Optimizer::TextureVisitor::apply(osg::Node& node) { - + osg::StateSet* ss = node.getStateSet(); - if (ss && + if (ss && isOperationPermissibleForObject(&node) && isOperationPermissibleForObject(ss)) { @@ -3094,7 +3094,7 @@ void Optimizer::TextureVisitor::apply(osg::Geode& geode) if (!isOperationPermissibleForObject(&geode)) return; osg::StateSet* ss = geode.getStateSet(); - + if (ss && isOperationPermissibleForObject(ss)) { apply(*ss); @@ -3139,18 +3139,18 @@ void Optimizer::TextureVisitor::apply(osg::Texture& texture) osg::ImageStream* is = dynamic_cast(texture.getImage(i)); if (is) ++numImageStreams; } - + if (numImageStreams==0) { texture.setUnRefImageDataAfterApply(_valueAutoUnRef); } } - + if (_changeClientImageStorage) { texture.setClientStorageHint(_valueClientImageStorage); } - + if (_changeAnisotropy) { texture.setMaxAnisotropy(_valueAnisotropy); @@ -3195,7 +3195,7 @@ bool Optimizer::MergeGeodesVisitor::mergeGeodes(osg::Group& group) // this is done so we don't have to do a search and remove from the list later on. children[i] = group.getChild(i); } - + // remove all children group.removeChildren(0,group.getNumChildren()); @@ -3204,7 +3204,7 @@ bool Optimizer::MergeGeodesVisitor::mergeGeodes(osg::Group& group) { osg::Node* child = children[i].get(); - if (typeid(*child)==typeid(osg::Geode)) + if (typeid(*child)==typeid(osg::Geode)) { osg::Geode* geode = static_cast(child); geodeDuplicateMap[geode].push_back(geode); @@ -3218,9 +3218,9 @@ bool Optimizer::MergeGeodesVisitor::mergeGeodes(osg::Group& group) // if no geodes then just return. if (geodeDuplicateMap.empty()) return false; - + OSG_INFO<<"mergeGeodes in group '"<second.begin()+1; dupItr!=itr->second.end(); ++dupItr) @@ -3284,14 +3284,14 @@ void Optimizer::FlattenBillboardVisitor::process() itr != _billboards.end(); ++itr) { - bool mergeAcceptable = true; + bool mergeAcceptable = true; osg::ref_ptr billboard = itr->first; NodePathList& npl = itr->second; osg::Group* mainGroup = 0; if (npl.size()>1) - { + { for(NodePathList::iterator nitr = npl.begin(); nitr != npl.end(); ++nitr) @@ -3305,7 +3305,7 @@ void Optimizer::FlattenBillboardVisitor::process() osg::MatrixTransform* mt = dynamic_cast(np[np.size()-2]); if (group == mainGroup && - np[np.size()-1]==billboard.get() && + np[np.size()-1]==billboard.get() && mt && mt->getDataVariance()==osg::Object::STATIC && mt->getNumChildren()==1) { @@ -3337,7 +3337,7 @@ void Optimizer::FlattenBillboardVisitor::process() new_billboard->setMode(billboard->getMode()); new_billboard->setAxis(billboard->getAxis()); new_billboard->setStateSet(billboard->getStateSet()); - new_billboard->setName(billboard->getName()); + new_billboard->setName(billboard->getName()); mainGroup->addChild(new_billboard); @@ -3432,7 +3432,7 @@ void Optimizer::TextureAtlasBuilder::completeRow(unsigned int indexAtlas) if (y_min >= y_max || x_min >= x_max) continue; Source * source = sitr3->get(); - if (source->_atlas || atlas->_image->getPixelFormat() != source->_image->getPixelFormat() || + if (source->_atlas || atlas->_image->getPixelFormat() != source->_image->getPixelFormat() || atlas->_image->getDataType() != source->_image->getDataType()) { continue; @@ -3470,7 +3470,7 @@ void Optimizer::TextureAtlasBuilder::completeRow(unsigned int indexAtlas) for(SourceList::iterator sitr2 = _sourceList.begin(); sitr2 != _sourceList.end(); ++sitr2) { Source * source = sitr2->get(); - if (source->_atlas || atlas->_image->getPixelFormat() != source->_image->getPixelFormat() || + if (source->_atlas || atlas->_image->getPixelFormat() != source->_image->getPixelFormat() || atlas->_image->getDataType() != source->_image->getDataType()) { continue; @@ -3519,7 +3519,7 @@ void Optimizer::TextureAtlasBuilder::buildAtlas() aitr != _atlasList.end() && !addedSourceToAtlas; ++aitr) { - if(!(*aitr)->_image || + if(!(*aitr)->_image || ((*aitr)->_image->getPixelFormat() == (*sitr)->_image->getPixelFormat() && (*aitr)->_image->getPacking() == (*sitr)->_image->getPacking())) { @@ -3553,7 +3553,7 @@ void Optimizer::TextureAtlasBuilder::buildAtlas() } } } - + // build the atlas which are suitable for use, and discard the rest. AtlasList activeAtlasList; for(AtlasList::iterator aitr = _atlasList.begin(); @@ -3570,7 +3570,7 @@ void Optimizer::TextureAtlasBuilder::buildAtlas() source->_atlas = 0; atlas->_sourceList.clear(); } - + if (!(atlas->_sourceList.empty())) { std::stringstream ostr; @@ -3671,11 +3671,11 @@ Optimizer::TextureAtlasBuilder::Source* Optimizer::TextureAtlasBuilder::getSourc bool Optimizer::TextureAtlasBuilder::Source::suitableForAtlas(int maximumAtlasWidth, int maximumAtlasHeight, int margin) { if (!_image) return false; - + // size too big? if (_image->s()+margin*2 > maximumAtlasWidth) return false; if (_image->t()+margin*2 > maximumAtlasHeight) return false; - + switch(_image->getPixelFormat()) { case(GL_COMPRESSED_ALPHA_ARB): @@ -3694,7 +3694,7 @@ bool Optimizer::TextureAtlasBuilder::Source::suitableForAtlas(int maximumAtlasWi break; } - if ((_image->getPixelSizeInBits() % 8) != 0) + if ((_image->getPixelSizeInBits() % 8) != 0) { // pixel size not byte aligned so report as not suitable to prevent other atlas code from having problems with byte boundaries. return false; @@ -3722,7 +3722,7 @@ bool Optimizer::TextureAtlasBuilder::Source::suitableForAtlas(int maximumAtlasWi return false; } } - + return true; } @@ -3742,14 +3742,14 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At // does the source have a valid image? const osg::Image* sourceImage = source->_image.get(); if (!sourceImage) return DOES_NOT_FIT_IN_ANY_ROW; - + // does pixel format match? if (_image.valid()) { if (_image->getPixelFormat() != sourceImage->getPixelFormat()) return DOES_NOT_FIT_IN_ANY_ROW; if (_image->getDataType() != sourceImage->getDataType()) return DOES_NOT_FIT_IN_ANY_ROW; } - + const osg::Texture2D* sourceTexture = source->_texture.get(); if (sourceTexture) { @@ -3776,10 +3776,10 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At if (_texture.valid()) { - bool sourceUsesBorder = sourceTexture->getWrap(osg::Texture2D::WRAP_S)==osg::Texture2D::CLAMP_TO_BORDER || + bool sourceUsesBorder = sourceTexture->getWrap(osg::Texture2D::WRAP_S)==osg::Texture2D::CLAMP_TO_BORDER || sourceTexture->getWrap(osg::Texture2D::WRAP_T)==osg::Texture2D::CLAMP_TO_BORDER; - bool atlasUsesBorder = sourceTexture->getWrap(osg::Texture2D::WRAP_S)==osg::Texture2D::CLAMP_TO_BORDER || + bool atlasUsesBorder = sourceTexture->getWrap(osg::Texture2D::WRAP_S)==osg::Texture2D::CLAMP_TO_BORDER || sourceTexture->getWrap(osg::Texture2D::WRAP_T)==osg::Texture2D::CLAMP_TO_BORDER; if (sourceUsesBorder!=atlasUsesBorder) @@ -3793,37 +3793,37 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At // border colours don't match if (_texture->getBorderColor() != sourceTexture->getBorderColor()) return DOES_NOT_FIT_IN_ANY_ROW; } - + if (_texture->getFilter(osg::Texture2D::MIN_FILTER) != sourceTexture->getFilter(osg::Texture2D::MIN_FILTER)) { // inconsitent min filters return DOES_NOT_FIT_IN_ANY_ROW; } - + if (_texture->getFilter(osg::Texture2D::MAG_FILTER) != sourceTexture->getFilter(osg::Texture2D::MAG_FILTER)) { // inconsitent mag filters return DOES_NOT_FIT_IN_ANY_ROW; } - + if (_texture->getMaxAnisotropy() != sourceTexture->getMaxAnisotropy()) { // anisotropy different. return DOES_NOT_FIT_IN_ANY_ROW; } - + if (_texture->getInternalFormat() != sourceTexture->getInternalFormat()) { // internal formats inconistent return DOES_NOT_FIT_IN_ANY_ROW; } - + if (_texture->getShadowCompareFunc() != sourceTexture->getShadowCompareFunc()) { // shadow functions inconsitent return DOES_NOT_FIT_IN_ANY_ROW; } - + if (_texture->getShadowTextureMode() != sourceTexture->getShadowTextureMode()) { // shadow texture mode inconsitent @@ -3837,13 +3837,13 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At } } } - + if (sourceImage->s() + 2*_margin > _maximumAtlasWidth) { // image too big for Atlas return DOES_NOT_FIT_IN_ANY_ROW; } - + if (sourceImage->t() + 2*_margin > _maximumAtlasHeight) { // image too big for Atlas @@ -3871,7 +3871,7 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At OSG_INFO<<"Fits in next row"<setWrap(osg::Texture2D::WRAP_S, sourceTexture->getWrap(osg::Texture2D::WRAP_S)); _texture->setWrap(osg::Texture2D::WRAP_T, sourceTexture->getWrap(osg::Texture2D::WRAP_T)); - + _texture->setBorderColor(sourceTexture->getBorderColor()); _texture->setBorderWidth(0); - + _texture->setFilter(osg::Texture2D::MIN_FILTER, sourceTexture->getFilter(osg::Texture2D::MIN_FILTER)); _texture->setFilter(osg::Texture2D::MAG_FILTER, sourceTexture->getFilter(osg::Texture2D::MAG_FILTER)); @@ -3931,12 +3931,12 @@ bool Optimizer::TextureAtlasBuilder::Atlas::addSource(Source* source) source->_x = _x + _margin; source->_y = _y + _margin; source->_atlas = this; - + // move the atlas' cursor along to the right _x += sourceImage->s() + 2*_margin; - + if (_x > _width) _width = _x; - + int localTop = _y + sourceImage->t() + 2*_margin; if ( localTop > _height) _height = localTop; @@ -3959,7 +3959,7 @@ bool Optimizer::TextureAtlasBuilder::Atlas::addSource(Source* source) source->_x = _x + _margin; source->_y = _y + _margin; source->_atlas = this; - + // move the atlas' cursor along to the right _x += sourceImage->s() + 2*_margin; @@ -3985,9 +3985,9 @@ void Optimizer::TextureAtlasBuilder::Atlas::clampToNearestPowerOfTwoSize() int h = 1; while (h<_height) h *= 2; - + OSG_INFO<<"Clamping "<<_width<<", "<<_height<<" to "<allocateImage(_width,_height,1, pixelFormat, dataType, packing); - + { // clear memory unsigned int size = _image->getTotalSizeInBytes(); unsigned char* str = _image->data(); for(unsigned int i=0; i_y + sourceImage->t(); int m; @@ -4063,9 +4063,9 @@ void Optimizer::TextureAtlasBuilder::Atlas::copySources() { *(destPtr++) = *(sourcePtr++); } - + } - + // copy bottom row margin @@ -4078,7 +4078,7 @@ void Optimizer::TextureAtlasBuilder::Atlas::copySources() { *(destPtr++) = *(sourcePtr++); } - + } // copy left column margin @@ -4095,7 +4095,7 @@ void Optimizer::TextureAtlasBuilder::Atlas::copySources() *(destPtr++) = *(sourcePtr++); } } - } + } // copy right column margin y = source->_y; @@ -4111,7 +4111,7 @@ void Optimizer::TextureAtlasBuilder::Atlas::copySources() *(destPtr++) = *(sourcePtr++); } } - } + } // copy top left corner margin y = source->_y + sourceImage->t(); @@ -4177,14 +4177,14 @@ void Optimizer::TextureAtlasVisitor::reset() bool Optimizer::TextureAtlasVisitor::pushStateSet(osg::StateSet* stateset) { osg::StateSet::TextureAttributeList& tal = stateset->getTextureAttributeList(); - + // if no textures ignore if (tal.empty()) return false; - + bool pushStateState = false; // if already in stateset list ignore - if (_statesetMap.count(stateset)>0) + if (_statesetMap.count(stateset)>0) { pushStateState = true; } @@ -4207,14 +4207,14 @@ bool Optimizer::TextureAtlasVisitor::pushStateSet(osg::StateSet* stateset) pushStateState = true; } } - + if (pushStateState) { _statesetStack.push_back(stateset); } - - return pushStateState; + + return pushStateState; } void Optimizer::TextureAtlasVisitor::popStateSet() @@ -4225,9 +4225,9 @@ void Optimizer::TextureAtlasVisitor::popStateSet() void Optimizer::TextureAtlasVisitor::apply(osg::Node& node) { bool pushedStateState = false; - + osg::StateSet* ss = node.getStateSet(); - if (ss && ss->getDataVariance()==osg::Object::STATIC) + if (ss && ss->getDataVariance()==osg::Object::STATIC) { if (isOperationPermissibleForObject(&node) && isOperationPermissibleForObject(ss)) @@ -4237,7 +4237,7 @@ void Optimizer::TextureAtlasVisitor::apply(osg::Node& node) } traverse(node); - + if (pushedStateState) popStateSet(); } @@ -4246,8 +4246,8 @@ void Optimizer::TextureAtlasVisitor::apply(osg::Geode& geode) if (!isOperationPermissibleForObject(&geode)) return; osg::StateSet* ss = geode.getStateSet(); - - + + bool pushedGeodeStateState = false; if (ss && ss->getDataVariance()==osg::Object::STATIC) @@ -4274,11 +4274,11 @@ void Optimizer::TextureAtlasVisitor::apply(osg::Geode& geode) pushedDrawableStateState = pushStateSet(ss); } } - + if (!_statesetStack.empty()) { for(StateSetStack::iterator ssitr = _statesetStack.begin(); - ssitr != _statesetStack.end(); + ssitr != _statesetStack.end(); ++ssitr) { _statesetMap[*ssitr].insert(drawable); @@ -4287,16 +4287,16 @@ void Optimizer::TextureAtlasVisitor::apply(osg::Geode& geode) if (pushedDrawableStateState) popStateSet(); } - + } - + if (pushedGeodeStateState) popStateSet(); } void Optimizer::TextureAtlasVisitor::optimize() { _builder.reset(); - + if (_textures.size()<2) { // nothing to optimize @@ -4325,20 +4325,20 @@ void Optimizer::TextureAtlasVisitor::optimize() bool t_repeat = texture->getWrap(osg::Texture2D::WRAP_T)==osg::Texture2D::REPEAT || texture->getWrap(osg::Texture2D::WRAP_T)==osg::Texture2D::MIRROR; - + if (s_repeat || t_repeat) { texturesThatRepeat.insert(texture); - + bool s_outOfRange = false; bool t_outOfRange = false; - + float s_min = -0.001; float s_max = 1.001; float t_min = -0.001; float t_max = 1.001; - + for(Drawables::iterator ditr = drawables.begin(); ditr != drawables.end(); ++ditr) @@ -4364,11 +4364,11 @@ void Optimizer::TextureAtlasVisitor::optimize() // if no texcoords then texgen must be being used, therefore must assume that texture is truely repeating s_outOfRange = true; t_outOfRange = true; - } + } } - if (s_outOfRange || t_outOfRange) - { + if (s_outOfRange || t_outOfRange) + { texturesThatRepeatAndAreOutOfRange.insert(texture); } @@ -4377,7 +4377,7 @@ void Optimizer::TextureAtlasVisitor::optimize() } } - // now change any texture that repeat but all texcoords to them + // now change any texture that repeat but all texcoords to them // are in 0 to 1 range than converting the to CLAMP mode, to allow them // to be used in an atlas. Textures::iterator titr; @@ -4433,7 +4433,7 @@ void Optimizer::TextureAtlasVisitor::optimize() dssm[(*ditr)->asGeometry()].insert(sitr->first); } } - + Drawables drawablesThatHaveMultipleTexturesOnOneUnit; for(DrawableStateSetMap::iterator ditr = dssm.begin(); ditr != dssm.end(); @@ -4474,8 +4474,8 @@ void Optimizer::TextureAtlasVisitor::optimize() } } - - // remap the textures in the StateSet's + + // remap the textures in the StateSet's for(sitr = _statesetMap.begin(); sitr != _statesetMap.end(); ++sitr) @@ -4502,11 +4502,11 @@ void Optimizer::TextureAtlasVisitor::optimize() } stateset->setTextureAttribute(unit, newTexture); - + Drawables& drawables = sitr->second; - + osg::Matrix matrix = _builder.getTextureMatrix(texture); - + // first check to see if all drawables are ok for applying texturematrix to. bool canTexMatBeFlattenedToAllDrawables = true; for(Drawables::iterator ditr = drawables.begin(); @@ -4516,11 +4516,11 @@ void Optimizer::TextureAtlasVisitor::optimize() osg::Geometry* geom = (*ditr)->asGeometry(); osg::Vec2Array* texcoords = geom ? dynamic_cast(geom->getTexCoordArray(unit)) : 0; - if (!texcoords) + if (!texcoords) { canTexMatBeFlattenedToAllDrawables = false; } - + if (drawablesThatHaveMultipleTexturesOnOneUnit.count(*ditr)!=0) { canTexMatBeFlattenedToAllDrawables = false; @@ -4550,7 +4550,7 @@ void Optimizer::TextureAtlasVisitor::optimize() else { OSG_NOTICE<<"Error, Optimizer::TextureAtlasVisitor::optimize() shouldn't ever get here..."< group = new osg::Group(dynamic_cast(transform), osg::CopyOp::DEEP_COPY_NODES | osg::CopyOp::DEEP_COPY_DRAWABLES | osg::CopyOp::DEEP_COPY_ARRAYS); @@ -4735,7 +4735,7 @@ void Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor::apply( if(geode.getNumParents() == 1) { transformGeode(geode); - } + } else { // Else make a copy and then transform diff --git a/src/osgUtil/PerlinNoise.cpp b/src/osgUtil/PerlinNoise.cpp index cf0db5a82..72694be6b 100644 --- a/src/osgUtil/PerlinNoise.cpp +++ b/src/osgUtil/PerlinNoise.cpp @@ -54,7 +54,7 @@ PerlinNoise::PerlinNoise() { SetNoiseFrequency(1); } - + void PerlinNoise::SetNoiseFrequency(int frequency) { start = 1; diff --git a/src/osgUtil/PositionalStateContainer.cpp b/src/osgUtil/PositionalStateContainer.cpp index 0138cd09a..2787b9db1 100644 --- a/src/osgUtil/PositionalStateContainer.cpp +++ b/src/osgUtil/PositionalStateContainer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -54,7 +54,7 @@ void PositionalStateContainer::draw(osg::State& state,RenderLeaf*& previous, con else state.applyModelViewMatrix(new osg::RefMatrix( *postMultMatrix)); } - + else { state.applyModelViewMatrix((*litr).second.get()); @@ -62,10 +62,10 @@ void PositionalStateContainer::draw(osg::State& state,RenderLeaf*& previous, con // apply the light source. litr->first->apply(state); - + // tell state about. state.haveAppliedAttribute(litr->first.get()); - + // set this state as a global default state.setGlobalDefaultAttribute(litr->first.get()); } @@ -75,9 +75,9 @@ void PositionalStateContainer::draw(osg::State& state,RenderLeaf*& previous, con ++titr) { state.setActiveTextureUnit(titr->first); - + AttrMatrixList attrList = titr->second; - + for(AttrMatrixList::iterator litr=attrList.begin(); litr!=attrList.end(); ++litr) diff --git a/src/osgUtil/PrintVisitor.cpp b/src/osgUtil/PrintVisitor.cpp index 8824fcffd..a9cb14e9d 100644 --- a/src/osgUtil/PrintVisitor.cpp +++ b/src/osgUtil/PrintVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgUtil/RenderBin.cpp b/src/osgUtil/RenderBin.cpp index bdd3d2047..ca442949b 100644 --- a/src/osgUtil/RenderBin.cpp +++ b/src/osgUtil/RenderBin.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -73,7 +73,7 @@ RenderBin* RenderBin::createRenderBin(const std::string& binName) RenderBin* prototype = getRenderBinPrototype(binName); if (prototype) return dynamic_cast(prototype->clone(osg::CopyOp::DEEP_COPY_ALL)); } - + OSG_WARN <<"Warning: RenderBin \""<setThreadSafeRefUnref(true); - + // set up an alphafunc by default to speed up blending operations. #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE osg::AlphaFunc* alphafunc = new osg::AlphaFunc; alphafunc->setFunction(osg::AlphaFunc::GREATER,0.0f); alphafunc->setThreadSafeRefUnref(true); - + _stateset->setAttributeAndModes(alphafunc, osg::StateAttribute::ON); #endif } -#endif +#endif } RenderBin::RenderBin(const RenderBin& rhs,const CopyOp& copyop): @@ -212,13 +212,13 @@ void RenderBin::sort() { itr->second->sort(); } - - if (_sortCallback.valid()) + + if (_sortCallback.valid()) { _sortCallback->sortImplementation(this); } else sortImplementation(); - + _sorted = true; } @@ -296,14 +296,14 @@ struct FrontToBackSortFunctor } }; - + void RenderBin::sortFrontToBack() { copyLeavesFromStateGraphListToRenderLeafList(); // now sort the list into acending depth order. std::sort(_renderLeafList.begin(),_renderLeafList.end(),FrontToBackSortFunctor()); - + // cout << "sort front to back"<drawImplementation(this,renderInfo,previous); } @@ -535,7 +535,7 @@ bool RenderBin::getStats(Statistics& stats) const const RenderLeaf* rl = *dw_itr; const Drawable* dw= rl->getDrawable(); stats.addDrawable(); // number of geosets - + const Geometry* geom = dw->asGeometry(); if (geom) { @@ -547,7 +547,7 @@ bool RenderBin::getStats(Statistics& stats) const { stats.addMatrix(); // number of matrices } - + if (dw) { // then tot up the primitive types and no vertices. @@ -560,7 +560,7 @@ bool RenderBin::getStats(Statistics& stats) const oitr!=_stateGraphList.end(); ++oitr) { - + for(StateGraph::LeafList::const_iterator dw_itr = (*oitr)->_leaves.begin(); dw_itr != (*oitr)->_leaves.end(); ++dw_itr) @@ -645,7 +645,7 @@ unsigned int RenderBin::computeNumberOfDynamicRenderLeaves() const { count += rbitr->second->computeNumberOfDynamicRenderLeaves(); } - + return count; } diff --git a/src/osgUtil/RenderLeaf.cpp b/src/osgUtil/RenderLeaf.cpp index 94be63c62..5905c02f7 100644 --- a/src/osgUtil/RenderLeaf.cpp +++ b/src/osgUtil/RenderLeaf.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -80,11 +80,11 @@ void RenderLeaf::render(osg::RenderInfo& renderInfo,RenderLeaf* previous) // draw the drawable _drawable->draw(renderInfo); } - + if (_dynamic) { state.decrementDynamicObjectCount(); } - + // OSG_NOTICE<<"RenderLeaf "<<_drawable->getName()<<" "<<_depth< @@ -54,10 +54,10 @@ RenderStage::RenderStage(): _cameraRequiresSetUp = false; _camera = 0; - + _level = 0; _face = 0; - + _imageReadPixelFormat = GL_RGBA; _imageReadPixelDataType = GL_UNSIGNED_BYTE; } @@ -84,10 +84,10 @@ RenderStage::RenderStage(SortMode mode): _cameraRequiresSetUp = false; _camera = 0; - + _level = 0; _face = 0; - + _imageReadPixelFormat = GL_RGBA; _imageReadPixelDataType = GL_UNSIGNED_BYTE; } @@ -128,7 +128,7 @@ RenderStage::~RenderStage() void RenderStage::reset() { _stageDrawnThisFrame = false; - + if (_renderStageLighting.valid()) _renderStageLighting->reset(); for(RenderStageList::iterator pre_itr = _preRenderList.begin(); @@ -209,7 +209,7 @@ void RenderStage::addPostRenderStage(RenderStage* rs, int order) void RenderStage::drawPreRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous) { if (_preRenderList.empty()) return; - + //cout << "Drawing prerendering stages "<x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<getRenderTargetImplementation(); @@ -249,7 +249,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) height = osg::maximum(height,itr->second.height()); depth = osg::maximum(depth,itr->second.depth()); } - + // OSG_NOTICE<<"RenderStage::runCameraSetUp viewport "<<_viewport->x()<<" "<<_viewport->y()<<" "<<_viewport->width()<<" "<<_viewport->height()<first]._imageReadPixelDataType = dataType; _bufferAttachmentMap[itr->first]._image = image; } - + if (itr->second._texture.valid()) { osg::Texture* texture = itr->second._texture.get(); @@ -335,12 +335,12 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) } } - + if (renderTargetImplementation==osg::Camera::FRAME_BUFFER_OBJECT) { osg::FBOExtensions* fbo_ext = osg::FBOExtensions::instance(state.getContextID(),true); bool fbo_supported = fbo_ext && fbo_ext->isSupported(); - + if (fbo_supported) { OSG_INFO<<"Setting up osg::Camera::FRAME_BUFFER_OBJECT"< fbo = new osg::FrameBufferObject; osg::ref_ptr fbo_multisample; - + bool colorAttached = false; bool depthAttached = false; bool stencilAttached = false; @@ -397,7 +397,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) osg::Camera::BufferComponent buffer = itr->first; osg::Camera::Attachment& attachment = itr->second; - + if (attachment._texture.valid() || attachment._image.valid()) fbo->setAttachment(buffer, osg::FrameBufferAttachment(attachment)); else @@ -435,7 +435,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) width, height, internalFormat, samples, colorSamples))); } - + if (buffer==osg::Camera::DEPTH_BUFFER) depthAttached = true; else if (buffer==osg::Camera::STENCIL_BUFFER) stencilAttached = true; else if (buffer==osg::Camera::PACKED_DEPTH_STENCIL_BUFFER) @@ -444,18 +444,18 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) stencilAttached = true; } else if (buffer>=osg::Camera::COLOR_BUFFER) colorAttached = true; - + } if (!depthAttached) { - // If doing MSFBO (and therefore need two FBOs, one for multisampled rendering and one for - // final resolve), then configure "fbo" as the resolve FBO, and When done - // configuring, swap it into "_resolveFbo" (see line 554). But, if not + // If doing MSFBO (and therefore need two FBOs, one for multisampled rendering and one for + // final resolve), then configure "fbo" as the resolve FBO, and When done + // configuring, swap it into "_resolveFbo" (see line 554). But, if not // using MSFBO, then "fbo" is just the render fbo. - // If using MSFBO, then resolveBuffersMask - // is the value set by the app for the resolve buffers. But if not using - // MSFBO, then resolveBuffersMask is the value set by the app for render + // If using MSFBO, then resolveBuffersMask + // is the value set by the app for the resolve buffers. But if not using + // MSFBO, then resolveBuffersMask is the value set by the app for render // buffers. In both cases, resolveBuffersMask is used to configure "fbo". if( resolveBuffersMask & osg::Camera::IMPLICIT_DEPTH_BUFFER_ATTACHMENT ) { @@ -504,9 +504,9 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) fbo->apply(state); - // If no color attachment make sure to set glDrawBuffer/glReadBuffer to none + // If no color attachment make sure to set glDrawBuffer/glReadBuffer to none // otherwise glCheckFramebufferStatus will fail - // It has to be done after call to glBindFramebuffer (fbo->apply) + // It has to be done after call to glBindFramebuffer (fbo->apply) // and before call to glCheckFramebufferStatus if ( !colorAttached ) { @@ -528,20 +528,20 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) GLuint fboId = state.getGraphicsContext() ? state.getGraphicsContext()->getDefaultFboId() : 0; fbo_ext->glBindFramebuffer(GL_FRAMEBUFFER_EXT, fboId); fbo = 0; - + // clean up. double availableTime = 100.0f; double currentTime = state.getFrameStamp()?state.getFrameStamp()->getReferenceTime():0.0; osg::RenderBuffer::flushDeletedRenderBuffers(state.getContextID(),currentTime,availableTime); osg::FrameBufferObject::flushDeletedFrameBufferObjects(state.getContextID(),currentTime,availableTime); - + } else { setDrawBuffer(GL_NONE, false ); setReadBuffer(GL_NONE, false ); - + _fbo = fbo; if (fbo_multisample.valid()) @@ -578,7 +578,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) } } } - + if (!fbo_supported) { if (renderTargetImplementationdepth = 24; } if (!colorAttached) - { + { if (bufferFormat == GL_NONE) bufferFormat = GL_RGB; traits->red = 8; @@ -727,7 +727,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) if (state.getGraphicsContext()) { traits->sharedContext = state.getGraphicsContext(); - + const osg::GraphicsContext::Traits* sharedTraits = traits->sharedContext->getTraits(); if (sharedTraits) { @@ -745,11 +745,11 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) OSG_INFO<<"RenderStage::runCameraSetUp(State&) Context has been realized "<second._texture.valid()) setTexture(itr->second._texture.get(), itr->second._level, itr->second._face); } } @@ -856,7 +856,7 @@ void RenderStage::copyTexture(osg::RenderInfo& renderInfo) else if ((texture3D = dynamic_cast(_texture.get())) != 0) { // need to implement - texture3D->copyTexSubImage3D(state, + texture3D->copyTexSubImage3D(state, static_cast(_viewport->x()), static_cast(_viewport->y()), _face, @@ -868,7 +868,7 @@ void RenderStage::copyTexture(osg::RenderInfo& renderInfo) else if ((textureCubeMap = dynamic_cast(_texture.get())) != 0) { // need to implement - textureCubeMap->copyTexSubImageCubeMap(state, _face, + textureCubeMap->copyTexSubImageCubeMap(state, _face, static_cast(_viewport->x()), static_cast(_viewport->y()), static_cast(_viewport->x()), @@ -907,17 +907,17 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b bool fbo_supported = fbo_ext && fbo_ext->isSupported(); bool using_multiple_render_targets = fbo_supported && _fbo->hasMultipleRenderingTargets(); - + if (!using_multiple_render_targets) { #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) - - if( getDrawBufferApplyMask() ) + + if( getDrawBufferApplyMask() ) glDrawBuffer(_drawBuffer); - if( getReadBufferApplyMask() ) + if( getReadBufferApplyMask() ) glReadBuffer(_readBuffer); - + #endif } @@ -926,7 +926,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b _fbo->apply(state); } - // do the drawing itself. + // do the drawing itself. RenderBin::draw(renderInfo,previous); @@ -952,7 +952,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b { GLbitfield blitMask = 0; bool needToBlitColorBuffers = false; - + //find which buffer types should be copied for (FrameBufferObject::AttachmentMap::const_iterator it = _resolveFbo->getAttachmentMap().begin(), @@ -1019,7 +1019,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b // glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); } #endif - + apply_read_fbo = true; read_fbo = _resolveFbo.get(); @@ -1043,7 +1043,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b if (read_fbo) SubFunc::applyReadFBO(apply_read_fbo, read_fbo, state); #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) - + if (using_multiple_render_targets) { int attachment=itr->first; @@ -1068,12 +1068,12 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b GLenum dataType = itr->second._image->getDataType(); if (dataType==0) dataType = _imageReadPixelDataType; - if (dataType==0) dataType = GL_UNSIGNED_BYTE; + if (dataType==0) dataType = GL_UNSIGNED_BYTE; itr->second._image->readPixels(static_cast(_viewport->x()), static_cast(_viewport->y()), static_cast(_viewport->width()), - static_cast(_viewport->height()), + static_cast(_viewport->height()), pixelFormat, dataType); } } @@ -1098,7 +1098,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b itr != bufferAttachments.end(); ++itr) { - if (itr->second._texture.valid() && itr->second._mipMapGeneration) + if (itr->second._texture.valid() && itr->second._mipMapGeneration) { state.setActiveTextureUnit(0); state.applyTextureAttribute(0, itr->second._texture.get()); @@ -1110,7 +1110,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b struct DrawInnerOperation : public osg::Operation { - DrawInnerOperation(RenderStage* stage, osg::RenderInfo& renderInfo) : + DrawInnerOperation(RenderStage* stage, osg::RenderInfo& renderInfo) : osg::Operation("DrawInnerStage",false), _stage(stage), _renderInfo(renderInfo) {} @@ -1129,7 +1129,7 @@ struct DrawInnerOperation : public osg::Operation _stage->drawInner(_renderInfo, previous, doCopyTexture); } } - + RenderStage* _stage; RenderInfo _renderInfo; }; @@ -1141,7 +1141,7 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) if(_initialViewMatrix.valid()) renderInfo.getState()->setInitialViewMatrix(_initialViewMatrix.get()); - // push the stages camera so that drawing code can query it + // push the stages camera so that drawing code can query it if (_camera) renderInfo.pushCamera(_camera); _stageDrawnThisFrame = true; @@ -1155,7 +1155,7 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) // note, SceneView does call to drawPreRenderStages explicitly // so there is no need to call it here. drawPreRenderStages(renderInfo,previous); - + if (_cameraRequiresSetUp) { runCameraSetUp(renderInfo); @@ -1168,7 +1168,7 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) osg::GraphicsContext* useContext = callingContext; osg::OperationThread* useThread = 0; osg::RenderInfo useRenderInfo(renderInfo); - + RenderLeaf* saved_previous = previous; if (_graphicsContext.valid() && _graphicsContext != callingContext) @@ -1176,26 +1176,26 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) // show we release the context so that others can use it?? will do so right // now as an experiment. callingContext->releaseContext(); - + // OSG_NOTICE<<" enclosing state before - "<getState(); useContext = _graphicsContext.get(); useThread = useContext->getGraphicsThread(); useRenderInfo.setState(useState); - + // synchronize the frame stamps useState->setFrameStamp(const_cast(state.getFrameStamp())); // map the DynamicObjectCount across to the new window useState->setDynamicObjectCount(state.getDynamicObjectCount()); useState->setDynamicObjectRenderingCompletedCallback(state.getDynamicObjectRenderingCompletedCallback()); - - if (!useThread) + + if (!useThread) { previous = 0; useContext->makeCurrent(); - + // OSG_NOTICE<<" nested state before - "<getStateSetStackSize()<getPreDrawCallback()))(renderInfo); } - - bool doCopyTexture = _texture.valid() ? + + bool doCopyTexture = _texture.valid() ? (callingContext != useContext) : false; @@ -1216,31 +1216,31 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) { #if 1 ref_ptr block = new osg::BlockAndFlushOperation; - + useThread->add(new DrawInnerOperation( this, renderInfo )); - + useThread->add(block.get()); - + // wait till the DrawInnerOperations is complete. block->block(); - + doCopyTexture = false; - + #else useThread->add(new DrawInnerOperation( this, renderInfo ), true); - + doCopyTexture = false; -#endif +#endif } else { drawInner( useRenderInfo, previous, doCopyTexture); - + if (useRenderInfo.getUserData() != renderInfo.getUserData()) { renderInfo.setUserData(useRenderInfo.getUserData()); } - + } if (useState != &state) @@ -1280,8 +1280,8 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) // flush any command left in the useContex's FIFO // to ensure that textures are updated before main thread commenses. glFlush(); - - + + useContext->releaseContext(); } } @@ -1289,9 +1289,9 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) if (callingContext && useContext != callingContext) { // restore the graphics context. - + previous = saved_previous; - + // OSG_NOTICE<<" nested state after - "<getStateSetStackSize()<x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<second->computeNumberOfDynamicRenderLeaves(); } - + return count; } diff --git a/src/osgUtil/ReversePrimitiveFunctor.cpp b/src/osgUtil/ReversePrimitiveFunctor.cpp index fdcdc6dd2..10723c4ad 100644 --- a/src/osgUtil/ReversePrimitiveFunctor.cpp +++ b/src/osgUtil/ReversePrimitiveFunctor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -19,11 +19,11 @@ template osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typename Type::value_type* indices) { if (indices==0 || count==0) return NULL; - + Type * dePtr = new Type(mode); Type & de = *dePtr; de.reserve(count); - + typedef const typename Type::value_type* IndexPointer; switch(mode) @@ -31,7 +31,7 @@ osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typena case(GL_TRIANGLES): { IndexPointer ilast = &indices[count]; - + for (IndexPointer iptr=indices; iptrfirst; i--) + + for (GLint i=end-1; i>first; i--) de.push_back(i); break; @@ -153,11 +153,11 @@ void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count case (GL_POINTS): case (GL_LINES): case (GL_LINE_STRIP): - case (GL_LINE_LOOP): + case (GL_LINE_LOOP): { - for (GLint i=end-1; i>=first; i--) + for (GLint i=end-1; i>=first; i--) de.push_back(i); - + break; } default: @@ -189,7 +189,7 @@ void ReversePrimitiveFunctor::begin(GLenum mode) else { _running = true; - + _reversedPrimitiveSet = new osg::DrawElementsUInt(mode); } } @@ -207,7 +207,7 @@ void ReversePrimitiveFunctor::vertex(unsigned int pos) } void ReversePrimitiveFunctor::end() -{ +{ if (_running == false) { OSG_WARN << "ReversePrimitiveFunctor : call \"end\" without call \"begin\"." << std::endl; @@ -215,9 +215,9 @@ void ReversePrimitiveFunctor::end() else { _running = false; - + osg::ref_ptr tmpDe(static_cast(_reversedPrimitiveSet.get())); - + _reversedPrimitiveSet = drawElementsTemplate(tmpDe->getMode(), tmpDe->size(), &(tmpDe->front())); } } diff --git a/src/osgUtil/SceneGraphBuilder.cpp b/src/osgUtil/SceneGraphBuilder.cpp index ec468fa24..5f9cc29a1 100644 --- a/src/osgUtil/SceneGraphBuilder.cpp +++ b/src/osgUtil/SceneGraphBuilder.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -59,7 +59,7 @@ void SceneGraphBuilder::PushMatrix() void SceneGraphBuilder::PopMatrix() { if (!_matrixStack.empty()) _matrixStack.pop_back(); - + matrixChanged(); } @@ -214,9 +214,9 @@ void SceneGraphBuilder::TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) void SceneGraphBuilder::Vertex3f(GLfloat x, GLfloat y, GLfloat z) { osg::Vec3 vertex(x,y,z); - + vertex = vertex * _matrixStack.back(); - + if (_vertices.valid()) _vertices->push_back(vertex); if (_normal.valid()) _normals->push_back(_normal); if (_colors.valid()) _colors->push_back(_color); @@ -228,7 +228,7 @@ void SceneGraphBuilder::Begin(GLenum mode) // reset geometry _primitiveMode = mode; _vertices = new osg::Vec3Array; - + _normalSet = false; _normals = new osg::Vec3Array; @@ -245,7 +245,7 @@ void SceneGraphBuilder::End() allocateGeometry(); _geometry->setVertexArray(_vertices.get()); - + if (_colorSet) { _geometry->setColorArray(_colors.get()); @@ -255,11 +255,11 @@ void SceneGraphBuilder::End() { osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(_color); - + _geometry->setColorArray(colors); _geometry->setColorBinding(osg::Geometry::BIND_OVERALL); } - + if (_normalSet) { _geometry->setNormalArray(_normals.get()); @@ -269,7 +269,7 @@ void SceneGraphBuilder::End() { _geometry->setNormalBinding(osg::Geometry::BIND_OFF); } - + if (_maxNumTexCoordComponents==1) { // convert Vec4Array into FloatArray @@ -448,17 +448,17 @@ osg::Node* SceneGraphBuilder::getScene() osg::Node* SceneGraphBuilder::takeScene() { osg::ref_ptr node; - + if (_group.valid() && _group->getNumChildren()>0) node = _group.get(); else if (_transform.valid() && _transform->getNumChildren()>0) node = _transform.get(); else if (_geode.valid() && _geode->getNumDrawables()>0) node = _geode.get(); - + // reset all the pointers to properly release the scene graph _geometry = 0; _geode = 0; _transform = 0; _group = 0; - + return node.release(); } @@ -495,7 +495,7 @@ void SceneGraphBuilder::addShape(osg::Shape* shape) { osg::ShapeDrawable* sd = new osg::ShapeDrawable(shape); sd->setColor(_color); - + addDrawable(sd); } @@ -519,7 +519,7 @@ void SceneGraphBuilder::allocateStateSet() _stateset = dynamic_cast(_stateset->clone(osg::CopyOp::SHALLOW_COPY)); _statesetAssigned = false; } - + if (!_stateset) _stateset = new osg::StateSet; } diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 8b91c6132..958195ef6 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -93,7 +93,7 @@ static const GLubyte patternHorzEven[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}; // 32 x 32 bit array every row is a horizontal line of pixels -// and the (bitwise) columns a vertical line +// and the (bitwise) columns a vertical line // The following is a checkerboard pattern static const GLubyte patternCheckerboard[] = { 0x55, 0x55, 0x55, 0x55, @@ -137,25 +137,25 @@ SceneView::SceneView(DisplaySettings* ds) _fusionDistanceValue = 1.0f; _lightingMode=NO_SCENEVIEW_LIGHT; - + _prioritizeTextures = false; - + setCamera(new Camera); _camera->setViewport(new Viewport); _camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f)); - + _initCalled = false; _camera->setDrawBuffer(GL_BACK); _automaticFlush = true; _requiresFlush = false; - + _activeUniforms = DEFAULT_UNIFORMS; - + _previousFrameTime = 0; _previousSimulationTime = 0; - + _redrawInterlacedStereoStencilMask = true; _interlacedStereoStencilWidth = 0; _interlacedStereoStencilHeight = 0; @@ -173,22 +173,22 @@ SceneView::SceneView(const SceneView& rhs, const osg::CopyOp& copyop): _fusionDistanceValue = rhs._fusionDistanceValue; _lightingMode = rhs._lightingMode; - + _prioritizeTextures = rhs._prioritizeTextures; - + _camera = rhs._camera; _cameraWithOwnership = rhs._cameraWithOwnership; - + _initCalled = false; _automaticFlush = rhs._automaticFlush; _requiresFlush = false; - + _activeUniforms = rhs._activeUniforms; - + _previousFrameTime = 0; _previousSimulationTime = 0; - + _redrawInterlacedStereoStencilMask = rhs._redrawInterlacedStereoStencilMask; _interlacedStereoStencilWidth = rhs._interlacedStereoStencilWidth; _interlacedStereoStencilHeight = rhs._interlacedStereoStencilHeight; @@ -227,7 +227,7 @@ void SceneView::setDefaults(unsigned int options) // enable lighting by default. _globalStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON); #endif - + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) osg::LightModel* lightmodel = new osg::LightModel; lightmodel->setAmbientIntensity(osg::Vec4(0.1f,0.1f,0.1f,1.0f)); @@ -238,9 +238,9 @@ void SceneView::setDefaults(unsigned int options) { _lightingMode = NO_SCENEVIEW_LIGHT; } - + _renderInfo.setState(new State); - + _stateGraph = new StateGraph; _renderStage = new RenderStage; @@ -248,14 +248,14 @@ void SceneView::setDefaults(unsigned int options) if (options & COMPILE_GLOBJECTS_AT_INIT) { GLObjectsVisitor::Mode dlvMode = GLObjectsVisitor::COMPILE_DISPLAY_LISTS | - GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES | + GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES | GLObjectsVisitor::CHECK_BLACK_LISTED_MODES; #ifdef __sgi dlvMode = GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES; #endif - // sgi's IR graphics has a problem with lighting and display lists, as it seems to store + // sgi's IR graphics has a problem with lighting and display lists, as it seems to store // lighting state with the display list, and the display list visitor doesn't currently apply // state before creating display lists. So will disable the init visitor default, this won't // affect functionality since the display lists will be created as and when needed. @@ -264,7 +264,7 @@ void SceneView::setDefaults(unsigned int options) _initVisitor = dlv; } - + _updateVisitor = new UpdateVisitor; _cullVisitor = CullVisitor::create(); @@ -280,7 +280,7 @@ void SceneView::setDefaults(unsigned int options) texenv->setMode(osg::TexEnv::MODULATE); _globalStateSet->setTextureAttributeAndModes(0,texenv, osg::StateAttribute::ON); #endif - + _camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f)); } @@ -294,7 +294,7 @@ void SceneView::setCamera(osg::Camera* camera, bool assumeOwnershipOfCamera) { OSG_NOTICE<<"Warning: attempt to assign a NULL camera to SceneView not permitted."< temporaryRefernce = node; - + // remove pre existing children _camera->removeChildren(0, _camera->getNumChildren()); - + // add the new one in. _camera->addChild(node); } @@ -330,24 +330,24 @@ void SceneView::init() { _initVisitor->reset(); _initVisitor->setFrameStamp(_frameStamp.get()); - + GLObjectsVisitor* dlv = dynamic_cast(_initVisitor.get()); if (dlv) dlv->setState(_renderInfo.getState()); - + if (_frameStamp.valid()) { _initVisitor->setTraversalNumber(_frameStamp->getFrameNumber()); } - + _camera->accept(*_initVisitor.get()); - - } + + } } void SceneView::update() { if (_camera.valid() && _updateVisitor.valid()) - { + { _updateVisitor->reset(); _updateVisitor->setFrameStamp(_frameStamp.get()); @@ -357,9 +357,9 @@ void SceneView::update() { _updateVisitor->setTraversalNumber(_frameStamp->getFrameNumber()); } - + _camera->accept(*_updateVisitor.get()); - + // now force a recompute of the bounding volume while we are still in // the read/write app phase, this should prevent the need to recompute // the bounding volumes from within the cull traversal which may be @@ -376,43 +376,43 @@ void SceneView::updateUniforms() } if (!_localStateSet) return; - + if ((_activeUniforms & FRAME_NUMBER_UNIFORM) && _frameStamp.valid()) { osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_FrameNumber",osg::Uniform::UNSIGNED_INT); - uniform->set(_frameStamp->getFrameNumber()); + uniform->set(_frameStamp->getFrameNumber()); } - + if ((_activeUniforms & FRAME_TIME_UNIFORM) && _frameStamp.valid()) { osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_FrameTime",osg::Uniform::FLOAT); uniform->set(static_cast(_frameStamp->getReferenceTime())); } - + if ((_activeUniforms & DELTA_FRAME_TIME_UNIFORM) && _frameStamp.valid()) { float delta_frame_time = (_previousFrameTime != 0.0) ? static_cast(_frameStamp->getReferenceTime()-_previousFrameTime) : 0.0f; _previousFrameTime = _frameStamp->getReferenceTime(); - + osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_DeltaFrameTime",osg::Uniform::FLOAT); uniform->set(delta_frame_time); } - + if ((_activeUniforms & SIMULATION_TIME_UNIFORM) && _frameStamp.valid()) { osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_SimulationTime",osg::Uniform::FLOAT); uniform->set(static_cast(_frameStamp->getSimulationTime())); } - + if ((_activeUniforms & DELTA_SIMULATION_TIME_UNIFORM) && _frameStamp.valid()) { float delta_simulation_time = (_previousSimulationTime != 0.0) ? static_cast(_frameStamp->getSimulationTime()-_previousSimulationTime) : 0.0f; _previousSimulationTime = _frameStamp->getSimulationTime(); - + osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_DeltaSimulationTime",osg::Uniform::FLOAT); uniform->set(delta_simulation_time); } - + if (_activeUniforms & VIEW_MATRIX_UNIFORM) { osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_ViewMatrix",osg::Uniform::FLOAT_MAT4); @@ -661,7 +661,7 @@ void SceneView::computeRightEyeViewport(const osg::Viewport *viewport) void SceneView::setLightingMode(LightingMode mode) { if (mode==_lightingMode) return; - + if (_lightingMode!=NO_SCENEVIEW_LIGHT) { // remove GL_LIGHTING mode @@ -681,7 +681,7 @@ void SceneView::setLightingMode(LightingMode mode) #if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) // add GL_LIGHTING mode _globalStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON); - if (_light.valid()) + if (_light.valid()) { _globalStateSet->setAssociatedModes(_light.get(), osg::StateAttribute::ON); } @@ -691,31 +691,31 @@ void SceneView::setLightingMode(LightingMode mode) void SceneView::inheritCullSettings(const osg::CullSettings& settings, unsigned int inheritanceMask) { - if (_camera.valid() && _camera->getView()) + if (_camera.valid() && _camera->getView()) { if (inheritanceMask & osg::CullSettings::LIGHTING_MODE) { LightingMode newLightingMode = _lightingMode; - + switch(_camera->getView()->getLightingMode()) { case(osg::View::NO_LIGHT): newLightingMode = NO_SCENEVIEW_LIGHT; break; case(osg::View::HEADLIGHT): newLightingMode = HEADLIGHT; break; case(osg::View::SKY_LIGHT): newLightingMode = SKY_LIGHT; break; } - + if (newLightingMode != _lightingMode) { setLightingMode(newLightingMode); } } - + if (inheritanceMask & osg::CullSettings::LIGHT) { setLight(_camera->getView()->getLight()); } } - + osg::CullSettings::inheritCullSettings(settings, inheritanceMask); } @@ -739,17 +739,17 @@ void SceneView::cull() // applications which is ok for most apps, but not multiple context/pipe applications. _renderInfo.setState(new osg::State); } - + osg::State* state = _renderInfo.getState(); if (!_localStateSet) { _localStateSet = new osg::StateSet; } - + // we in theory should be able to be able to bypass reset, but we'll call it just incase. //_state->reset(); - + state->setFrameStamp(_frameStamp.get()); state->setDisplaySettings(_displaySettings.get()); @@ -770,7 +770,7 @@ void SceneView::cull() _renderStage = new RenderStage; } - if (_displaySettings.valid() && _displaySettings->getStereo()) + if (_displaySettings.valid() && _displaySettings->getStereo()) { if (_displaySettings->getStereoMode()==osg::DisplaySettings::LEFT_EYE) @@ -813,7 +813,7 @@ void SceneView::cull() if (!_cullVisitorRight.valid()) _cullVisitorRight = dynamic_cast(_cullVisitor->clone()); if (!_stateGraphRight.valid()) _stateGraphRight = dynamic_cast(_stateGraph->cloneType()); if (!_renderStageRight.valid()) _renderStageRight = dynamic_cast(_renderStage->clone(osg::CopyOp::DEEP_COPY_ALL)); - + _cullVisitorLeft->setDatabaseRequestHandler(_cullVisitor->getDatabaseRequestHandler()); _cullVisitorLeft->setClampProjectionMatrixCallback(_cullVisitor->getClampProjectionMatrixCallback()); _cullVisitorLeft->setTraversalMask(_cullMaskLeft); @@ -827,7 +827,7 @@ void SceneView::cull() _cullVisitorRight->setTraversalMask(_cullMaskRight); computeRightEyeViewport(getViewport()); computeNearFar = cullStage(computeRightEyeProjection(getProjectionMatrix()),computeRightEyeView(getViewMatrix()),_cullVisitorRight.get(),_stateGraphRight.get(),_renderStageRight.get(),_viewportRight.get()); - + if (computeNearFar) { CullVisitor::value_type zNear = osg::minimum(_cullVisitorLeft->getCalculatedNearPlane(),_cullVisitorRight->getCalculatedNearPlane()); @@ -851,7 +851,7 @@ void SceneView::cull() _cullVisitor->clampProjectionMatrix(getProjectionMatrix(),zNear,zFar); } } - + } @@ -868,14 +868,14 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod if (_camera->containsOccluderNodes()) { //std::cout << "Scene graph contains occluder nodes, searching for them"<inheritCullSettings(*this); - + _collectOccludersVisitor->reset(); - + _collectOccludersVisitor->setFrameStamp(_frameStamp.get()); // use the frame number for the traversal number. @@ -894,17 +894,17 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod _collectOccludersVisitor->popModelViewMatrix(); _collectOccludersVisitor->popProjectionMatrix(); _collectOccludersVisitor->popViewport(); - + // sort the occluder from largest occluder volume to smallest. _collectOccludersVisitor->removeOccludedOccluders(); - - + + OSG_DEBUG << "finished searching for occluder - found "<<_collectOccludersVisitor->getCollectedOccluderSet().size()<getOccluderList().clear(); std::copy(_collectOccludersVisitor->getCollectedOccluderSet().begin(),_collectOccludersVisitor->getCollectedOccluderSet().end(), std::back_insert_iterator(cullVisitor->getOccluderList())); } - + cullVisitor->reset(); @@ -941,8 +941,8 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod renderStage->setClearAccum(_camera->getClearAccum()); renderStage->setClearStencil(_camera->getClearStencil()); renderStage->setClearMask(_camera->getClearMask()); - -#if 1 + +#if 1 renderStage->setCamera(_camera.get()); #endif @@ -959,9 +959,9 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod break; default: break; - } + } #endif - + if (_globalStateSet.valid()) cullVisitor->pushStateSet(_globalStateSet.get()); if (_secondaryStateSet.valid()) cullVisitor->pushStateSet(_secondaryStateSet.get()); if (_localStateSet.valid()) cullVisitor->pushStateSet(_localStateSet.get()); @@ -971,8 +971,8 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod cullVisitor->pushProjectionMatrix(proj.get()); cullVisitor->pushModelViewMatrix(mv.get(),osg::Transform::ABSOLUTE_RF); - // traverse the scene graph to generate the rendergraph. - // If the camera has a cullCallback execute the callback which has the + // traverse the scene graph to generate the rendergraph. + // If the camera has a cullCallback execute the callback which has the // requirement that it must traverse the camera's children. { osg::NodeCallback* callback = _camera->getCullCallback(); @@ -988,7 +988,7 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod if (_localStateSet.valid()) cullVisitor->popStateSet(); if (_secondaryStateSet.valid()) cullVisitor->popStateSet(); if (_globalStateSet.valid()) cullVisitor->popStateSet(); - + renderStage->sort(); @@ -998,8 +998,8 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod // a clean has been used instead to try to minimize the amount of // allocation and deleteing of the StateGraph nodes. rendergraph->prune(); - - // set the number of dynamic objects in the scene. + + // set the number of dynamic objects in the scene. _dynamicObjectCount += renderStage->computeNumberOfDynamicRenderLeaves(); @@ -1010,9 +1010,9 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod void SceneView::releaseAllGLObjects() { if (!_camera) return; - + _camera->releaseGLObjects(_renderInfo.getState()); - + // we need to reset State as it keeps handles to Program objects. if (_renderInfo.getState()) _renderInfo.getState()->reset(); } @@ -1021,14 +1021,14 @@ void SceneView::releaseAllGLObjects() void SceneView::flushAllDeletedGLObjects() { _requiresFlush = false; - + osg::flushAllDeletedGLObjects(getState()->getContextID()); } void SceneView::flushDeletedGLObjects(double& availableTime) { // OSG_NOTICE<<"SceneView::flushDeletedGLObjects(availableTime="<getStereo()) + if (_displaySettings.valid() && _displaySettings->getStereo()) { - + switch(_displaySettings->getStereoMode()) { case(osg::DisplaySettings::QUAD_BUFFER): @@ -1130,10 +1130,10 @@ void SceneView::draw() } _renderStageLeft->setColorMask(cmask); _renderStageRight->setColorMask(cmask); - + _localStateSet->setAttribute(getViewport()); - + _renderStageLeft->drawPreRenderStages(_renderInfo,previous); _renderStageRight->drawPreRenderStages(_renderInfo,previous); @@ -1145,7 +1145,7 @@ void SceneView::draw() leftColorMask = new osg::ColorMask(); _renderStageLeft->setColorMask(leftColorMask); } - + // red leftColorMask->setMask(true,false,false,true); @@ -1156,8 +1156,8 @@ void SceneView::draw() // draw left eye. _renderStageLeft->draw(_renderInfo,previous); - - + + // ensure that right eye color planes are active. osg::ColorMask* rightColorMask = _renderStageRight->getColorMask(); @@ -1169,7 +1169,7 @@ void SceneView::draw() // cyan rightColorMask->setMask(false,true,true,true); - + // blue // rightColorMask->setMask(false,false,true,true); @@ -1220,7 +1220,7 @@ void SceneView::draw() static_cast(separation), static_cast(getViewport()->height()),_renderStageLeft->getClearColor()); - + _localStateSet->setAttribute(_viewportLeft.get()); _renderStageLeft->draw(_renderInfo,previous); @@ -1348,8 +1348,8 @@ void SceneView::draw() glLoadIdentity(); glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - + glLoadIdentity(); + getViewport()->apply(*state); getState()->applyMode(GL_LIGHTING,false); getState()->applyMode(GL_DEPTH_TEST,false); @@ -1374,12 +1374,12 @@ void SceneView::draw() } getState()->applyMode(GL_POLYGON_STIPPLE,true); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - glRecti(0, 0, 1, 1); + glRecti(0, 0, 1, 1); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); getState()->applyMode(GL_POLYGON_STIPPLE,false); getState()->applyMode(GL_LIGHTING,true); getState()->applyMode(GL_DEPTH_TEST,true); - + _redrawInterlacedStereoStencilMask = false; _interlacedStereoStencilWidth = static_cast(getViewport()->width()); _interlacedStereoStencilHeight = static_cast(getViewport()->height()); @@ -1389,9 +1389,9 @@ void SceneView::draw() _renderStageRight->setClearMask(_renderStageRight->getClearMask() & ~(GL_STENCIL_BUFFER_BIT|GL_COLOR_BUFFER_BIT)); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glStencilFunc(GL_EQUAL, 0, ~0u); + glStencilFunc(GL_EQUAL, 0, ~0u); _renderStageLeft->draw(_renderInfo,previous); - + glStencilFunc(GL_NOTEQUAL, 0, ~0u); _renderStageRight->draw(_renderInfo,previous); glDisable(GL_STENCIL_TEST); @@ -1442,7 +1442,7 @@ void SceneView::draw() _renderStage->drawPreRenderStages(_renderInfo,previous); _renderStage->draw(_renderInfo,previous); } - + // re apply the defalt OGL state. state->popAllStateSets(); state->apply(); @@ -1482,9 +1482,9 @@ bool SceneView::projectWindowIntoObject(const osg::Vec3& window,osg::Vec3& objec { osg::Matrix inverseMVPW; inverseMVPW.invert(computeMVPW()); - + object = window*inverseMVPW; - + return true; } @@ -1498,10 +1498,10 @@ bool SceneView::projectWindowXYIntoObject(int x,int y,osg::Vec3& near_point,osg: { osg::Matrix inverseMVPW; inverseMVPW.invert(computeMVPW()); - + near_point = osg::Vec3(x,y,0.0f)*inverseMVPW; far_point = osg::Vec3(x,y,1.0f)*inverseMVPW; - + return true; } @@ -1519,7 +1519,7 @@ bool SceneView::projectObjectIntoWindow(const osg::Vec3& object,osg::Vec3& windo const osg::Matrix SceneView::computeMVPW() const { osg::Matrix matrix( getViewMatrix() * getProjectionMatrix()); - + if (getViewport()) matrix.postMult(getViewport()->computeWindowMatrix()); else @@ -1534,7 +1534,7 @@ void SceneView::clearArea(int x,int y,int width,int height,const osg::Vec4& colo viewport->setViewport(x,y,width,height); _renderInfo.getState()->applyAttribute(viewport.get()); - + glScissor( x, y, width, height ); glEnable( GL_SCISSOR_TEST ); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); @@ -1550,7 +1550,7 @@ void SceneView::setProjectionMatrixAsOrtho(double left, double right, setProjectionMatrix(osg::Matrixd::ortho(left, right, bottom, top, zNear, zFar)); -} +} void SceneView::setProjectionMatrixAsOrtho2D(double left, double right, double bottom, double top) @@ -1573,7 +1573,7 @@ void SceneView::setProjectionMatrixAsPerspective(double fovy,double aspectRatio, { setProjectionMatrix(osg::Matrixd::perspective(fovy,aspectRatio, zNear, zFar)); -} +} bool SceneView::getProjectionMatrixAsOrtho(double& left, double& right, double& bottom, double& top, @@ -1591,13 +1591,13 @@ bool SceneView::getProjectionMatrixAsFrustum(double& left, double& right, return getProjectionMatrix().getFrustum(left, right, bottom, top, zNear, zFar); -} +} bool SceneView::getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, double& zNear, double& zFar) const { return getProjectionMatrix().getPerspective(fovy, aspectRatio, zNear, zFar); -} +} void SceneView::setViewMatrixAsLookAt(const Vec3& eye,const Vec3& center,const Vec3& up) { @@ -1611,7 +1611,7 @@ void SceneView::getViewMatrixAsLookAt(Vec3& eye,Vec3& center,Vec3& up,float look bool SceneView::getStats(Statistics& stats) { - if (_displaySettings.valid() && _displaySettings->getStereo()) + if (_displaySettings.valid() && _displaySettings->getStereo()) { switch(_displaySettings->getStereoMode()) { diff --git a/src/osgUtil/ShaderGen.cpp b/src/osgUtil/ShaderGen.cpp index 0f5f5f8cd..dbcc19eeb 100644 --- a/src/osgUtil/ShaderGen.cpp +++ b/src/osgUtil/ShaderGen.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -59,14 +59,14 @@ public: osg::Uniform *getUniform(const std::string& name) const { UniformMap::const_iterator it = _uniformMap.find(name); - return it != _uniformMap.end() ? + return it != _uniformMap.end() ? const_cast(it->second.uniformVec.back().first) : 0; } protected: osg::StateAttribute::GLModeValue getMode(const ModeMap &modeMap, - osg::StateAttribute::GLMode mode, + osg::StateAttribute::GLMode mode, osg::StateAttribute::GLModeValue def = osg::StateAttribute::INHERIT) const { ModeMap::const_iterator it = modeMap.find(mode); @@ -77,7 +77,7 @@ protected: osg::StateAttribute::Type type, unsigned int member = 0) const { AttributeMap::const_iterator it = attributeMap.find(std::make_pair(type, member)); - return (it != attributeMap.end() && it->second.attributeVec.size()) ? + return (it != attributeMap.end() && it->second.attributeVec.size()) ? const_cast(it->second.attributeVec.back().first) : 0; } }; @@ -134,7 +134,7 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const { vert << "varying vec3 viewDir;\n"; } - + // copy varying to fragment shader frag << vert.str(); @@ -168,7 +168,7 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const if (stateMask & NORMAL_MAP) { - vert << + vert << " vec3 n = gl_NormalMatrix * gl_Normal;\n"\ " vec3 t = gl_NormalMatrix * tangent;\n"\ " vec3 b = cross(n, t);\n"\ @@ -187,7 +187,7 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const } else if (stateMask & LIGHTING) { - vert << + vert << " normalDir = gl_NormalMatrix * gl_Normal;\n"\ " vec3 dir = -vec3(gl_ModelViewMatrix * gl_Vertex);\n"\ " viewDir = dir;\n"\ @@ -199,7 +199,7 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const } else if (stateMask & FOG) { - vert << + vert << " viewDir = -vec3(gl_ModelViewMatrix * gl_Vertex);\n"\ " gl_FrontColor = gl_Color;\n"; } @@ -207,7 +207,7 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const { vert << " gl_FrontColor = gl_Color;\n"; } - + vert << "}\n"; frag << "\n"\ @@ -230,7 +230,7 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const if (stateMask & (LIGHTING | NORMAL_MAP)) { - frag << + frag << " vec3 nd = normalize(normalDir);\n"\ " vec3 ld = normalize(lightDir);\n"\ " vec3 vd = normalize(viewDir);\n"\ @@ -258,12 +258,12 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const if (stateMask & FOG) { - frag << + frag << " float d2 = dot(viewDir, viewDir);//gl_FragCoord.z/gl_FragCoord.w;\n"\ " float f = exp2(-1.442695*gl_Fog.density*gl_Fog.density*d2);\n"\ " color.rgb = mix(gl_Fog.color.rgb, color.rgb, clamp(f, 0.0, 1.0));\n"; } - + frag << " gl_FragColor = color;\n"; frag << "}\n"; @@ -279,14 +279,14 @@ osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const return stateSet; } -ShaderGenVisitor::ShaderGenVisitor() : +ShaderGenVisitor::ShaderGenVisitor() : NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _stateCache(new ShaderGenCache), _state(new StateEx) { } -ShaderGenVisitor::ShaderGenVisitor(ShaderGenCache *stateCache) : +ShaderGenVisitor::ShaderGenVisitor(ShaderGenCache *stateCache) : NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _stateCache(stateCache), _state(new StateEx) @@ -383,7 +383,7 @@ void ShaderGenVisitor::update(osg::Drawable *drawable) osg::StateSet *ss = const_cast(state->getStateSetStack().back()); ss->setAttribute(progss->getAttribute(osg::StateAttribute::PROGRAM)); ss->setUniformList(progss->getUniformList()); - + // remove any modes that won't be appropriate when using shaders if ((stateMask&ShaderGenCache::LIGHTING)!=0) { diff --git a/src/osgUtil/Simplifier.cpp b/src/osgUtil/Simplifier.cpp index d594b77c0..f80506ce5 100644 --- a/src/osgUtil/Simplifier.cpp +++ b/src/osgUtil/Simplifier.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -73,7 +73,7 @@ public: EdgeCollapse(): _geometry(0), _computeErrorMetricUsingLength(false) {} - + ~EdgeCollapse(); void setGeometry(osg::Geometry* geometry, const Simplifier::IndexList& protectedPoints); @@ -91,18 +91,18 @@ public: float r2 = r; Point* p1 = edge->_p1.get(); Point* p2 = edge->_p2.get(); - + if (p1==0 || p2==0) { OSG_NOTICE<<"Error computeInterpolatedPoint("<_vertex = p1->_vertex * r1 + p2->_vertex * r2; unsigned int s = osg::minimum(p1->_attributes.size(),p2->_attributes.size()); for(unsigned int i=0;i_attributes.push_back(p1->_attributes[i]*r1 + p2->_attributes[i]*r2); + point->_attributes.push_back(p1->_attributes[i]*r1 + p2->_attributes[i]*r2); } return point; } @@ -111,7 +111,7 @@ public: { return computeInterpolatedPoint(edge,0.5f); } - + error_type computeErrorMetric(Edge* edge,Point* point) const { if (_computeErrorMetricUsingLength) @@ -139,7 +139,7 @@ public: { error += fabs( (*itr)->distance(vertex) ); } - + // use average of error error /= error_type(triangles.size()); @@ -150,7 +150,7 @@ public: return 0; } } - + void updateErrorMetricForEdge(Edge* edge) { if (!edge->_p1 || !edge->_p2) @@ -161,14 +161,14 @@ public: osg::ref_ptr keep_local_reference_to_edge(edge); - + if (_edgeSet.count(keep_local_reference_to_edge)!=0) { _edgeSet.erase(keep_local_reference_to_edge); } edge->_proposedPoint = computeOptimalPoint(edge); - + if (_computeErrorMetricUsingLength) { edge->setErrorMetric( computeErrorMetric( edge, edge->_proposedPoint.get())); @@ -182,18 +182,18 @@ public: else edge->setErrorMetric( FLT_MAX ); } - + _edgeSet.insert(keep_local_reference_to_edge); } - + void updateErrorMetricForAllEdges() { typedef std::vector< osg::ref_ptr > LocalEdgeList ; LocalEdgeList edges; std::copy( _edgeSet.begin(), _edgeSet.end(), std::back_inserter(edges)); - + _edgeSet.clear(); - + for(LocalEdgeList::iterator itr=edges.begin(); itr!=edges.end(); ++itr) @@ -271,7 +271,7 @@ public: struct Point : public osg::Referenced { Point(): _protected(false), _index(0) {} - + bool _protected; unsigned int _index; @@ -290,14 +290,14 @@ public: { if (_vertex < rhs._vertex) return true; if (rhs._vertex < _vertex) return false; - + return _attributes < rhs._attributes; } - + bool isBoundaryPoint() const { if (_protected) return true; - + for(TriangleSet::const_iterator itr=_triangles.begin(); itr!=_triangles.end(); ++itr) @@ -306,7 +306,7 @@ public: if ((triangle->_e1->_p1==this || triangle->_e1->_p2==this) && triangle->_e1->isBoundaryEdge()) return true; if ((triangle->_e2->_p1==this || triangle->_e2->_p2==this) && triangle->_e2->isBoundaryEdge()) return true; if ((triangle->_e3->_p1==this || triangle->_e3->_p2==this) && triangle->_e3->isBoundaryEdge()) return true; - + //if ((*itr)->isBoundaryTriangle()) return true; } return false; @@ -317,7 +317,7 @@ public: struct Edge : public osg::Referenced { Edge(): _errorMetric(0.0), _maximumDeviation(1.0) {} - + void clear() { _p1 = 0; @@ -327,7 +327,7 @@ public: osg::ref_ptr _p1; osg::ref_ptr _p2; - + TriangleSet _triangles; error_type _errorMetric; @@ -337,7 +337,7 @@ public: void setErrorMetric(error_type errorMetric) { _errorMetric = errorMetric; } error_type getErrorMetric() const { return _errorMetric; } - + bool operator < ( const Edge& rhs) const { // both error metrics are computed @@ -346,10 +346,10 @@ public: if (dereference_check_less(_p1,rhs._p1)) return true; if (dereference_check_less(rhs._p1,_p1)) return false; - + return dereference_check_less(_p2,rhs._p2); } - + bool operator == ( const Edge& rhs) const { if (&rhs==this) return true; @@ -365,23 +365,23 @@ public: if (rhs<*this) return true; return false; } - + void addTriangle(Triangle* triangle) { _triangles.insert(triangle); // if (_triangles.size()>2) OSG_NOTICE<<"Warning too many triangles ("<<_triangles.size()<<") sharing edge "<isBoundaryPoint() || _p2->isBoundaryPoint(); + return isBoundaryEdge() || _p1->isBoundaryPoint() || _p2->isBoundaryPoint(); } - + void updateMaxNormalDeviationOnEdgeCollapse() { @@ -406,21 +406,21 @@ public: } } } - - error_type getMaxNormalDeviationOnEdgeCollapse() const { return _maximumDeviation; } + + error_type getMaxNormalDeviationOnEdgeCollapse() const { return _maximumDeviation; } }; struct Triangle : public osg::Referenced { Triangle() {} - + void clear() { _p1 = 0; _p2 = 0; _p3 = 0; - + _e1 = 0; _e2 = 0; _e3 = 0; @@ -432,14 +432,14 @@ public: if (dereference_check_less(rhs._p1,_p1)) return false; - const Point* lhs_lower = dereference_check_less(_p2,_p3) ? _p2.get() : _p3.get(); - const Point* rhs_lower = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p2.get() : rhs._p3.get(); + const Point* lhs_lower = dereference_check_less(_p2,_p3) ? _p2.get() : _p3.get(); + const Point* rhs_lower = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p2.get() : rhs._p3.get(); if (dereference_check_less(lhs_lower,rhs_lower)) return true; if (dereference_check_less(rhs_lower,lhs_lower)) return false; - const Point* lhs_upper = dereference_check_less(_p2,_p3) ? _p3.get() : _p2.get(); - const Point* rhs_upper = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p3.get() : rhs._p2.get(); + const Point* lhs_upper = dereference_check_less(_p2,_p3) ? _p3.get() : _p2.get(); + const Point* rhs_upper = dereference_check_less(rhs._p2,rhs._p3) ? rhs._p3.get() : rhs._p2.get(); return dereference_check_less(lhs_upper,rhs_upper); } @@ -461,29 +461,29 @@ public: _p2 = points[(lowest+1)%3]; _p3 = points[(lowest+2)%3]; } - + void update() { _plane.set(_p1->_vertex,_p2->_vertex,_p3->_vertex); - + } - + osg::Plane computeNewPlaneOnEdgeCollapse(Edge* edge,Point* pNew) const { - const Point* p1 = (_p1==edge->_p1 || _p1==edge->_p2) ? pNew : _p1.get(); - const Point* p2 = (_p2==edge->_p1 || _p2==edge->_p2) ? pNew : _p2.get(); + const Point* p1 = (_p1==edge->_p1 || _p1==edge->_p2) ? pNew : _p1.get(); + const Point* p2 = (_p2==edge->_p1 || _p2==edge->_p2) ? pNew : _p2.get(); const Point* p3 = (_p3==edge->_p1 || _p3==edge->_p2) ? pNew : _p3.get(); - + return osg::Plane(p1->_vertex,p2->_vertex,p3->_vertex); } - + // note return 1 - dotproduct, so that deviation is in the range of 0.0 to 2.0, where 0 is coincident, 1.0 is 90 degrees, and 2.0 is 180 degrees. error_type computeNormalDeviationOnEdgeCollapse(Edge* edge,Point* pNew) const { - const Point* p1 = (_p1==edge->_p1 || _p1==edge->_p2) ? pNew : _p1.get(); - const Point* p2 = (_p2==edge->_p1 || _p2==edge->_p2) ? pNew : _p2.get(); + const Point* p1 = (_p1==edge->_p1 || _p1==edge->_p2) ? pNew : _p1.get(); + const Point* p2 = (_p2==edge->_p1 || _p2==edge->_p2) ? pNew : _p2.get(); const Point* p3 = (_p3==edge->_p1 || _p3==edge->_p2) ? pNew : _p3.get(); - + osg::Vec3 new_normal = (p2->_vertex - p1->_vertex) ^ (p3->_vertex - p2->_vertex); new_normal.normalize(); @@ -498,21 +498,21 @@ public: error_type(_plane[2])*error_type(vertex.z())+ error_type(_plane[3]); } - + bool isBoundaryTriangle() const { return (_e1->isBoundaryEdge() || _e2->isBoundaryEdge() || _e3->isBoundaryEdge()); } - + osg::ref_ptr _p1; osg::ref_ptr _p2; osg::ref_ptr _p3; - + osg::ref_ptr _e1; osg::ref_ptr _e2; osg::ref_ptr _e3; - + osg::Plane _plane; }; @@ -524,14 +524,14 @@ public: // detect if triangle is degenerate. if (p1==p2 || p2==p3 || p1==p3) return 0; - + Triangle* triangle = new Triangle; Point* points[3]; points[0] = addPoint(triangle, p1); points[1] = addPoint(triangle, p2); points[2] = addPoint(triangle, p3); - + // find the lowest value point in the list. unsigned int lowest = 0; if (dereference_check_less(points[1],points[lowest])) lowest = 1; @@ -544,34 +544,34 @@ public: triangle->_e1 = addEdge(triangle, triangle->_p1.get(), triangle->_p2.get()); triangle->_e2 = addEdge(triangle, triangle->_p2.get(), triangle->_p3.get()); triangle->_e3 = addEdge(triangle, triangle->_p3.get(), triangle->_p1.get()); - + triangle->update(); _triangleSet.insert(triangle); - + return triangle; } - + Triangle* addTriangle(Point* p1, Point* p2, Point* p3) { // OSG_NOTICE<<" addTriangle("<_e1 = addEdge(triangle, triangle->_p1.get(), triangle->_p2.get()); triangle->_e2 = addEdge(triangle, triangle->_p2.get(), triangle->_p3.get()); triangle->_e3 = addEdge(triangle, triangle->_p3.get(), triangle->_p1.get()); - + triangle->update(); _triangleSet.insert(triangle); @@ -595,7 +595,7 @@ public: if (triangle->_p1.valid()) removePoint(triangle,triangle->_p1.get()); if (triangle->_p2.valid()) removePoint(triangle,triangle->_p2.get()); if (triangle->_p3.valid()) removePoint(triangle,triangle->_p3.get()); - + if (triangle->_e1.valid()) removeEdge(triangle,triangle->_e1.get()); if (triangle->_e2.valid()) removeEdge(triangle,triangle->_e2.get()); if (triangle->_e3.valid()) removeEdge(triangle,triangle->_e3.get()); @@ -611,21 +611,21 @@ public: if (triangle->_p1==pOriginal) triangle->_p1=pNew; if (triangle->_p2==pOriginal) triangle->_p2=pNew; if (triangle->_p3==pOriginal) triangle->_p3=pNew; - + // fixes the edges so they point to use the new point triangle->_e1 = replaceEdgePoint(triangle->_e1.get(),pOriginal,pNew); triangle->_e2 = replaceEdgePoint(triangle->_e2.get(),pOriginal,pNew); triangle->_e3 = replaceEdgePoint(triangle->_e3.get(),pOriginal,pNew); - + // remove the triangle form the original point, and possibly the point if its the last triangle to use it removePoint(triangle, pOriginal); - + // add the triangle to that point addPoint(triangle,pNew); } - + } - + unsigned int testTriangle(Triangle* triangle) { unsigned int result = 0; @@ -634,7 +634,7 @@ public: OSG_NOTICE<<"testTriangle("<_p1->_triangles.count(triangle)==0) + else if (triangle->_p1->_triangles.count(triangle)==0) { OSG_NOTICE<<"testTriangle("<_triangles does not contain triangle"<_p2->_triangles.count(triangle)==0) + else if (triangle->_p2->_triangles.count(triangle)==0) { OSG_NOTICE<<"testTriangle("<_triangles does not contain triangle"<_p3->_triangles.count(triangle)==0) + else if (triangle->_p3->_triangles.count(triangle)==0) { OSG_NOTICE<<"testTriangle("<_triangles does not contain triangle"<_e1.get())) { ++result; OSG_NOTICE<<"testTriangle("<_e2.get())) { ++result; @@ -709,9 +709,9 @@ public: edge->_p1 = p2; edge->_p2 = p1; } - + edge->setErrorMetric( computeErrorMetric( edge.get(), edge->_proposedPoint.get())); - + EdgeSet::iterator itr = _edgeSet.find(edge); if (itr==_edgeSet.end()) { @@ -723,9 +723,9 @@ public: // OSG_NOTICE<<" reuseEdge("<_p1="<_p1.get()<<" _p2="<_p2.get()<addTriangle(triangle); - + return edge.get(); } @@ -754,10 +754,10 @@ public: if (itr!=_edgeSet.end()) { // remove the edge from the list, as its positoin in the list - // may need to change once its values have been ammended + // may need to change once its values have been ammended _edgeSet.erase(itr); } - + // modify its values if (edge->_p1==pOriginal) edge->_p1=pNew; if (edge->_p2==pOriginal) edge->_p2=pNew; @@ -784,7 +784,7 @@ public: { return edge; } - + } @@ -811,13 +811,13 @@ public: osg::ref_ptr keep_point_locally_referenced_to_prevent_premature_deletion = pNew; osg::ref_ptr edge_p1 = edge->_p1; osg::ref_ptr edge_p2 = edge->_p2; - + TriangleMap triangleMap; TriangleList triangles_p1; TriangleList triangles_p2; LocalEdgeList oldEdges; - - + + if (edge_p1 != pNew) { for(TriangleSet::iterator itr=edge_p1->_triangles.begin(); @@ -833,10 +833,10 @@ public: oldEdges.insert(triangle->_e3); } } - + //triangles_p1 = edge_p1->_triangles; } - + if (edge_p2 != pNew) { for(TriangleSet::iterator itr=edge_p2->_triangles.begin(); @@ -860,14 +860,14 @@ public: ++oeitr) { _edgeSet.erase(*oeitr); - + const_cast(oeitr->get())->setErrorMetric(0.0f); - + _edgeSet.insert(*oeitr); } TriangleList::iterator titr_p1, titr_p2; - + for(titr_p1 = triangles_p1.begin(); titr_p1 != triangles_p1.end(); ++titr_p1) @@ -883,7 +883,7 @@ public: } //OSG_NOTICE<<" pNew="<_triangles; for(TriangleSet::iterator teitr=trianglesToRemove.begin(); @@ -896,7 +896,7 @@ public: LocalEdgeList newEdges; - + for(titr_p1 = triangles_p1.begin(); titr_p1 != triangles_p1.end(); ++titr_p1) @@ -997,9 +997,9 @@ public: // unsigned int numEdges1 = _edgeSet.size(); typedef std::set< osg::ref_ptr > LocalEdgeList; - LocalEdgeList edges2UpdateErrorMetric; + LocalEdgeList edges2UpdateErrorMetric; TriangleSet::iterator titr; - + // for each deleted triangle insert two new triangles for(titr = triangles.begin(); @@ -1023,7 +1023,7 @@ public: if (edge->_p2 == tri->_p1.get()) edgeToReplace = 3; // edge p3,p1 else if (edge->_p2 == tri->_p2.get()) edgeToReplace = 2; // edge p2, p3 } - + Triangle* newTri1 = 0; Triangle* newTri2 = 0; switch(edgeToReplace) @@ -1053,7 +1053,7 @@ public: newTri2 = addTriangle(pNew, tri->_p2.get(), tri->_p3.get()); break; } - + if (newTri1) { edges2UpdateErrorMetric.insert(newTri1->_e1.get()); @@ -1067,7 +1067,7 @@ public: edges2UpdateErrorMetric.insert(newTri2->_e3.get()); } } - + // unsigned int numTriangles2 = _triangleSet.size(); // unsigned int numEdges2 = _edgeSet.size(); // unsigned int numBoundaryEdges2 = computeNumBoundaryEdges(); @@ -1117,7 +1117,7 @@ public: ++numErrors; } } - + if (edge->_triangles.empty()) { OSG_NOTICE<<"testEdge("<_triangles.insert(triangle); - + return point; } @@ -1182,20 +1182,20 @@ public: if (itr!=_pointSet.end()) { point->_triangles.erase(triangle); - + if (point->_triangles.empty()) { // point no longer in use, so need to delete. _pointSet.erase(itr); } } - + } - + unsigned int testPoint(Point* point) { unsigned int numErrors = 0; - + for(TriangleSet::iterator itr=point->_triangles.begin(); itr!=point->_triangles.end(); ++itr) @@ -1210,10 +1210,10 @@ public: ++numErrors; } } - + return numErrors; } - + unsigned int testAllPoints() { unsigned int numErrors = 0; @@ -1225,19 +1225,19 @@ public: } return numErrors; } - + //protected: typedef std::vector< osg::ref_ptr > ArrayList; osg::Geometry* _geometry; - + bool _computeErrorMetricUsingLength; EdgeSet _edgeSet; TriangleSet _triangleSet; PointSet _pointSet; PointList _originalPointList; - + }; struct CollectTriangleOperator @@ -1246,8 +1246,8 @@ struct CollectTriangleOperator CollectTriangleOperator():_ec(0) {} void setEdgeCollapse(EdgeCollapse* ec) { _ec = ec; } - - EdgeCollapse* _ec; + + EdgeCollapse* _ec; // for use in the triangle functor. inline void operator()(unsigned int p1, unsigned int p2, unsigned int p3) @@ -1274,16 +1274,16 @@ class CopyArrayToPointsVisitor : public osg::ArrayVisitor public: CopyArrayToPointsVisitor(EdgeCollapse::PointList& pointList): _pointList(pointList) {} - + template void copy(T& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) - _pointList[i]->_attributes.push_back((float)array[i]); + + for(unsigned int i=0;i<_pointList.size();++i) + _pointList[i]->_attributes.push_back((float)array[i]); } - + virtual void apply(osg::Array&) {} virtual void apply(osg::ByteArray& array) { copy(array); } virtual void apply(osg::ShortArray& array) { copy(array); } @@ -1296,65 +1296,65 @@ class CopyArrayToPointsVisitor : public osg::ArrayVisitor virtual void apply(osg::Vec4ubArray& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { osg::Vec4ub& value = array[i]; EdgeCollapse::FloatList& attributes = _pointList[i]->_attributes; - attributes.push_back((float)value.r()); - attributes.push_back((float)value.g()); - attributes.push_back((float)value.b()); - attributes.push_back((float)value.a()); + attributes.push_back((float)value.r()); + attributes.push_back((float)value.g()); + attributes.push_back((float)value.b()); + attributes.push_back((float)value.a()); } } virtual void apply(osg::Vec2Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { osg::Vec2& value = array[i]; EdgeCollapse::FloatList& attributes = _pointList[i]->_attributes; - attributes.push_back(value.x()); - attributes.push_back(value.y()); + attributes.push_back(value.x()); + attributes.push_back(value.y()); } } virtual void apply(osg::Vec3Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { osg::Vec3& value = array[i]; EdgeCollapse::FloatList& attributes = _pointList[i]->_attributes; - attributes.push_back(value.x()); - attributes.push_back(value.y()); - attributes.push_back(value.z()); + attributes.push_back(value.x()); + attributes.push_back(value.y()); + attributes.push_back(value.z()); } } - + virtual void apply(osg::Vec4Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { osg::Vec4& value = array[i]; EdgeCollapse::FloatList& attributes = _pointList[i]->_attributes; - attributes.push_back(value.x()); - attributes.push_back(value.y()); - attributes.push_back(value.z()); - attributes.push_back(value.w()); + attributes.push_back(value.x()); + attributes.push_back(value.y()); + attributes.push_back(value.z()); + attributes.push_back(value.w()); } } - + EdgeCollapse::PointList& _pointList; - - + + protected: - + CopyArrayToPointsVisitor& operator = (const CopyArrayToPointsVisitor&) { return *this; } }; @@ -1363,54 +1363,54 @@ class CopyVertexArrayToPointsVisitor : public osg::ArrayVisitor public: CopyVertexArrayToPointsVisitor(EdgeCollapse::PointList& pointList): _pointList(pointList) {} - + virtual void apply(osg::Vec2Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollapse::Point; _pointList[i]->_index = i; - + osg::Vec2& value = array[i]; osg::Vec3& vertex = _pointList[i]->_vertex; - vertex.set(value.x(),value.y(),0.0f); + vertex.set(value.x(),value.y(),0.0f); } } virtual void apply(osg::Vec3Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollapse::Point; _pointList[i]->_index = i; - + _pointList[i]->_vertex = array[i]; } } - + virtual void apply(osg::Vec4Array& array) { if (_pointList.size()!=array.size()) return; - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollapse::Point; _pointList[i]->_index = i; - + osg::Vec4& value = array[i]; osg::Vec3& vertex = _pointList[i]->_vertex; - vertex.set(value.x()/value.w(),value.y()/value.w(),value.z()/value.w()); + vertex.set(value.x()/value.w(),value.y()/value.w(),value.z()/value.w()); } } - + EdgeCollapse::PointList& _pointList; protected: - + CopyVertexArrayToPointsVisitor& operator = (const CopyVertexArrayToPointsVisitor&) { return *this; } }; @@ -1418,7 +1418,7 @@ class CopyVertexArrayToPointsVisitor : public osg::ArrayVisitor void EdgeCollapse::setGeometry(osg::Geometry* geometry, const Simplifier::IndexList& protectedPoints) { _geometry = geometry; - + // check to see if vertex attributes indices exists, if so expand them to remove them if (_geometry->suitableForOptimization()) { @@ -1426,7 +1426,7 @@ void EdgeCollapse::setGeometry(osg::Geometry* geometry, const Simplifier::IndexL OSG_INFO<<"EdgeCollapse::setGeometry(..): Removing attribute indices"<copyToAndOptimize(*_geometry); } - + // check to see if vertex attributes indices exists, if so expand them to remove them if (_geometry->containsSharedArrays()) { @@ -1436,13 +1436,13 @@ void EdgeCollapse::setGeometry(osg::Geometry* geometry, const Simplifier::IndexL } unsigned int numVertices = geometry->getVertexArray()->getNumElements(); - + _originalPointList.resize(numVertices); - + // copy vertices across to local point list CopyVertexArrayToPointsVisitor copyVertexArrayToPoints(_originalPointList); _geometry->getVertexArray()->accept(copyVertexArrayToPoints); - + // copy other per vertex attributes across to local point list. CopyArrayToPointsVisitor copyArrayToPoints(_originalPointList); @@ -1454,10 +1454,10 @@ void EdgeCollapse::setGeometry(osg::Geometry* geometry, const Simplifier::IndexL if (_geometry->getNormalArray() && _geometry->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX) geometry->getNormalArray()->accept(copyArrayToPoints); - + if (_geometry->getColorArray() && _geometry->getColorBinding()==osg::Geometry::BIND_PER_VERTEX) geometry->getColorArray()->accept(copyArrayToPoints); - + if (_geometry->getSecondaryColorArray() && _geometry->getSecondaryColorBinding()==osg::Geometry::BIND_PER_VERTEX) geometry->getSecondaryColorArray()->accept(copyArrayToPoints); @@ -1481,11 +1481,11 @@ void EdgeCollapse::setGeometry(osg::Geometry* geometry, const Simplifier::IndexL CollectTriangleIndexFunctor collectTriangles; collectTriangles.setEdgeCollapse(this); - + _geometry->accept(collectTriangles); - + } - + class CopyPointsToArrayVisitor : public osg::ArrayVisitor @@ -1500,24 +1500,24 @@ class CopyPointsToArrayVisitor : public osg::ArrayVisitor void copy(T& array, R /*dummy*/) { array.resize(_pointList.size()); - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { - if (_index<_pointList[i]->_attributes.size()) + if (_index<_pointList[i]->_attributes.size()) { float val = (_pointList[i]->_attributes[_index]); array[i] = R (val); } } - + ++_index; } - + // use local typedefs if usinged char,short and int to get round gcc 3.3.1 problem with defining unsigned short() typedef unsigned char dummy_uchar; typedef unsigned short dummy_ushort; typedef unsigned int dummy_uint; - + virtual void apply(osg::Array&) {} virtual void apply(osg::ByteArray& array) { copy(array, char());} virtual void apply(osg::ShortArray& array) { copy(array, short()); } @@ -1530,8 +1530,8 @@ class CopyPointsToArrayVisitor : public osg::ArrayVisitor virtual void apply(osg::Vec4ubArray& array) { array.resize(_pointList.size()); - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { EdgeCollapse::FloatList& attributes = _pointList[i]->_attributes; array[i].set((unsigned char)attributes[_index], @@ -1545,8 +1545,8 @@ class CopyPointsToArrayVisitor : public osg::ArrayVisitor virtual void apply(osg::Vec2Array& array) { array.resize(_pointList.size()); - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { EdgeCollapse::FloatList& attributes = _pointList[i]->_attributes; if (_index+1_attributes; if (_index+2_attributes; if (_index+3 void normalize(Itr begin, Itr end) { @@ -1601,11 +1601,11 @@ class NormalizeArrayVisitor : public osg::ArrayVisitor itr->normalize(); } } - + virtual void apply(osg::Vec2Array& array) { normalize(array.begin(),array.end()); } virtual void apply(osg::Vec3Array& array) { normalize(array.begin(),array.end()); } virtual void apply(osg::Vec4Array& array) { normalize(array.begin(),array.end()); } - + }; class CopyPointsToVertexArrayVisitor : public osg::ArrayVisitor @@ -1613,12 +1613,12 @@ class CopyPointsToVertexArrayVisitor : public osg::ArrayVisitor public: CopyPointsToVertexArrayVisitor(EdgeCollapse::PointList& pointList): _pointList(pointList) {} - + virtual void apply(osg::Vec2Array& array) { array.resize(_pointList.size()); - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i]->_index = i; osg::Vec3& vertex = _pointList[i]->_vertex; @@ -1629,30 +1629,30 @@ class CopyPointsToVertexArrayVisitor : public osg::ArrayVisitor virtual void apply(osg::Vec3Array& array) { array.resize(_pointList.size()); - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i]->_index = i; array[i] = _pointList[i]->_vertex; } } - + virtual void apply(osg::Vec4Array& array) { array.resize(_pointList.size()); - - for(unsigned int i=0;i<_pointList.size();++i) + + for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i]->_index = i; osg::Vec3& vertex = _pointList[i]->_vertex; array[i].set(vertex.x(),vertex.y(),vertex.z(),1.0f); } } - + EdgeCollapse::PointList& _pointList; - + protected: - + CopyPointsToVertexArrayVisitor& operator = (const CopyPointsToVertexArrayVisitor&) { return *this; } }; @@ -1667,7 +1667,7 @@ void EdgeCollapse::copyBackToGeometry() // copy vertices across to local point list CopyPointsToVertexArrayVisitor copyVertexArrayToPoints(_originalPointList); _geometry->getVertexArray()->accept(copyVertexArrayToPoints); - + // copy other per vertex attributes across to local point list. CopyPointsToArrayVisitor copyArrayToPoints(_originalPointList); @@ -1685,10 +1685,10 @@ void EdgeCollapse::copyBackToGeometry() NormalizeArrayVisitor nav; _geometry->getNormalArray()->accept(nav); } - + if (_geometry->getColorArray() && _geometry->getColorBinding()==osg::Geometry::BIND_PER_VERTEX) _geometry->getColorArray()->accept(copyArrayToPoints); - + if (_geometry->getSecondaryColorArray() && _geometry->getSecondaryColorBinding()==osg::Geometry::BIND_PER_VERTEX) _geometry->getSecondaryColorArray()->accept(copyArrayToPoints); @@ -1721,7 +1721,7 @@ void EdgeCollapse::copyBackToGeometry() (*primitives)[pos++] = triangle->_p2->_index; (*primitives)[pos++] = triangle->_p3->_index; } - + _geometry->getPrimitiveSetList().clear(); _geometry->addPrimitiveSet(primitives); @@ -1735,7 +1735,7 @@ Simplifier::Simplifier(double sampleRatio, double maximumError, double maximumLe _maximumLength(maximumLength), _triStrip(true), _smoothing(true) - + { } @@ -1758,11 +1758,11 @@ void Simplifier::simplify(osg::Geometry& geometry, const IndexList& protectedPoi ec.updateErrorMetricForAllEdges(); unsigned int numOriginalPrimitives = ec._triangleSet.size(); - + if (getSampleRatio()<1.0) { while (!ec._edgeSet.empty() && - continueSimplification((*ec._edgeSet.begin())->getErrorMetric() , numOriginalPrimitives, ec._triangleSet.size()) && + continueSimplification((*ec._edgeSet.begin())->getErrorMetric() , numOriginalPrimitives, ec._triangleSet.size()) && ec.collapseMinimumErrorEdge()) { //OSG_INFO<<" Collapsed edge ec._triangleSet.size()="<getErrorMetric() , numOriginalPrimitives, ec._triangleSet.size()) && + continueSimplification((*ec._edgeSet.rbegin())->getErrorMetric() , numOriginalPrimitives, ec._triangleSet.size()) && // ec._triangleSet.size() < targetNumTriangles && ec.divideLongestEdge()) { @@ -1798,14 +1798,14 @@ void Simplifier::simplify(osg::Geometry& geometry, const IndexList& protectedPoi OSG_INFO<< " !ec._edgeSet.empty() = "<getErrorMetric() , numOriginalPrimitives, ec._triangleSet.size())< @@ -48,7 +48,7 @@ struct SmoothTriangleFunctor SmoothTriangleFunctor(): _coordBase(0), _normalBase(0) {} - + void set(osg::Vec3 *cb,int noVertices, osg::Vec3 *nb) { _coordBase=cb; diff --git a/src/osgUtil/StateGraph.cpp b/src/osgUtil/StateGraph.cpp index e52d9db43..ccad89e57 100644 --- a/src/osgUtil/StateGraph.cpp +++ b/src/osgUtil/StateGraph.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osgUtil/TangentSpaceGenerator.cpp b/src/osgUtil/TangentSpaceGenerator.cpp index f99ea0e7d..15bb3eaaa 100644 --- a/src/osgUtil/TangentSpaceGenerator.cpp +++ b/src/osgUtil/TangentSpaceGenerator.cpp @@ -95,7 +95,7 @@ void TangentSpaceGenerator::generate(osg::Geometry *geo, int normal_map_tex_unit } else { for (i=0; i= 0) { vN = osg::Vec4(txN, 0); } else { @@ -275,7 +275,7 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, if(nx){ osg::Vec3 V, T1, T2, T3, B1, B2, B3; - V = osg::Vec3(P2.x() - P1.x(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ + V = osg::Vec3(P2.x() - P1.x(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ osg::Vec3(P3.x() - P1.x(), uv3.x() - uv1.x(), uv3.y() - uv1.y()); if (V.x() != 0) { V.normalize(); @@ -284,10 +284,10 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, T2.x() += -V.y() / V.x(); B2.x() += -V.z() / V.x(); T3.x() += -V.y() / V.x(); - B3.x() += -V.z() / V.x(); + B3.x() += -V.z() / V.x(); } - V = osg::Vec3(P2.y() - P1.y(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ + V = osg::Vec3(P2.y() - P1.y(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ osg::Vec3(P3.y() - P1.y(), uv3.x() - uv1.x(), uv3.y() - uv1.y()); if (V.x() != 0) { V.normalize(); @@ -296,10 +296,10 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, T2.y() += -V.y() / V.x(); B2.y() += -V.z() / V.x(); T3.y() += -V.y() / V.x(); - B3.y() += -V.z() / V.x(); + B3.y() += -V.z() / V.x(); } - V = osg::Vec3(P2.z() - P1.z(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ + V = osg::Vec3(P2.z() - P1.z(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ osg::Vec3(P3.z() - P1.z(), uv3.x() - uv1.x(), uv3.y() - uv1.y()); if (V.x() != 0) { V.normalize(); @@ -308,7 +308,7 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, T2.z() += -V.y() / V.x(); B2.z() += -V.z() / V.x(); T3.z() += -V.y() / V.x(); - B3.z() += -V.z() / V.x(); + B3.z() += -V.z() / V.x(); } osg::Vec3 tempvec; @@ -334,7 +334,7 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, osg::Vec3 V; - V = osg::Vec3(P2.x() - P1.x(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ + V = osg::Vec3(P2.x() - P1.x(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ osg::Vec3(P3.x() - P1.x(), uv3.x() - uv1.x(), uv3.y() - uv1.y()); if (V.x() != 0) { V.normalize(); @@ -343,10 +343,10 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, (*T_)[iB].x() += -V.y() / V.x(); (*B_)[iB].x() += -V.z() / V.x(); (*T_)[iC].x() += -V.y() / V.x(); - (*B_)[iC].x() += -V.z() / V.x(); + (*B_)[iC].x() += -V.z() / V.x(); } - V = osg::Vec3(P2.y() - P1.y(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ + V = osg::Vec3(P2.y() - P1.y(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ osg::Vec3(P3.y() - P1.y(), uv3.x() - uv1.x(), uv3.y() - uv1.y()); if (V.x() != 0) { V.normalize(); @@ -355,10 +355,10 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, (*T_)[iB].y() += -V.y() / V.x(); (*B_)[iB].y() += -V.z() / V.x(); (*T_)[iC].y() += -V.y() / V.x(); - (*B_)[iC].y() += -V.z() / V.x(); + (*B_)[iC].y() += -V.z() / V.x(); } - V = osg::Vec3(P2.z() - P1.z(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ + V = osg::Vec3(P2.z() - P1.z(), uv2.x() - uv1.x(), uv2.y() - uv1.y()) ^ osg::Vec3(P3.z() - P1.z(), uv3.x() - uv1.x(), uv3.y() - uv1.y()); if (V.x() != 0) { V.normalize(); @@ -367,7 +367,7 @@ void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset, (*T_)[iB].z() += -V.y() / V.x(); (*B_)[iB].z() += -V.z() / V.x(); (*T_)[iC].z() += -V.y() / V.x(); - (*B_)[iC].z() += -V.z() / V.x(); + (*B_)[iC].z() += -V.z() / V.x(); } (*N_)[iA] += osg::Vec4(face_normal, 0); diff --git a/src/osgUtil/Tessellator.cpp b/src/osgUtil/Tessellator.cpp index e6bf0081e..6c47555f6 100644 --- a/src/osgUtil/Tessellator.cpp +++ b/src/osgUtil/Tessellator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -24,7 +24,7 @@ using namespace osgUtil; Tessellator::Tessellator() : _wtype(TESS_WINDING_ODD), _ttype(TESS_TYPE_POLYGONS), - _boundaryOnly(false), _numberVerts(0) + _boundaryOnly(false), _numberVerts(0) { _tobj = gluNewTess(); if (_tobj) @@ -56,13 +56,13 @@ void Tessellator::beginTessellation() { gluTessProperty(_tobj, GLU_TESS_WINDING_RULE, _wtype); gluTessProperty(_tobj, GLU_TESS_BOUNDARY_ONLY, _boundaryOnly); - + if (tessNormal.length()>0.0) gluTessNormal(_tobj, tessNormal.x(), tessNormal.y(), tessNormal.z()); gluTessBeginPolygon(_tobj,this); } -} - +} + void Tessellator::beginContour() { if (_tobj) @@ -70,7 +70,7 @@ void Tessellator::beginContour() gluTessBeginContour(_tobj); } } - + void Tessellator::addVertex(osg::Vec3* vertex) { if (_tobj) @@ -104,7 +104,7 @@ void Tessellator::endTessellation() if (_tobj) { gluTessEndPolygon(_tobj); - + if (_errorCode!=0) { const GLubyte *estring = gluErrorString((GLenum)_errorCode); @@ -119,7 +119,7 @@ void Tessellator::reset() { delete (*i); } - + // We need to also free the vertex list as well otherwise we are leaking... for (NewVertexList::iterator j = _newVertexList.begin(); j != _newVertexList.end(); ++j) { @@ -138,7 +138,7 @@ void Tessellator::reset() class InsertNewVertices : public osg::ArrayVisitor { public: - + float _f1,_f2,_f3,_f4; unsigned int _i1,_i2,_i3,_i4; @@ -157,7 +157,7 @@ class InsertNewVertices : public osg::ArrayVisitor if (_f2) val += static_cast(array[_i2] * _f2); if (_f3) val += static_cast(array[_i3] * _f3); if (_f4) val += static_cast(array[_i4] * _f4); - + array.push_back(val); } @@ -179,7 +179,7 @@ void Tessellator::retessellatePolygons(osg::Geometry &geom) { // turn the contour list into primitives, a little like Tessellator does but more generally osg::Vec3Array* vertices = dynamic_cast(geom.getVertexArray()); - + if (!vertices || vertices->empty() || geom.getPrimitiveSetList().empty()) return; @@ -189,7 +189,7 @@ void Tessellator::retessellatePolygons(osg::Geometry &geom) geom.getColorIndices() || geom.getSecondaryColorIndices() || geom.getFogCoordIndices()) return; - + // not even text coord indices don't handle geometry which use indices... for(unsigned int unit=0;unitgetType()==osg::PrimitiveSet::DrawArrayLengthsPrimitiveType) { osg::DrawArrayLengths* drawArrayLengths = static_cast(primitive.get()); - unsigned int first = drawArrayLengths->getFirst(); + unsigned int first = drawArrayLengths->getFirst(); for(osg::DrawArrayLengths::iterator itr=drawArrayLengths->begin(); itr!=drawArrayLengths->end(); ++itr) @@ -290,8 +290,8 @@ void Tessellator::retessellatePolygons(osg::Geometry &geom) } if (_ttype==TESS_TYPE_GEOMETRY) { endTessellation(); - - collectTessellation(geom, 0); + + collectTessellation(geom, 0); } } @@ -371,13 +371,13 @@ void Tessellator::addContour(osg::PrimitiveSet* primitive, osg::Vec3Array* verti if (primitive->getMode()==osg::PrimitiveSet::QUADS) nperprim=4; if (primitive->getMode()==osg::PrimitiveSet::TRIANGLES) nperprim=3; unsigned int idx=0; - + switch(primitive->getType()) { case(osg::PrimitiveSet::DrawArraysPrimitiveType): { osg::DrawArrays* drawArray = static_cast(primitive); - unsigned int first = drawArray->getFirst(); + unsigned int first = drawArray->getFirst(); unsigned int last = first+drawArray->getCount(); addContour(primitive->getMode(),first,last,vertices); break; @@ -437,50 +437,50 @@ void Tessellator::addContour(osg::PrimitiveSet* primitive, osg::Vec3Array* verti OSG_NOTICE<<"Tessellator::addContour(primitive, vertices) : Primitive type "<getType()<<" not handled"<(geom.getVertexArray()); osg::Vec3Array* normals = NULL; if (geom.getNormalBinding()==osg::Geometry::BIND_PER_VERTEX) { normals = dynamic_cast(geom.getNormalArray()); } - + typedef std::vector ArrayList; ArrayList arrays; - + if (geom.getColorBinding()==osg::Geometry::BIND_PER_VERTEX) { arrays.push_back(geom.getColorArray()); } - + if (geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_VERTEX) { arrays.push_back(geom.getSecondaryColorArray()); } - + if (geom.getFogCoordBinding()==osg::Geometry::BIND_PER_VERTEX) { arrays.push_back(geom.getFogCoordArray()); } - + osg::Geometry::ArrayDataList& tcal = geom.getTexCoordArrayList(); for(osg::Geometry::ArrayDataList::iterator tcalItr=tcal.begin(); tcalItr!=tcal.end(); ++tcalItr) { - if (tcalItr->array.valid()) + if (tcalItr->array.valid()) { arrays.push_back(tcalItr->array.get()); } } - + // now add any new vertices that are required. for(NewVertexList::iterator itr=_newVertexList.begin(); itr!=_newVertexList.end(); @@ -488,11 +488,11 @@ void Tessellator::handleNewVertices(osg::Geometry& geom,VertexPtrToIndexMap &ver { NewVertex& newVertex = (*itr); osg::Vec3* vertex = newVertex._vpos; - + // assign vertex. vertexPtrToIndexMap[vertex]=vertices->size(); vertices->push_back(*vertex); - + // assign normals if (normals) { @@ -504,14 +504,14 @@ void Tessellator::handleNewVertices(osg::Geometry& geom,VertexPtrToIndexMap &ver norm.normalize(); normals->push_back(norm); } - + if (!arrays.empty()) { InsertNewVertices inv(newVertex._f1,vertexPtrToIndexMap[newVertex._v1], newVertex._f2,vertexPtrToIndexMap[newVertex._v2], newVertex._f3,vertexPtrToIndexMap[newVertex._v3], newVertex._f4,vertexPtrToIndexMap[newVertex._v4]); - + // assign the rest of the attributes. for(ArrayList::iterator aItr=arrays.begin(); aItr!=arrays.end(); @@ -521,9 +521,9 @@ void Tessellator::handleNewVertices(osg::Geometry& geom,VertexPtrToIndexMap &ver } } } - + } - + } void Tessellator::begin(GLenum mode) @@ -614,8 +614,8 @@ void Tessellator::reduceArray(osg::Array * cold, const unsigned int nnu) (*v4arr).erase(itr, v4arr->end()); } break; - default: // should also handle:ArrayType' ByteArrayType' ShortArrayType' IntArrayType' - // `UShortArrayType' `UIntArrayType' `Vec4ubArrayType' `FloatArrayType' + default: // should also handle:ArrayType' ByteArrayType' ShortArrayType' IntArrayType' + // `UShortArrayType' `UIntArrayType' `Vec4ubArrayType' `FloatArrayType' break; } } @@ -625,15 +625,15 @@ void Tessellator::collectTessellation(osg::Geometry &geom, unsigned int original { osg::Vec3Array* vertices = dynamic_cast(geom.getVertexArray()); VertexPtrToIndexMap vertexPtrToIndexMap; - + // populate the VertexPtrToIndexMap. for(unsigned int vi=0;visize();++vi) { vertexPtrToIndexMap[&((*vertices)[vi])] = vi; } - + handleNewVertices(geom, vertexPtrToIndexMap); - + // we don't properly handle per primitive and per primitive_set bindings yet // will need to address this soon. Robert Oct 2002. { @@ -661,9 +661,9 @@ void Tessellator::collectTessellation(osg::Geometry &geom, unsigned int original default: break; } - + } - // GWM Dec 2003 - these holders need to go outside the loop to + // GWM Dec 2003 - these holders need to go outside the loop to // retain the flat shaded colour &/or normal for each tessellated polygon osg::Vec3 norm(0.0f,0.0f,0.0f); osg::Vec4 primCol4(0.0f,0.0f,0.0f,1.0f); @@ -719,7 +719,7 @@ void Tessellator::collectTessellation(osg::Geometry &geom, unsigned int original ntris=elements->getNumIndices()/3; } - if (primItr==_primList.begin()) + if (primItr==_primList.begin()) { // first primitive so collect primitive normal & colour. if (normals) { if (geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE) @@ -778,7 +778,7 @@ void Tessellator::collectTessellation(osg::Geometry &geom, unsigned int original } } } - // OSG_WARN<<"Add: "<< iprim << std::endl; + // OSG_WARN<<"Add: "<< iprim << std::endl; } iprim++; // GWM Sep 2002 count which normal we should use } diff --git a/src/osgUtil/TransformAttributeFunctor.cpp b/src/osgUtil/TransformAttributeFunctor.cpp index 4dd931a42..2d0ea3d89 100644 --- a/src/osgUtil/TransformAttributeFunctor.cpp +++ b/src/osgUtil/TransformAttributeFunctor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgUtil/TransformCallback.cpp b/src/osgUtil/TransformCallback.cpp index 3b14aa164..a92c2de2a 100644 --- a/src/osgUtil/TransformCallback.cpp +++ b/src/osgUtil/TransformCallback.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -21,10 +21,10 @@ TransformCallback::TransformCallback(const osg::Vec3& pivot,const osg::Vec3& axi _pivot = pivot; _axis = axis; _angular_velocity = angularVelocity; - + _previousTraversalNumber = osg::UNINITIALIZED_FRAME_NUMBER; _previousTime = -1.0; - + _pause = false; } @@ -33,10 +33,10 @@ void TransformCallback::operator() (osg::Node* node, osg::NodeVisitor* nv) osg::MatrixTransform* transform = dynamic_cast(node); if (nv && transform) { - + const osg::FrameStamp* fs = nv->getFrameStamp(); if (!fs) return; // not frame stamp, no handle on the time so can't move. - + double newTime = fs->getSimulationTime(); // ensure that we do not operate on this node more than @@ -53,11 +53,11 @@ void TransformCallback::operator() (osg::Node* node, osg::NodeVisitor* nv) // update the specified transform transform->preMult(mat); - + _previousTraversalNumber = nv->getTraversalNumber(); } - _previousTime = newTime; + _previousTime = newTime; } diff --git a/src/osgUtil/TriStripVisitor.cpp b/src/osgUtil/TriStripVisitor.cpp index 870ae0632..9e502a002 100644 --- a/src/osgUtil/TriStripVisitor.cpp +++ b/src/osgUtil/TriStripVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include @@ -33,9 +33,9 @@ class WriteValue : public osg::ConstValueVisitor { public: WriteValue(std::ostream& o):_o(o) {} - + std::ostream& _o; - + virtual void apply(const GLbyte& v) { _o << v; } virtual void apply(const GLshort& v) { _o << v; } virtual void apply(const GLint& v) { _o << v; } @@ -49,7 +49,7 @@ class WriteValue : public osg::ConstValueVisitor virtual void apply(const Vec4& v) { _o << v; } protected: - + WriteValue& operator = (const WriteValue&) { return *this; } }; @@ -73,7 +73,7 @@ struct VertexAttribComparitor add(geometry.getVertexAttribArray(i),geometry.getVertexAttribBinding(i)); } } - + void add(osg::Array* array, osg::Geometry::AttributeBinding binding) { if (binding==osg::Geometry::BIND_PER_VERTEX && array) @@ -82,17 +82,17 @@ struct VertexAttribComparitor itr!=_arrayList.end(); ++itr) { - if ((*itr) == array) + if ((*itr) == array) return; } _arrayList.push_back(array); } } - + typedef std::vector ArrayList; - + ArrayList _arrayList; - + bool operator() (unsigned int lhs, unsigned int rhs) const { for(ArrayList::const_iterator itr=_arrayList.begin(); @@ -104,7 +104,7 @@ struct VertexAttribComparitor if (compare==1) return false; } return false; - } + } int compare(unsigned int lhs, unsigned int rhs) { @@ -116,9 +116,9 @@ struct VertexAttribComparitor if (compare==-1) return -1; if (compare==1) return 1; } -// +// // WriteValue wv(std::cout); -// +// // std::cout<<"Values equal"<=minimum_ratio_of_indices_to_unique_vertices) { @@ -408,7 +408,7 @@ void TriStripVisitor::stripify(Geometry& geom) // the largest indice is in_numVertices, but indices start at 0 // so increment to give to the corrent number of verticies. ++in_numVertices; - + // remap any shared vertex attributes RemapArray ra(copyMapping); arrayComparitor.accept(ra); @@ -434,7 +434,7 @@ void TriStripVisitor::stripify(Geometry& geom) typedef std::multimap QuadMap; QuadMap quadMap; - // pick out quads and place them in the quadMap, and also look for the max + // pick out quads and place them in the quadMap, and also look for the max for(pitr=outPrimitives.begin(); pitr!=outPrimitives.end(); ++pitr) @@ -454,7 +454,7 @@ void TriStripVisitor::stripify(Geometry& geom) IndexList indices; indices.reserve(4*quadMap.size()); - // adds all the quads into the quad primitive, in ascending order + // adds all the quads into the quad primitive, in ascending order // and the QuadMap stores the quad's in ascending order. for(QuadMap::iterator qitr=quadMap.begin(); qitr!=quadMap.end(); @@ -472,7 +472,7 @@ void TriStripVisitor::stripify(Geometry& geom) indices.push_back(pitr->Indices[(min_pos+1)%4]); indices.push_back(pitr->Indices[(min_pos+2)%4]); indices.push_back(pitr->Indices[(min_pos+3)%4]); - } + } bool inOrder = true; unsigned int previousValue = indices.front(); @@ -506,10 +506,10 @@ void TriStripVisitor::stripify(Geometry& geom) new_primitives.push_back(elements); } } - } - } + } + } - // handle non quad primitives + // handle non quad primitives for(pitr=outPrimitives.begin(); pitr!=outPrimitives.end(); ++pitr) @@ -553,8 +553,8 @@ void TriStripVisitor::stripify(Geometry& geom) geom.setPrimitiveSetList(new_primitives); - #if 0 - // debugging code for indentifying the tri-strips. + #if 0 + // debugging code for indentifying the tri-strips. osg::Vec4Array* colors = new osg::Vec4Array(new_primitives.size()); for(i=0;isize();++i) { @@ -565,7 +565,7 @@ void TriStripVisitor::stripify(Geometry& geom) } geom.setColorArray(colors); geom.setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET); - #endif + #endif } else { @@ -581,7 +581,7 @@ void TriStripVisitor::stripify() ++itr) { stripify(*(*itr)); - + // osgUtil::SmoothingVisitor sv; // sv.smooth(*(*itr)); } diff --git a/src/osgUtil/UpdateVisitor.cpp b/src/osgUtil/UpdateVisitor.cpp index 52062a9da..718777f5a 100644 --- a/src/osgUtil/UpdateVisitor.cpp +++ b/src/osgUtil/UpdateVisitor.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osgUtil/Version.cpp b/src/osgUtil/Version.cpp index fe13f25f0..d173b736d 100644 --- a/src/osgUtil/Version.cpp +++ b/src/osgUtil/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osgViewer/CompositeViewer.cpp b/src/osgViewer/CompositeViewer.cpp index 7707b296e..43e55b6fa 100644 --- a/src/osgViewer/CompositeViewer.cpp +++ b/src/osgViewer/CompositeViewer.cpp @@ -704,7 +704,7 @@ void CompositeViewer::eventTraversal() if (_views.empty()) return; double cutOffTime = (_runFrameScheme==ON_DEMAND) ? DBL_MAX : _frameStamp->getReferenceTime(); - + double beginEventTraversal = osg::Timer::instance()->delta_s(_startTick, osg::Timer::instance()->tick()); // OSG_NOTICE<<"CompositeViewer::frameEventTraversal()."<handleMouseEvent(event)) result = noErr; break; - + case kEventClassKeyboard: if (w->handleKeyboardEvent(event)) result = noErr; break; - + case kEventClassWindow: { - + switch (GetEventKind(event)) { case kEventWindowBoundsChanging: // left the code for live-resizing, but it is not used, because of window-refreshing issues... GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &bounds ); - + w->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top); w->requestRedraw(); result = noErr; break; - + case kEventWindowBoundsChanged: InvalWindowRect(window, GetWindowPortBounds(window, &bounds)); GetWindowBounds(window, kWindowContentRgn, &bounds); w->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top); result = noErr; break; - + case kEventWindowClose: w->requestClose(); result = noErr; break; - - default: + + default: break; } } @@ -94,20 +94,20 @@ static pascal OSStatus GraphicsWindowEventHandler(EventHandlerCallRef nextHandle //std::cout << "unknown: " << GetEventClass(event) << std::endl; break; } - + //if (result == eventNotHandledErr) // result = CallNextEventHandler (nextHandler, event); - + return result; } static bool s_quit_requested = false; -// Application eventhandler -- listens for a quit-event +// Application eventhandler -- listens for a quit-event static pascal OSStatus ApplicationEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { - + HICommand commandStruct; OSErr err = eventNotHandledErr; @@ -119,9 +119,9 @@ static pascal OSStatus ApplicationEventHandler(EventHandlerCallRef inHandlerCall s_quit_requested = true; err = noErr; break; - + } - + return err; } @@ -157,7 +157,7 @@ class CarbonKeyboardMap { _keymap[48 ] = osgGA::GUIEventAdapter::KEY_Tab; _keymap[49 ] = osgGA::GUIEventAdapter::KEY_Space; _keymap[117 ] = osgGA::GUIEventAdapter::KEY_Delete; - + _keymap[122 ] = osgGA::GUIEventAdapter::KEY_F1; _keymap[120 ] = osgGA::GUIEventAdapter::KEY_F2; _keymap[99 ] = osgGA::GUIEventAdapter::KEY_F3; @@ -170,7 +170,7 @@ class CarbonKeyboardMap { _keymap[109 ] = osgGA::GUIEventAdapter::KEY_F10; _keymap[103 ] = osgGA::GUIEventAdapter::KEY_F11; _keymap[111 ] = osgGA::GUIEventAdapter::KEY_F12; - + _keymap[75 ] = osgGA::GUIEventAdapter::KEY_KP_Divide; _keymap[67 ] = osgGA::GUIEventAdapter::KEY_KP_Multiply; _keymap[78 ] = osgGA::GUIEventAdapter::KEY_KP_Subtract; @@ -188,10 +188,10 @@ class CarbonKeyboardMap { _keymap[65 ] = osgGA::GUIEventAdapter::KEY_KP_Delete; } - + ~CarbonKeyboardMap() { } - + unsigned int remapKey(unsigned int key, unsigned int rawkey) { KeyMap::iterator itr = _keymap.find(rawkey); @@ -215,7 +215,7 @@ class CarbonWindowAdapter : public MenubarController::WindowAdapter { public: CarbonWindowAdapter(GraphicsWindowCarbon* win) : MenubarController::WindowAdapter(), _win(win) {} virtual bool valid() {return (_win.valid() && _win->valid()); } - virtual void getWindowBounds(CGRect& rect) + virtual void getWindowBounds(CGRect& rect) { Rect windowBounds; OSErr error = GetWindowBounds(_win->getNativeWindowRef(), kWindowStructureRgn, &windowBounds); @@ -224,9 +224,9 @@ public: rect.size.width = windowBounds.right - windowBounds.left; rect.size.height = windowBounds.bottom - windowBounds.top; } - + osgViewer::GraphicsWindow* getWindow() { return _win.get(); } -private: +private: osg::observer_ptr _win; }; @@ -237,7 +237,7 @@ void GraphicsWindowCarbon::init() if (_initialized) return; // getEventQueue()->setCurrentEventState(osgGA::GUIEventAdapter::getAccumulatedEventState().get()); - + _lastModifierKeys = 0; _windowTitleHeight = 0; _closeRequested = false; @@ -271,7 +271,7 @@ bool GraphicsWindowCarbon::setWindowDecorationImplementation(bool flag) else { err = ChangeWindowAttributes(getNativeWindowRef(), kWindowNoTitleBarAttribute | kWindowNoShadowAttribute, kWindowStandardDocumentAttributes); - SetWindowBounds(getNativeWindowRef(), kWindowContentRgn, &bounds); + SetWindowBounds(getNativeWindowRef(), kWindowContentRgn, &bounds); } if (err != noErr) @@ -279,18 +279,18 @@ bool GraphicsWindowCarbon::setWindowDecorationImplementation(bool flag) OSG_WARN << "GraphicsWindowCarbon::setWindowDecoration failed with " << err << std::endl; return false; } - + // update titlebar-height Rect titleRect; GetWindowBounds(_window, kWindowTitleBarRgn, &titleRect); _windowTitleHeight = abs(titleRect.bottom - titleRect.top); - - // sth: I don't know why I have to reattach the context to the window here, If I don't do this I get blank areas, where the titlebar was. + + // sth: I don't know why I have to reattach the context to the window here, If I don't do this I get blank areas, where the titlebar was. // InvalWindowRect doesn't help here :-/ - + aglSetDrawable(_context, 0); aglSetDrawable(_context, GetWindowPort(_window)); - + MenubarController::instance()->update(); } @@ -299,16 +299,16 @@ bool GraphicsWindowCarbon::setWindowDecorationImplementation(bool flag) WindowAttributes GraphicsWindowCarbon::computeWindowAttributes(bool useWindowDecoration, bool supportsResize) { - WindowAttributes attr; - - if (useWindowDecoration) + WindowAttributes attr; + + if (useWindowDecoration) { if (supportsResize) attr = (kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute); else attr = (kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute) & ~kWindowResizableAttribute; } - else + else { attr = kWindowNoTitleBarAttribute | kWindowNoShadowAttribute | kWindowStandardHandlerAttribute; if (supportsResize) @@ -323,7 +323,7 @@ void GraphicsWindowCarbon::installEventHandler() { EventTypeSpec windEventList[] = { { kEventClassWindow, kEventWindowBoundsChanged}, { kEventClassWindow, kEventWindowClose}, - + {kEventClassMouse, kEventMouseDown}, {kEventClassMouse, kEventMouseUp}, {kEventClassMouse, kEventMouseMoved}, @@ -338,7 +338,7 @@ void GraphicsWindowCarbon::installEventHandler() { {kEventClassKeyboard, kEventHotKeyPressed}, {kEventClassKeyboard, kEventHotKeyReleased}, }; - + InstallWindowEventHandler(_window, NewEventHandlerUPP(GraphicsWindowEventHandler), GetEventTypeCount(windEventList), windEventList, this, NULL); } @@ -348,31 +348,31 @@ bool GraphicsWindowCarbon::realizeImplementation() if (!_initialized) init(); if (!_initialized) return false; if (!_traits) return false; - + OSG_INFO << "GraphicsWindowCarbon::realizeImplementation" << std::endl; - + setWindowDecoration(_traits->windowDecoration); useCursor(_traits->useCursor); // move the window to the right screen DarwinWindowingSystemInterface* wsi = dynamic_cast(osg::GraphicsContext::getWindowingSystemInterface()); int screenLeft = 0, screenTop = 0; - if (wsi) + if (wsi) { wsi->getScreenTopLeft((*_traits), screenLeft, screenTop); } - - WindowData *windowData = ( _traits.get() && _traits->inheritedWindowData.get() ) ? static_cast(_traits->inheritedWindowData.get()) : 0; - + + WindowData *windowData = ( _traits.get() && _traits->inheritedWindowData.get() ) ? static_cast(_traits->inheritedWindowData.get()) : 0; + _ownsWindow = (windowData) ? (windowData->getNativeWindowRef() == NULL) : true; - + if (_ownsWindow) { - + // create the window Rect bounds = {_traits->y + screenTop, _traits->x + screenLeft, _traits->y + _traits->height + screenTop, _traits->x + _traits->width + screenLeft}; OSStatus err = 0; WindowAttributes attr = computeWindowAttributes(_useWindowDecoration, _traits->supportsResize); - + err = CreateNewWindow(kDocumentWindowClass, attr, &bounds, &_window); if (err) { @@ -385,22 +385,22 @@ bool GraphicsWindowCarbon::realizeImplementation() else { _window = windowData->getNativeWindowRef(); } - + Rect titleRect; GetWindowBounds(_window, kWindowTitleBarRgn, &titleRect); _windowTitleHeight = abs(titleRect.bottom - titleRect.top); - + if ((_ownsWindow) || (windowData && windowData->installEventHandler())) installEventHandler(); - + // set the window title setWindowName(_traits->windowName); - + // create the context AGLContext sharedContextCarbon = NULL; - + GraphicsHandleCarbon* graphicsHandleCarbon = dynamic_cast(_traits->sharedContext); - if (graphicsHandleCarbon) + if (graphicsHandleCarbon) { sharedContextCarbon = graphicsHandleCarbon->getAGLContext(); } @@ -411,16 +411,16 @@ bool GraphicsWindowCarbon::realizeImplementation() return false; } - + if ( windowData && windowData->getAGLDrawable() ) { - aglSetDrawable(_context, (AGLDrawable)*(windowData->getAGLDrawable()) ); - + aglSetDrawable(_context, (AGLDrawable)*(windowData->getAGLDrawable()) ); + } else { - aglSetDrawable(_context, GetWindowPort(_window)); - ShowWindow(_window); + aglSetDrawable(_context, GetWindowPort(_window)); + ShowWindow(_window); MenubarController::instance()->attachWindow( new CarbonWindowAdapter(this) ); } - + makeCurrent(); if ((_traits->useMultiThreadedOpenGLEngine) && (OpenThreads::GetNumberOfProcessors() > 1)) { @@ -435,11 +435,11 @@ bool GraphicsWindowCarbon::realizeImplementation() // so we'll use the raw value of it to keep things compiling on older // versions of OSX. cgerr = CGLEnable( ctx, static_cast (313) ); -#endif +#endif if (cgerr != kCGLNoError ) { OSG_INFO << "GraphicsWindowCarbon::realizeImplementation: multi-threaded OpenGL Execution not available" << std::endl; - } + } } InitCursor(); @@ -459,7 +459,7 @@ bool GraphicsWindowCarbon::realizeImplementation() bool GraphicsWindowCarbon::makeCurrentImplementation() { - + return (aglSetCurrentContext(_context) == GL_TRUE); } @@ -487,21 +487,21 @@ void GraphicsWindowCarbon::closeImplementation() // there's a possibility that the MenubarController is destructed already, so prevent a crash: MenubarController* mbc = MenubarController::instance(); if (mbc) mbc->detachWindow(this); - + if (_pixelFormat) { aglDestroyPixelFormat(_pixelFormat); _pixelFormat = NULL; } - - if (_context) + + if (_context) { aglSetDrawable(_context, NULL); aglSetCurrentContext(NULL); aglDestroyContext(_context); _context = NULL; } - + if (_ownsWindow && _window) DisposeWindow(_window); _window = NULL; } @@ -531,7 +531,7 @@ void GraphicsWindowCarbon::resizedImplementation(int x, int y, int width, int he aglUpdateContext(_context); MenubarController::instance()->update(); - + getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime()); } @@ -541,24 +541,24 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) { static unsigned int lastEmulatedMouseButton = 0; - // mouse down event + // mouse down event Point wheresMyMouse; GetEventParameter (theEvent, kEventParamWindowMouseLocation, typeQDPoint, NULL, sizeof(wheresMyMouse), NULL, &wheresMyMouse); - + wheresMyMouse.v -= _windowTitleHeight; if (_useWindowDecoration && (wheresMyMouse.v < 0)) return false; - + Point wheresMyMouseGlobal; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(wheresMyMouse), NULL, &wheresMyMouseGlobal); - + EventMouseButton mouseButton = 0; GetEventParameter (theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(mouseButton), NULL, &mouseButton); - + UInt32 modifierKeys; GetEventParameter (theEvent,kEventParamKeyModifiers,typeUInt32, NULL,sizeof(modifierKeys), NULL,&modifierKeys); - - + + WindowRef win; int fwres = FindWindow(wheresMyMouseGlobal, &win); // return false when Window is inactive; For enabling click-to-active on window by delegating event to default handler @@ -573,7 +573,7 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) // swap right and middle buttons so that middle button is 2, right button is 3. if (mouseButton==3) mouseButton = 2; else if (mouseButton==2) mouseButton = 3; - + // check tablet pointer device and map it to a mouse button TabletProximityRec theTabletRecord; // The Tablet Proximity Record // Extract the Tablet Proximity reccord from the event. @@ -581,18 +581,18 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) typeTabletProximityRec, NULL, sizeof(TabletProximityRec), NULL, (void *)&theTabletRecord)) - { + { osgGA::GUIEventAdapter::TabletPointerType pointerType; switch(theTabletRecord.pointerType) { case 1: // pen pointerType = osgGA::GUIEventAdapter::PEN; break; - + case 2: // puck pointerType = osgGA::GUIEventAdapter::PUCK; break; - + case 3: // eraser pointerType = osgGA::GUIEventAdapter::ERASER; break; @@ -601,14 +601,14 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) pointerType = osgGA::GUIEventAdapter::UNKNOWN; break; } - + getEventQueue()->penProximity(pointerType, (theTabletRecord.enterProximity != 0)); } // get tilt and rotation from the pen TabletPointRec theTabletPointRecord; - if(noErr == GetEventParameter(theEvent, kEventParamTabletPointRec, typeTabletPointRec, NULL, - sizeof(TabletPointRec), NULL, (void *)&theTabletPointRecord)) + if(noErr == GetEventParameter(theEvent, kEventParamTabletPointRec, typeTabletPointRec, NULL, + sizeof(TabletPointRec), NULL, (void *)&theTabletPointRecord)) { int penRotation = (int)theTabletPointRecord.rotation * 9 / 575; //to get angle between 0 to 360 grad penRotation = -(((penRotation + 180) % 360) - 180) ; //for same range on all plattforms we need -180 to 180 @@ -618,7 +618,7 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) penRotation ); } - + switch(GetEventKind(theEvent)) { case kEventMouseDown: @@ -626,10 +626,10 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) float mx = wheresMyMouse.h; float my = wheresMyMouse.v; transformMouseXY(mx, my); - + lastEmulatedMouseButton = 0; - - if (mouseButton == 1) + + if (mouseButton == 1) { if( modifierKeys & cmdKey ) { @@ -640,8 +640,8 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) mouseButton = lastEmulatedMouseButton = 2; } } - - if (clickCount > 1) + + if (clickCount > 1) getEventQueue()->mouseDoubleButtonPress(mx,my, mouseButton); else getEventQueue()->mouseButtonPress(mx, my, mouseButton); @@ -661,24 +661,24 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) } } break; - + case kEventMouseDragged: { // get pressure from the pen, only when mouse/pen is dragged TabletPointRec theTabletRecord; - if(noErr == GetEventParameter(theEvent, kEventParamTabletPointRec, typeTabletPointRec, NULL, + if(noErr == GetEventParameter(theEvent, kEventParamTabletPointRec, typeTabletPointRec, NULL, sizeof(TabletPointRec), NULL, (void *)&theTabletRecord)) { - + getEventQueue()->penPressure(theTabletRecord.pressure / 65535.0f); } - + float mx = wheresMyMouse.h; float my = wheresMyMouse.v; transformMouseXY(mx, my); getEventQueue()->mouseMotion(mx, my); } break; - + case kEventMouseMoved: { float mx = wheresMyMouse.h; @@ -687,7 +687,7 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) getEventQueue()->mouseMotion(mx, my); } break; - + // mouse with scroll-wheels case kEventMouseWheelMoved: { @@ -707,7 +707,7 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) } } break; - + // new trackpads and mighty mouse, (not officially documented, see http://developer.apple.com/qa/qa2005/qa1453.html ) case 11: { @@ -716,7 +716,7 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) kEventParamMouseWheelSmoothVerticalDelta = 'saxy', // typeSInt32 kEventParamMouseWheelSmoothHorizontalDelta = 'saxx' // typeSInt32 }; - + SInt32 scroll_delta_x = 0; SInt32 scroll_delta_y = 0; OSErr err = noErr; @@ -728,12 +728,12 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) } } break; - + default: return false; } } - + return true; } @@ -742,25 +742,25 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) bool GraphicsWindowCarbon::handleKeyboardEvent(EventRef theEvent) { handleModifierKeys(theEvent); - + OSStatus status; - + UInt32 rawkey; GetEventParameter (theEvent,kEventParamKeyCode,typeUInt32, NULL,sizeof(rawkey), NULL,&rawkey); - + // OSG_INFO << "key code: " << rawkey << " modifiers: " << modifierKeys << std::endl; - + UInt32 dataSize; /* jbw check return status so that we don't allocate a huge array */ status = GetEventParameter( theEvent, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0, &dataSize, NULL ); if (status != noErr) return false; if (dataSize<=1) return false; - + UniChar* uniChars = new UniChar[dataSize+1]; GetEventParameter( theEvent, kEventParamKeyUnicodes, typeUnicodeText, NULL, dataSize, NULL, (void*)uniChars ); - + unsigned int keychar = remapCarbonKey(static_cast(uniChars[0]), rawkey); - + switch(GetEventKind(theEvent)) { case kEventRawKeyDown: @@ -772,18 +772,18 @@ bool GraphicsWindowCarbon::handleKeyboardEvent(EventRef theEvent) getEventQueue()->keyPress(keychar); break; } - + case kEventRawKeyUp: - { + { //OSG_INFO << "GraphicsWindowCarbon::keyPress" << std::endl; //getEventQueue()->getCurrentEventState()->setModKeyMask(modifierMask); getEventQueue()->keyRelease(keychar); break; } - + default: break; - + } delete[] uniChars; @@ -797,14 +797,14 @@ void GraphicsWindowCarbon::handleModifierKey(UInt32 modifierKey, UInt32 modifier { getEventQueue()->keyPress(keySymbol); } - + if (!(modifierKey & modifierMask) && (_lastModifierKeys & modifierMask)) { getEventQueue()->keyRelease(keySymbol); } } -bool GraphicsWindowCarbon::handleModifierKeys(EventRef theEvent) +bool GraphicsWindowCarbon::handleModifierKeys(EventRef theEvent) { UInt32 modifierKeys; GetEventParameter (theEvent,kEventParamKeyModifiers,typeUInt32, NULL,sizeof(modifierKeys), NULL,&modifierKeys); @@ -812,25 +812,25 @@ bool GraphicsWindowCarbon::handleModifierKeys(EventRef theEvent) //std::cout << modifierKeys << std::endl; if (_lastModifierKeys == modifierKeys) return false; - + handleModifierKey(modifierKeys, shiftKey, osgGA::GUIEventAdapter::KEY_Shift_L); handleModifierKey(modifierKeys, controlKey, osgGA::GUIEventAdapter::KEY_Control_L); handleModifierKey(modifierKeys, optionKey, osgGA::GUIEventAdapter::KEY_Alt_L); handleModifierKey(modifierKeys, cmdKey, osgGA::GUIEventAdapter::KEY_Super_L); - - // Caps lock needs some special handling, i did not find a way to get informed when the caps-lock-key gets released + + // Caps lock needs some special handling, i did not find a way to get informed when the caps-lock-key gets released if ((modifierKeys & alphaLock) && !(_lastModifierKeys & alphaLock)) { getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_Caps_Lock); getEventQueue()->keyRelease(osgGA::GUIEventAdapter::KEY_Caps_Lock); } - + if (!(modifierKeys & alphaLock) && (_lastModifierKeys & alphaLock)) { getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_Caps_Lock); getEventQueue()->keyRelease(osgGA::GUIEventAdapter::KEY_Caps_Lock); } - + _lastModifierKeys = modifierKeys; return true; } @@ -840,22 +840,22 @@ bool GraphicsWindowCarbon::handleModifierKeys(EventRef theEvent) void GraphicsWindowCarbon::checkEvents() { if (!_realized) return; - + EventRef theEvent; EventTargetRef theTarget = GetEventDispatcherTarget(); while (ReceiveNextEvent(0, NULL, 0,true, &theEvent)== noErr) { switch(GetEventClass(theEvent)) { - case kEventClassMouse: + case kEventClassMouse: { // handle the menubar Point wheresMyMouse; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(wheresMyMouse), NULL, &wheresMyMouse); - + EventMouseButton mouseButton = 0; GetEventParameter (theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(mouseButton), NULL, &mouseButton); - + WindowRef win; int fwres = FindWindow(wheresMyMouse, &win); @@ -874,8 +874,8 @@ void GraphicsWindowCarbon::checkEvents() break; } break; - - case kEventClassAppleEvent: + + case kEventClassAppleEvent: { EventRecord eventRecord; ConvertEventRefToEventRecord(theEvent, &eventRecord); @@ -886,16 +886,16 @@ void GraphicsWindowCarbon::checkEvents() } SendEventToEventTarget (theEvent, theTarget); - ReleaseEvent(theEvent); - } + ReleaseEvent(theEvent); + } if (_closeRequested) getEventQueue()->closeWindow(); - + if (s_quit_requested) { getEventQueue()->quitApplication(); s_quit_requested = false; } - + } @@ -903,11 +903,11 @@ bool GraphicsWindowCarbon::setWindowRectangleImplementation(int x, int y, int wi { int screenLeft(0), screenTop(0); DarwinWindowingSystemInterface* wsi = dynamic_cast(osg::GraphicsContext::getWindowingSystemInterface()); - if (wsi) + if (wsi) { wsi->getScreenTopLeft((*_traits), screenLeft, screenTop); } - + Rect bounds = {y + screenTop, x + screenLeft, y + height + screenTop, x + width + screenLeft}; SetWindowBounds(getNativeWindowRef(), kWindowContentRgn, &bounds); aglUpdateContext(_context); @@ -922,17 +922,17 @@ void GraphicsWindowCarbon::adaptResize(int x, int y, int w, int h) DarwinWindowingSystemInterface* wsi = dynamic_cast(osg::GraphicsContext::getWindowingSystemInterface()); int screenLeft(0), screenTop(0); if (wsi) { - + // get the screen containing the window unsigned int screenNdx = wsi->getScreenContaining(x,y,w,h); - + // update traits _traits->screenNum = screenNdx; - + // get top left of screen wsi->getScreenTopLeft((*_traits), screenLeft, screenTop); } - + resized(x-screenLeft,y-screenTop,w,h); } @@ -961,7 +961,7 @@ void GraphicsWindowCarbon::useCursor(bool cursorOn) OSG_WARN << "GraphicsWindowCarbon::useCursor: could not get OSXCarbonWindowingSystemInterface" << std::endl; return; } - + CGDirectDisplayID displayId = wsi->getDisplayID((*_traits)); CGDisplayErr err = (cursorOn ? CGDisplayShowCursor(displayId) : CGDisplayHideCursor(displayId)); if (err != kCGErrorSuccess) { @@ -977,7 +977,7 @@ void GraphicsWindowCarbon::setCursor(MouseCursor mouseCursor) return; UInt32 cursor; - switch (mouseCursor) + switch (mouseCursor) { case NoCursor: HideCursor(); @@ -1002,7 +1002,7 @@ void GraphicsWindowCarbon::setCursor(MouseCursor mouseCursor) cursor = kThemeArrowCursor; OSG_WARN << "GraphicsWindowCarbon::setCursor doesn't implement cursor: type = " << mouseCursor << std::endl; } - + _currentCursor = mouseCursor; SetThemeCursor(cursor); ShowCursor(); @@ -1015,10 +1015,10 @@ void GraphicsWindowCarbon::setSyncToVBlank(bool on) } } -void GraphicsWindowCarbon::setWindowName (const std::string& name) +void GraphicsWindowCarbon::setWindowName (const std::string& name) { _traits->windowName = name; - if (!_traits->windowName.empty()) + if (!_traits->windowName.empty()) { CFStringRef windowtitle = CFStringCreateWithBytes( kCFAllocatorDefault, (const UInt8*)(_traits->windowName.c_str()), _traits->windowName.length(),kCFStringEncodingUTF8, false ); SetWindowTitleWithCFString( _window, windowtitle ); @@ -1068,7 +1068,7 @@ public: { } - virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits) + virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits) { _init(); diff --git a/src/osgViewer/GraphicsWindowWin32.cpp b/src/osgViewer/GraphicsWindowWin32.cpp index 30cc3ad8e..06650cc91 100644 --- a/src/osgViewer/GraphicsWindowWin32.cpp +++ b/src/osgViewer/GraphicsWindowWin32.cpp @@ -2193,7 +2193,7 @@ void GraphicsWindowWin32::useCursor( bool cursorOn ) if (_traits.valid()) _traits->useCursor = cursorOn; - // note, we are using setCursorImpl to set the cursor, so we can use + // note, we are using setCursorImpl to set the cursor, so we can use // _appMouseCursor to cache the current mouse-cursor setCursorImpl(cursorOn ? _appMouseCursor : NoCursor); } diff --git a/src/osgViewer/GraphicsWindowX11.cpp b/src/osgViewer/GraphicsWindowX11.cpp index 9d528329f..d551f36e4 100644 --- a/src/osgViewer/GraphicsWindowX11.cpp +++ b/src/osgViewer/GraphicsWindowX11.cpp @@ -453,7 +453,7 @@ bool GraphicsWindowX11::setWindowDecorationImplementation(bool flag) // if traits says not resize we want to set the functions to exlude MWM_FUNC_RESIZE, // but this bitmask needs to be set if the MWM_FUNC_ALL bit is already set in order to toggle it off. if (_traits.valid() && !_traits->supportsResize) wmHints.functions = wmHints.functions | MWM_FUNC_RESIZE; - + } else { @@ -463,7 +463,7 @@ bool GraphicsWindowX11::setWindowDecorationImplementation(bool flag) wmHints.inputMode = 0; wmHints.status = 0; } - + XChangeProperty( display, _window, atom, atom, 32, PropModeReplace, (unsigned char *)&wmHints, 5 ); result = true; } @@ -494,7 +494,7 @@ bool GraphicsWindowX11::setWindowRectangleImplementation(int x, int y, int width XFlush(display); XSync(display, 0); - + // add usleep here to give window manager a chance to handle the request, if // we don't add this sleep then any X11 calls right afterwards can produce // X11 errors. @@ -758,7 +758,7 @@ void GraphicsWindowX11::init() if (_traits->samples) { attributes.push_back(EGL_SAMPLES); attributes.push_back(_traits->samples); } attributes.push_back(EGL_RENDERABLE_TYPE); attributes.push_back(OSG_EGL_OPENGL_TARGET_BIT); - + attributes.push_back(EGL_NONE); attributes.push_back(EGL_NONE); @@ -915,7 +915,7 @@ bool GraphicsWindowX11::createWindow() doFullSceenWorkAround = true; } } - + _window = XCreateWindow( _display, _parent, x, y, @@ -952,7 +952,7 @@ bool GraphicsWindowX11::createWindow() setWindowDecoration(_traits->windowDecoration); - + useCursor(_traits->useCursor); _deleteWindow = XInternAtom (_display, "WM_DELETE_WINDOW", False); @@ -1206,7 +1206,7 @@ void GraphicsWindowX11::checkEvents() double resizeTime = eventTime; _timeOfLastCheckEvents = getEventQueue()->getTime(); if (baseTime>_timeOfLastCheckEvents) baseTime = _timeOfLastCheckEvents; - + // OSG_NOTICE<<"GraphicsWindowX11::checkEvents() : getEventQueue()->getCurrentEventState()->getGraphicsContext()="<getCurrentEventState()->getGraphicsContext()<(&aa); if (!view) return false; - + osgViewer::ViewerBase* viewer = view->getViewerBase(); if (!viewer) return false; - + if (ea.getHandled()) return false; switch(ea.getEventType()) @@ -85,7 +85,7 @@ void HelpHandler::setUpHUDCamera(osgViewer::ViewerBase* viewer) osgViewer::GraphicsWindow* window = dynamic_cast(_camera->getGraphicsContext()); if (!window) - { + { osgViewer::Viewer::Windows windows; viewer->getWindows(windows); @@ -156,7 +156,7 @@ void HelpHandler::setUpScene(osgViewer::ViewerBase* viewer) } const osg::ApplicationUsage::UsageMap& keyboardBinding = _applicationUsage->getKeyboardMouseBindings(); - + for(osg::ApplicationUsage::UsageMap::const_iterator itr = keyboardBinding.begin(); itr != keyboardBinding.end(); ++itr) @@ -196,9 +196,9 @@ void HelpHandler::setUpScene(osgViewer::ViewerBase* viewer) float ratio = 1.0; if (width > 1024.0f) ratio = 1024.0f/width; if (height*ratio > 800.0f) ratio = 800.0f/height; - - _camera->setViewMatrix(osg::Matrix::translate(-bb.center()) * - osg::Matrix::scale(ratio,ratio,ratio) * + + _camera->setViewMatrix(osg::Matrix::translate(-bb.center()) * + osg::Matrix::scale(ratio,ratio,ratio) * osg::Matrix::translate(osg::Vec3(640.0f, 520.0f, 0.0f))); } } diff --git a/src/osgViewer/PixelBufferCarbon.cpp b/src/osgViewer/PixelBufferCarbon.cpp index 330fcb719..61b674391 100644 --- a/src/osgViewer/PixelBufferCarbon.cpp +++ b/src/osgViewer/PixelBufferCarbon.cpp @@ -6,7 +6,7 @@ * Copyright 2007 __MyCompanyName__. All rights reserved. * */ - + #if defined (__APPLE__) && (!__LP64__) #include @@ -19,31 +19,31 @@ using namespace osgViewer; -/** creates a pixelformat from a Trait */ +/** creates a pixelformat from a Trait */ AGLPixelFormat PixelBufferCarbon::createPixelFormat(osg::GraphicsContext::Traits* traits) { std::vector attributes; - + attributes.push_back(AGL_NO_RECOVERY); attributes.push_back(AGL_RGBA); - if (!traits->pbuffer) + if (!traits->pbuffer) attributes.push_back(AGL_COMPLIANT); else attributes.push_back(AGL_CLOSEST_POLICY); - + if (traits->doubleBuffer) attributes.push_back(AGL_DOUBLEBUFFER); if (traits->quadBufferStereo) attributes.push_back(AGL_STEREO); - + attributes.push_back(AGL_RED_SIZE); attributes.push_back(traits->red); attributes.push_back(AGL_GREEN_SIZE); attributes.push_back(traits->green); attributes.push_back(AGL_BLUE_SIZE); attributes.push_back(traits->blue); attributes.push_back(AGL_DEPTH_SIZE); attributes.push_back(traits->depth); - + if (traits->alpha) { attributes.push_back(AGL_ALPHA_SIZE); attributes.push_back(traits->alpha); } - + if (traits->stencil) { attributes.push_back(AGL_STENCIL_SIZE); attributes.push_back(traits->stencil); } - - // TODO + + // TODO // missing accumulation-buffer-stuff #if defined(AGL_SAMPLE_BUFFERS_ARB) && defined (AGL_SAMPLES_ARB) @@ -53,7 +53,7 @@ AGLPixelFormat PixelBufferCarbon::createPixelFormat(osg::GraphicsContext::Traits #endif attributes.push_back(AGL_NONE); - + return aglChoosePixelFormat(NULL, 0, &(attributes.front())); } @@ -69,40 +69,40 @@ void PixelBufferCarbon::init() /** This is the class we need to create for pbuffers, note its not a GraphicsWindow as it won't need any of the event handling and window mapping facilities.*/ -/** Realise the GraphicsContext implementation, +/** Realise the GraphicsContext implementation, * Pure virtual - must be implemented by concrate implementations of GraphicsContext. */ -bool PixelBufferCarbon::realizeImplementation() +bool PixelBufferCarbon::realizeImplementation() { if (!_valid) { OSG_WARN << "PixelBufferCarbon::realizeImplementation() aglChoosePixelFormat failed! " << aglErrorString(aglGetError()) << std::endl; return false; } - + AGLContext sharedContext = NULL; - // get any shared AGL contexts + // get any shared AGL contexts GraphicsHandleCarbon* graphicsHandleCarbon = dynamic_cast(_traits->sharedContext); - if (graphicsHandleCarbon) + if (graphicsHandleCarbon) { sharedContext = graphicsHandleCarbon->getAGLContext(); } - + _context = aglCreateContext (_pixelformat, sharedContext); - + if (!_context) { OSG_WARN << "PixelBufferCarbon::realizeImplementation() aglCreateContext failed! " << aglErrorString(aglGetError()) << std::endl; return false; } - - + + _realized = aglCreatePBuffer (_traits->width, _traits->height, _traits->target, GL_RGBA, _traits->level, &(_pbuffer)); if (!_realized) { OSG_WARN << "PixelBufferCarbon::realizeImplementation() aglCreatePBuffer failed! " << aglErrorString(aglGetError()) << std::endl; } - + makeCurrentImplementation(); - + _realized = aglSetPBuffer(_context, _pbuffer, _traits->face, _traits->level, 0); if (!_realized) { OSG_WARN << "PixelBufferCarbon::realizeImplementation() aglSetPBuffer failed! " << aglErrorString(aglGetError()) << std::endl; @@ -110,55 +110,55 @@ bool PixelBufferCarbon::realizeImplementation() return _realized; } -void PixelBufferCarbon::closeImplementation() -{ +void PixelBufferCarbon::closeImplementation() +{ if (_pbuffer) aglDestroyPBuffer(_pbuffer); if (_context) aglDestroyContext(_context); if (_pixelformat) aglDestroyPixelFormat(_pixelformat); - + _pbuffer = NULL; _context = NULL; _pixelformat = NULL; - + _valid = _realized = false; } /** Make this graphics context current implementation. * Pure virtual - must be implemented by concrate implementations of GraphicsContext. */ -bool PixelBufferCarbon::makeCurrentImplementation() -{ +bool PixelBufferCarbon::makeCurrentImplementation() +{ return (_realized) ? (aglSetCurrentContext(_context) == GL_TRUE) : false; } - + /** Make this graphics context current with specified read context implementation. * Pure virtual - must be implemented by concrate implementations of GraphicsContext. */ -bool PixelBufferCarbon::makeContextCurrentImplementation(GraphicsContext* /*readContext*/) { +bool PixelBufferCarbon::makeContextCurrentImplementation(GraphicsContext* /*readContext*/) { return makeCurrentImplementation(); } /** Release the graphics context.*/ -bool PixelBufferCarbon::releaseContextImplementation() -{ +bool PixelBufferCarbon::releaseContextImplementation() +{ return (aglSetCurrentContext(NULL) == GL_TRUE); } /** Pure virtual, Bind the graphics context to associated texture implementation. * Pure virtual - must be implemented by concrate implementations of GraphicsContext. */ -void PixelBufferCarbon::bindPBufferToTextureImplementation( GLenum buffer ){ +void PixelBufferCarbon::bindPBufferToTextureImplementation( GLenum buffer ){ - OSG_NOTICE<<"GraphicsWindow::void bindPBufferToTextureImplementation(..) not implemented."<sharedContext ) { getState()->setContextID( _traits->sharedContext->getState()->getContextID() ); - incrementContextIDUsageCount( getState()->getContextID() ); + incrementContextIDUsageCount( getState()->getContextID() ); } else { @@ -479,7 +479,7 @@ PixelBufferWin32::~PixelBufferWin32() { closeImplementation(); } - + void PixelBufferWin32::init() { if (_initialized) return; @@ -640,7 +640,7 @@ void PixelBufferWin32::init() _traits->height = iHeight; } - _initialized = true; + _initialized = true; _valid = true; return; @@ -655,13 +655,13 @@ bool PixelBufferWin32::realizeImplementation() } if (!_initialized) init(); - + if (!_initialized) return false; if ( _traits->sharedContext ) { GraphicsHandleWin32* graphicsHandleWin32 = dynamic_cast(_traits->sharedContext); - if (graphicsHandleWin32) + if (graphicsHandleWin32) { if ( !wglShareLists(graphicsHandleWin32->getWGLContext(), _hglrc) ) { @@ -719,7 +719,7 @@ bool PixelBufferWin32::makeCurrentImplementation() // If the pbuffer is bound to a texture then release it. This operation requires a current context, so // do it after the MakeCurrent. - + if ( _boundBuffer!=0 ) { WGLExtensions* wgle = WGLExtensions::instance(); @@ -735,7 +735,7 @@ bool PixelBufferWin32::makeCurrentImplementation() return result; } - + bool PixelBufferWin32::makeContextCurrentImplementation( GraphicsContext* readContext ) { WGLExtensions* wgle = WGLExtensions::instance(); @@ -747,7 +747,7 @@ bool PixelBufferWin32::makeContextCurrentImplementation( GraphicsContext* readCo } GraphicsHandleWin32* graphicsHandleWin32 = dynamic_cast(readContext); - if (graphicsHandleWin32) + if (graphicsHandleWin32) { return wgle->wglMakeContextCurrentARB(_hdc, graphicsHandleWin32->getHDC(), _hglrc); } @@ -768,7 +768,7 @@ bool PixelBufferWin32::releaseContextImplementation() void PixelBufferWin32::bindPBufferToTextureImplementation( GLenum buffer ) { WGLExtensions* wgle = WGLExtensions::instance(); - + if ( !wgle || !wgle->wglBindTexImageARB ) { OSG_NOTICE << "PixelBufferWin32, wglBindTexImageARB not available" << std::endl; @@ -788,7 +788,7 @@ void PixelBufferWin32::bindPBufferToTextureImplementation( GLenum buffer ) default: bindBuffer = static_cast(buffer); } - + if ( bindBuffer != _boundBuffer ) { if ( _boundBuffer != 0 && !wgle->wglReleaseTexImageARB(reinterpret_cast(_hwnd), _boundBuffer) ) @@ -801,10 +801,10 @@ void PixelBufferWin32::bindPBufferToTextureImplementation( GLenum buffer ) OSG_NOTICE << "PixelBufferWin32::bindPBufferToTextureImplementation, wglBindTexImageARB error: " << sysError() << std::endl; } _boundBuffer = bindBuffer; - } + } } -void PixelBufferWin32::swapBuffersImplementation() +void PixelBufferWin32::swapBuffersImplementation() { SwapBuffers( _hdc ); } diff --git a/src/osgViewer/PixelBufferX11.cpp b/src/osgViewer/PixelBufferX11.cpp index 7ac59bf30..bec072c83 100644 --- a/src/osgViewer/PixelBufferX11.cpp +++ b/src/osgViewer/PixelBufferX11.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -37,7 +37,7 @@ PixelBufferX11::PixelBufferX11(osg::GraphicsContext::Traits* traits) _traits = traits; init(); - + if (valid()) { setState( new osg::State ); @@ -46,7 +46,7 @@ PixelBufferX11::PixelBufferX11(osg::GraphicsContext::Traits* traits) if (_traits.valid() && _traits->sharedContext) { getState()->setContextID( _traits->sharedContext->getState()->getContextID() ); - incrementContextIDUsageCount( getState()->getContextID() ); + incrementContextIDUsageCount( getState()->getContextID() ); } else { @@ -66,20 +66,20 @@ bool PixelBufferX11::createVisualInfo() { typedef std::vector Attributes; Attributes attributes; - + attributes.push_back(GLX_USE_GL); - + attributes.push_back(GLX_RGBA); - + if (_traits->doubleBuffer) attributes.push_back(GLX_DOUBLEBUFFER); - + attributes.push_back(GLX_RED_SIZE); attributes.push_back(_traits->red); attributes.push_back(GLX_GREEN_SIZE); attributes.push_back(_traits->green); attributes.push_back(GLX_BLUE_SIZE); attributes.push_back(_traits->blue); attributes.push_back(GLX_DEPTH_SIZE); attributes.push_back(_traits->depth); - + if (_traits->alpha) { attributes.push_back(GLX_ALPHA_SIZE); attributes.push_back(_traits->alpha); } - + if (_traits->stencil) { attributes.push_back(GLX_STENCIL_SIZE); attributes.push_back(_traits->stencil); } #if defined(GLX_SAMPLE_BUFFERS) && defined (GLX_SAMPLES) @@ -92,9 +92,9 @@ bool PixelBufferX11::createVisualInfo() // GLX_AUX_BUFFERS // GLX_ACCUM_RED_SIZE // GLX_ACCUM_GREEN_SIZE - + attributes.push_back(None); - + _visualInfo = glXChooseVisual( _display, _traits->screenNum, &(attributes.front()) ); return _visualInfo != 0; @@ -109,7 +109,7 @@ void PixelBufferX11::init() _valid = false; return; } - + if (_traits->target != 0) { // we don't support Pbuffer render to texture under GLX. @@ -119,7 +119,7 @@ void PixelBufferX11::init() _display = XOpenDisplay(_traits->displayName().c_str()); - + unsigned int screen = _traits->screenNum; if (!_display) @@ -194,15 +194,15 @@ void PixelBufferX11::init() return; } - + if (!createVisualInfo()) { - _traits->red /= 2; - _traits->green /= 2; - _traits->blue /= 2; - _traits->alpha /= 2; - _traits->depth /= 2; - + _traits->red /= 2; + _traits->green /= 2; + _traits->blue /= 2; + _traits->alpha /= 2; + _traits->depth /= 2; + OSG_INFO<<"Relaxing traits"<(_traits->sharedContext); Context sharedContext = graphicsHandleX11 ? graphicsHandleX11->getContext() : 0; @@ -229,7 +229,7 @@ void PixelBufferX11::init() _valid = false; return; } - + #ifdef GLX_VERSION_1_3 // First try the regular glx extension if we have a new enough version available. if (haveGLX1_3) @@ -244,7 +244,7 @@ void PixelBufferX11::init() if ( !_pbuffer && (unsigned int)visual_id == _visualInfo->visualid ) { typedef std::vector AttributeList; - + AttributeList attributes; attributes.push_back( GLX_PBUFFER_WIDTH ); attributes.push_back( _traits->width ); @@ -253,7 +253,7 @@ void PixelBufferX11::init() attributes.push_back( GLX_LARGEST_PBUFFER ); attributes.push_back( GL_TRUE ); attributes.push_back( 0L ); - + _pbuffer = glXCreatePbuffer(_display, fbconfigs[i], &attributes.front() ); _useGLX1_3 = true; } @@ -285,12 +285,12 @@ void PixelBufferX11::init() { GLXFBConfigSGIX fbconfig = glXGetFBConfigFromVisualSGIX( _display, _visualInfo ); typedef std::vector AttributeList; - + AttributeList attributes; attributes.push_back( GLX_LARGEST_PBUFFER_SGIX ); attributes.push_back( GL_TRUE ); attributes.push_back( 0L ); - + _pbuffer = glXCreateGLXPbufferSGIX(_display, fbconfig, _traits->width, _traits->height, &attributes.front() ); if (_pbuffer) { @@ -298,7 +298,7 @@ void PixelBufferX11::init() int iHeight = 0; glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_WIDTH_SGIX , (unsigned int *)&iWidth); glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_HEIGHT_SGIX, (unsigned int *)&iHeight); - + if (_traits->width != iWidth || _traits->height != iHeight) { OSG_NOTICE << "PixelBufferX11::init(), SGIX_pbuffer created with different size then requsted" << std::endl; @@ -339,7 +339,7 @@ void PixelBufferX11::closeImplementation() { glXDestroyContext(_display, _context ); } - + if (_pbuffer) { if (_useGLX1_3) @@ -359,7 +359,7 @@ void PixelBufferX11::closeImplementation() XFlush( _display ); XSync( _display,0 ); } - + _pbuffer = 0; _context = 0; @@ -414,7 +414,7 @@ bool PixelBufferX11::realizeImplementation() } if (!_initialized) init(); - + if (!_initialized) return false; _realized = true; diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp index b4f339772..9c0a9df57 100644 --- a/src/osgViewer/Renderer.cpp +++ b/src/osgViewer/Renderer.cpp @@ -53,7 +53,7 @@ class OSGVIEWER_EXPORT EXTQuerySupport : public OpenGLQuerySupport typedef std::pair QueryFrameNumberPair; typedef std::list QueryFrameNumberList; typedef std::vector QueryList; - + QueryFrameNumberList _queryFrameNumberList; QueryList _availableQueryObjects; double _previousQueryTime; @@ -147,7 +147,7 @@ class ARBQuerySupport : public OpenGLQuerySupport public: virtual void checkQuery(osg::Stats* stats, osg::State* state, osg::Timer_t startTick); - + virtual void beginQuery(unsigned int frameNumber, osg::State* state); virtual void endQuery(osg::State* state); virtual void initialize(osg::State* state, osg::Timer_t startTick); @@ -377,7 +377,7 @@ Renderer::Renderer(osg::Camera* camera): osgViewer::ViewerBase* viewer = view ? view->getViewerBase() : 0; osgUtil::IncrementalCompileOperation* ico = viewer ? viewer->getIncrementalCompileOperation() : 0; bool automaticFlush = (ico==NULL); - + osg::DisplaySettings* ds = _camera->getDisplaySettings() ? _camera->getDisplaySettings() : ((view && view->getDisplaySettings()) ? view->getDisplaySettings() : osg::DisplaySettings::instance().get()); @@ -501,7 +501,7 @@ void Renderer::updateSceneView(osgUtil::SceneView* sceneView) bool automaticFlush = (ico==NULL); sceneView->setAutomaticFlush(automaticFlush); - + osgDB::DatabasePager* databasePager = view ? view->getDatabasePager() : 0; sceneView->getCullVisitor()->setDatabaseRequestHandler(databasePager); @@ -540,7 +540,7 @@ void Renderer::compile() glov.setState(sceneView->getState()); sceneView->getSceneData()->accept(glov); } - + sceneView->getState()->checkGLErrors("After Renderer::compile"); } @@ -731,7 +731,7 @@ void Renderer::draw() } _availableQueue.add(sceneView); - + if (acquireGPUStats) { _querySupport->endQuery(state); diff --git a/src/osgViewer/Scene.cpp b/src/osgViewer/Scene.cpp index c3dab6d3a..039180908 100644 --- a/src/osgViewer/Scene.cpp +++ b/src/osgViewer/Scene.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -35,7 +35,7 @@ Scene::Scene(): { setDatabasePager(osgDB::DatabasePager::create()); setImagePager(new osgDB::ImagePager); - + OpenThreads::ScopedLock lock(getSceneCacheMutex()); getSceneCache().push_back(this); } @@ -120,10 +120,10 @@ Scene* Scene::getScene(osg::Node* node) Scene* Scene::getOrCreateScene(osg::Node* node) { - if (!node) return 0; + if (!node) return 0; osgViewer::Scene* scene = getScene(node); - if (!scene) + if (!scene) { scene = new Scene; scene->setSceneData(node); diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index fd19d2378..a04599519 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -266,8 +266,8 @@ void StatsHandler::reset() _camera->removeChildren( 0, _camera->getNumChildren() ); } -void StatsHandler::addUserStatsLine(const std::string& label, const osg::Vec4& textColor, const osg::Vec4& barColor, - const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, +void StatsHandler::addUserStatsLine(const std::string& label, const osg::Vec4& textColor, const osg::Vec4& barColor, + const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, const std::string& beginTimeName, const std::string& endTimeName, float maxValue) { _userStatsLines.push_back(UserStatsLine(label, textColor, barColor, timeTakenName, multiplier, average, averageInInverseSpace, beginTimeName, endTimeName, maxValue)); @@ -1226,16 +1226,16 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) pos.x() = _leftPos; UserStatsLine& line = _userStatsLines[i]; - createTimeStatsLine(line.label, pos, line.textColor, line.barColor, viewer->getViewerStats(), viewer->getViewerStats(), + createTimeStatsLine(line.label, pos, line.textColor, line.barColor, viewer->getViewerStats(), viewer->getViewerStats(), line.timeTakenName, line.multiplier, line.average, line.averageInInverseSpace, line.beginTimeName, line.endTimeName); - + pos.y() -= _characterSize*_lineHeight; } { pos.x() = _leftPos; - createTimeStatsLine("Event", pos, colorUpdate, colorUpdateAlpha, viewer->getViewerStats(), viewer->getViewerStats(), + createTimeStatsLine("Event", pos, colorUpdate, colorUpdateAlpha, viewer->getViewerStats(), viewer->getViewerStats(), "Event traversal time taken", 1000.0, true, false, "Event traversal begin time", "Event traversal end time"); pos.y() -= _characterSize*_lineHeight; @@ -1244,7 +1244,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) { pos.x() = _leftPos; - createTimeStatsLine("Update", pos, colorUpdate, colorUpdateAlpha, viewer->getViewerStats(), viewer->getViewerStats(), + createTimeStatsLine("Update", pos, colorUpdate, colorUpdateAlpha, viewer->getViewerStats(), viewer->getViewerStats(), "Update traversal time taken", 1000.0, true, false, "Update traversal begin time", "Update traversal end time"); pos.y() -= _characterSize*_lineHeight; @@ -1617,9 +1617,9 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) } void StatsHandler::createTimeStatsLine(const std::string& lineLabel, - osg::Vec3 pos, const osg::Vec4& textColor, const osg::Vec4& barColor, - osg::Stats* viewerStats, osg::Stats* stats, - const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, + osg::Vec3 pos, const osg::Vec4& textColor, const osg::Vec4& barColor, + osg::Stats* viewerStats, osg::Stats* stats, + const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace, const std::string& beginTimeName, const std::string& endTimeName) { osg::ref_ptr label = new osgText::Text; @@ -1678,7 +1678,7 @@ void StatsHandler::createCameraTimeStats(osg::Vec3& pos, bool acquireGPUStats, o { pos.x() = _leftPos; - createTimeStatsLine("Cull", pos, colorCull, colorCullAlpha, viewerStats, stats, + createTimeStatsLine("Cull", pos, colorCull, colorCullAlpha, viewerStats, stats, "Cull traversal time taken", 1000.0, true, false, "Cull traversal begin time", "Cull traversal end time"); pos.y() -= _characterSize*_lineHeight; @@ -1687,7 +1687,7 @@ void StatsHandler::createCameraTimeStats(osg::Vec3& pos, bool acquireGPUStats, o { pos.x() = _leftPos; - createTimeStatsLine("Draw", pos, colorDraw, colorDrawAlpha, viewerStats, stats, + createTimeStatsLine("Draw", pos, colorDraw, colorDrawAlpha, viewerStats, stats, "Draw traversal time taken", 1000.0, true, false, "Draw traversal begin time", "Draw traversal end time"); pos.y() -= _characterSize*_lineHeight; @@ -1697,7 +1697,7 @@ void StatsHandler::createCameraTimeStats(osg::Vec3& pos, bool acquireGPUStats, o { pos.x() = _leftPos; - createTimeStatsLine("GPU", pos, colorGPU, colorGPUAlpha, viewerStats, stats, + createTimeStatsLine("GPU", pos, colorGPU, colorGPUAlpha, viewerStats, stats, "GPU draw time taken", 1000.0, true, false, "GPU draw begin time", "GPU draw end time"); pos.y() -= _characterSize*_lineHeight; diff --git a/src/osgViewer/Version.cpp b/src/osgViewer/Version.cpp index c09176f8f..7a6860812 100644 --- a/src/osgViewer/Version.cpp +++ b/src/osgViewer/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include diff --git a/src/osgViewer/View.cpp b/src/osgViewer/View.cpp index 6d4d2429e..aab4308f5 100644 --- a/src/osgViewer/View.cpp +++ b/src/osgViewer/View.cpp @@ -286,7 +286,7 @@ void View::setSceneData(osg::Node* node) getSceneData()->getOrCreateStateSet(); getSceneData()->accept(sgv); #endif - + // now make sure the scene graph is set up with the correct DataVariance to protect the dynamic elements of // the scene graph from being run in parallel. osgUtil::Optimizer::StaticObjectDetectionVisitor sodv; @@ -369,7 +369,7 @@ void View::home() void View::addEventHandler(osgGA::GUIEventHandler* eventHandler) -{ +{ EventHandlers::iterator itr = std::find(_eventHandlers.begin(), _eventHandlers.end(), eventHandler); if (itr == _eventHandlers.end()) { @@ -459,7 +459,7 @@ void View::setUpViewAcrossAllScreens() traits->windowDecoration = false; traits->doubleBuffer = true; traits->sharedContext = 0; - + osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); _camera->setGraphicsContext(gc.get()); diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 28b694b44..9198e5633 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -637,7 +637,7 @@ void Viewer::eventTraversal() if (_done) return; double cutOffTime = (_runFrameScheme==ON_DEMAND) ? DBL_MAX : _frameStamp->getReferenceTime(); - + double beginEventTraversal = osg::Timer::instance()->delta_s(_startTick, osg::Timer::instance()->tick()); // OSG_NOTICE<<"Viewer::frameEventTraversal()."<(&aa); if (!view) return false; - + osgViewer::ViewerBase* viewer = view->getViewerBase(); if (viewer == NULL) @@ -160,7 +160,7 @@ void WindowSizeHandler::toggleFullscreen(osgViewer::GraphicsWindow *window) { osg::GraphicsContext::WindowingSystemInterface *wsi = osg::GraphicsContext::getWindowingSystemInterface(); - if (wsi == NULL) + if (wsi == NULL) { OSG_NOTICE << "Error, no WindowSystemInterface available, cannot toggle window fullscreen." << std::endl; return; @@ -206,7 +206,7 @@ void WindowSizeHandler::changeWindowedResolution(osgViewer::GraphicsWindow *wind { osg::GraphicsContext::WindowingSystemInterface *wsi = osg::GraphicsContext::getWindowingSystemInterface(); - if (wsi == NULL) + if (wsi == NULL) { OSG_NOTICE << "Error, no WindowSystemInterface available, cannot toggle window fullscreen." << std::endl; return; @@ -316,7 +316,7 @@ bool ThreadingHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIAction { osgViewer::View* view = dynamic_cast(&aa); if (!view) return false; - + osgViewer::ViewerBase* viewerBase = view->getViewerBase(); osgViewer::Viewer* viewer = dynamic_cast(viewerBase); @@ -356,11 +356,11 @@ bool ThreadingHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIAction viewerBase->setThreadingModel(osgViewer::ViewerBase::SingleThreaded); OSG_NOTICE<<"Threading model 'SingleThreaded' selected."<setThreadingModel(osgViewer::ViewerBase::SingleThreaded); OSG_NOTICE<<"Threading model 'SingleThreaded' selected."<setThreadingModel(viewer->suggestBestThreadingModel()); OSG_NOTICE<<"Threading model 'AutomaticSelection' selected."<= _interval) { const osg::Matrixd& m = view->getCamera()->getInverseViewMatrix(); - double animationPathTime = osg::Timer::instance()->delta_s(_animStartTime, time); + double animationPathTime = osg::Timer::instance()->delta_s(_animStartTime, time); _animPath->insert(animationPathTime, osg::AnimationPath::ControlPoint(m.getTrans(), m.getRotate())); _delta = 0.0f; @@ -459,7 +459,7 @@ bool RecordCameraPathHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GU } else _delta += delta; - + return true; } @@ -478,7 +478,7 @@ bool RecordCameraPathHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GU _currentlyRecording = true; _animStartTime = osg::Timer::instance()->tick(); _animPath = new osg::AnimationPath(); - + if (!_filename.empty()) { std::stringstream ss; @@ -489,7 +489,7 @@ bool RecordCameraPathHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GU _autoinc++; } ss << "."<empty()) - { + { _animPathManipulator = new osgGA::AnimationPathManipulator(_animPath.get()); _animPathManipulator->home(ea,aa); @@ -562,7 +562,7 @@ bool RecordCameraPathHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GU } } } - + // The user has requested to STOP playback. else { @@ -573,7 +573,7 @@ bool RecordCameraPathHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GU } return true; - } + } break; } @@ -636,7 +636,7 @@ void LODScaleHandler::getUsage(osg::ApplicationUsage& usage) const ostr<(&aa); if (!view) return false; - + osgViewer::ViewerBase* viewer = view->getViewerBase(); if (viewer == NULL) { return false; } - + if (ea.getHandled()) return false; switch(ea.getEventType()) @@ -729,7 +729,7 @@ InteractiveImageHandler::InteractiveImageHandler(osg::Image* image, osg::Texture } } -bool InteractiveImageHandler::computeIntersections(osgViewer::View* view, float x,float y, const osg::NodePath& nodePath, osgUtil::LineSegmentIntersector::Intersections& intersections,osg::Node::NodeMask traversalMask) const +bool InteractiveImageHandler::computeIntersections(osgViewer::View* view, float x,float y, const osg::NodePath& nodePath, osgUtil::LineSegmentIntersector::Intersections& intersections,osg::Node::NodeMask traversalMask) const { float local_x, local_y = 0.0; const osg::Camera* camera; @@ -818,7 +818,7 @@ bool InteractiveImageHandler::mousePosition(osgViewer::View* view, osg::NodeVisi { osg::Vec2 tc(0.5f,0.5f); - // use the nearest intersection + // use the nearest intersection const osgUtil::LineSegmentIntersector::Intersection& intersection = *(intersections.begin()); osg::Drawable* drawable = intersection.drawable.get(); osg::Geometry* geometry = drawable ? drawable->asGeometry() : 0; @@ -843,7 +843,7 @@ bool InteractiveImageHandler::mousePosition(osgViewer::View* view, osg::NodeVisi osg::Vec2Array* texcoords_Vec2Array = dynamic_cast(texcoords); if (texcoords_Vec2Array) { - // we have tex coord array so now we can compute the final tex coord at the point of intersection. + // we have tex coord array so now we can compute the final tex coord at the point of intersection. osg::Vec2 tc1 = (*texcoords_Vec2Array)[i1]; osg::Vec2 tc2 = (*texcoords_Vec2Array)[i2]; osg::Vec2 tc3 = (*texcoords_Vec2Array)[i3]; @@ -893,7 +893,7 @@ bool InteractiveImageHandler::mousePosition(osgViewer::View* view, osg::NodeVisi bool InteractiveImageHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv) { if (ea.getHandled()) return false; - + if (!_image) return false; switch(ea.getEventType()) @@ -917,11 +917,11 @@ bool InteractiveImageHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUI osgViewer::View* view = dynamic_cast(&aa); int x,y; bool sendKeyEvent = mousePosition(view, nv, ea, x, y); - + if (sendKeyEvent) { return _image->sendKeyEvent(ea.getKey(), ea.getEventType()==osgGA::GUIEventAdapter::KEYDOWN); - } + } break; } case (osgGA::GUIEventAdapter::RESIZE): @@ -959,7 +959,7 @@ void InteractiveImageHandler::resize(int width, int height) _image->scaleImage(width, height, 1); } - // Make sure the texture does not rescale the image because + // Make sure the texture does not rescale the image because // it thinks it should still be the previous size... if (_texture.valid()) _texture->setTextureSize(width, height); diff --git a/src/osgVolume/FixedFunctionTechnique.cpp b/src/osgVolume/FixedFunctionTechnique.cpp index 0b5db1fc3..9a42c050c 100644 --- a/src/osgVolume/FixedFunctionTechnique.cpp +++ b/src/osgVolume/FixedFunctionTechnique.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -46,12 +46,12 @@ FixedFunctionTechnique::~FixedFunctionTechnique() void FixedFunctionTechnique::setNumSlices(unsigned int numSlices) { if (_numSlices==numSlices) return; - + _numSlices = numSlices; - + if (_volumeTile) _volumeTile->setDirty(true); } - + osg::Node* createCube(const osg::Vec3& center, float size, unsigned int numSlices) { @@ -74,7 +74,7 @@ osg::Node* createCube(const osg::Vec3& center, float size, unsigned int numSlice (*coords)[i*4+2].set(halfSize,y,-halfSize); (*coords)[i*4+3].set(halfSize,y,halfSize); } - + osg::Vec3Array* normals = new osg::Vec3Array(1); (*normals)[0].set(0.0f,-1.0f,0.0f); geom->setNormalArray(normals); @@ -91,7 +91,7 @@ osg::Node* createCube(const osg::Vec3& center, float size, unsigned int numSlice billboard->setMode(osg::Billboard::POINT_ROT_WORLD); billboard->addDrawable(geom); billboard->setPosition(0,center); - + return billboard; } @@ -119,13 +119,13 @@ void FixedFunctionTechnique::init() } float alphaFuncValue = 0.1; - + osg::Image* image_3d = 0; osgVolume::Locator* masterLocator = _volumeTile->getLocator(); - osg::Texture::InternalFormatMode internalFormatMode = osg::Texture::USE_IMAGE_DATA_FORMAT; + osg::Texture::InternalFormatMode internalFormatMode = osg::Texture::USE_IMAGE_DATA_FORMAT; image_3d = _volumeTile->getLayer()->getImage(); - + CollectPropertiesVisitor cpv; if (_volumeTile->getLayer()->getProperty()) { @@ -154,7 +154,7 @@ void FixedFunctionTechnique::init() { matrix = masterLocator->getTransform(); } - + OSG_NOTICE<<"Matrix = "<addChild(clipnode); - texgenNode_0->setTextureUnit(0); - texgenNode_0->getTexGen()->setMode(osg::TexGen::EYE_LINEAR); - texgenNode_0->getTexGen()->setPlanesFromMatrix(osg::Matrix::inverse(matrix)); + texgenNode_0->setTextureUnit(0); + texgenNode_0->getTexGen()->setMode(osg::TexGen::EYE_LINEAR); + texgenNode_0->getTexGen()->setPlanesFromMatrix(osg::Matrix::inverse(matrix)); osg::StateSet* stateset = texgenNode_0->getOrCreateStateSet(); stateset->setMode(GL_LIGHTING,osg::StateAttribute::ON); stateset->setMode(GL_BLEND,osg::StateAttribute::ON); - + if (cpv._afProperty.valid()) { stateset->setAttributeAndModes(cpv._afProperty->getAlphaFunc(), osg::StateAttribute::ON); @@ -202,11 +202,11 @@ void FixedFunctionTechnique::init() { stateset->setAttributeAndModes(new osg::AlphaFunc(osg::AlphaFunc::GREATER,alphaFuncValue), osg::StateAttribute::ON); } - + osg::Material* material = new osg::Material; material->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,1.0f,1.0f,1.0f)); stateset->setAttributeAndModes(material); - + if (cpv._mipProperty.valid()) { stateset->setAttribute(new osg::BlendFunc(osg::BlendFunc::ONE, osg::BlendFunc::ONE)); @@ -225,7 +225,7 @@ void FixedFunctionTechnique::init() texture3D->setWrap(osg::Texture3D::WRAP_R,osg::Texture3D::CLAMP_TO_EDGE); texture3D->setWrap(osg::Texture3D::WRAP_S,osg::Texture3D::CLAMP_TO_EDGE); texture3D->setWrap(osg::Texture3D::WRAP_T,osg::Texture3D::CLAMP_TO_EDGE); - if (image_3d->getPixelFormat()==GL_ALPHA || + if (image_3d->getPixelFormat()==GL_ALPHA || image_3d->getPixelFormat()==GL_LUMINANCE) { texture3D->setInternalFormatMode(osg::Texture3D::USE_USER_DEFINED_FORMAT); @@ -245,7 +245,7 @@ void FixedFunctionTechnique::init() stateset->setTextureMode(0,GL_TEXTURE_GEN_R,osg::StateAttribute::ON); stateset->setTextureAttributeAndModes(0,new osg::TexEnv(),osg::StateAttribute::ON); - + _node = texgenNode_0; } @@ -256,7 +256,7 @@ void FixedFunctionTechnique::update(osgUtil::UpdateVisitor* uv) void FixedFunctionTechnique::cull(osgUtil::CullVisitor* cv) { - //OSG_NOTICE<<"FixedFunctionTechnique::cull(osgUtil::CullVisitor* nv)"<accept(*cv); @@ -283,8 +283,8 @@ void FixedFunctionTechnique::traverse(osg::NodeVisitor& nv) { update(uv); return; - } - + } + } else if (nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR) { @@ -297,10 +297,10 @@ void FixedFunctionTechnique::traverse(osg::NodeVisitor& nv) } - if (_volumeTile->getDirty()) + if (_volumeTile->getDirty()) { OSG_INFO<<"******* Doing init ***********"<init(); } } - + diff --git a/src/osgVolume/Locator.cpp b/src/osgVolume/Locator.cpp index fe51c9963..2dd9d4694 100644 --- a/src/osgVolume/Locator.cpp +++ b/src/osgVolume/Locator.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -24,7 +24,7 @@ void Locator::setTransformAsExtents(double minX, double minY, double maxX, doubl _transform.set(maxX-minX, 0.0, 0.0, 0.0, 0.0, maxY-minY, 0.0, 0.0, 0.0, 0.0, maxZ-minZ, 0.0, - minX, minY, minZ, 1.0); + minX, minY, minZ, 1.0); _inverse.invert(_transform); @@ -103,7 +103,7 @@ bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::V topRight.y() = osg::maximum( topRight.y(), itr->y()); topRight.z() = osg::maximum( topRight.z(), itr->z()); } - + return true; } @@ -176,7 +176,7 @@ bool Locator::computeLocalBounds(osg::Vec3d& bottomLeft, osg::Vec3d& topRight) c topRight.y() = osg::maximum( topRight.y(), itr->y()); topRight.z() = osg::maximum( topRight.z(), itr->z()); } - + return true; } diff --git a/src/osgVolume/Property.cpp b/src/osgVolume/Property.cpp index b634d6358..191dc9bda 100644 --- a/src/osgVolume/Property.cpp +++ b/src/osgVolume/Property.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -133,7 +133,7 @@ AlphaFuncProperty::AlphaFuncProperty(const AlphaFuncProperty& afp,const osg::Cop void AlphaFuncProperty::setValue(float v) { - _uniform->set(v); + _uniform->set(v); _alphaFunc->setReferenceValue(v); } @@ -218,7 +218,7 @@ PropertyVisitor::PropertyVisitor(bool traverseOnlyActiveChildren): } void PropertyVisitor::apply(CompositeProperty& cp) -{ +{ for(unsigned int i=0; iaccept(*this); @@ -226,7 +226,7 @@ void PropertyVisitor::apply(CompositeProperty& cp) } void PropertyVisitor::apply(SwitchProperty& sp) -{ +{ if (_traverseOnlyActiveChildren) { if (sp.getActiveProperty()>=0 && sp.getActiveProperty()(sp.getNumProperties())) @@ -268,12 +268,12 @@ void CollectPropertiesVisitor::apply(TransparencyProperty& tp) { _transparencyPr class CycleSwitchVisitor : public osgVolume::PropertyVisitor { public: - + CycleSwitchVisitor(int delta): PropertyVisitor(false), _delta(delta), _switchModified(true) {} - + virtual void apply(SwitchProperty& sp) { if (sp.getNumProperties()>=2) @@ -289,7 +289,7 @@ class CycleSwitchVisitor : public osgVolume::PropertyVisitor { sp.setActiveProperty(0); } - + _switchModified = true; } else // _delta<0 @@ -307,10 +307,10 @@ class CycleSwitchVisitor : public osgVolume::PropertyVisitor _switchModified = true; } } - + PropertyVisitor::apply(sp); } - + int _delta; bool _switchModified; }; @@ -354,7 +354,7 @@ bool PropertyAdjustmentCallback::handle(const osgGA::GUIEventAdapter& ea,osgGA:: property->accept(cpv); bool passOnUpdates = false; - + switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::MOVE): @@ -394,7 +394,7 @@ bool PropertyAdjustmentCallback::handle(const osgGA::GUIEventAdapter& ea,osgGA:: { float v = (ea.getY()-ea.getYmin())/(ea.getYmax()-ea.getYmin()); if (ea.getMouseYOrientation()==osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS) v = 1.0f-v; - + float v2 = v*v; float v4 = v2*v2; diff --git a/src/osgVolume/RayTracedTechnique.cpp b/src/osgVolume/RayTracedTechnique.cpp index ab0fac8de..b102b4130 100644 --- a/src/osgVolume/RayTracedTechnique.cpp +++ b/src/osgVolume/RayTracedTechnique.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -229,7 +229,7 @@ void RayTracedTechnique::init() texture3D->setWrap(osg::Texture3D::WRAP_S,osg::Texture3D::CLAMP_TO_BORDER); texture3D->setWrap(osg::Texture3D::WRAP_T,osg::Texture3D::CLAMP_TO_BORDER); texture3D->setBorderColor(osg::Vec4(0.0,0.0,0.0,0.0)); - if (image_3d->getPixelFormat()==GL_ALPHA || + if (image_3d->getPixelFormat()==GL_ALPHA || image_3d->getPixelFormat()==GL_LUMINANCE) { texture3D->setInternalFormatMode(osg::Texture3D::USE_USER_DEFINED_FORMAT); @@ -303,7 +303,7 @@ void RayTracedTechnique::init() } else - { + { osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_mip.frag"); if (fragmentShader) { @@ -337,12 +337,12 @@ void RayTracedTechnique::init() } } else - { + { osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_iso.frag"); if (fragmentShader) { OSG_INFO<<"Shader found"<addShader(fragmentShader); } else @@ -353,7 +353,7 @@ void RayTracedTechnique::init() program->addShader(new osg::Shader(osg::Shader::FRAGMENT, volume_iso_frag)); } } - } + } else if (shadingModel==Light) { enableBlending = true; @@ -373,7 +373,7 @@ void RayTracedTechnique::init() } else - { + { osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_lit.frag"); if (fragmentShader) { @@ -489,7 +489,7 @@ void RayTracedTechnique::init() drawElements->push_back(1); drawElements->push_back(2); drawElements->push_back(3); - + // bottom drawElements->push_back(3); drawElements->push_back(2); @@ -524,7 +524,7 @@ void RayTracedTechnique::init() geode->addDrawable(geom); - } + } if (cpv._sampleDensityWhenMovingProperty.valid()) { @@ -599,8 +599,8 @@ void RayTracedTechnique::traverse(osg::NodeVisitor& nv) { update(uv); return; - } - + } + } else if (nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR) { @@ -613,12 +613,12 @@ void RayTracedTechnique::traverse(osg::NodeVisitor& nv) } - if (_volumeTile->getDirty()) + if (_volumeTile->getDirty()) { OSG_INFO<<"******* Doing init ***********"<init(); } } - + } // end of osgVolume namespace diff --git a/src/osgVolume/Version.cpp b/src/osgVolume/Version.cpp index 84584aa93..fce51dc1d 100644 --- a/src/osgVolume/Version.cpp +++ b/src/osgVolume/Version.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgVolume/Volume.cpp b/src/osgVolume/Volume.cpp index 3138708d4..6880cfed8 100644 --- a/src/osgVolume/Volume.cpp +++ b/src/osgVolume/Volume.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -36,7 +36,7 @@ Volume::~Volume() { const_cast(*itr)->_volume = 0; } - + _volumeTileSet.clear(); _volumeTileMap.clear(); } @@ -52,7 +52,7 @@ VolumeTile* Volume::getVolumeTile(const TileID& tileID) VolumeTileMap::iterator itr = _volumeTileMap.find(tileID); if (itr != _volumeTileMap.end()) return 0; - + return itr->second; } @@ -62,7 +62,7 @@ const VolumeTile* Volume::getVolumeTile(const TileID& tileID) const VolumeTileMap::const_iterator itr = _volumeTileMap.find(tileID); if (itr != _volumeTileMap.end()) return 0; - + return itr->second; } @@ -84,12 +84,12 @@ void Volume::registerVolumeTile(VolumeTile* volumeTile) if (!volumeTile) return; OpenThreads::ScopedLock lock(_mutex); - + if (volumeTile->getTileID().valid()) { _volumeTileMap[volumeTile->getTileID()] = volumeTile; } - + _volumeTileSet.insert(volumeTile); if (_volumeTileSet.size() > s_maxNumVolumeTiles) s_maxNumVolumeTiles = _volumeTileSet.size(); @@ -107,7 +107,7 @@ void Volume::unregisterVolumeTile(VolumeTile* volumeTile) { _volumeTileMap.erase(volumeTile->getTileID()); } - + _volumeTileSet.erase(volumeTile); // OSG_NOTICE<<"Volume::unregisterVolumeTile "<requiresUpdateTraversal()) { @@ -143,9 +143,9 @@ void VolumeTile::init() if (_volumeTechnique.valid() && getDirty()) { _volumeTechnique->init(); - + setDirty(false); - } + } } void VolumeTile::setLayer(Layer* layer) @@ -155,23 +155,23 @@ void VolumeTile::setLayer(Layer* layer) void VolumeTile::setVolumeTechnique(VolumeTechnique* volumeTechnique) { - if (_volumeTechnique == volumeTechnique) return; + if (_volumeTechnique == volumeTechnique) return; int dirtyDelta = _dirty ? -1 : 0; - if (_volumeTechnique.valid()) + if (_volumeTechnique.valid()) { _volumeTechnique->_volumeTile = 0; } _volumeTechnique = volumeTechnique; - - if (_volumeTechnique.valid()) + + if (_volumeTechnique.valid()) { _volumeTechnique->_volumeTile = this; - ++dirtyDelta; + ++dirtyDelta; } - + if (dirtyDelta>0) setDirty(true); else if (dirtyDelta<0) setDirty(false); } @@ -186,7 +186,7 @@ void VolumeTile::setDirty(bool dirty) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } - else if (getNumChildrenRequiringUpdateTraversal()>0) + else if (getNumChildrenRequiringUpdateTraversal()>0) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } @@ -195,7 +195,7 @@ void VolumeTile::setDirty(bool dirty) osg::BoundingSphere VolumeTile::computeBound() const { const Locator* masterLocator = getLocator(); - if (_layer.valid() && !masterLocator) + if (_layer.valid() && !masterLocator) { masterLocator = _layer->getLocator(); } diff --git a/src/osgWidget/Box.cpp b/src/osgWidget/Box.cpp index 15e425a14..a94fba611 100644 --- a/src/osgWidget/Box.cpp +++ b/src/osgWidget/Box.cpp @@ -111,7 +111,7 @@ void Box::_resizeImplementation(point_type w, point_type h) { widget->setOrigin(xoff, 0.0f); // Immediately reset our xoff for the next iteration. - if(_uniform) { + if(_uniform) { _positionWidget(widget, maxWidth, maxHeight); xadd = maxWidth; @@ -178,7 +178,7 @@ Window::Sizes Box::_getHeightImplementation() const { _getMaxWidgetHeightTotal() * size(), _getMaxWidgetMinHeightTotal() * size() ); - + else return Sizes( _accumulate(&Widget::getHeightTotal), _accumulate(&Widget::getMinHeightTotal) diff --git a/src/osgWidget/Browser.cpp b/src/osgWidget/Browser.cpp index 2fc286237..1b92ee989 100644 --- a/src/osgWidget/Browser.cpp +++ b/src/osgWidget/Browser.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -57,7 +57,7 @@ Browser::Browser(const std::string& url, const GeometryHints& hints) bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints) { if (!browserImage) return false; - + _browserImage = browserImage; bool flip = _browserImage->getOrigin()==osg::Image::TOP_LEFT; @@ -66,7 +66,7 @@ bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints) osg::Vec3 widthVec(hints.widthVec); osg::Vec3 heightVec(hints.heightVec); - + switch(hints.aspectRatioPolicy) { case(GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO): @@ -79,7 +79,7 @@ bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints) // no need to adjust aspect ratio break; } - + osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(hints.position, widthVec, heightVec, 0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f); diff --git a/src/osgWidget/Canvas.cpp b/src/osgWidget/Canvas.cpp index 7040cf2d6..49122c6e3 100644 --- a/src/osgWidget/Canvas.cpp +++ b/src/osgWidget/Canvas.cpp @@ -22,7 +22,7 @@ bool Canvas::addWidget(Widget* widget, point_type x, point_type y) { if(!widget) return false; widget->setOrigin(x, y); - + return Window::addWidget(widget); } diff --git a/src/osgWidget/Frame.cpp b/src/osgWidget/Frame.cpp index e1d04ccb8..ff1353b64 100644 --- a/src/osgWidget/Frame.cpp +++ b/src/osgWidget/Frame.cpp @@ -71,7 +71,7 @@ bool Frame::Corner::mouseDrag(double x, double y, const WindowManager* wm) } parent->update(); - + return true; } @@ -84,7 +84,7 @@ _border (border) Frame::Border::Border(const Border& border, const osg::CopyOp& co): Widget (border, co), -_border (border._border) +_border (border._border) { } @@ -110,7 +110,7 @@ void Frame::Border::positioned() point_type h = getHeight(); if(_border == BORDER_LEFT) setTexCoordRegion(w * 3, 0.0f, w, h); - + else if(_border == BORDER_RIGHT) setTexCoordRegion(w * 4, 0.0f, w, h); else if(_border == BORDER_TOP) { @@ -140,7 +140,7 @@ void Frame::Border::positioned() bool Frame::Border::mouseDrag(double x, double y, const WindowManager* wm) { Frame* parent = dynamic_cast(getParent()); - + if(!parent) return false; if(_border == BORDER_TOP && parent->canMove()) parent->addOrigin(x, y); @@ -209,13 +209,13 @@ Frame* Frame::createSimpleFrame( Frame* exFrame ) { Frame* frame = 0; - + // Use an "existing frame" if we have it (for example, if you've in inherited from // Frame and want to use this stuff. if(!exFrame) frame = new Frame(name, flags); else frame = exFrame; - + frame->addWidget(new Corner(CORNER_LOWER_LEFT, cw, ch), 0, 0); frame->addWidget(new Border(BORDER_BOTTOM, w, ch), 0, 1); frame->addWidget(new Corner(CORNER_LOWER_RIGHT, cw, ch), 0, 2); @@ -320,7 +320,7 @@ Frame* Frame::createSimpleFrameWithSingleTexture( // frame->getEmbeddedWindow()->setTexCoordRegion(cw, ch, tw - (cw * 2.0f), th - (ch * 2.0f)); } - else + else { OSG_WARN << "createSimpleFrameWithSingleTexture with a null image, the frame " << name << " will be use texture" << std::endl; } @@ -339,7 +339,7 @@ bool Frame::resizeFrame(point_type w, point_type h) { return resize( left->getWidth() + right->getWidth() + w, top->getHeight() + bottom->getHeight() + h - ); + ); } @@ -359,7 +359,7 @@ Frame* Frame::createSimpleFrameFromTheme( frame = createSimpleFrameWithSingleTexture(name, natifImage.get(), width, height, flags, exFrame); - if (frame && image && natifImage.valid()) + if (frame && image && natifImage.valid()) { const unsigned int bpps = image->getPixelSizeInBits() / 8; const unsigned int one_third_s = image->s()/3; @@ -388,10 +388,10 @@ template void copyDataImpl(const osg::Image* source, const unsigned int x1, const unsigned int y1, const unsigned int x2, const unsigned int y2, - osg::Image* destination, + osg::Image* destination, const unsigned int xd = 0, const unsigned int yd = 0) { - if ((unsigned int)destination->s() >= xd + (x2 - x1) && + if ((unsigned int)destination->s() >= xd + (x2 - x1) && (unsigned int)destination->t() >= yd + (y2 - y1)) { const unsigned int bpps = source->getPixelSizeInBits() / (8 * sizeof(T)); @@ -403,7 +403,7 @@ void copyDataImpl(const osg::Image* source, { for (unsigned int x = 0; x < x2 - x1; ++x) { - for (unsigned int d = 0; d < bpps; d++) + for (unsigned int d = 0; d < bpps; d++) { T v = srcdata[(y + y1) * source->s() * bpps + (x + x1) * bpps + d]; dstdata[(yd + y) * destination->s() * bpps + (xd + x) * bpps + d] = v; @@ -415,21 +415,21 @@ void copyDataImpl(const osg::Image* source, assert(false && "copyDataImpl: Incorrect image dimensions."); } -/** Copies a rectangle of corners (x1, y1), (x2, y2) from an image into +/** Copies a rectangle of corners (x1, y1), (x2, y2) from an image into another image starting at position (xd, yd). No scaling is done, the - pixels are just copied, so the destination image must be at least + pixels are just copied, so the destination image must be at least (xd + (x2 - x1)) by (yd + (y2 - y1)) pixels. */ void copyData(const osg::Image* source, - const unsigned int x1, const unsigned int y1, + const unsigned int x1, const unsigned int y1, const unsigned int x2, const unsigned int y2, - osg::Image* destination, + osg::Image* destination, const unsigned int xd, const unsigned int yd) { if (source->getDataType() == destination->getDataType()) { if (source->getDataType() == GL_UNSIGNED_BYTE) { - copyDataImpl(source, x1, y1, x2, y2, + copyDataImpl(source, x1, y1, x2, y2, destination, xd, yd); } else @@ -541,7 +541,7 @@ osg::Image* createNatifEdgeImageFromTheme(osg::Image* theme) OSG_WARN << "width and height are different, bad format theme image " << theme->getFileName() << std::endl; return 0; } - + // check size int ceilvalue = static_cast(ceil(s * 1.0 / 3)); int intvalue = s/3; diff --git a/src/osgWidget/Input.cpp b/src/osgWidget/Input.cpp index 55d181479..7b5658830 100644 --- a/src/osgWidget/Input.cpp +++ b/src/osgWidget/Input.cpp @@ -103,7 +103,7 @@ void Input::_calculateCursorOffsets() { _offsets.resize(_text->getText().size()+1, 0.0f); _widths.resize(_text->getText().size()+1, 1.0f); - if (_text->getText().size()==0) + if (_text->getText().size()==0) { _offsets[0] = 0; _widths[0] = 1.f; @@ -128,7 +128,7 @@ void Input::_calculateCursorOffsets() { glyphs.push_back(gq.getGlyphs().at(i)); } } - + std::list keys; for (unsigned int i=0; i<_text->getText().size(); ++i) { @@ -248,7 +248,7 @@ void Input::positioned() } else { - // We're at the end of the string, perhaps the string is empty, + // We're at the end of the string, perhaps the string is empty, // so get the advance for any character, perhaps a large one, I chose 'A'. osgText::Glyph* glyph = const_cast(_text->getFont())->getGlyph(osgText::FontResolution(_text->getFontWidth(), _text->getFontHeight()), 'A'); _cursor->setSize(glyph->getHorizontalAdvance(), getHeight()); @@ -297,7 +297,7 @@ bool Input::mouseDrag (double x, double y, const WindowManager*) if ((x >= offset1 && x <= offset2) || i == _offsets.size() - 1) // If we're at the last one, obviously it will be there. { - _selectionEndIndex = _index = i; + _selectionEndIndex = _index = i; positioned(); break; } @@ -310,9 +310,9 @@ bool Input::mousePush (double x, double y, const WindowManager* wm) { double offset = getOrigin().x(); Window* window = getParent(); - if (window) - { - offset += window->getOrigin().x(); + if (window) + { + offset += window->getOrigin().x(); } x -= offset; @@ -325,7 +325,7 @@ bool Input::mousePush (double x, double y, const WindowManager* wm) if ((x >= offset1 && x <= offset2) || i == _offsets.size() - 1) // If we're at the last one, obviously it will be there. { - _selectionStartIndex = _selectionEndIndex = _index = i; + _selectionStartIndex = _selectionEndIndex = _index = i; positioned(); break; } diff --git a/src/osgWidget/Lua.cpp b/src/osgWidget/Lua.cpp index 3fa9c7d9c..9def84f2a 100644 --- a/src/osgWidget/Lua.cpp +++ b/src/osgWidget/Lua.cpp @@ -43,7 +43,7 @@ int newWindow(lua_State* L) { int newWidget(lua_State* L) { osg::ref_ptr w = new Widget("testLUA", 0.0f, 0.0f); - + lua_pushstring(L, w->getName().c_str()); return 1; @@ -94,7 +94,7 @@ bool LuaEngine::initialize() { _data->lua = lua_open(); luaL_openlibs(_data->lua); - + static const struct luaL_reg library[] = { {"newWindow", lua::newWindow}, {"newWidget", lua::newWidget}, diff --git a/src/osgWidget/PdfReader.cpp b/src/osgWidget/PdfReader.cpp index 8dcb07b3a..9f928c84c 100644 --- a/src/osgWidget/PdfReader.cpp +++ b/src/osgWidget/PdfReader.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ PdfReader::PdfReader(const std::string& filename, const GeometryHints& hints) { open(filename, hints); } - + bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints) { if (!pdfImage) return false; @@ -39,7 +39,7 @@ bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints) osg::Vec3 widthVec(hints.widthVec); osg::Vec3 heightVec(hints.heightVec); - + switch(hints.aspectRatioPolicy) { case(GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO): @@ -52,7 +52,7 @@ bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints) // no need to adjust aspect ratio break; } - + osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(hints.position, widthVec, heightVec, 0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f); @@ -69,7 +69,7 @@ bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints) pictureQuad->setEventCallback(new osgViewer::InteractiveImageHandler(_pdfImage.get())); addDrawable(pictureQuad); - + return true; } @@ -82,20 +82,20 @@ bool PdfReader::open(const std::string& filename, const GeometryHints& hints) bool PdfReader::page(int pageNum) { if (!_pdfImage) return false; - + return _pdfImage->page(pageNum); } bool PdfReader::previous() { if (!_pdfImage) return false; - + return _pdfImage->previous(); } bool PdfReader::next() { if (!_pdfImage) return false; - + return _pdfImage->next(); } diff --git a/src/osgWidget/StyleManager.cpp b/src/osgWidget/StyleManager.cpp index faead0fb0..047ffc283 100644 --- a/src/osgWidget/StyleManager.cpp +++ b/src/osgWidget/StyleManager.cpp @@ -25,100 +25,100 @@ bool Style::applyStyle(Widget* widget, Reader r) { if(_match("pos %i %i", r) || _match("pos %f %f", r)) { r.readSequence(vec2); - + widget->setOrigin(vec2); } else if(_match("pos-x %i", r) || _match("pos-x %f", r)) { r.readSequence(f); - + widget->setX(f); } else if(_match("pos-y %i", r) || _match("pos-y %f", r)) { r.readSequence(f); - + widget->setY(f); } else if(_match("size %i %i", r) || _match("size %f %f", r)) { r.readSequence(vec2); - + widget->setSize(vec2); } else if(_match("width %i", r) || _match("width %f", r)) { r.readSequence(f); - + widget->setWidth(f); } else if(_match("height %i", r) || _match("height %f", r)) { r.readSequence(f); - + widget->setHeight(f); } // Color using 4x 0-255 integers. else if(_match("color %i %i %i %i", r)) { r.readSequence(vec4); - + widget->setColor(vec4 / 255.0f); } // Color using 3x 0-255 integers with a default alpha of 255. else if(_match("color %i %i %i", r)) { r.readSequence(vec3); - + widget->setColor(osg::Vec4(vec3[0], vec3[1], vec3[2], 255.0f) / 255.0f); } - + // Color using 4x 0.0f-1.0f floats. else if(_match("color %f %f %f %f", r)) { r.readSequence(vec4); - + widget->setColor(vec4); } // Color using 3x 0.0f-1.0f floats with a default alpha of 1.0f. else if(_match("color %f %f %f", r)) { r.readSequence(vec3); - + widget->setColor(osg::Vec4(vec3[0], vec3[1], vec3[2], 1.0f)); } // Set padding uniformly. else if(_match("padding %i", r)) { r.readSequence(f); - + widget->setPadding(f); } // Set left padding. else if(_match("padding-left %i", r)) { r.readSequence(f); - + widget->setPadLeft(f); } // Set right padding. else if(_match("padding-right %i", r)) { r.readSequence(f); - + widget->setPadRight(f); } // Set top padding. else if(_match("padding-top %i", r)) { r.readSequence(f); - + widget->setPadTop(f); } // Set bottom padding. else if(_match("padding-bottom %i", r)) { r.readSequence(f); - + widget->setPadBottom(f); } @@ -136,7 +136,7 @@ bool Style::applyStyle(Widget* widget, Reader r) { else if(_match("halign %w", r)) { r.readSequence(str); - + widget->setAlignHorizontal(strToHAlign(str)); } @@ -178,19 +178,19 @@ bool Style::applyStyle(Window* window, Reader r) { if(_match("pos %i %i", r) || _match("pos %f %f", r)) { r.readSequence(vec2); - + window->setOrigin(vec2.x(), vec2.y()); } else if(_match("pos-x %i", r) || _match("pos-x %f", r)) { r.readSequence(f); - + window->setX(f); } else if(_match("pos-y %i", r) || _match("pos-y %f", r)) { r.readSequence(f); - + window->setY(f); } @@ -202,13 +202,13 @@ bool Style::applyStyle(Window* window, Reader r) { else if(_match("width %i", r) || _match("width %f", r)) { r.readSequence(f); - + window->resize(f); } else if(_match("height %i", r) || _match("height %f", r)) { r.readSequence(f); - + window->resize(0.0f, f); } @@ -251,7 +251,7 @@ Widget::Layer Style::strToLayer(const std::string& layer) else if(l == "middle") return Widget::LAYER_MIDDLE; else if(l == "low") return Widget::LAYER_LOW; - + else if(l == "bg") return Widget::LAYER_BG; else { @@ -312,7 +312,7 @@ Widget::CoordinateMode Style::strToCoordMode(const std::string& coordmode) { bool Style::strToFill(const std::string& fill) { std::string cm = lowerCase(fill); - + if(cm == "true") return true; else if(cm == "false") return false; diff --git a/src/osgWidget/Table.cpp b/src/osgWidget/Table.cpp index a1240e541..19e4eff2b 100644 --- a/src/osgWidget/Table.cpp +++ b/src/osgWidget/Table.cpp @@ -81,7 +81,7 @@ void Table::_resizeImplementation(point_type width, point_type height) { for(unsigned int row = 0; row < _rows; row++) { point_type h = height / numRowFills; - + if(cur >= _lastRowAdd && hrem) { _lastRowAdd++; h++; @@ -147,7 +147,7 @@ Window::Sizes Table::_getWidthImplementation() const { getColumnWidths(cols); getColumnMinWidths(minCols); - + return Sizes( std::accumulate(cols.begin(), cols.end(), 0.0f, Plus()), std::accumulate(minCols.begin(), minCols.end(), 0.0f, Plus()) diff --git a/src/osgWidget/Util.cpp b/src/osgWidget/Util.cpp index 033de00bd..b693daae9 100644 --- a/src/osgWidget/Util.cpp +++ b/src/osgWidget/Util.cpp @@ -19,7 +19,7 @@ std::string getFilePath(const std::string& filename) { osgDB::FilePathList path; char* fp = getenv("OSGWIDGET_FILE_PATH"); - + osgDB::convertStringPathIntoFilePathList(fp ? fp : ".", path); return osgDB::findFileInPath(filename, path); @@ -27,11 +27,11 @@ std::string getFilePath(const std::string& filename) { std::string generateRandomName(const std::string& base) { static unsigned int count = 0; - + std::stringstream ss; ss << base << "_" << count; - + count++; return ss.str(); @@ -50,7 +50,7 @@ osg::Camera* createOrthoCamera(matrix_type width, matrix_type height) { camera->setViewMatrix(osg::Matrix::identity()); camera->setClearMask(GL_DEPTH_BUFFER_BIT); camera->setRenderOrder(osg::Camera::POST_RENDER); - + return camera; } diff --git a/src/osgWidget/ViewerEventHandlers.cpp b/src/osgWidget/ViewerEventHandlers.cpp index 1547ee9d3..fd2efc1ee 100644 --- a/src/osgWidget/ViewerEventHandlers.cpp +++ b/src/osgWidget/ViewerEventHandlers.cpp @@ -23,7 +23,7 @@ bool MouseHandler::handle( return (this->*ma)(gea.getX(), gea.getY(), gea.getButton()); } - + return false; } @@ -93,23 +93,23 @@ MouseHandler::MouseAction MouseHandler::_isMouseEvent( if(ev == osgGA::GUIEventAdapter::PUSH) return &MouseHandler::_handleMousePush ; - + else if(ev == osgGA::GUIEventAdapter::RELEASE) return &MouseHandler::_handleMouseRelease ; - + else if(ev == osgGA::GUIEventAdapter::DOUBLECLICK) return &MouseHandler::_handleMouseDoubleClick ; - + else if(ev == osgGA::GUIEventAdapter::DRAG) return &MouseHandler::_handleMouseDrag ; - + else if(ev == osgGA::GUIEventAdapter::MOVE) return &MouseHandler::_handleMouseMove ; - + else if(ev == osgGA::GUIEventAdapter::SCROLL) return &MouseHandler::_handleMouseScroll ; @@ -179,7 +179,7 @@ bool ResizeHandler::handle( _wm->setSize(w, h); } - + _wm->setWindowSize(w, h); _wm->resizeAllWindows(); diff --git a/src/osgWidget/VncClient.cpp b/src/osgWidget/VncClient.cpp index 65ffae8d9..2032c07ae 100644 --- a/src/osgWidget/VncClient.cpp +++ b/src/osgWidget/VncClient.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ VncClient::VncClient(const std::string& hostname, const GeometryHints& hints) bool VncClient::assign(VncImage* vncImage, const GeometryHints& hints) { if (!vncImage) return false; - + _vncImage = vncImage; bool flip = _vncImage->getOrigin()==osg::Image::TOP_LEFT; @@ -34,7 +34,7 @@ bool VncClient::assign(VncImage* vncImage, const GeometryHints& hints) osg::Vec3 widthVec(hints.widthVec); osg::Vec3 heightVec(hints.heightVec); - + switch(hints.aspectRatioPolicy) { case(GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO): @@ -47,7 +47,7 @@ bool VncClient::assign(VncImage* vncImage, const GeometryHints& hints) // no need to adjust aspect ratio break; } - + osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(hints.position, widthVec, heightVec, 0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f); @@ -77,6 +77,6 @@ bool VncClient::connect(const std::string& hostname, const GeometryHints& hints) void VncClient::close() { if (!_vncImage) return; - + _vncImage->close(); } diff --git a/src/osgWidget/Widget.cpp b/src/osgWidget/Widget.cpp index 7d3e80fae..246949689 100644 --- a/src/osgWidget/Widget.cpp +++ b/src/osgWidget/Widget.cpp @@ -160,12 +160,12 @@ void Widget::setDimensions(point_type x, point_type y, point_type w, point_type // valid, however. if(_coordMode == CM_RELATIVE) { XYCoord size; - + if(_parent) size = _parent->getSize(); if(x >= 0.0f && x <= 1.0f) { _relCoords[0] = x; - + x = size.x() * x; } @@ -174,16 +174,16 @@ void Widget::setDimensions(point_type x, point_type y, point_type w, point_type y = size.y() * y; } - + if(w >= 0.0f && w <= 1.0f) { _relCoords[2] = w; - + w = size.x() * w; } - + if(h >= 0.0f && h <= 1.0f) { _relCoords[3] = h; - + h = size.y() * h; } } @@ -217,7 +217,7 @@ void Widget::setColor(color_type r, color_type g, color_type b, color_type a, Co void Widget::addColor(color_type r, color_type g, color_type b, color_type a, Corner p) { ColorArray* cols = _cols(); - + if(p == ALL_CORNERS) { (*cols)[LL] += Color(r, g, b, a); (*cols)[LR] += Color(r, g, b, a); @@ -263,7 +263,7 @@ void Widget::setTexCoordRegion(point_type x, point_type y, point_type w, point_t XYCoord t(x / tw, y / tw); (*texs)[LL] = t; - + // Set the LOWER_RIGHT point. t += XYCoord(w / tw, 0.0f); @@ -297,7 +297,7 @@ void Widget::setTexCoordWrapVertical() { osg::Texture* texture = _texture(); if(!image || !texture || image->t() == 0.0f) return; - + texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT); setTexCoord(0.0f, getHeight() / image->t(), UPPER_LEFT); @@ -318,11 +318,11 @@ bool Widget::setImage(osg::Image* image, bool setTexCoords, bool useTextRect) { } osg::Texture* texture = 0; - + if(useTextRect) texture = new osg::TextureRectangle(); - + else texture = new osg::Texture2D(); - + if(!texture) return false; texture->setImage(0, image); @@ -431,19 +431,19 @@ void Widget::addSize(point_type w, point_type h) { MACRO_WIDGET_H(verts) + h ); } - + else setDimensions(-1.0f, -1.0f, _relCoords[2] + w, _relCoords[3] + h); } point_type Widget::getWidth() const { const PointArray* verts = _verts(); - + return MACRO_WIDGET_W(verts); } point_type Widget::getHeight() const { const PointArray* verts = _verts(); - + return MACRO_WIDGET_H(verts); } @@ -512,14 +512,14 @@ Color Widget::getImageColorAtXY(point_type x, point_type y) const { point_type X = ((x / getWidth()) * width) + (*texs)[LL].x(); point_type Y = (((getHeight() - y) / getHeight()) * height) + (*texs)[UR].y(); - + return image->getColor(TexCoord(X, Y)); } bool Widget::isPaddingUniform() const { return _padLeft == _padRight && - _padLeft == _padTop && + _padLeft == _padTop && _padLeft == _padBottom ; } diff --git a/src/osgWidget/Window.cpp b/src/osgWidget/Window.cpp index a729f41b4..ac594bdd3 100644 --- a/src/osgWidget/Window.cpp +++ b/src/osgWidget/Window.cpp @@ -12,7 +12,7 @@ bool callbackWindowMove(Event& ev) { ev.getWindow()->addOrigin(ev.x, ev.y); ev.getWindow()->update(); - + return true; } @@ -21,7 +21,7 @@ bool callbackWindowRotate(Event& ev) { ev.getWindow()->addRotate(ev.y); ev.getWindow()->update(); - + return true; } @@ -30,13 +30,13 @@ bool callbackWindowScale(Event& ev) { ev.getWindow()->addScale(ev.y); ev.getWindow()->update(); - + return true; } bool callbackWindowTabFocus(Event& ev) { if(!ev.getWindow() || ev.key != osgGA::GUIEventAdapter::KEY_Tab) return false; - + return ev.getWindow()->setNextFocusable(); } @@ -64,7 +64,7 @@ void Window::EmbeddedWindow::parented(Window* parent) { else warn() << "EmbeddedWindow Widget [" << _name << "] cannot embed itself in Window [" << _window->getName() - << "], since it is already a child of [" << _window->_parent->getName() + << "], since it is already a child of [" << _window->_parent->getName() << "]" << std::endl ; } @@ -302,7 +302,7 @@ bool Window::resizePercent(point_type width, point_type height) { _wm->getWidth() * (width / 100.0f), _wm->getHeight() * (height / 100.0f) ); - + else return resize( _parent->getWidth() * (width / 100.0f), _parent->getHeight() * (height / 100.0f) @@ -332,7 +332,7 @@ void Window::update() { xy.set(x, y); } - + matrix_type z = _z; // We can't do proper scissoring until we have access to our parent WindowManager, and @@ -412,11 +412,11 @@ void Window::_setWidthAndHeight() { if(_height.minimum < 0.0f) _setWidthAndHeightUnknownSizeError("minimum height", _height.minimum); if(hasDecimal(_width.current)) _setWidthAndHeightNotPAError("current width", _width.current); - + if(hasDecimal(_width.minimum)) _setWidthAndHeightNotPAError("minimum width", _width.minimum); - + if(hasDecimal(_height.current)) _setWidthAndHeightNotPAError("current height", _height.current); - + if(hasDecimal(_height.minimum)) _setWidthAndHeightNotPAError("minimum height", _height.minimum); } @@ -437,7 +437,7 @@ void Window::_removeFromGeode(Widget* widget) { bool Window::_setWidget(Widget* widget, int index) { if(!widget) { warn() << "Window [" << _name << "] called addWidget with NULL." << std::endl; - + return false; } @@ -480,7 +480,7 @@ bool Window::_setWidget(Widget* widget, int index) { widget->_index = geode->getNumDrawables(); geode->addDrawable(widget); - + _setParented(widget); _setManaged(widget); _setStyled(widget); @@ -531,7 +531,7 @@ void Window::_setStyled(Widget* widget) { void Window::_setParented(Widget* widget, bool setUnparented) { if(!widget) return; - + if(!setUnparented) { widget->_parent = this; @@ -547,7 +547,7 @@ void Window::_setParented(Widget* widget, bool setUnparented) { void Window::_setManaged(Widget* widget, bool setUnmanaged) { if(!widget || !_wm) return; - + // Tell the widget it's managed if it isn't already... if(!setUnmanaged) { if(widget->_isManaged) return; @@ -675,7 +675,7 @@ bool Window::setFocused(const Widget* widget) { for(WindowList::iterator w = wl.begin(); w != wl.end(); w++) { ConstIterator ii = std::find(w->get()->begin(), w->get()->end(), widget); - + if(ii != w->get()->end()) { found = true; i = ii; @@ -736,7 +736,7 @@ bool Window::setFocused(const std::string& name) { } _setFocused(w1); - + return true; } @@ -1021,7 +1021,7 @@ point_type Window::_getNumFill(int begin, int end, int add) const { Window::Sizes Window::_getWidthImplementation() const { osg::BoundingBox bb = getGeode()->getBoundingBox(); - + point_type w = osg::round(bb.xMax() - bb.xMin()); return Sizes(w, 0.0f); diff --git a/src/osgWidget/WindowManager.cpp b/src/osgWidget/WindowManager.cpp index ea605ad2a..0c1a6659d 100644 --- a/src/osgWidget/WindowManager.cpp +++ b/src/osgWidget/WindowManager.cpp @@ -59,7 +59,7 @@ _styleManager (new StyleManager()) { // Setup our picking debug (is debug the right word here?) Window... if(_flags & WM_PICK_DEBUG) { _pickWindow = new Box("PickWindow", Box::VERTICAL); - + Label* label = new Label("PickLabel"); label->setFontSize(13); @@ -113,7 +113,7 @@ WindowManager::WindowManager(const WindowManager& wm, const osg::CopyOp& co): WindowManager::~WindowManager() { if(_flags & WM_USE_LUA) _lua->close(); - + if(_flags & WM_USE_PYTHON) _python->close(); } @@ -152,7 +152,7 @@ bool WindowManager::_handleMousePushed(float x, float y, bool& down) { Window* topmostWindow = ev._window->getTopmostParent(); setFocused(topmostWindow); - + if(ev._widget) topmostWindow->setFocused(ev._widget); } @@ -271,7 +271,7 @@ void WindowManager::childInserted(unsigned int i) { _styleManager->applyStyles(window); } - + void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) { for (unsigned int i = start; i < start+numChildren; i++) { @@ -280,7 +280,7 @@ void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) { if(!window) continue; if(_remove(window)) { - + window->_index = 0; window->unmanaged(this); } @@ -343,7 +343,7 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) { } if(_flags & WM_PICK_DEBUG) _updatePickWindow(0, x, y); - + return false; } @@ -383,7 +383,7 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) { for(WindowVector::iterator i = windows.begin(); i != windows.end(); i++) { warn() << "- " << i->get()->getName() << " " << i->get()->getOrCreateStateSet()->getBinNumber() << std::endl; } - + warn() << std::endl; return false; @@ -394,7 +394,7 @@ bool WindowManager::setFocused(Window* window) { Event ev(this); ev._window = window; - + // Inform the previously focused Window that it is going to be unfocused. if(_focused.valid()) _focused->callMethodAndCallbacks(ev.makeType(EVENT_UNFOCUS)); @@ -414,7 +414,7 @@ bool WindowManager::setFocused(Window* window) { if(w->getStrata() == Window::STRATA_FOREGROUND) fg.push_back(w); else if(w->getStrata() == Window::STRATA_BACKGROUND) bg.push_back(w); - + else focusable.push_back(w); } @@ -450,14 +450,14 @@ bool WindowManager::setFocused(Window* window) { // Handled our special BACKGROUND Windows. for(Iterator w = bg.begin(); w != bg.end(); w++) w->get()->_z = -zRange * i; - + // Handle our special FOREGOUND Windows. for(Iterator w = fg.begin(); w != fg.end(); w++) w->get()->_z = -zRange; - + // Update every window, regardless. for(Iterator w = begin(); w != end(); w++) { Window* win = w->get(); - + win->_zRange = zRange; win->update(); @@ -477,7 +477,7 @@ void WindowManager::setPointerXY(float x, float y) { // If ydiff isn't NEAR 0 (floating point booleans aren't 100% reliable, but that // doesn't matter in our case), assume we have either up or down movement. if(ydiff != 0.0f) _lastVertical = ydiff > 0.0f ? PD_UP : PD_DOWN; - + else _lastVertical = PD_NONE; // If xdiff isn't 0, assume we have either left or right movement. @@ -508,7 +508,7 @@ void WindowManager::setStyleManager(StyleManager* sm) { void WindowManager::resizeAllWindows(bool visible) { for(Iterator i = begin(); i != end(); i++) if(i->valid()) { if(visible && !getValue(i->get()->_index)) continue; - + i->get()->resize(); } } @@ -556,7 +556,7 @@ bool WindowManager::pointerMove(float x, float y) { Event evLeave(this); evLeave.makeMouse(x, y, EVENT_MOUSE_LEAVE); - + setEventFromInterface(evLeave, _lastEvent); _lastEvent->callMethodAndCallbacks(evLeave); diff --git a/src/osgWrappers/deprecated-dotosg/osg/AnimationPath.cpp b/src/osgWrappers/deprecated-dotosg/osg/AnimationPath.cpp index f473e846d..9a109cf81 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/AnimationPath.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/AnimationPath.cpp @@ -32,8 +32,8 @@ bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr) { osg::AnimationPath *ap = dynamic_cast(&obj); if (!ap) return false; - - + + bool itAdvanced = false; if (fr[0].matchWord("LoopMode")) @@ -42,20 +42,20 @@ bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr) { ap->setLoopMode(AnimationPath::SWING); fr += 2; - itAdvanced = true; + itAdvanced = true; } else if (fr[1].matchWord("LOOP")) { ap->setLoopMode(AnimationPath::LOOP); fr += 2; - itAdvanced = true; - } + itAdvanced = true; + } else if (fr[1].matchWord("NO_LOOPING")) { ap->setLoopMode(AnimationPath::NO_LOOPING); fr += 2; - itAdvanced = true; - } + itAdvanced = true; + } } @@ -65,24 +65,24 @@ bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr) int entry = fr[0].getNoNestedBrackets(); fr += 2; - + double time; Vec3d position,scale; Quat rotation; - + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) { if (fr[0].getFloat(time) && - fr[1].getFloat(position[0]) && - fr[2].getFloat(position[1]) && + fr[1].getFloat(position[0]) && + fr[2].getFloat(position[1]) && fr[3].getFloat(position[2]) && - fr[4].getFloat(rotation[0]) && - fr[5].getFloat(rotation[1]) && + fr[4].getFloat(rotation[0]) && + fr[5].getFloat(rotation[1]) && fr[6].getFloat(rotation[2]) && fr[7].getFloat(rotation[3]) && - fr[8].getFloat(scale[0]) && - fr[9].getFloat(scale[1]) && + fr[8].getFloat(scale[0]) && + fr[9].getFloat(scale[1]) && fr[10].getFloat(scale[2])) { @@ -90,8 +90,8 @@ bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr) osg::AnimationPath::ControlPoint ctrlPoint(position,rotation,scale); ap->insert(time, ctrlPoint); - fr+=11; - } + fr+=11; + } else fr.advanceOverCurrentFieldOrBlock(); } @@ -99,7 +99,7 @@ bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } - + return itAdvanced; } @@ -132,7 +132,7 @@ bool AnimationPath_writeLocalData(const osg::Object &obj, osgDB::Output &fw) fw.precision(15); for (AnimationPath::TimeControlPointMap::const_iterator itr=tcpm.begin(); - itr!=tcpm.end(); + itr!=tcpm.end(); ++itr) { fw.indent() << itr->first << " " << itr->second.getPosition() << " " << itr->second.getRotation() << " " <second.getScale() << std::endl; @@ -170,27 +170,27 @@ bool AnimationPathCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) if (!apc) return false; bool iteratorAdvanced = false; - + if (fr.matchSequence("pivotPoint %f %f %f")) { osg::Vec3 pivot; fr[1].getFloat(pivot[0]); fr[2].getFloat(pivot[1]); fr[3].getFloat(pivot[2]); - + apc->setPivotPoint(pivot); - + fr += 4; iteratorAdvanced = true; } - + if (fr.matchSequence("timeOffset %f")) { fr[1].getFloat(apc->_timeOffset); fr+=2; iteratorAdvanced = true; } - + else if(fr.matchSequence("timeMultiplier %f")) { fr[1].getFloat(apc->_timeMultiplier); @@ -206,7 +206,7 @@ bool AnimationPathCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) if (animpath) apc->setAnimationPath(animpath); iteratorAdvanced = true; } - + return iteratorAdvanced; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/AutoTransform.cpp b/src/osgWrappers/deprecated-dotosg/osg/AutoTransform.cpp index 0270bc1fb..aba623c85 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/AutoTransform.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/AutoTransform.cpp @@ -35,7 +35,7 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) fr[1].getFloat(pos[0]); fr[2].getFloat(pos[1]); fr[3].getFloat(pos[2]); - + transform.setPosition(pos); fr += 4; @@ -49,9 +49,9 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) fr[2].getFloat(att[1]); fr[3].getFloat(att[2]); fr[4].getFloat(att[3]); - + transform.setRotation(att); - + fr += 5; iteratorAdvanced = true; } @@ -62,7 +62,7 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) fr[1].getFloat(scale[0]); fr[2].getFloat(scale[1]); fr[3].getFloat(scale[2]); - + transform.setScale(scale); fr += 4; @@ -73,7 +73,7 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) { float scale; fr[1].getFloat(scale); - + transform.setMinimumScale(scale); fr += 2; @@ -84,7 +84,7 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) { float scale; fr[1].getFloat(scale); - + transform.setMaximumScale(scale); fr += 2; @@ -97,9 +97,9 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) fr[1].getFloat(pivot[0]); fr[2].getFloat(pivot[1]); fr[3].getFloat(pivot[2]); - + transform.setPivotPoint(pivot); - + fr += 4; iteratorAdvanced = true; } @@ -127,7 +127,7 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) if (w=="ROTATE_TO_SCREEN") transform.setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN); else if (w=="ROTATE_TO_CAMERA") transform.setAutoRotateMode(osg::AutoTransform::ROTATE_TO_CAMERA); else if (w=="NO_ROTATION") transform.setAutoRotateMode(osg::AutoTransform::NO_ROTATION); - + fr += 2; iteratorAdvanced = true; } @@ -140,12 +140,12 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } - if (fr.matchSequence("autoScaleTransistionWidthRatio %f") || + if (fr.matchSequence("autoScaleTransistionWidthRatio %f") || fr.matchSequence("autoScaleTransitionWidthRatio %f")) { float ratio; fr[1].getFloat(ratio); - + transform.setAutoScaleTransitionWidthRatio(ratio); fr += 2; @@ -167,8 +167,8 @@ bool AutoTransform_writeLocalData(const Object& obj, Output& fw) if (transform.getMinimumScale()>0.0) fw.indent()<<"minimumScale "<entry) { bool localAdvance = false; - if (fr.matchSequence("internalFormat %i")) + if (fr.matchSequence("internalFormat %i")) { // In their infinite wisdom, the Apple engineers changed the type // of GLenum from 'unsigned int' to 'unsigned long', thus breaking @@ -190,31 +190,31 @@ bool Camera_readLocalData(Object& obj, Input& fr) osg::Image* image = dynamic_cast(attribute.get()); attachment._image = image; } - + } - if (fr.matchSequence("level %i")) + if (fr.matchSequence("level %i")) { fr[1].getUInt(attachment._level); fr += 2; localAdvance = true; } - if (fr.matchSequence("face %i")) + if (fr.matchSequence("face %i")) { fr[1].getUInt(attachment._face); fr += 2; localAdvance = true; } - if (fr.matchSequence("mipMapGeneration TRUE")) + if (fr.matchSequence("mipMapGeneration TRUE")) { attachment._mipMapGeneration = true; fr += 2; localAdvance = true; } - if (fr.matchSequence("mipMapGeneration FALSE")) + if (fr.matchSequence("mipMapGeneration FALSE")) { attachment._mipMapGeneration = false; fr += 2; @@ -223,7 +223,7 @@ bool Camera_readLocalData(Object& obj, Input& fr) if (!localAdvance) ++fr; } - + iteratorAdvanced = true; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/CameraView.cpp b/src/osgWrappers/deprecated-dotosg/osg/CameraView.cpp index 15cdfad50..453ff9e84 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/CameraView.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/CameraView.cpp @@ -36,7 +36,7 @@ bool CameraView_readLocalData(Object& obj, Input& fr) fr[1].getFloat(pos[0]); fr[2].getFloat(pos[1]); fr[3].getFloat(pos[2]); - + cameraview.setPosition(pos); fr += 4; @@ -50,9 +50,9 @@ bool CameraView_readLocalData(Object& obj, Input& fr) fr[2].getFloat(att[1]); fr[3].getFloat(att[2]); fr[4].getFloat(att[3]); - + cameraview.setAttitude(att); - + fr += 5; iteratorAdvanced = true; } @@ -96,10 +96,10 @@ bool CameraView_readLocalData(Object& obj, Input& fr) bool CameraView_writeLocalData(const Object& obj, Output& fw) { const CameraView& cameraview = static_cast(obj); - + fw.indent()<<"position "<(es.getClearMask())<< std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osg/ClusterCullingCallback.cpp b/src/osgWrappers/deprecated-dotosg/osg/ClusterCullingCallback.cpp index 3f2d242ba..0a6684dd9 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/ClusterCullingCallback.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/ClusterCullingCallback.cpp @@ -23,13 +23,13 @@ REGISTER_DOTOSGWRAPPER(ClusterCullingCallback) bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) { ClusterCullingCallback* ccc = dynamic_cast(&obj); - if (!ccc) return false; + if (!ccc) return false; bool iteratorAdvanced = false; osg::Vec3 vec; if (fr[0].matchWord("controlPoint") && - fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2])) + fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2])) { ccc->setControlPoint(vec); fr += 4; @@ -37,7 +37,7 @@ bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) } if (fr[0].matchWord("normal") && - fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2])) + fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2])) { ccc->setNormal(vec); fr += 4; @@ -45,14 +45,14 @@ bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) } float value; - if (fr[0].matchWord("radius") && fr[1].getFloat(value)) + if (fr[0].matchWord("radius") && fr[1].getFloat(value)) { ccc->setRadius(value); fr += 2; iteratorAdvanced = true; } - if (fr[0].matchWord("deviation") && fr[1].getFloat(value)) + if (fr[0].matchWord("deviation") && fr[1].getFloat(value)) { ccc->setDeviation(value); fr += 2; @@ -65,7 +65,7 @@ bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) bool ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { const ClusterCullingCallback* ccc = dynamic_cast(&obj); - if (!ccc) return false; + if (!ccc) return false; int prec = fw.precision(); fw.precision(15); @@ -74,7 +74,7 @@ bool ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output fw.indent() << "normal " << ccc->getNormal() << std::endl; fw.indent() << "radius " << ccc->getRadius() << std::endl; fw.indent() << "deviation " << ccc->getDeviation() << std::endl; - + fw.precision(prec); return true; diff --git a/src/osgWrappers/deprecated-dotosg/osg/CompositeShape.cpp b/src/osgWrappers/deprecated-dotosg/osg/CompositeShape.cpp index 87257b5ab..434717981 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/CompositeShape.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/CompositeShape.cpp @@ -44,14 +44,14 @@ bool CompositeShape_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } } - + while((readObject=fr.readObjectOfType(type_wrapper())).valid()) { osg::Shape* shape = static_cast(readObject.get()); composite.addChild(shape); iteratorAdvanced = true; } - + return iteratorAdvanced; } @@ -64,7 +64,7 @@ bool CompositeShape_writeLocalData(const Object& obj, Output& fw) fw.indent() << "Shape "; fw.writeObject(*composite.getShape()); } - + for(unsigned int i=0;i s_ellipsoidModel = new EllipsoidModel; - + EllipsoidModel* em = static_cast(fr.readObjectOfType(*s_ellipsoidModel)); if (em) csn.setEllipsoidModel(em); @@ -60,8 +60,8 @@ bool CoordinateSystemNode_writeLocalData(const Object& obj, Output& fw) fw.indent()<<"Format "<(obj); - + Depth::Function func; if (fr[0].matchWord("function") && Depth_matchFuncStr(fr[1].getStr(),func)) { @@ -77,11 +77,11 @@ bool Depth_writeLocalData(const Object& obj,Output& fw) const Depth& depth = static_cast(obj); fw.indent() << "function " << Depth_getFuncStr(depth.getFunction()) << std::endl; - + fw.indent() << "writeMask "; if (depth.getWriteMask()) fw << "TRUE" << std::endl; else fw << "FALSE" << std::endl; - + fw.indent() << "range " << depth.getZNear() << " " << depth.getZFar() << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp b/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp index 84045119b..8499f1f62 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp @@ -114,7 +114,7 @@ bool Drawable_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } } - + if (fr[0].matchWord("useVertexBufferObjects")) { if (fr[1].matchWord("TRUE")) @@ -143,7 +143,7 @@ bool Drawable_writeLocalData(const Object& obj, Output& fw) { fw.writeObject(*drawable.getStateSet()); } - + if (drawable.getShape()) { fw.writeObject(*drawable.getShape()); @@ -168,20 +168,20 @@ bool Drawable_writeLocalData(const Object& obj, Output& fw) { fw.writeObject(*drawable.getDrawCallback()); } - - + + if (drawable.getInitialBound().valid()) { const osg::BoundingBox& bb = drawable.getInitialBound(); fw.indent()<<"initialBound "<(obj); fw.indent() << "num_drawables " << geode.getNumDrawables() << std::endl; - + for(unsigned int i=0;i0) primitives.reserve(capacity); - + fr += 3; - + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) { @@ -62,7 +62,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr) } ++fr; - + iteratorAdvanced = true; } @@ -114,7 +114,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } } - + if (fr[0].matchWord("VertexIndices")) { ++fr; @@ -291,7 +291,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr) { int unit=0; fr[1].getInt(unit); - + fr+=2; Array* texcoords = Array_readLocalData(fr); if (texcoords) @@ -299,14 +299,14 @@ bool Geometry_readLocalData(Object& obj, Input& fr) geom.setTexCoordArray(unit,texcoords); } iteratorAdvanced = true; - + } if (fr.matchSequence("TexCoordIndices %i")) { int unit=0; fr[1].getInt(unit); - + fr+=2; IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); if (indices) @@ -330,12 +330,12 @@ bool Geometry_readLocalData(Object& obj, Input& fr) { int unit=0; fr[1].getInt(unit); - - if (fr[2].matchString("TRUE")) + + if (fr[2].matchString("TRUE")) geom.setVertexAttribNormalize(unit,GL_TRUE); else geom.setVertexAttribNormalize(unit,GL_FALSE); - + fr+=3; iteratorAdvanced = true; } @@ -344,7 +344,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr) { int unit=0; fr[1].getInt(unit); - + fr+=2; Array* vertexattrib = Array_readLocalData(fr); if (vertexattrib) @@ -352,14 +352,14 @@ bool Geometry_readLocalData(Object& obj, Input& fr) geom.setVertexAttribArray(unit,vertexattrib); } iteratorAdvanced = true; - + } if (fr.matchSequence("VertexAttribIndices %i")) { int unit=0; fr[1].getInt(unit); - + fr+=2; IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); if (indices) @@ -785,12 +785,12 @@ Array* Array_readLocalData(Input& fr) ++fr; return_array = array; } - - if (return_array) + + if (return_array) { if (!uniqueID.empty()) fr.registerUniqueIDForObject(uniqueID.c_str(),return_array); } - + return return_array; } @@ -1004,16 +1004,16 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) { bool iteratorAdvanced = false; bool firstMatched = false; - if ((firstMatched = fr.matchSequence("DrawArrays %w %i %i %i")) || + if ((firstMatched = fr.matchSequence("DrawArrays %w %i %i %i")) || fr.matchSequence("DrawArrays %w %i %i") ) { - + GLenum mode; Geometry_matchPrimitiveModeStr(fr[1].getStr(),mode); int first; fr[2].getInt(first); - + int count; fr[3].getInt(count); @@ -1030,11 +1030,11 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) geom.addPrimitiveSet(new DrawArrays(mode, first, count, numInstances)); - + iteratorAdvanced = true; - + } - else if ((firstMatched = fr.matchSequence("DrawArrayLengths %w %i %i %i {")) || + else if ((firstMatched = fr.matchSequence("DrawArrayLengths %w %i %i %i {")) || fr.matchSequence("DrawArrayLengths %w %i %i {") ) { int entry = fr[1].getNoNestedBrackets(); @@ -1047,7 +1047,7 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) int capacity; fr[3].getInt(capacity); - + int numInstances = 0; if (firstMatched) { @@ -1075,12 +1075,12 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) } } ++fr; - + geom.addPrimitiveSet(prim); - + iteratorAdvanced = true; } - else if ((firstMatched = fr.matchSequence("DrawElementsUByte %w %i %i {")) || + else if ((firstMatched = fr.matchSequence("DrawElementsUByte %w %i %i {")) || fr.matchSequence("DrawElementsUByte %w %i {")) { int entry = fr[1].getNoNestedBrackets(); @@ -1090,7 +1090,7 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) int capacity; fr[2].getInt(capacity); - + int numInstances = 0; if (firstMatched) { @@ -1117,12 +1117,12 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) } } ++fr; - + geom.addPrimitiveSet(prim); - + iteratorAdvanced = true; } - else if ((firstMatched = fr.matchSequence("DrawElementsUShort %w %i %i {")) || + else if ((firstMatched = fr.matchSequence("DrawElementsUShort %w %i %i {")) || fr.matchSequence("DrawElementsUShort %w %i {")) { int entry = fr[1].getNoNestedBrackets(); @@ -1132,7 +1132,7 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) int capacity; fr[2].getInt(capacity); - + int numInstances = 0; if (firstMatched) { @@ -1143,7 +1143,7 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) { fr += 4; } - + DrawElementsUShort* prim = new DrawElementsUShort; prim->setMode(mode); prim->setNumInstances(numInstances); @@ -1159,12 +1159,12 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) } } ++fr; - + geom.addPrimitiveSet(prim); - + iteratorAdvanced = true; } - else if ((firstMatched = fr.matchSequence("DrawElementsUInt %w %i %i {")) || + else if ((firstMatched = fr.matchSequence("DrawElementsUInt %w %i %i {")) || fr.matchSequence("DrawElementsUInt %w %i {")) { int entry = fr[1].getNoNestedBrackets(); @@ -1174,7 +1174,7 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) int capacity; fr[2].getInt(capacity); - + int numInstances = 0; if (firstMatched) { @@ -1185,7 +1185,7 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) { fr += 4; } - + DrawElementsUInt* prim = new DrawElementsUInt; prim->setMode(mode); prim->setNumInstances(numInstances); @@ -1201,9 +1201,9 @@ bool Primitive_readLocalData(Input& fr,osg::Geometry& geom) } } ++fr; - + geom.addPrimitiveSet(prim); - + iteratorAdvanced = true; } @@ -1298,31 +1298,31 @@ bool Geometry_writeLocalData(const Object& obj, Output& fw) fw.indent()<<"VertexArray "; Array_writeLocalData(*geom.getVertexArray(),fw); - + } if (geom.getVertexIndices()) { fw.indent()<<"VertexIndices "; - Array_writeLocalData(*geom.getVertexIndices(),fw); + Array_writeLocalData(*geom.getVertexIndices(),fw); } if (geom.getNormalArray()) { - + fw.indent()<<"NormalBinding "<(obj); - // no current image reading code + // no current image reading code // as it is all handled by osg::Registry::readImage() via plugins. return iteratorAdvanced; @@ -38,7 +38,7 @@ bool Image_writeLocalData(const Object& /*obj*/, Output& /*fw*/) { // const Image& image = static_cast(obj); - // no current image writing code here + // no current image writing code here // as it is all handled by osg::Registry::writeImage() via plugins. return true; diff --git a/src/osgWrappers/deprecated-dotosg/osg/ImageSequence.cpp b/src/osgWrappers/deprecated-dotosg/osg/ImageSequence.cpp index 17a25d439..50bd891d2 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/ImageSequence.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/ImageSequence.cpp @@ -30,7 +30,7 @@ bool ImageSequence_readLocalData(Object& obj, Input& fr) std::string modeStr; if (fr.read("Mode",modeStr)) { - if (modeStr=="PRE_LOAD_ALL_IMAGES") + if (modeStr=="PRE_LOAD_ALL_IMAGES") { is.setMode(osg::ImageSequence::PRE_LOAD_ALL_IMAGES); } @@ -43,13 +43,13 @@ bool ImageSequence_readLocalData(Object& obj, Input& fr) is.setMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES); } } - + double length; if (fr.read("Duration", length) || fr.read("Length", length) ) { is.setLength(length); } - + if (fr.matchSequence("FileNames {")) { fr += 2; @@ -89,24 +89,24 @@ bool ImageSequence_writeLocalData(const Object& obj, Output& fw) { const ImageSequence& is = static_cast(obj); - // no current image writing code here + // no current image writing code here // as it is all handled by osg::Registry::writeImage() via plugins. switch(is.getMode()) - { - case(osg::ImageSequence::PRE_LOAD_ALL_IMAGES): - fw.indent()<<"Mode PRE_LOAD_ALL_IMAGES"<getFileName().empty()) fw.indent()<getFileName())<(obj); - + osg::Vec4 ambient; if (fr[0].matchWord("ambientIntensity") && fr[1].getFloat(ambient[0]) && @@ -86,7 +86,7 @@ bool LightModel_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } } - + return iteratorAdvanced; } @@ -95,7 +95,7 @@ bool LightModel_writeLocalData(const Object& obj,Output& fw) const LightModel& lightmodel = static_cast(obj); fw.indent() << "ambientIntensity " << lightmodel.getAmbientIntensity() << std::endl; - + if (lightmodel.getColorControl()==osg::LightModel::SEPARATE_SPECULAR_COLOR) fw.indent() << "colorControl SEPARATE_SPECULAR_COLOR" << std::endl; else @@ -105,7 +105,7 @@ bool LightModel_writeLocalData(const Object& obj,Output& fw) fw.indent() << "localViewer TRUE"<< std::endl; else fw.indent() << "localViewer FALSE"<< std::endl; - + if (lightmodel.getTwoSided()) fw.indent() << "twoSided TRUE"<< std::endl; else diff --git a/src/osgWrappers/deprecated-dotosg/osg/LightSource.cpp b/src/osgWrappers/deprecated-dotosg/osg/LightSource.cpp index d582f4d1d..5c27e1189 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/LightSource.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/LightSource.cpp @@ -30,7 +30,7 @@ bool LightSource_readLocalData(Object& obj, Input& fr) if (fr[0].matchWord("referenceFrame")) { bool cullingActiveBefore = lightsource.getCullingActive(); - + if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) { lightsource.setReferenceFrame(LightSource::ABSOLUTE_RF); @@ -43,7 +43,7 @@ bool LightSource_readLocalData(Object& obj, Input& fr) fr += 2; iteratorAdvanced = true; } - + // if culling wasn't before reset it to off. if (!cullingActiveBefore && lightsource.getCullingActive()) { diff --git a/src/osgWrappers/deprecated-dotosg/osg/LineStipple.cpp b/src/osgWrappers/deprecated-dotosg/osg/LineStipple.cpp index 5558603e1..870244cb1 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/LineStipple.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/LineStipple.cpp @@ -29,7 +29,7 @@ bool LineStipple_readLocalData(Object& obj, Input& fr) bool iteratorAdvanced = false; LineStipple& linestipple = static_cast(obj); - + int ref = linestipple.getFactor(); if (fr[0].matchWord("factor") && fr[1].getInt(ref)) { diff --git a/src/osgWrappers/deprecated-dotosg/osg/Material.cpp b/src/osgWrappers/deprecated-dotosg/osg/Material.cpp index e2664cc3f..d4522860d 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Material.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Material.cpp @@ -141,7 +141,7 @@ bool Material_readLocalData(Object& obj, Input& fr) { material.setTransparency(Material::FRONT_AND_BACK,transparency); - + fr+=2; iteratorAdvanced = true; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/Matrix.cpp b/src/osgWrappers/deprecated-dotosg/osg/Matrix.cpp index bb36713a9..9ef91e5f6 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Matrix.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Matrix.cpp @@ -4,7 +4,7 @@ bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword) { bool iteratorAdvanced = false; - + if (fr[0].matchWord(keyword) && fr[1].isOpenBracket()) { int entry = fr[0].getNoNestedBrackets(); @@ -30,8 +30,8 @@ bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword) else fr.advanceOverCurrentFieldOrBlock(); } iteratorAdvanced = true; - } - + } + return iteratorAdvanced; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/MatrixTransform.cpp b/src/osgWrappers/deprecated-dotosg/osg/MatrixTransform.cpp index abb082876..e212a7311 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/MatrixTransform.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/MatrixTransform.cpp @@ -55,10 +55,10 @@ bool MatrixTransform_readLocalData(Object& obj, Input& fr) fr +=2 ; iteratorAdvanced = true; } - - } - - Matrix matrix; + + } + + Matrix matrix; if (readMatrix(matrix,fr)) { transform.setMatrix(matrix); diff --git a/src/osgWrappers/deprecated-dotosg/osg/Node.cpp b/src/osgWrappers/deprecated-dotosg/osg/Node.cpp index 4b523b422..77fa1f626 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Node.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Node.cpp @@ -215,7 +215,7 @@ bool Node_writeLocalData(const Object& obj, Output& fw) { fw.writeObject(*node.getStateSet()); } - + if (node.getUpdateCallback()) { fw.indent() << "UpdateCallbacks {" << std::endl; @@ -248,7 +248,7 @@ bool Node_writeLocalData(const Object& obj, Output& fw) const osg::BoundingSphere& bs = node.getInitialBound(); fw.indent()<<"initialBound "<(obj); - + static ref_ptr s_occluder = new ConvexPlanarOccluder; - + ConvexPlanarOccluder* tmpOccluder = static_cast(fr.readObjectOfType(*s_occluder)); - + if (tmpOccluder) { occludernode.setOccluder(tmpOccluder); diff --git a/src/osgWrappers/deprecated-dotosg/osg/OcclusionQueryNode.cpp b/src/osgWrappers/deprecated-dotosg/osg/OcclusionQueryNode.cpp index 17647505e..50afdf785 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/OcclusionQueryNode.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/OcclusionQueryNode.cpp @@ -1,14 +1,14 @@ // // 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 -// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or +// This library is open source and may be redistributed and/or modified under +// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or // (at your option) any later version. The full license is in LICENSE file // included with this distribution, and on the openscenegraph.org website. -// +// // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // OpenSceneGraph Public License for more details. // diff --git a/src/osgWrappers/deprecated-dotosg/osg/PagedLOD.cpp b/src/osgWrappers/deprecated-dotosg/osg/PagedLOD.cpp index 88b271384..e40532908 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/PagedLOD.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/PagedLOD.cpp @@ -27,7 +27,7 @@ bool PagedLOD_readLocalData(Object& obj, Input& fr) bool iteratorAdvanced = false; PagedLOD& lod = static_cast(obj); - + std::string path; if (fr.read("DatabasePath",path)) { @@ -38,13 +38,13 @@ bool PagedLOD_readLocalData(Object& obj, Input& fr) if (lod.getDatabasePath().empty() && fr.getOptions() && !fr.getOptions()->getDatabasePathList().empty()) { const std::string& path = fr.getOptions()->getDatabasePathList().front(); - if (!path.empty()) + if (!path.empty()) { lod.setDatabasePath(path); } - } + } } - + unsigned int num; if (fr[0].matchWord("NumChildrenThatCannotBeExpired") && fr[1].getUInt(num)) { @@ -52,7 +52,7 @@ bool PagedLOD_readLocalData(Object& obj, Input& fr) fr+=2; iteratorAdvanced = true; } - + bool flag; if (fr.read("DisableExternalChildrenPaging", flag)) { @@ -82,7 +82,7 @@ bool PagedLOD_readLocalData(Object& obj, Input& fr) { if (fr[0].getStr()) lod.setFileName(i,fr[0].getStr()); else lod.setFileName(i,""); - + ++fr; ++i; } @@ -134,9 +134,9 @@ bool PagedLOD_writeLocalData(const Object& obj, Output& fw) fw.indent() << "FileNameList "<(obj); - + fw.indent()<<"position "<(obj); - - if(fr.matchSequence("GeometryVerticesOut %i")) + + if(fr.matchSequence("GeometryVerticesOut %i")) { unsigned int verticesOut; fr[1].getUInt(verticesOut); @@ -41,8 +41,8 @@ bool Program_readLocalData(Object& obj, Input& fr) fr += 2; iteratorAdvanced = true; } - - if(fr.matchSequence("GeometryInputType %w")) + + if(fr.matchSequence("GeometryInputType %w")) { std::string primitiveMode = fr[1].getStr(); GLenum mode; @@ -51,8 +51,8 @@ bool Program_readLocalData(Object& obj, Input& fr) fr += 2; iteratorAdvanced = true; } - - if(fr.matchSequence("GeometryOutputType %w")) + + if(fr.matchSequence("GeometryOutputType %w")) { std::string primitiveMode = fr[1].getStr(); GLenum mode; @@ -104,7 +104,7 @@ bool Program_readLocalData(Object& obj, Input& fr) bool Program_writeLocalData(const Object& obj,Output& fw) { const Program& program = static_cast(obj); - + fw.indent() << "GeometryVerticesOut " << program.getParameter(GL_GEOMETRY_VERTICES_OUT_EXT) << std::endl; fw.indent() << "GeometryInputType " << Geometry_getPrimitiveModeStr(program.getParameter(GL_GEOMETRY_INPUT_TYPE_EXT)) << std::endl; fw.indent() << "GeometryOutputType " << Geometry_getPrimitiveModeStr(program.getParameter(GL_GEOMETRY_OUTPUT_TYPE_EXT)) << std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osg/Projection.cpp b/src/osgWrappers/deprecated-dotosg/osg/Projection.cpp index 5debf7591..10b222ca1 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Projection.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Projection.cpp @@ -27,12 +27,12 @@ REGISTER_DOTOSGWRAPPER(Projection) bool Projection_readLocalData(Object& obj, Input& fr) { Projection &myobj = static_cast(obj); - bool iteratorAdvanced = false; + bool iteratorAdvanced = false; Matrix matrix; if (readMatrix(matrix,fr)) { - myobj.setMatrix(matrix); + myobj.setMatrix(matrix); iteratorAdvanced = true; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/ProxyNode.cpp b/src/osgWrappers/deprecated-dotosg/osg/ProxyNode.cpp index 25268bd4f..024face00 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/ProxyNode.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/ProxyNode.cpp @@ -55,7 +55,7 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr) proxyNode.setLoadingExternalReferenceMode(ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER); else if (fr[1].matchWord("NO_AUTOMATIC_LOADING")) proxyNode.setLoadingExternalReferenceMode(ProxyNode::NO_AUTOMATIC_LOADING); - + fr+=2; iteratorAdvanced = true; } @@ -71,11 +71,11 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr) if (fr.getOptions() && !fr.getOptions()->getDatabasePathList().empty()) { const std::string& path = fr.getOptions()->getDatabasePathList().front(); - if (!path.empty()) + if (!path.empty()) { proxyNode.setDatabasePath(path); } - } + } bool matchFirst; if ((matchFirst=fr.matchSequence("FileNameList {")) || fr.matchSequence("FileNameList %i {")) @@ -99,7 +99,7 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr) { if (fr[0].getStr()) proxyNode.setFileName(i,fr[0].getStr()); else proxyNode.setFileName(i,""); - + ++fr; ++i; } @@ -169,18 +169,18 @@ bool ProxyNode_writeLocalData(const Object& obj, Output& fw) std::string optionsString = fw.getOptions()->getOptionString(); includeExternalReferences = optionsString.find("includeExternalReferences")!=std::string::npos; bool newExternals = optionsString.find("writeExternalReferenceFiles")!=std::string::npos; - if (newExternals) + if (newExternals) { useOriginalExternalReferences = false; writeExternalReferenceFiles = true; - } + } } const ProxyNode& proxyNode = static_cast(obj); if (proxyNode.getCenterMode()==osg::ProxyNode::USER_DEFINED_CENTER) fw.indent() << "Center "<< proxyNode.getCenter() << std::endl; fw.indent() << "ExtRefMode "; - + switch(proxyNode.getLoadingExternalReferenceMode()) { case ProxyNode::LOAD_IMMEDIATELY: @@ -198,9 +198,9 @@ bool ProxyNode_writeLocalData(const Object& obj, Output& fw) fw.indent() << "FileNameList "<(obj); - if (fr.matchSequence("defaultTime")) + if (fr.matchSequence("defaultTime")) { - if (fr[1].isFloat()) + if (fr[1].isFloat()) { float t; fr[1].getFloat(t) ; @@ -100,29 +100,29 @@ bool Sequence_readLocalData(Object& obj, Input& fr) fr += 2; } } - else if (fr.matchSequence("frameTime {")) + else if (fr.matchSequence("frameTime {")) { int entry = fr[0].getNoNestedBrackets(); fr += 2; - + int i = 0; - while (!fr.eof() && fr[0].getNoNestedBrackets() > entry) + while (!fr.eof() && fr[0].getNoNestedBrackets() > entry) { float t; - if (fr[0].getFloat(t)) + if (fr[0].getFloat(t)) { sw.setTime(i, t); ++fr; i++; } } - + iteratorAdvanced = true; ++fr; } - else if (fr.matchSequence("lastFrameTime")) + else if (fr.matchSequence("lastFrameTime")) { - if (fr[1].isFloat()) + if (fr[1].isFloat()) { float t; fr[1].getFloat(t) ; @@ -131,21 +131,21 @@ bool Sequence_readLocalData(Object& obj, Input& fr) fr += 2; } } - else if (fr.matchSequence("interval")) + else if (fr.matchSequence("interval")) { Sequence::LoopMode mode; int begin, end; if (Sequence_matchLoopMode(fr[1].getStr(), mode) && - fr[2].getInt(begin) && fr[3].getInt(end)) + fr[2].getInt(begin) && fr[3].getInt(end)) { sw.setInterval(mode, begin, end); iteratorAdvanced = true; fr += 4; } } - else if (fr.matchSequence("duration")) + else if (fr.matchSequence("duration")) { - if (fr[1].isFloat() && fr[2].isInt()) + if (fr[1].isFloat() && fr[2].isInt()) { float speed; int nreps; @@ -156,19 +156,19 @@ bool Sequence_readLocalData(Object& obj, Input& fr) fr += 3; } } - else if (fr.matchSequence("mode")) + else if (fr.matchSequence("mode")) { Sequence::SequenceMode mode; - if (Sequence_matchSeqMode(fr[1].getStr(), mode)) + if (Sequence_matchSeqMode(fr[1].getStr(), mode)) { sw.setMode(mode); iteratorAdvanced = true; fr += 2; } } - else if (fr.matchSequence("sync")) + else if (fr.matchSequence("sync")) { - if (fr[1].isInt()) + if (fr[1].isInt()) { int sync ; fr[1].getInt(sync) ; @@ -177,9 +177,9 @@ bool Sequence_readLocalData(Object& obj, Input& fr) fr += 2; } } - else if (fr.matchSequence("clearOnStop")) + else if (fr.matchSequence("clearOnStop")) { - if (fr[1].isInt()) + if (fr[1].isInt()) { int clearOnStop ; fr[1].getInt(clearOnStop) ; @@ -188,7 +188,7 @@ bool Sequence_readLocalData(Object& obj, Input& fr) fr += 2; } } - + return iteratorAdvanced; } @@ -202,7 +202,7 @@ bool Sequence_writeLocalData(const Object& obj, Output& fw) // frame times fw.indent() << "frameTime {" << std::endl; fw.moveIn(); - for (unsigned int i = 0; i < sw.getNumChildren(); i++) + for (unsigned int i = 0; i < sw.getNumChildren(); i++) { fw.indent() << sw.getTime(i) << std::endl; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/Shader.cpp b/src/osgWrappers/deprecated-dotosg/osg/Shader.cpp index 10ee90f13..43451a5ca 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Shader.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Shader.cpp @@ -42,7 +42,7 @@ bool Shader_readLocalData(Object& obj, Input& fr) fr+=2; iteratorAdvanced = true; } - + if (fr.matchSequence("file %w") || fr.matchSequence("file %s") ) { @@ -51,7 +51,7 @@ bool Shader_readLocalData(Object& obj, Input& fr) shader.setShaderSource(s->getShaderSource()); else shader.loadShaderSourceFromFile( osgDB::findDataFile(fr[1].getStr()) ); - + fr += 2; iteratorAdvanced = true; } @@ -94,18 +94,18 @@ bool Shader_writeLocalData(const Object& obj,Output& fw) { fileName = fw.getShaderFileNameForOutput(); } - + osgDB::writeShaderFile(shader, fileName); if (!fileName.empty()) - { + { fw.indent() << "file "< lines; std::istringstream iss(shader.getShaderSource()); @@ -116,12 +116,12 @@ bool Shader_writeLocalData(const Object& obj,Output& fw) fw.indent() << "code {\n"; fw.moveIn(); - + std::vector::const_iterator j; for (j=lines.begin(); j!=lines.end(); ++j) { fw.indent() << fw.wrapString(*j) << "\n"; } - + fw.moveOut(); fw.indent() << "}\n"; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/ShapeDrawable.cpp b/src/osgWrappers/deprecated-dotosg/osg/ShapeDrawable.cpp index 252827a34..c59627b91 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/ShapeDrawable.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/ShapeDrawable.cpp @@ -36,9 +36,9 @@ bool ShapeDrawable_readLocalData(Object& obj, Input& fr) fr[2].getFloat(color[1]); fr[3].getFloat(color[2]); fr[4].getFloat(color[3]); - + geom.setColor(color); - + fr+=5; iteratorAdvanced = true; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/Sphere.cpp b/src/osgWrappers/deprecated-dotosg/osg/Sphere.cpp index 0a2b98b93..457a5942f 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Sphere.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Sphere.cpp @@ -43,7 +43,7 @@ bool Sphere_readLocalData(Object& obj, Input& fr) fr+=4; iteratorAdvanced = true; } - + if (fr.matchSequence("Radius %f")) { float radius; @@ -52,7 +52,7 @@ bool Sphere_readLocalData(Object& obj, Input& fr) fr+=2; iteratorAdvanced = true; } - + return iteratorAdvanced; } @@ -60,7 +60,7 @@ bool Sphere_readLocalData(Object& obj, Input& fr) bool Sphere_writeLocalData(const Object& obj, Output& fw) { const Sphere& sphere = static_cast(obj); - + fw.indent()<<"Center "< lock(s_initGLNames); if (!first_time) return; - + ADD_NAME("GL_ALPHA_TEST",GL_ALPHA_TEST) ADD_NAME("GL_BLEND",GL_BLEND) ADD_NAME("GL_COLOR_MATERIAL",GL_COLOR_MATERIAL) @@ -100,21 +100,21 @@ void initGLNames() ADD_NAME("GL_COLOR_SUM",GL_COLOR_SUM); ADD_NAME("GL_NORMALIZE",GL_NORMALIZE); ADD_NAME("GL_RESCALE_NORMAL",GL_RESCALE_NORMAL); - + ADD_NAME("GL_TEXTURE_1D",GL_TEXTURE_1D) ADD_NAME("GL_TEXTURE_2D",GL_TEXTURE_2D) ADD_NAME("GL_TEXTURE_3D",GL_TEXTURE_3D) - + ADD_NAME("GL_TEXTURE_CUBE_MAP",GL_TEXTURE_CUBE_MAP); ADD_NAME("GL_TEXTURE_RECTANGLE",GL_TEXTURE_RECTANGLE); - + ADD_NAME("GL_TEXTURE_GEN_Q",GL_TEXTURE_GEN_Q) ADD_NAME("GL_TEXTURE_GEN_R",GL_TEXTURE_GEN_R) ADD_NAME("GL_TEXTURE_GEN_S",GL_TEXTURE_GEN_S) ADD_NAME("GL_TEXTURE_GEN_T",GL_TEXTURE_GEN_T) - + ADD_NAME("GL_STENCIL_TEST",GL_STENCIL_TEST) - + ADD_NAME("GL_CLIP_PLANE0",GL_CLIP_PLANE0); ADD_NAME("GL_CLIP_PLANE1",GL_CLIP_PLANE1); ADD_NAME("GL_CLIP_PLANE2",GL_CLIP_PLANE2); @@ -137,19 +137,19 @@ void initGLNames() #endif ADD_NAME("GL_VERTEX_PROGRAM_POINT_SIZE", GL_VERTEX_PROGRAM_POINT_SIZE) ADD_NAME("GL_VERTEX_PROGRAM_TWO_SIDE", GL_VERTEX_PROGRAM_TWO_SIDE) - + s_TextureGLModeSet.insert(GL_TEXTURE_1D); s_TextureGLModeSet.insert(GL_TEXTURE_2D); s_TextureGLModeSet.insert(GL_TEXTURE_3D); - + s_TextureGLModeSet.insert(GL_TEXTURE_CUBE_MAP); s_TextureGLModeSet.insert(GL_TEXTURE_RECTANGLE); - + s_TextureGLModeSet.insert(GL_TEXTURE_GEN_Q); s_TextureGLModeSet.insert(GL_TEXTURE_GEN_R); s_TextureGLModeSet.insert(GL_TEXTURE_GEN_S); s_TextureGLModeSet.insert(GL_TEXTURE_GEN_T); - + // for(GLNameToGLModeMap::iterator itr=s_GLNameToGLModeMap.begin(); // itr!=s_GLNameToGLModeMap.end(); @@ -157,7 +157,7 @@ void initGLNames() // { // cout << "Name ["<first<<","<second<<"]"<< std::endl; // } - + first_time = false; } @@ -277,10 +277,10 @@ bool GeoState_readLocalData(Object& obj, Input& fr) { statset.setAttribute(attribute); } - - if (attribute->getType()==StateAttribute::TEXGEN) + + if (attribute->getType()==StateAttribute::TEXGEN) statset.setAssociatedModes(attribute,texgening); - + iteratorAdvanced = true; } @@ -295,8 +295,8 @@ bool StateSet_readLocalData(Object& obj, Input& fr) StateSet& stateset = static_cast(obj); initGLNames(); - - // read the rendering hint value. + + // read the rendering hint value. if (fr[0].matchWord("rendering_hint")) { if (fr[1].matchWord("DEFAULT_BIN")) @@ -349,7 +349,7 @@ bool StateSet_readLocalData(Object& obj, Input& fr) { setRenderBinDetails=true; binName = fr[1].getStr(); - + fr+=2; iteratorAdvanced = true; } @@ -394,7 +394,7 @@ bool StateSet_readLocalData(Object& obj, Input& fr) { int mode; fr[0].getInt(mode); - + if (s_TextureGLModeSet.find(mode)!=s_TextureGLModeSet.end()) { // remap to a texture unit. @@ -432,7 +432,7 @@ bool StateSet_readLocalData(Object& obj, Input& fr) readingMode=true; } } - } + } } // new code using osg::Registry's list of prototypes to loaded attributes. @@ -459,7 +459,7 @@ bool StateSet_readLocalData(Object& obj, Input& fr) } iteratorAdvanced = true; } - + while(fr.matchSequence("textureUnit %i {")) { int entry = fr[0].getNoNestedBrackets(); @@ -467,11 +467,11 @@ bool StateSet_readLocalData(Object& obj, Input& fr) unsigned int unit=0; fr[1].getUInt(unit); fr+=3; - + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) { bool localIteratorAdvanced = false; - + bool readingMode = true; StateAttribute::GLModeValue value; while (readingMode) @@ -504,34 +504,34 @@ bool StateSet_readLocalData(Object& obj, Input& fr) readingMode=true; } } - } + } } - + StateAttribute* attribute = NULL; while((attribute=fr.readStateAttribute())!=NULL) { stateset.setTextureAttribute(unit,attribute); localIteratorAdvanced = true; } - + if (!localIteratorAdvanced) fr.advanceOverCurrentFieldOrBlock(); } - + // skip over trailing '}' ++fr; - + iteratorAdvanced = true; } - - - + + + return iteratorAdvanced; } -// visual studio 6.0 doesn't appear to define std::max?!? So do our own here.. +// visual studio 6.0 doesn't appear to define std::max?!? So do our own here.. template T mymax(const T& a,const T& b) { @@ -545,22 +545,22 @@ bool StateSet_writeLocalData(const Object& obj, Output& fw) initGLNames(); - // write the rendering hint value. + // write the rendering hint value. fw.indent()<<"rendering_hint "; switch(stateset.getRenderingHint()) { case(StateSet::DEFAULT_BIN): fw<<"DEFAULT_BIN"<< std::endl; - break; + break; case(StateSet::OPAQUE_BIN): fw<<"OPAQUE_BIN"<< std::endl; - break; + break; case(StateSet::TRANSPARENT_BIN): fw<<"TRANSPARENT_BIN"<< std::endl; - break; + break; default: fw<first << dec <<" " << StateSet_getModeStr(mitr->second) << std::endl; } } - + const StateSet::UniformList& ul = stateset.getUniformList(); for(StateSet::UniformList::const_iterator uitr=ul.begin(); uitr!=ul.end(); @@ -604,15 +604,15 @@ bool StateSet_writeLocalData(const Object& obj, Output& fw) fw.writeObject(*(sitr->second.first)); } - - const StateSet::TextureModeList& tml = stateset.getTextureModeList(); + + const StateSet::TextureModeList& tml = stateset.getTextureModeList(); const StateSet::TextureAttributeList& tal = stateset.getTextureAttributeList(); unsigned int maxUnit = mymax(tml.size(),tal.size()); for(unsigned int unit=0;unitsecond.first)); } } - + fw.moveOut(); fw.indent()<<"}"<< std::endl; } - + if (stateset.getUpdateCallback()) { fw.indent() << "UpdateCallback {" << std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osg/Stencil.cpp b/src/osgWrappers/deprecated-dotosg/osg/Stencil.cpp index cd375b2e5..45aaacac6 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Stencil.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Stencil.cpp @@ -36,7 +36,7 @@ bool Stencil_readLocalData(Object& obj, Input& fr) bool iteratorAdvanced = false; Stencil& stencil = static_cast(obj); - + bool setFunction = false; Stencil::Function func = stencil.getFunction(); if (fr[0].matchWord("function") && Stencil_matchFuncStr(fr[1].getStr(),func)) @@ -110,11 +110,11 @@ bool Stencil_writeLocalData(const Object& obj,Output& fw) fw.indent() << "function " << Stencil_getFuncStr(stencil.getFunction()) << std::endl; fw.indent() << "functionRef " << stencil.getFunctionRef() << std::endl; fw.indent() << "functionMask 0x" << hex << stencil.getFunctionMask() << dec << std::endl; - + fw.indent() << "stencilFailOperation " << Stencil_getOperationStr(stencil.getStencilFailOperation()) << std::endl; fw.indent() << "stencilPassAndDepthFailOperation " << Stencil_getOperationStr(stencil.getStencilPassAndDepthFailOperation()) << std::endl; fw.indent() << "stencilPassAndDepthPassOperation " << Stencil_getOperationStr(stencil.getStencilPassAndDepthPassOperation()) << std::endl; - + fw.indent() << "writeMask 0x" << hex << stencil.getWriteMask() << dec << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osg/Switch.cpp b/src/osgWrappers/deprecated-dotosg/osg/Switch.cpp index 5740474a1..ca0f1f1e3 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Switch.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Switch.cpp @@ -53,7 +53,7 @@ bool Switch_readLocalData(Object& obj, Input& fr) if (fr[0].matchWord("NewChildDefaultValue")) { - if (fr[1].matchWord("TRUE")) + if (fr[1].matchWord("TRUE")) { sw.setNewChildDefaultValue(true); iteratorAdvanced = true; @@ -95,9 +95,9 @@ bool Switch_readLocalData(Object& obj, Input& fr) } ++fr; - + iteratorAdvanced = true; - + } return iteratorAdvanced; diff --git a/src/osgWrappers/deprecated-dotosg/osg/TexEnv.cpp b/src/osgWrappers/deprecated-dotosg/osg/TexEnv.cpp index b6a01d87e..c404b0b56 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/TexEnv.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/TexEnv.cpp @@ -48,9 +48,9 @@ bool TexEnv_readLocalData(Object& obj, Input& fr) fr[2].getFloat(color[1]); fr[3].getFloat(color[2]); fr[4].getFloat(color[3]); - + texenv.setColor(color); - + fr+=5; iteratorAdvanced = true; } @@ -63,7 +63,7 @@ bool TexEnv_writeLocalData(const Object& obj, Output& fw) const TexEnv& texenv = static_cast(obj); fw.indent() << "mode " << TexEnv_getModeStr(texenv.getMode()) << std::endl; - + switch(texenv.getMode()) { case(TexEnv::DECAL): diff --git a/src/osgWrappers/deprecated-dotosg/osg/TexEnvCombine.cpp b/src/osgWrappers/deprecated-dotosg/osg/TexEnvCombine.cpp index 217965e2d..b8fdd1dc5 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/TexEnvCombine.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/TexEnvCombine.cpp @@ -155,9 +155,9 @@ bool TexEnvCombine_readLocalData(Object& obj, Input& fr) fr[2].getFloat(color[1]); fr[3].getFloat(color[2]); fr[4].getFloat(color[3]); - + texenv.setConstantColor(color); - + fr+=5; iteratorAdvanced = true; } @@ -171,7 +171,7 @@ bool TexEnvCombine_writeLocalData(const Object& obj, Output& fw) fw.indent() << "combine_RGB " << TexEnvCombine_getCombineParamStr(texenv.getCombine_RGB()) << std::endl; fw.indent() << "combine_Alpha " << TexEnvCombine_getCombineParamStr(texenv.getCombine_Alpha()) << std::endl; - + fw.indent() << "source0_RGB " << TexEnvCombine_getSourceParamStr(texenv.getSource0_RGB()) << std::endl; fw.indent() << "source1_RGB " << TexEnvCombine_getSourceParamStr(texenv.getSource1_RGB()) << std::endl; fw.indent() << "source2_RGB " << TexEnvCombine_getSourceParamStr(texenv.getSource2_RGB()) << std::endl; @@ -190,7 +190,7 @@ bool TexEnvCombine_writeLocalData(const Object& obj, Output& fw) fw.indent() << "scale_RGB " << texenv.getScale_RGB() << std::endl; fw.indent() << "scale_Alpha " << texenv.getScale_Alpha() << std::endl; - + fw.indent() << "constantColor " << texenv.getConstantColor() << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osg/TexEnvFilter.cpp b/src/osgWrappers/deprecated-dotosg/osg/TexEnvFilter.cpp index 2d495b9dc..0e38b4f60 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/TexEnvFilter.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/TexEnvFilter.cpp @@ -44,6 +44,6 @@ bool TexEnvFilter_writeLocalData(const Object& obj, Output& fw) const TexEnvFilter& texenvfilter = static_cast(obj); fw.indent() << "lodBias " << texenvfilter.getLodBias() << std::endl; - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/TexGen.cpp b/src/osgWrappers/deprecated-dotosg/osg/TexGen.cpp index 73c33290a..55564cb3d 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/TexGen.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/TexGen.cpp @@ -45,7 +45,7 @@ bool TexGen_readLocalData(Object& obj, Input& fr) fr+=2; iteratorAdvanced = true; } - + osg::Plane plane; if (fr[0].matchWord("plane_s")) { diff --git a/src/osgWrappers/deprecated-dotosg/osg/TexGenNode.cpp b/src/osgWrappers/deprecated-dotosg/osg/TexGenNode.cpp index ca3926089..18fa278e4 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/TexGenNode.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/TexGenNode.cpp @@ -32,7 +32,7 @@ bool TexGenNode_readLocalData(Object& obj, Input& fr) { texGenNode.setTextureUnit(textureUnit); - + fr+=2; iteratorAdvanced = true; } diff --git a/src/osgWrappers/deprecated-dotosg/osg/TexMat.cpp b/src/osgWrappers/deprecated-dotosg/osg/TexMat.cpp index 8f674fb78..832f80134 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/TexMat.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/TexMat.cpp @@ -35,9 +35,9 @@ bool TexMat_readLocalData(Object& obj, Input& fr) } if (matched) { - + Matrix& matrix = texmat.getMatrix(); - + int k=0; double v; for(int i=0;i<4;++i) @@ -55,13 +55,13 @@ bool TexMat_readLocalData(Object& obj, Input& fr) if (fr[0].matchWord("scaleByTextureRectangleSize")) { - if (fr[1].matchWord("TRUE")) + if (fr[1].matchWord("TRUE")) { texmat.setScaleByTextureRectangleSize(true); fr +=2 ; iteratorAdvanced = true; } - else if (fr[1].matchWord("FALSE")) + else if (fr[1].matchWord("FALSE")) { texmat.setScaleByTextureRectangleSize(false); fr +=2 ; @@ -81,11 +81,11 @@ bool TexMat_writeLocalData(const Object& obj, Output& fw) fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl; fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl; fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl; - + if (texmat.getScaleByTextureRectangleSize()) { fw.indent() << "scaleByTextureRectangleSize TRUE"<setFileName(filename); texture.setImage(image); } - + fr += 2; iteratorAdvanced = true; } @@ -89,7 +89,7 @@ bool Texture1D_writeLocalData(const Object& obj, Output& fw) } if (!fileName.empty()) - { + { fw.indent() << "file "<setFileName(filename); texture.setImage(image); } - + fr += 2; iteratorAdvanced = true; } - + if (fr[0].matchWord("ImageSequence") || fr[0].matchWord("Image")) { osg::Image* image = fr.readImage(); @@ -97,7 +97,7 @@ bool Texture2D_writeLocalData(const Object& obj, Output& fw) } if (!fileName.empty()) - { + { fw.indent() << "file "<setFileName(filename); texture.setImage(image); } - + fr += 2; iteratorAdvanced = true; } - + if (fr[0].matchWord("ImageSequence") || fr[0].matchWord("Image")) { osg::Image* image = fr.readImage(); @@ -88,7 +88,7 @@ bool Texture3D_writeLocalData(const Object& obj, Output& fw) } if (!fileName.empty()) - { + { fw.indent() << "file "<setFileName(filename); texture.setImage(image); } - + fr += 2; iteratorAdvanced = true; } - + if (fr[0].matchWord("ImageSequence") || fr[0].matchWord("Image")) { osg::Image* image = fr.readImage(); @@ -89,7 +89,7 @@ bool TextureRectangle_writeLocalData(const Object& obj, Output& fw) } if (!fileName.empty()) - { + { fw.indent() << "file "<(obj); const osg::TransferFunction1D::ColorMap& colorMap = tf.getColorMap(); - + fw.indent()<<"NumberImageCells "<second; fw.indent()<first<<" "< 1.0) ++fr; - + if (fr.matchSequence("unsigned int")) { uniform.setType( Uniform::getTypeId( "unsigned int" ) ); fr += 2; } else - { + { uniform.setType( Uniform::getTypeId( fr[0].getStr() ) ); ++fr; } - + unsigned int numElements; fr[0].getUInt(numElements); uniform.setNumElements( numElements ); @@ -83,7 +83,7 @@ bool Uniform_readLocalData(Object& obj, Input& fr) case(osg::Uniform::FLOAT): { float value; - if (fr[0].getFloat(value)) + if (fr[0].getFloat(value)) { uniform.set(value); fr+=1; @@ -94,7 +94,7 @@ bool Uniform_readLocalData(Object& obj, Input& fr) case(osg::Uniform::FLOAT_VEC2): { osg::Vec2 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1])) + if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1])) { uniform.set(value); fr+=2; @@ -105,7 +105,7 @@ bool Uniform_readLocalData(Object& obj, Input& fr) case(osg::Uniform::FLOAT_VEC3): { osg::Vec3 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && fr[2].getFloat(value[2])) + if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && fr[2].getFloat(value[2])) { uniform.set(value); fr+=3; @@ -116,7 +116,7 @@ bool Uniform_readLocalData(Object& obj, Input& fr) case(osg::Uniform::FLOAT_VEC4): { osg::Vec4 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && fr[2].getFloat(value[2]) && fr[3].getFloat(value[3])) + if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && fr[2].getFloat(value[2]) && fr[3].getFloat(value[3])) { uniform.set(value); fr+=4; @@ -127,7 +127,7 @@ bool Uniform_readLocalData(Object& obj, Input& fr) case(osg::Uniform::INT): { int value; - if (fr[0].getInt(value)) + if (fr[0].getInt(value)) { uniform.set(value); fr+=1; @@ -172,7 +172,7 @@ bool Uniform_readLocalData(Object& obj, Input& fr) { osg::Matrix2 value; if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && - fr[2].getFloat(value[2]) && fr[3].getFloat(value[3])) + fr[2].getFloat(value[2]) && fr[3].getFloat(value[3])) { uniform.set(value); fr+=4; diff --git a/src/osgWrappers/deprecated-dotosg/osgAnimation/Matrix.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/Matrix.cpp index bb36713a9..9ef91e5f6 100644 --- a/src/osgWrappers/deprecated-dotosg/osgAnimation/Matrix.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgAnimation/Matrix.cpp @@ -4,7 +4,7 @@ bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword) { bool iteratorAdvanced = false; - + if (fr[0].matchWord(keyword) && fr[1].isOpenBracket()) { int entry = fr[0].getNoNestedBrackets(); @@ -30,8 +30,8 @@ bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword) else fr.advanceOverCurrentFieldOrBlock(); } iteratorAdvanced = true; - } - + } + return iteratorAdvanced; } diff --git a/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp index 183d9c3e9..cb3343857 100644 --- a/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2008 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -54,7 +54,7 @@ bool Bone_readLocalData(Object& obj, Input& fr) fr[2].getFloat(att[1]); fr[3].getFloat(att[2]); fr[4].getFloat(att[3]); - + fr += 5; iteratorAdvanced = true; osg::notify(osg::WARN) << "Old osgAnimation file format update your data file" << std::endl; @@ -66,7 +66,7 @@ bool Bone_readLocalData(Object& obj, Input& fr) fr[1].getFloat(pos[0]); fr[2].getFloat(pos[1]); fr[3].getFloat(pos[2]); - + fr += 4; iteratorAdvanced = true; osg::notify(osg::WARN) << "Old osgAnimation file format update your data file" << std::endl; @@ -78,7 +78,7 @@ bool Bone_readLocalData(Object& obj, Input& fr) fr[1].getFloat(scale[0]); fr[2].getFloat(scale[1]); fr[3].getFloat(scale[2]); - + fr += 4; iteratorAdvanced = true; osg::notify(osg::WARN) << "Old osgAnimation file format update your data file" << std::endl; @@ -86,7 +86,7 @@ bool Bone_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("InvBindMatrixInSkeletonSpace {")) { - Matrix matrix; + Matrix matrix; if (readMatrix(matrix,fr, "InvBindMatrixInSkeletonSpace")) { bone.setInvBindMatrixInSkeletonSpace(matrix); @@ -95,7 +95,7 @@ bool Bone_readLocalData(Object& obj, Input& fr) } if (fr.matchSequence("MatrixInSkeletonSpace {")) { - Matrix matrix; + Matrix matrix; if (readMatrix(matrix,fr, "MatrixInSkeletonSpace")) { bone.setMatrixInSkeletonSpace(matrix); @@ -126,13 +126,13 @@ RegisterDotOsgWrapperProxy g_BoneProxy -bool Skeleton_readLocalData(Object& obj, Input& fr) -{ +bool Skeleton_readLocalData(Object& obj, Input& fr) +{ return false; } -bool Skeleton_writeLocalData(const Object& obj, Output& fr) +bool Skeleton_writeLocalData(const Object& obj, Output& fr) { - return true; + return true; } RegisterDotOsgWrapperProxy g_SkeletonProxy ( @@ -149,7 +149,7 @@ bool Animation_readChannel(osgAnimation::Channel* pChannel, Input& fr) { bool iteratorAdvanced = false; std::string name = "unknown"; - if (fr.matchSequence("name %s")) + if (fr.matchSequence("name %s")) { if (fr[1].getStr()) name = fr[1].getStr(); @@ -159,7 +159,7 @@ bool Animation_readChannel(osgAnimation::Channel* pChannel, Input& fr) pChannel->setName(name); std::string target = "unknown"; - if (fr.matchSequence("target %s")) + if (fr.matchSequence("target %s")) { if (fr[1].getStr()) target = fr[1].getStr(); @@ -170,7 +170,7 @@ bool Animation_readChannel(osgAnimation::Channel* pChannel, Input& fr) // we dont need this info float weight = 1.0; - if (fr.matchSequence("weight %f")) + if (fr.matchSequence("weight %f")) { fr[1].getFloat(weight); fr += 2; @@ -195,7 +195,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } - if (fr.matchSequence("weight %f")) + if (fr.matchSequence("weight %f")) { float weight; fr[1].getFloat(weight); @@ -203,8 +203,8 @@ bool Animation_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; anim.setWeight(weight); } - - if (fr.matchSequence("duration %f")) + + if (fr.matchSequence("duration %f")) { float duration; fr[1].getFloat(duration); @@ -213,7 +213,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) anim.setDuration(duration); } - if (fr.matchSequence("starttime %f")) + if (fr.matchSequence("starttime %f")) { float starttime; fr[1].getFloat(starttime); @@ -223,16 +223,16 @@ bool Animation_readLocalData(Object& obj, Input& fr) } int nbChannels = 0; - if (fr.matchSequence("num_channels %i")) + if (fr.matchSequence("num_channels %i")) { fr[1].getInt(nbChannels); fr += 2; iteratorAdvanced = true; } - for (int i = 0; i < nbChannels; i++) + for (int i = 0; i < nbChannels; i++) { - if (fr.matchSequence("DoubleLinearChannel {")) + if (fr.matchSequence("DoubleLinearChannel {")) { fr += 2; @@ -240,15 +240,15 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (Animation_readChannel(channel, fr)) iteratorAdvanced = true; - + int nbKeys; - if (fr.matchSequence("Keyframes %i {")) + if (fr.matchSequence("Keyframes %i {")) { fr[1].getInt(nbKeys); fr += 3; iteratorAdvanced = true; - for (int k = 0; k < nbKeys; k++) + for (int k = 0; k < nbKeys; k++) { double v; float time; @@ -269,7 +269,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("}")) // channel fr += 1; } - else if (fr.matchSequence("FloatLinearChannel {")) + else if (fr.matchSequence("FloatLinearChannel {")) { fr += 2; @@ -277,15 +277,15 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (Animation_readChannel(channel, fr)) iteratorAdvanced = true; - + int nbKeys; - if (fr.matchSequence("Keyframes %i {")) + if (fr.matchSequence("Keyframes %i {")) { fr[1].getInt(nbKeys); fr += 3; iteratorAdvanced = true; - for (int k = 0; k < nbKeys; k++) + for (int k = 0; k < nbKeys; k++) { float v; float time; @@ -306,7 +306,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("}")) // channel fr += 1; } - else if (fr.matchSequence("Vec2LinearChannel {")) + else if (fr.matchSequence("Vec2LinearChannel {")) { fr += 2; @@ -314,15 +314,15 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (Animation_readChannel(channel, fr)) iteratorAdvanced = true; - + int nbKeys; - if (fr.matchSequence("Keyframes %i {")) + if (fr.matchSequence("Keyframes %i {")) { fr[1].getInt(nbKeys); fr += 3; iteratorAdvanced = true; - for (int k = 0; k < nbKeys; k++) + for (int k = 0; k < nbKeys; k++) { osg::Vec2 v; float time; @@ -344,7 +344,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("}")) // channel fr += 1; } - else if (fr.matchSequence("Vec3LinearChannel {")) + else if (fr.matchSequence("Vec3LinearChannel {")) { fr += 2; @@ -352,15 +352,15 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (Animation_readChannel(channel, fr)) iteratorAdvanced = true; - + int nbKeys; - if (fr.matchSequence("Keyframes %i {")) + if (fr.matchSequence("Keyframes %i {")) { fr[1].getInt(nbKeys); fr += 3; iteratorAdvanced = true; - for (int k = 0; k < nbKeys; k++) + for (int k = 0; k < nbKeys; k++) { osg::Vec3 v; float time; @@ -383,7 +383,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("}")) // channel fr += 1; } - else if (fr.matchSequence("Vec4LinearChannel {")) + else if (fr.matchSequence("Vec4LinearChannel {")) { fr += 2; @@ -391,15 +391,15 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (Animation_readChannel(channel, fr)) iteratorAdvanced = true; - + int nbKeys; - if (fr.matchSequence("Keyframes %i {")) + if (fr.matchSequence("Keyframes %i {")) { fr[1].getInt(nbKeys); fr += 3; iteratorAdvanced = true; - for (int k = 0; k < nbKeys; k++) + for (int k = 0; k < nbKeys; k++) { osg::Vec4 v; float time; @@ -423,7 +423,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("}")) // channel fr += 1; } - else if (fr.matchSequence("QuatSphericalLinearChannel {")) + else if (fr.matchSequence("QuatSphericalLinearChannel {")) { fr += 2; @@ -431,15 +431,15 @@ bool Animation_readLocalData(Object& obj, Input& fr) if (Animation_readChannel(channel, fr)) iteratorAdvanced = true; - + int nbKeys; - if (fr.matchSequence("Keyframes %i {")) + if (fr.matchSequence("Keyframes %i {")) { fr[1].getInt(nbKeys); fr += 3; iteratorAdvanced = true; - for (int k = 0; k < nbKeys; k++) + for (int k = 0; k < nbKeys; k++) { osg::Quat q; float time; @@ -464,14 +464,14 @@ bool Animation_readLocalData(Object& obj, Input& fr) fr += 1; } // Deprecated - // Reading of old channel info + // Reading of old channel info // Kept here for easy conversion of old .osg data to new format - else if (fr.matchSequence("Channel {")) + else if (fr.matchSequence("Channel {")) { fr += 2; std::string name = "unknown"; - if (fr.matchSequence("name %s")) + if (fr.matchSequence("name %s")) { if (fr[1].getStr()) name = fr[1].getStr(); @@ -479,7 +479,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } std::string target = "unknown"; - if (fr.matchSequence("target %s")) + if (fr.matchSequence("target %s")) { if (fr[1].getStr()) target = fr[1].getStr(); @@ -489,7 +489,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) std::string type = "unknown"; int nbKeys; - if (fr.matchSequence("Keyframes %s %i {")) + if (fr.matchSequence("Keyframes %s %i {")) { if (fr[1].getStr()) type = fr[1].getStr(); @@ -498,24 +498,24 @@ bool Animation_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; osgAnimation::Channel* channel = 0; - if (type == "Quat") + if (type == "Quat") { osgAnimation::QuatSphericalLinearChannel* c = new osgAnimation::QuatSphericalLinearChannel; c->getOrCreateSampler()->getOrCreateKeyframeContainer(); channel = c; } - else if (type == "Vec3") + else if (type == "Vec3") { osgAnimation::Vec3LinearChannel* c = new osgAnimation::Vec3LinearChannel; c->getOrCreateSampler()->getOrCreateKeyframeContainer(); channel = c; } - if (channel) + if (channel) { - for (int k = 0; k < nbKeys; k++) + for (int k = 0; k < nbKeys; k++) { - if (type == "Quat") + if (type == "Quat") { osg::Quat q; float time; @@ -530,7 +530,7 @@ bool Animation_readLocalData(Object& obj, Input& fr) c->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::QuatKeyframe(time, q)); iteratorAdvanced = true; } - else if (type == "Vec3") + else if (type == "Vec3") { osg::Vec3 v; float time; @@ -576,7 +576,7 @@ void Animation_writeChannel(const std::string& channelString, ChannelType* pChan { fw.indent() << "Keyframes " << kfc->size() << " {" << std::endl; fw.moveIn(); - for (unsigned int k = 0; k < kfc->size(); k++) + for (unsigned int k = 0; k < kfc->size(); k++) { fw.indent() << "key " << (*kfc)[k].getTime() << " " << (*kfc)[k].getValue() << std::endl; } @@ -591,7 +591,7 @@ bool Animation_writeLocalData(const Object& obj, Output& fw) { const osgAnimation::Animation& anim = dynamic_cast(obj); - switch (anim.getPlayMode()) + switch (anim.getPlayMode()) { case osgAnimation::Animation::ONCE: fw.indent() << "playmode ONCE" << std::endl; @@ -602,7 +602,7 @@ bool Animation_writeLocalData(const Object& obj, Output& fw) case osgAnimation::Animation::LOOP: fw.indent() << "playmode LOOP" << std::endl; break; - case osgAnimation::Animation::PPONG: + case osgAnimation::Animation::PPONG: fw.indent() << "playmode PPONG" << std::endl; break; default: @@ -614,7 +614,7 @@ bool Animation_writeLocalData(const Object& obj, Output& fw) fw.indent() << "starttime " << anim.getStartTime() << std::endl; fw.indent() << "num_channels " << anim.getChannels().size() << std::endl; - for (unsigned int i = 0; i < anim.getChannels().size(); i++) + for (unsigned int i = 0; i < anim.getChannels().size(); i++) { osgAnimation::Channel* pChannel = anim.getChannels()[i].get(); @@ -698,12 +698,12 @@ RegisterDotOsgWrapperProxy g_atkAnimationProxy -bool AnimationManagerBase_readLocalData(osgAnimation::AnimationManagerBase& manager, Input& fr) +bool AnimationManagerBase_readLocalData(osgAnimation::AnimationManagerBase& manager, Input& fr) { int nbAnims = 0; bool iteratorAdvanced = false; - if (fr.matchSequence("num_animations %i")) + if (fr.matchSequence("num_animations %i")) { fr[1].getInt(nbAnims); fr += 2; @@ -714,26 +714,26 @@ bool AnimationManagerBase_readLocalData(osgAnimation::AnimationManagerBase& mana { Object* o = fr.readObject(); osgAnimation::Animation* a = dynamic_cast(o); - if (a) + if (a) { manager.registerAnimation(a); iteratorAdvanced = true; - } + } else - osg::notify(osg::WARN)<<"Warning: can't read an animation object"<< std::endl; + osg::notify(osg::WARN)<<"Warning: can't read an animation object"<< std::endl; } return iteratorAdvanced; } -bool BasicAnimationManager_readLocalData(Object& obj, Input& fr) +bool BasicAnimationManager_readLocalData(Object& obj, Input& fr) { osgAnimation::BasicAnimationManager& manager = dynamic_cast(obj); return AnimationManagerBase_readLocalData(manager, fr); } -bool TimelineAnimationManager_readLocalData(Object& obj, Input& fr) +bool TimelineAnimationManager_readLocalData(Object& obj, Input& fr) { osgAnimation::TimelineAnimationManager& manager = dynamic_cast(obj); return AnimationManagerBase_readLocalData(manager, fr); @@ -748,7 +748,7 @@ bool AnimationManagerBase_writeLocalData(const osgAnimation::AnimationManagerBas for (osgAnimation::AnimationList::const_iterator it = animList.begin(); it != animList.end(); ++it) { if (!fw.writeObject(**it)) - osg::notify(osg::WARN)<<"Warning: can't write an animation object"<< std::endl; + osg::notify(osg::WARN)<<"Warning: can't write an animation object"<< std::endl; } return true; } @@ -787,25 +787,25 @@ RegisterDotOsgWrapperProxy g_TimelineAnimationManagerProxy ); -bool RigGeometry_readLocalData(Object& obj, Input& fr) +bool RigGeometry_readLocalData(Object& obj, Input& fr) { osgAnimation::RigGeometry& geom = dynamic_cast(obj); osg::ref_ptr vmap = new osgAnimation::VertexInfluenceMap; int nbGroups = 0; bool iteratorAdvanced = false; - if (fr.matchSequence("num_influences %i")) + if (fr.matchSequence("num_influences %i")) { fr[1].getInt(nbGroups); fr += 2; iteratorAdvanced = true; } - for (int i = 0; i < nbGroups; i++) + for (int i = 0; i < nbGroups; i++) { int nbVertexes = 0; std::string name; - if (fr.matchSequence("osgAnimation::VertexInfluence %s %i {")) + if (fr.matchSequence("osgAnimation::VertexInfluence %s %i {")) { name = fr[1].getStr(); fr[2].getInt(nbVertexes); @@ -816,11 +816,11 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr) osgAnimation::VertexInfluence vi; vi.setName(name); vi.reserve(nbVertexes); - for (int j = 0; j < nbVertexes; j++) + for (int j = 0; j < nbVertexes; j++) { int index = -1; float weight = 1; - if (fr.matchSequence("%i %f")) + if (fr.matchSequence("%i %f")) { fr[0].getInt(index); fr[1].getFloat(weight); @@ -829,7 +829,7 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr) } vi.push_back(osgAnimation::VertexIndexWeight(index, weight)); } - if (fr.matchSequence("}")) + if (fr.matchSequence("}")) { fr+=1; } @@ -848,7 +848,7 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr) return iteratorAdvanced; } -bool RigGeometry_writeLocalData(const Object& obj, Output& fw) +bool RigGeometry_writeLocalData(const Object& obj, Output& fw) { const osgAnimation::RigGeometry& geom = dynamic_cast(obj); const osgAnimation::VertexInfluenceMap* vm = geom.getInfluenceMap(); @@ -856,7 +856,7 @@ bool RigGeometry_writeLocalData(const Object& obj, Output& fw) return true; fw.indent() << "num_influences " << vm->size() << std::endl; fw.moveIn(); - for (osgAnimation::VertexInfluenceMap::const_iterator it = vm->begin(); it != vm->end(); ++it) + for (osgAnimation::VertexInfluenceMap::const_iterator it = vm->begin(); it != vm->end(); ++it) { std::string name = it->first; if (name.empty()) @@ -864,7 +864,7 @@ bool RigGeometry_writeLocalData(const Object& obj, Output& fw) fw.indent() << "osgAnimation::VertexInfluence \"" << name << "\" " << it->second.size() << " {" << std::endl; fw.moveIn(); const osgAnimation::VertexInfluence& vi = it->second; - for (osgAnimation::VertexInfluence::const_iterator itv = vi.begin(); itv != vi.end(); itv++) + for (osgAnimation::VertexInfluence::const_iterator itv = vi.begin(); itv != vi.end(); itv++) { fw.indent() << itv->first << " " << itv->second << std::endl; } @@ -888,7 +888,7 @@ RegisterDotOsgWrapperProxy g_atkRigGeometryProxy ); -bool MorphGeometry_readLocalData(Object& obj, Input& fr) +bool MorphGeometry_readLocalData(Object& obj, Input& fr) { osgAnimation::MorphGeometry& geom = dynamic_cast(obj); @@ -946,7 +946,7 @@ bool MorphGeometry_readLocalData(Object& obj, Input& fr) { float weight = 1.0; - if (fr.matchSequence("weight %f")) + if (fr.matchSequence("weight %f")) { fr[1].getFloat(weight); fr += 2; @@ -965,7 +965,7 @@ bool MorphGeometry_readLocalData(Object& obj, Input& fr) return iteratorAdvanced; } -bool MorphGeometry_writeLocalData(const Object& obj, Output& fw) +bool MorphGeometry_writeLocalData(const Object& obj, Output& fw) { const osgAnimation::MorphGeometry& geom = dynamic_cast(obj); @@ -976,9 +976,9 @@ bool MorphGeometry_writeLocalData(const Object& obj, Output& fw) } fw.indent() << "morphNormals "; - if (geom.getMorphNormals()) + if (geom.getMorphNormals()) fw << "TRUE" << std::endl; - else + else fw << "FALSE" << std::endl; const osgAnimation::MorphGeometry::MorphTargetList& morphTargets = geom.getMorphTargetList(); @@ -1032,7 +1032,7 @@ RegisterDotOsgWrapperProxy g_UpdateBoneProxy -bool UpdateSkeleton_readLocalData(Object& obj, Input& fr) +bool UpdateSkeleton_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; return iteratorAdvanced; @@ -1054,7 +1054,7 @@ RegisterDotOsgWrapperProxy g_UpdateSkeletonProxy ); -bool UpdateMorph_readLocalData(Object& obj, Input& fr) +bool UpdateMorph_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; return iteratorAdvanced; diff --git a/src/osgWrappers/deprecated-dotosg/osgAnimation/StackedTransform.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/StackedTransform.cpp index d67295e13..b2621fe29 100644 --- a/src/osgWrappers/deprecated-dotosg/osgAnimation/StackedTransform.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgAnimation/StackedTransform.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMaterial.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMaterial.cpp index f7acb1250..8bc614cf4 100644 --- a/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMaterial.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMaterial.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -25,7 +25,7 @@ using namespace osg; using namespace osgDB; -bool UpdateMaterial_readLocalData(Object& obj, Input& fr) +bool UpdateMaterial_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; return iteratorAdvanced; diff --git a/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp index 2f8879197..801fc2889 100644 --- a/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp @@ -1,14 +1,14 @@ -/* -*-c++-*- +/* -*-c++-*- * Copyright (C) 2009 Cedric Pinson * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ diff --git a/src/osgWrappers/deprecated-dotosg/osgFX/IO_AnisotropicLighting.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_AnisotropicLighting.cpp index 06ac43e55..e503ce5f5 100644 --- a/src/osgWrappers/deprecated-dotosg/osgFX/IO_AnisotropicLighting.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgFX/IO_AnisotropicLighting.cpp @@ -47,7 +47,7 @@ bool AnisotropicLighting_writeLocalData(const osg::Object &obj, osgDB::Output &f const osgFX::AnisotropicLighting &myobj = static_cast(obj); fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n"; - + const osg::Image *lmap = myobj.getLightingMap(); if (lmap) { if (!lmap->getFileName().empty()) { diff --git a/src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp index 98f085b96..ceeebeaf9 100644 --- a/src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp @@ -78,6 +78,6 @@ bool BumpMapping_writeLocalData(const osg::Object &obj, osgDB::Output &fw) if (myobj.getOverrideNormalMapTexture()) { fw.writeObject(*myobj.getOverrideNormalMapTexture()); } - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp index ca1a4a6d1..e64039fec 100644 --- a/src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp @@ -33,7 +33,7 @@ bool Cartoon_readLocalData(osg::Object &obj, osgDB::Input &fr) if (fr[0].matchWord("outlineColor")) { osg::Vec4 w; - if (fr[1].getFloat(w.x()) && fr[2].getFloat(w.y()) && + if (fr[1].getFloat(w.x()) && fr[2].getFloat(w.y()) && fr[3].getFloat(w.z()) && fr[4].getFloat(w.w())) { myobj.setOutlineColor(w); fr += 5; diff --git a/src/osgWrappers/deprecated-dotosg/osgFX/IO_MultiTextureControl.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_MultiTextureControl.cpp index aae9b9034..d3f98a7f9 100644 --- a/src/osgWrappers/deprecated-dotosg/osgFX/IO_MultiTextureControl.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgFX/IO_MultiTextureControl.cpp @@ -66,7 +66,7 @@ bool MultiTextureControl_writeLocalData(const osg::Object &obj, osgDB::Output &f fw.indent() << "TextureWeights "<(obj); osg::Vec3 a = adp.getDamping(); fw.indent() << "damping " << a.x() << " " << a.y() << " " << a.z() << std::endl; - + float low = adp.getCutoffLow(), high = adp.getCutoffHigh(); fw.indent() << "cutoff " << low << " " << high << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BounceOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BounceOperator.cpp index 27a77780d..ba32dc47b 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BounceOperator.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BounceOperator.cpp @@ -34,7 +34,7 @@ bool BounceOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("resilience")) { if (fr[1].getFloat(value)) { bp.setResilience(value); @@ -42,7 +42,7 @@ bool BounceOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("cutoff")) { if (fr[1].getFloat(value)) { bp.setCutoff(value); diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BoxPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BoxPlacer.cpp index d62b535b6..23fee6b60 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BoxPlacer.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BoxPlacer.cpp @@ -57,7 +57,7 @@ bool BoxPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw) const osgParticle::BoxPlacer &myobj = static_cast(obj); osgParticle::rangef r; - + r = myobj.getXRange(); fw.indent() << "xRange " << r.minimum << " " << r.maximum << std::endl; r = myobj.getYRange(); diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConstantRateCounter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConstantRateCounter.cpp index 38bb178a5..0fa875a12 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConstantRateCounter.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConstantRateCounter.cpp @@ -50,6 +50,6 @@ bool ConstantRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &f fw.indent() << "minimumNumberOfParticlesToCreate " << myobj.getMinimumNumberOfParticlesToCreate() << std::endl; fw.indent() << "numberOfParticlesPerSecondToCreate " << myobj.getNumberOfParticlesPerSecondToCreate() << std::endl; - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DampingOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DampingOperator.cpp index e6f290744..c5cfe658d 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DampingOperator.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DampingOperator.cpp @@ -34,7 +34,7 @@ bool DampingOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + float low = 0.0f, high = FLT_MAX; if (fr[0].matchWord("cutoff")) { if (fr[1].getFloat(low) && fr[2].getFloat(high)) { @@ -52,7 +52,7 @@ bool DampingOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw) const osgParticle::DampingOperator &dp = static_cast(obj); osg::Vec3 a = dp.getDamping(); fw.indent() << "damping " << a.x() << " " << a.y() << " " << a.z() << std::endl; - + float low = dp.getCutoffLow(), high = dp.getCutoffHigh(); fw.indent() << "cutoff " << low << " " << high << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DomainOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DomainOperator.cpp index 451f77c8f..ec5960b1e 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DomainOperator.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_DomainOperator.cpp @@ -31,7 +31,7 @@ bool DomainOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) { if (fr[1].getStr()) typeName = fr[1].getStr(); fr += 3; - + osgParticle::DomainOperator::Domain::Type type = osgParticle::DomainOperator::Domain::UNDEFINED_DOMAIN; if (typeName == "point") type = osgParticle::DomainOperator::Domain::POINT_DOMAIN; else if (typeName == "line") type = osgParticle::DomainOperator::Domain::LINE_DOMAIN; @@ -41,7 +41,7 @@ bool DomainOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) else if (typeName == "sphere") type = osgParticle::DomainOperator::Domain::SPHERE_DOMAIN; else if (typeName == "box") type = osgParticle::DomainOperator::Domain::BOX_DOMAIN; else if (typeName == "disk") type = osgParticle::DomainOperator::Domain::DISK_DOMAIN; - + osgParticle::DomainOperator::Domain domain(type); if (fr[0].matchWord("plane")) { if (fr[1].getFloat(domain.plane[0]) && fr[2].getFloat(domain.plane[1]) && @@ -50,42 +50,42 @@ bool DomainOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) fr += 5; } } - + if (fr[0].matchWord("vertices1")) { if (fr[1].getFloat(domain.v1[0]) && fr[2].getFloat(domain.v1[1]) && fr[3].getFloat(domain.v1[2])) { fr += 4; } } - + if (fr[0].matchWord("vertices2")) { if (fr[1].getFloat(domain.v2[0]) && fr[2].getFloat(domain.v2[1]) && fr[3].getFloat(domain.v2[2])) { fr += 4; } } - + if (fr[0].matchWord("vertices3")) { if (fr[1].getFloat(domain.v3[0]) && fr[2].getFloat(domain.v3[1]) && fr[3].getFloat(domain.v3[2])) { fr += 4; } } - + if (fr[0].matchWord("basis1")) { if (fr[1].getFloat(domain.s1[0]) && fr[2].getFloat(domain.s1[1]) && fr[3].getFloat(domain.s1[2])) { fr += 4; } } - + if (fr[0].matchWord("basis2")) { if (fr[1].getFloat(domain.s2[0]) && fr[2].getFloat(domain.s2[1]) && fr[3].getFloat(domain.s2[2])) { fr += 4; } } - + if (fr[0].matchWord("factors")) { if (fr[1].getFloat(domain.r1) && fr[2].getFloat(domain.r2)) { @@ -93,7 +93,7 @@ bool DomainOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) } } dp.addDomain(domain); - + ++fr; itAdvanced = true; } @@ -103,11 +103,11 @@ bool DomainOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) bool DomainOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { const osgParticle::DomainOperator &dp = static_cast(obj); - + for(unsigned int i=0;i(obj); osg::Vec3 a = ep.getCenter(); fw.indent() << "center " << a.x() << " " << a.y() << " " << a.z() << std::endl; - + fw.indent() << "radius " << ep.getRadius() << std::endl; fw.indent() << "magnitude " << ep.getMagnitude() << std::endl; fw.indent() << "epsilon " << ep.getEpsilon() << std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidFrictionOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidFrictionOperator.cpp index c4938eb52..a460c5f3e 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidFrictionOperator.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidFrictionOperator.cpp @@ -70,7 +70,7 @@ bool FluidFrictionOperator_writeLocalData(const osg::Object &obj, osgDB::Output fw.indent() << "fluidDensity " << aop.getFluidDensity() << std::endl; fw.indent() << "fluidViscosity " << aop.getFluidViscosity() << std::endl; fw.indent() << "overrideRadius " << aop.getOverrideRadius() << std::endl; - + osg::Vec3 w = aop.getWind(); fw.indent() << "wind " << w << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidProgram.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidProgram.cpp index 04fb2dadd..19367b28b 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidProgram.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidProgram.cpp @@ -38,7 +38,7 @@ bool FluidProgram_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("viscosity")) { if (fr[1].getFloat(f)) { myobj.setFluidViscosity(f); @@ -46,7 +46,7 @@ bool FluidProgram_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("density")) { if (fr[1].getFloat(f)) { myobj.setFluidDensity(f); @@ -72,16 +72,16 @@ bool FluidProgram_writeLocalData(const osg::Object &obj, osgDB::Output &fw) osg::Vec3 vec; float f; - + vec = myobj.getAcceleration(); fw.indent() << "acceleration " << vec << std::endl; - + f = myobj.getFluidViscosity(); fw.indent() << "viscosity " << f << std::endl; - + f = myobj.getFluidDensity(); fw.indent() << "density " << f << std::endl; - + vec = myobj.getWind(); fw.indent() << "wind " << vec << std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularEmitter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularEmitter.cpp index ee2691719..6cb393af4 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularEmitter.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularEmitter.cpp @@ -30,7 +30,7 @@ bool ModularEmitter_readLocalData(osg::Object &obj, osgDB::Input &fr) myobj.setCounter(counter); itAdvanced = true; } - + osgParticle::Placer *placer = static_cast(fr.readObjectOfType(osgDB::type_wrapper())); if (placer) { myobj.setPlacer(placer); diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_MultiSegmentPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_MultiSegmentPlacer.cpp index a6a19d8c3..91e3e1df5 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_MultiSegmentPlacer.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_MultiSegmentPlacer.cpp @@ -28,7 +28,7 @@ bool MultiSegmentPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr) osg::Vec3 v; - if (fr[0].matchWord("vertex")) { + if (fr[0].matchWord("vertex")) { if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) { myobj.addVertex(v); fr += 4; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_OrbitOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_OrbitOperator.cpp index a8af27402..eb9b30aa6 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_OrbitOperator.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_OrbitOperator.cpp @@ -34,7 +34,7 @@ bool OrbitOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + float value = 0.0f; if (fr[0].matchWord("magnitude")) { if (fr[1].getFloat(value)) { @@ -43,7 +43,7 @@ bool OrbitOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("epsilon")) { if (fr[1].getFloat(value)) { op.setEpsilon(value); @@ -51,7 +51,7 @@ bool OrbitOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("maxRadius")) { if (fr[1].getFloat(value)) { op.setMaxRadius(value); @@ -68,7 +68,7 @@ bool OrbitOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw) const osgParticle::OrbitOperator &op = static_cast(obj); osg::Vec3 a = op.getCenter(); fw.indent() << "center " << a.x() << " " << a.y() << " " << a.z() << std::endl; - + fw.indent() << "magnitude " << op.getMagnitude() << std::endl; fw.indent() << "epsilon " << op.getEpsilon() << std::endl; fw.indent() << "maxRadius " << op.getMaxRadius() << std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp index efb255e2c..824ad36b2 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp @@ -134,7 +134,7 @@ bool read_particle(osgDB::Input &fr, osgParticle::Particle &P) itAdvanced = true; } } - + // interpolators diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleEffect.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleEffect.cpp index edf895afc..14075fd70 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleEffect.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleEffect.cpp @@ -23,7 +23,7 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) { osgParticle::ParticleEffect& effect = static_cast(object); bool itrAdvanced = false; - + if (fr.matchSequence("textFileName %s")) { effect.setTextureFileName(fr[1].getStr()); @@ -37,7 +37,7 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) fr[1].getFloat(position[0]); fr[2].getFloat(position[1]); fr[3].getFloat(position[2]); - + effect.setPosition(position); fr += 4; @@ -49,17 +49,17 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) float scale; fr[1].getFloat(scale); effect.setScale(scale); - + fr += 2; itrAdvanced = true; } - + if (fr.matchSequence("intensity %f")) { float intensity; fr[1].getFloat(intensity); effect.setIntensity(intensity); - + fr += 2; itrAdvanced = true; } @@ -69,7 +69,7 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) float startTime; fr[1].getFloat(startTime); effect.setStartTime(startTime); - + fr += 2; itrAdvanced = true; } @@ -79,7 +79,7 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) float emitterDuration; fr[1].getFloat(emitterDuration); effect.setEmitterDuration(emitterDuration); - + fr += 2; itrAdvanced = true; } @@ -96,7 +96,7 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) fr += 2; itrAdvanced = true; } - + if (fr[0].matchWord("particleSizeRange")) { osgParticle::rangef r; @@ -131,12 +131,12 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) itrAdvanced = true; } } - + if (particleSet) { effect.setDefaultParticleTemplate(particle); } - + if (fr.matchSequence("wind %f %f %f")) { @@ -144,13 +144,13 @@ bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr) fr[1].getFloat(wind[0]); fr[2].getFloat(wind[1]); fr[3].getFloat(wind[2]); - + effect.setWind(wind); - + fr += 4; itrAdvanced = true; } - + if (fr[0].matchWord("useLocalParticleSystem")) { if (fr[1].matchWord("FALSE")) @@ -215,7 +215,7 @@ bool ParticleEffect_writeLocalData(const osg::Object& object, osgDB::Output& fw) fw.indent()<<"useLocalParticleSystem "; if (effect.getUseLocalParticleSystem()) fw<<"TRUE"< ps_proto = new osgParticle::ParticleSystem; - + osgParticle::ParticleSystem *ps = static_cast(fr.readObjectOfType(*ps_proto)); if (ps) { myobj.setParticleSystem(ps); itAdvanced = true; - } + } if (fr[0].matchWord("enabled")) { if (fr[1].matchWord("TRUE")) { @@ -121,7 +121,7 @@ bool ParticleProcessor_writeLocalData(const osg::Object &obj, osgDB::Output &fw) if (myobj.getParticleSystem()) fw.writeObject(*myobj.getParticleSystem()); fw.indent() << "enabled "; - if (myobj.isEnabled()) + if (myobj.isEnabled()) fw << "TRUE" << std::endl; else fw << "FALSE" << std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystem.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystem.cpp index 49d1b6a4e..7e71ee4fe 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystem.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystem.cpp @@ -85,7 +85,7 @@ bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("useShaders")) { if (fr[1].matchWord("TRUE")) { myobj.setUseShaders(true); @@ -133,7 +133,7 @@ bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("defaultBoundingBox")) { osg::BoundingBox bbox; if ( fr[1].getFloat(bbox.xMin()) && @@ -147,7 +147,7 @@ bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("sortMode")) { if (fr[1].matchWord("NO_SORT")) { myobj.setSortMode(osgParticle::ParticleSystem::NO_SORT); @@ -165,7 +165,7 @@ bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + if (fr[0].matchWord("visibilityDistance")) { double distance; if (fr[1].getFloat(distance)) { @@ -174,15 +174,15 @@ bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - - if (fr[0].matchWord("particleTemplate")) { + + if (fr[0].matchWord("particleTemplate")) { ++fr; itAdvanced = true; osgParticle::Particle P; if (read_particle(fr, P)) { myobj.setDefaultParticleTemplate(P); } - } + } return itAdvanced; } @@ -229,15 +229,15 @@ bool ParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw) fw << "TRUE" << std::endl; else fw << "FALSE" << std::endl; - + fw.indent() << "doublePassRendering "; if (myobj.getDoublePassRendering()) fw << "TRUE" << std::endl; else fw << "FALSE" << std::endl; - + fw.indent() << "frozen "; - if (myobj.isFrozen()) + if (myobj.isFrozen()) fw << "TRUE" << std::endl; else fw << "FALSE" << std::endl; @@ -248,7 +248,7 @@ bool ParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw) else fw << "FALSE" << std::endl; - osg::BoundingBox bbox = myobj.getDefaultBoundingBox(); + osg::BoundingBox bbox = myobj.getDefaultBoundingBox(); fw.indent() << "defaultBoundingBox "; fw << bbox.xMin() << " " << bbox.yMin() << " " << bbox.zMin() << " "; fw << bbox.xMax() << " " << bbox.yMax() << " " << bbox.zMax() << std::endl; @@ -266,7 +266,7 @@ bool ParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw) fw << "SORT_BACK_TO_FRONT" << std::endl; break; } - + fw.indent() << "visibilityDistance " << myobj.getVisibilityDistance() << std::endl; fw.indent() << "particleTemplate "; diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystemUpdater.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystemUpdater.cpp index 71f7fdf35..ce0693c4c 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystemUpdater.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystemUpdater.cpp @@ -20,7 +20,7 @@ REGISTER_DOTOSGWRAPPER(PSU_Proxy) bool PSU_readLocalData(osg::Object &obj, osgDB::Input &fr) { - osgParticle::ParticleSystemUpdater &myobj = static_cast(obj); + osgParticle::ParticleSystemUpdater &myobj = static_cast(obj); bool itAdvanced = false; osg::ref_ptr proto = new osgParticle::ParticleSystem; @@ -35,7 +35,7 @@ bool PSU_readLocalData(osg::Object &obj, osgDB::Input &fr) bool PSU_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { - const osgParticle::ParticleSystemUpdater &myobj = static_cast(obj); + const osgParticle::ParticleSystemUpdater &myobj = static_cast(obj); for (unsigned int i=0; i(obj); osgParticle::rangef r; - + r = myobj.getRadiusRange(); fw.indent() << "radiusRange " << r.minimum << " " << r.maximum << std::endl; r = myobj.getPhiRange(); diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SinkOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SinkOperator.cpp index b0bae2f4a..02f729d6f 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SinkOperator.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SinkOperator.cpp @@ -36,12 +36,12 @@ bool SinkOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) sp.setSinkTarget(osgParticle::SinkOperator::SINK_VELOCITY); else if (str == "angular_velocity") sp.setSinkTarget(osgParticle::SinkOperator::SINK_ANGULAR_VELOCITY); - + fr += 2; itAdvanced = true; } } - + if (fr[0].matchWord("sinkStrategy")) { const char *ptstr = fr[1].getStr(); if (ptstr) { @@ -50,19 +50,19 @@ bool SinkOperator_readLocalData(osg::Object &obj, osgDB::Input &fr) sp.setSinkStrategy(osgParticle::SinkOperator::SINK_INSIDE); else if (str == "outside") sp.setSinkStrategy(osgParticle::SinkOperator::SINK_OUTSIDE); - + fr += 2; itAdvanced = true; } } - + return itAdvanced; } bool SinkOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { const osgParticle::SinkOperator &sp = static_cast(obj); - + fw.indent() << "sinkTarget "; switch (sp.getSinkTarget()) { @@ -75,7 +75,7 @@ bool SinkOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw) default: fw << "undefined" << std::endl; break; } - + fw.indent() << "sinkStrategy "; switch (sp.getSinkStrategy()) { @@ -86,6 +86,6 @@ bool SinkOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw) default: fw << "undefined" << std::endl; break; } - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_VariableRateCounter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_VariableRateCounter.cpp index 0214fa018..d8f533714 100644 --- a/src/osgWrappers/deprecated-dotosg/osgParticle/IO_VariableRateCounter.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_VariableRateCounter.cpp @@ -32,7 +32,7 @@ bool VariableRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + return itAdvanced; } @@ -42,6 +42,6 @@ bool VariableRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &f osgParticle::rangef r = myobj.getRateRange(); fw.indent() << "rateRange " << r.minimum << " " << r.maximum << std::endl; - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowedScene.cpp b/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowedScene.cpp index d5bc81c8d..147e840dc 100644 --- a/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowedScene.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowedScene.cpp @@ -43,7 +43,7 @@ bool ShadowedScene_readLocalData(osg::Object& obj, osgDB::Input &fr) bool ShadowedScene_writeLocalData(const osg::Object& obj, osgDB::Output& fw) { const osgShadow::ShadowedScene& ss = static_cast(obj); - + if (ss.getShadowTechnique()) { fw.writeObject(*ss.getShadowTechnique()); diff --git a/src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp index d810487cf..4034e57ec 100644 --- a/src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp @@ -35,7 +35,7 @@ bool DOFTransform_readLocalData(Object& obj, Input& fr) { fr += 2; // skip over "putMatrix {" iteratorAdvanced = true; - + bool matched = true; for(int k=0;k<16 && matched;++k) { @@ -55,11 +55,11 @@ bool DOFTransform_readLocalData(Object& obj, Input& fr) k++; } } - + dof.setPutMatrix(matrix); dof.setInversePutMatrix(Matrix::inverse(matrix)); } - + fr.advanceToEndOfCurrentBlock(); } @@ -74,20 +74,20 @@ bool DOFTransform_readLocalData(Object& obj, Input& fr) fr+=4; \ iteratorAdvanced = true; \ } \ -} +} Vec3 vec3; - + ReadVec3(setMinHPR,"minHPR") ReadVec3(setMaxHPR,"maxHPR") ReadVec3(setIncrementHPR,"incrementHPR") ReadVec3(setCurrentHPR,"currentHPR") - + ReadVec3(setMinTranslate,"minTranslate") ReadVec3(setMaxTranslate,"maxTranslate") ReadVec3(setIncrementTranslate,"incrementTranslate") ReadVec3(setCurrentTranslate,"currentTranslate") - + ReadVec3(setMinScale,"minScale") ReadVec3(setMaxScale,"maxScale") ReadVec3(setIncrementScale,"incrementScale") @@ -102,30 +102,30 @@ bool DOFTransform_readLocalData(Object& obj, Input& fr) else if(fr[1].matchWord("RHP")) dof.setHPRMultOrder(DOFTransform::RHP); else if(fr[1].matchWord("RPH")) dof.setHPRMultOrder(DOFTransform::RPH); } - + if (fr.matchSequence("limitationFlags %i")) { unsigned int flags; fr[1].getUInt(flags); dof.setLimitationFlags(flags); - + fr += 2; iteratorAdvanced = true; - + } - + if (fr[0].matchWord("animationOn")) { - + if (fr[1].matchWord("TRUE")) dof.setAnimationOn(true); else if (fr[1].matchWord("FALSE")) dof.setAnimationOn(false); - + fr += 2; iteratorAdvanced = true; - + } - + #undef ReadVec3 return iteratorAdvanced; diff --git a/src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp index 1e3bc1e03..a3cea4e1a 100644 --- a/src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp @@ -30,7 +30,7 @@ bool MultiSwitch_readLocalData(Object& obj, Input& fr) if (fr[0].matchWord("NewChildDefaultValue")) { - if (fr[1].matchWord("TRUE")) + if (fr[1].matchWord("TRUE")) { sw.setNewChildDefaultValue(true); iteratorAdvanced = true; @@ -57,7 +57,7 @@ bool MultiSwitch_readLocalData(Object& obj, Input& fr) unsigned int switchSet; fr[1].getUInt(switchSet); fr+=2; - + sw.setActiveSwitchSet(switchSet); } @@ -85,9 +85,9 @@ bool MultiSwitch_readLocalData(Object& obj, Input& fr) } ++fr; - + iteratorAdvanced = true; - + } return iteratorAdvanced; diff --git a/src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp index 2c0973131..7d68a6266 100644 --- a/src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp @@ -77,7 +77,7 @@ bool ElevationSector_readLocalData(osg::Object &obj, osgDB::Input &fr) float minElevation; float maxElevation; float fadeAngle; - + fr[1].getFloat(minElevation); fr[2].getFloat(maxElevation); fr[3].getFloat(fadeAngle); @@ -138,7 +138,7 @@ bool AzimElevationSector_readLocalData(osg::Object &obj, osgDB::Input &fr) float minElevation; float maxElevation; float fadeAngle; - + fr[1].getFloat(minElevation); fr[2].getFloat(maxElevation); fr[3].getFloat(fadeAngle); diff --git a/src/osgWrappers/deprecated-dotosg/osgSim/IO_ShapeAttribute.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_ShapeAttribute.cpp index 7621615d4..a9ae7c0da 100644 --- a/src/osgWrappers/deprecated-dotosg/osgSim/IO_ShapeAttribute.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgSim/IO_ShapeAttribute.cpp @@ -28,9 +28,9 @@ bool ShapeAttributeList_readLocalData(osg::Object &obj, osgDB::Input &fr) bool iteratorAdvanced = false; ShapeAttributeList &sal = static_cast(obj); - + int entry = fr[0].getNoNestedBrackets(); - + while (!fr.eof() && fr[0].getNoNestedBrackets()>=entry) { if (fr.matchSequence("string %s %s")) @@ -61,7 +61,7 @@ bool ShapeAttributeList_readLocalData(osg::Object &obj, osgDB::Input &fr) return iteratorAdvanced; } - + bool ShapeAttributeList_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { const ShapeAttributeList &sal = static_cast(obj); diff --git a/src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp index f43ff39ed..e3228ccae 100644 --- a/src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp @@ -1,13 +1,13 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -43,7 +43,7 @@ bool CompositeLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) osgTerrain::CompositeLayer& layer = static_cast(obj); bool itrAdvanced = false; - + osg::ref_ptr locator = 0; do @@ -87,11 +87,11 @@ bool CompositeLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) if (locator.valid()) proxyLayer->setLocator(locator.get()); if (minLevel!=0) proxyLayer->setMinLevel(minLevel); if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel); - + layer.addLayer(proxyLayer); } - + fr += 2; itrAdvanced = true; @@ -116,9 +116,9 @@ bool CompositeLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) if (readObject.valid()) itrAdvanced = true; } - + } while (itrAdvanced); - + if (locator.valid()) layer.setLocator(locator.get()); return itrAdvanced; @@ -142,22 +142,22 @@ bool CompositeLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw) { fw.writeObject(*locator); } - + if (proxyLayer->getMinLevel()!=0) { fw.indent()<<"MinLevel "<getMinLevel()<getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS) { fw.indent()<<"MaxLevel "<getMaxLevel()<getCompoundName()<(obj); bool itrAdvanced = false; - + if (fr.matchSequence("file %w") || fr.matchSequence("file %s")) { std::string setname; @@ -43,7 +43,7 @@ bool HeightFieldLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) { layer.setName(setname); layer.setFileName(filename); - layer.setHeightField(hf.get()); + layer.setHeightField(hf.get()); } } fr += 2; @@ -58,14 +58,14 @@ bool HeightFieldLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) { layer.setHeightField(hf); } - + return itrAdvanced; } bool HeightFieldLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw) { const osgTerrain::HeightFieldLayer& layer = static_cast(obj); - + if (!layer.getFileName().empty()) { std::string str = osgTerrain::createCompoundSetNameAndFileName(layer.getName(), layer.getFileName()); diff --git a/src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp index 80d2e16ee..b232386a5 100644 --- a/src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp @@ -33,13 +33,13 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) osgTerrain::ImageLayer& layer = static_cast(obj); bool itrAdvanced = false; - + if (fr.matchSequence("file %w") || fr.matchSequence("file %s")) { std::string filename = fr[1].getStr(); if (!filename.empty()) { - bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? + bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading() : false; layer.setFileName(filename); @@ -53,11 +53,11 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) } } } - + fr += 2; itrAdvanced = true; } - + return itrAdvanced; } @@ -67,7 +67,7 @@ bool ImageLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw) const osgTerrain::ImageLayer& layer = static_cast(obj); std::string fileName = layer.getFileName(); - + if (fw.getOutputTextureFiles()) { if (fileName.empty()) diff --git a/src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp index c7de0f615..ada6dc49b 100644 --- a/src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp @@ -34,11 +34,11 @@ bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr) osgTerrain::Layer& layer = static_cast(obj); bool itrAdvanced = false; - + osg::ref_ptr readObject = fr.readObjectOfType(osgDB::type_wrapper()); osgTerrain::Locator* locator = dynamic_cast(readObject.get()); if (locator) layer.setLocator(locator); - + osg::Texture::FilterMode filter; if (fr[0].matchWord("MinFilter") && Layer_matchFilterStr(fr[1].getStr(),filter)) { @@ -76,24 +76,24 @@ bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr) bool Layer_writeLocalData(const osg::Object& obj, osgDB::Output& fw) { const osgTerrain::Layer& layer = static_cast(obj); - + if (layer.getLocator() && !(layer.getLocator()->getDefinedInFile())) { fw.writeObject(*layer.getLocator()); } - + fw.indent()<<"MinFilter "<setMaxLevel(maxLevel); terrainTile.setElevationLayer(proxyLayer); - + fr += 2; localAdvanced = true; @@ -114,7 +114,7 @@ bool TerrainTile_readLocalData(osg::Object& obj, osgDB::Input &fr) unsigned int layerNum = 0; if (firstMatched) { - fr[1].getUInt(layerNum); + fr[1].getUInt(layerNum); ++fr; } @@ -152,8 +152,8 @@ bool TerrainTile_readLocalData(osg::Object& obj, osgDB::Input &fr) if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel); terrainTile.setColorLayer(layerNum, proxyLayer); - } - + } + fr += 2; localAdvanced = true; @@ -197,7 +197,7 @@ bool TerrainTile_readLocalData(osg::Object& obj, osgDB::Input &fr) } } - if (osgTerrain::TerrainTile::getTileLoadedCallback().valid()) + if (osgTerrain::TerrainTile::getTileLoadedCallback().valid()) osgTerrain::TerrainTile::getTileLoadedCallback()->loaded(&terrainTile, fr.getOptions()); return itrAdvanced; @@ -228,7 +228,7 @@ bool TerrainTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw) fw.indent()<<"ElevationLayer {"<(terrainTile.getElevationLayer()); if (proxyLayer) { @@ -243,12 +243,12 @@ bool TerrainTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw) if (proxyLayer->getMinLevel()!=0) { fw.indent()<<"MinLevel "<getMinLevel()<getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS) { fw.indent()<<"MaxLevel "<getMaxLevel()<getFileName()<(layer); if (proxyLayer) { @@ -291,12 +291,12 @@ bool TerrainTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw) if (proxyLayer->getMinLevel()!=0) { fw.indent()<<"MinLevel "<getMinLevel()<getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS) { fw.indent()<<"MaxLevel "<getMaxLevel()<getFileName().empty()) fw.indent()<<"ProxyLayer "<getFileName()<(-1); + else return static_cast(-1); } std::string convertBackdropTypeEnumToString(osgText::Text::BackdropType backdropType) { @@ -56,15 +56,15 @@ std::string convertBackdropTypeEnumToString(osgText::Text::BackdropType backdrop default : return ""; } } - - + + osgText::Text::BackdropImplementation convertBackdropImplementationStringToEnum(std::string & str) { if (str=="POLYGON_OFFSET") return osgText::Text::POLYGON_OFFSET; else if (str=="NO_DEPTH_BUFFER") return osgText::Text::NO_DEPTH_BUFFER; else if (str=="DEPTH_RANGE") return osgText::Text::DEPTH_RANGE; else if (str=="STENCIL_BUFFER") return osgText::Text::STENCIL_BUFFER; - else return static_cast(-1); + else return static_cast(-1); } std::string convertBackdropImplementationEnumToString(osgText::Text::BackdropImplementation backdropImplementation) { @@ -83,7 +83,7 @@ osgText::Text::ColorGradientMode convertColorGradientModeStringToEnum(std::strin if (str=="SOLID") return osgText::Text::SOLID; else if (str=="PER_CHARACTER") return osgText::Text::PER_CHARACTER; else if (str=="OVERALL") return osgText::Text::OVERALL; - else return static_cast(-1); + else return static_cast(-1); } std::string convertColorGradientModeEnumToString(osgText::Text::ColorGradientMode colorGradientMode) { @@ -108,17 +108,17 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr) { std::string str = fr[1].getStr(); osgText::Text::BackdropType backdropType = convertBackdropTypeStringToEnum(str); - + if (backdropType != static_cast(-1)) text.setBackdropType(backdropType); - + fr += 2; itAdvanced = true; } - + float backdropHorizontalOffset = text.getBackdropHorizontalOffset(); float backdropVerticalOffset = text.getBackdropVerticalOffset(); - + // backdropHorizontalOffset if (fr[0].matchWord("backdropHorizontalOffset")) { @@ -139,7 +139,7 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr) } } text.setBackdropOffset(backdropHorizontalOffset, backdropVerticalOffset); - + // backdropColor if (fr[0].matchWord("backdropColor")) { @@ -151,39 +151,39 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + // backdropImplementation if (fr[0].matchWord("backdropImplementation")) { std::string str = fr[1].getStr(); osgText::Text::BackdropImplementation backdropImplementation = convertBackdropImplementationStringToEnum(str); - + if (backdropImplementation != static_cast(-1)) text.setBackdropImplementation(backdropImplementation); - + fr += 2; itAdvanced = true; } - + // ColorGradientMode if (fr[0].matchWord("colorGradientMode")) { std::string str = fr[1].getStr(); osgText::Text::ColorGradientMode colorGradientMode = convertColorGradientModeStringToEnum(str); - + if (colorGradientMode != static_cast(-1)) text.setColorGradientMode(colorGradientMode); - + fr += 2; itAdvanced = true; } - + // ** get default value; osg::Vec4 colorGradientTopLeft = text.getColorGradientTopLeft(); osg::Vec4 colorGradientBottomLeft = text.getColorGradientBottomLeft(); osg::Vec4 colorGradientBottomRight = text.getColorGradientBottomRight(); osg::Vec4 colorGradientTopRight = text.getColorGradientTopRight(); - + // colorGradientTopLeft if (fr[0].matchWord("colorGradientTopLeft")) { @@ -207,7 +207,7 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + // colorGradientBottomRight if (fr[0].matchWord("colorGradientBottomRight")) { @@ -219,7 +219,7 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + // colorGradientTopRight if (fr[0].matchWord("colorGradientTopRight")) { @@ -231,9 +231,9 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr) itAdvanced = true; } } - + text.setColorGradientCorners(colorGradientTopLeft, colorGradientBottomLeft, colorGradientBottomRight, colorGradientTopRight); - + return itAdvanced; } @@ -243,38 +243,38 @@ bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw) // backdropType fw.indent() << "backdropType " << convertBackdropTypeEnumToString(text.getBackdropType()) << std::endl; - + // backdropHorizontalOffset fw.indent() << "backdropHorizontalOffset " << text.getBackdropHorizontalOffset() << std::endl; - + // backdropVerticalOffset fw.indent() << "backdropVerticalOffset " << text.getBackdropVerticalOffset() << std::endl; - + // backdropColor osg::Vec4 c = text.getBackdropColor(); fw.indent() << "backdropColor " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl; - + // backdropImplementation fw.indent() << "backdropImplementation " << convertBackdropImplementationEnumToString(text.getBackdropImplementation()) << std::endl; - + // colorGradientMode fw.indent() << "colorGradientMode " << convertColorGradientModeEnumToString(text.getColorGradientMode()) << std::endl; - + // colorGradientTopLeft c = text.getColorGradientTopLeft(); fw.indent() << "colorGradientTopLeft " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl; - + // colorGradientBottomLeft c = text.getColorGradientBottomLeft(); fw.indent() << "colorGradientBottomLeft " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl; - + // colorGradientBottomRight c = text.getColorGradientBottomRight(); fw.indent() << "colorGradientBottomRight " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl; - + // colorGradientTopRight c = text.getColorGradientTopRight(); fw.indent() << "colorGradientTopRight " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl; - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp b/src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp index 865c184ea..a34178cb9 100644 --- a/src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp @@ -45,7 +45,7 @@ bool Text3D_readLocalData(osg::Object &obj, osgDB::Input &fr) osgText::Text3D &text = static_cast(obj); bool itAdvanced = false; - + // characterDepth if (fr[0].matchWord("characterDepth")) { @@ -68,8 +68,8 @@ bool Text3D_readLocalData(osg::Object &obj, osgDB::Input &fr) } fr += 2; itAdvanced = true; - } - + } + return itAdvanced; } @@ -78,8 +78,8 @@ bool Text3D_writeLocalData(const osg::Object &obj, osgDB::Output &fw) const osgText::Text3D &text = static_cast(obj); fw.indent() << "characterDepth " << text.getCharacterDepth() << std::endl; - + fw.indent() << "renderMode " << convertRenderModeEnumToString(text.getRenderMode()) << std::endl; - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp b/src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp index 0df8fd426..eb383a3f0 100644 --- a/src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp @@ -137,7 +137,7 @@ bool TextBase_readLocalData(osg::Object &obj, osgDB::Input &fr) fr += 2; itAdvanced = true; } - + if (fr.matchSequence("axisAlignment %w")) { std::string str = fr[1].getStr(); @@ -328,7 +328,7 @@ bool TextBase_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { fw.indent() << "maximumWidth " << text.getMaximumWidth() << std::endl; } - + if (text.getMaximumHeight()>0.0f) { fw.indent() << "maximumHeight " << text.getMaximumHeight() << std::endl; @@ -338,7 +338,7 @@ bool TextBase_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { fw.indent() << "lineSpacing " << text.getLineSpacing() << std::endl; } - + // alignment fw.indent() << "alignment "; switch(text.getAlignment()) @@ -346,19 +346,19 @@ bool TextBase_writeLocalData(const osg::Object &obj, osgDB::Output &fw) case osgText::Text::LEFT_TOP: fw << "LEFT_TOP" << std::endl; break; case osgText::Text::LEFT_CENTER : fw << "LEFT_CENTER" << std::endl; break; case osgText::Text::LEFT_BOTTOM : fw << "LEFT_BOTTOM" << std::endl; break; - + case osgText::Text::CENTER_TOP: fw << "CENTER_TOP" << std::endl; break; case osgText::Text::CENTER_CENTER: fw << "CENTER_CENTER" << std::endl; break; case osgText::Text::CENTER_BOTTOM: fw << "CENTER_BOTTOM" << std::endl; break; - + case osgText::Text::RIGHT_TOP: fw << "RIGHT_TOP" << std::endl; break; case osgText::Text::RIGHT_CENTER: fw << "RIGHT_CENTER" << std::endl; break; case osgText::Text::RIGHT_BOTTOM: fw << "RIGHT_BOTTOM" << std::endl; break; - + case osgText::Text::LEFT_BASE_LINE: fw << "LEFT_BASE_LINE" << std::endl; break; case osgText::Text::CENTER_BASE_LINE:fw << "CENTER_BASE_LINE" << std::endl; break; case osgText::Text::RIGHT_BASE_LINE: fw << "RIGHT_BASE_LINE" << std::endl; break; - + case osgText::Text::LEFT_BOTTOM_BASE_LINE: fw << "LEFT_BOTTOM_BASE_LINE" << std::endl; break; case osgText::Text::CENTER_BOTTOM_BASE_LINE:fw << "CENTER_BOTTOM_BASE_LINE" << std::endl; break; case osgText::Text::RIGHT_BOTTOM_BASE_LINE: fw << "RIGHT_BOTTOM_BASE_LINE" << std::endl; break; @@ -426,7 +426,7 @@ bool TextBase_writeLocalData(const osg::Object &obj, osgDB::Output &fw) } //std::copy(textstring.begin(),textstring.end(),std::back_inserter(str)); - + fw.indent() << "text " << fw.wrapString(str) << std::endl; } else diff --git a/src/osgWrappers/deprecated-dotosg/osgViewer/CompositeViewer.cpp b/src/osgWrappers/deprecated-dotosg/osgViewer/CompositeViewer.cpp index da8577601..94a77f638 100644 --- a/src/osgWrappers/deprecated-dotosg/osgViewer/CompositeViewer.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgViewer/CompositeViewer.cpp @@ -33,7 +33,7 @@ bool CompositeViewer_readLocalData(osg::Object& /*obj*/, osgDB::Input& /*fr*/) bool CompositeViewer_writeLocalData(const osg::Object& /*obj*/, osgDB::Output& /*fw*/) { // const osgViewer::CompositeViewer* compositeViewer = dynamic_cast(&obj); - + osg::notify(osg::NOTICE)<<"CompositeViewer_writeLocalData"<allocateImage(1,numPixels,1,GL_LUMINANCE,GL_FLOAT); - + float intensityMultiplier = 0.01f; float* ptr = reinterpret_cast(image->data()); for(unsigned int i=0; isecond * intensityMultiplier; } - + } - + *ptr++ = intensity; } - + return image; } - + } return 0; } @@ -157,7 +157,7 @@ bool View_readLocalData(osg::Object &obj, osgDB::Input &fr) double collar = 0.45; unsigned int screenNum = 0; unsigned int intensityFormat = 8; - osg::Matrix matrix; + osg::Matrix matrix; std::string filename; osg::ref_ptr intensityMap; int entry = fr[0].getNoNestedBrackets(); @@ -174,15 +174,15 @@ bool View_readLocalData(osg::Object &obj, osgDB::Input &fr) if (fr.matchSequence("intensityMap {")) intensityMap = readIntensityImage(fr,local_itrAdvanced); if (fr.read("intensityFormat",intensityFormat)) local_itrAdvanced = true; if (readMatrix(matrix,fr,"projectorMatrix")) local_itrAdvanced = true; - + if (!local_itrAdvanced) ++fr; } - + // skip trailing '}' ++fr; - + iteratorAdvanced = true; - + if (!filename.empty()) { intensityMap = osgDB::readRefImageFile(filename); @@ -205,24 +205,24 @@ bool View_readLocalData(osg::Object &obj, osgDB::Input &fr) int width = 128; int height = 1024; unsigned int screenNum = 0; - + if (fr.read("setUpViewOnSingleScreen",screenNum)) { view.setUpViewOnSingleScreen(screenNum); iteratorAdvanced = true; } - + if (fr.read("setUpViewAcrossAllScreens")) { view.setUpViewAcrossAllScreens(); iteratorAdvanced = true; } - + if (fr.read("setUpViewInWindow",x,y,width,height,screenNum)) { view.setUpViewInWindow(x, y, width, height, screenNum); } - + if (fr.read("setUpViewInWindow",x,y,width,height)) { view.setUpViewInWindow(x, y, width, height); @@ -235,7 +235,7 @@ bool View_readLocalData(osg::Object &obj, osgDB::Input &fr) view.setCamera(static_cast(readObject.get())); iteratorAdvanced = true; } - + if (fr.matchSequence("Slaves {")) { int entry = fr[0].getNoNestedBrackets(); @@ -248,14 +248,14 @@ bool View_readLocalData(osg::Object &obj, osgDB::Input &fr) if (readObject.valid()) view.addSlave(static_cast(readObject.get())); else ++fr; } - + // skip trailing '}' ++fr; - + iteratorAdvanced = true; } - + return iteratorAdvanced; } @@ -269,12 +269,12 @@ bool View_writeLocalData(const osg::Object &obj, osgDB::Output &fw) { fw.writeObject(*view.getCamera()); } - + if (view.getNumSlaves() != 0) { fw.indent()<<"Slaves {"<(obj); bool itrAdvanced = false; - - osg::ref_ptr readObject; + + osg::ref_ptr readObject; do { readObject = fr.readObjectOfType(osgDB::type_wrapper()); if (readObject.valid()) itrAdvanced = true; - + osgVolume::Property* property = dynamic_cast(readObject.get()); if (property) cp.addProperty(property); - + } while (readObject.valid()); return itrAdvanced; diff --git a/src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp index bba4d63ab..49dc9632c 100644 --- a/src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp @@ -34,7 +34,7 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) osgVolume::ImageLayer& layer = static_cast(obj); bool itrAdvanced = false; - + if (fr.matchSequence("file %w") || fr.matchSequence("file %s")) { std::string filename = fr[1].getStr(); @@ -58,7 +58,7 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) if (fileType == osgDB::DIRECTORY) { image = osgDB::readRefImageFile(filename+".dicom"); - + } else if (fileType == osgDB::REGULAR_FILE) { @@ -67,7 +67,7 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) if (image.valid()) - { + { osg::notify(osg::INFO)<<"osgVolume::ImageLayer image read: "<getPixelFormat()<<" textureFormat "<getInternalTextureFormat()<<" dataType "<getDataType()< details = dynamic_cast(image->getUserData()); @@ -89,11 +89,11 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) } } } - + fr += 2; itrAdvanced = true; } - + return itrAdvanced; } @@ -101,7 +101,7 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) bool ImageLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw) { const osgVolume::ImageLayer& layer = static_cast(obj); - + if (!layer.getFileName().empty()) { fw.indent()<<"file "<< layer.getFileName() << std::endl; diff --git a/src/osgWrappers/deprecated-dotosg/osgVolume/ScalarProperty.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/ScalarProperty.cpp index ee231c0ca..198e501b7 100644 --- a/src/osgWrappers/deprecated-dotosg/osgVolume/ScalarProperty.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgVolume/ScalarProperty.cpp @@ -69,7 +69,7 @@ bool ScalarProperty_readLocalData(osg::Object& obj, osgDB::Input &fr) bool itrAdvanced = false; - float value=0; + float value=0; if (fr.read("value",value)) { itrAdvanced = true; diff --git a/src/osgWrappers/deprecated-dotosg/osgVolume/SwitchProperty.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/SwitchProperty.cpp index 123d1d8ae..5d7b6614e 100644 --- a/src/osgWrappers/deprecated-dotosg/osgVolume/SwitchProperty.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgVolume/SwitchProperty.cpp @@ -32,7 +32,7 @@ bool SwitchProperty_readLocalData(osg::Object& obj, osgDB::Input &fr) bool itrAdvanced = false; - int value=0; + int value=0; if (fr.read("activeProperty",value)) { itrAdvanced = true; diff --git a/src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp index e5aec191d..67685183d 100644 --- a/src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp @@ -50,7 +50,7 @@ bool Volume_writeLocalData(const osg::Object& obj, osgDB::Output& fw) if (volume.getVolumeTechniquePrototype()) { fw.writeObject(*volume.getVolumeTechniquePrototype()); - } + } return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp index be3fceef7..0adf96581 100644 --- a/src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp @@ -75,9 +75,9 @@ bool VolumeTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw) if (volumeTile.getVolumeTechnique()) { fw.writeObject(*volumeTile.getVolumeTechnique()); - } + } fw.precision(prec); - + return true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp index 24d87f289..ea0302826 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp @@ -7,7 +7,7 @@ #include #include -bool osgWidget_Box_readData(osg::Object& /*obj*/, osgDB::Input& fr) +bool osgWidget_Box_readData(osg::Object& /*obj*/, osgDB::Input& fr) { /* osgWidget::Box& box = static_cast(obj); @@ -18,7 +18,7 @@ bool osgWidget_Box_readData(osg::Object& /*obj*/, osgDB::Input& fr) model, fr ); - + if(fr[0].matchWord("animation") and fr[1].isString()) iter = loadFile( "animation", &osgCal::osgWidget_Box::loadAnimation, @@ -40,7 +40,7 @@ bool osgWidget_Box_readData(osg::Object& /*obj*/, osgDB::Input& fr) fr ); */ - + osgWidget::warn() << "Box read" << std::endl; return false; @@ -49,7 +49,7 @@ bool osgWidget_Box_readData(osg::Object& /*obj*/, osgDB::Input& fr) bool osgWidget_Box_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::Box& model = static_cast(obj); - + fw.indent() << fw.wrapString("Box stuff...") << std::endl; return true; @@ -66,7 +66,7 @@ bool Model_readData(osg::Object& obj, osgDB::Input& fr) { if(core) { model.create(core); - + iter = true; } diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/EmbeddedWindow.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/EmbeddedWindow.cpp index b17183657..3cbdc54f9 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/EmbeddedWindow.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/EmbeddedWindow.cpp @@ -10,14 +10,14 @@ bool osgWidget_EmbeddedWindow_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "EmbeddedWindow read" << std::endl; - + return false; } bool osgWidget_EmbeddedWindow_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::Window::EmbeddedWindow& model = static_cast(obj); - + fw.indent() << fw.wrapString("EmbeddedWindow stuff...") << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp index 8a0ccbda2..54624d031 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp @@ -10,14 +10,14 @@ bool osgWidget_Frame_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "Frame read" << std::endl; - + return false; } bool osgWidget_Frame_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::Frame& model = static_cast(obj); - + fw.indent() << fw.wrapString("Frame stuff...") << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp index d7edc52cd..280e24e96 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp @@ -7,17 +7,17 @@ #include #include -bool osgWidget_Input_readData(osg::Object& /*obj*/, osgDB::Input& fr) +bool osgWidget_Input_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "Input read" << std::endl; - + return false; } bool osgWidget_Input_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::Input& model = static_cast(obj); - + fw.indent() << fw.wrapString("Input stuff...") << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp index 10bf5bc15..8556a3811 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp @@ -7,17 +7,17 @@ #include #include -bool osgWidget_Label_readData(osg::Object& /*obj*/, osgDB::Input& fr) +bool osgWidget_Label_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "Label read" << std::endl; - + return false; } bool osgWidget_Label_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::Label& model = static_cast(obj); - + fw.indent() << fw.wrapString("Label stuff...") << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/Table.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Table.cpp index 461cfe44a..a98a7f4be 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/Table.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/Table.cpp @@ -9,14 +9,14 @@ bool osgWidget_Table_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "Table read" << std::endl; - + return false; } bool osgWidget_Table_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::Table& model = static_cast(obj); - + fw.indent() << fw.wrapString("Table stuff...") << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/Widget.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Widget.cpp index 62906e913..f9dace966 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/Widget.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/Widget.cpp @@ -10,7 +10,7 @@ bool osgWidget_Widget_readData(osg::Object& obj, osgDB::Input& fr) { osgWidget::warn() << "Widget read" << std::endl; - + return false; } @@ -18,7 +18,7 @@ bool osgWidget_Widget_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::Widget& model = static_cast(obj); - + fw.indent() << fw.wrapString("Widget stuff...") << std::endl; return true; @@ -27,14 +27,14 @@ bool osgWidget_Widget_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) bool osgWidget_NotifyWidget_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "NotifyWidget read" << std::endl; - + return false; } bool osgWidget_NotifyWidget_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::NotifyWidget& model = static_cast(obj); - + fw.indent() << fw.wrapString("NotifyWidget stuff...") << std::endl; return true; @@ -43,14 +43,14 @@ bool osgWidget_NotifyWidget_writeData(const osg::Object& /*obj*/, osgDB::Output& bool osgWidget_NullWidget_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "NullWidget read" << std::endl; - + return false; } bool osgWidget_NullWidget_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::NullWidget& model = static_cast(obj); - + fw.indent() << fw.wrapString("NullWidget stuff...") << std::endl; return true; diff --git a/src/osgWrappers/deprecated-dotosg/osgWidget/WindowManager.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/WindowManager.cpp index 689bf5493..42efec7dd 100644 --- a/src/osgWrappers/deprecated-dotosg/osgWidget/WindowManager.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgWidget/WindowManager.cpp @@ -10,14 +10,14 @@ bool osgWidget_WindowManager_readData(osg::Object& /*obj*/, osgDB::Input& fr) { osgWidget::warn() << "WindowManager read" << std::endl; - + return false; } bool osgWidget_WindowManager_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) { // const osgWidget::WindowManager& model = static_cast(obj); - + fw.indent() << fw.wrapString("WindowManager stuff...") << std::endl; return true; diff --git a/src/osgWrappers/serializers/osg/AlphaFunc.cpp b/src/osgWrappers/serializers/osg/AlphaFunc.cpp index ca7107745..d48ecd9a2 100644 --- a/src/osgWrappers/serializers/osg/AlphaFunc.cpp +++ b/src/osgWrappers/serializers/osg/AlphaFunc.cpp @@ -18,6 +18,6 @@ REGISTER_OBJECT_WRAPPER( AlphaFunc, ADD_ENUM_VALUE( GEQUAL ); ADD_ENUM_VALUE( ALWAYS ); END_ENUM_SERIALIZER(); // _comparisonFunc - + ADD_FLOAT_SERIALIZER( ReferenceValue, 1.0f ); // _referenceValue } diff --git a/src/osgWrappers/serializers/osg/AnimationPath.cpp b/src/osgWrappers/serializers/osg/AnimationPath.cpp index c1337878c..cee1d8804 100644 --- a/src/osgWrappers/serializers/osg/AnimationPath.cpp +++ b/src/osgWrappers/serializers/osg/AnimationPath.cpp @@ -63,7 +63,7 @@ REGISTER_OBJECT_WRAPPER( AnimationPath, "osg::Object osg::AnimationPath" ) { ADD_USER_SERIALIZER( TimeControlPointMap ); // _timeControlPointMap - + BEGIN_ENUM_SERIALIZER( LoopMode, LOOP ); ADD_ENUM_VALUE( SWING ); ADD_ENUM_VALUE( LOOP ); diff --git a/src/osgWrappers/serializers/osg/AutoTransform.cpp b/src/osgWrappers/serializers/osg/AutoTransform.cpp index 7466cafbb..b5c986906 100644 --- a/src/osgWrappers/serializers/osg/AutoTransform.cpp +++ b/src/osgWrappers/serializers/osg/AutoTransform.cpp @@ -14,13 +14,13 @@ REGISTER_OBJECT_WRAPPER( AutoTransform, ADD_VEC3D_SERIALIZER( Scale, osg::Vec3d() ); // _scale ADD_VEC3D_SERIALIZER( PivotPoint, osg::Vec3d() ); // _pivotPoint ADD_FLOAT_SERIALIZER( AutoUpdateEyeMovementTolerance, 0.0f ); // _autoUpdateEyeMovementTolerance - + BEGIN_ENUM_SERIALIZER( AutoRotateMode, NO_ROTATION ); ADD_ENUM_VALUE( NO_ROTATION ); ADD_ENUM_VALUE( ROTATE_TO_SCREEN ); ADD_ENUM_VALUE( ROTATE_TO_CAMERA ); END_ENUM_SERIALIZER(); // _autoRotateMode - + ADD_BOOL_SERIALIZER( AutoScaleToScreen, false ); // _autoScaleToScreen ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation ADD_FLOAT_SERIALIZER( AutoScaleTransitionWidthRatio, 0.25f ); // _autoScaleTransitionWidthRatio diff --git a/src/osgWrappers/serializers/osg/Billboard.cpp b/src/osgWrappers/serializers/osg/Billboard.cpp index 075eccb16..40d2fa2fd 100644 --- a/src/osgWrappers/serializers/osg/Billboard.cpp +++ b/src/osgWrappers/serializers/osg/Billboard.cpp @@ -45,7 +45,7 @@ REGISTER_OBJECT_WRAPPER( Billboard, ADD_ENUM_VALUE( POINT_ROT_WORLD ); ADD_ENUM_VALUE( AXIAL_ROT ); END_ENUM_SERIALIZER(); // _mode - + ADD_VEC3_SERIALIZER( Axis, osg::Vec3f() ); // _axis ADD_VEC3_SERIALIZER( Normal, osg::Vec3f() ); // _normal ADD_USER_SERIALIZER( PositionList ); // _positionList diff --git a/src/osgWrappers/serializers/osg/BlendEquation.cpp b/src/osgWrappers/serializers/osg/BlendEquation.cpp index 539f72f43..55cbc049a 100644 --- a/src/osgWrappers/serializers/osg/BlendEquation.cpp +++ b/src/osgWrappers/serializers/osg/BlendEquation.cpp @@ -18,7 +18,7 @@ REGISTER_OBJECT_WRAPPER( BlendEquation, ADD_ENUM_VALUE( FUNC_SUBTRACT ); ADD_ENUM_VALUE( FUNC_REVERSE_SUBTRACT ); END_ENUM_SERIALIZER(); // _equationRGB - + BEGIN_ENUM_SERIALIZER2( EquationAlpha, osg::BlendEquation::Equation, FUNC_ADD ); ADD_ENUM_VALUE( RGBA_MIN ); ADD_ENUM_VALUE( RGBA_MAX ); diff --git a/src/osgWrappers/serializers/osg/Camera.cpp b/src/osgWrappers/serializers/osg/Camera.cpp index 7dd69aff2..ac3d51cad 100644 --- a/src/osgWrappers/serializers/osg/Camera.cpp +++ b/src/osgWrappers/serializers/osg/Camera.cpp @@ -66,7 +66,7 @@ static osg::Camera::Attachment readBufferAttachment( osgDB::InputStream& is ) } else return attachment; - + is >> osgDB::PROPERTY("MultisampleSamples") >> attachment._multisampleSamples; is >> osgDB::PROPERTY("MultisampleColorSamples") >> attachment._multisampleColorSamples; return attachment; @@ -99,7 +99,7 @@ static void writeBufferAttachment( osgDB::OutputStream& os, const osg::Camera::A os << (char)-1 << std::endl; return; } - + os << osgDB::PROPERTY("MultisampleSamples") << attachment._multisampleSamples << std::endl; os << osgDB::PROPERTY("MultisampleColorSamples") << attachment._multisampleColorSamples << std::endl; } @@ -191,7 +191,7 @@ static bool readBufferAttachmentMap( osgDB::InputStream& is, osg::Camera& node ) is >> osgDB::BEGIN_BRACKET; osg::Camera::Attachment attachment = readBufferAttachment(is); is >> osgDB::END_BRACKET; - + if ( attachment._internalFormat!=GL_NONE ) { node.attach( bufferComponent, attachment._internalFormat ); @@ -241,24 +241,24 @@ REGISTER_OBJECT_WRAPPER( Camera, ADD_INT_SERIALIZER( ClearStencil, 0 ); // _clearStencil ADD_OBJECT_SERIALIZER( ColorMask, osg::ColorMask, NULL ); // _colorMask ADD_OBJECT_SERIALIZER( Viewport, osg::Viewport, NULL ); // _viewport - + BEGIN_ENUM_SERIALIZER( TransformOrder, PRE_MULTIPLY ); ADD_ENUM_VALUE( PRE_MULTIPLY ); ADD_ENUM_VALUE( POST_MULTIPLY ); END_ENUM_SERIALIZER(); // _transformOrder - + BEGIN_ENUM_SERIALIZER( ProjectionResizePolicy, HORIZONTAL ); ADD_ENUM_VALUE( FIXED ); ADD_ENUM_VALUE( HORIZONTAL ); ADD_ENUM_VALUE( VERTICAL ); END_ENUM_SERIALIZER(); // _projectionResizePolicy - + ADD_MATRIXD_SERIALIZER( ProjectionMatrix, osg::Matrixd() ); // _projectionMatrix ADD_MATRIXD_SERIALIZER( ViewMatrix, osg::Matrixd() ); // _viewMatrix ADD_USER_SERIALIZER( RenderOrder ); // _renderOrder & _renderOrderNum ADD_GLENUM_SERIALIZER( DrawBuffer, GLenum, GL_NONE ); // _drawBuffer ADD_GLENUM_SERIALIZER( ReadBuffer, GLenum, GL_NONE ); // _readBuffer - + BEGIN_ENUM_SERIALIZER( RenderTargetImplementation, FRAME_BUFFER ); ADD_ENUM_VALUE( FRAME_BUFFER_OBJECT ); ADD_ENUM_VALUE( PIXEL_BUFFER_RTT ); @@ -266,7 +266,7 @@ REGISTER_OBJECT_WRAPPER( Camera, ADD_ENUM_VALUE( FRAME_BUFFER ); ADD_ENUM_VALUE( SEPERATE_WINDOW ); END_ENUM_SERIALIZER(); // _renderTargetImplementation - + ADD_USER_SERIALIZER( BufferAttachmentMap ); // _bufferAttachmentMap ADD_OBJECT_SERIALIZER( InitialDrawCallback, osg::Camera::DrawCallback, NULL ); // _initialDrawCallback ADD_OBJECT_SERIALIZER( PreDrawCallback, osg::Camera::DrawCallback, NULL ); // _preDrawCallback diff --git a/src/osgWrappers/serializers/osg/CameraView.cpp b/src/osgWrappers/serializers/osg/CameraView.cpp index 17b3ed037..8fcca5e78 100644 --- a/src/osgWrappers/serializers/osg/CameraView.cpp +++ b/src/osgWrappers/serializers/osg/CameraView.cpp @@ -11,12 +11,12 @@ REGISTER_OBJECT_WRAPPER( CameraView, ADD_VEC3D_SERIALIZER( Position, osg::Vec3d() ); // _position ADD_QUAT_SERIALIZER( Attitude, osg::Quat() ); // _attitude ADD_DOUBLE_SERIALIZER( FieldOfView, 60.0 ); // _fieldOfView - + BEGIN_ENUM_SERIALIZER( FieldOfViewMode, VERTICAL ); ADD_ENUM_VALUE( UNCONSTRAINED ); ADD_ENUM_VALUE( HORIZONTAL ); ADD_ENUM_VALUE( VERTICAL ); END_ENUM_SERIALIZER(); // _fieldOfViewMode - + ADD_DOUBLE_SERIALIZER( FocalLength, 0.0 ); // _focalLength } diff --git a/src/osgWrappers/serializers/osg/ClipNode.cpp b/src/osgWrappers/serializers/osg/ClipNode.cpp index 6c9497bd7..705d0e89f 100644 --- a/src/osgWrappers/serializers/osg/ClipNode.cpp +++ b/src/osgWrappers/serializers/osg/ClipNode.cpp @@ -9,7 +9,7 @@ REGISTER_OBJECT_WRAPPER( ClipNode, "osg::Object osg::Node osg::Group osg::ClipNode" ) { ADD_LIST_SERIALIZER( ClipPlaneList, osg::ClipNode::ClipPlaneList ); // _planes - + BEGIN_ENUM_SERIALIZER( ReferenceFrame, RELATIVE_RF ); ADD_ENUM_VALUE( RELATIVE_RF ); ADD_ENUM_VALUE( ABSOLUTE_RF ); diff --git a/src/osgWrappers/serializers/osg/Depth.cpp b/src/osgWrappers/serializers/osg/Depth.cpp index c16f953f8..30348e321 100644 --- a/src/osgWrappers/serializers/osg/Depth.cpp +++ b/src/osgWrappers/serializers/osg/Depth.cpp @@ -18,7 +18,7 @@ REGISTER_OBJECT_WRAPPER( Depth, ADD_ENUM_VALUE( GEQUAL ); ADD_ENUM_VALUE( ALWAYS ); END_ENUM_SERIALIZER(); // _func - + ADD_DOUBLE_SERIALIZER( ZNear, 0.0 ); // _zNear ADD_DOUBLE_SERIALIZER( ZFar, 1.0 ); // _zFar ADD_BOOL_SERIALIZER( WriteMask, true ); // _depthWriteMask diff --git a/src/osgWrappers/serializers/osg/Fog.cpp b/src/osgWrappers/serializers/osg/Fog.cpp index f195da762..9bdb31add 100644 --- a/src/osgWrappers/serializers/osg/Fog.cpp +++ b/src/osgWrappers/serializers/osg/Fog.cpp @@ -13,7 +13,7 @@ REGISTER_OBJECT_WRAPPER( Fog, ADD_ENUM_VALUE( EXP ); ADD_ENUM_VALUE( EXP2 ); END_ENUM_SERIALIZER(); // _mode - + ADD_FLOAT_SERIALIZER( Start, 0.0f ); // _start ADD_FLOAT_SERIALIZER( End, 1.0f ); // _end ADD_FLOAT_SERIALIZER( Density, 1.0f ); // _density diff --git a/src/osgWrappers/serializers/osg/Geometry.cpp b/src/osgWrappers/serializers/osg/Geometry.cpp index 9f20d640f..abe0c906d 100644 --- a/src/osgWrappers/serializers/osg/Geometry.cpp +++ b/src/osgWrappers/serializers/osg/Geometry.cpp @@ -19,14 +19,14 @@ static void readArrayData( osgDB::InputStream& is, osg::Geometry::ArrayData& dat bool hasArray = false; is >> osgDB::PROPERTY("Array") >> hasArray; if ( hasArray ) data.array = is.readArray(); - + bool hasIndices = false; is >> osgDB::PROPERTY("Indices") >> hasIndices; if ( hasIndices ) data.indices = dynamic_cast( is.readArray() ); - + is >> osgDB::PROPERTY("Binding"); data.binding = (osg::Geometry::AttributeBinding)readAttributeBinding(is); - + int normalizeValue = 0; is >> osgDB::PROPERTY("Normalize") >> normalizeValue; data.normalize = normalizeValue; @@ -37,11 +37,11 @@ static void writeArrayData( osgDB::OutputStream& os, const osg::Geometry::ArrayD os << osgDB::PROPERTY("Array") << data.array.valid(); if ( data.array.valid() ) os << data.array.get(); else os << std::endl; - + os << osgDB::PROPERTY("Indices") << data.indices.valid(); if ( data.indices.valid() ) os << data.indices.get(); else os << std::endl; - + os << osgDB::PROPERTY("Binding"); writeAttributeBinding(os, data.binding); os << std::endl; os << osgDB::PROPERTY("Normalize") << (int)data.normalize << std::endl; } diff --git a/src/osgWrappers/serializers/osg/HeightField.cpp b/src/osgWrappers/serializers/osg/HeightField.cpp index e66536ae8..ce64e301e 100644 --- a/src/osgWrappers/serializers/osg/HeightField.cpp +++ b/src/osgWrappers/serializers/osg/HeightField.cpp @@ -36,7 +36,7 @@ static bool readHeights( osgDB::InputStream& is, osg::HeightField& shape ) { unsigned int numCols = shape.getNumColumns(), numRows = shape.getNumRows(); if ( array->size()> osgDB::BEGIN_BRACKET; - osg::Object* object = is.readObject(); - if(object) obj.setUserData(object); + osg::Object* object = is.readObject(); + if(object) obj.setUserData(object); is >> osgDB::END_BRACKET; return true; } @@ -23,7 +23,7 @@ static bool readUserData( osgDB::InputStream& is, osg::Object& obj ) static bool writeUserData( osgDB::OutputStream& os, const osg::Object& obj ) { os << osgDB::BEGIN_BRACKET << std::endl; - os.writeObject(dynamic_cast(obj.getUserData())); + os.writeObject(dynamic_cast(obj.getUserData())); os << osgDB::END_BRACKET << std::endl; return true; } @@ -34,7 +34,7 @@ REGISTER_OBJECT_WRAPPER( Object, "osg::Object" ) { ADD_STRING_SERIALIZER( Name, "" ); // _name - + BEGIN_ENUM_SERIALIZER( DataVariance, UNSPECIFIED ); ADD_ENUM_VALUE( STATIC ); ADD_ENUM_VALUE( DYNAMIC ); @@ -42,7 +42,7 @@ REGISTER_OBJECT_WRAPPER( Object, END_ENUM_SERIALIZER(); // _dataVariance ADD_USER_SERIALIZER( UserData ); // _userData, deprecated - + UPDATE_TO_VERSION( 77 ) { REMOVE_SERIALIZER( UserData ); diff --git a/src/osgWrappers/serializers/osg/PagedLOD.cpp b/src/osgWrappers/serializers/osg/PagedLOD.cpp index 94e28b7a3..2f7aec4a4 100644 --- a/src/osgWrappers/serializers/osg/PagedLOD.cpp +++ b/src/osgWrappers/serializers/osg/PagedLOD.cpp @@ -53,13 +53,13 @@ static bool readRangeDataList( osgDB::InputStream& is, osg::PagedLOD& node ) node.setFileName( i, name ); } is >> osgDB::END_BRACKET; - + size = 0; is >> osgDB::PROPERTY("PriorityList") >> size >> osgDB::BEGIN_BRACKET; for ( unsigned int i=0; i> offset >> scale; - + node.setPriorityOffset( i, offset ); node.setPriorityScale( i, scale ); } @@ -77,7 +77,7 @@ static bool writeRangeDataList( osgDB::OutputStream& os, const osg::PagedLOD& no os << std::endl; } os << osgDB::END_BRACKET << std::endl; - + size = node.getNumPriorityOffsets(); os << osgDB::PROPERTY("PriorityList") << size << osgDB::BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i0 ) { @@ -137,7 +137,7 @@ REGISTER_OBJECT_WRAPPER( PagedLOD, "osg::Object osg::Node osg::LOD osg::PagedLOD" ) { // Note: osg::Group is not in the list to prevent recording dynamic loaded children - + ADD_USER_SERIALIZER( DatabasePath ); // _databasePath ADD_UINT_SERIALIZER( FrameNumberOfLastTraversal, 0 ); // _frameNumberOfLastTraversal, note, not required, removed from soversion 70 onwwards, see below ADD_UINT_SERIALIZER( NumChildrenThatCannotBeExpired, 0 ); // _numChildrenThatCannotBeExpired @@ -147,9 +147,9 @@ REGISTER_OBJECT_WRAPPER( PagedLOD, UPDATE_TO_VERSION( 70 ) { - REMOVE_SERIALIZER( FrameNumberOfLastTraversal ); + REMOVE_SERIALIZER( FrameNumberOfLastTraversal ); } - + } diff --git a/src/osgWrappers/serializers/osg/PolygonMode.cpp b/src/osgWrappers/serializers/osg/PolygonMode.cpp index 8cdb0c21e..734db5157 100644 --- a/src/osgWrappers/serializers/osg/PolygonMode.cpp +++ b/src/osgWrappers/serializers/osg/PolygonMode.cpp @@ -24,7 +24,7 @@ static bool readMode( osgDB::InputStream& is, osg::PolygonMode& attr ) is >> osgDB::PROPERTY("UseFrontAndBack") >> frontAndBack; is >> osgDB::PROPERTY("Front"); int value1 = readModeValue(is); is >> osgDB::PROPERTY("Back"); int value2 = readModeValue(is); - + if ( frontAndBack ) attr.setMode( osg::PolygonMode::FRONT_AND_BACK, (osg::PolygonMode::Mode)value1 ); else @@ -38,11 +38,11 @@ static bool readMode( osgDB::InputStream& is, osg::PolygonMode& attr ) static bool writeMode( osgDB::OutputStream& os, const osg::PolygonMode& attr ) { os << osgDB::PROPERTY("UseFrontAndBack") << attr.getFrontAndBack() << std::endl; - + os << osgDB::PROPERTY("Front"); writeModeValue( os, (int)attr.getMode(osg::PolygonMode::FRONT) ); os << std::endl; - + os << osgDB::PROPERTY("Back"); writeModeValue( os, (int)attr.getMode(osg::PolygonMode::BACK) ); os << std::endl; diff --git a/src/osgWrappers/serializers/osg/ProxyNode.cpp b/src/osgWrappers/serializers/osg/ProxyNode.cpp index 9b12600fe..bc32011d5 100644 --- a/src/osgWrappers/serializers/osg/ProxyNode.cpp +++ b/src/osgWrappers/serializers/osg/ProxyNode.cpp @@ -62,7 +62,7 @@ static bool writeChildren( osgDB::OutputStream& os, const osg::ProxyNode& node ) if ( !node.getFileName(i).empty() ) dynamicLoadedSize++; } - + unsigned int realSize = size-dynamicLoadedSize; os << realSize; if ( realSize>0 ) { @@ -104,13 +104,13 @@ struct ProxyNodeFinishedObjectReadCallback : public osgDB::FinishedObjectReadCal virtual void objectRead(osgDB::InputStream& is, osg::Object& obj) { osg::ProxyNode& proxyNode = static_cast(obj); - + if (proxyNode.getLoadingExternalReferenceMode() == osg::ProxyNode::LOAD_IMMEDIATELY) { for(unsigned int i=0; i= proxyNode.getNumChildren() && !proxyNode.getFileName(i).empty()) - { + { osgDB::FilePathList& fpl = ((osgDB::ReaderWriter::Options*)is.getOptions())->getDatabasePathList(); fpl.push_front( fpl.empty() ? osgDB::getFilePath(proxyNode.getFileName(i)) : fpl.front()+'/'+ osgDB::getFilePath(proxyNode.getFileName(i))); osg::Node* node = osgDB::readNodeFile(proxyNode.getFileName(i), is.getOptions()); @@ -129,23 +129,23 @@ REGISTER_OBJECT_WRAPPER( ProxyNode, "osg::Object osg::Node osg::ProxyNode" ) { // Note: osg::Group is not in the list to prevent recording dynamic loaded children - + ADD_USER_SERIALIZER( FileNames ); // _filenameList ADD_USER_SERIALIZER( Children ); // _children (which are not loaded from external) ADD_STRING_SERIALIZER( DatabasePath, "" ); // _databasePath - + BEGIN_ENUM_SERIALIZER( LoadingExternalReferenceMode, LOAD_IMMEDIATELY ); ADD_ENUM_VALUE( LOAD_IMMEDIATELY ); ADD_ENUM_VALUE( DEFER_LOADING_TO_DATABASE_PAGER ); ADD_ENUM_VALUE( NO_AUTOMATIC_LOADING ); END_ENUM_SERIALIZER(); // _loadingExtReference - + BEGIN_ENUM_SERIALIZER( CenterMode, USE_BOUNDING_SPHERE_CENTER ); ADD_ENUM_VALUE( USE_BOUNDING_SPHERE_CENTER ); ADD_ENUM_VALUE( USER_DEFINED_CENTER ); ADD_ENUM_VALUE( UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED ); END_ENUM_SERIALIZER(); // _centerMode - + ADD_USER_SERIALIZER( UserCenter ); // _userDefinedCenter, _radius wrapper->addFinishedObjectReadCallback(new ProxyNodeFinishedObjectReadCallback()); diff --git a/src/osgWrappers/serializers/osg/Sequence.cpp b/src/osgWrappers/serializers/osg/Sequence.cpp index 5ee6fa0e4..6d2c78da0 100644 --- a/src/osgWrappers/serializers/osg/Sequence.cpp +++ b/src/osgWrappers/serializers/osg/Sequence.cpp @@ -9,26 +9,26 @@ REGISTER_OBJECT_WRAPPER( Sequence, "osg::Object osg::Node osg::Group osg::Sequence" ) { ADD_LIST_SERIALIZER( TimeList, std::vector ); // _frameTime - + BEGIN_ENUM_SERIALIZER( LoopMode, LOOP ); ADD_ENUM_VALUE( LOOP ); ADD_ENUM_VALUE( SWING ); END_ENUM_SERIALIZER(); // _loopMode - + ADD_INT_SERIALIZER( Begin, 0 ); // _begin ADD_INT_SERIALIZER( End, -1 ); // _end ADD_FLOAT_SERIALIZER( Speed, 0.0f ); // _speed ADD_INT_SERIALIZER( NumRepeats, -1 ); // _nreps ADD_DOUBLE_SERIALIZER( DefaultTime, 1.0 ); // _defaultTime ADD_DOUBLE_SERIALIZER( LastFrameTime, 0.0 ); // _lastFrameTime - + BEGIN_ENUM_SERIALIZER2( Mode, osg::Sequence::SequenceMode, STOP ); ADD_ENUM_VALUE( START ); ADD_ENUM_VALUE( STOP ); ADD_ENUM_VALUE( PAUSE ); ADD_ENUM_VALUE( RESUME ); END_ENUM_SERIALIZER(); // _mode - + ADD_BOOL_SERIALIZER( Sync, false ); // _sync ADD_BOOL_SERIALIZER( ClearOnStop, false ); // _clearOnStop } diff --git a/src/osgWrappers/serializers/osg/Shader.cpp b/src/osgWrappers/serializers/osg/Shader.cpp index 1d6e1b134..f98f43663 100644 --- a/src/osgWrappers/serializers/osg/Shader.cpp +++ b/src/osgWrappers/serializers/osg/Shader.cpp @@ -32,7 +32,7 @@ static bool writeShaderSource( osgDB::OutputStream& os, const osg::Shader& shade { lines.push_back( line ); } - + os.writeSize(lines.size()); os << osgDB::BEGIN_BRACKET << std::endl; for ( std::vector::const_iterator itr=lines.begin(); itr!=lines.end(); ++itr ) @@ -57,7 +57,7 @@ REGISTER_OBJECT_WRAPPER( Shader, ADD_ENUM_VALUE( GEOMETRY ); ADD_ENUM_VALUE( UNDEFINED ); END_ENUM_SERIALIZER(); // _type - + ADD_USER_SERIALIZER( ShaderSource ); // _shaderSource ADD_OBJECT_SERIALIZER( ShaderBinary, osg::ShaderBinary, NULL ); // _shaderBinary } diff --git a/src/osgWrappers/serializers/osg/StateSet.cpp b/src/osgWrappers/serializers/osg/StateSet.cpp index 60c69eff0..c41990c83 100644 --- a/src/osgWrappers/serializers/osg/StateSet.cpp +++ b/src/osgWrappers/serializers/osg/StateSet.cpp @@ -291,13 +291,13 @@ REGISTER_OBJECT_WRAPPER( StateSet, ADD_USER_SERIALIZER( TextureAttributeList ); // _textureAttributeList ADD_USER_SERIALIZER( UniformList ); // _uniformList ADD_INT_SERIALIZER( RenderingHint, osg::StateSet::DEFAULT_BIN ); // _renderingHint - + BEGIN_ENUM_SERIALIZER( RenderBinMode, INHERIT_RENDERBIN_DETAILS ); ADD_ENUM_VALUE( INHERIT_RENDERBIN_DETAILS ); ADD_ENUM_VALUE( USE_RENDERBIN_DETAILS ); ADD_ENUM_VALUE( OVERRIDE_RENDERBIN_DETAILS ); END_ENUM_SERIALIZER(); // _binMode - + ADD_INT_SERIALIZER( BinNumber, 0 ); // _binNum ADD_STRING_SERIALIZER( BinName, "" ); // _binName ADD_BOOL_SERIALIZER( NestRenderBins, true ); // _nestRenderBins diff --git a/src/osgWrappers/serializers/osg/Stencil.cpp b/src/osgWrappers/serializers/osg/Stencil.cpp index c702e37af..a80d23022 100644 --- a/src/osgWrappers/serializers/osg/Stencil.cpp +++ b/src/osgWrappers/serializers/osg/Stencil.cpp @@ -18,10 +18,10 @@ REGISTER_OBJECT_WRAPPER( Stencil, ADD_ENUM_VALUE( GEQUAL ); ADD_ENUM_VALUE( ALWAYS ); END_ENUM_SERIALIZER(); // _func - + ADD_INT_SERIALIZER( FunctionRef, 0 ); // _funcRef ADD_HEXINT_SERIALIZER( FunctionMask, ~0u ); // _funcMask - + BEGIN_ENUM_SERIALIZER2( StencilFailOperation, osg::Stencil::Operation, KEEP ); ADD_ENUM_VALUE( KEEP ); ADD_ENUM_VALUE( ZERO ); @@ -32,7 +32,7 @@ REGISTER_OBJECT_WRAPPER( Stencil, ADD_ENUM_VALUE( INCR_WRAP ); ADD_ENUM_VALUE( DECR_WRAP ); END_ENUM_SERIALIZER(); // _sfail - + BEGIN_ENUM_SERIALIZER2( StencilPassAndDepthFailOperation, osg::Stencil::Operation, KEEP ); ADD_ENUM_VALUE( KEEP ); ADD_ENUM_VALUE( ZERO ); @@ -43,7 +43,7 @@ REGISTER_OBJECT_WRAPPER( Stencil, ADD_ENUM_VALUE( INCR_WRAP ); ADD_ENUM_VALUE( DECR_WRAP ); END_ENUM_SERIALIZER(); // _zfail - + BEGIN_ENUM_SERIALIZER2( StencilPassAndDepthPassOperation, osg::Stencil::Operation, KEEP ); ADD_ENUM_VALUE( KEEP ); ADD_ENUM_VALUE( ZERO ); @@ -54,6 +54,6 @@ REGISTER_OBJECT_WRAPPER( Stencil, ADD_ENUM_VALUE( INCR_WRAP ); ADD_ENUM_VALUE( DECR_WRAP ); END_ENUM_SERIALIZER(); // _zpass - + ADD_HEXINT_SERIALIZER( WriteMask, ~0u ); // _writeMask } diff --git a/src/osgWrappers/serializers/osg/TessellationHints.cpp b/src/osgWrappers/serializers/osg/TessellationHints.cpp index 09d28e064..52de1655f 100644 --- a/src/osgWrappers/serializers/osg/TessellationHints.cpp +++ b/src/osgWrappers/serializers/osg/TessellationHints.cpp @@ -12,7 +12,7 @@ REGISTER_OBJECT_WRAPPER( TessellationHints, ADD_ENUM_VALUE( USE_SHAPE_DEFAULTS ); ADD_ENUM_VALUE( USE_TARGET_NUM_FACES ); END_ENUM_SERIALIZER(); // _TessellationMode - + ADD_FLOAT_SERIALIZER( DetailRatio, 1.0f ); // _detailRatio ADD_UINT_SERIALIZER( TargetNumFaces, 100 ); // _targetNumFaces ADD_BOOL_SERIALIZER( CreateFrontFace, true ); // _createFrontFace diff --git a/src/osgWrappers/serializers/osg/TexEnv.cpp b/src/osgWrappers/serializers/osg/TexEnv.cpp index ce2e7ebdd..b6146e5f1 100644 --- a/src/osgWrappers/serializers/osg/TexEnv.cpp +++ b/src/osgWrappers/serializers/osg/TexEnv.cpp @@ -15,6 +15,6 @@ REGISTER_OBJECT_WRAPPER( TexEnv, ADD_ENUM_VALUE( REPLACE ); ADD_ENUM_VALUE( ADD ); END_ENUM_SERIALIZER(); // _mode - + ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color } diff --git a/src/osgWrappers/serializers/osg/TexGen.cpp b/src/osgWrappers/serializers/osg/TexGen.cpp index d4b6455ae..518a72b94 100644 --- a/src/osgWrappers/serializers/osg/TexGen.cpp +++ b/src/osgWrappers/serializers/osg/TexGen.cpp @@ -32,7 +32,7 @@ REGISTER_OBJECT_WRAPPER( TexGen, ADD_ENUM_VALUE( NORMAL_MAP ); ADD_ENUM_VALUE( REFLECTION_MAP ); END_ENUM_SERIALIZER(); // _mode - + ADD_USER_SERIALIZER( PlaneS ); ADD_USER_SERIALIZER( PlaneT ); ADD_USER_SERIALIZER( PlaneR ); diff --git a/src/osgWrappers/serializers/osg/TexGenNode.cpp b/src/osgWrappers/serializers/osg/TexGenNode.cpp index 78c2aa2bc..4cd576d08 100644 --- a/src/osgWrappers/serializers/osg/TexGenNode.cpp +++ b/src/osgWrappers/serializers/osg/TexGenNode.cpp @@ -10,7 +10,7 @@ REGISTER_OBJECT_WRAPPER( TexGenNode, { ADD_UINT_SERIALIZER( TextureUnit, 0 ); // _textureUnit ADD_OBJECT_SERIALIZER( TexGen, osg::TexGen, NULL ); // _texgen - + BEGIN_ENUM_SERIALIZER( ReferenceFrame, RELATIVE_RF ); ADD_ENUM_VALUE( RELATIVE_RF ); ADD_ENUM_VALUE( ABSOLUTE_RF ); diff --git a/src/osgWrappers/serializers/osg/Texture.cpp b/src/osgWrappers/serializers/osg/Texture.cpp index 237093132..9d15a16f7 100644 --- a/src/osgWrappers/serializers/osg/Texture.cpp +++ b/src/osgWrappers/serializers/osg/Texture.cpp @@ -87,7 +87,7 @@ REGISTER_OBJECT_WRAPPER( Texture, ADD_BOOL_SERIALIZER( ResizeNonPowerOfTwoHint, true ); // _resizeNonPowerOfTwoHint ADD_VEC4D_SERIALIZER( BorderColor, osg::Vec4d(0.0,0.0,0.0,0.0) ); // _borderColor ADD_GLINT_SERIALIZER( BorderWidth, 0 ); // _borderWidth - + BEGIN_ENUM_SERIALIZER( InternalFormatMode, USE_IMAGE_DATA_FORMAT ); ADD_ENUM_VALUE( USE_IMAGE_DATA_FORMAT ); ADD_ENUM_VALUE( USE_USER_DEFINED_FORMAT ); @@ -103,12 +103,12 @@ REGISTER_OBJECT_WRAPPER( Texture, ADD_ENUM_VALUE( USE_S3TC_DXT1c_COMPRESSION ); ADD_ENUM_VALUE( USE_S3TC_DXT1a_COMPRESSION ); END_ENUM_SERIALIZER(); // _internalFormatMode - + ADD_USER_SERIALIZER( InternalFormat ); // _internalFormat ADD_USER_SERIALIZER( SourceFormat ); // _sourceFormat ADD_USER_SERIALIZER( SourceType ); // _sourceType ADD_BOOL_SERIALIZER( ShadowComparison, false ); // _use_shadow_comparison - + BEGIN_ENUM_SERIALIZER( ShadowCompareFunc, LEQUAL ); ADD_ENUM_VALUE( NEVER ); ADD_ENUM_VALUE( LESS ); @@ -119,12 +119,12 @@ REGISTER_OBJECT_WRAPPER( Texture, ADD_ENUM_VALUE( GEQUAL ); ADD_ENUM_VALUE( ALWAYS ); END_ENUM_SERIALIZER(); // _shadow_compare_func - + BEGIN_ENUM_SERIALIZER( ShadowTextureMode, LUMINANCE ); ADD_ENUM_VALUE( LUMINANCE ); ADD_ENUM_VALUE( INTENSITY ); ADD_ENUM_VALUE( ALPHA ); END_ENUM_SERIALIZER(); // _shadow_texture_mode - + ADD_FLOAT_SERIALIZER( ShadowAmbient, 0.0f ); // _shadow_ambient } diff --git a/src/osgWrappers/serializers/osg/TextureCubeMap.cpp b/src/osgWrappers/serializers/osg/TextureCubeMap.cpp index e7c5b8d88..131c89e04 100644 --- a/src/osgWrappers/serializers/osg/TextureCubeMap.cpp +++ b/src/osgWrappers/serializers/osg/TextureCubeMap.cpp @@ -42,7 +42,7 @@ REGISTER_OBJECT_WRAPPER( TextureCubeMap, ADD_USER_SERIALIZER( NegY ); ADD_USER_SERIALIZER( PosZ ); ADD_USER_SERIALIZER( NegZ ); // _images - + ADD_INT_SERIALIZER( TextureWidth, 0 ); // _textureWidth ADD_INT_SERIALIZER( TextureHeight, 0 ); // _textureHeight } diff --git a/src/osgWrappers/serializers/osg/Uniform.cpp b/src/osgWrappers/serializers/osg/Uniform.cpp index bfa4cb4cd..7f243f4c8 100644 --- a/src/osgWrappers/serializers/osg/Uniform.cpp +++ b/src/osgWrappers/serializers/osg/Uniform.cpp @@ -109,7 +109,7 @@ REGISTER_OBJECT_WRAPPER( Uniform, ADD_ENUM_VALUE( UNSIGNED_INT_SAMPLER_BUFFER ); ADD_ENUM_VALUE( UNDEFINED ); END_ENUM_SERIALIZER(); // _type - + ADD_UINT_SERIALIZER( NumElements, 0 ); // _numElements ADD_USER_SERIALIZER( Elements ); // _floatArray, _intArray, _uintArray ADD_OBJECT_SERIALIZER( UpdateCallback, osg::Uniform::Callback, NULL ); // _updateCallback diff --git a/src/osgWrappers/serializers/osg/ValueObject.cpp b/src/osgWrappers/serializers/osg/ValueObject.cpp index c8f4c1709..dfa356ecd 100644 --- a/src/osgWrappers/serializers/osg/ValueObject.cpp +++ b/src/osgWrappers/serializers/osg/ValueObject.cpp @@ -16,7 +16,7 @@ SERIALIZER_TYPE( Value, DEFAULT ); \ } \ } \ - + WRAPVALUEOBJECT( BoolValueObject, "osg::Object osg::BoolValueObject", ADD_REF_BOOL_SERIALIZER, 0) WRAPVALUEOBJECT( CharValueObject, "osg::Object osg::CharValueObject", ADD_REF_CHAR_SERIALIZER, 0) diff --git a/src/osgWrappers/serializers/osgAnimation/Animation.cpp b/src/osgWrappers/serializers/osgAnimation/Animation.cpp index 5f08723c0..3a4ba4e5b 100644 --- a/src/osgWrappers/serializers/osgAnimation/Animation.cpp +++ b/src/osgWrappers/serializers/osgAnimation/Animation.cpp @@ -154,7 +154,7 @@ static bool readChannels( osgDB::InputStream& is, osgAnimation::Animation& ani ) { std::string type; is >> osgDB::PROPERTY("Type") >> type >> osgDB::BEGIN_BRACKET; - + READ_CHANNEL_FUNC( DoubleStepChannel, osgAnimation::DoubleStepChannel, osgAnimation::DoubleKeyframeContainer, double ); READ_CHANNEL_FUNC( FloatStepChannel, osgAnimation::FloatStepChannel, osgAnimation::FloatKeyframeContainer, float ); READ_CHANNEL_FUNC( Vec2StepChannel, osgAnimation::Vec2StepChannel, osgAnimation::Vec2KeyframeContainer, osg::Vec2 ); @@ -224,7 +224,7 @@ static bool writeChannels( osgDB::OutputStream& os, const osgAnimation::Animatio osgAnimation::Vec3CubicBezierKeyframeContainer ); WRITE_CHANNEL_FUNC2( Vec4CubicBezierChannel, osgAnimation::Vec4CubicBezierChannel, osgAnimation::Vec4CubicBezierKeyframeContainer ); - + os << osgDB::PROPERTY("Type") << std::string("UnknownChannel") << osgDB::BEGIN_BRACKET << std::endl; os << osgDB::END_BRACKET << std::endl; } @@ -240,13 +240,13 @@ REGISTER_OBJECT_WRAPPER( osgAnimation_Animation, ADD_DOUBLE_SERIALIZER( Duration, 0.0f ); // _duration ADD_FLOAT_SERIALIZER( Weight, 0.0f ); // _weight ADD_DOUBLE_SERIALIZER( StartTime, 0.0f ); // _startTime - + BEGIN_ENUM_SERIALIZER( PlayMode, LOOP ); ADD_ENUM_VALUE( ONCE ); ADD_ENUM_VALUE( STAY ); ADD_ENUM_VALUE( LOOP ); ADD_ENUM_VALUE( PPONG ); END_ENUM_SERIALIZER(); // _playmode - + ADD_USER_SERIALIZER( Channels ); // _channels } diff --git a/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp b/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp index 2f9a3ea67..6ece8575b 100644 --- a/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp +++ b/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp @@ -45,7 +45,7 @@ REGISTER_OBJECT_WRAPPER( osgAnimation_MorphGeometry, ADD_ENUM_VALUE( NORMALIZED ); ADD_ENUM_VALUE( RELATIVE ); END_ENUM_SERIALIZER(); // _method - + ADD_USER_SERIALIZER( MorphTargets ); // _morphTargets ADD_BOOL_SERIALIZER( MorphNormals, true ); // _morphNormals } diff --git a/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp b/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp index 56d57ff50..6023b99a7 100644 --- a/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp +++ b/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp @@ -17,7 +17,7 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& std::string name; unsigned int viSize = 0; is >> osgDB::PROPERTY("VertexInfluence") >> name; viSize = is.readSize(); is >> osgDB::BEGIN_BRACKET; - + osgAnimation::VertexInfluence vi; vi.setName( name ); vi.reserve( viSize ); @@ -32,7 +32,7 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& is >> osgDB::END_BRACKET; } is >> osgDB::END_BRACKET; - + if ( !map->empty() ) geom.setInfluenceMap( map ); return true; } @@ -47,7 +47,7 @@ static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigG std::string name = itr->first; const osgAnimation::VertexInfluence& vi = itr->second; if ( name.empty() ) name = "Empty"; - + os << osgDB::PROPERTY("VertexInfluence") << name; os.writeSize(vi.size()) ; os << osgDB::BEGIN_BRACKET << std::endl; for ( osgAnimation::VertexInfluence::const_iterator vitr=vi.begin(); diff --git a/src/osgWrappers/serializers/osgManipulator/Dragger.cpp b/src/osgWrappers/serializers/osgManipulator/Dragger.cpp index 4f2f4d067..afa74324a 100644 --- a/src/osgWrappers/serializers/osgManipulator/Dragger.cpp +++ b/src/osgWrappers/serializers/osgManipulator/Dragger.cpp @@ -74,7 +74,7 @@ REGISTER_OBJECT_WRAPPER( osgManipulator_Dragger, "osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger" ) { // Dragger should not record children seperately, so ignore the osg::Group class wrapper - + ADD_BOOL_SERIALIZER( HandleEvents, false ); // _handleEvents ADD_BOOL_SERIALIZER( DraggerActive, false ); // _draggerActive ADD_UINT_SERIALIZER( ActivationModKeyMask, 0 ); // _activationModKeyMask diff --git a/src/osgWrappers/serializers/osgParticle/DomainOperator.cpp b/src/osgWrappers/serializers/osgParticle/DomainOperator.cpp index ec2bba7d6..8b59c32a5 100644 --- a/src/osgWrappers/serializers/osgParticle/DomainOperator.cpp +++ b/src/osgWrappers/serializers/osgParticle/DomainOperator.cpp @@ -24,7 +24,7 @@ static bool readDomains( osgDB::InputStream& is, osgParticle::DomainOperator& dp else if (typeName=="SPHERE") type = osgParticle::DomainOperator::Domain::SPHERE_DOMAIN; else if (typeName=="BOX") type = osgParticle::DomainOperator::Domain::BOX_DOMAIN; else if (typeName=="DISK") type = osgParticle::DomainOperator::Domain::DISK_DOMAIN; - + osgParticle::DomainOperator::Domain domain(type); is >> osgDB::PROPERTY("Plane") >> domain.plane; is >> osgDB::PROPERTY("Vertices1") >> domain.v1; @@ -34,7 +34,7 @@ static bool readDomains( osgDB::InputStream& is, osgParticle::DomainOperator& dp is >> osgDB::PROPERTY("Basis2") >> domain.s2; is >> osgDB::PROPERTY("Factors") >> domain.r1 >> domain.r2; dp.addDomain(domain); - + is >> osgDB::END_BRACKET; } is >> osgDB::END_BRACKET; @@ -48,7 +48,7 @@ static bool writeDomains( osgDB::OutputStream& os, const osgParticle::DomainOper for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; - + is >> osgDB::PROPERTY("Shape"); p.setShape( static_cast(readShapeValue(is)) ); - + double lifeTime; is >> osgDB::PROPERTY("LifeTime") >> lifeTime; p.setLifeTime( lifeTime ); - + float min, max; osg::Vec4d minV, maxV; is >> osgDB::PROPERTY("SizeRange") >> min >> max; p.setSizeRange( osgParticle::rangef(min, max) ); is >> osgDB::PROPERTY("AlphaRange") >> min >> max; p.setAlphaRange( osgParticle::rangef(min, max) ); is >> osgDB::PROPERTY("ColorRange") >> minV >> maxV; p.setColorRange( osgParticle::rangev4(minV, maxV) ); - + bool hasInterpolator = false; is >> osgDB::PROPERTY("SizeInterpolator") >> hasInterpolator; if ( hasInterpolator ) @@ -52,7 +52,7 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ) p.setColorInterpolator( static_cast(is.readObject()) ); is >> osgDB::END_BRACKET; } - + float radius; is >> osgDB::PROPERTY("Radius") >> radius; float mass; is >> osgDB::PROPERTY("Mass") >> mass; osg::Vec3d pos; is >> osgDB::PROPERTY("Position") >> pos; @@ -60,7 +60,7 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ) osg::Vec3d angle; is >> osgDB::PROPERTY("Angle") >> angle; osg::Vec3d angleV; is >> osgDB::PROPERTY("AngularVelocity") >> angleV; int s, t, num; is >> osgDB::PROPERTY("TextureTile") >> s >> t >> num; - + p.setRadius( radius ); p.setMass( mass ); p.setPosition( pos ); @@ -68,7 +68,7 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ) p.setAngle( angle ); p.setAngularVelocity( angleV ); p.setTextureTile( s, t, num ); - + bool hasObject = false; is >> osgDB::PROPERTY("Drawable") >> hasObject; if ( hasObject ) { @@ -76,7 +76,7 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ) p.setDrawable( dynamic_cast(is.readObject()) ); is >> osgDB::END_BRACKET; } - + is >> osgDB::END_BRACKET; return true; } @@ -84,15 +84,15 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ) bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ) { os << osgDB::BEGIN_BRACKET << std::endl; - + os << osgDB::PROPERTY("Shape"); writeShapeValue( os, (int)p.getShape() ); os << std::endl; - + os << osgDB::PROPERTY("LifeTime") << p.getLifeTime() << std::endl; os << osgDB::PROPERTY("SizeRange") << p.getSizeRange().minimum << p.getSizeRange().maximum << std::endl; os << osgDB::PROPERTY("AlphaRange") << p.getAlphaRange().minimum << p.getAlphaRange().maximum << std::endl; os << osgDB::PROPERTY("ColorRange") << osg::Vec4d(p.getColorRange().minimum) << osg::Vec4d(p.getColorRange().maximum) << std::endl; - + os << osgDB::PROPERTY("SizeInterpolator") << (p.getSizeInterpolator()!=NULL); if ( p.getSizeInterpolator()!=NULL ) os << osgDB::BEGIN_BRACKET << std::endl << p.getSizeInterpolator() << osgDB::END_BRACKET << std::endl; @@ -102,7 +102,7 @@ bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ) os << osgDB::PROPERTY("ColorInterpolator") << (p.getColorInterpolator()!=NULL); if ( p.getColorInterpolator()!=NULL ) os << osgDB::BEGIN_BRACKET << std::endl << p.getColorInterpolator() << osgDB::END_BRACKET << std::endl; - + os << osgDB::PROPERTY("Radius") << p.getRadius() << std::endl; os << osgDB::PROPERTY("Mass") << p.getMass() << std::endl; os << osgDB::PROPERTY("Position") << osg::Vec3d(p.getPosition()) << std::endl; @@ -110,7 +110,7 @@ bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ) os << osgDB::PROPERTY("Angle") << osg::Vec3d(p.getAngle()) << std::endl; os << osgDB::PROPERTY("AngularVelocity") << osg::Vec3d(p.getAngularVelocity()) << std::endl; os << osgDB::PROPERTY("TextureTile") << p.getTileS() << p.getTileT() << p.getNumTiles() << std::endl; - + os << osgDB::PROPERTY("Drawable") << (p.getDrawable()!=NULL); if ( p.getDrawable()!=NULL ) { @@ -119,7 +119,7 @@ bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ) os << osgDB::END_BRACKET; } os << std::endl; - + os << osgDB::END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp b/src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp index 748791ada..73ceabcbd 100644 --- a/src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp +++ b/src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp @@ -12,7 +12,7 @@ REGISTER_OBJECT_WRAPPER( osgParticleParticleProcessor, ADD_ENUM_VALUE( RELATIVE_RF ); ADD_ENUM_VALUE( ABSOLUTE_RF ); END_ENUM_SERIALIZER(); // _rf - + ADD_BOOL_SERIALIZER( Enabled, true ); // _enabled ADD_OBJECT_SERIALIZER( ParticleSystem, osgParticle::ParticleSystem, NULL ); // _ps ADD_BOOL_SERIALIZER( Endless, true ); // _endless diff --git a/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp b/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp index 2072dfcc9..70163d873 100644 --- a/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp +++ b/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp @@ -61,32 +61,32 @@ REGISTER_OBJECT_WRAPPER( osgParticleParticleSystem, "osg::Object osg::Drawable osgParticle::ParticleSystem" ) { ADD_USER_SERIALIZER( DefaultBoundingBox ); // _def_bbox - + BEGIN_ENUM_SERIALIZER2( ParticleAlignment, osgParticle::ParticleSystem::Alignment, BILLBOARD ); ADD_ENUM_VALUE( BILLBOARD ); ADD_ENUM_VALUE( FIXED ); END_ENUM_SERIALIZER(); // _alignment - + ADD_VEC3_SERIALIZER( AlignVectorX, osg::Vec3() ); // _align_X_axis ADD_VEC3_SERIALIZER( AlignVectorY, osg::Vec3() ); // _align_Y_axis - + BEGIN_ENUM_SERIALIZER( ParticleScaleReferenceFrame, WORLD_COORDINATES ); ADD_ENUM_VALUE( LOCAL_COORDINATES ); ADD_ENUM_VALUE( WORLD_COORDINATES ); END_ENUM_SERIALIZER(); // _particleScaleReferenceFrame - + ADD_BOOL_SERIALIZER( UseVertexArray, false ); // _useVertexArray ADD_BOOL_SERIALIZER( UseShaders, false ); // _useShaders ADD_BOOL_SERIALIZER( DoublePassRendering, false ); // _doublepass ADD_BOOL_SERIALIZER( Frozen, false ); // _frozen ADD_USER_SERIALIZER( DefaultParticleTemplate ); // _def_ptemp ADD_BOOL_SERIALIZER( FreezeOnCull, false ); // _freeze_on_cull - + BEGIN_ENUM_SERIALIZER( SortMode, NO_SORT ); ADD_ENUM_VALUE( NO_SORT ); ADD_ENUM_VALUE( SORT_FRONT_TO_BACK ); ADD_ENUM_VALUE( SORT_BACK_TO_FRONT ); END_ENUM_SERIALIZER(); // _sortMode - + ADD_DOUBLE_SERIALIZER( VisibilityDistance, -1.0 ); // _visibilityDistance } diff --git a/src/osgWrappers/serializers/osgParticle/SinkOperator.cpp b/src/osgWrappers/serializers/osgParticle/SinkOperator.cpp index a751c6654..d6a333ada 100644 --- a/src/osgWrappers/serializers/osgParticle/SinkOperator.cpp +++ b/src/osgWrappers/serializers/osgParticle/SinkOperator.cpp @@ -13,7 +13,7 @@ REGISTER_OBJECT_WRAPPER( osgParticleSinkOperator, ADD_ENUM_VALUE( SINK_VELOCITY ); ADD_ENUM_VALUE( SINK_ANGULAR_VELOCITY ); END_ENUM_SERIALIZER(); // _sinkTarget - + BEGIN_ENUM_SERIALIZER( SinkStrategy, SINK_INSIDE ); ADD_ENUM_VALUE( SINK_INSIDE ); ADD_ENUM_VALUE( SINK_OUTSIDE ); diff --git a/src/osgWrappers/serializers/osgShadow/MinimalShadowMap.cpp b/src/osgWrappers/serializers/osgShadow/MinimalShadowMap.cpp index 094ecfa71..aaa3dc15d 100644 --- a/src/osgWrappers/serializers/osgShadow/MinimalShadowMap.cpp +++ b/src/osgWrappers/serializers/osgShadow/MinimalShadowMap.cpp @@ -12,7 +12,7 @@ REGISTER_OBJECT_WRAPPER( osgShadow_MinimalShadowMap, ADD_MATRIX_SERIALIZER( ModellingSpaceToWorldTransform, osg::Matrix() ); // _modellingSpaceToWorld ADD_FLOAT_SERIALIZER( MaxFarPlane, FLT_MAX ); // _maxFarPlane ADD_FLOAT_SERIALIZER( MinLightMargin, 0.0f ); // _minLightMargin - + BEGIN_ENUM_SERIALIZER( ShadowReceivingCoarseBoundAccuracy, BOUNDING_BOX ); ADD_ENUM_VALUE( EMPTY_BOX ); ADD_ENUM_VALUE( BOUNDING_SPHERE ); diff --git a/src/osgWrappers/serializers/osgShadow/ParallelSplitShadowMap.cpp b/src/osgWrappers/serializers/osgShadow/ParallelSplitShadowMap.cpp index 0a2f47d63..93b4484c5 100644 --- a/src/osgWrappers/serializers/osgShadow/ParallelSplitShadowMap.cpp +++ b/src/osgWrappers/serializers/osgShadow/ParallelSplitShadowMap.cpp @@ -17,7 +17,7 @@ REGISTER_OBJECT_WRAPPER( osgShadow_ParallelSplitShadowMap, ADD_DOUBLE_SERIALIZER( MinNearDistanceForSplits, 5.0 ); // _split_min_near_dist ADD_OBJECT_SERIALIZER( UserLight, osg::Light, NULL ); // _userLight ADD_VEC2_SERIALIZER( AmbientBias, osg::Vec2() ); // _ambientBias - + BEGIN_ENUM_SERIALIZER2( SplitCalculationMode, osgShadow::ParallelSplitShadowMap::SplitCalcMode, SPLIT_EXP ); ADD_ENUM_VALUE( SPLIT_LINEAR ); ADD_ENUM_VALUE( SPLIT_EXP ); diff --git a/src/osgWrappers/serializers/osgShadow/ShadowMap.cpp b/src/osgWrappers/serializers/osgShadow/ShadowMap.cpp index c3840be91..b987b6972 100644 --- a/src/osgWrappers/serializers/osgShadow/ShadowMap.cpp +++ b/src/osgWrappers/serializers/osgShadow/ShadowMap.cpp @@ -11,7 +11,7 @@ REGISTER_OBJECT_WRAPPER( osgShadow_ShadowMap, ADD_UINT_SERIALIZER( TextureUnit, 1 ); // _shadowTextureUnit ADD_VEC2_SERIALIZER( PolygonOffset, osg::Vec2f() ); // _polyOffset ADD_VEC2_SERIALIZER( AmbientBias, osg::Vec2d() ); // _ambientBias - + ADD_SERIALIZER( (new osgDB::PropByRefSerializer ("TextureSize", osg::Vec2s(1024, 1024), &osgShadow::ShadowMap::getTextureSize, diff --git a/src/osgWrappers/serializers/osgShadow/ShadowVolume.cpp b/src/osgWrappers/serializers/osgShadow/ShadowVolume.cpp index 5c1a63981..1dbccdf6f 100644 --- a/src/osgWrappers/serializers/osgShadow/ShadowVolume.cpp +++ b/src/osgWrappers/serializers/osgShadow/ShadowVolume.cpp @@ -13,6 +13,6 @@ REGISTER_OBJECT_WRAPPER( osgShadow_ShadowVolume, ADD_ENUM_CLASS_VALUE( osgShadow::ShadowVolumeGeometry, STENCIL_TWO_PASS ); ADD_ENUM_CLASS_VALUE( osgShadow::ShadowVolumeGeometry, STENCIL_TWO_SIDED ); END_ENUM_SERIALIZER(); // _drawMode - + ADD_BOOL_SERIALIZER( DynamicShadowVolumes, false ); // _dynamicShadowVolumes } diff --git a/src/osgWrappers/serializers/osgShadow/StandardShadowMap.cpp b/src/osgWrappers/serializers/osgShadow/StandardShadowMap.cpp index 83f8161e1..c46eb3911 100644 --- a/src/osgWrappers/serializers/osgShadow/StandardShadowMap.cpp +++ b/src/osgWrappers/serializers/osgShadow/StandardShadowMap.cpp @@ -13,12 +13,12 @@ REGISTER_OBJECT_WRAPPER( osgShadow_StandardShadowMap, ADD_UINT_SERIALIZER( ShadowTextureUnit, 1 ); // _shadowTextureUnit ADD_UINT_SERIALIZER( BaseTextureCoordIndex, 0 ); // _baseTextureCoordIndex ADD_UINT_SERIALIZER( ShadowTextureCoordIndex, 1 ); // _shadowTextureCoordIndex - + ADD_SERIALIZER( (new osgDB::PropByRefSerializer ("TextureSize", osg::Vec2s(1024, 1024), &osgShadow::StandardShadowMap::getTextureSize, &osgShadow::StandardShadowMap::setTextureSize)) ); // _textureSize - + ADD_OBJECT_SERIALIZER( Light, osg::Light, NULL ); // _light } diff --git a/src/osgWrappers/serializers/osgSim/DOFTransform.cpp b/src/osgWrappers/serializers/osgSim/DOFTransform.cpp index 946441470..7aeb64475 100644 --- a/src/osgWrappers/serializers/osgSim/DOFTransform.cpp +++ b/src/osgWrappers/serializers/osgSim/DOFTransform.cpp @@ -57,7 +57,7 @@ REGISTER_OBJECT_WRAPPER( osgSim_DOFTransform, ADD_USER_SERIALIZER( PutMatrix ); // _Put, _inversePut ADD_USER_SERIALIZER( LimitationFlags ); // _limitationFlags ADD_BOOL_SERIALIZER( AnimationOn, false ); // _animationOn - + BEGIN_ENUM_SERIALIZER2( HPRMultOrder, osgSim::DOFTransform::MultOrder, PRH ); ADD_ENUM_VALUE( PRH ); ADD_ENUM_VALUE( PHR ); diff --git a/src/osgWrappers/serializers/osgSim/LightPointNode.cpp b/src/osgWrappers/serializers/osgSim/LightPointNode.cpp index 389c63431..db80af7e0 100644 --- a/src/osgWrappers/serializers/osgSim/LightPointNode.cpp +++ b/src/osgWrappers/serializers/osgSim/LightPointNode.cpp @@ -17,11 +17,11 @@ static bool readLightPointList( osgDB::InputStream& is, osgSim::LightPointNode& is >> osgDB::PROPERTY("LightPoint") >> osgDB::BEGIN_BRACKET; is >> osgDB::PROPERTY("Position") >> pt._position; is >> osgDB::PROPERTY("Color") >> pt._color; - + int blendingMode = 0; is >> osgDB::PROPERTY("Attributes") >> pt._on >> blendingMode >> pt._intensity >> pt._radius; pt._blendingMode = (osgSim::LightPoint::BlendingMode)blendingMode; - + bool hasObject = false; is >> osgDB::PROPERTY("Sector") >> hasObject; if ( hasObject ) { diff --git a/src/osgWrappers/serializers/osgSim/MultiSwitch.cpp b/src/osgWrappers/serializers/osgSim/MultiSwitch.cpp index f624ea512..8af94a077 100644 --- a/src/osgWrappers/serializers/osgSim/MultiSwitch.cpp +++ b/src/osgWrappers/serializers/osgSim/MultiSwitch.cpp @@ -15,7 +15,7 @@ static bool readValues( osgDB::InputStream& is, osgSim::MultiSwitch& node ) { is >> osgDB::PROPERTY("SwitchSet"); unsigned int valueSize = is.readSize(); is >> osgDB::BEGIN_BRACKET; - + osgSim::MultiSwitch::ValueList values; for ( unsigned int j=0; j> osgDB::BEGIN_BRACKET; is >> osgDB::PROPERTY("Range") >> min >> max; - + bool hasColorRange = false; unsigned int colorSize = 0; is >> osgDB::PROPERTY("Colors") >> hasColorRange >> colorSize; @@ -31,7 +31,7 @@ static bool readScalarsToColors( osgDB::InputStream& is, osgSim::ScalarBar& bar colors.push_back( color ); } is >> osgDB::END_BRACKET; - + osgSim::ColorRange* cr = new osgSim::ColorRange(min, max, colors); bar.setScalarsToColors( cr ); } @@ -44,14 +44,14 @@ static bool writeScalarsToColors( osgDB::OutputStream& os, const osgSim::ScalarB os << osgDB::BEGIN_BRACKET << std::endl; os << osgDB::PROPERTY("Range") << stc->getMin() << stc->getMax() << std::endl; os << osgDB::PROPERTY("Colors"); - + unsigned int colorSize = 0; const osgSim::ColorRange* cr = dynamic_cast(stc); if ( cr ) { const std::vector& colors = cr->getColors(); colorSize = colors.size(); - + os << true << colorSize << osgDB::BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; osgSim::ScalarBar::ScalarPrinter* sp = dynamic_cast( is.readObject() ); - if ( sp ) bar.setScalarPrinter( sp ); + if ( sp ) bar.setScalarPrinter( sp ); is >> osgDB::END_BRACKET; return true; } @@ -85,7 +85,7 @@ static bool readScalarPrinter( osgDB::InputStream& is, osgSim::ScalarBar& bar ) static bool writeScalarPrinter( osgDB::OutputStream& os, const osgSim::ScalarBar& bar ) { os << osgDB::BEGIN_BRACKET << std::endl; - os.writeObject( dynamic_cast(bar.getScalarPrinter()) ); + os.writeObject( dynamic_cast(bar.getScalarPrinter()) ); os << osgDB::END_BRACKET << std::endl; return true; } @@ -104,7 +104,7 @@ static bool readTextProperties( osgDB::InputStream& is, osgSim::ScalarBar& bar ) is >> osgDB::PROPERTY("CharacterSize") >> prop._characterSize; is >> osgDB::PROPERTY("Color") >> prop._fontFile; is >> osgDB::END_BRACKET; - + prop._fontResolution = std::pair(resX, resY); bar.setTextProperties( prop ); return true; @@ -135,12 +135,12 @@ REGISTER_OBJECT_WRAPPER( osgSim_ScalarBar, ADD_VEC3_SERIALIZER( Position, osg::Vec3() ); // _position ADD_FLOAT_SERIALIZER( Width, 0.0f ); // _width ADD_FLOAT_SERIALIZER( AspectRatio, 0.0f ); // _aspectRatio - + BEGIN_ENUM_SERIALIZER( Orientation, HORIZONTAL ); ADD_ENUM_VALUE( HORIZONTAL ); ADD_ENUM_VALUE( VERTICAL ); END_ENUM_SERIALIZER(); // _orientation - + ADD_USER_SERIALIZER( ScalarPrinter ); // _sp ADD_USER_SERIALIZER( TextProperties ); // _textProperties } diff --git a/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp b/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp index 16ececa78..5f777c7cd 100644 --- a/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp +++ b/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp @@ -10,42 +10,42 @@ static bool checkImage( const osgTerrain::ImageLayer& im ) { return im.getImage() != NULL; } static bool readImage( osgDB::InputStream& is, osgTerrain::ImageLayer& il ) -{ - - if(!is.isBinary()) is >> osgDB::BEGIN_BRACKET; +{ + + if(!is.isBinary()) is >> osgDB::BEGIN_BRACKET; + + bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? + osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading() : false; - bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? - osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading() : false; - osg::ref_ptr image = is.readImage(!deferExternalLayerLoading); if (image.valid()) { - if(image->valid()) + if(image->valid()) { - il.setImage(image.get()); - } - } - if(!is.isBinary()) is >> osgDB::END_BRACKET; + il.setImage(image.get()); + } + } + if(!is.isBinary()) is >> osgDB::END_BRACKET; return true; } static bool writeImage( osgDB::OutputStream& os, const osgTerrain::ImageLayer& il ) -{ - const osg::Image* image = il.getImage(); +{ + const osg::Image* image = il.getImage(); - if(!os.isBinary()) os << osgDB::BEGIN_BRACKET << std::endl; + if(!os.isBinary()) os << osgDB::BEGIN_BRACKET << std::endl; os.writeImage(image); - if(!os.isBinary()) os << osgDB::END_BRACKET << std::endl; - - return true; + if(!os.isBinary()) os << osgDB::END_BRACKET << std::endl; + + return true; } REGISTER_OBJECT_WRAPPER( osgTerrain_ImageLayer, new osgTerrain::ImageLayer, osgTerrain::ImageLayer, "osg::Object osgTerrain::Layer osgTerrain::ImageLayer" ) -{ - ADD_USER_SERIALIZER( Image ); +{ + ADD_USER_SERIALIZER( Image ); } diff --git a/src/osgWrappers/serializers/osgTerrain/Layer.cpp b/src/osgWrappers/serializers/osgTerrain/Layer.cpp index 04e8c48c8..bc9d6913b 100644 --- a/src/osgWrappers/serializers/osgTerrain/Layer.cpp +++ b/src/osgWrappers/serializers/osgTerrain/Layer.cpp @@ -39,14 +39,14 @@ static bool writeValidDataOperator( osgDB::OutputStream& os, const osgTerrain::L os << (unsigned int)1 << ndv->getValue() << std::endl; return true; } - + const osgTerrain::ValidRange* vr = dynamic_cast( layer.getValidDataOperator() ); if ( vr ) { os << (unsigned int)2 << vr->getMinValue() << vr->getMaxValue() << std::endl; return true; } - + os << (unsigned int)0 << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgTerrain/Locator.cpp b/src/osgWrappers/serializers/osgTerrain/Locator.cpp index 1c86b7e52..4ec6ce34d 100644 --- a/src/osgWrappers/serializers/osgTerrain/Locator.cpp +++ b/src/osgWrappers/serializers/osgTerrain/Locator.cpp @@ -13,7 +13,7 @@ REGISTER_OBJECT_WRAPPER( osgTerrain_Locator, ADD_ENUM_VALUE( GEOGRAPHIC ); ADD_ENUM_VALUE( PROJECTED ); END_ENUM_SERIALIZER(); // _coordinateSystemType - + ADD_STRING_SERIALIZER( Format, "" ); // _format ADD_STRING_SERIALIZER( CoordinateSystem, "" ); // _cs ADD_OBJECT_SERIALIZER( EllipsoidModel, osg::EllipsoidModel, NULL ); // _ellipsoidModel diff --git a/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp b/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp index d8c62e061..32ad4aace 100644 --- a/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp +++ b/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp @@ -99,6 +99,6 @@ REGISTER_OBJECT_WRAPPER( osgTerrain_TerrainTile, ADD_ENUM_VALUE( ENABLE_BLENDING ); ADD_ENUM_VALUE( ENABLE_BLENDING_WHEN_ALPHA_PRESENT ); END_ENUM_SERIALIZER(); // BlendingPolicy - + wrapper->addFinishedObjectReadCallback( new TerrainTileFinishedObjectReadCallback() ); } diff --git a/src/osgWrappers/serializers/osgText/Text.cpp b/src/osgWrappers/serializers/osgText/Text.cpp index 5de7532e2..1651d6fc5 100644 --- a/src/osgWrappers/serializers/osgText/Text.cpp +++ b/src/osgWrappers/serializers/osgText/Text.cpp @@ -72,22 +72,22 @@ REGISTER_OBJECT_WRAPPER( osgText_Text, ADD_ENUM_VALUE( OUTLINE ); ADD_ENUM_VALUE( NONE ); END_ENUM_SERIALIZER(); // _backdropType - + BEGIN_ENUM_SERIALIZER( BackdropImplementation, DEPTH_RANGE ); ADD_ENUM_VALUE( POLYGON_OFFSET ); ADD_ENUM_VALUE( NO_DEPTH_BUFFER ); ADD_ENUM_VALUE( DEPTH_RANGE ); ADD_ENUM_VALUE( STENCIL_BUFFER ); END_ENUM_SERIALIZER(); // _backdropImplementation - + ADD_USER_SERIALIZER( BackdropOffset ); // _backdropHorizontalOffset, _backdropVerticalOffset ADD_VEC4_SERIALIZER( BackdropColor, osg::Vec4() ); // _backdropColor - + BEGIN_ENUM_SERIALIZER( ColorGradientMode, SOLID ); ADD_ENUM_VALUE( SOLID ); ADD_ENUM_VALUE( PER_CHARACTER ); ADD_ENUM_VALUE( OVERALL ); END_ENUM_SERIALIZER(); // _colorGradientMode - + ADD_USER_SERIALIZER( ColorGradientCorners ); // _colorGradientTopLeft .. _colorGradientBottomRight } diff --git a/src/osgWrappers/serializers/osgText/TextBase.cpp b/src/osgWrappers/serializers/osgText/TextBase.cpp index ca673dfe3..a57ef259b 100644 --- a/src/osgWrappers/serializers/osgText/TextBase.cpp +++ b/src/osgWrappers/serializers/osgText/TextBase.cpp @@ -103,7 +103,7 @@ static bool writeText( osgDB::OutputStream& os, const osgText::TextBase& text ) break; } } - + os << isACString; if ( isACString ) { @@ -177,19 +177,19 @@ REGISTER_OBJECT_WRAPPER( osgText_TextBase, ADD_USER_SERIALIZER( Font ); // _font ADD_USER_SERIALIZER( FontSize ); // _fontSize ADD_USER_SERIALIZER( CharacterSize ); // _characterHeight, _characterAspectRatio - + BEGIN_ENUM_SERIALIZER( CharacterSizeMode, OBJECT_COORDS ); ADD_ENUM_VALUE( OBJECT_COORDS ); ADD_ENUM_VALUE( SCREEN_COORDS ); ADD_ENUM_VALUE( OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT ); END_ENUM_SERIALIZER(); // _characterSizeMode - + ADD_FLOAT_SERIALIZER( MaximumWidth, 0.0f ); // _maximumWidth ADD_FLOAT_SERIALIZER( MaximumHeight, 0.0f ); // _maximumHeight ADD_FLOAT_SERIALIZER( LineSpacing, 0.0f ); // _lineSpacing ADD_USER_SERIALIZER( Text ); // _text ADD_VEC3_SERIALIZER( Position, osg::Vec3() ); // _position - + BEGIN_ENUM_SERIALIZER2( Alignment, osgText::TextBase::AlignmentType, LEFT_BASE_LINE ); ADD_ENUM_VALUE( LEFT_TOP ); ADD_ENUM_VALUE( LEFT_CENTER ); @@ -207,7 +207,7 @@ REGISTER_OBJECT_WRAPPER( osgText_TextBase, ADD_ENUM_VALUE( CENTER_BOTTOM_BASE_LINE ); ADD_ENUM_VALUE( RIGHT_BOTTOM_BASE_LINE ); END_ENUM_SERIALIZER(); // _alignment - + BEGIN_ENUM_SERIALIZER( AxisAlignment, XY_PLANE ); ADD_ENUM_VALUE( XY_PLANE ); ADD_ENUM_VALUE( REVERSED_XY_PLANE ); @@ -218,16 +218,16 @@ REGISTER_OBJECT_WRAPPER( osgText_TextBase, ADD_ENUM_VALUE( SCREEN ); ADD_ENUM_VALUE( USER_DEFINED_ROTATION ); END_ENUM_SERIALIZER(); // _axisAlignment - + ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation ADD_BOOL_SERIALIZER( AutoRotateToScreen, false ); // _autoRotateToScreen - + BEGIN_ENUM_SERIALIZER( Layout, LEFT_TO_RIGHT ); ADD_ENUM_VALUE( LEFT_TO_RIGHT ); ADD_ENUM_VALUE( RIGHT_TO_LEFT ); ADD_ENUM_VALUE( VERTICAL ); END_ENUM_SERIALIZER(); // _layout - + ADD_USER_SERIALIZER( DrawMode ); // _drawMode ADD_FLOAT_SERIALIZER( BoundingBoxMargin, 0.0f ); // _textBBMargin ADD_VEC4_SERIALIZER( BoundingBoxColor, osg::Vec4() ); // _textBBColor diff --git a/src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp b/src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp index c41ce8bae..c3a722a88 100644 --- a/src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp +++ b/src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp @@ -9,6 +9,6 @@ REGISTER_OBJECT_WRAPPER( osgVolume_ScalarProperty, "osg::Object osgVolume::Property osgVolume::ScalarProperty" ) { // FIXME: don't set constructor directly, try implementing a setName() method? - + ADD_FLOAT_SERIALIZER( Value, 1.0f ); } diff --git a/src/osgWrappers/serializers/osgVolume/VolumeTile.cpp b/src/osgWrappers/serializers/osgVolume/VolumeTile.cpp index 3fd6bd0e3..691ab874c 100644 --- a/src/osgWrappers/serializers/osgVolume/VolumeTile.cpp +++ b/src/osgWrappers/serializers/osgVolume/VolumeTile.cpp @@ -30,9 +30,9 @@ REGISTER_OBJECT_WRAPPER( osgVolume_VolumeTile, ADD_OBJECT_SERIALIZER( Volume, osgVolume::Volume, NULL ); // _volume UPDATE_TO_VERSION( 90 ) { - REMOVE_SERIALIZER( Volume ); + REMOVE_SERIALIZER( Volume ); } - + ADD_BOOL_SERIALIZER( Dirty, false ); // _dirty ADD_USER_SERIALIZER( TileID ); // _tileID ADD_OBJECT_SERIALIZER( VolumeTechnique, osgVolume::VolumeTechnique, NULL ); // _volumeTechnique