Graphite  Version 3
An experimental 3D geometry processing program
shader_manager.h
Go to the documentation of this file.
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_OGF_SCENE_GRAPH_GFX_SHADERS_SHADER_MANAGER_H
38 #define H_OGF_SCENE_GRAPH_GFX_SHADERS_SHADER_MANAGER_H
39 
40 #include <OGF/scene_graph_gfx/common/common.h>
42 #include <OGF/gom/types/node.h>
43 
44 #include <map>
45 
51 namespace OGF {
52 
53  class SceneGraphShaderManager;
54 
58  gom_class SCENE_GRAPH_GFX_API ShaderManager : public Object {
59  public:
65  ShaderManager(Grob* grob, SceneGraphShaderManager* sg_shader_manager);
66 
70  ~ShaderManager() override;
71 
72  gom_slots:
77  Shader* current_shader() {
78  return current_shader_;
79  }
80 
85  Grob* grob() {
86  return grob_;
87  }
88 
92  void draw();
93 
100  void update();
101 
107  return sg_shader_manager_;
108  }
109 
110  gom_properties:
116  void set_shader(const std::string& value);
117 
123  std::string get_shader() const;
124 
129  gom_attribute(aggregate_properties,"true")
130  Shader* get_shader_object() const {
131  return current_shader_;
132  }
133 
134  private:
135  Grob* grob_;
136  SceneGraphShaderManager* sg_shader_manager_;
137  Shader* current_shader_;
141  typedef std::map<std::string, Shader_var> ShaderMap;
142  ShaderMap shaders_;
143  };
144 
149 }
150 
151 #endif
A smart pointer with reference-counted copy semantics.
Definition: smart_pointer.h:76
Base class for all 3D Graphite objects.
Definition: grob.h:68
Base class for all objects in the GOM system.
Definition: object.h:65
Manages the shaders and full screen effects for the entire SceneGraph.
Manages the Shader objects associated with a Grob.
std::string get_shader() const
Gets the class name of the current shader.
ShaderManager(Grob *grob, SceneGraphShaderManager *sg_shader_manager)
ShaderManager constructor.
void draw()
Draws the Grob using the current Shader.
~ShaderManager() override
ShaderManager destructor.
Grob * grob()
Gets the Grob.
void update()
Updates the current shader.
SceneGraphShaderManager * scene_graph_shader_manager() const
Gets the SceneGraphShaderManager.
Base class for Grob shader.
Definition: shader.h:64
Global Graphite namespace.
Definition: common.h:76
SmartPointer< ShaderManager > ShaderManager_var
An automatic reference-counted pointer to a ShaderManager.
The base class for all composite objects in the GOM system.
The base class for all object shaders.