Removed deprecated drawImplementation(State&) method from Drawable and Drawable::DrawCallback

This commit is contained in:
Robert Osfield 2007-03-28 11:30:38 +00:00
parent 7fb38ff42f
commit 7fc714ada1
31 changed files with 83 additions and 86 deletions

View File

@ -39,10 +39,10 @@ class CullCallback : public osg::NodeCallback
class DrawableDrawCallback : public osg::Drawable::DrawCallback
{
virtual void drawImplementation(osg::State& state,const osg::Drawable* drawable) const
virtual void drawImplementation(osg::RenderInfo& renderInfo,const osg::Drawable* drawable) const
{
std::cout<<"draw call back - pre drawImplementation"<<drawable<<std::endl;
drawable->drawImplementation(state);
drawable->drawImplementation(renderInfo);
std::cout<<"draw call back - post drawImplementation"<<drawable<<std::endl;
}
};

View File

@ -41,7 +41,7 @@ public:
void loadFont(const std::string& font);
void loadLayout(const std::string& layout);
void drawImplementation(osg::State& state) const;
void drawImplementation(osg::RenderInfo& renderInfo) const;
protected:
@ -185,8 +185,10 @@ void CEGUIDrawable::loadLayout(const std::string& layout)
}
void CEGUIDrawable::drawImplementation(osg::State& state) const
void CEGUIDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
{
osg::State& state = renderInfo.getState();
if (state.getContextID()!=_activeContextID) return;
glPushAttrib(GL_ALL_ATTRIB_BITS);

View File

@ -25,8 +25,9 @@ struct DrawCallback : public osg::Drawable::DrawCallback
DrawCallback():
_firstTime(true) {}
virtual void drawImplementation(osg::State& state,const osg::Drawable* drawable) const
virtual void drawImplementation(osg::RenderInfo& renderInfo,const osg::Drawable* drawable) const
{
osg::State& state = *renderInfo.getState();
if (!_firstTime)
{
@ -50,7 +51,7 @@ struct DrawCallback : public osg::Drawable::DrawCallback
_firstTime = false;
drawable->drawImplementation(state);
drawable->drawImplementation(renderInfo);
}
mutable bool _firstTime;

View File

@ -215,7 +215,7 @@ class Teapot : public osg::Drawable
// the draw immediate mode method is where the OSG wraps up the drawing of
// of OpenGL primitives.
virtual void drawImplementation(osg::State&) const
virtual void drawImplementation(osg::RenderInfo&) const
{
// teapot(..) doens't use vertex arrays at all so we don't need to toggle their state
// if we did we'd need to something like following call

View File

@ -57,7 +57,7 @@ class OSG_EXPORT DrawPixels : public Drawable
void setSubImageDimensions(unsigned int offsetX,unsigned int offsetY,unsigned int width,unsigned int height);
void getSubImageDimensions(unsigned int& offsetX,unsigned int& offsetY,unsigned int& width,unsigned int& height) const;
virtual void drawImplementation(State& state) const;
virtual void drawImplementation(RenderInfo& state) const;
virtual BoundingBox computeBound() const;

View File

@ -404,11 +404,8 @@ class OSG_EXPORT Drawable : public Object
META_Object(osg,DrawCallback);
/** Deprecated.*/
virtual void drawImplementation(osg::State&,const osg::Drawable*) const {}
/** do customized draw code.*/
virtual void drawImplementation(osg::RenderInfo& renderInfo,const osg::Drawable* drawable) const { drawImplementation(*renderInfo.getState(), drawable); }
virtual void drawImplementation(osg::RenderInfo& /*renderInfo*/,const osg::Drawable* /*drawable*/) const {}
};
/** Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.*/
@ -420,15 +417,12 @@ class OSG_EXPORT Drawable : public Object
/** Get the const DrawCallback.*/
const DrawCallback* getDrawCallback() const { return _drawCallback.get(); }
/** Deprecated. */
virtual void drawImplementation(State&) const {}
/** drawImplementation(State&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that
/** drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that
* must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable.
* drawImplementation(State&) is called from the draw(State&) method, with the draw method handling management of OpenGL display lists,
* and drawImplementation(State&) handling the actuall drawing itself.
* drawImplementation(RenderInfo&) is called from the draw(RenderInfo&) method, with the draw method handling management of OpenGL display lists,
* and drawImplementation(RenderInfo&) handling the actuall drawing itself.
* @param state The osg::State object that encapulates the current OpenGL state for the current graphics context. */
virtual void drawImplementation(RenderInfo& renderInfo) const { drawImplementation(*renderInfo.getState()); }
virtual void drawImplementation(RenderInfo& renderInfo) const = 0;
/** Return a OpenGL display list handle a newly generated or reused from display list cache. */

View File

@ -336,7 +336,7 @@ class OSG_EXPORT Geometry : public Drawable
* This is the internal draw method which does the drawing itself,
* and is the method to override when deriving from Geometry for user-drawn objects.
*/
virtual void drawImplementation(State& state) const;
virtual void drawImplementation(RenderInfo& renderInfo) const;
/** Return true, osg::Geometry does support accept(Drawable::AttributeFunctor&). */
virtual bool supports(const Drawable::AttributeFunctor&) const { return true; }

View File

@ -160,7 +160,7 @@ class OSG_EXPORT ShapeDrawable : public Drawable
* drawing itself, and is the method to override when deriving from
* ShapeDrawable for user-drawn objects.
*/
virtual void drawImplementation(State& state) const;
virtual void drawImplementation(RenderInfo& renderInfo) const;
/* Not all virtual overloads of these methods are overridden in this class, so
bring the base class implementation in to avoid hiding the non-used ones. */

View File

@ -39,7 +39,7 @@ namespace osgParticle
virtual void reuseParticle(int i);
/// Draw the connected particles as either a line or a quad strip, depending upon viewing distance. .
virtual void drawImplementation(osg::State& state) const;
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
///Get the (const) particle from where the line or quadstrip starts to be drawn
const osgParticle::Particle* getStartParticle() const

View File

@ -162,7 +162,7 @@ namespace osgParticle
/// Update the particles. Don't call this directly, use a <CODE>ParticleSystemUpdater</CODE> instead.
virtual void update(double dt);
virtual void drawImplementation(osg::State& state) const;
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
virtual osg::BoundingBox computeBound() const;

View File

@ -126,7 +126,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable
int t() const { return _t; }
/** Draw ImpostorSprite directly. */
virtual void drawImplementation(osg::State& state) const;
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
/** Return true, osg::ImpostorSprite does support accept(Drawable::AttributeFunctor&). */
virtual bool supports(const Drawable::AttributeFunctor&) const { return true; }

View File

@ -88,7 +88,7 @@ BoundingBox DrawPixels::computeBound() const
return bbox;
}
void DrawPixels::drawImplementation(State&) const
void DrawPixels::drawImplementation(RenderInfo&) const
{
glRasterPos3f(_position.x(),_position.y(),_position.z());

View File

@ -876,14 +876,16 @@ unsigned int Geometry::getGLObjectSizeHint() const
return totalSize;
}
void Geometry::drawImplementation(State& state) const
void Geometry::drawImplementation(RenderInfo& renderInfo) const
{
State& state = *renderInfo.getState();
// osg::notify(osg::NOTICE)<<"Geometry::drawImplementation"<<std::endl;
if (_internalOptimizedGeometry.valid())
{
_internalOptimizedGeometry->drawImplementation(state);
_internalOptimizedGeometry->drawImplementation(renderInfo);
return;
}

View File

@ -1785,8 +1785,10 @@ void ShapeDrawable::setTessellationHints(TessellationHints* hints)
}
}
void ShapeDrawable::drawImplementation(State& state) const
void ShapeDrawable::drawImplementation(RenderInfo& renderInfo) const
{
osg::State& state = *renderInfo.getState();
if (_shape.valid())
{
glColor4fv(_color.ptr());

View File

@ -112,8 +112,10 @@ void ConnectedParticleSystem::reuseParticle(int particleIndex)
}
void ConnectedParticleSystem::drawImplementation(osg::State& state) const
void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) const
{
osg::State& state = *renderInfo.getState();
OpenThreads::ScopedReadLock lock(_readWriteMutex);
const Particle* particle = (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0;

View File

@ -89,8 +89,10 @@ void osgParticle::ParticleSystem::update(double dt)
dirtyBound();
}
void osgParticle::ParticleSystem::drawImplementation(osg::State& state) const
void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) const
{
osg::State& state = *renderInfo.getState();
OpenThreads::ScopedReadLock lock(_readWriteMutex);
// update the frame count, so other objects can detect when

View File

@ -84,9 +84,9 @@ class Logos: public osg::Drawable
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Logos*>(obj)!=NULL; }
virtual const char* className() const { return "Logos"; }
virtual void drawImplementation(osg::State &state ) const
virtual void drawImplementation(osg::RenderInfo& renderInfo) const
{
if( state.getContextID() != _contextID )
if( renderInfo.getContextID() != _contextID )
return;

View File

@ -79,7 +79,7 @@ float ImpostorSprite::calcPixelError(const osg::Matrix& MVPW) const
return sqrtf(max_error_sqrd);
}
void ImpostorSprite::drawImplementation(osg::State&) const
void ImpostorSprite::drawImplementation(osg::RenderInfo&) const
{
// when the tex env is set to REPLACE, and the
// texture is set up correctly the color has no effect.

View File

@ -82,8 +82,9 @@ void LightPointDrawable::reset()
}
void LightPointDrawable::drawImplementation(osg::State& state) const
void LightPointDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
{
osg::State& state = *renderInfo.getState();
state.applyMode(GL_POINT_SMOOTH,true);
state.applyMode(GL_BLEND,true);

View File

@ -80,7 +80,7 @@ class OSGSIM_EXPORT LightPointDrawable : public osg::Drawable
}
/** draw LightPoints. */
virtual void drawImplementation(osg::State& state) const;
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
void setSimulationTime(double time)

