Added a default StateSet to osg::View's master Camera. Wired up osgViewer::Viewer so

that the master Camera's StateSet is passed to osgUtil::SceneView to use as its global StateSet.
This commit is contained in:
Robert Osfield
2007-01-12 12:10:06 +00:00
parent 5c030413f3
commit 5c78d06dad
4 changed files with 9 additions and 13 deletions

View File

@@ -155,7 +155,8 @@ void SceneView::setDefaults(unsigned int options)
_camera->getProjectionMatrix().makePerspective(50.0f,1.4f,1.0f,10000.0f);
_camera->getViewMatrix().makeIdentity();
_globalStateSet = new osg::StateSet;
if (!_globalStateSet) _globalStateSet = new osg::StateSet;
else _globalStateSet->clear();
if ((options & HEADLIGHT) || (options & SKY_LIGHT))
{
@@ -215,17 +216,6 @@ void SceneView::setDefaults(unsigned int options)
_cullVisitor->setRenderStage(_renderStage.get());
_globalStateSet->setGlobalDefaults();
// enable depth testing by default.
_globalStateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
#if 0
// set up an alphafunc by default to speed up blending operations.
osg::AlphaFunc* alphafunc = new osg::AlphaFunc;
alphafunc->setFunction(osg::AlphaFunc::GREATER,1.0f);
_globalStateSet->setAttributeAndModes(alphafunc, osg::StateAttribute::OFF);
#endif
// set up an texture environment by default to speed up blending operations.
osg::TexEnv* texenv = new osg::TexEnv;