From 2ad67b172778682bee7dc6b891d3d973aaf72801 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 18 May 2005 18:43:03 +0000 Subject: [PATCH] From Joakim Simonsson: "DOFAnimation's default state could now be controlled by the RW option. The option string is "dofAnimation" If the option string is omitted the default animation state is off." --- src/osgPlugins/flt/FltFile.cpp | 12 ++++++++---- src/osgPlugins/flt/FltFile.h | 6 +++++- src/osgPlugins/flt/flt2osg.cpp | 5 +++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/osgPlugins/flt/FltFile.cpp b/src/osgPlugins/flt/FltFile.cpp index 1564ca5c7..a2dc84eca 100644 --- a/src/osgPlugins/flt/FltFile.cpp +++ b/src/osgPlugins/flt/FltFile.cpp @@ -27,11 +27,15 @@ FltFile::FltFile( MaterialPool* pMaterialPool, LtPtAppearancePool* pLtPtAppearancePool, LtPtAnimationPool* pLtPtAnimationPool, - osgDB::ReaderWriter::Options* options) + osgDB::ReaderWriter::Options* options): + _useTextureAlphaForTransparancyBinning(true), + _doUnitsConversion(true), + _defaultDOFAnimationState(false), + _desiredUnits(ConvertToMeters) { - _useTextureAlphaForTransparancyBinning = true; - _doUnitsConversion = true; - _desiredUnits = ConvertToMeters; + + + if (pColorPool) { diff --git a/src/osgPlugins/flt/FltFile.h b/src/osgPlugins/flt/FltFile.h index 80f3306a0..e0d9b046d 100644 --- a/src/osgPlugins/flt/FltFile.h +++ b/src/osgPlugins/flt/FltFile.h @@ -26,7 +26,7 @@ class FltFile : public osg::Referenced MaterialPool* pMaterialPool = NULL, LtPtAppearancePool* pLtPtAppearancePool = NULL, LtPtAnimationPool* pLtPtAnimationPool = NULL, - osgDB::ReaderWriter::Options* options =NULL); + osgDB::ReaderWriter::Options* options = NULL); virtual osg::Object* readObject(const std::string& fileName); virtual osg::Node* readNode(const std::string& fileName); @@ -70,6 +70,9 @@ class FltFile : public osg::Referenced FltFile::ConvertUnits getDesiredUnits() const { return _desiredUnits; } std::string getDesiredUnitsString() const; + void setDefaultDOFAnimationState(bool defaultDOFAnimationState) { _defaultDOFAnimationState = defaultDOFAnimationState; } + bool getDefaultDOFAnimationState() const { return _defaultDOFAnimationState; } + int getFlightVersion() const; inline HeaderRecord* getHeaderRecord() { return _headerRecord.get(); } void getOrigin( double& latitude, double& longitude ) const; @@ -95,6 +98,7 @@ class FltFile : public osg::Referenced bool _useInternalLtPtPalettes; bool _useTextureAlphaForTransparancyBinning; bool _doUnitsConversion; + bool _defaultDOFAnimationState; //< Default DOF Animation state ConvertUnits _desiredUnits; std::string _directory; diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index 4328039bf..ca193d0dc 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -91,8 +91,6 @@ static int dprint = 0 ; #define DPRINT if(dprint)fprintf -#define USE_PROXYNODE_FOR_EXTERNAL_FILES - using namespace flt; unsigned int mystrnlen(char *s, unsigned int maxLen) @@ -1103,6 +1101,9 @@ osg::Group* ConvertFromFLT::visitDOF(osg::Group& osgParent, DofRecord* rec) p_data->dfYscale._dfIncrement, p_data->dfZscale._dfIncrement)); + // default DOF animation state + transform->setAnimationOn(rec->getFltFile()->getDefaultDOFAnimationState()); + // compute the put matrix. osg::Vec3 O ( p_data->OriginLocalDOF.x(), p_data->OriginLocalDOF.y(),