Spinning Topp Logo BlackTopp Studios
inc
billboard.h
Go to the documentation of this file.
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 _graphicsbillboard_h
41 #define _graphicsbillboard_h
42 
43 /// @file
44 /// @brief This file contains the declaration for the Billboard class used by BillboardSetProxy.
45 
46 #include "vector3.h"
47 #include "colourvalue.h"
48 
49 namespace Ogre
50 {
51  class Billboard;
52 }
53 
54 namespace Mezzanine
55 {
56  namespace Graphics
57  {
58  ///////////////////////////////////////////////////////////////////////////////
59  /// @brief This is the proxy class for placing and manipulating a set of 2D billboards in the scene.
60  /// @details
61  ///////////////////////////////////////
63  {
64  protected:
65  /// @internal
66  /// @brief A pointer to the internal Billboard.
67  Ogre::Billboard* GraphicsBillboard;
68  public:
69  /// @brief Internal constructor.
70  /// @param InternalBillboard A pointer to the internal Billboard this instance is based on.
71  Billboard(Ogre::Billboard* InternalBillboard);
72  /// @brief Class destructor.
73  ~Billboard();
74 
75  ///////////////////////////////////////////////////////////////////////////////
76  // Utility
77 
78  /// @brief Gets whether or not this billboard has had it's dimensions individually configured.
79  /// @return Returns true if this billboard has had it's dimensions manually altered, false otherwise.
80  Boole HasOwnDimensions() const;
81  /// @brief Resets whatever dimensions are on this billboard to the default provided to the parent BillboardSetProxy.
82  void ResetDimensions();
83  /// @brief Gets whether or not this billboard is using custom texture coordinates.
84  /// @return Returns true if custom texture coordinates have been set for this billboard, false otherwise.
85  Boole IsUsingTextureCoordRect() const;
86 
87  ///////////////////////////////////////////////////////////////////////////////
88  // Billboard Properties
89 
90  /// @brief Sets the location of this billboard relative to it's parent set.
91  /// @param Loc The relative location to place this billboard.
92  void SetLocation(const Vector3& Loc);
93  /// @brief Gets the location of this billboard relative to it's parent set.
94  /// @return Returns a Vector3 representing the current position of this billboard relative to it's parent.
95  Vector3 GetLocation() const;
96  /// @brief Sets the facing direction of this billboard. Only useful with specific types of BillboardSetProxies.
97  /// @remarks This value is only used if the parent billboard is of type: "BBT_Oriented_Self" or "BBT_Perpendicular_Self".
98  /// @param Dir The facing direction of this billboard.
99  void SetDirection(const Vector3& Dir);
100  /// @brief Gets the facing direction of this billboard. Only useful with specific types of BillboardSetProxies.
101  /// @remarks This value is only used if the parent billboard is of type: "BBT_Oriented_Self" or "BBT_Perpendicular_Self".
102  /// @return Returns a Vector3 representing the current facing direction of this billboard.
103  Vector3 GetDirection() const;
104  /// @brief Sets the rotation of this billboard.
105  /// @param Rot The rotation in radians around the facing axis of this billboard to apply.
106  void SetRotation(const Real Rot);
107  /// @brief Gets the rotation of this billboard.
108  /// @return Returns a Real representing the rotation around the facing axis of this billboard in radians.
109  Real GetRotation() const;
110  /// @brief Sets the base colour of this billboard.
111  /// @note Pure white is default and what you will want to use in most situations as that will preserve the render settings set on the material used to render.
112  /// @param Colour The colour that will become the base colour of this billboard.
113  void SetColour(const ColourValue& Colour);
114  /// @brief Gets the base colour of this billboard.
115  /// @return Returns a ColourValue representing the currently set base colour of this billboard.
116  ColourValue GetColour() const;
117 
118  /// @brief Sets the world unit dimensions of this billboard.
119  /// @param Width The world unit width to be assigned to this specific billboard.
120  /// @param Height The world unit height to be assigned to this specific billboard.
121  void SetDimensions(const Real Width, const Real Height);
122  /// @brief Gets the individually configured world unit Width of this billboard.
123  /// @return Returns a Real representing the Width of this billboard that has been manually set.
124  Real GetOwnWidth() const;
125  /// @brief Gets the individually configured world unit Height of this billboard.
126  /// @return Returns a Real representing the Height of this billboard that has been manually set.
127  Real GetOwnHeight() const;
128 
129  /// @brief Sets the rect in texture coordinates to use for rendering this billboard.
130  /// @note Texture coordinates should always be between 0.0 and 1.0.
131  /// @param Left The Left texture coordinate to use for rendering this billboard.
132  /// @param Top The Top texture coordinate to use for rendering this billboard.
133  /// @param Right The Right texture coordinate to use for rendering this billboard.
134  /// @param Bottom The Bottom texture coordinate to use for rendering this billboard.
135  void SetTextureCoordRect(const Real Left, const Real Top, const Real Right, const Real Bottom);
136  /// @brief Gets the Left side texture coordinate being used to render this billboard.
137  /// @return Returns a Real representing the Left texture coordinate to use to render this billboard.
138  Real GetLeftTextureCoord() const;
139  /// @brief Gets the Top side texture coordinate being used to render this billboard.
140  /// @return Returns a Real representing the top texture coordinate to use to render this billboard.
141  Real GetTopTextureCoord() const;
142  /// @brief Gets the Right side texture coordinate being used to render this billboard.
143  /// @return Returns a Real representing the Right texture coordinate to use to render this billboard.
144  Real GetRightTextureCoord() const;
145  /// @brief Gets the Bottom side texture coordinate being used to render this billboard.
146  /// @return Returns a Real representing the Bottom texture coordinate to use to render this billboard.
147  Real GetBottomTextureCoord() const;
148 
149  ///////////////////////////////////////////////////////////////////////////////
150  // Serialization
151 
152  /// @brief Convert this class to an XML::Node ready for serialization.
153  /// @param ParentNode The point in the XML hierarchy that all this renderable should be appended to.
154  void ProtoSerialize(XML::Node& ParentNode) const;
155  /// @brief Take the data stored in an XML Node and overwrite this object with it.
156  /// @param SelfRoot An XML::Node containing the data to populate this class with.
157  void ProtoDeSerialize(const XML::Node& SelfRoot);
158 
159  /// @brief Get the name of the the XML tag the proxy class will leave behind as its instances are serialized.
160  /// @return A string containing the name of this class.
161  static String GetSerializableName();
162 
163  ///////////////////////////////////////////////////////////////////////////////
164  // Internal Methods
165 
166  /// @internal
167  /// @brief Accessor for the internal billboard.
168  /// @return Returns a pointer to the internal billboard this class is based on.
169  Ogre::Billboard* _GetGraphicsObject() const;
170  };//Billboard
171  }//Graphics
172 }//Mezzanine
173 
174 #endif
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
This is the proxy class for placing and manipulating a set of 2D billboards in the scene...
Definition: billboard.h:62
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
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
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
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
Ogre::Billboard * GraphicsBillboard
A pointer to the internal Billboard.
Definition: billboard.h:67