Hi All,

I've started doing a preliminary implementation the  of the design I
discussed in previous emails.  I've introduced ShaderComponent and now
StateAttribute "has a" optional ShaderComponent.  I've also fleshed
out a bit more of ShaderComposer with some very simple wiring in
osg::State to invoke this.  I've also checked in the beginnings of a
osgshadercomposition example which will be the initial test bed for
the functionality as it develops.

Whilst fleshing out the ShaderComposer API I created the ShaderMain
and ShaderAssembly classes that I previously proposed but quickly
found that I was creating container class that weren't really needed -
a simple std::map was more than enough to the do the job they were
meant to fulfill.  At least that's my current impression from creating
the required Program and main Shader caches in ShaderComposer.  With
putting together the ShaderComposer and implementing the required
caches I was able to distill down the shader composition step to just
one method:

        typedef std::vector< const osg::Shader* >  Shaders;
        virtual osg::Shader* composeMain(const Shaders& shaders);

This single method will take a list of Shaders of the same
Shader::Type (VERTEX, GEOMETRY or FRAGMENT) that have been sourced
from the active ShaderComponents, and then create a main shader by
assembling all the code injection details held on each of the shaders.
 It could be that one of the Shaders themselves is a main in which
case the composeMain() should just return a null as there isn't any
need to create a main for it.

I haven't started adding the required code injection API into
osg::Shader yet, or implemented the full ShaderComponent and mode
tracking that will be needed in osg::State so I'm still a couple of
working days away from having basic shader composition working.
However, progress is encouraging, the implementation of the required
classes/methods is hanging together quite naturally so far.

Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to