From 6821a80e14fe2002672e99485a99c0bbbf859331 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 22 Oct 2004 19:26:45 +0000 Subject: [PATCH] Changed the ReferenceFrame enums to be RELEATIVE and ABSOLUTE, and deprecated the RELATIVE_TO_ABSOLUTE and RELATIVE_TO_PARENTS. --- examples/osgdistortion/osgdistortion.cpp | 2 +- examples/osgforest/osgforest.cpp | 2 +- examples/osgfxbrowser/osgfxbrowser.cpp | 2 +- examples/osghud/osghud.cpp | 2 +- examples/osglauncher/osglauncher.cpp | 2 +- examples/osgparticle/osgparticle.cpp | 2 +- examples/osgphotoalbum/osgphotoalbum.cpp | 4 ++-- examples/osgpick/osgpick.cpp | 2 +- examples/osgscalarbar/osgscalarbar.cpp | 2 +- examples/osgtesselate/osgtesselate.cpp | 2 +- examples/osgtext/osgtext.cpp | 2 +- .../osgtexturerectangle/osgtexturerectangle.cpp | 2 +- include/osg/LightSource | 11 ++++++++--- include/osg/Transform | 15 ++++++++++----- include/osgParticle/AccelOperator | 2 +- include/osgParticle/AngularAccelOperator | 2 +- include/osgParticle/ForceOperator | 2 +- include/osgParticle/Operator | 2 +- include/osgParticle/ParticleProcessor | 9 +++++++-- src/osg/AutoTransform.cpp | 4 ++-- src/osg/Group.cpp | 4 ++-- src/osg/LightSource.cpp | 6 +++--- src/osg/MatrixTransform.cpp | 6 +++--- src/osg/PositionAttitudeTransform.cpp | 4 ++-- src/osg/Transform.cpp | 4 ++-- src/osgParticle/FluidFrictionOperator.cpp | 2 +- src/osgParticle/ModularEmitter.cpp | 2 +- src/osgParticle/ParticleProcessor.cpp | 2 +- src/osgPlugins/net/ReaderWriterNET.cpp | 12 ++++++++++-- src/osgPlugins/osg/LightSource.cpp | 14 +++++++------- src/osgPlugins/osg/Transform.cpp | 16 ++++++++-------- .../osgParticle/IO_ParticleProcessor.cpp | 16 ++++++++-------- src/osgProducer/Viewer.cpp | 4 ++-- src/osgSim/DOFTransform.cpp | 4 ++-- src/osgUtil/CullVisitor.cpp | 2 +- src/osgUtil/Optimizer.cpp | 2 +- 36 files changed, 98 insertions(+), 75 deletions(-) diff --git a/examples/osgdistortion/osgdistortion.cpp b/examples/osgdistortion/osgdistortion.cpp index 1c3342310..3b1acb7d3 100644 --- a/examples/osgdistortion/osgdistortion.cpp +++ b/examples/osgdistortion/osgdistortion.cpp @@ -144,7 +144,7 @@ void DistortionNode::createHUDSubgraph() // create the hud. osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); modelview_abs->addChild(geode); diff --git a/examples/osgforest/osgforest.cpp b/examples/osgforest/osgforest.cpp index 79ed5c199..9a794c17d 100644 --- a/examples/osgforest/osgforest.cpp +++ b/examples/osgforest/osgforest.cpp @@ -744,7 +744,7 @@ osg::Node* ForestTechniqueManager::createHUDWithText(const std::string& str) // create the hud. osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); modelview_abs->addChild(geode); diff --git a/examples/osgfxbrowser/osgfxbrowser.cpp b/examples/osgfxbrowser/osgfxbrowser.cpp index 61d0ba528..18080e7e6 100644 --- a/examples/osgfxbrowser/osgfxbrowser.cpp +++ b/examples/osgfxbrowser/osgfxbrowser.cpp @@ -232,7 +232,7 @@ osg::Group *build_hud_base(osg::Group *root) root->addChild(proj.get()); osg::ref_ptr xform = new osg::MatrixTransform(osg::Matrix::identity()); - xform->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + xform->setReferenceFrame(osg::Transform::ABSOLUTE); proj->addChild(xform.get()); osg::StateSet *ss = xform->getOrCreateStateSet(); diff --git a/examples/osghud/osghud.cpp b/examples/osghud/osghud.cpp index d98ca8b6e..19e36f25d 100644 --- a/examples/osghud/osghud.cpp +++ b/examples/osghud/osghud.cpp @@ -148,7 +148,7 @@ osg::Node* createHUD() // create the hud. osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); modelview_abs->addChild(geode); diff --git a/examples/osglauncher/osglauncher.cpp b/examples/osglauncher/osglauncher.cpp index 95605016e..d4825d2b7 100644 --- a/examples/osglauncher/osglauncher.cpp +++ b/examples/osglauncher/osglauncher.cpp @@ -111,7 +111,7 @@ osg::Node* createHUD(osgText::Text* updateText) // eg to be used as a menuing/help system! // Can pick texts too! osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); osg::Projection* projection = new osg::Projection; diff --git a/examples/osgparticle/osgparticle.cpp b/examples/osgparticle/osgparticle.cpp index c8b7c8beb..c3fda3e57 100644 --- a/examples/osgparticle/osgparticle.cpp +++ b/examples/osgparticle/osgparticle.cpp @@ -50,7 +50,7 @@ public: // we have to check whether the reference frame is relative to parents // or it's absolute; in the first case, we must transform the vectors // from local to world space. - if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE_TO_PARENTS) { + if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE) { // transform the center point (full transformation) xf_center_ = prg->transformLocalToWorld(center_); // transform the axis vector (only rotation and scale) diff --git a/examples/osgphotoalbum/osgphotoalbum.cpp b/examples/osgphotoalbum/osgphotoalbum.cpp index 51bab81b1..e39b81316 100644 --- a/examples/osgphotoalbum/osgphotoalbum.cpp +++ b/examples/osgphotoalbum/osgphotoalbum.cpp @@ -80,7 +80,7 @@ public: virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const { - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.preMult(getMatrix()); } @@ -96,7 +96,7 @@ public: { const osg::Matrix& inverse = getInverseMatrix(); - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.postMult(inverse); } diff --git a/examples/osgpick/osgpick.cpp b/examples/osgpick/osgpick.cpp index 19de0e4cb..42691b691 100644 --- a/examples/osgpick/osgpick.cpp +++ b/examples/osgpick/osgpick.cpp @@ -112,7 +112,7 @@ osg::Node* createHUD(osgText::Text* updateText) // eg to be used as a menuing/help system! // Can pick texts too! osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); osg::Projection* projection = new osg::Projection; diff --git a/examples/osgscalarbar/osgscalarbar.cpp b/examples/osgscalarbar/osgscalarbar.cpp index bdd952ddf..d035aaa9e 100644 --- a/examples/osgscalarbar/osgscalarbar.cpp +++ b/examples/osgscalarbar/osgscalarbar.cpp @@ -84,7 +84,7 @@ osg::Node * createScalarBar_HUD() stateset->setRenderBinDetails(11, "RenderBin"); osg::MatrixTransform * modelview = new osg::MatrixTransform; - modelview->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview->setReferenceFrame(osg::Transform::ABSOLUTE); osg::Matrixd matrix(osg::Matrixd::scale(1000,1000,1000) * osg::Matrixd::translate(120,10,0)); // I've played with these values a lot and it seems to work, but I have no idea why modelview->setMatrix(matrix); modelview->addChild(geode); diff --git a/examples/osgtesselate/osgtesselate.cpp b/examples/osgtesselate/osgtesselate.cpp index 59d351f6f..337500ea7 100644 --- a/examples/osgtesselate/osgtesselate.cpp +++ b/examples/osgtesselate/osgtesselate.cpp @@ -525,7 +525,7 @@ osg::Node* createHUD() // create the hud. osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); modelview_abs->addChild(geode); diff --git a/examples/osgtext/osgtext.cpp b/examples/osgtext/osgtext.cpp index 4aa882903..70bfeeae7 100644 --- a/examples/osgtext/osgtext.cpp +++ b/examples/osgtext/osgtext.cpp @@ -501,7 +501,7 @@ int main( int argc, char **argv ) projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024)); osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); modelview_abs->addChild(createHUDText()); diff --git a/examples/osgtexturerectangle/osgtexturerectangle.cpp b/examples/osgtexturerectangle/osgtexturerectangle.cpp index 3676ef5d5..638bd79e9 100644 --- a/examples/osgtexturerectangle/osgtexturerectangle.cpp +++ b/examples/osgtexturerectangle/osgtexturerectangle.cpp @@ -209,7 +209,7 @@ osg::Node* createHUD() // create HUD osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; - modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE); modelview_abs->setMatrix(osg::Matrix::identity()); modelview_abs->addChild(group); diff --git a/include/osg/LightSource b/include/osg/LightSource index 516f131d9..65c57494d 100644 --- a/include/osg/LightSource +++ b/include/osg/LightSource @@ -38,13 +38,18 @@ class SG_EXPORT LightSource : public Group enum ReferenceFrame { - RELATIVE_TO_PARENTS, - RELATIVE_TO_ABSOLUTE + RELATIVE, + ABSOLUTE +#ifdef USE_DEPRECATED_API + , + RELATIVE_TO_PARENTS=RELATIVE, + RELATIVE_TO_ABSOLUTE=ABSOLUTE, +#endif }; /** Set the light sources's ReferenceFrame, either to be relative to its * parent reference frame, or relative to an absolute coordinate - * frame. RELATIVE_TO_PARENTS is the default. + * frame. RELATIVE is the default. * Note: setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will * also set the CullingActive flag on the light source, and hence all * of its parents, to false, thereby disabling culling of it and diff --git a/include/osg/Transform b/include/osg/Transform index 9c68b327b..cebaf09ab 100644 --- a/include/osg/Transform +++ b/include/osg/Transform @@ -89,13 +89,18 @@ class SG_EXPORT Transform : public Group enum ReferenceFrame { - RELATIVE_TO_PARENTS, - RELATIVE_TO_ABSOLUTE + RELATIVE, + ABSOLUTE +#ifdef USE_DEPRECATED_API + , + RELATIVE_TO_PARENTS=RELATIVE, + RELATIVE_TO_ABSOLUTE=ABSOLUTE, +#endif }; /** Set the transform's ReferenceFrame, either to be relative to its * parent reference frame, or relative to an absolute coordinate - * frame. RELATIVE_TO_PARENTS is the default. + * frame. RELATIVE is the default. * Note: Setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will * also set the CullingActive flag on the transform, and hence all * of its parents, to false, thereby disabling culling of it and @@ -111,7 +116,7 @@ class SG_EXPORT Transform : public Group virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { return false; } @@ -124,7 +129,7 @@ class SG_EXPORT Transform : public Group virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const { - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { return false; } diff --git a/include/osgParticle/AccelOperator b/include/osgParticle/AccelOperator index d56f679b0..044362f9c 100644 --- a/include/osgParticle/AccelOperator +++ b/include/osgParticle/AccelOperator @@ -95,7 +95,7 @@ namespace osgParticle inline void AccelOperator::beginOperate(Program *prg) { - if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) { + if (prg->getReferenceFrame() == ModularProgram::RELATIVE) { xf_accel_ = prg->rotateLocalToWorld(accel_); } else { xf_accel_ = accel_; diff --git a/include/osgParticle/AngularAccelOperator b/include/osgParticle/AngularAccelOperator index b1518786c..78b523a91 100644 --- a/include/osgParticle/AngularAccelOperator +++ b/include/osgParticle/AngularAccelOperator @@ -86,7 +86,7 @@ namespace osgParticle inline void AngularAccelOperator::beginOperate(Program *prg) { - if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) { + if (prg->getReferenceFrame() == ModularProgram::RELATIVE) { xf_angular_accel_ = prg->rotateLocalToWorld(angular_accel_); } else { xf_angular_accel_ = angular_accel_; diff --git a/include/osgParticle/ForceOperator b/include/osgParticle/ForceOperator index 9a641dc7d..36953778b 100644 --- a/include/osgParticle/ForceOperator +++ b/include/osgParticle/ForceOperator @@ -87,7 +87,7 @@ namespace osgParticle inline void ForceOperator::beginOperate(Program *prg) { - if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) { + if (prg->getReferenceFrame() == ModularProgram::RELATIVE) { xf_force_ = prg->rotateLocalToWorld(force_); } else { xf_force_ = force_; diff --git a/include/osgParticle/Operator b/include/osgParticle/Operator index 982ea06ef..c9fd51c2c 100644 --- a/include/osgParticle/Operator +++ b/include/osgParticle/Operator @@ -57,7 +57,7 @@ namespace osgParticle /** 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_TO_PARENTS, then your + for the current reference frame. If the reference frame is RELATIVE, then your class should prepare itself to do all operations in local coordinates. */ virtual void beginOperate(Program *) {} diff --git a/include/osgParticle/ParticleProcessor b/include/osgParticle/ParticleProcessor index d19bc5f62..e4f4e1e9e 100644 --- a/include/osgParticle/ParticleProcessor +++ b/include/osgParticle/ParticleProcessor @@ -39,8 +39,13 @@ namespace osgParticle public: enum ReferenceFrame { - RELATIVE_TO_PARENTS, - RELATIVE_TO_ABSOLUTE + RELATIVE, + ABSOLUTE +#ifdef USE_DEPRECATED_API + , + RELATIVE_TO_PARENTS=RELATIVE, + RELATIVE_TO_ABSOLUTE=ABSOLUTE, +#endif }; ParticleProcessor(); diff --git a/src/osg/AutoTransform.cpp b/src/osg/AutoTransform.cpp index cba4c86fe..3dc21138c 100644 --- a/src/osg/AutoTransform.cpp +++ b/src/osg/AutoTransform.cpp @@ -45,7 +45,7 @@ bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { if (_matrixDirty) computeMatrix(); - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.preMult(_cachedMatrix); } @@ -59,7 +59,7 @@ bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const bool AutoTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const { - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.postMult(osg::Matrix::translate(-_position)* osg::Matrix::rotate(_rotation.inverse())* diff --git a/src/osg/Group.cpp b/src/osg/Group.cpp index bd650b7d4..4e55230c4 100644 --- a/src/osg/Group.cpp +++ b/src/osg/Group.cpp @@ -321,7 +321,7 @@ bool Group::computeBound() const ++itr) { const osg::Transform* transform = (*itr)->asTransform(); - if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_PARENTS) + if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE) { bb.expandBy((*itr)->getBound()); } @@ -340,7 +340,7 @@ bool Group::computeBound() const ++itr) { const osg::Transform* transform = (*itr)->asTransform(); - if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_PARENTS) + if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE) { _bsphere.expandRadiusBy((*itr)->getBound()); } diff --git a/src/osg/LightSource.cpp b/src/osg/LightSource.cpp index 7cbc7f846..46d923830 100644 --- a/src/osg/LightSource.cpp +++ b/src/osg/LightSource.cpp @@ -16,7 +16,7 @@ using namespace osg; LightSource::LightSource(): _value(StateAttribute::ON), - _referenceFrame(RELATIVE_TO_PARENTS) + _referenceFrame(RELATIVE) { // switch off culling of light source nodes by default. setCullingActive(false); @@ -33,7 +33,7 @@ LightSource::~LightSource() void LightSource::setReferenceFrame(ReferenceFrame rf) { _referenceFrame = rf; - setCullingActive(_referenceFrame==RELATIVE_TO_PARENTS); + setCullingActive(_referenceFrame==RELATIVE); } void LightSource::setLight(Light* light) @@ -62,7 +62,7 @@ bool LightSource::computeBound() const { Group::computeBound(); - if (_light.valid() && _referenceFrame==RELATIVE_TO_PARENTS) + if (_light.valid() && _referenceFrame==RELATIVE) { const Vec4& pos = _light->getPosition(); if (pos[3]!=0.0f) diff --git a/src/osg/MatrixTransform.cpp b/src/osg/MatrixTransform.cpp index 6183a9f89..03d50ee9c 100644 --- a/src/osg/MatrixTransform.cpp +++ b/src/osg/MatrixTransform.cpp @@ -29,7 +29,7 @@ MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp& MatrixTransform::MatrixTransform(const Matrix& mat ) { - _referenceFrame = RELATIVE_TO_PARENTS; + _referenceFrame = RELATIVE; _matrix = mat; _inverseDirty = false; @@ -42,7 +42,7 @@ MatrixTransform::~MatrixTransform() bool MatrixTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.preMult(_matrix); } @@ -57,7 +57,7 @@ bool MatrixTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) con { const Matrix& inverse = getInverseMatrix(); - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.postMult(inverse); } diff --git a/src/osg/PositionAttitudeTransform.cpp b/src/osg/PositionAttitudeTransform.cpp index efe120464..946918615 100644 --- a/src/osg/PositionAttitudeTransform.cpp +++ b/src/osg/PositionAttitudeTransform.cpp @@ -21,7 +21,7 @@ PositionAttitudeTransform::PositionAttitudeTransform(): bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.preMult(osg::Matrix::translate(-_pivotPoint)* osg::Matrix::scale(_scale)* @@ -41,7 +41,7 @@ bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVis bool PositionAttitudeTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const { - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.postMult(osg::Matrix::translate(-_position)* osg::Matrix::rotate(_attitude.inverse())* diff --git a/src/osg/Transform.cpp b/src/osg/Transform.cpp index 269da8838..573652977 100644 --- a/src/osg/Transform.cpp +++ b/src/osg/Transform.cpp @@ -98,7 +98,7 @@ Matrix osg::computeEyeToLocal(const Matrix& modelview,const NodePath& nodePath) Transform::Transform() { - _referenceFrame = RELATIVE_TO_PARENTS; + _referenceFrame = RELATIVE; } Transform::Transform(const Transform& transform,const CopyOp& copyop): @@ -118,7 +118,7 @@ void Transform::setReferenceFrame(ReferenceFrame rf) _referenceFrame = rf; // switch off culling if transform is absolute. - if (_referenceFrame==RELATIVE_TO_ABSOLUTE) setCullingActive(false); + if (_referenceFrame==RELATIVE) setCullingActive(false); else setCullingActive(true); } diff --git a/src/osgParticle/FluidFrictionOperator.cpp b/src/osgParticle/FluidFrictionOperator.cpp index d03509d90..9a96f5412 100644 --- a/src/osgParticle/FluidFrictionOperator.cpp +++ b/src/osgParticle/FluidFrictionOperator.cpp @@ -37,7 +37,7 @@ void osgParticle::FluidFrictionOperator::operate(Particle *P, double dt) osg::Vec3 Fr(-R * v.x(), -R * v.y(), -R * v.z()); - if (current_program_->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) { + if (current_program_->getReferenceFrame() == ModularProgram::RELATIVE) { Fr = current_program_->rotateLocalToWorld(Fr); } diff --git a/src/osgParticle/ModularEmitter.cpp b/src/osgParticle/ModularEmitter.cpp index f9fb3a346..4290c1ecf 100644 --- a/src/osgParticle/ModularEmitter.cpp +++ b/src/osgParticle/ModularEmitter.cpp @@ -25,7 +25,7 @@ void osgParticle::ModularEmitter::emit(double dt) if (P) { placer_->place(P); shooter_->shoot(P); - if (getReferenceFrame() == RELATIVE_TO_PARENTS) { + if (getReferenceFrame() == RELATIVE) { P->transformPositionVelocity(getLocalToWorldMatrix()); } } diff --git a/src/osgParticle/ParticleProcessor.cpp b/src/osgParticle/ParticleProcessor.cpp index 046367dda..d8ca15db4 100644 --- a/src/osgParticle/ParticleProcessor.cpp +++ b/src/osgParticle/ParticleProcessor.cpp @@ -13,7 +13,7 @@ using namespace osg; osgParticle::ParticleProcessor::ParticleProcessor() : osg::Node(), - rf_(RELATIVE_TO_PARENTS), + rf_(RELATIVE), enabled_(true), t0_(-1), ps_(0), diff --git a/src/osgPlugins/net/ReaderWriterNET.cpp b/src/osgPlugins/net/ReaderWriterNET.cpp index dee497e2a..b8773a5f4 100644 --- a/src/osgPlugins/net/ReaderWriterNET.cpp +++ b/src/osgPlugins/net/ReaderWriterNET.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include "sockinet.h" /* @@ -122,6 +123,10 @@ class NetReader : public osgDB::ReaderWriter virtual ReadResult readFile(ObjectType objectType, const std::string& inFileName, const Options *options) { + osg::Timer_t start = osg::Timer::instance()->tick(); + + osg::notify(osg::DEBUG_INFO) << "osgPlugin .net: start load" << inFileName << std::endl; + std::string hostname; std::string serverPrefix; std::string localCacheDir; @@ -320,12 +325,15 @@ class NetReader : public osgDB::ReaderWriter - osg::notify(osg::DEBUG_INFO) << "osgPlugin .net: " << fileName << - " fetched from server." << std::endl; if( reader != 0L ) readResult = readFile(objectType, reader, sio, local_opt.get() ); + double ms = osg::Timer::instance()->delta_m(start,osg::Timer::instance()->tick()); + + osg::notify(osg::DEBUG_INFO) << "osgPlugin .net: " << fileName << + " fetched from server. in" << ms <<" ms"<< std::endl; + if( !localCacheDir.empty() && cacheMode & Write ) { std::string cacheFile = localCacheDir + '/' + fileName; diff --git a/src/osgPlugins/osg/LightSource.cpp b/src/osgPlugins/osg/LightSource.cpp index 1622fa47a..be145387a 100644 --- a/src/osgPlugins/osg/LightSource.cpp +++ b/src/osgPlugins/osg/LightSource.cpp @@ -28,13 +28,13 @@ bool LightSource_readLocalData(Object& obj, Input& fr) LightSource& lightsource = static_cast(obj); if (fr[0].matchWord("referenceFrame")) { - if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) { - lightsource.setReferenceFrame(LightSource::RELATIVE_TO_ABSOLUTE); + if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) { + lightsource.setReferenceFrame(LightSource::ABSOLUTE); fr += 2; iteratorAdvanced = true; } - if (fr[1].matchWord("RELATIVE_TO_PARENTS")) { - lightsource.setReferenceFrame(LightSource::RELATIVE_TO_PARENTS); + if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) { + lightsource.setReferenceFrame(LightSource::RELATIVE); fr += 2; iteratorAdvanced = true; } @@ -58,12 +58,12 @@ bool LightSource_writeLocalData(const Object& obj, Output& fw) fw.indent() << "referenceFrame "; switch (lightsource.getReferenceFrame()) { - case LightSource::RELATIVE_TO_ABSOLUTE: + case LightSource::ABSOLUTE: fw << "RELATIVE_TO_ABSOLUTE\n"; break; - case LightSource::RELATIVE_TO_PARENTS: + case LightSource::RELATIVE: default: - fw << "RELATIVE_TO_PARENTS\n"; + fw << "RELATIVE\n"; }; if (lightsource.getLight()) fw.writeObject(*lightsource.getLight()); diff --git a/src/osgPlugins/osg/Transform.cpp b/src/osgPlugins/osg/Transform.cpp index f90221d2d..470f6ad79 100644 --- a/src/osgPlugins/osg/Transform.cpp +++ b/src/osgPlugins/osg/Transform.cpp @@ -50,13 +50,13 @@ bool Transform_readLocalData(Object& obj, Input& fr) } if (fr[0].matchWord("referenceFrame")) { - if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) { - transform.setReferenceFrame(Transform::RELATIVE_TO_ABSOLUTE); + if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE") ) { + transform.setReferenceFrame(Transform::ABSOLUTE); fr += 2; iteratorAdvanced = true; } - if (fr[1].matchWord("RELATIVE_TO_PARENTS")) { - transform.setReferenceFrame(Transform::RELATIVE_TO_PARENTS); + if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) { + transform.setReferenceFrame(Transform::RELATIVE); fr += 2; iteratorAdvanced = true; } @@ -72,12 +72,12 @@ bool Transform_writeLocalData(const Object& obj, Output& fw) fw.indent() << "referenceFrame "; switch (transform.getReferenceFrame()) { - case Transform::RELATIVE_TO_ABSOLUTE: - fw << "RELATIVE_TO_ABSOLUTE\n"; + case Transform::ABSOLUTE: + fw << "ABSOLUTE\n"; break; - case Transform::RELATIVE_TO_PARENTS: + case Transform::RELATIVE: default: - fw << "RELATIVE_TO_PARENTS\n"; + fw << "RELATIVE\n"; }; return true; diff --git a/src/osgPlugins/osgParticle/IO_ParticleProcessor.cpp b/src/osgPlugins/osgParticle/IO_ParticleProcessor.cpp index d4de419b1..115eade88 100644 --- a/src/osgPlugins/osgParticle/IO_ParticleProcessor.cpp +++ b/src/osgPlugins/osgParticle/IO_ParticleProcessor.cpp @@ -51,13 +51,13 @@ bool ParticleProcessor_readLocalData(osg::Object &obj, osgDB::Input &fr) } if (fr[0].matchWord("referenceFrame")) { - if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) { - myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_TO_ABSOLUTE); + if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) { + myobj.setReferenceFrame(osgParticle::ParticleProcessor::ABSOLUTE); fr += 2; itAdvanced = true; } - if (fr[1].matchWord("RELATIVE_TO_PARENTS")) { - myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_TO_PARENTS); + if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) { + myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE); fr += 2; itAdvanced = true; } @@ -129,12 +129,12 @@ bool ParticleProcessor_writeLocalData(const osg::Object &obj, osgDB::Output &fw) fw.indent() << "referenceFrame "; switch (myobj.getReferenceFrame()) { - case osgParticle::ParticleProcessor::RELATIVE_TO_ABSOLUTE: - fw << "RELATIVE_TO_ABSOLUTE" << std::endl; + case osgParticle::ParticleProcessor::ABSOLUTE: + fw << "ABSOLUTE" << std::endl; break; - case osgParticle::ParticleProcessor::RELATIVE_TO_PARENTS: + case osgParticle::ParticleProcessor::RELATIVE: default: - fw << "RELATIVE_TO_PARENTS" << std::endl; + fw << "RELATIVE" << std::endl; } fw.indent() << "endless "; diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index ba6a3fc41..e7d9879ae 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -468,11 +468,11 @@ void Viewer::setUpViewer(unsigned int options) lightsource->setLight(light); if (options & HEAD_LIGHT_SOURCE) { - lightsource->setReferenceFrame(osg::LightSource::RELATIVE_TO_ABSOLUTE); // headlight. + lightsource->setReferenceFrame(osg::LightSource::ABSOLUTE); // headlight. } else { - lightsource->setReferenceFrame(osg::LightSource::RELATIVE_TO_PARENTS); // skylight + lightsource->setReferenceFrame(osg::LightSource::RELATIVE); // skylight } lightsource->setLocalStateSetModes(osg::StateAttribute::ON); } diff --git a/src/osgSim/DOFTransform.cpp b/src/osgSim/DOFTransform.cpp index 5241307e3..d89bc51e0 100644 --- a/src/osgSim/DOFTransform.cpp +++ b/src/osgSim/DOFTransform.cpp @@ -141,7 +141,7 @@ bool DOFTransform::computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisito l2w.postMult(getInversePutMatrix()); // finally. - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { matrix.preMult(l2w); } @@ -209,7 +209,7 @@ bool DOFTransform::computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisito //and impose inverse put: w2l.postMult(getPutMatrix()); - if (_referenceFrame==RELATIVE_TO_PARENTS) + if (_referenceFrame==RELATIVE) { //finally: matrix.postMult(w2l); diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index ee3fdc339..e73c19aff 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -830,7 +830,7 @@ void CullVisitor::apply(LightSource& node) StateAttribute* light = node.getLight(); if (light) { - if (node.getReferenceFrame()==osg::LightSource::RELATIVE_TO_PARENTS) + if (node.getReferenceFrame()==osg::LightSource::RELATIVE) { RefMatrix& matrix = getModelViewMatrix(); addPositionedAttribute(&matrix,light); diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 3a87bb984..181fc2219 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -625,7 +625,7 @@ class CollectLowestTransformsVisitor : public osg::NodeVisitor if (transform) { if (transform->getDataVariance()==osg::Transform::DYNAMIC) _moreThanOneMatrixRequired=true; - else if (transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_ABSOLUTE) _moreThanOneMatrixRequired=true; + else if (transform->getReferenceFrame()==osg::Transform::RELATIVE) _moreThanOneMatrixRequired=true; else { if (_transformSet.empty()) transform->computeLocalToWorldMatrix(_firstMatrix,0);