Spinning Topp Logo BlackTopp Studios
inc
linegroup.h
1 // © Copyright 2010 - 2016 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  class World;
53  namespace Internal
54  {
55  class Line3D;
56  }
57 
58  ///////////////////////////////////////////////////////////////////////////////
59  /// @class LineGroup
60  /// @headerfile linegroup.h
61  /// @brief This is a group of consectutive line segments to be rendered together.
62  /// @details This class stores a listing of points and renders thems as one
63  /// object into the world provided.
65  {
66  /// @todo TODO: This class really should support rotation, the underlying implementation does.
67  private:
68  World * ParentWorld;
69  public:
70  /// @brief Basic Constructor.
71  LineGroup(World * ParentWorld);
72  /// @brief Default Destructor.
73  ~LineGroup();
74 
75  /// @brief This add Either a start pointing, or a line segment to the next point.
76  /// @details This adds a point that will be rendered as the endpoint of a line.
77  /// @param NewPoint The Point to be added.
78  /// @param Colour The colour to be given to the new point.
79  void AddPoint(const Vector3& NewPoint, const ColourValue& Colour);
80  /// @brief Access points by order they were added.
81  /// @return Returns the point indicated by index. They start at 0, and increment from there.
82  /// @param Index A Whole number which indicates which point to retrieve.
83  const Vector3 GetPoint(const Whole Index) const;
84  /// @brief Get the amount of points used to define Line Segments.
85  /// @return A Whole Number which indicates the amount of points used to make the lines in this LineGroup.
86  Whole GetNumPoints() const;
87  /// @brief This changes a specific point.
88  /// @details This replaces a point specified by index with a new point.
89  /// @param Index The index of the point to replace.
90  /// @param NewValue A point to replace the existing point with.
91  void UpdatePoint(const Whole Index, const Vector3& NewValue);
92  /// @brief Clears all data pertaining to points in this line group.
93  void ClearLines();
94 
95  /// @brief This adds Two points to the list.
96  /// @param Start The first point to be added.
97  /// @param End The second point to be added.
98  /// @param Colour The colour of the line being added.
99  void DrawLine(const Vector3& Start, const Vector3& End, const ColourValue& Colour);
100  /// @brief Updates the render buffers with the needed data to draw the lines in this LineGroup.
101  void DrawLines();
102 
103  /// @brief Configures this LineGroup to render in the scene.
104  void AddToWorld();
105  /// @brief Unhooks this LineGroup from the scene, stopping it from rendering.
106  void RemoveFromWorld();
107 
108  /// @brief How big would a circle need to be to encapsulate this.
109  /// @return This returns a real number which indicates the radius.
110  Real GetBoundingRadius() const;
111  private:
112  /// @internal
113  /// @brief A Pointer to the internal class that actually does the work.
114  Internal::Line3D *LineData;
115  };//LineGroup
116 }//Mezzanine
117 
118 #endif
This file is used on some platforms to determine what data should be read and written to and from a s...
All the definitions for datatypes as well as some basic conversion functions are defined here...
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
Definition: colourvalue.h:64
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
This is a group of consectutive line segments to be rendered together.
Definition: linegroup.h:64
This is used to represent a point in space, or a vector through space.
Definition: vector3.h:77
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Definition: datatypes.h:151
This class represents a world for objects to interact within.
Definition: world.h:74
Does the bulk of the work that that the Mezzanine::LineGroup performs.
Definition: linegroup.cpp:88