OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gfx_object_base.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GFX_OBJ_BASE_HH
20 #define OST_GFX_OBJ_BASE_HH
21 
22 /*
23  Author: Ansgar Philippsen
24 */
25 
26 #include <ost/geom/geom.hh>
27 #include <ost/mol/entity_handle.hh>
28 #include <ost/mol/entity_view.hh>
29 #if OST_IMG_ENABLED
30 # include <ost/img/map.hh>
31 #endif
32 
33 #include <ost/config.hh>
34 #include "module_config.hh"
35 
36 #include "gfx_node.hh"
37 #include "color.hh"
38 #include "render_mode.hh"
39 #include "gradient.hh"
40 #include "material.hh"
41 #include "color_ops/color_op.hh"
42 
43 namespace ost { namespace gfx {
44 
45 class Scene; // fw decl
46 
48 /*
49  this abstract base class is for both the actual GfxObj as well as a
50  shortly implemented re-design of the GfxNode, and hence temporary in
51  its current form
52 */
54 {
55  public:
56  GfxObjBase(const String& name): GfxNode(name) {}
57 
59  virtual void SetMatAmb(const Color& c) = 0;
61  virtual void SetMatDiff(const Color& c) = 0;
63  virtual void SetMatSpec(const Color& c) = 0;
65  virtual void SetMatShin(float s) = 0;
67  virtual void SetMatEmm(const Color& c) = 0;
68 
70  virtual void ContextSwitch() = 0;
71 
73  virtual void SetRenderMode(RenderMode::Type m) = 0;
75  virtual RenderMode::Type GetRenderMode() const = 0;
76 
78  virtual geom::Vec3 GetCenter() const = 0;
79 
81  virtual void SetLineWidth(float w) = 0;
82 
84  virtual void SetPolyMode(unsigned int m) = 0;
85 
87  virtual void SetAALines(bool f) = 0;
88 
90  virtual void SetLineHalo(float f) = 0;
91 
93  virtual void SetOutline(bool f) = 0;
95  virtual bool GetOutline() const = 0;
97  virtual void SetOutlineMode(int m) = 0;
99  virtual int GetOutlineMode() const = 0;
102  virtual void SetOutlineWidth(float f) = 0;
104  virtual float GetOutlineWidth() const = 0;
107  virtual void SetOutlineExpandFactor(float f) = 0;
109  virtual float GetOutlineExpandFactor() const = 0;
111  virtual void SetOutlineExpandColor(const Color& c) = 0;
113  virtual Color GetOutlineExpandColor() const = 0;
114 
116  virtual void SetOpacity(float f) = 0;
118  virtual float GetOpacity() const = 0;
119 
122  virtual void ColorBy(const mol::EntityView& ev,
123  const String& prop,
124  const Gradient& g, float minv, float maxv) = 0;
125 
126 #if OST_IMG_ENABLED
127 
128  virtual void ColorBy(const img::MapHandle& mh,
129  const String& prop,
130  const Gradient& g,float minv, float maxv) = 0;
131 #endif
132 
133 
134 
135 };
136 
137 }} // ns
138 
139 #endif