Renamed DrawableUpdate/Event/Cull callbacks to use new include/osg/Callback versions
This commit is contained in:
parent
e8fd414661
commit
55a8f4abbc
@ -26,7 +26,7 @@
|
|||||||
const std::string IMAGE_PATH = "osgWidget/";
|
const std::string IMAGE_PATH = "osgWidget/";
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Sampler: public osg::Drawable::UpdateCallback
|
struct Sampler: public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
T _motion;
|
T _motion;
|
||||||
Sampler() {
|
Sampler() {
|
||||||
|
@ -65,7 +65,7 @@ class DrawableDrawCallback : public osg::Drawable::DrawCallback
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback
|
struct DrawableUpdateCallback : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
virtual void update(osg::NodeVisitor*, osg::Drawable* drawable)
|
virtual void update(osg::NodeVisitor*, osg::Drawable* drawable)
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DrawableCullCallback : public osg::Drawable::CullCallback
|
struct DrawableCullCallback : public osg::DrawableCullCallback
|
||||||
{
|
{
|
||||||
/** do customized cull code.*/
|
/** do customized cull code.*/
|
||||||
virtual bool cull(osg::NodeVisitor*, osg::Drawable* drawable, osg::State* /*state*/) const
|
virtual bool cull(osg::NodeVisitor*, osg::Drawable* drawable, osg::State* /*state*/) const
|
||||||
@ -158,7 +158,7 @@ class CameraEventCallback : public osg::NodeCallback
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct TestDrawableUpdateCallback : public osg::Drawable::UpdateCallback
|
struct TestDrawableUpdateCallback : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
TestDrawableUpdateCallback(const std::string &message): _message(message) {}
|
TestDrawableUpdateCallback(const std::string &message): _message(message) {}
|
||||||
|
|
||||||
|
@ -1143,7 +1143,7 @@ osg::Geometry* buildGPUCullGeometry( const std::vector<DynamicInstance>& instanc
|
|||||||
// instance wandering ( object goes to random destination point and when it reaches
|
// instance wandering ( object goes to random destination point and when it reaches
|
||||||
// destination, it picks another random point and so on ).
|
// destination, it picks another random point and so on ).
|
||||||
// Object parts are animated ( wheels and propellers )
|
// Object parts are animated ( wheels and propellers )
|
||||||
struct AnimateObjectsCallback : public osg::Drawable::UpdateCallback
|
struct AnimateObjectsCallback : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
AnimateObjectsCallback( osg::BufferTemplate< std::vector<DynamicInstance> >* instances, osg::Image* instancesImage, const osg::BoundingBox& bbox, unsigned int quantityPerType )
|
AnimateObjectsCallback( osg::BufferTemplate< std::vector<DynamicInstance> >* instances, osg::Image* instancesImage, const osg::BoundingBox& bbox, unsigned int quantityPerType )
|
||||||
: _instances(instances), _instancesImage(instancesImage), _bbox(bbox), _quantityPerType(quantityPerType), _lastTime(0.0)
|
: _instances(instances), _instancesImage(instancesImage), _bbox(bbox), _quantityPerType(quantityPerType), _lastTime(0.0)
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class ImageStreamStateCallback : public osg::Drawable::UpdateCallback {
|
class ImageStreamStateCallback : public osg::DrawableUpdateCallback {
|
||||||
public:
|
public:
|
||||||
ImageStreamStateCallback(osgText::Text* text, osg::ImageStream* is)
|
ImageStreamStateCallback(osgText::Text* text, osg::ImageStream* is)
|
||||||
: osg::Drawable::UpdateCallback()
|
: osg::DrawableUpdateCallback()
|
||||||
, _text(text)
|
, _text(text)
|
||||||
, _imageStream(is)
|
, _imageStream(is)
|
||||||
, _fps(0)
|
, _fps(0)
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
// call back which creates a deformation field to oscillate the model.
|
// call back which creates a deformation field to oscillate the model.
|
||||||
class MyGeometryCallback :
|
class MyGeometryCallback :
|
||||||
public osg::Drawable::UpdateCallback,
|
public osg::DrawableUpdateCallback,
|
||||||
public osg::Drawable::AttributeFunctor
|
public osg::Drawable::AttributeFunctor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -22,7 +22,7 @@ namespace osg {
|
|||||||
/** Implements cluster culling to cull back facing drawables. Derived from
|
/** Implements cluster culling to cull back facing drawables. Derived from
|
||||||
* Drawable::CullCallback.
|
* Drawable::CullCallback.
|
||||||
*/
|
*/
|
||||||
class OSG_EXPORT ClusterCullingCallback : public Drawable::CullCallback, public NodeCallback
|
class OSG_EXPORT ClusterCullingCallback : public DrawableCullCallback, public NodeCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ namespace osgAnimation
|
|||||||
bool link(osgAnimation::Channel* channel);
|
bool link(osgAnimation::Channel* channel);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UpdateMorphGeometry : public osg::Drawable::UpdateCallback
|
struct UpdateMorphGeometry : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
UpdateMorphGeometry() {}
|
UpdateMorphGeometry() {}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace osgAnimation
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct UpdateRigGeometry : public osg::Drawable::UpdateCallback
|
struct UpdateRigGeometry : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
UpdateRigGeometry() {}
|
UpdateRigGeometry() {}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace osgGA{
|
|||||||
EventHandler is base class for adding handling of events, either as node event callback, drawable event callback or an event handler attached directly to the view(er)
|
EventHandler is base class for adding handling of events, either as node event callback, drawable event callback or an event handler attached directly to the view(er)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OSGGA_EXPORT EventHandler : public osg::NodeCallback, public osg::Drawable::EventCallback
|
class OSGGA_EXPORT EventHandler : public osg::NodeCallback, public osg::DrawableEventCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
osg::Object(eh, copyop),
|
osg::Object(eh, copyop),
|
||||||
osg::Callback(eh, copyop),
|
osg::Callback(eh, copyop),
|
||||||
osg::NodeCallback(eh, copyop),
|
osg::NodeCallback(eh, copyop),
|
||||||
osg::Drawable::EventCallback(eh, copyop) {}
|
osg::DrawableEventCallback(eh, copyop) {}
|
||||||
|
|
||||||
META_Object(osgGA, EventHandler);
|
META_Object(osgGA, EventHandler);
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ class OSGVIEWER_EXPORT ScreenCaptureHandler : public osgGA::GUIEventHandler
|
|||||||
/** InteractiveImage is an event handler that computes the mouse coordinates in an images coordinate frame
|
/** InteractiveImage is an event handler that computes the mouse coordinates in an images coordinate frame
|
||||||
* and then passes keyboard and mouse events to it. This event handler is useful for vnc or browser
|
* and then passes keyboard and mouse events to it. This event handler is useful for vnc or browser
|
||||||
* surfaces in the 3D scene.*/
|
* surfaces in the 3D scene.*/
|
||||||
class OSGVIEWER_EXPORT InteractiveImageHandler : public osgGA::GUIEventHandler, public osg::Drawable::CullCallback
|
class OSGVIEWER_EXPORT InteractiveImageHandler : public osgGA::GUIEventHandler, public osg::DrawableCullCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ protected:
|
|||||||
InteractiveImageHandler() {}
|
InteractiveImageHandler() {}
|
||||||
|
|
||||||
InteractiveImageHandler(const InteractiveImageHandler&,const osg::CopyOp& = osg::CopyOp::SHALLOW_COPY):
|
InteractiveImageHandler(const InteractiveImageHandler&,const osg::CopyOp& = osg::CopyOp::SHALLOW_COPY):
|
||||||
osg::Object(), osg::Callback(), osgGA::GUIEventHandler(), osg::Drawable::CullCallback(), _fullscreen(false) {}
|
osg::Object(), osg::Callback(), osgGA::GUIEventHandler(), osg::DrawableCullCallback(), _fullscreen(false) {}
|
||||||
|
|
||||||
bool mousePosition(osgViewer::View* view, osg::NodeVisitor* nv, const osgGA::GUIEventAdapter& ea, int& x, int &y) const;
|
bool mousePosition(osgViewer::View* view, osg::NodeVisitor* nv, const osgGA::GUIEventAdapter& ea, int& x, int &y) const;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ ClusterCullingCallback::ClusterCullingCallback():
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClusterCullingCallback::ClusterCullingCallback(const ClusterCullingCallback& ccc,const CopyOp& copyop):
|
ClusterCullingCallback::ClusterCullingCallback(const ClusterCullingCallback& ccc,const CopyOp& copyop):
|
||||||
Drawable::CullCallback(ccc,copyop),
|
DrawableCullCallback(ccc,copyop),
|
||||||
_controlPoint(ccc._controlPoint),
|
_controlPoint(ccc._controlPoint),
|
||||||
_normal(ccc._normal),
|
_normal(ccc._normal),
|
||||||
_radius(ccc._radius),
|
_radius(ccc._radius),
|
||||||
|
@ -106,7 +106,7 @@ struct StatsGraph : public osg::MatrixTransform
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Geode> _statsGraphGeode;
|
osg::ref_ptr<osg::Geode> _statsGraphGeode;
|
||||||
|
|
||||||
struct NeverCull : public osg::Drawable::CullCallback
|
struct NeverCull : public osg::DrawableCullCallback
|
||||||
{
|
{
|
||||||
NeverCull() {}
|
NeverCull() {}
|
||||||
bool cull(osg::NodeVisitor* /*nv*/, osg::Drawable* /*drawable*/, osg::RenderInfo* /*renderInfo*/) const { return false;}
|
bool cull(osg::NodeVisitor* /*nv*/, osg::Drawable* /*drawable*/, osg::RenderInfo* /*renderInfo*/) const { return false;}
|
||||||
@ -137,7 +137,7 @@ struct StatsGraph : public osg::MatrixTransform
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct GraphUpdateCallback : public osg::Drawable::UpdateCallback
|
struct GraphUpdateCallback : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
|
|
||||||
const unsigned int _width;
|
const unsigned int _width;
|
||||||
|
@ -566,7 +566,7 @@ void CompositeDragger::setIntersectionMask(osg::Node::NodeMask intersectionMask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ForceCullCallback : public osg::Drawable::CullCallback
|
class ForceCullCallback : public osg::DrawableCullCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const
|
virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const
|
||||||
|
@ -33,7 +33,7 @@ class Logos: public osg::Drawable
|
|||||||
last_position
|
last_position
|
||||||
};
|
};
|
||||||
|
|
||||||
struct logosCullCallback : public osg::Drawable::CullCallback
|
struct logosCullCallback : public osg::DrawableCullCallback
|
||||||
{
|
{
|
||||||
virtual bool cull(osg::NodeVisitor *visitor, osg::Drawable* drawable, osg::State*) const
|
virtual bool cull(osg::NodeVisitor *visitor, osg::Drawable* drawable, osg::State*) const
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ GlobalFadeText* getGlobalFadeText()
|
|||||||
return s_globalFadeText.get();
|
return s_globalFadeText.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FadeText::FadeTextUpdateCallback : public osg::Drawable::UpdateCallback
|
struct FadeText::FadeTextUpdateCallback : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
FadeTextData _ftd;
|
FadeTextData _ftd;
|
||||||
|
|
||||||
|
@ -985,7 +985,7 @@ void CullVisitor::apply(osg::Drawable& drawable)
|
|||||||
|
|
||||||
if( drawable.getCullCallback() )
|
if( drawable.getCullCallback() )
|
||||||
{
|
{
|
||||||
osg::Drawable::CullCallback* dcb = dynamic_cast<osg::Drawable::CullCallback*>(drawable.getCullCallback());
|
osg::DrawableCullCallback* dcb = drawable.getCullCallback()->asDrawableCullCallback();
|
||||||
if (dcb)
|
if (dcb)
|
||||||
{
|
{
|
||||||
if( dcb->cull( this, &drawable, &_renderInfo ) == true ) return;
|
if( dcb->cull( this, &drawable, &_renderInfo ) == true ) return;
|
||||||
@ -1076,7 +1076,7 @@ void CullVisitor::apply(Billboard& node)
|
|||||||
|
|
||||||
if( drawable->getCullCallback() )
|
if( drawable->getCullCallback() )
|
||||||
{
|
{
|
||||||
osg::Drawable::CullCallback* dcb = dynamic_cast<osg::Drawable::CullCallback*>(drawable->getCullCallback());
|
osg::DrawableCullCallback* dcb = drawable->getCullCallback()->asDrawableCullCallback();
|
||||||
if (dcb && dcb->cull( this, drawable, &_renderInfo ) == true )
|
if (dcb && dcb->cull( this, drawable, &_renderInfo ) == true )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ void Keystone::compute3DPositions(osg::DisplaySettings* ds, osg::Vec3& tl, osg::
|
|||||||
//
|
//
|
||||||
// Keystone helper functions
|
// Keystone helper functions
|
||||||
//
|
//
|
||||||
struct KeystoneCullCallback : public osg::Drawable::CullCallback
|
struct KeystoneCullCallback : public osg::DrawableCullCallback
|
||||||
{
|
{
|
||||||
KeystoneCullCallback(Keystone* keystone=0):_keystone(keystone) {}
|
KeystoneCullCallback(Keystone* keystone=0):_keystone(keystone) {}
|
||||||
KeystoneCullCallback(const KeystoneCullCallback&, const osg::CopyOp&) {}
|
KeystoneCullCallback(const KeystoneCullCallback&, const osg::CopyOp&) {}
|
||||||
@ -108,7 +108,7 @@ struct KeystoneCullCallback : public osg::Drawable::CullCallback
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct KeystoneUpdateCallback : public osg::Drawable::UpdateCallback
|
struct KeystoneUpdateCallback : public osg::DrawableUpdateCallback
|
||||||
{
|
{
|
||||||
KeystoneUpdateCallback(Keystone* keystone=0):_keystone(keystone) {}
|
KeystoneUpdateCallback(Keystone* keystone=0):_keystone(keystone) {}
|
||||||
KeystoneUpdateCallback(const KeystoneUpdateCallback&, const osg::CopyOp&) {}
|
KeystoneUpdateCallback(const KeystoneUpdateCallback&, const osg::CopyOp&) {}
|
||||||
|
@ -41,14 +41,21 @@ bool Drawable_readLocalData(Object& obj, Input& fr)
|
|||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawable::UpdateCallback* uc = fr.readObjectOfType<Drawable::UpdateCallback>();
|
DrawableUpdateCallback* uc = fr.readObjectOfType<DrawableUpdateCallback>();
|
||||||
if (uc)
|
if (uc)
|
||||||
{
|
{
|
||||||
drawable.setUpdateCallback(uc);
|
drawable.setUpdateCallback(uc);
|
||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawable::CullCallback* cc = fr.readObjectOfType<Drawable::CullCallback>();
|
DrawableEventCallback* ec = fr.readObjectOfType<DrawableEventCallback>();
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
drawable.setEventCallback(ec);
|
||||||
|
iteratorAdvanced = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawableCullCallback* cc = fr.readObjectOfType<DrawableCullCallback>();
|
||||||
if (cc)
|
if (cc)
|
||||||
{
|
{
|
||||||
drawable.setCullCallback(cc);
|
drawable.setCullCallback(cc);
|
||||||
|
Loading…
Reference in New Issue
Block a user