Spinning Topp Logo BlackTopp Studios
inc
entityproxy.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 _graphicsentityproxy_h
41 #define _graphicsentityproxy_h
42 
43 /// @file
44 /// @brief This file contains the declaration for the World proxy wrapping basic entity(mesh) functionality.
45 
47 
48 namespace Ogre
49 {
50  class Entity;
51 }
52 
53 namespace Mezzanine
54 {
55  namespace Graphics
56  {
57  class Mesh;
58  ///////////////////////////////////////////////////////////////////////////////
59  /// @brief This is the proxy class for placing and manipulating a mesh in the scene.
60  /// @details
61  ///////////////////////////////////////
63  {
64  protected:
65  // We want to be able to preserve all our settings and set a mesh seemlessly, but the underlying implementation doesn't support that.
66  // So we need a cache of all the settings we can access. Our base class already handles two such settings, so we can skip those.
67 
68  /// @internal
69  /// @brief A pointer to the internal Entity this proxy is based on.
70  Ogre::Entity* GraphicsEntity;
71  /// @internal
72  /// @brief A pointer to the mesh being used by this proxy.
74 
75  /// @internal
76  /// @brief Stores the maximum distance this object can be from the camera before it is clipped/culled.
78  /// @internal
79  /// @brief A bitmask which will be compared against to determine which lights apply to this object.
81  /// @internal
82  /// @brief Stores whether or not this object should be rendered, regardless of other criteria.
84  /// @internal
85  /// @brief Stores whether or not this object can cast shadows on other objects.
87 
88  /// @copydoc WorldProxy::ProtoSerializeImpl(XML::Node&) const
89  virtual void ProtoSerializeImpl(XML::Node& SelfRoot) const;
90  /// @copydoc WorldProxy::ProtoDeSerializeImpl(const XML::Node&)
91  virtual void ProtoDeSerializeImpl(const XML::Node& SelfRoot);
92  /// @internal
93  /// @brief Creates an internal entity based on the provided mesh.
94  /// @param ObjectMesh A pointer to the mesh to be applied to this proxy.
95  virtual void CreateEntity(Mesh* ObjectMesh);
96  /// @internal
97  /// @brief Creates an internal entity based on the provided mesh.
98  /// @param MeshName The name of the mesh to be loaded and applied to this proxy.
99  /// @param GroupName The resource group name where the mesh can be found.
100  virtual void CreateEntity(const String& MeshName, const String& GroupName);
101  /// @internal
102  /// @brief Destroys the internal entity in use by this proxy.
103  virtual void DestroyEntity();
104  public:
105  /// @brief Blank constructor.
106  /// @param ID The unique ID assigned to this EntityProxy.
107  /// @param Creator A pointer to the manager that created this proxy.
108  EntityProxy(const UInt32 ID, SceneManager* Creator);
109  /// @brief Loaded Mesh constructor.
110  /// @param ID The unique ID assigned to this EntityProxy.
111  /// @param TheMesh A pointer to the mesh to be applied to this proxy.
112  /// @param Creator A pointer to the manager that created this proxy.
113  EntityProxy(const UInt32 ID, Mesh* TheMesh, SceneManager* Creator);
114  /// @brief Standard constructor.
115  /// @param ID The unique ID assigned to this EntityProxy.
116  /// @param MeshName The name of the mesh to be loaded and applied to this proxy.
117  /// @param GroupName The resource group name where the mesh can be found.
118  /// @param Creator A pointer to the manager that created this proxy.
119  EntityProxy(const UInt32 ID, const String& MeshName, const String& GroupName, SceneManager* Creator);
120  /// @brief XML constructor.
121  /// @param SelfRoot An XML::Node containing the data to populate this class with.
122  /// @param Creator A pointer to the manager that created this proxy.
123  EntityProxy(const XML::Node& SelfRoot, SceneManager* Creator);
124  /// @brief Class destructor.
125  virtual ~EntityProxy();
126 
127  /// @todo Create sub-entity access methods on this class.
128  /// @todo Create minor material manipulation methods on this class.
129  /// @todo Create Animation state and Skeleton access methods on this class.
130 
131  ///////////////////////////////////////////////////////////////////////////////
132  // Utility
133 
134  /// @copydoc WorldProxy::GetProxyType() const
135  virtual Mezzanine::ProxyType GetProxyType() const;
136 
137  /// @copydoc WorldProxy::AddToWorld()
138  virtual void AddToWorld();
139  /// @copydoc WorldProxy::RemoveFromWorld()
140  virtual void RemoveFromWorld();
141 
142  ///////////////////////////////////////////////////////////////////////////////
143  // Mesh Management
144 
145  /// @brief Sets the mesh to be used by this proxy.
146  /// @param MeshName The name of the mesh to apply to this proxy.
147  /// @param Group The resource group to which the mesh belongs.
148  virtual void SetMesh(const String& MeshName, const String& Group);
149  /// @brief Sets the mesh to be used by this proxy.
150  /// @param ObjectMesh The mesh to apply to this proxy.
151  virtual void SetMesh(Mesh* ObjectMesh);
152  /// @brief Gets the mesh currently being used by this proxy.
153  /// @return Returns a pointer to the mesh currently being used by this proxy.
154  virtual Mesh* GetMesh() const;
155 
156  ///////////////////////////////////////////////////////////////////////////////
157  // RenderableProxy Properties
158 
159  /// @copydoc RenderableProxy::SetVisible(const Boole)
160  virtual void SetVisible(const Boole Visible);
161  /// @copydoc RenderableProxy::GetVisible() const
162  virtual Boole GetVisible() const;
163  /// @copydoc RenderableProxy::SetCastShadows(const Boole)
164  virtual void SetCastShadows(const Boole CastShadows);
165  /// @copydoc RenderableProxy::GetCastShadows() const
166  virtual Boole GetCastShadows() const;
167  /// @copydoc RenderableProxy::GetReceiveShadows() const
168  virtual Boole GetReceiveShadows() const;
169 
170  /// @copydoc RenderableProxy::SetLightMask(const UInt32)
171  virtual void SetLightMask(const UInt32 Mask);
172  /// @copydoc RenderableProxy::GetLightMask() const
173  virtual UInt32 GetLightMask() const;
174  /// @copydoc RenderableProxy::SetVisibilityMask(const UInt32)
175  virtual void SetVisibilityMask(const UInt32 Mask);
176  /// @copydoc RenderableProxy::GetVisibilityMask() const
177  virtual UInt32 GetVisibilityMask() const;
178  /// @copydoc RenderableProxy::SetQueryMask(const UInt32)
179  virtual void SetQueryMask(const UInt32 Mask);
180  /// @copydoc RenderableProxy::GetQueryMask() const
181  virtual UInt32 GetQueryMask() const;
182 
183  /// @copydoc RenderableProxy::SetRenderDistance(const Real)
184  virtual void SetRenderDistance(const Real Distance);
185  /// @copydoc RenderableProxy::GetRenderDistance() const
186  virtual Real GetRenderDistance() const;
187 
188  ///////////////////////////////////////////////////////////////////////////////
189  // Entity Properties
190 
191  ///////////////////////////////////////////////////////////////////////////////
192  // Serialization
193 
194  /// @copydoc WorldProxy::ProtoSerializeProperties(XML::Node& SelfRoot) const
195  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
196  /// @brief Convert the mesh of this class to an XML::Node ready for serialization.
197  /// @param SelfRoot The root node containing all the serialized data for this instance.
198  virtual void ProtoSerializeMesh(XML::Node& SelfRoot) const;
199 
200  /// @copydoc WorldProxy::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
201  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
202  /// @brief Take the data stored in an XML Node and overwrite the mesh of this object with it.
203  /// @param SelfRoot An XML::Node containing the data to populate this class with.
204  virtual void ProtoDeSerializeMesh(const XML::Node& SelfRoot);
205 
206  /// @copydoc WorldProxy::GetDerivedSerializableName() const
207  virtual String GetDerivedSerializableName() const;
208  /// @copydoc WorldProxy::GetSerializableName()
209  static String GetSerializableName();
210 
211  ///////////////////////////////////////////////////////////////////////////////
212  // Internal Methods
213 
214  /// @internal
215  /// @brief Accessor for the internal entity.
216  /// @return Returns a pointer to the internal entity this proxy is based on.
217  virtual Ogre::Entity* _GetGraphicsObject() const;
218  /// @copydoc RenderableProxy::_GetBaseGraphicsObject() const
219  virtual Ogre::MovableObject* _GetBaseGraphicsObject() const;
220  };//EntityProxy
221  }//Graphics
222 }//Mezzanine
223 
224 #endif
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
Boole CanCastShadows
Stores whether or not this object can cast shadows on other objects.
Definition: entityproxy.h:86
This class contains utilities and functions to allow the manipulation of the Graphical scene...
Definition: scenemanager.h:85
This file contains the declaration for the base class from which graphics proxies inherit...
This class is used to check and modify the properties of a graphics mesh.
Definition: mesh.h:63
Ogre::Entity * GraphicsEntity
A pointer to the internal Entity this proxy is based on.
Definition: entityproxy.h:70
Boole SceneVisible
Stores whether or not this object should be rendered, regardless of other criteria.
Definition: entityproxy.h:83
This is the base proxy class for world proxies wrapping functionality of the graphics subsystem...
This is the proxy class for placing and manipulating a mesh in the scene.
Definition: entityproxy.h:62
UInt32 LightMask
A bitmask which will be compared against to determine which lights apply to this object.
Definition: entityproxy.h:80
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
Mesh * ProxyMesh
A pointer to the mesh being used by this proxy.
Definition: entityproxy.h:73
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
ProxyType
Used by all World proxies to describe what their derived types are.
Definition: enumerations.h:91
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
Real RenderDist
Stores the maximum distance this object can be from the camera before it is clipped/culled.
Definition: entityproxy.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