openscenegraph
ShaderComposer
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
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.
7 *
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.
12*/
13
14#ifndef OSG_SHADERCOMPOSER
15#define OSG_SHADERCOMPOSER 1
16
17#include <osg/Object>
18#include <osg/StateAttribute>
19#include <osg/Program>
20
21namespace osg {
22
23// forward declare osg::State
24class State;
25
26typedef std::vector<osg::ShaderComponent*> ShaderComponents;
27
28/// deprecated
29class OSG_EXPORT ShaderComposer : public osg::Object
30{
31 public:
32
33 ShaderComposer();
34 ShaderComposer(const ShaderComposer& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
35 META_Object(osg, ShaderComposer);
36
37 virtual osg::Program* getOrCreateProgram(const ShaderComponents& shaderComponents);
38
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);
42
43 virtual void releaseGLObjects(osg::State* state) const;
44
45 protected:
46
47 virtual ~ShaderComposer();
48
49
50 typedef std::map< ShaderComponents, ref_ptr<Program> > ProgramMap;
51 ProgramMap _programMap;
52
53 typedef std::map< Shaders, ref_ptr<Shader> > ShaderMainMap;
54 ShaderMainMap _shaderMainMap;
55
56};
57
58}
59
60#endif