1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSG_SHADERCOMPOSER
15#define OSG_SHADERCOMPOSER 1
18#include <osg/StateAttribute>
23// forward declare osg::State
26typedef std::vector<osg::ShaderComponent*> ShaderComponents;
29class OSG_EXPORT ShaderComposer : public osg::Object
34 ShaderComposer(const ShaderComposer& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
35 META_Object(osg, ShaderComposer);
37 virtual osg::Program* getOrCreateProgram(const ShaderComponents& shaderComponents);
39 typedef std::vector< const osg::Shader* > Shaders;
40 virtual osg::Shader* composeMain(const Shaders& shaders);
41 virtual void addShaderToProgram(Program* program, const Shaders& shaders);
43 virtual void releaseGLObjects(osg::State* state) const;
47 virtual ~ShaderComposer();
50 typedef std::map< ShaderComponents, ref_ptr<Program> > ProgramMap;
51 ProgramMap _programMap;
53 typedef std::map< Shaders, ref_ptr<Shader> > ShaderMainMap;
54 ShaderMainMap _shaderMainMap;