Added s/getClearMask() support to osg::ClearNode, osgUtil::SceneView and the
.osg plugin.
This commit is contained in:
@@ -33,10 +33,11 @@ class OSG_EXPORT ClearNode : public Group
|
||||
|
||||
ClearNode();
|
||||
|
||||
ClearNode(const ClearNode& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Group(es,copyop),
|
||||
_requiresClear(es._requiresClear),
|
||||
_clearColor(es._clearColor) {}
|
||||
ClearNode(const ClearNode& cs, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Group(cs,copyop),
|
||||
_requiresClear(cs._requiresClear),
|
||||
_clearColor(cs._clearColor),
|
||||
_clearMask(cs._clearMask) {}
|
||||
|
||||
|
||||
META_Node(osg, ClearNode);
|
||||
@@ -52,13 +53,21 @@ class OSG_EXPORT ClearNode : public Group
|
||||
|
||||
/** Returns the clear color. */
|
||||
inline const Vec4& getClearColor() const { return _clearColor; }
|
||||
|
||||
/** Set the clear mask used in glClear(..).
|
||||
* Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */
|
||||
inline void setClearMask(GLbitfield mask) { _clearMask = mask; }
|
||||
|
||||
/** Get the clear mask.*/
|
||||
inline GLbitfield getClearMask() const { return _clearMask; }
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~ClearNode() {}
|
||||
|
||||
bool _requiresClear;
|
||||
Vec4 _clearColor;
|
||||
bool _requiresClear;
|
||||
Vec4 _clearColor;
|
||||
GLbitfield _clearMask;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ using namespace osg;
|
||||
*/
|
||||
ClearNode::ClearNode():
|
||||
_requiresClear(true),
|
||||
_clearColor(0.0f,0.0f,0.0f,1.0f)
|
||||
_clearColor(0.0f,0.0f,0.0f,1.0f),
|
||||
_clearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
||||
{
|
||||
setCullingActive(false);
|
||||
StateSet* stateset = new StateSet;
|
||||
|
||||
@@ -67,6 +67,18 @@ bool ClearNode_readLocalData(Object& obj, Input& fr)
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("clearMask"))
|
||||
{
|
||||
if (fr[1].isUInt())
|
||||
{
|
||||
unsigned int value=0;
|
||||
fr[1].getUInt(value);
|
||||
es.setClearMask(static_cast<GLbitfield>(value));
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
@@ -86,6 +98,7 @@ bool ClearNode_writeLocalData(const Object& obj, Output& fw)
|
||||
}
|
||||
|
||||
fw.indent() << "clearColor "<<es.getClearColor()<< std::endl;
|
||||
fw.indent() << "clearMask "<<static_cast<unsigned int>(es.getClearMask())<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -615,10 +615,7 @@ void SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod
|
||||
if (clearNode->getRequiresClear())
|
||||
{
|
||||
renderStage->setClearColor(clearNode->getClearColor());
|
||||
renderStage->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
// really should set clear mask here, but what to? Need
|
||||
// to consider the stencil and accumulation buffers..
|
||||
// will defer to later. Robert Osfield. October 2001.
|
||||
renderStage->setClearMask(clearNode->getClearMask());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user