Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Extrusion.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef Extrusion_INCLUDE_ONCE
33 #define Extrusion_INCLUDE_ONCE
34 
35 #include <vlGraphics/Geometry.hpp>
36 #include <vlCore/Vector4.hpp>
37 #include <vlCore/Vector3.hpp>
38 #include <vlCore/Matrix4.hpp>
39 #include <vector>
40 
41 namespace vl
42 {
54  {
56 
57  public:
60  {
61  VL_DEBUG_SET_OBJECT_NAME()
62  mSmooth = false;
63  mFillBottom = true;
64  mFillTop = true;
65  mSilhouetteMode = SilhouetteClosed;
66  }
67 
69  vl::ref<vl::Geometry> extrude();
70 
72  void setSilhouette(const std::vector<vl::fvec2>& silhouette) { mSilhouette = silhouette; }
74  const std::vector<vl::fvec2>& silhouette() const { return mSilhouette; }
76  std::vector<vl::fvec2>& silhouette() { return mSilhouette; }
77 
79  void setSilhouetteMode(ESilhouetteMode mode) { mSilhouetteMode = mode; }
81  ESilhouetteMode silhouetteMode() const { return mSilhouetteMode; }
82 
84  void setSmooth(bool smooth) { mSmooth = smooth; }
86  bool smooth() const { return mSmooth; }
87 
89  void setFillBottom(bool fill) { mFillBottom = fill; }
91  bool fillBottom() const { return mFillBottom; }
92 
94  void setFillTop(bool fill) { mFillTop = fill; }
96  bool fillTop() const { return mFillTop; }
97 
100  const std::vector<vl::fvec3>& positionPath() const { return mPositionPath; }
103  std::vector<vl::fvec3>& positionPath() { return mPositionPath; }
107  const std::vector<float>& scalingPath() const { return mScalingPath; }
111  std::vector<float>& scalingPath() { return mScalingPath; }
115  const std::vector<float>& rotationPath() const { return mRotationPath; }
119  std::vector<float>& rotationPath() { return mRotationPath; }
123  const std::vector<vl::fvec4>& colorPath() const { return mColorPath; }
127  std::vector<vl::fvec4>& colorPath() { return mColorPath; }
128 
129  protected:
130  std::vector<vl::fvec2> mSilhouette;
131  std::vector<vl::fvec3> mPositionPath;
132  std::vector<float> mScalingPath;
133  std::vector<float> mRotationPath;
134  std::vector<vl::fvec4> mColorPath;
135  ESilhouetteMode mSilhouetteMode;
136  bool mSmooth;
138  bool mFillTop;
139  };
140 }
141 
142 #endif
const std::vector< vl::fvec4 > & colorPath() const
The color to be applied to the extrusion.
Definition: Extrusion.hpp:123
ESilhouetteMode silhouetteMode() const
Wether the silhouette is considered closed, i.e. a line-loop, or open.
Definition: Extrusion.hpp:81
std::vector< float > mRotationPath
Definition: Extrusion.hpp:133
void setSmooth(bool smooth)
If true the normals of the geometry are smoothed.
Definition: Extrusion.hpp:84
std::vector< vl::fvec4 > & colorPath()
The color to be applied to the extrusion.
Definition: Extrusion.hpp:127
void setSilhouetteMode(ESilhouetteMode mode)
Wether the silhouette is considered closed, i.e. a line-loop, or open.
Definition: Extrusion.hpp:79
ESilhouetteMode mSilhouetteMode
Definition: Extrusion.hpp:135
std::vector< vl::fvec2 > mSilhouette
Definition: Extrusion.hpp:130
The Extrusion class generates a Geometry extruding a silhouette along a path.
Definition: Extrusion.hpp:53
std::vector< vl::fvec4 > mColorPath
Definition: Extrusion.hpp:134
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
std::vector< float > mScalingPath
Definition: Extrusion.hpp:132
Visualization Library main namespace.
const std::vector< float > & rotationPath() const
The rotation to be applied along the extrusion.
Definition: Extrusion.hpp:115
std::vector< vl::fvec3 > & positionPath()
The path along which the silhouette is extruded.
Definition: Extrusion.hpp:103
void setFillBottom(bool fill)
Whether a set of triangles should be generated to fill the beginning of the extrusion (default is tru...
Definition: Extrusion.hpp:89
bool smooth() const
If true the normals of the geometry are smoothed.
Definition: Extrusion.hpp:86
The base class for all the reference counted objects.
Definition: Object.hpp:158
bool fillBottom() const
Whether a set of triangles should be generated to fill the beginning of the extrusion (default is tru...
Definition: Extrusion.hpp:91
std::vector< vl::fvec3 > mPositionPath
Definition: Extrusion.hpp:131
std::vector< float > & rotationPath()
The rotation to be applied along the extrusion.
Definition: Extrusion.hpp:119
std::vector< vl::fvec2 > & silhouette()
Returns the silhouette to be extruded.
Definition: Extrusion.hpp:76
void setFillTop(bool fill)
Whether a set of triangles should be generated to fill the ending of the extrusion (default is true)...
Definition: Extrusion.hpp:94
bool fillTop() const
Whether a set of triangles should be generated to fill the ending of the extrusion (default is true)...
Definition: Extrusion.hpp:96
Extrusion()
Constructor.
Definition: Extrusion.hpp:59
const std::vector< vl::fvec2 > & silhouette() const
Returns the silhouette to be extruded.
Definition: Extrusion.hpp:74
const std::vector< vl::fvec3 > & positionPath() const
The path along which the silhouette is extruded.
Definition: Extrusion.hpp:100
std::vector< float > & scalingPath()
The scaling to be applied along the extrusion.
Definition: Extrusion.hpp:111
const std::vector< float > & scalingPath() const
The scaling to be applied along the extrusion.
Definition: Extrusion.hpp:107
void setSilhouette(const std::vector< vl::fvec2 > &silhouette)
Sets the silhouette to be extruded.
Definition: Extrusion.hpp:72
ESilhouetteMode
Definition: Extrusion.hpp:43