Deferred rendering is now the de-facto standard rendering technique in many modern game engines, hence I think it is important to have this technique demonstrated in an osg code example.
This particular sample adds soft shadows as well as bump mapping into the rendering pipeline. The image files whitemetal_diffuse.jpg and whitemetal_normal.jpg from OpenSceneGraph-Data images folder are required (The OSG_FILE_PATH environment variable must be set correctly)
Two additional osgt models are included with the demo (best to also put them into OpenSceneGraph-Data, I think.
The shaders are currently defined in separate .frag and .vert files.
implementations being registered at the same time.
One usage case for this functionality to support usage of Wayland and X11 in the same version of the osgViewer.
As part of the new functionality there is now a osg::GraphicsContext::Traits::windowingSystemPreferrence string
that default to empty, but if defined will ensure that a specific WindowingSystemInterface is utilized when
you do a generic call like osg::createGraphicsContext().
Also implemented is standard proxy object for registering the new contexts and removing them automatically, and
declaration of standard graphicswindow_name() C entry point to help with static build linking.
This feature makes it easier to editor an presentation that is already running in Present3D, once the edits are done
pressing 'u' in Present3D then loads the file again.
"From I think that this piece of code in StateSet::setTextureAttributeAndModes is a copy&paste mistake:
OSG_NOTICE<<"Warning: non texture attribute '"<<attribute->className()<<"' passed to setTextureAttributeAndModes(unit,attr,value), "<<std::endl;
OSG_NOTICE<<" assuming setAttributeAndModes(attr,value) instead."<<std::endl;
OSG_NOTICE<<" please change calling code to use appropriate call."<<std::endl;
setAttribute(attribute,value);
As per the warning message it should be calling setAttributeAndModes(attribute,value); ."
The file osg-OpenSceneGraph-3.4.0\include\osg\Types
typedefs int8_t, int16_t, int32_t and int64_t
These are typedefed as signed __intX in several other places.
With VS2008, this causes an error "int8_t redifined, different basic types"
Explicitly declaring them signed fixes the error."
As for motivation behind the change, I think it makes more sense that way because only the CullVisitor cares about rendering. Say an intersection visitor or update visitor only needs to traverse the subgraph once, not once for each pass. For these visitors there is no point in traversing the subgraph more than once, since it's exactly the same graph. Another motivation is the performance improvement had when an intersection visitor tests against a multipass Technique."
Note about mods by Robert Osfield, "Changed dyanmic_cast<> and check against getTraversalType() to utilize the new asCullVisitor() instead to improve efficiency."