Hi Ralf,

On 12 March 2018 at 17:13, Robert Osfield <robert.osfi...@gmail.com> wrote:
> At this point I don't think it makes sense to add more complexity to
> ShaderGen as it'll just make it harder to rewrite to use #pragma(tic)
> shader composition.  The right approach is to convert it to #psc and
> then add additional features.  I don't know how much work this might
> be but I'll do a code review of ShaderGen in OSG master now and see
> how easy it would be to adapt it.

I have now checked in a rewrite of ShaderGen to use #pragma(tic)
shader composition:

   
https://github.com/openscenegraph/OpenSceneGraph/commit/4447190dd6cb926341547c001bcaecedffb3bf81

There was functionality in the original implementation that was only
partially implemented so I couldn't see how it could function so I've
removed it.  The old code didn't have any proper lighting code so I
need to write this, and the handling of fog isn't implemented
correctly either, I've left this in place but might remove this.

I have checked in shadergen.vert and shadergen.frag to
OpenSceneGraph-Data/shaders:

    
https://github.com/openscenegraph/OpenSceneGraph-Data/blob/master/shaders/shadergen.vert
    
https://github.com/openscenegraph/OpenSceneGraph-Data/blob/master/shaders/shadergen.frag

Unfortunately as osgUtil isn't able to use osgDB::readShaderFile()
itself, due the hierarchy of OSG libs, so these shaders are converted
to .cpp's and can be found in src/osgUtil/shaders.  These .cpp's are
updated by using osg2cpp --shader
OpenSceneGraph-Data/shaders/shadergen.vert.

It probably would be useful to have a set uber shader setting in
osgUtil::ShaderGen to help workaround the above constraint.

For integration of new features such as support additional
functionality from plugins like obj that aren't natively supported by
fixed function GL I would suggest levering the StateSet::setDefine()
to enable/disable controls, then have the uber shader have this in
them.  This way you needn't deeply couple ShaderGen to the various
plugins, instead just the uber shaders and plugins need to be
coordinated.

For the proposed change to ShaderGen/OBJ plugin, I'm now officially
declaring them a dead-end, so if you want this functionality you'll
need to refactor to use the suggested approach above.

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

Reply via email to