View File

@ -28,12 +28,13 @@ LightPointSpriteDrawable::LightPointSpriteDrawable(const LightPointSpriteDrawabl
{
}
void LightPointSpriteDrawable::drawImplementation(osg::State& state) const
void LightPointSpriteDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
{
osg::State& state = *renderInfo.getState();
if (!state.getModeValidity(GL_POINT_SPRITE_ARB))
{
LightPointDrawable::drawImplementation(state);
LightPointDrawable::drawImplementation(renderInfo);
return;
}

View File

@ -39,7 +39,7 @@ class OSGSIM_EXPORT LightPointSpriteDrawable : public osgSim::LightPointDrawable
/** draw LightPoints. */
virtual void drawImplementation(osg::State& state) const;
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
protected:

View File

@ -53,7 +53,7 @@ public:
META_Object(osgSim,Surface)
void drawImplementation(osg::State& state) const;
void drawImplementation(osg::RenderInfo& renderInfo) const;
virtual osg::BoundingBox computeBound() const;
@ -64,9 +64,9 @@ private:
SphereSegment* _ss;
};
void SphereSegment::Surface::drawImplementation(osg::State& state) const
void SphereSegment::Surface::drawImplementation(osg::RenderInfo& renderInfo) const
{
_ss->Surface_drawImplementation(state);
_ss->Surface_drawImplementation(*renderInfo.getState());
}
osg:: BoundingBox SphereSegment::Surface::computeBound() const
@ -101,7 +101,7 @@ public:
META_Object(osgSim,EdgeLine)
void drawImplementation(osg::State& state) const;
void drawImplementation(osg::RenderInfo& renderInfo) const;
protected:
@ -121,9 +121,9 @@ private:
SphereSegment* _ss;
};
void SphereSegment::EdgeLine::drawImplementation(osg::State& state) const
void SphereSegment::EdgeLine::drawImplementation(osg::RenderInfo& renderInfo) const
{
_ss->EdgeLine_drawImplementation(state);
_ss->EdgeLine_drawImplementation(*renderInfo.getState());
}
osg::BoundingBox SphereSegment::EdgeLine::computeBound() const
@ -159,7 +159,7 @@ public:
META_Object(osgSim,Side)
void drawImplementation(osg::State& state) const;
void drawImplementation(osg::RenderInfo& renderInfo) const;
protected:
@ -172,9 +172,9 @@ private:
};
void SphereSegment::Side::drawImplementation(osg::State& state) const
void SphereSegment::Side::drawImplementation(osg::RenderInfo& renderInfo) const
{
_ss->Side_drawImplementation(state, _planeOrientation, _BoundaryAngle);
_ss->Side_drawImplementation(*renderInfo.getState(), _planeOrientation, _BoundaryAngle);
}
osg::BoundingBox SphereSegment::Side::computeBound() const
@ -210,7 +210,7 @@ public:
META_Object(osgSim,Spoke)
void drawImplementation(osg::State& state) const;
void drawImplementation(osg::RenderInfo& renderInfo) const;
protected:
@ -229,9 +229,9 @@ private:
SphereSegment::BoundaryAngle _azAngle, _elevAngle;
};
void SphereSegment::Spoke::drawImplementation(osg::State& state) const
void SphereSegment::Spoke::drawImplementation(osg::RenderInfo& renderInfo) const
{
_ss->Spoke_drawImplementation(state, _azAngle, _elevAngle);
_ss->Spoke_drawImplementation(*renderInfo.getState(), _azAngle, _elevAngle);
}
osg::BoundingBox SphereSegment::Spoke::computeBound() const

