OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ShaderComposer.h
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 
21 namespace osg {
22 
23 // forward declare osg::State
24 class State;
25 
26 typedef std::vector<osg::ShaderComponent*> ShaderComponents;
27 
29 {
30  public:
31 
35 
36  virtual osg::Program* getOrCreateProgram(const ShaderComponents& shaderComponents);
37 
38  typedef std::vector< const osg::Shader* > Shaders;
39  virtual osg::Shader* composeMain(const Shaders& shaders);
40  virtual void addShaderToProgram(Program* program, const Shaders& shaders);
41 
42  void releaseGLObjects(osg::State* state);
43 
44  protected:
45 
46  virtual ~ShaderComposer();
47 
48 
49  typedef std::map< ShaderComponents, ref_ptr<Program> > ProgramMap;
50  ProgramMap _programMap;
51 
52  typedef std::map< Shaders, ref_ptr<Shader> > ShaderMainMap;
53  ShaderMainMap _shaderMainMap;
54 
55 };
56 
57 }
58 
59 #endif
#define OSG_EXPORT
Definition: Export.h:43
std::map< ShaderComponents, ref_ptr< Program > > ProgramMap
#define META_Object(library, name)
Definition: Object.h:42
std::map< Shaders, ref_ptr< Shader > > ShaderMainMap
Definition: AlphaFunc.h:19
std::vector< osg::ShaderComponent * > ShaderComponents