MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
linegroup.h
1 // © Copyright 2010 - 2014 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _linegroup_cpp
41 #define _linegroup_cpp
42 
43 #include "crossplatformexport.h"
44 #include "datatypes.h"
45 #include "vector3.h"
46 #include "colourvalue.h"
47 
48 namespace Mezzanine
49 {
50  // Just a few forward declarations to make wrapping some functionality to engine internals easier.
51  class Entresol;
52  namespace Internal
53  {
54  class Line3D;
55  }
56 
57  ///////////////////////////////////////////////////////////////////////////////
58  /// @class LineGroup
59  /// @headerfile linegroup.h
60  /// @brief This is a group of consectutive line segments to be rendered together.
61  /// @details This class stores a listing of points and renders thems as one
62  /// object into the world provided.
64  {
65  /// @todo TODO: This class really should support rotation, the underlying implementation does.
66  public:
67  /// @brief Basic Constructor.
68  LineGroup();
69  /// @brief Default Destructor.
70  ~LineGroup();
71 
72  /// @brief This add Either a start pointing, or a line segment to the next point.
73  /// @details This adds a point that will be rendered as the endpoint of a line.
74  /// @param NewPoint The Point to be added.
75  /// @param Colour The colour to be given to the new point.
76  void AddPoint(const Vector3& NewPoint, const ColourValue& Colour);
77  /// @brief Access points by order they were added.
78  /// @details This returns the point indicated by index. They start at 0, and increment from there.
79  /// @param Index A Whole number which indicates which point to retrieve.
80  const Vector3 GetPoint(const Whole Index) const;
81  /// @brief Get the amount of points used to define Line Segments.
82  /// @return A Whole Number which indicates the amount of points used to make the lines in this LineGroup.
83  Whole GetNumPoints() const;
84  /// @brief This changes a specific point.
85  /// @details This replaces a point specified by index with a new point.
86  /// @param Index The index of the point to replace.
87  /// @param NewValue A point to replace the existing point with.
88  void UpdatePoint(const Whole Index, const Vector3& NewValue);
89  /// @brief Clears all data pertaining to points in this line group.
90  void ClearLines();
91 
92  /// @brief This adds Two points to the list.
93  /// @param Start The first point to be added.
94  /// @param End The second point to be added.
95  /// @param Colour The colour of the line being added.
96  void DrawLine(const Vector3& Start, const Vector3& End, const ColourValue& Colour);
97  /// @brief Updates the render buffers with the needed data to draw the lines in this LineGroup.
98  void DrawLines();
99 
100  /// @brief Configures this LineGroup to render in the scene.
101  void AddToWorld();
102  /// @brief Unhooks this LineGroup from the scene, stopping it from rendering.
103  void RemoveFromWorld();
104 
105  /// @brief How big would a circle need to be to encapsulate this.
106  /// @return This returns a real number which indicates the radius.
107  Real GetBoundingRadius() const;
108  private:
109  /// @internal
110  /// @brief A Pointer to the internal class that actually does the work.
111  Internal::Line3D *LineData;
112  };//LineGroup
113 }//Mezzanine
114 
115 #endif