Added support for automatic creation of global StateAttributes to osg::State,

these global attributes are created by cloning any attributes which are
applied during rendering, the clone in a shallow copy, which will set up
default valus for that attribute.  This should prevent attribute bleed
from one stateset to the next when the global StateSet doesn't contain
an attribute used within the scene graph.
This commit is contained in:
Robert Osfield
2001-10-15 14:07:54 +00:00
parent f27c006e28
commit 59077fed15
4 changed files with 67 additions and 27 deletions

View File

@@ -82,6 +82,14 @@ void StateSet::setGlobalDefaults()
setRendingBinToInherit();
setAttributeAndModes(new AlphaFunc,StateAttribute::OFF);
setAttributeAndModes(new Transparency,StateAttribute::OFF);
Material *material = new Material;
material->setColorMode(Material::AMBIENT_AND_DIFFUSE);
setAttributeAndModes(material,StateAttribute::ON);
/*
setMode(GL_LIGHTING,StateAttribute::OFF);
setMode(GL_FOG,StateAttribute::OFF);
setMode(GL_POINT_SMOOTH,StateAttribute::OFF);
@@ -103,8 +111,8 @@ void StateSet::setGlobalDefaults()
setAttributeAndModes(new PolygonMode,StateAttribute::OFF);
setAttributeAndModes(new Transparency,StateAttribute::OFF);
setAttributeAndModes(new Depth,StateAttribute::ON);
*/
}