OpenWalnut  1.5.0dev
WMPointRenderer.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 WMPOINTRENDERER_H
26 #define WMPOINTRENDERER_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include "core/common/math/linearAlgebra/WVectorFixed.h"
32 #include "core/kernel/WModule.h"
33 #include "core/kernel/WModuleInputData.h"
34 #include "core/kernel/WModuleOutputData.h"
35 
36 class WDataSetPoints;
37 class WGEShader;
39 
40 /**
41  * This module renders the points in a point dataset.
42  *
43  * \ingroup modules
44  */
45 class WMPointRenderer: public WModule
46 {
47 public:
48  /**
49  * Constructor. Creates the module skeleton.
50  */
52 
53  /**
54  * Destructor.
55  */
56  virtual ~WMPointRenderer();
57 
58  /**
59  * Gives back the name of this module.
60  * \return the module's name.
61  */
62  virtual const std::string getName() const;
63 
64  /**
65  * Gives back a description of this module.
66  * \return description to module.
67  */
68  virtual const std::string getDescription() const;
69 
70  /**
71  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
72  * should never be initialized or modified in some other way. A simple new instance is required.
73  *
74  * \return the prototype used to create every module in OpenWalnut.
75  */
76  virtual std::shared_ptr< WModule > factory() const;
77 
78  /**
79  * Get the icon for this module in XPM format.
80  * \return The icon.
81  */
82  virtual const char** getXPMIcon() const;
83 
84 protected:
85  /**
86  * Entry point after loading the module. Runs in separate thread.
87  */
88  virtual void moduleMain();
89 
90  /**
91  * Initialize the connectors this module is using.
92  */
93  virtual void connectors();
94 
95  /**
96  * Initialize the properties for this module.
97  */
98  virtual void properties();
99 
100 private:
101  WPropInt m_nbVertices; //!< Info-property showing the number of vertices in the data set.
102 
103  /**
104  * A condition used to notify about changes in several properties.
105  */
106  std::shared_ptr< WCondition > m_propCondition;
107 
108  /**
109  * An input connector used to get points from other modules.
110  */
111  std::shared_ptr< WModuleInputData< WDataSetPoints > > m_pointInput;
112 
113  /**
114  * The shader for the points
115  */
116  osg::ref_ptr< WGEShader > m_shader;
117 
118  /**
119  * The size of a point on screen.
120  */
121  WPropDouble m_size;
122 
123  /**
124  * Slower but correct depth calculation.
125  */
126  WPropBool m_useCorrectDepth;
127 
128  /**
129  * Invisible bool property that decides whether attribute or uniform is used.
130  */
131  WPropBool m_useAttribute;
132 };
133 
134 #endif // WMPOINTRENDERER_H
Dataset to store a bunch of points without order or topology.
This class adds some convenience methods to WGEGroupNode.
Class encapsulating the OSG Program class for a more convenient way of adding and modifying shader.
Definition: WGEShader.h:48
This module renders the points in a point dataset.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual const std::string getName() const
Gives back the name of this module.
WPropInt m_nbVertices
Info-property showing the number of vertices in the data set.
WPropBool m_useCorrectDepth
Slower but correct depth calculation.
virtual void connectors()
Initialize the connectors this module is using.
virtual const std::string getDescription() const
Gives back a description of this module.
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.
WMPointRenderer()
Constructor.
std::shared_ptr< WModuleInputData< WDataSetPoints > > m_pointInput
An input connector used to get points from other modules.
osg::ref_ptr< WGEShader > m_shader
The shader for the points.
WPropBool m_useAttribute
Invisible bool property that decides whether attribute or uniform is used.
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...
WPropDouble m_size
The size of a point on screen.
virtual void properties()
Initialize the properties for this module.
virtual ~WMPointRenderer()
Destructor.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72