ShaderComposer 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #ifndef OSG_SHADERCOMPOSER
  14. #define OSG_SHADERCOMPOSER 1
  15. #include <osg/Object>
  16. #include <osg/StateAttribute>
  17. #include <osg/Program>
  18. namespace osg {
  19. // forward declare osg::State
  20. class State;
  21. typedef std::vector<osg::ShaderComponent*> ShaderComponents;
  22. /// deprecated
  23. class OSG_EXPORT ShaderComposer : public osg::Object
  24. {
  25. public:
  26. ShaderComposer();
  27. ShaderComposer(const ShaderComposer& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
  28. META_Object(osg, ShaderComposer);
  29. virtual osg::Program* getOrCreateProgram(const ShaderComponents& shaderComponents);
  30. typedef std::vector< const osg::Shader* > Shaders;
  31. virtual osg::Shader* composeMain(const Shaders& shaders);
  32. virtual void addShaderToProgram(Program* program, const Shaders& shaders);
  33. virtual void releaseGLObjects(osg::State* state) const;
  34. protected:
  35. virtual ~ShaderComposer();
  36. typedef std::map< ShaderComponents, ref_ptr<Program> > ProgramMap;
  37. ProgramMap _programMap;
  38. typedef std::map< Shaders, ref_ptr<Shader> > ShaderMainMap;
  39. ShaderMainMap _shaderMainMap;
  40. };
  41. }
  42. #endif