View File

@ -15,7 +15,7 @@
#include <osg/DrawPixels>
#include <osg/Image>
#include <osg/Object>
#include <osg/State>
#include <osg/RenderInfo>
#include <osg/Vec3>
// Must undefine IN and OUT macros defined in Windows headers
@ -110,11 +110,11 @@ BEGIN_OBJECT_REFLECTOR(osg::DrawPixels)
__void__getSubImageDimensions__unsigned_int_R1__unsigned_int_R1__unsigned_int_R1__unsigned_int_R1,
"",
"");
I_Method1(void, drawImplementation, IN, osg::State &, state,
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, state,
Properties::VIRTUAL,
__void__drawImplementation__State_R1,
"Deprecated. ",
"");
__void__drawImplementation__RenderInfo_R1,
"drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. ",
" param state The osg::State object that encapulates the current OpenGL state for the current graphics context. ");
I_Method0(osg::BoundingBox, computeBound,
Properties::VIRTUAL,
__BoundingBox__computeBound,

View File

@ -338,15 +338,10 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Drawable)
__C5_DrawCallback_P1__getDrawCallback,
"Get the const DrawCallback. ",
"");
I_Method1(void, drawImplementation, IN, osg::State &, x,
Properties::VIRTUAL,
__void__drawImplementation__State_R1,
"Deprecated. ",
"");
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo,
Properties::VIRTUAL,
Properties::PURE_VIRTUAL,
__void__drawImplementation__RenderInfo_R1,
"drawImplementation(State&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. ",
"drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. ",
" param state The osg::State object that encapulates the current OpenGL state for the current graphics context. ");
I_Method1(bool, supports, IN, const osg::Drawable::AttributeFunctor &, x,
Properties::VIRTUAL,
@ -767,12 +762,7 @@ BEGIN_OBJECT_REFLECTOR(osg::Drawable::DrawCallback)
__C5_char_P1__className,
"return the name of the object's class type. ",
"Must be defined by derived classes. ");
I_Method2(void, drawImplementation, IN, osg::State &, x, IN, const osg::Drawable *, x,
Properties::VIRTUAL,
__void__drawImplementation__osg_State_R1__C5_osg_Drawable_P1,
"Deprecated. ",
"");
I_Method2(void, drawImplementation, IN, osg::RenderInfo &, renderInfo, IN, const osg::Drawable *, drawable,
I_Method2(void, drawImplementation, IN, osg::RenderInfo &, x, IN, const osg::Drawable *, x,
Properties::VIRTUAL,
__void__drawImplementation__osg_RenderInfo_R1__C5_osg_Drawable_P1,
"do customized draw code. ",

View File

@ -16,7 +16,7 @@
#include <osg/Geometry>
#include <osg/Object>
#include <osg/PrimitiveSet>
#include <osg/State>
#include <osg/RenderInfo>
// Must undefine IN and OUT macros defined in Windows headers
#ifdef IN
@ -617,9 +617,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry)
__unsigned_int__getGLObjectSizeHint,
"Return the estimated size of GLObjects (display lists/vertex buffer objects) that are associated with this drawable. ",
"This size is used a hint for reuse of deleteed display lists/vertex buffer objects. ");
I_Method1(void, drawImplementation, IN, osg::State &, state,
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo,
Properties::VIRTUAL,
__void__drawImplementation__State_R1,
__void__drawImplementation__RenderInfo_R1,
"Draw Geometry directly ignoring an OpenGL display list which could be attached. ",
"This is the internal draw method which does the drawing itself, and is the method to override when deriving from Geometry for user-drawn objects.");
I_Method1(bool, supports, IN, const osg::Drawable::AttributeFunctor &, x,

View File

@ -15,9 +15,9 @@
#include <osg/Drawable>
#include <osg/Object>
#include <osg/PrimitiveSet>
#include <osg/RenderInfo>
#include <osg/Shape>
#include <osg/ShapeDrawable>
#include <osg/State>
#include <osg/Vec4>
// Must undefine IN and OUT macros defined in Windows headers
@ -91,9 +91,9 @@ BEGIN_OBJECT_REFLECTOR(osg::ShapeDrawable)
__C5_TessellationHints_P1__getTessellationHints,
"",
"");
I_Method1(void, drawImplementation, IN, osg::State &, state,
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo,
Properties::VIRTUAL,
__void__drawImplementation__State_R1,
__void__drawImplementation__RenderInfo_R1,
"Draw ShapeDrawable directly ignoring an OpenGL display list which could be attached. ",
"This is the internal draw method which does the drawing itself, and is the method to override when deriving from ShapeDrawable for user-drawn objects.");
I_Method1(bool, supports, IN, const osg::Drawable::AttributeFunctor &, x,

View File

@ -12,7 +12,7 @@
#include <osg/CopyOp>
#include <osg/Object>
#include <osg/State>
#include <osg/RenderInfo>
#include <osgParticle/ConnectedParticleSystem>
#include <osgParticle/Particle>
@ -68,9 +68,9 @@ BEGIN_OBJECT_REFLECTOR(osgParticle::ConnectedParticleSystem)
__void__reuseParticle__int,
"Reuse the i-th particle. ",
"");
I_Method1(void, drawImplementation, IN, osg::State &, state,
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo,
Properties::VIRTUAL,
__void__drawImplementation__osg_State_R1,
__void__drawImplementation__osg_RenderInfo_R1,
"Draw the connected particles as either a line or a quad strip, depending upon viewing distance. . ",
"");
I_Method0(const osgParticle::Particle *, getStartParticle,

View File

@ -13,7 +13,7 @@
#include <osg/BoundingBox>
#include <osg/CopyOp>
#include <osg/Object>
#include <osg/State>
#include <osg/RenderInfo>
#include <osg/Vec3>
#include <osgParticle/Particle>
#include <osgParticle/ParticleSystem>
@ -220,11 +220,11 @@ BEGIN_OBJECT_REFLECTOR(osgParticle::ParticleSystem)
__void__update__double,
"Update the particles. Don't call this directly, use a ParticleSystemUpdater instead. ",
"");
I_Method1(void, drawImplementation, IN, osg::State &, state,
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo,
Properties::VIRTUAL,
__void__drawImplementation__osg_State_R1,
"Deprecated. ",
"");
__void__drawImplementation__osg_RenderInfo_R1,
"drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. ",
" param state The osg::State object that encapulates the current OpenGL state for the current graphics context. ");
I_Method0(osg::BoundingBox, computeBound,
Properties::VIRTUAL,
__osg_BoundingBox__computeBound,

View File

@ -402,7 +402,7 @@ BEGIN_OBJECT_REFLECTOR(osgParticle::PrecipitationEffect::PrecipitationDrawable)
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo,
Properties::VIRTUAL,
__void__drawImplementation__osg_RenderInfo_R1,
"drawImplementation(State&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. ",
"drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. ",
" param state The osg::State object that encapulates the current OpenGL state for the current graphics context. ");
I_Method0(osgParticle::PrecipitationEffect::PrecipitationDrawable::CellMatrixMap &, getCurrentCellMatrixMap,
Properties::NON_VIRTUAL,

View File

@ -17,7 +17,7 @@
#include <osg/Matrix>
#include <osg/Object>
#include <osg/PrimitiveSet>
#include <osg/State>
#include <osg/RenderInfo>
#include <osg/StateSet>
#include <osg/Texture2D>
#include <osg/Vec2>
@ -158,9 +158,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::ImpostorSprite)
__int__t,
"",
"");
I_Method1(void, drawImplementation, IN, osg::State &, state,
I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo,
Properties::VIRTUAL,
__void__drawImplementation__osg_State_R1,
__void__drawImplementation__osg_RenderInfo_R1,
"Draw ImpostorSprite directly. ",
"");
I_Method1(bool, supports, IN, const osg::Drawable::AttributeFunctor &, x,