Moved resizeGLObjects/releaseGLObjects out of Referenced to avoid multiple inheritance warnings
This commit is contained in:
parent
46b07141e8
commit
fe98c3d7f5
@ -42,6 +42,14 @@ struct OSG_EXPORT GraphicsOperation : public Operation
|
||||
virtual void operator () (Object* object);
|
||||
|
||||
virtual void operator () (GraphicsContext* context) = 0;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ class OSG_EXPORT Referenced
|
||||
|
||||
/** Remove Observer that is observing this object.*/
|
||||
void removeObserver(Observer* observer) const;
|
||||
|
||||
#if 0
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
|
||||
|
||||
@ -123,7 +123,7 @@ class OSG_EXPORT Referenced
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const {}
|
||||
|
||||
#endif
|
||||
public:
|
||||
|
||||
friend class DeleteHandler;
|
||||
|
@ -38,7 +38,7 @@ struct LessDepthSortFunctor
|
||||
|
||||
/** StateGraph - contained in a renderBin, defines the scene to be drawn.
|
||||
*/
|
||||
class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
class OSGUTIL_EXPORT StateGraph : public osg::Object
|
||||
{
|
||||
public:
|
||||
|
||||
@ -66,7 +66,6 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
bool _dynamic;
|
||||
|
||||
StateGraph():
|
||||
osg::Referenced(false),
|
||||
_parent(NULL),
|
||||
_stateset(NULL),
|
||||
_depth(0),
|
||||
@ -78,7 +77,6 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
}
|
||||
|
||||
StateGraph(StateGraph* parent,const osg::StateSet* stateset):
|
||||
osg::Referenced(false),
|
||||
_parent(parent),
|
||||
_stateset(stateset),
|
||||
_depth(0),
|
||||
@ -95,7 +93,13 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
|
||||
~StateGraph() {}
|
||||
|
||||
StateGraph* cloneType() const { return new StateGraph; }
|
||||
|
||||
virtual osg::Object* cloneType() const { return new StateGraph(); }
|
||||
virtual StateGraph* cloneStateGraph() const { return new StateGraph(); }
|
||||
virtual osg::Object* clone(const osg::CopyOp&) const { return new StateGraph(); }
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const StateGraph*>(obj)!=0L; }
|
||||
virtual const char* libraryName() const { return "osgUtil"; }
|
||||
virtual const char* className() const { return "StateGraph"; }
|
||||
|
||||
void setUserData(osg::Referenced* obj) { _userData = obj; }
|
||||
osg::Referenced* getUserData() { return _userData.get(); }
|
||||
@ -345,7 +349,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
private:
|
||||
|
||||
/// disallow copy construction.
|
||||
StateGraph(const StateGraph&):osg::Referenced() {}
|
||||
StateGraph(const StateGraph&) : osg::Object() {}
|
||||
/// disallow copy operator.
|
||||
StateGraph& operator = (const StateGraph&) { return *this; }
|
||||
|
||||
|
@ -720,11 +720,11 @@ void SceneView::cull()
|
||||
{
|
||||
|
||||
if (!_cullVisitorLeft.valid()) _cullVisitorLeft = _cullVisitor->clone();
|
||||
if (!_stateGraphLeft.valid()) _stateGraphLeft = _stateGraph->cloneType();
|
||||
if (!_stateGraphLeft.valid()) _stateGraphLeft = _stateGraph->cloneStateGraph();
|
||||
if (!_renderStageLeft.valid()) _renderStageLeft = osg::clone(_renderStage.get(), osg::CopyOp::DEEP_COPY_ALL);
|
||||
|
||||
if (!_cullVisitorRight.valid()) _cullVisitorRight = _cullVisitor->clone();
|
||||
if (!_stateGraphRight.valid()) _stateGraphRight = _stateGraph->cloneType();
|
||||
if (!_stateGraphRight.valid()) _stateGraphRight = _stateGraph->cloneStateGraph();
|
||||
if (!_renderStageRight.valid()) _renderStageRight = osg::clone(_renderStage.get(), osg::CopyOp::DEEP_COPY_ALL);
|
||||
|
||||
_cullVisitorLeft->setDatabaseRequestHandler(_cullVisitor->getDatabaseRequestHandler());
|
||||
@ -931,11 +931,15 @@ void SceneView::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
struct Resize
|
||||
{
|
||||
unsigned int maxSize = 1;
|
||||
unsigned int maxSize;
|
||||
|
||||
Resize(unsigned int ms) : maxSize(ms) {}
|
||||
|
||||
void operator() (osg::Referenced* object)
|
||||
{
|
||||
operator()(dynamic_cast<osg::Object*>(object));
|
||||
}
|
||||
void operator() (osg::Object* object)
|
||||
{
|
||||
if (object) object->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
@ -960,11 +964,19 @@ void SceneView::releaseGLObjects(osg::State* state) const
|
||||
|
||||
struct Release
|
||||
{
|
||||
void operator() (const osg::Referenced* object)
|
||||
osg::State* _state;
|
||||
|
||||
Release(State* state) : _state(state) {}
|
||||
|
||||
void operator() (osg::Referenced* object)
|
||||
{
|
||||
if (object) object->releaseGLObjects();
|
||||
operator()(dynamic_cast<osg::Object*>(object));
|
||||
}
|
||||
} operation;
|
||||
void operator() (osg::Object* object)
|
||||
{
|
||||
if (object) object->releaseGLObjects(_state);
|
||||
}
|
||||
} operation(state);
|
||||
|
||||
operation(_localStateSet.get());
|
||||
operation(_updateVisitor.get());
|
||||
|
Loading…
Reference in New Issue
Block a user