diff --git a/NEWS b/NEWS index c1b7e800e..43b94ec1a 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,15 @@ OSG News (most significant items from ChangeLog) ================================================ - Support added for dynamic paging of Terrage databases. + Support added for dynamic paging of Terrage databases, the required + multi-threading is set up by defult. All the end user application need + to do is load the database and the paging then happens automatically - + without any need for intervention by the users application. + + The app phase of operations on the scene graph has been renamed + the update phase to make its function clearer. The main phases are now + named now does update, cull, draw. The AppVisitor, set/getAppCallback etc + have be renamed UpdateVisitor, set/getUpdateCallback etc. Added new osgshadowtexture demo which illustrates how to create dynamic shadow textures in your scene. @@ -13,8 +21,6 @@ OSG News (most significant items from ChangeLog) From Brede Johansen, new osgpbuffer demo for Win32. New osglogo demo. - - New osgshadowtexture demo. 13th November 2002 - OpenSceneGraph-0.9.2.tar.gz diff --git a/VisualStudio/osgUtil/osgUtil.dsp b/VisualStudio/osgUtil/osgUtil.dsp index 0a0f1ba0a..0865e4ed6 100755 --- a/VisualStudio/osgUtil/osgUtil.dsp +++ b/VisualStudio/osgUtil/osgUtil.dsp @@ -105,7 +105,7 @@ SOURCE=..\..\src\osgUtil\HighlightMapGenerator.cpp # End Source File # Begin Source File -SOURCE=..\..\src\osgUtil\AppVisitor.cpp +SOURCE=..\..\src\osgUtil\UpdateVisitor.cpp # End Source File # Begin Source File @@ -205,7 +205,7 @@ SOURCE=..\..\include\osgUtil\ReflectionMapGenerator # End Source File # Begin Source File -SOURCE=..\..\include\osgUtil\AppVisitor +SOURCE=..\..\include\osgUtil\UpdateVisitor # End Source File # Begin Source File diff --git a/include/osg/Drawable b/include/osg/Drawable index 8d7456339..062b8d665 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -172,21 +172,36 @@ class SG_EXPORT Drawable : public Object void compile(State& state); - struct AppCallback : public virtual osg::Referenced + struct UpdateCallback : public virtual osg::Referenced + { + /** do customized app code.*/ + virtual void update(osg::NodeVisitor *visitor, osg::Drawable* drawable) = 0; + }; + + /** Set the UpdateCallback which allows users to attach customize the undating of an object during the app traversal.*/ + void setUpdateCallback(UpdateCallback* ac); + + /** Get the non const UpdateCallback.*/ + UpdateCallback* getUpdateCallback() { return _updateCallback.get(); } + +#ifdef USE_DEPRECATED_API + struct AppCallback : public UpdateCallback { /** do customized app code.*/ virtual void app(osg::NodeVisitor *visitor, osg::Drawable* drawable) = 0; + + virtual void update(osg::NodeVisitor *visitor, osg::Drawable* drawable) { app(visitor,drawable); } }; - /** Set the AppCallback which allows users to attach customize the undating of an object during the app traversal.*/ - void setAppCallback(AppCallback* ac); + /** deprecated.*/ + void setAppCallback(AppCallback* ac) { setUpdateCallback(ac); } - /** Get the non const AppCallback.*/ - AppCallback* getAppCallback() { return _appCallback.get(); } + /** deprecated.*/ + AppCallback* getAppCallback() { return getUpdateCallback(); } - /** Get the const AppCallback.*/ - const AppCallback* getAppCallback() const { return _appCallback.get(); } - + /** deprecated.*/ + const AppCallback* getAppCallback() const { return getUpdateCallback(); } +#endif struct CullCallback : public virtual osg::Referenced { @@ -381,7 +396,7 @@ class SG_EXPORT Drawable : public Object typedef osg::buffered_value GLObjectList; mutable GLObjectList _globjList; - ref_ptr _appCallback; + ref_ptr _updateCallback; ref_ptr _drawCallback; ref_ptr _cullCallback; diff --git a/include/osg/Node b/include/osg/Node index 8b32f7e55..4c099c664 100644 --- a/include/osg/Node +++ b/include/osg/Node @@ -127,18 +127,29 @@ class SG_EXPORT Node : public Object inline unsigned int getNumParents() const { return _parents.size(); } - /** Set app node callback, called during app traversal. */ - void setAppCallback(NodeCallback* nc); + /** Set update node callback, called during update traversal. */ + void setUpdateCallback(NodeCallback* nc); - /** Get app node callback, called during app traversal. */ - inline NodeCallback* getAppCallback() { return _appCallback.get(); } + /** Get update node callback, called during update traversal. */ + inline NodeCallback* getUpdateCallback() { return _updateCallback.get(); } - /** Get const app node callback, called during app traversal. */ - inline const NodeCallback* getAppCallback() const { return _appCallback.get(); } + /** Get const update node callback, called during update traversal. */ + inline const NodeCallback* getUpdateCallback() const { return _updateCallback.get(); } + +#ifdef USE_DEPRECATED_API + /** deprecated. */ + void setAppCallback(NodeCallback* nc) { setUpdateCallback(nc); } + + /** deprecated. */ + inline NodeCallback* getAppCallback() { return getUpdateCallback(); } + + /** deprecated. */ + inline const NodeCallback* getAppCallback() const { return getUpdateCallback(); } +#endif /** Get the number of Children of this node which require App traversal, * since they have an AppCallback attached to them or their children.*/ - inline unsigned int getNumChildrenRequiringAppTraversal() const { return _numChildrenRequiringAppTraversal; } + inline unsigned int getNumChildrenRequiringUpdateTraversal() const { return _numChildrenRequiringUpdateTraversal; } /** Set cull node callback, called during cull traversal. */ @@ -256,9 +267,9 @@ class SG_EXPORT Node : public Object friend class osg::Group; friend class osg::Drawable; - ref_ptr _appCallback; - unsigned int _numChildrenRequiringAppTraversal; - void setNumChildrenRequiringAppTraversal(unsigned int num); + ref_ptr _updateCallback; + unsigned int _numChildrenRequiringUpdateTraversal; + void setNumChildrenRequiringUpdateTraversal(unsigned int num); ref_ptr _cullCallback; diff --git a/include/osg/NodeVisitor b/include/osg/NodeVisitor index ad37e7fde..17bf16b78 100644 --- a/include/osg/NodeVisitor +++ b/include/osg/NodeVisitor @@ -58,7 +58,7 @@ class SG_EXPORT NodeVisitor : public Referenced enum VisitorType { NODE_VISITOR = 0, - APP_VISITOR, + UPDATE_VISITOR, COLLECT_OCCLUDER_VISITOR, CULL_VISITOR }; diff --git a/include/osgGLUT/Viewer b/include/osgGLUT/Viewer index c86733129..3a99215a2 100644 --- a/include/osgGLUT/Viewer +++ b/include/osgGLUT/Viewer @@ -60,7 +60,7 @@ class OSGGLUT_EXPORT Viewer : public Window, public osgGA::GUIActionAdapter virtual bool run(); // called on each frame redraw..return the time in ms for each operation. - virtual float app(unsigned int viewport); + virtual float update(unsigned int viewport); virtual float cull(unsigned int viewport); virtual float draw(unsigned int viewport); @@ -163,10 +163,10 @@ class OSGGLUT_EXPORT Viewer : public Window, public osgGA::GUIActionAdapter struct StatsRecord { // gwm Jul 2001, added for display of statistics StatsRecord(): - timeApp(0), timeCull(0), timeDraw(0), timeFrame(0), + timeUpdate(0), timeCull(0), timeDraw(0), timeFrame(0), frameend(0) {} - float timeApp, timeCull, timeDraw, timeFrame; + float timeUpdate, timeCull, timeDraw, timeFrame; osg::Timer_t frameend; }; StatsRecord times[3]; // store up to 3 frames worth of times diff --git a/include/osgUtil/SceneView b/include/osgUtil/SceneView index 349179cc6..4593f9109 100644 --- a/include/osgUtil/SceneView +++ b/include/osgUtil/SceneView @@ -140,9 +140,9 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced osg::NodeVisitor* getInitVisitor() { return _initVisitor.get(); } const osg::NodeVisitor* getInitVisitor() const { return _initVisitor.get(); } - void setAppVisitor(osg::NodeVisitor* av) { _appVisitor = av; } - osg::NodeVisitor* getAppVisitor() { return _appVisitor.get(); } - const osg::NodeVisitor* getAppVisitor() const { return _appVisitor.get(); } + void setUpdateVisitor(osg::NodeVisitor* av) { _updateVisitor = av; } + osg::NodeVisitor* getUpdateVisitor() { return _updateVisitor.get(); } + const osg::NodeVisitor* getUpdateVisitor() const { return _updateVisitor.get(); } void setCullVisitor(osgUtil::CullVisitor* cv) { _cullVisitor = cv; } osgUtil::CullVisitor* getCullVisitor() { return _cullVisitor.get(); } @@ -261,13 +261,16 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced * The init traversal is called once for each SceneView, and should * be used to compile display list, texture objects intialize data * not otherwise intializaed during scene graph loading. Note, is - * called automatically by app&cull if it hasn't already been called + * called automatically by update&cull if it hasn't already been called * elsewhere. Also init() should only ever be called within a valid * graphics context.*/ virtual void init(); /** Do app traversal of attached scene graph using App NodeVisitor.*/ - virtual void app(); + virtual void update(); +#ifdef USE_DEPREACTED_API + virtual void app() { update(); } +#endif /** Do cull traversal of attached scene graph using Cull NodeVisitor.*/ virtual void cull(); @@ -297,7 +300,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced bool _initCalled; osg::ref_ptr _initVisitor; - osg::ref_ptr _appVisitor; + osg::ref_ptr _updateVisitor; osg::Node::NodeMask _cullMask; osg::ref_ptr _cullVisitor; osg::ref_ptr _rendergraph; diff --git a/include/osgUtil/AppVisitor b/include/osgUtil/UpdateVisitor similarity index 72% rename from include/osgUtil/AppVisitor rename to include/osgUtil/UpdateVisitor index 88afec889..1ea84b54a 100644 --- a/include/osgUtil/AppVisitor +++ b/include/osgUtil/UpdateVisitor @@ -2,8 +2,8 @@ //Distributed under the terms of the GNU Library General Public License (LGPL) //as published by the Free Software Foundation. -#ifndef OSGUTIL_APPVISITOR -#define OSGUTIL_APPVISITOR 1 +#ifndef OSGUTIL_UPDATEVISITOR +#define OSGUTIL_UPDATEVISITOR 1 #include #include @@ -22,16 +22,16 @@ namespace osgUtil { /** - * Basic AppVisitor implementation for animating a scene. + * Basic UpdateVisitor implementation for animating a scene. * This visitor traverses the scene graph, call each nodes appCallback if * it exists. */ -class OSGUTIL_EXPORT AppVisitor : public osg::NodeVisitor +class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor { public: - AppVisitor(); - virtual ~AppVisitor(); + UpdateVisitor(); + virtual ~UpdateVisitor(); virtual void reset(); @@ -54,29 +54,29 @@ class OSGUTIL_EXPORT AppVisitor : public osg::NodeVisitor protected: /** prevent unwanted copy construction.*/ - AppVisitor(const AppVisitor&):osg::NodeVisitor() {} + UpdateVisitor(const UpdateVisitor&):osg::NodeVisitor() {} /** prevent unwanted copy operator.*/ - AppVisitor& operator = (const AppVisitor&) { return *this; } + UpdateVisitor& operator = (const UpdateVisitor&) { return *this; } inline void handle_callbacks_and_traverse(osg::Node& node) { - osg::NodeCallback* callback = node.getAppCallback(); + osg::NodeCallback* callback = node.getUpdateCallback(); if (callback) (*callback)(&node,this); - else if (node.getNumChildrenRequiringAppTraversal()>0) traverse(node); + else if (node.getNumChildrenRequiringUpdateTraversal()>0) traverse(node); } inline void handle_geode_callbacks(osg::Geode& node) { - osg::NodeCallback* callback = node.getAppCallback(); + osg::NodeCallback* callback = node.getUpdateCallback(); if (callback) (*callback)(&node,this); - else if (node.getNumChildrenRequiringAppTraversal()>0) traverse(node); + else if (node.getNumChildrenRequiringUpdateTraversal()>0) traverse(node); // call the app callbacks on the drawables. for(unsigned int i=0;igetAppCallback(); - if (callback) callback->app(this,node.getDrawable(i)); + osg::Drawable::UpdateCallback* callback = node.getDrawable(i)->getUpdateCallback(); + if (callback) callback->update(this,node.getDrawable(i)); } } diff --git a/src/Demos/osganimate/osganimate.cpp b/src/Demos/osganimate/osganimate.cpp index e3a4114b9..684765228 100644 --- a/src/Demos/osganimate/osganimate.cpp +++ b/src/Demos/osganimate/osganimate.cpp @@ -143,7 +143,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius) positioned->addChild(glider); osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform; - xform->setAppCallback(new osg::PositionAttitudeTransform::AnimationPathCallback(animationPath,0.0,1.0)); + xform->setUpdateCallback(new osg::PositionAttitudeTransform::AnimationPathCallback(animationPath,0.0,1.0)); xform->addChild(positioned); model->addChild(xform); @@ -164,7 +164,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius) positioned->addChild(cessna); osg::MatrixTransform* xform = new osg::MatrixTransform; - xform->setAppCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath,0.0f,2.0)); + xform->setUpdateCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath,0.0f,2.0)); xform->addChild(positioned); model->addChild(xform); diff --git a/src/Demos/osgcallback/osgcallback.cpp b/src/Demos/osgcallback/osgcallback.cpp index 26cf4bd62..4aed79acb 100644 --- a/src/Demos/osgcallback/osgcallback.cpp +++ b/src/Demos/osgcallback/osgcallback.cpp @@ -49,13 +49,13 @@ void write_usage(std::ostream& out,const std::string& name) out << std::endl; } -class AppCallback : public osg::NodeCallback +class UpdateCallback : public osg::NodeCallback { virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { - std::cout<<"app callback - pre traverse"<setAppCallback(new DrawableAppCallback()); + geode.getDrawable(i)->setUpdateCallback(new DrawableUpdateCallback()); geode.getDrawable(i)->setCullCallback(new DrawableCullCallback()); geode.getDrawable(i)->setDrawCallback(new DrawableDrawCallback()); } diff --git a/src/Demos/osgclip/osgclip.cpp b/src/Demos/osgclip/osgclip.cpp index 664b54be3..e61e0dfca 100644 --- a/src/Demos/osgclip/osgclip.cpp +++ b/src/Demos/osgclip/osgclip.cpp @@ -98,7 +98,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph) osg::MatrixTransform* transform= new osg::MatrixTransform; osg::NodeCallback* nc = new osgUtil::TransformCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f)); - transform->setAppCallback(nc); + transform->setUpdateCallback(nc); osg::ClipNode* clipnode = new osg::ClipNode; osg::BoundingSphere bs = subgraph->getBound(); diff --git a/src/Demos/osgcluster/osgcluster.cpp b/src/Demos/osgcluster/osgcluster.cpp index d4fbe4151..de43e78b9 100644 --- a/src/Demos/osgcluster/osgcluster.cpp +++ b/src/Demos/osgcluster/osgcluster.cpp @@ -166,9 +166,9 @@ class MySceneView : public SceneView { } // override the basic SceneView::app traversal. - virtual void app() + virtual void update() { - SceneView::app(); + SceneView::update(); switch (_viewerMode) { case(MASTER): diff --git a/src/Demos/osgcube/osgcube.cpp b/src/Demos/osgcube/osgcube.cpp index 9ba5a01da..b7f635d44 100644 --- a/src/Demos/osgcube/osgcube.cpp +++ b/src/Demos/osgcube/osgcube.cpp @@ -181,7 +181,7 @@ int main( int argc, char **argv ) myTransform->addChild( createGeometryCube() ); // move node in a circle at 90 degrees a sec. - myTransform->setAppCallback(new MyTransformCallback(myTransform,osg::inDegrees(90.0f))); + myTransform->setUpdateCallback(new MyTransformCallback(myTransform,osg::inDegrees(90.0f))); // add model to viewer. viewer.addViewport( myTransform ); diff --git a/src/Demos/osggeometry/osggeometry.cpp b/src/Demos/osggeometry/osggeometry.cpp index b37083d18..12cbe3a99 100644 --- a/src/Demos/osggeometry/osggeometry.cpp +++ b/src/Demos/osggeometry/osggeometry.cpp @@ -632,7 +632,7 @@ osg::Node* createBackground() // create a tranform to move the background back and forward with. osg::MatrixTransform* transform = new osg::MatrixTransform(); - transform->setAppCallback(new MyTransformCallback(1.0f)); + transform->setUpdateCallback(new MyTransformCallback(1.0f)); transform->addChild(geode); return transform; diff --git a/src/Demos/osglight/osglight.cpp b/src/Demos/osglight/osglight.cpp index 8f4ffd29b..0f1aa8921 100644 --- a/src/Demos/osglight/osglight.cpp +++ b/src/Demos/osglight/osglight.cpp @@ -124,7 +124,7 @@ osg::Node* createLights(osg::BoundingBox& bb,osg::StateSet* rootStateSet) animationPath->insert(8.0,osg::AnimationPath::ControlPoint(bb.corner(0))); animationPath->setLoopMode(osg::AnimationPath::SWING); - mt->setAppCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath)); + mt->setUpdateCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath)); } // create marker for point light. @@ -225,7 +225,7 @@ osg::Node* createRoom(osg::Node* loadedModel) osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform(); pat->setPivotPoint(loaded_bs.center()); - pat->setAppCallback(new ModelTransformCallback(loaded_bs)); + pat->setUpdateCallback(new ModelTransformCallback(loaded_bs)); pat->addChild(loadedModel); bs = pat->getBound(); diff --git a/src/Demos/osglogo/osglogo.cpp b/src/Demos/osglogo/osglogo.cpp index fa1906436..f4f7f5230 100644 --- a/src/Demos/osglogo/osglogo.cpp +++ b/src/Demos/osglogo/osglogo.cpp @@ -145,7 +145,7 @@ osg:: Node* createGlobe(const osg::BoundingBox& bb,float ratio) osg::MatrixTransform* xform = new osg::MatrixTransform; - xform->setAppCallback(new osgUtil::TransformCallback(bb.center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(30.0f))); + xform->setUpdateCallback(new osgUtil::TransformCallback(bb.center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(30.0f))); xform->addChild(geode); return xform; diff --git a/src/Demos/osgpbuffer/osgpbuffer.cpp b/src/Demos/osgpbuffer/osgpbuffer.cpp index 8b555c567..3ad7a68c2 100644 --- a/src/Demos/osgpbuffer/osgpbuffer.cpp +++ b/src/Demos/osgpbuffer/osgpbuffer.cpp @@ -32,11 +32,11 @@ PBuffer* g_pPixelBuffer; -class MyAppCallback : public osg::NodeCallback +class MyUpdateCallback : public osg::NodeCallback { public: - MyAppCallback(osg::Node* subgraph): + MyUpdateCallback(osg::Node* subgraph): _subgraph(subgraph) {} virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) @@ -196,7 +196,7 @@ new_viewport->setViewport(0,0,width,height); // call back which cretes a deformation field to oscilate the model. class MyGeometryCallback : - public osg::Drawable::AppCallback, + public osg::Drawable::UpdateCallback, public osg::Drawable::AttributeFunctor { public: @@ -539,14 +539,14 @@ texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP); polyGeom->setStateSet(stateset); - polyGeom->setAppCallback(new MyGeometryCallback(origin,xAxis,yAxis,zAxis,1.0,1.0/width,0.2f)); + polyGeom->setUpdateCallback(new MyGeometryCallback(origin,xAxis,yAxis,zAxis,1.0,1.0/width,0.2f)); osg::Geode* geode = new osg::Geode(); geode->addDrawable(polyGeom); osg::Group* parent = new osg::Group; - parent->setAppCallback(new MyAppCallback(subgraph)); + parent->setUpdateCallback(new MyUpdateCallback(subgraph)); parent->setCullCallback(new MyCullCallback(subgraph,texture)); @@ -630,7 +630,7 @@ int main( int argc, char **argv ) loadedModelTransform->addChild(loadedModel); osg::NodeCallback* nc = new osgUtil::TransformCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f)); - loadedModelTransform->setAppCallback(nc); + loadedModelTransform->setUpdateCallback(nc); osg::Group* rootNode = new osg::Group(); // rootNode->addChild(loadedModelTransform); diff --git a/src/Demos/osgprerender/osgprerender.cpp b/src/Demos/osgprerender/osgprerender.cpp index 4acfc37c3..3b6925304 100644 --- a/src/Demos/osgprerender/osgprerender.cpp +++ b/src/Demos/osgprerender/osgprerender.cpp @@ -24,11 +24,11 @@ #include #include -class MyAppCallback : public osg::NodeCallback +class MyUpdateCallback : public osg::NodeCallback { public: - MyAppCallback(osg::Node* subgraph): + MyUpdateCallback(osg::Node* subgraph): _subgraph(subgraph) {} virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) @@ -199,10 +199,9 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv) } - // call back which cretes a deformation field to oscilate the model. class MyGeometryCallback : - public osg::Drawable::AppCallback, + public osg::Drawable::UpdateCallback, public osg::Drawable::AttributeFunctor { public: @@ -221,7 +220,7 @@ class MyGeometryCallback : _yAxis(y), _zAxis(z) {} - virtual void app(osg::NodeVisitor* nv,osg::Drawable* drawable) + virtual void update(osg::NodeVisitor* nv,osg::Drawable* drawable) { const osg::FrameStamp* fs = nv->getFrameStamp(); double referenceTime = fs->getReferenceTime(); @@ -538,14 +537,14 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph) polyGeom->setStateSet(stateset); - polyGeom->setAppCallback(new MyGeometryCallback(origin,xAxis,yAxis,zAxis,1.0,1.0/width,0.2f)); + polyGeom->setUpdateCallback(new MyGeometryCallback(origin,xAxis,yAxis,zAxis,1.0,1.0/width,0.2f)); osg::Geode* geode = new osg::Geode(); geode->addDrawable(polyGeom); osg::Group* parent = new osg::Group; - parent->setAppCallback(new MyAppCallback(subgraph)); + parent->setUpdateCallback(new MyUpdateCallback(subgraph)); parent->setCullCallback(new MyCullCallback(subgraph,image)); @@ -629,7 +628,7 @@ int main( int argc, char **argv ) loadedModelTransform->addChild(loadedModel); osg::NodeCallback* nc = new osgUtil::TransformCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f)); - loadedModelTransform->setAppCallback(nc); + loadedModelTransform->setUpdateCallback(nc); osg::Group* rootNode = new osg::Group(); // rootNode->addChild(loadedModelTransform); diff --git a/src/Demos/osgreflect/osgreflect.cpp b/src/Demos/osgreflect/osgreflect.cpp index 0432a45d3..8afdfb968 100644 --- a/src/Demos/osgreflect/osgreflect.cpp +++ b/src/Demos/osgreflect/osgreflect.cpp @@ -368,7 +368,7 @@ int main( int argc, char **argv ) viewer.addViewport( rootNode ); osg::NodeCallback* nc = new osgUtil::TransformCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f)); - loadedModelTransform->setAppCallback(nc); + loadedModelTransform->setUpdateCallback(nc); // register trackball, flight and drive. viewer.registerCameraManipulator(new osgGA::TrackballManipulator); diff --git a/src/Demos/osgshadowtexture/osgshadowtexture.cpp b/src/Demos/osgshadowtexture/osgshadowtexture.cpp index ae86780d4..893ebdc4f 100644 --- a/src/Demos/osgshadowtexture/osgshadowtexture.cpp +++ b/src/Demos/osgshadowtexture/osgshadowtexture.cpp @@ -138,7 +138,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius) positioned->addChild(cessna); osg::MatrixTransform* xform = new osg::MatrixTransform; - xform->setAppCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath,0.0f,2.0)); + xform->setUpdateCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath,0.0f,2.0)); xform->addChild(positioned); model->addChild(xform); diff --git a/src/Demos/osgtext/main.cpp b/src/Demos/osgtext/main.cpp index 986da4a4e..2d407c77c 100644 --- a/src/Demos/osgtext/main.cpp +++ b/src/Demos/osgtext/main.cpp @@ -381,13 +381,13 @@ class TextViewer: public osgGLUT::Viewer { public: - virtual float app(unsigned int viewport) + virtual float update(unsigned int viewport) { float ret; - ret=Viewer::app(viewport); + ret=Viewer::update(viewport); if(_hudSceneView.valid() && viewport>=_viewportList.size()-1) { - _hudSceneView->app(); + _hudSceneView->update(); } return ret; } diff --git a/src/Demos/osgtexture1D/osgtexture1D.cpp b/src/Demos/osgtexture1D/osgtexture1D.cpp index a4fb66ad2..f6fc28ec5 100644 --- a/src/Demos/osgtexture1D/osgtexture1D.cpp +++ b/src/Demos/osgtexture1D/osgtexture1D.cpp @@ -221,7 +221,7 @@ int main( int argc, char **argv ) loadedModel->setStateSet(stateset); - loadedModel->setAppCallback(new AnimateStateCallback()); + loadedModel->setUpdateCallback(new AnimateStateCallback()); // add model to viewer. viewer.addViewport( loadedModel ); diff --git a/src/Demos/osgtexture2D/osgtexture2D.cpp b/src/Demos/osgtexture2D/osgtexture2D.cpp index fa210c9d3..23afbd44e 100644 --- a/src/Demos/osgtexture2D/osgtexture2D.cpp +++ b/src/Demos/osgtexture2D/osgtexture2D.cpp @@ -195,7 +195,7 @@ osg::Node* createLayer(const osg::Vec3& offset,osg::Image* image,osg::Node* geom local_offset += local_delta; - // top_transform->setAppCallback(new TextureCallback(texture)); + // top_transform->setUpdateCallback(new TextureCallback(texture)); } diff --git a/src/Demos/osgtexture3D/osgtexture3D.cpp b/src/Demos/osgtexture3D/osgtexture3D.cpp index da8ee8e9d..5939724a1 100644 --- a/src/Demos/osgtexture3D/osgtexture3D.cpp +++ b/src/Demos/osgtexture3D/osgtexture3D.cpp @@ -189,7 +189,7 @@ osg::Node* createModel() // A bit hacky, and my plan is to reimplement the osg::scaleImage and // osg::Image::copySubImage() without using GLU which will get round // this current limitation. - geode->setAppCallback(new ConstructStateCallback()); + geode->setUpdateCallback(new ConstructStateCallback()); return geode; diff --git a/src/osg/DOFTransform.cpp b/src/osg/DOFTransform.cpp index 2e2052997..e4ab78d40 100644 --- a/src/osg/DOFTransform.cpp +++ b/src/osg/DOFTransform.cpp @@ -7,12 +7,12 @@ DOFTransform::DOFTransform(): _animationOn(true), _increasingFlags(0xffff) { - setNumChildrenRequiringAppTraversal(1); + setNumChildrenRequiringUpdateTraversal(1); } void DOFTransform::traverse(NodeVisitor& nv) { - if (nv.getVisitorType()==NodeVisitor::APP_VISITOR) + if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR) { animate(); } diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 3e1276b6b..3ac6418e9 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -214,15 +214,15 @@ void Drawable::flushDeletedDisplayLists(uint contextID) } } -void Drawable::setAppCallback(AppCallback* ac) +void Drawable::setUpdateCallback(UpdateCallback* ac) { - if (_appCallback==ac) return; + if (_updateCallback==ac) return; int delta = 0; - if (_appCallback.valid()) --delta; + if (_updateCallback.valid()) --delta; if (ac) ++delta; - _appCallback = ac; + _updateCallback = ac; if (delta!=0) { @@ -230,7 +230,7 @@ void Drawable::setAppCallback(AppCallback* ac) itr!=_parents.end(); ++itr) { - (*itr)->setNumChildrenRequiringAppTraversal((*itr)->getNumChildrenRequiringAppTraversal()+delta); + (*itr)->setNumChildrenRequiringUpdateTraversal((*itr)->getNumChildrenRequiringUpdateTraversal()+delta); } } } diff --git a/src/osg/Geode.cpp b/src/osg/Geode.cpp index c2e2cee44..266b49473 100644 --- a/src/osg/Geode.cpp +++ b/src/osg/Geode.cpp @@ -45,9 +45,9 @@ bool Geode::addDrawable( Drawable *drawable ) // register as parent of drawable. drawable->addParent(this); - if (drawable->getAppCallback()) + if (drawable->getUpdateCallback()) { - setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+1); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } dirtyBound(); @@ -75,20 +75,20 @@ bool Geode::removeDrawable(unsigned int pos,unsigned int numDrawablesToRemove) endOfRemoveRange=_drawables.size(); } - unsigned int appCallbackRemoved = 0; + unsigned int updateCallbackRemoved = 0; for(unsigned i=pos;iremoveParent(this); // update the number of app calbacks removed - if (_drawables[i]->getAppCallback()) ++appCallbackRemoved; + if (_drawables[i]->getUpdateCallback()) ++updateCallbackRemoved; } _drawables.erase(_drawables.begin()+pos,_drawables.begin()+endOfRemoveRange); - if (appCallbackRemoved) + if (updateCallbackRemoved) { - setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()-appCallbackRemoved); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-updateCallbackRemoved); } dirtyBound(); @@ -118,11 +118,11 @@ bool Geode::setDrawable( unsigned int i, Drawable* newDrawable ) Drawable* origDrawable = _drawables[i].get(); int delta = 0; - if (origDrawable->getAppCallback()) --delta; - if (newDrawable->getAppCallback()) ++delta; + if (origDrawable->getUpdateCallback()) --delta; + if (newDrawable->getUpdateCallback()) ++delta; if (delta!=0) { - setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+delta); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+delta); } // remove from origDrawable's parent list. diff --git a/src/osg/Group.cpp b/src/osg/Group.cpp index 8a4423c44..a349db02b 100644 --- a/src/osg/Group.cpp +++ b/src/osg/Group.cpp @@ -65,11 +65,11 @@ bool Group::addChild( Node *child ) // could now require app traversal thanks to the new subgraph, // so need to check and update if required. - if (child->getNumChildrenRequiringAppTraversal()>0 || - child->getAppCallback()) + if (child->getNumChildrenRequiringUpdateTraversal()>0 || + child->getUpdateCallback()) { - setNumChildrenRequiringAppTraversal( - getNumChildrenRequiringAppTraversal()+1 + setNumChildrenRequiringUpdateTraversal( + getNumChildrenRequiringUpdateTraversal()+1 ); } @@ -123,7 +123,7 @@ bool Group::removeChild(unsigned int pos,unsigned int numChildrenToRemove) // remove this Geode from the child parent list. child->removeParent(this); - if (child->getNumChildrenRequiringAppTraversal()>0 || child->getAppCallback()) ++appCallbackRemoved; + if (child->getNumChildrenRequiringUpdateTraversal()>0 || child->getUpdateCallback()) ++appCallbackRemoved; if (child->getNumChildrenWithCullingDisabled()>0 || !child->getCullingActive()) ++numChildrenWithCullingDisabledRemoved; @@ -135,7 +135,7 @@ bool Group::removeChild(unsigned int pos,unsigned int numChildrenToRemove) if (appCallbackRemoved) { - setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()-appCallbackRemoved); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-appCallbackRemoved); } if (numChildrenWithCullingDisabledRemoved) @@ -192,21 +192,21 @@ bool Group::setChild( unsigned int i, Node* newNode ) // could now require app traversal thanks to the new subgraph, // so need to check and update if required. int delta_numChildrenRequiringAppTraversal = 0; - if (origNode->getNumChildrenRequiringAppTraversal()>0 || - origNode->getAppCallback()) + if (origNode->getNumChildrenRequiringUpdateTraversal()>0 || + origNode->getUpdateCallback()) { --delta_numChildrenRequiringAppTraversal; } - if (newNode->getNumChildrenRequiringAppTraversal()>0 || - newNode->getAppCallback()) + if (newNode->getNumChildrenRequiringUpdateTraversal()>0 || + newNode->getUpdateCallback()) { ++delta_numChildrenRequiringAppTraversal; } if (delta_numChildrenRequiringAppTraversal!=0) { - setNumChildrenRequiringAppTraversal( - getNumChildrenRequiringAppTraversal()+delta_numChildrenRequiringAppTraversal + setNumChildrenRequiringUpdateTraversal( + getNumChildrenRequiringUpdateTraversal()+delta_numChildrenRequiringAppTraversal ); } diff --git a/src/osg/MatrixTransform.cpp b/src/osg/MatrixTransform.cpp index 557285bd3..77adc1ace 100644 --- a/src/osg/MatrixTransform.cpp +++ b/src/osg/MatrixTransform.cpp @@ -16,7 +16,7 @@ MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp& _inverseDirty(transform._inverseDirty), _animationPath(dynamic_cast(copyop(transform._animationPath.get()))) { - if (_animationPath.valid()) setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+1); + if (_animationPath.valid()) setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } MatrixTransform::MatrixTransform(const Matrix& mat ) @@ -38,7 +38,7 @@ void MatrixTransform::traverse(NodeVisitor& nv) { // if app traversal update the frame count. if (_animationPath.valid() && - nv.getVisitorType()==NodeVisitor::APP_VISITOR && + nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR && nv.getFrameStamp()) { double time = nv.getFrameStamp()->getReferenceTime(); @@ -54,7 +54,7 @@ void MatrixTransform::AnimationPathCallback::operator()(Node* node, NodeVisitor* MatrixTransform* mt = dynamic_cast(node); if (mt && _animationPath.valid() && - nv->getVisitorType()==NodeVisitor::APP_VISITOR && + nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR && nv->getFrameStamp()) { double time = nv->getFrameStamp()->getReferenceTime(); diff --git a/src/osg/Node.cpp b/src/osg/Node.cpp index e3e61f932..201edcfbe 100644 --- a/src/osg/Node.cpp +++ b/src/osg/Node.cpp @@ -13,7 +13,7 @@ Node::Node() _bsphere_computed = false; _nodeMask = 0xffffffff; - _numChildrenRequiringAppTraversal = 0; + _numChildrenRequiringUpdateTraversal = 0; _cullingActive = true; _numChildrenWithCullingDisabled = 0; @@ -27,8 +27,8 @@ Node::Node(const Node& node,const CopyOp& copyop): _bsphere_computed(node._bsphere_computed), _name(node._name), _parents(), // leave empty as parentList is managed by Group. - _appCallback(node._appCallback), - _numChildrenRequiringAppTraversal(0), // assume no children yet. + _updateCallback(node._updateCallback), + _numChildrenRequiringUpdateTraversal(0), // assume no children yet. _cullCallback(node._cullCallback), _cullingActive(node._cullingActive), _numChildrenWithCullingDisabled(0), // assume no children yet. @@ -77,24 +77,24 @@ osg::StateSet* Node::getOrCreateStateSet() } -void Node::setAppCallback(NodeCallback* nc) +void Node::setUpdateCallback(NodeCallback* nc) { // if no changes just return. - if (_appCallback==nc) return; + if (_updateCallback==nc) return; // app callback has been changed, will need to update - // both _appCallback and possibly the numChildrenRequiringAppTraversal + // both _updateCallback and possibly the numChildrenRequiringAppTraversal // if the number of callbacks changes. // update the parents numChildrenRequiringAppTraversal - // note, if _numChildrenRequiringAppTraversal!=0 then the + // note, if _numChildrenRequiringUpdateTraversal!=0 then the // parents won't be affected by any app callback change, // so no need to inform them. - if (_numChildrenRequiringAppTraversal==0 && !_parents.empty()) + if (_numChildrenRequiringUpdateTraversal==0 && !_parents.empty()) { int delta = 0; - if (_appCallback.valid()) --delta; + if (_updateCallback.valid()) --delta; if (nc) ++delta; if (delta!=0) { @@ -105,32 +105,32 @@ void Node::setAppCallback(NodeCallback* nc) itr != _parents.end(); ++itr) { - (*itr)->setNumChildrenRequiringAppTraversal( - (*itr)->getNumChildrenRequiringAppTraversal()+delta ); + (*itr)->setNumChildrenRequiringUpdateTraversal( + (*itr)->getNumChildrenRequiringUpdateTraversal()+delta ); } } } // set the app callback itself. - _appCallback = nc; + _updateCallback = nc; } -void Node::setNumChildrenRequiringAppTraversal(unsigned int num) +void Node::setNumChildrenRequiringUpdateTraversal(unsigned int num) { // if no changes just return. - if (_numChildrenRequiringAppTraversal==num) return; + if (_numChildrenRequiringUpdateTraversal==num) return; - // note, if _appCallback is set then the + // note, if _updateCallback is set then the // parents won't be affected by any changes to - // _numChildrenRequiringAppTraversal so no need to inform them. - if (!_appCallback && !_parents.empty()) + // _numChildrenRequiringUpdateTraversal so no need to inform them. + if (!_updateCallback && !_parents.empty()) { // need to pass on changes to parents. int delta = 0; - if (_numChildrenRequiringAppTraversal>0) --delta; + if (_numChildrenRequiringUpdateTraversal>0) --delta; if (num>0) ++delta; if (delta!=0) { @@ -141,8 +141,8 @@ void Node::setNumChildrenRequiringAppTraversal(unsigned int num) itr != _parents.end(); ++itr) { - (*itr)->setNumChildrenRequiringAppTraversal( - (*itr)->getNumChildrenRequiringAppTraversal()+delta + (*itr)->setNumChildrenRequiringUpdateTraversal( + (*itr)->getNumChildrenRequiringUpdateTraversal()+delta ); } @@ -150,7 +150,7 @@ void Node::setNumChildrenRequiringAppTraversal(unsigned int num) } // finally update this objects value. - _numChildrenRequiringAppTraversal=num; + _numChildrenRequiringUpdateTraversal=num; } diff --git a/src/osg/PositionAttitudeTransform.cpp b/src/osg/PositionAttitudeTransform.cpp index 64ab25e8d..29d861a41 100644 --- a/src/osg/PositionAttitudeTransform.cpp +++ b/src/osg/PositionAttitudeTransform.cpp @@ -46,7 +46,7 @@ void PositionAttitudeTransform::AnimationPathCallback::operator()(Node* node, No PositionAttitudeTransform* pat = dynamic_cast(node); if (pat && _animationPath.valid() && - nv->getVisitorType()==NodeVisitor::APP_VISITOR && + nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR && nv->getFrameStamp()) { double time = nv->getFrameStamp()->getReferenceTime(); diff --git a/src/osg/Sequence.cpp b/src/osg/Sequence.cpp index 91177c83c..375fad944 100644 --- a/src/osg/Sequence.cpp +++ b/src/osg/Sequence.cpp @@ -19,7 +19,7 @@ Sequence::Sequence() : _nrepsremain(0), _mode(STOP) { - setNumChildrenRequiringAppTraversal(1); + setNumChildrenRequiringUpdateTraversal(1); } Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) : @@ -35,7 +35,7 @@ Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) : _nrepsremain(seq._nrepsremain), _mode(seq._mode) { - setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+1); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } void Sequence::setTime(int frame, float t) @@ -105,7 +105,7 @@ void Sequence::setMode(SequenceMode mode) void Sequence::traverse(NodeVisitor& nv) { // if app traversal update the frame count. - if (nv.getVisitorType()==NodeVisitor::APP_VISITOR && _mode == START && _nrepsremain) + if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR && _mode == START && _nrepsremain) { const FrameStamp* framestamp = nv.getFrameStamp(); if (framestamp) diff --git a/src/osg/ShapeDrawable.cpp b/src/osg/ShapeDrawable.cpp index 670a6abca..48e69bf11 100644 --- a/src/osg/ShapeDrawable.cpp +++ b/src/osg/ShapeDrawable.cpp @@ -855,8 +855,8 @@ void PrimitiveShapeVisitor::apply(const Sphere& sphere) float rTop = cosf(lTop)*sphere.getRadius(); float zTop = sinf(lTop)*sphere.getRadius(); float vTop = vBase+vDelta; - float nzTop= sinf(lTop); - float nRatioTop= cosf(lTop); + //float nzTop= sinf(lTop); + //float nRatioTop= cosf(lTop); _functor.begin(GL_QUAD_STRIP); diff --git a/src/osgGLUT/Viewer.cpp b/src/osgGLUT/Viewer.cpp index 5b43c7115..6fd460c42 100644 --- a/src/osgGLUT/Viewer.cpp +++ b/src/osgGLUT/Viewer.cpp @@ -372,7 +372,7 @@ void Viewer::requestWarpPointer(int x,int y) } -float Viewer::app(unsigned int viewport) +float Viewer::update(unsigned int viewport) { osg::Timer_t beforeApp = _timer.tick(); @@ -403,7 +403,7 @@ float Viewer::app(unsigned int viewport) // do app traversal. getViewportSceneView(viewport)->setFrameStamp(_frameStamp.get()); - getViewportSceneView(viewport)->app(); + getViewportSceneView(viewport)->update(); osg::Timer_t beforeCull = _timer.tick(); @@ -511,7 +511,7 @@ void Viewer::showStats(const unsigned int /*viewport*/) if (_printStats>=Statistics::STAT_GRAPHS && _printStats!=Statistics::STAT_PRIMSPERVIEW && _printStats!=Statistics::STAT_PRIMSPERBIN) { // more stats - graphs this time int sampleIndex = 2; - float timeApp=times[sampleIndex].timeApp; + float timeUpdate=times[sampleIndex].timeUpdate; float timeCull=times[sampleIndex].timeCull; float timeDraw=times[sampleIndex].timeDraw; float timeFrame=times[sampleIndex].timeFrame; @@ -524,7 +524,7 @@ void Viewer::showStats(const unsigned int /*viewport*/) char clin[72]; // buffer to print glColor4fv((GLfloat * )&app_color); - sprintf(clin,"App %.2f ms.", timeApp); + sprintf(clin,"App %.2f ms.", timeUpdate); displaytext((int)(.15f*tmax),(int)(0.98f*vh),clin); glColor4fv((GLfloat * )&cull_color); @@ -539,7 +539,7 @@ void Viewer::showStats(const unsigned int /*viewport*/) sprintf(clin,"Frame %.2f ms.", timeFrame); displaytext((int)(.75*tmax),(int)(0.98f*vh),clin); - /* osg::notify(osg::NOTICE) << "Time of App "<setReferenceTime(clockSeconds()); // application traverasal. - times[2].timeApp=0.0f; + times[2].timeUpdate=0.0f; // cull traverasal. times[2].timeCull=0.0f; @@ -699,8 +699,8 @@ void Viewer::display() for(unsigned int i = 0; i < getNumViewports(); i++ ) { - // application traverasal. - times[2].timeApp+=app(i); + // update traverasal. + times[2].timeUpdate+=update(i); // cull traverasal. diff --git a/src/osgPlugins/geo/ReaderWriterGEO.cpp b/src/osgPlugins/geo/ReaderWriterGEO.cpp index 431689123..38e6dd4d2 100644 --- a/src/osgPlugins/geo/ReaderWriterGEO.cpp +++ b/src/osgPlugins/geo/ReaderWriterGEO.cpp @@ -126,7 +126,7 @@ public: // so that it visits 'invisible' nodes to update visibility. Or could use // a visitor with setTraversalMode(TraversalMode==TRAVERSE_ALL_CHILDREN)? traverse(node,nv); - // std::cout<<"app callback - post traverse"<< (float)_frameStamp->getReferenceTime() <getReferenceTime() <setAppCallback(gcb); + text->setUpdateCallback(gcb); for (std::vector< georecord *>::const_iterator rcitr=bhv.begin(); rcitr!=bhv.end(); ++rcitr) @@ -778,7 +778,7 @@ class ReaderWriterGEO : public ReaderWriter if (hasColorAction(bhv) || vinf->hasVertexActions()) { osg::Geometry *nugeom=gi.getGeom(); geoBehaviourDrawableCB *gcb=new geoBehaviourDrawableCB; - nugeom->setAppCallback(gcb); + nugeom->setUpdateCallback(gcb); nugeom->setUseDisplayList(false); // as we are updating arrays, cannot change colours for (std::vector< georecord *>::const_iterator rcitr=bhv.begin(); rcitr!=bhv.end(); @@ -956,7 +956,7 @@ class ReaderWriterGEO : public ReaderWriter // also test for other properties of a unique material: // - use material/vertex colours; geoInfo gu(txidx,shademodel, bothsides); - if (gu==&(*itrint) && !(*itrint).getGeom()->getAppCallback()) igeom=igidx; + if (gu==&(*itrint) && !(*itrint).getGeom()->getUpdateCallback()) igeom=igidx; igidx++; } std::vector< georecord *>bhv=grec->getBehaviour(); // behaviours attached to facets, eg colour! @@ -1277,13 +1277,13 @@ class ReaderWriterGEO : public ReaderWriter { if ((*rcitr)->getType()==DB_DSK_INTERNAL_VARS) { theHeader->addInternalVars(**rcitr); - // theHeader->setAppCallback(theHeader->getInternalVars()); + // theHeader->setUpdateCallback(theHeader->getInternalVars()); } if ((*rcitr)->getType()==DB_DSK_FLOAT_VAR) { if (theHeader) theHeader->addUserVar((**rcitr)); } } - theHeader->setAppCallback(new geoHeaderCB); + theHeader->setUpdateCallback(new geoHeaderCB); } for (itr=geomatlist.begin(); itr< geomatlist.end(); itr++) { osg::Material *mt=new osg::Material; @@ -1379,7 +1379,7 @@ class ReaderWriterGEO : public ReaderWriter if (!bhv.empty()) { // then add a DCS/matrix_transform mtr=new MatrixTransform; geoBehaviourCB *gcb=new geoBehaviourCB; - mtr->setAppCallback(gcb); + mtr->setUpdateCallback(gcb); for (std::vector< georecord *>::const_iterator rcitr=bhv.begin(); rcitr!=bhv.end(); @@ -1908,7 +1908,7 @@ void internalVars::update(const osg::FrameStamp *_frameStamp) { break; } } - // std::cout<<"app callback - post traverse"<< (float)_frameStamp->getReferenceTime() <getReferenceTime() < gblist; }; diff --git a/src/osgPlugins/geo/osgGeoAnimation.h b/src/osgPlugins/geo/osgGeoAnimation.h index 90beeed44..b20249174 100644 --- a/src/osgPlugins/geo/osgGeoAnimation.h +++ b/src/osgPlugins/geo/osgGeoAnimation.h @@ -37,11 +37,11 @@ public: }; ~geoHeader() {} void setUserUpdate(double (*ufn)(const double time,const double val, const std::string name) ) - { // pass the address of a user written function in the App process. + { // pass the address of a user written function in the Update phase. uvarupdate=ufn; } void setExternUpdate(double (*ufn)(const double time,const double val, const std::string name) ) - { // pass the address of a user written function in the App process. + { // pass the address of a user written function in the Update phase. extvarupdate=ufn; } double (* uvarupdate)(const double t, const double val, const std::string name); // called when variables are updated, you write this! diff --git a/src/osgPlugins/txp/TerrapageNode.cpp b/src/osgPlugins/txp/TerrapageNode.cpp index 4cc11347f..c8fbb1181 100644 --- a/src/osgPlugins/txp/TerrapageNode.cpp +++ b/src/osgPlugins/txp/TerrapageNode.cpp @@ -8,7 +8,7 @@ namespace txp TerrapageNode::TerrapageNode(): _pageManager(0) { - setNumChildrenRequiringAppTraversal(1); + setNumChildrenRequiringUpdateTraversal(1); } TerrapageNode::TerrapageNode(const TerrapageNode& pager,const osg::CopyOp&): @@ -19,7 +19,7 @@ TerrapageNode::TerrapageNode(const TerrapageNode& pager,const osg::CopyOp&): _pageManager(0), _lastRecordEyePoint(pager._lastRecordEyePoint) { - setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+1); + setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); } TerrapageNode::~TerrapageNode() @@ -32,7 +32,7 @@ void TerrapageNode::traverse(osg::NodeVisitor& nv) { if (_pageManager) { - if (nv.getVisitorType()==osg::NodeVisitor::APP_VISITOR) + if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR) { updateSceneGraph(); } diff --git a/src/osgUtil/AppVisitor.cpp b/src/osgUtil/AppVisitor.cpp deleted file mode 100644 index c10a18ed2..000000000 --- a/src/osgUtil/AppVisitor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -using namespace osg; -using namespace osgUtil; - -AppVisitor::AppVisitor():NodeVisitor(APP_VISITOR,TRAVERSE_ACTIVE_CHILDREN) -{ -} - - -AppVisitor::~AppVisitor() -{ -} - - -void AppVisitor::reset() -{ -} diff --git a/src/osgUtil/Makefile b/src/osgUtil/Makefile index cd26ab76a..037a3585e 100644 --- a/src/osgUtil/Makefile +++ b/src/osgUtil/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES = \ - AppVisitor.cpp\ + UpdateVisitor.cpp\ CullVisitor.cpp\ DisplayListVisitor.cpp\ DisplayRequirementsVisitor.cpp\ diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 737cc1aa8..e36429c54 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -878,7 +878,7 @@ void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Group& group) if (group.getNumParents()>0 && group.getNumChildren()<=1) { if (!group.getUserData() && - !group.getAppCallback() && + !group.getUpdateCallback() && !group.getStateSet() && group.getNodeMask()==0xffffffff) { diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index af52cd996..356520d2c 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -80,7 +80,7 @@ void SceneView::setDefaults() _initVisitor = dlv; #endif - _appVisitor = new AppVisitor; + _updateVisitor = new UpdateVisitor; _cullVisitor = new CullVisitor; @@ -137,7 +137,7 @@ void SceneView::init() } } -void SceneView::app() +void SceneView::update() { if (!_initCalled) init(); @@ -155,19 +155,19 @@ void SceneView::app() std::cout<<" Number of active objects ="<reset(); + _updateVisitor->reset(); - _appVisitor->setFrameStamp(_frameStamp.get()); + _updateVisitor->setFrameStamp(_frameStamp.get()); // use the frame number for the traversal number. if (_frameStamp.valid()) { - _appVisitor->setTraversalNumber(_frameStamp->getFrameNumber()); + _updateVisitor->setTraversalNumber(_frameStamp->getFrameNumber()); } - _sceneData->accept(*_appVisitor.get()); + _sceneData->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 diff --git a/src/osgUtil/UpdateVisitor.cpp b/src/osgUtil/UpdateVisitor.cpp new file mode 100644 index 000000000..3fa8415eb --- /dev/null +++ b/src/osgUtil/UpdateVisitor.cpp @@ -0,0 +1,18 @@ +#include + +using namespace osg; +using namespace osgUtil; + +UpdateVisitor::UpdateVisitor():NodeVisitor(UPDATE_VISITOR,TRAVERSE_ACTIVE_CHILDREN) +{ +} + + +UpdateVisitor::~UpdateVisitor() +{ +} + + +void UpdateVisitor::reset() +{ +}