OpenWalnut  1.5.0dev
WMIsosurfaceRaytracer.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WMISOSURFACERAYTRACER_H
26 #define WMISOSURFACERAYTRACER_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Node>
32 #include <osg/Uniform>
33 
34 #include "core/graphicsEngine/shaders/WGEShader.h"
35 #include "core/kernel/WModule.h"
36 #include "core/kernel/WModuleInputData.h"
37 #include "core/kernel/WModuleOutputData.h"
38 
39 class WDataSetVector;
40 class WDataSetScalar;
41 
42 /**
43  * This module builds the base for fast raytracing of isosurfacesin OpenWalnut. It uses shader based raytracing.
44  *
45  * \ingroup modules
46  */
48 {
49 public:
50  /**
51  * Default constructor.
52  */
54 
55  /**
56  * Destructor.
57  */
58  virtual ~WMIsosurfaceRaytracer();
59 
60  /**
61  * Gives back the name of this module.
62  * \return the module's name.
63  */
64  virtual const std::string getName() const;
65 
66  /**
67  * Gives back a description of this module.
68  * \return description to module.
69  */
70  virtual const std::string getDescription() const;
71 
72  /**
73  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
74  * should never be initialized or modified in some other way. A simple new instance is required.
75  *
76  * \return the prototype used to create every module in OpenWalnut.
77  */
78  virtual std::shared_ptr< WModule > factory() const;
79 
80  /**
81  * Get the icon for this module in XPM format.
82  * \return The icon.
83  */
84  virtual const char** getXPMIcon() const;
85 
86 protected:
87  /**
88  * Entry point after loading the module. Runs in separate thread.
89  */
90  virtual void moduleMain();
91 
92  /**
93  * Initialize the connectors this module is using.
94  */
95  virtual void connectors();
96 
97  /**
98  * Initialize the properties for this module.
99  */
100  virtual void properties();
101 
102  /**
103  * Initialize requirements for this module.
104  */
105  virtual void requirements();
106 
107 private:
108  /**
109  * An input connector used to get datasets from other modules. The connection management between connectors must not be handled by the module.
110  */
111  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input;
112 
113  /**
114  * The gradient field input
115  */
116  std::shared_ptr< WModuleInputData< WDataSetVector > > m_gradients;
117 
118  /**
119  * The Isovalue used in the case m_isoSurface is true.
120  */
121  WPropDouble m_isoValue;
122 
123  /**
124  * The color used when in isosurface mode for blending.
125  */
126  WPropColor m_isoColor;
127 
128  /**
129  * The number of steps to walk along the ray.
130  */
131  WPropInt m_stepCount;
132 
133  /**
134  * The numeric precision used for iso-checking.
135  */
136  WPropDouble m_epsilon;
137 
138  /**
139  * The alpha transparency used for the rendering
140  */
141  WPropDouble m_alpha;
142 
143  /**
144  * The ratio between colormap and normal surface color.
145  */
146  WPropDouble m_colormapRatio;
147 
148  /**
149  * Some special coloring mode for disabling specular hightlights.
150  */
151  WPropBool m_phongNoSpec;
152 
153  /**
154  * If true, per-pixel-phong shading is applied to the surface.
155  */
156  WPropBool m_phongShading;
157 
158  /**
159  * If true, the ray-tracer uses stochastic jitter to improve image quality.
160  */
162 
163  /**
164  * If true, a certain border area can be clipped. Very useful for non-peeled noisy data.
165  */
166  WPropBool m_borderClip;
167 
168  /**
169  * The distance used for clipping.
170  */
171  WPropDouble m_borderClipDistance;
172 
173  /**
174  * A condition used to notify about changes in several properties.
175  */
176  std::shared_ptr< WCondition > m_propCondition;
177 
178  /**
179  * the DVR shader.
180  */
181  osg::ref_ptr< WGEShader > m_shader;
182 };
183 
184 #endif // WMISOSURFACERAYTRACER_H
185 
This data set type contains scalars as values.
This data set type contains vectors as values.
This module builds the base for fast raytracing of isosurfacesin OpenWalnut.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input
An input connector used to get datasets from other modules.
osg::ref_ptr< WGEShader > m_shader
the DVR shader.
virtual void properties()
Initialize the properties for this module.
virtual ~WMIsosurfaceRaytracer()
Destructor.
WPropDouble m_epsilon
The numeric precision used for iso-checking.
virtual void requirements()
Initialize requirements for this module.
WPropDouble m_isoValue
The Isovalue used in the case m_isoSurface is true.
virtual const std::string getName() const
Gives back the name of this module.
WPropBool m_phongNoSpec
Some special coloring mode for disabling specular hightlights.
virtual const std::string getDescription() const
Gives back a description of this module.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
WPropColor m_isoColor
The color used when in isosurface mode for blending.
WPropBool m_stochasticJitter
If true, the ray-tracer uses stochastic jitter to improve image quality.
WPropDouble m_alpha
The alpha transparency used for the rendering.
WPropDouble m_borderClipDistance
The distance used for clipping.
std::shared_ptr< WModuleInputData< WDataSetVector > > m_gradients
The gradient field input.
WMIsosurfaceRaytracer()
Default constructor.
WPropBool m_phongShading
If true, per-pixel-phong shading is applied to the surface.
WPropInt m_stepCount
The number of steps to walk along the ray.
virtual void connectors()
Initialize the connectors this module is using.
WPropBool m_borderClip
If true, a certain border area can be clipped.
WPropDouble m_colormapRatio
The ratio between colormap and normal surface color.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
virtual void moduleMain()
Entry point after loading the module.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72