1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
19 /** \file
20  * \ingroup freestyle
21  * \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from
22  * NodeGroup.
23  */
24 
25 #include "DrawingStyle.h"
26 #include "NodeGroup.h"
27 
28 #include "../system/FreestyleConfig.h"
29 
30 namespace Freestyle {
31 
32 class NodeDrawingStyle : public NodeGroup {
33  public:
NodeDrawingStyle()34   inline NodeDrawingStyle() : NodeGroup()
35   {
36   }
~NodeDrawingStyle()37   virtual ~NodeDrawingStyle()
38   {
39   }
40 
drawingStyle()41   inline const DrawingStyle &drawingStyle() const
42   {
43     return _DrawingStyle;
44   }
45 
setDrawingStyle(const DrawingStyle & iDrawingStyle)46   inline void setDrawingStyle(const DrawingStyle &iDrawingStyle)
47   {
48     _DrawingStyle = iDrawingStyle;
49   }
50 
51   /*! Sets the style. Must be one of FILLED, LINES, POINTS, INVISIBLE. */
setStyle(const DrawingStyle::STYLE iStyle)52   inline void setStyle(const DrawingStyle::STYLE iStyle)
53   {
54     _DrawingStyle.setStyle(iStyle);
55   }
56 
57   /*! Sets the line width in the LINES style case */
setLineWidth(const float iLineWidth)58   inline void setLineWidth(const float iLineWidth)
59   {
60     _DrawingStyle.setLineWidth(iLineWidth);
61   }
62 
63   /*! Sets the Point size in the POINTS style case */
setPointSize(const float iPointSize)64   inline void setPointSize(const float iPointSize)
65   {
66     _DrawingStyle.setPointSize(iPointSize);
67   }
68 
69   /*! Enables or disables the lighting. true = enable */
setLightingEnabled(const bool iEnableLighting)70   inline void setLightingEnabled(const bool iEnableLighting)
71   {
72     _DrawingStyle.setLightingEnabled(iEnableLighting);
73   }
74 
75   /*! Accept the corresponding visitor */
76   virtual void accept(SceneVisitor &v);
77 
78   /*! accessors */
style()79   inline DrawingStyle::STYLE style() const
80   {
81     return _DrawingStyle.style();
82   }
83 
lineWidth()84   inline float lineWidth() const
85   {
86     return _DrawingStyle.lineWidth();
87   }
88 
pointSize()89   inline float pointSize() const
90   {
91     return _DrawingStyle.pointSize();
92   }
93 
lightingEnabled()94   inline bool lightingEnabled() const
95   {
96     return _DrawingStyle.lightingEnabled();
97   }
98 
99  private:
100   DrawingStyle _DrawingStyle;
101 
102 #ifdef WITH_CXX_GUARDEDALLOC
103   MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NodeDrawingStyle")
104 #endif
105 };
106 
107 } /* namespace Freestyle */
108