Renamed all instance of AppCallback/AppVisitor to UpdateCallback/UpdateVisitor

inline with the decision to rename the "app phase" the "update phase".
This commit is contained in:
Robert Osfield 2002-12-19 15:55:40 +00:00
parent eb42926ab1
commit adf5c91808
44 changed files with 239 additions and 205 deletions

12
NEWS
View File

@ -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

View File

@ -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

View File

@ -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<uint> GLObjectList;
mutable GLObjectList _globjList;
ref_ptr<AppCallback> _appCallback;
ref_ptr<UpdateCallback> _updateCallback;
ref_ptr<DrawCallback> _drawCallback;
ref_ptr<CullCallback> _cullCallback;

View File

@ -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<NodeCallback> _appCallback;
unsigned int _numChildrenRequiringAppTraversal;
void setNumChildrenRequiringAppTraversal(unsigned int num);
ref_ptr<NodeCallback> _updateCallback;
unsigned int _numChildrenRequiringUpdateTraversal;
void setNumChildrenRequiringUpdateTraversal(unsigned int num);
ref_ptr<NodeCallback> _cullCallback;

View File

@ -58,7 +58,7 @@ class SG_EXPORT NodeVisitor : public Referenced
enum VisitorType
{
NODE_VISITOR = 0,
APP_VISITOR,
UPDATE_VISITOR,
COLLECT_OCCLUDER_VISITOR,
CULL_VISITOR
};

View File

@ -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

View File

@ -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<osg::NodeVisitor> _initVisitor;
osg::ref_ptr<osg::NodeVisitor> _appVisitor;
osg::ref_ptr<osg::NodeVisitor> _updateVisitor;
osg::Node::NodeMask _cullMask;
osg::ref_ptr<osgUtil::CullVisitor> _cullVisitor;
osg::ref_ptr<osgUtil::RenderGraph> _rendergraph;

View File

@ -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 <osg/NodeVisitor>
#include <osg/Node>
@ -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;i<node.getNumDrawables();++i)
{
osg::Drawable::AppCallback* callback = node.getDrawable(i)->getAppCallback();
if (callback) callback->app(this,node.getDrawable(i));
osg::Drawable::UpdateCallback* callback = node.getDrawable(i)->getUpdateCallback();
if (callback) callback->update(this,node.getDrawable(i));
}
}

View File

@ -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);

View File

@ -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"<<node<<std::endl;
std::cout<<"update callback - pre traverse"<<node<<std::endl;
traverse(node,nv);
std::cout<<"app callback - post traverse"<<node<<std::endl;
std::cout<<"update callback - post traverse"<<node<<std::endl;
}
};
@ -100,11 +100,11 @@ struct TransformCallback : public osg::Transform::ComputeTransformCallback
}
};
struct DrawableAppCallback : public osg::Drawable::AppCallback
struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback
{
virtual void app(osg::NodeVisitor*, osg::Drawable* drawable)
virtual void update(osg::NodeVisitor*, osg::Drawable* drawable)
{
std::cout<<"Drawable app callback "<<drawable<<std::endl;
std::cout<<"Drawable update callback "<<drawable<<std::endl;
}
};
@ -129,14 +129,14 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
virtual void apply(osg::Node& node)
{
node.setAppCallback(new AppCallback());
node.setUpdateCallback(new UpdateCallback());
node.setCullCallback(new CullCallback());
traverse(node);
}
virtual void apply(osg::Geode& geode)
{
geode.setAppCallback(new AppCallback());
geode.setUpdateCallback(new UpdateCallback());
//note, it makes no sense to attach a cull callback to the node
//at there are no nodes to traverse below the geode, only
@ -146,7 +146,7 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
for(unsigned int i=0;i<geode.getNumDrawables();++i)
{
geode.getDrawable(i)->setAppCallback(new DrawableAppCallback());
geode.getDrawable(i)->setUpdateCallback(new DrawableUpdateCallback());
geode.getDrawable(i)->setCullCallback(new DrawableCullCallback());
geode.getDrawable(i)->setDrawCallback(new DrawableDrawCallback());
}

View File

@ -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();

View File

@ -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):

View File

@ -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 );

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -24,11 +24,11 @@
#include <osgGLUT/glut>
#include <osgGLUT/Viewer>
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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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 );

View File

@ -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));
}

View File

@ -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;

View File

@ -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();
}

View File

@ -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);
}
}
}

View File

@ -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;i<endOfRemoveRange;++i)
{
// remove this Geode from the child parent list.
_drawables[i]->removeParent(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.

View File

@ -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
);
}

View File

