Imoroved backwards compatibility with 3.6
This commit is contained in:
parent
4fbaca7878
commit
41f7efbab6
@ -286,7 +286,7 @@ public:
|
||||
virtual bool run(osg::Object* object, osg::Object* data);
|
||||
|
||||
/** do customized update code.*/
|
||||
virtual void operator () (UniformBase*, NodeVisitor*) {}
|
||||
virtual void operator () (UniformBase* ub, NodeVisitor* nv);
|
||||
|
||||
virtual void operator () (Uniform*, NodeVisitor*) {}
|
||||
|
||||
|
@ -135,6 +135,14 @@ class OSG_EXPORT Object : public Referenced
|
||||
* Equivalent to dynamic_cast<Uniform*>(this).*/
|
||||
virtual Uniform* asUniform() { return 0; }
|
||||
|
||||
/** convert 'const this' into a const Uniform pointer if Object is a Uniform, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<const UniformBase*>(this).*/
|
||||
virtual const UniformBase* asUniformBase() const { return 0; }
|
||||
|
||||
/** Convert 'this' into a Uniform pointer if Object is a Uniform, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<UniformBase*>(this).*/
|
||||
virtual UniformBase* asUniformBase() { return 0; }
|
||||
|
||||
/** convert 'const this' into a const Uniform pointer if Object is a Uniform, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<const Uniform*>(this).*/
|
||||
virtual const Uniform* asUniform() const { return 0; }
|
||||
|
@ -627,6 +627,8 @@ class OSG_EXPORT Uniform : public UniformBase
|
||||
|
||||
virtual void apply(const GLExtensions* ext, GLint location) const;
|
||||
|
||||
typedef osg::UniformCallback Callback;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Uniform();
|
||||
|
@ -33,6 +33,9 @@ class OSG_EXPORT UniformBase : public Object
|
||||
|
||||
META_Object(osg, UniformBase);
|
||||
|
||||
virtual const UniformBase* asUniformBase() const { return this; }
|
||||
virtual UniformBase* asUniformBase() { return this; }
|
||||
|
||||
/** Set the name of the glUniform, ensuring it is only set once.*/
|
||||
virtual void setName( const std::string& name );
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <osg/ScriptEngine>
|
||||
#include <osg/RenderInfo>
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Uniform>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
@ -162,3 +163,13 @@ bool DrawableCullCallback::cull(osg::NodeVisitor* nv, osg::Drawable* drawable, o
|
||||
{
|
||||
return cull(nv, drawable, renderInfo? renderInfo->getState():0);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
void UniformCallback::operator () (UniformBase* ub, NodeVisitor* nv)
|
||||
{
|
||||
Uniform* uniform = ub->asUniform();
|
||||
if (uniform) this->operator()(uniform, nv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user