MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
renderableproxy.h
Go to the documentation of this file.
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 _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.
81  Boolean InWorld;
82  public:
83  /// @brief Class constructor.
84  /// @param Creator A pointer to the manager that created this proxy.
85  RenderableProxy(SceneManager* Creator);
86  /// @brief Class destructor.
87  virtual ~RenderableProxy();
88 
89  ///////////////////////////////////////////////////////////////////////////////
90  // Utility
91 
92  /// @brief Gets this proxies AABB.
93  /// @note This will only return valid values if this proxy is in the world. A proxy outside of the world has no AABB.
94  /// @return Returns an AxisAlignedBox containing the AABB of this graphics proxy.
95  virtual AxisAlignedBox GetAABB() const;
96 
97  /// @copydoc WorldProxy::AddToWorld()
98  virtual void AddToWorld();
99  /// @copydoc WorldProxy::RemoveFromWorld()
100  virtual void RemoveFromWorld();
101  /// @copydoc WorldProxy::IsInWorld() const
102  virtual Boolean IsInWorld() const;
103 
104  /// @copydoc PhysicsProxy::GetCreator() const
105  virtual WorldManager* GetCreator() const;
106 
107  ///////////////////////////////////////////////////////////////////////////////
108  // RenderableProxy Properties
109 
110  /// @brief Sets whether or not this proxy is visible.
111  /// @param Visible True to allow this proxy to render, false otherwise.
112  virtual void SetVisible(const Boolean Visible);
113  /// @brief Gets whether or not this proxy is visible.
114  /// @return Returns true if this proxy is being rendered, false otherwise.
115  virtual Boolean GetVisible() const;
116  /// @brief Sets whether or not this proxy can cast a shadow.
117  /// @param CastShadows True to allow this proxy to cast a shadow, false to prevent it from casting a shadow.
118  virtual void SetCastShadows(const Boolean CastShadows);
119  /// @brief Gets whether or not this proxy can cast a shadow.
120  /// @return Returns true if this proxy can cast a shadow, false otherwise.
121  virtual Boolean GetCastShadows() const;
122  /// @brief Gets whether or not this proxy can be rendered with a shadow casted on it.
123  /// @return Returns true if this proxy can receive shadows, false otherwise.
124  virtual Boolean GetReceiveShadows() const;
125 
126  /// @brief Sets which types of lights will affect this proxy.
127  /// @param Mask A bitmask used to indicate which types of lights will be applied to this proxy.
128  virtual void SetLightMask(const UInt32 Mask);
129  /// @brief Gets which types of lights will affect this proxy.
130  /// @return Returns a bitmask indicating the types of lights that will affect this proxies rendering.
131  virtual UInt32 GetLightMask() const;
132  /// @brief Sets the bitmask that will be used to determine if this object should be visible when rendering.
133  /// @remarks This bitmask is compared against the bitmask you provide to a viewport for what should be visible during rendering.
134  /// @param Mask The bitmask to be applied.
135  virtual void SetVisibilityMask(const UInt32 Mask);
136  /// @brief Gets 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  /// @return Returns a bitmask describing the type of object this will be treated as when rendering.
139  virtual UInt32 GetVisibilityMask() const;
140  /// @brief Sets the bitmesk that will be used to determine if this object should be counted in scene queries.
141  /// @remarks This bitmask is compared against the bitmask you provide when performing a scene query from the scenemanager.
142  /// @param Mask The bitmask to be applied.
143  virtual void SetQueryMask(const UInt32 Mask);
144  /// @brief Gets the bitmask 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  /// @return Returns a bitmask describing the type of object this will be treated as when discovered in scene queries.
147  virtual UInt32 GetQueryMask() const;
148 
149  /// @brief Sets the distance at which the proxy will stop rendering.
150  /// @note Passing in zero will remove distance checking for this object when rendering.
151  /// @param Distance The distance in world units from the camera when the proxy will stop being rendered.
152  virtual void SetRenderDistance(const Real Distance);
153  /// @brief Gets the distance at which the proxy will stop rendering.
154  /// @return Returns a Real representing the max distance from the camera at which the proxy will be rendered.
155  virtual Real GetRenderDistance() const;
156 
157  ///////////////////////////////////////////////////////////////////////////////
158  // Transform Methods
159 
160  /// @copydoc WorldProxy::SetLocation(const Vector3&)
161  virtual void SetLocation(const Vector3& Loc);
162  /// @copydoc WorldProxy::SetLocation(const Real, const Real, const Real)
163  virtual void SetLocation(const Real X, const Real Y, const Real Z);
164  /// @copydoc WorldProxy::GetLocation() const
165  virtual Vector3 GetLocation() const;
166  /// @copydoc WorldProxy::SetOrientation(const Quaternion&)
167  virtual void SetOrientation(const Quaternion& Ori);
168  /// @copydoc WorldProxy::SetOrientation(const Real, const Real, const Real, const Real)
169  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W);
170  /// @copydoc WorldProxy::GetOrientation() const
171  virtual Quaternion GetOrientation() const;
172  /// @copydoc WorldProxy::SetScale(const Vector3&)
173  virtual void SetScale(const Vector3& Sc);
174  /// @copydoc WorldProxy::SetScale(const Real, const Real, const Real)
175  virtual void SetScale(const Real X, const Real Y, const Real Z);
176  /// @copydoc WorldProxy::GetScale() const
177  virtual Vector3 GetScale() const;
178 
179  /// @copydoc WorldProxy::Translate(const Vector3&)
180  virtual void Translate(const Vector3& Trans);
181  /// @copydoc WorldProxy::Translate(const Real, const Real, const Real)
182  virtual void Translate(const Real X, const Real Y, const Real Z);
183  /// @copydoc WorldProxy::Yaw(const Real)
184  virtual void Yaw(const Real Angle);
185  /// @copydoc WorldProxy::Pitch(const Real)
186  virtual void Pitch(const Real Angle);
187  /// @copydoc WorldProxy::Roll(const Real)
188  virtual void Roll(const Real Angle);
189  /// @copydoc WorldProxy::Rotate(const Vector3&, const Real)
190  virtual void Rotate(const Vector3& Axis, const Real Angle);
191  /// @copydoc WorldProxy::Rotate(const Quaternion&)
192  virtual void Rotate(const Quaternion& Rotation);
193  /// @copydoc WorldProxy::Scale(const Vector3&)
194  virtual void Scale(const Vector3& Scale);
195  /// @copydoc WorldProxy::Scale(const Real, const Real, const Real)
196  virtual void Scale(const Real X, const Real Y, const Real Z);
197 
198  ///////////////////////////////////////////////////////////////////////////////
199  // Serialization
200 
201  /// @copydoc WorldProxy::ProtoSerialize(XML::Node&) const
202  virtual void ProtoSerialize(XML::Node& ParentNode) const;
203  /// @copydoc WorldProxy::ProtoSerializeProperties(XML::Node& SelfRoot) const
204  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
205 
206  /// @copydoc WorldProxy::ProtoDeSerialize(const XML::Node&)
207  virtual void ProtoDeSerialize(const XML::Node& SelfRoot);
208  /// @copydoc WorldProxy::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
209  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
210 
211  /// @copydoc WorldProxy::GetDerivedSerializableName() const
212  virtual String GetDerivedSerializableName() const;
213  /// @copydoc WorldProxy::GetSerializableName()
214  static String GetSerializableName();
215 
216  ///////////////////////////////////////////////////////////////////////////////
217  // Internal Methods
218 
219  /// @internal
220  /// @brief Accessor for the internal node in the scenegraph for this proxy.
221  /// @return Returns a pointer to the scenenode storing the transform data of this proxy.
222  virtual Ogre::SceneNode* _GetGraphicsNode() const;
223  /// @internal
224  /// @brief Accessor for the internal graphics object.
225  /// @return Returns a pointer to the internal object of this proxy.
226  virtual Ogre::MovableObject* _GetBaseGraphicsObject() const = 0;
227  };//RenderableProxy
228  }//Graphics
229 }//Mezzanine
230 
231 #endif