@ -16,7 +16,7 @@ MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp&
_inverseDirty(transform._inverseDirty),
_animationPath(dynamic_cast<AnimationPath*>(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<MatrixTransform*>(node);
if (mt &&
_animationPath.valid() &&
nv->getVisitorType()==NodeVisitor::APP_VISITOR &&
nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getReferenceTime();

View File

@ -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;
}

View File

@ -46,7 +46,7 @@ void PositionAttitudeTransform::AnimationPathCallback::operator()(Node* node, No
PositionAttitudeTransform* pat = dynamic_cast<PositionAttitudeTransform*>(node);
if (pat &&
_animationPath.valid() &&
nv->getVisitorType()==NodeVisitor::APP_VISITOR &&
nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getReferenceTime();

View File

@ -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)

View File

@ -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);

View File

@ -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 "<<timeApp<<"ms "<< std::endl;
/* osg::notify(osg::NOTICE) << "Time of App "<<timeUpdate<<"ms "<< std::endl;
osg::notify(osg::NOTICE) << "Time of Cull "<<timeCull<<"ms "<< std::endl;
osg::notify(osg::NOTICE) << "Time of Draw "<<timeDraw<<"ms "<< std::endl;
osg::notify(osg::NOTICE) << "Frame time "<<frameTime<< std::endl;
@ -568,15 +568,15 @@ void Viewer::showStats(const unsigned int /*viewport*/)
for (i=0; i<3; i++) {
glColor4fv((GLfloat * )&app_color);
glVertex2f(tstart,0.95f*vh);
glVertex2f(tstart+times[i].timeApp,0.95f*vh);
glVertex2f(tstart+times[i].timeUpdate,0.95f*vh);
glColor4fv((GLfloat * )&cull_color);
glVertex2f(tstart+times[i].timeApp,0.93f*vh);
glVertex2f(tstart+times[i].timeApp+times[i].timeCull, 0.93f*vh);
glVertex2f(tstart+times[i].timeUpdate,0.93f*vh);
glVertex2f(tstart+times[i].timeUpdate+times[i].timeCull, 0.93f*vh);
glColor4fv((GLfloat * )&draw_color);
glVertex2f(tstart+times[i].timeApp+times[i].timeCull, 0.91f*vh);
glVertex2f(tstart+times[i].timeApp+times[i].timeCull+times[i].timeDraw, 0.91f*vh);
glVertex2f(tstart+times[i].timeUpdate+times[i].timeCull, 0.91f*vh);
glVertex2f(tstart+times[i].timeUpdate+times[i].timeCull+times[i].timeDraw, 0.91f*vh);
glColor4fv((GLfloat * )&swap_color);
glVertex2f(tstart+times[i].timeApp+times[i].timeCull+times[i].timeDraw, 0.90f*vh);
glVertex2f(tstart+times[i].timeUpdate+times[i].timeCull+times[i].timeDraw, 0.90f*vh);
glVertex2f(tstart+times[i].timeFrame, 0.90f*vh);
tstart+=times[i].timeFrame;
}
@ -689,7 +689,7 @@ void Viewer::display()
_frameStamp->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.

View File

@ -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() <<std::endl;
// std::cout<<"update callback - post traverse"<< (float)_frameStamp->getReferenceTime() <<std::endl;
}
private:
};
@ -752,7 +752,7 @@ class ReaderWriterGEO : public ReaderWriter
if (!bhv.empty()) { // then check for a string content/colour.. action
bool ok=false;
geoBehaviourDrawableCB *gcb=new geoBehaviourDrawableCB;
text->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() <<std::endl;
// std::cout<<"update callback - post traverse"<< (float)_frameStamp->getReferenceTime() <<std::endl;
}
// now register with Registry to instantiate the above

View File

@ -616,7 +616,7 @@ void geoBehaviourCB::operator() (osg::Node *node, osg::NodeVisitor* nv)
traverse(node,nv);
}
void geoBehaviourDrawableCB::app(osg::NodeVisitor *,osg::Drawable *dr) {
void geoBehaviourDrawableCB::update(osg::NodeVisitor *,osg::Drawable *dr) {
Matrix mtr;
int prevvtr=-1; // previously moved vertex
Vec3 pos;

View File

@ -20,12 +20,12 @@ public:
protected:
};
class geoBehaviourDrawableCB: public osg::Drawable::AppCallback {
class geoBehaviourDrawableCB: public osg::Drawable::UpdateCallback {
public:
geoBehaviourDrawableCB() { }
~geoBehaviourDrawableCB() { }
void addBehaviour(geoBehaviour *gb) {gblist.push_back(gb);}
void app(osg::NodeVisitor *,osg::Drawable *dr);
void update(osg::NodeVisitor *,osg::Drawable *dr);
private:
std::vector<geoBehaviour *> gblist;
};

View File

@ -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!

View File

@ -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();
}

View File

@ -1,18 +0,0 @@
#include <osgUtil/AppVisitor>
using namespace osg;
using namespace osgUtil;
AppVisitor::AppVisitor():NodeVisitor(APP_VISITOR,TRAVERSE_ACTIVE_CHILDREN)
{
}
AppVisitor::~AppVisitor()
{
}
void AppVisitor::reset()
{
}

View File

@ -3,7 +3,7 @@ include $(TOPDIR)/Make/makedefs
CXXFILES = \
AppVisitor.cpp\
UpdateVisitor.cpp\
CullVisitor.cpp\
DisplayListVisitor.cpp\
DisplayRequirementsVisitor.cpp\

View File

@ -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)
{

View File

@ -1,5 +1,5 @@
#include <osgUtil/SceneView>
#include <osgUtil/AppVisitor>
#include <osgUtil/UpdateVisitor>
#include <osgUtil/DisplayListVisitor>
#include <osg/Notify>
@ -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 ="<<osg::Referenced::createdCount()-osg::Referenced::deletedCount()<<std::endl;
#endif
if (_sceneData.valid() && _appVisitor.valid())
if (_sceneData.valid() && _updateVisitor.valid())
{
_appVisitor->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

View File

@ -0,0 +1,18 @@
#include <osgUtil/UpdateVisitor>
using namespace osg;
using namespace osgUtil;
UpdateVisitor::UpdateVisitor():NodeVisitor(UPDATE_VISITOR,TRAVERSE_ACTIVE_CHILDREN)
{
}
UpdateVisitor::~UpdateVisitor()
{
}
void UpdateVisitor::reset()
{
}