Fixes for multipipe support.

Addition of FrameStatsHandler to osgproducer demo to add frame stats.
This commit is contained in:
Robert Osfield
2003-01-29 17:16:26 +00:00
parent cf1ff34d38
commit 6c4f2f5207
13 changed files with 222 additions and 61 deletions

View File

@@ -106,11 +106,15 @@ class DeleteHandler
inline void Referenced::unref() const
{
--_refCount;
if (_refCount<=0)
if (_refCount==0)
{
if (getDeleteHandler()) getDeleteHandler()->requestDelete(this);
else delete this;
}
else if (_refCount<0)
{
throw 2325;
}
}
}

View File

@@ -682,7 +682,7 @@ class SG_EXPORT State : public Referenced
typedef std::map<StateAttribute::Type,AttributeStack> AttributeMap;
typedef std::vector<AttributeMap> TextureAttributeMapList;
typedef std::vector<ref_ptr<const StateSet> > StateSetStack;
typedef std::vector<const StateSet*> StateSetStack;
typedef std::vector<ref_ptr<const Matrix> > MatrixStack;
ModeMap _modeMap;

View File

@@ -45,7 +45,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
typedef std::vector< osg::ref_ptr<RenderLeaf> > LeafList;
RenderGraph* _parent;
osg::ref_ptr<const osg::StateSet> _stateset;
const osg::StateSet* _stateset;
int _depth;
ChildList _children;
@@ -197,7 +197,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
++itr)
{
RenderGraph* rg = (*itr);
if (rg->_stateset.valid()) state.pushStateSet(rg->_stateset.get());
if (rg->_stateset) state.pushStateSet(rg->_stateset);
}
return;
}
@@ -209,9 +209,9 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
{
// state has changed so need to pop old state.
if (sg_curr->_stateset.valid()) state.popStateSet();
if (sg_curr->_stateset) state.popStateSet();
// and push new state.
if (sg_new->_stateset.valid()) state.pushStateSet(sg_new->_stateset.get());
if (sg_new->_stateset) state.pushStateSet(sg_new->_stateset);
return;
}
@@ -219,7 +219,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
// need to pop back up to the same depth as the new state group.
while (sg_curr->_depth>sg_new->_depth)
{
if (sg_curr->_stateset.valid()) state.popStateSet();
if (sg_curr->_stateset) state.popStateSet();
sg_curr = sg_curr->_parent;
}
@@ -240,7 +240,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
// nodes have the same parent
while (sg_curr != sg_new)
{
if (sg_curr->_stateset.valid()) state.popStateSet();
if (sg_curr->_stateset) state.popStateSet();
sg_curr = sg_curr->_parent;
return_path.push_back(sg_new);
@@ -252,7 +252,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
++itr)
{
RenderGraph* rg = (*itr);
if (rg->_stateset.valid()) state.pushStateSet(rg->_stateset.get());
if (rg->_stateset) state.pushStateSet(rg->_stateset);
}
}
@@ -262,7 +262,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
// need to pop back all statesets and matrices.
while (sg_curr)
{
if (sg_curr->_stateset.valid()) state.popStateSet();
if (sg_curr->_stateset) state.popStateSet();
sg_curr = sg_curr->_parent;
}

View File

@@ -103,9 +103,13 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
/** Get the background color.*/
const osg::Vec4& getBackgroundColor() const { return _backgroundColor; }
void setGlobalStateSet(osg::StateSet* state) { _globalState = state; }
osg::StateSet* getGlobalStateSet() { return _globalState.get(); }
const osg::StateSet* getGlobalStateSet() const { return _globalState.get(); }
void setGlobalStateSet(osg::StateSet* state) { _globalStateSet = state; }
osg::StateSet* getGlobalStateSet() { return _globalStateSet.get(); }
const osg::StateSet* getGlobalStateSet() const { return _globalStateSet.get(); }
void setLocalStateSet(osg::StateSet* state) { _localStateSet = state; }
osg::StateSet* getLocalStateSet() { return _localStateSet.get(); }
const osg::StateSet* getLocalStateSet() const { return _localStateSet.get(); }
enum LightingMode {
HEADLIGHT, // default
@@ -299,7 +303,8 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
void clearArea(int x,int y,int width,int height,const osg::Vec4& color);
osg::ref_ptr<osg::Node> _sceneData;
osg::ref_ptr<osg::StateSet> _globalState;
osg::ref_ptr<osg::StateSet> _globalStateSet;
osg::ref_ptr<osg::StateSet> _localStateSet;
osg::ref_ptr<osg::Light> _light;
osg::ref_ptr<osg::Camera> _camera;
osg::ref_ptr<osg::RefMatrix> _projectionMatrix;