Spinning Topp Logo BlackTopp Studios
inc
renderableproxy.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 _graphicsrenderableproxy_h
41 #define _graphicsrenderableproxy_h
42 
43 /// @file
44 /// @brief This file contains the declaration for the base class from which graphics proxies inherit.
45 
46 #include "worldproxy.h"
47 #include "axisalignedbox.h"
48 
49 namespace Ogre
50 {
51  class MovableObject;
52  class SceneNode;
53 }
54 
55 namespace Mezzanine
56 {
57  namespace Graphics
58  {
59  class SceneManager;
60  ///////////////////////////////////////////////////////////////////////////////
61  /// @brief This is the base proxy class for world proxies wrapping functionality of the graphics subsystem.
62  /// @details
63  ///////////////////////////////////////
65  {
66  protected:
67  /// @internal
68  /// @brief A pointer to the internal object storing the proxy transform.
69  Ogre::SceneNode* GraphicsNode;
70  /// @internal
71  /// @brief This is a pointer to the scene manager that created and owns this proxy.
73  /// @internal
74  /// @brief This is a bitmask identifying this objects type when being rendered. Used for advanced visibility configuration.
76  /// @internal
77  /// @brief This is a bitmask identifying this objects type when being queried. Used for advanced query configuration.
79  /// @internal
80  /// @brief This stores whether the proxy is currently in the graphics world or not.
82  public:
83  /// @brief XML-assist Constructor.
84  /// @param Creator A pointer to the manager that created this proxy.
85  RenderableProxy(SceneManager* Creator);
86  /// @brief Normal Constructor.
87  /// @param ID The unique ID assigned to this proxy.
88  /// @param Creator A pointer to the manager that created this proxy.
89  RenderableProxy(const UInt32 ID, SceneManager* Creator);
90  /// @brief Class destructor.
91  virtual ~RenderableProxy();
92 
93  ///////////////////////////////////////////////////////////////////////////////
94  // Utility
95 
96  /// @brief Gets this proxies AABB.
97  /// @note This will only return valid values if this proxy is in the world. A proxy outside of the world has no AABB.
98  /// @return Returns an AxisAlignedBox containing the AABB of this graphics proxy.
99  virtual AxisAlignedBox GetAABB() const;
100 
101  /// @copydoc WorldProxy::AddToWorld()
102  virtual void AddToWorld();
103  /// @copydoc WorldProxy::RemoveFromWorld()
104  virtual void RemoveFromWorld();
105  /// @copydoc WorldProxy::IsInWorld() const
106  virtual Boole IsInWorld() const;
107 
108  /// @copydoc WorldProxy::GetCreator() const
109  virtual WorldManager* GetCreator() const;
110 
111  ///////////////////////////////////////////////////////////////////////////////
112  // RenderableProxy Properties
113 
114  /// @brief Sets whether or not this proxy is visible.
115  /// @param Visible True to allow this proxy to render, false otherwise.
116  virtual void SetVisible(const Boole Visible);
117  /// @brief Gets whether or not this proxy is visible.
118  /// @return Returns true if this proxy is being rendered, false otherwise.
119  virtual Boole GetVisible() const;
120  /// @brief Sets whether or not this proxy can cast a shadow.
121  /// @param CastShadows True to allow this proxy to cast a shadow, false to prevent it from casting a shadow.
122  virtual void SetCastShadows(const Boole CastShadows);
123  /// @brief Gets whether or not this proxy can cast a shadow.
124  /// @return Returns true if this proxy can cast a shadow, false otherwise.
125  virtual Boole GetCastShadows() const;
126  /// @brief Gets whether or not this proxy can be rendered with a shadow casted on it.
127  /// @return Returns true if this proxy can receive shadows, false otherwise.
128  virtual Boole GetReceiveShadows() const;
129 
130  /// @brief Sets which types of lights will affect this proxy.
131  /// @param Mask A bitmask used to indicate which types of lights will be applied to this proxy.
132  virtual void SetLightMask(const UInt32 Mask);
133  /// @brief Gets which types of lights will affect this proxy.
134  /// @return Returns a bitmask indicating the types of lights that will affect this proxies rendering.
135  virtual UInt32 GetLightMask() const;
136  /// @brief Sets the bitmask that will be used to determine if this object should be visible when rendering.
137  /// @remarks This bitmask is compared against the bitmask you provide to a viewport for what should be visible during rendering.
138  /// @param Mask The bitmask to be applied.
139  virtual void SetVisibilityMask(const UInt32 Mask);
140  /// @brief Gets the bitmask that will be used to determine if this object should be visible when rendering.
141  /// @remarks This bitmask is compared against the bitmask you provide to a viewport for what should be visible during rendering.
142  /// @return Returns a bitmask describing the type of object this will be treated as when rendering.
143  virtual UInt32 GetVisibilityMask() const;
144  /// @brief Sets the bitmesk that will be used to determine if this object should be counted in scene queries.
145  /// @remarks This bitmask is compared against the bitmask you provide when performing a scene query from the scenemanager.
146  /// @param Mask The bitmask to be applied.
147  virtual void SetQueryMask(const UInt32 Mask);
148  /// @brief Gets the bitmask that will be used to determine if this object should be counted in scene queries.
149  /// @remarks This bitmask is compared against the bitmask you provide when performing a scene query from the scenemanager.
150  /// @return Returns a bitmask describing the type of object this will be treated as when discovered in scene queries.
151  virtual UInt32 GetQueryMask() const;
152 
153  /// @brief Sets the distance at which the proxy will stop rendering.
154  /// @note Passing in zero will remove distance checking for this object when rendering.
155  /// @param Distance The distance in world units from the camera when the proxy will stop being rendered.
156  virtual void SetRenderDistance(const Real Distance);
157  /// @brief Gets the distance at which the proxy will stop rendering.
158  /// @return Returns a Real representing the max distance from the camera at which the proxy will be rendered.
159  virtual Real GetRenderDistance() const;
160 
161  ///////////////////////////////////////////////////////////////////////////////
162  // Transform Methods
163 
164  /// @copydoc WorldProxy::SetLocation(const Vector3&)
165  virtual void SetLocation(const Vector3& Loc);
166  /// @copydoc WorldProxy::SetLocation(const Real, const Real, const Real)
167  virtual void SetLocation(const Real X, const Real Y, const Real Z);
168  /// @copydoc WorldProxy::GetLocation() const
169  virtual Vector3 GetLocation() const;
170  /// @copydoc WorldProxy::SetOrientation(const Quaternion&)
171  virtual void SetOrientation(const Quaternion& Ori);
172  /// @copydoc WorldProxy::SetOrientation(const Real, const Real, const Real, const Real)
173  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W);
174  /// @copydoc WorldProxy::GetOrientation() const
175  virtual Quaternion GetOrientation() const;
176  /// @copydoc WorldProxy::SetScale(const Vector3&)
177  virtual void SetScale(const Vector3& Sc);
178  /// @copydoc WorldProxy::SetScale(const Real, const Real, const Real)
179  virtual void SetScale(const Real X, const Real Y, const Real Z);
180  /// @copydoc WorldProxy::GetScale() const
181  virtual Vector3 GetScale() const;
182 
183  /// @copydoc WorldProxy::Translate(const Vector3&)
184  virtual void Translate(const Vector3& Trans);
185  /// @copydoc WorldProxy::Translate(const Real, const Real, const Real)
186  virtual void Translate(const Real X, const Real Y, const Real Z);
187  /// @copydoc WorldProxy::Yaw(const Real)
188  virtual void Yaw(const Real Angle);
189  /// @copydoc WorldProxy::Pitch(const Real)
190  virtual void Pitch(const Real Angle);
191  /// @copydoc WorldProxy::Roll(const Real)
192  virtual void Roll(const Real Angle);
193  /// @copydoc WorldProxy::Rotate(const Vector3&, const Real)
194  virtual void Rotate(const Vector3& Axis, const Real Angle);
195  /// @copydoc WorldProxy::Rotate(const Quaternion&)
196  virtual void Rotate(const Quaternion& Rotation);
197  /// @copydoc WorldProxy::Scale(const Vector3&)
198  virtual void Scale(const Vector3& Scale);
199  /// @copydoc WorldProxy::Scale(const Real, const Real, const Real)
200  virtual void Scale(const Real X, const Real Y, const Real Z);
201 
202  ///////////////////////////////////////////////////////////////////////////////
203  // Serialization
204 
205  /// @copydoc WorldProxy::ProtoSerializeProperties(XML::Node& SelfRoot) const
206  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
207  /// @copydoc WorldProxy::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
208  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
209 
210  /// @copydoc WorldProxy::GetDerivedSerializableName() const
211  virtual String GetDerivedSerializableName() const;
212  /// @copydoc WorldProxy::GetSerializableName()
213  static String GetSerializableName();
214 
215  ///////////////////////////////////////////////////////////////////////////////
216  // Internal Methods
217 
218  /// @internal
219  /// @brief Accessor for the internal node in the scenegraph for this proxy.
220  /// @return Returns a pointer to the scenenode storing the transform data of this proxy.
221  virtual Ogre::SceneNode* _GetGraphicsNode() const;
222  /// @internal
223  /// @brief Accessor for the internal graphics object.
224  /// @return Returns a pointer to the internal object of this proxy.
225  virtual Ogre::MovableObject* _GetBaseGraphicsObject() const = 0;
226  };//RenderableProxy
227  }//Graphics
228 }//Mezzanine
229 
230 #endif
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
This class contains utilities and functions to allow the manipulation of the Graphical scene...
Definition: scenemanager.h:85
SceneManager * Manager
This is a pointer to the scene manager that created and owns this proxy.
This is the base proxy class for world proxies wrapping functionality of the graphics subsystem...
UInt32 QueryMask
This is a bitmask identifying this objects type when being queried. Used for advanced query configura...
Ogre::SceneNode * GraphicsNode
A pointer to the internal object storing the proxy transform.
This file contains the AxisAlignedBox class for representing AABB's of objects in the world...
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 the base class for proxy objects belonging to the various 3D subsystems.
Definition: worldproxy.h:53
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
This is the base class for all managers that belong to a single world instance.
Definition: worldmanager.h:55
UInt32 VisibilityMask
This is a bitmask identifying this objects type when being rendered. Used for advanced visibility con...
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...
Boole InWorld
This stores whether the proxy is currently in the graphics world or not.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
This is used to store information about rotation in 3d space.
Definition: quaternion.h:68
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
This is a utility class used to represent the Axis-Aligned Bounding Boxes of objects in various subsy...