Various fixes to constructors to ensure that all variables are initialized.

This commit is contained in:
Robert Osfield
2002-07-20 23:54:55 +00:00
parent 0ff08a2978
commit 48b3be40e9
16 changed files with 74 additions and 41 deletions

View File

@@ -44,7 +44,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
CullVisitor();
virtual ~CullVisitor();
virtual CullVisitor* cloneType() const { return new CullVisitor(); }
virtual CullVisitor* cloneType() const { return osgNew CullVisitor(); }
virtual void reset();
@@ -318,7 +318,7 @@ inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,
}
// otherwise need to create new renderleaf.
RenderLeaf* renderleaf = new RenderLeaf(drawable,projection,matrix,depth);
RenderLeaf* renderleaf = osgNew RenderLeaf(drawable,projection,matrix,depth);
_reuseRenderLeafList.push_back(renderleaf);
++_currentReuseRenderLeafIndex;
return renderleaf;

View File

@@ -16,8 +16,8 @@ class OSGUTIL_EXPORT DepthSortedBin : public RenderBin
DepthSortedBin();
virtual osg::Object* cloneType() const { return new DepthSortedBin(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return new DepthSortedBin(); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return osgNew DepthSortedBin(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return osgNew DepthSortedBin(); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const DepthSortedBin*>(obj)!=0L; }
virtual const char* libraryName() const { return "osgUtil"; }
virtual const char* className() const { return "DepthSortedBin"; }

View File

@@ -37,8 +37,8 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
RenderBin();
virtual osg::Object* cloneType() const { return new RenderBin(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return new RenderBin(); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return osgNew RenderBin(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return osgNew RenderBin(); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderBin*>(obj)!=0L; }
virtual const char* libraryName() const { return "osgUtil"; }
virtual const char* className() const { return "RenderBin"; }
@@ -93,7 +93,7 @@ class RegisterRenderBinProxy
public:
RegisterRenderBinProxy()
{
_rb = new T;
_rb = osgNew T;
RenderBin::addRenderBinPrototype(_rb.get());
}

View File

@@ -51,21 +51,24 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
_parent(NULL),
_stateset(NULL),
_depth(0),
_averageDistance(0)
_averageDistance(0),
_userData(NULL)
{
}
RenderGraph(RenderGraph* parent,const osg::StateSet* stateset):
_parent(parent),
_stateset(stateset)
_stateset(stateset),
_depth(0),
_averageDistance(0),
_userData(NULL)
{
if (_parent) _depth = _parent->_depth + 1;
else _depth = 0;
}
~RenderGraph() {}
RenderGraph* cloneType() const { return new RenderGraph; }
RenderGraph* cloneType() const { return osgNew RenderGraph; }
void setUserData(osg::Referenced* obj) { _userData = obj; }
osg::Referenced* getUserData() { return _userData.get(); }
@@ -125,7 +128,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
// create a state group and insert it into the children list
// then return the state group.
RenderGraph* sg = new RenderGraph(this,stateset);
RenderGraph* sg = osgNew RenderGraph(this,stateset);
_children[stateset] = sg;
return sg;
}

View File

@@ -28,8 +28,8 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
RenderStage();
virtual osg::Object* cloneType() const { return new RenderStage(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return new RenderStage(); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return osgNew RenderStage(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return osgNew RenderStage(); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderStage*>(obj)!=0L; }
virtual const char* className() const { return "RenderStage"; }
@@ -96,7 +96,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
RenderStageLighting* getRenderStageLighting() const
{
if (!_renderStageLighting.valid()) _renderStageLighting = new RenderStageLighting;
if (!_renderStageLighting.valid()) _renderStageLighting = osgNew RenderStageLighting;
return _renderStageLighting.get();
}

View File

@@ -23,8 +23,8 @@ class OSGUTIL_EXPORT RenderStageLighting : public osg::Object
RenderStageLighting();
virtual osg::Object* cloneType() const { return new RenderStageLighting(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return new RenderStageLighting(); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return osgNew RenderStageLighting(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return osgNew RenderStageLighting(); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderStageLighting*>(obj)!=0L; }
virtual const char* libraryName() const { return "osgUtil"; }
virtual const char* className() const { return "RenderStageLighting"; }

View File

@@ -23,8 +23,8 @@ class OSGUTIL_EXPORT RenderToTextureStage : public RenderStage
RenderToTextureStage();
virtual osg::Object* cloneType() const { return new RenderToTextureStage(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return new RenderToTextureStage(); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return osgNew RenderToTextureStage(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return osgNew RenderToTextureStage(); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderToTextureStage*>(obj)!=0L; }
virtual const char* libraryName() const { return "osgUtil"; }
virtual const char* className() const { return "RenderToTextureStage"; }

View File

@@ -55,7 +55,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
else
{
// ensure that _viewport is always valid.
_viewport = new osg::Viewport;
_viewport = osgNew osg::Viewport;
}
}