Graphite  Version 3
An experimental 3D geometry processing program
scene_graph_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 
38 #ifndef H_OGF_SCENE_GRAPH_GFX_SHADERS_SCENE_GRAPH_SHDR_MGR_H
39 #define H_OGF_SCENE_GRAPH_GFX_SHADERS_SCENE_GRAPH_SHDR_MGR_H
40 
41 #include <OGF/scene_graph_gfx/common/common.h>
44 #include <map>
45 
51 namespace OGF {
52 
53  class Grob;
54  class Shader;
55  class ShaderManager;
56  class SceneGraph;
57 
62  gom_class SCENE_GRAPH_GFX_API SceneGraphShaderManager : public Object {
63  public:
64 
69 
74 
84  Grob* grob, std::string& classname,
85  ArgList& args, bool pointers = true
86  );
87 
95  Grob* grob, const std::string& classname, const ArgList& args
96  );
97 
98 
104 
105  gom_slots:
113  void update_focus();
114 
120  void current_object(const std::string& value);
121 
127  void shader(const std::string& value);
128 
134  void draw();
135 
136 
141  void pick_object();
142 
150  void apply_to_scene_graph(bool visible_only = false);
151 
157 
163 
168  void full_screen_effect(const std::string& value);
169 
170 
177 
178  gom_signals:
184  void focus_changed(const mat4& value);
185 
186  gom_properties:
187 
195  void set_auto_focus(bool value) {
196  auto_focus_ = value;
197  update_focus();
198  }
199 
200 
208  bool get_auto_focus() const {
209  return auto_focus_;
210  }
211 
219  void set_highlight_selected(bool value);
220 
228  bool get_highlight_selected() const {
229  return highlight_selected_;
230  }
231 
237  void set_draw_selected_only(bool value);
238 
244  bool get_draw_selected_only() const {
245  return draw_selected_only_;
246  }
247 
252  void set_effect(const FullScreenEffectName& effect);
253 
259 
267  const mat4& get_focus_matrix() const {
268  return focus_;
269  }
270 
271 
272  private:
273  SceneGraph* scene_graph_;
274 
275  Grob* current_object_;
276 
277  bool auto_focus_;
278  mat4 focus_;
279 
280  bool highlight_selected_;
281  bool draw_selected_only_;
282 
283  std::string last_shader_;
284 
285  typedef std::map<std::string, FullScreenEffect_var> EffectsMap;
286  EffectsMap effects_;
287 
288  FullScreenEffect* effect_;
289  FullScreenEffectName user_effect_name_;
290  };
291 }
292 
293 #endif
Represents a list of name-value pairs.
Definition: arg_list.h:65
A Full screen effect.
Base class for all 3D Graphite objects.
Definition: grob.h:68
Abstract base class for the GOM interpreter.
Definition: interpreter.h:222
Base class for all objects in the GOM system.
Definition: object.h:65
Manages the shaders and full screen effects for the entire SceneGraph.
void current_object(const std::string &value)
Notify this SceneGraphShaderManager that the current object changed.
bool get_highlight_selected() const
Tests whether highlighting mode is active.
void set_draw_selected_only(bool value)
Sets whether only the selected object should be drawn.
bool get_draw_selected_only() const
Tests whether only the selected object should be drawn.
void full_screen_effect(const std::string &value)
Sets the FullScreenEffect.
SceneGraphShaderManager()
SceneGraphShaderManager constructor.
void set_effect(const FullScreenEffectName &effect)
Sets the full screen effect.
void draw()
Draws the SceneGraph using the shaders associated with each object and the FullScreenEffect if one wa...
void set_highlight_selected(bool value)
Sets highlighting mode.
~SceneGraphShaderManager() override
SceneGraphShaderManager destructor.
const FullScreenEffectName & get_effect() const
Gets the full screen effect.
ShaderManager * resolve_shader_manager(Grob *grob)
Finds the ShaderManager associated with a given Grob.
void get_grob_shader(Grob *grob, std::string &classname, ArgList &args, bool pointers=true)
Gets the Shader associated with a Grob and its properties.
void apply_to_scene_graph(bool visible_only=false)
Copies the properties of the current Shader to all other Shaders in the SceneGraph associated with ob...
Shader * current()
Gets the shader of the current object.
void set_grob_shader(Grob *grob, const std::string &classname, const ArgList &args)
Sets the Shader associated with a Grob and its properties.
void shader(const std::string &value)
Change the shader associated with the current object.
FullScreenEffect * current_effect()
Gets the current FullScreenEffect.
bool get_auto_focus() const
Tests whether autofocus is active.
const mat4 & get_focus_matrix() const
Gets the focus matrix.
void pick_object()
Draws the SceneGraph using the picking shader, that will encode the id of each object in the backbuff...
Interpreter * interpreter()
Gets the main Interpreter.
Represents the list of objects loaded in Graphite.
Definition: scene_graph.h:62
Manages the Shader objects associated with a Grob.
Base class for Grob shader.
Definition: shader.h:64
Global Graphite namespace.
Definition: common.h:76
Base classes for full screen effects.