Spinning Topp Logo BlackTopp Studios
inc
mesh.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 _graphicsmesh_h
41 #define _graphicsmesh_h
42 
43 #include "datatypes.h"
44 
45 namespace Ogre
46 {
47  class Mesh;
48  template<typename T> class SharedPtr;
49  typedef SharedPtr<Mesh> MeshPtr;
50 }//Ogre
51 
52 namespace Mezzanine
53 {
54  namespace Graphics
55  {
56  class SubMesh;
57  class Skeleton;
58  class InternalMeshData;
59  ///////////////////////////////////////////////////////////////////////////////
60  /// @brief This class is used to check and modify the properties of a graphics mesh.
61  /// @details
62  ///////////////////////////////////////
63  class MEZZ_LIB Mesh
64  {
65  public:
66  /// @brief A convenience type for the storage of SubMeshes in this class.
67  typedef std::vector<SubMesh*> SubMeshContainer;
68  /// @brief An iterator type for SubMeshes being stored by this class.
69  typedef SubMeshContainer::iterator SubMeshIterator;
70  /// @brief A const iterator type for SubMeshes being stored by this class.
71  typedef SubMeshContainer::const_iterator ConstSubMeshIterator;
72  protected:
73  /// @internal
74  /// @brief A pointer to the internal data this Mesh is based on.
76  /// @internal
77  /// @brief If Skeletal animations are enabled on this Mesh, this is a pointer to the Skeleton being used.
79  /// @internal
80  /// @brief A container storing all the SubMeshes in this Mesh.
81  SubMeshContainer SubMeshes;
82 
83  /// @internal
84  /// @brief Constructs a Mezzanine wrapper for every SubMesh in the internal Mesh.
85  void WrapAllSubMeshes();
86  /// @internal
87  /// @brief Destroys every wrapped (but not the underlying instance) SubMesh in this Mesh.
88  void DestroyAllWrappedSubMeshes();
89  public:
90  /// @internal
91  /// @brief Internal Constructor.
92  /// @param InternalMesh The internal Mesh this Mesh class is based on.
93  Mesh(Ogre::MeshPtr InternalMesh);
94  /// @brief Class Destructor.
95  ~Mesh();
96 
97  ///////////////////////////////////////////////////////////////////////////////
98  // Utility Methods
99 
100  /// @brief Gets the number of Vertices in this Mesh.
101  /// @return Returns the number of Vertices that make up all SubMeshes in this Mesh.
102  Whole GetVertexCount() const;
103  /// @brief Gets the number of Indices in this Mesh.
104  /// @return Returns the number of Indices used to assemble the vertices in all SubMeshes in this Mesh.
105  Whole GetIndexCount() const;
106 
107  ///////////////////////////////////////////////////////////////////////////////
108  // SubMesh Methods
109 
110  /// @brief Gets a SubMesh by index.
111  /// @param Index The index of the SubMesh to retrieve.
112  /// @return Returns a pointer to the SubMesh at the specified index.
113  SubMesh* GetSubMesh(const Whole Index) const;
114  /// @brief Gets the number of SubMeshes in this Mesh.
115  /// @return Returns a Whole representing the number of SubMeshes that make up this Mesh.
116  Whole GetNumSubMeshes() const;
117 
118  ///////////////////////////////////////////////////////////////////////////////
119  // Skeleton Methods
120 
121 
122 
123  ///////////////////////////////////////////////////////////////////////////////
124  // Asset Methods
125 
126  /// @brief Gets the Name of this Mesh.
127  /// @note If this Mesh originated from a file, usually the name of the Mesh will be the file name.
128  /// @return Returns a const string reference containing the name of this Mesh.
129  ConstString& GetName() const;
130  /// @brief Gets the resource group this Mesh belongs to.
131  /// @return Returns a const string reference containing the group this Mesh belongs to.
132  ConstString& GetGroup() const;
133 
134  ///////////////////////////////////////////////////////////////////////////////
135  // Internal Methods
136 
137  /// @internal
138  /// @brief Gets the internal Mesh pointer.
139  /// @return Returns a shared pointer pointing to the internal Mesh.
140  Ogre::MeshPtr _GetInternalMesh() const;
141  };//Mesh
142  }//Graphics
143 }//Mezzanine
144 
145 #endif
SubMeshContainer::const_iterator ConstSubMeshIterator
A const iterator type for SubMeshes being stored by this class.
Definition: mesh.h:71
This class is used to check and modify the properties of a graphics mesh.
Definition: mesh.h:63
All the definitions for datatypes as well as some basic conversion functions are defined here...
This class represents a sub-section of an overall mesh.
Definition: submesh.h:61
Skeleton * MeshSkel
If Skeletal animations are enabled on this Mesh, this is a pointer to the Skeleton being used...
Definition: mesh.h:78
std::vector< SubMesh * > SubMeshContainer
A convenience type for the storage of SubMeshes in this class.
Definition: mesh.h:67
SubMeshContainer SubMeshes
A container storing all the SubMeshes in this Mesh.
Definition: mesh.h:81
const String ConstString
A Datatype used to a series of imutable characters.
Definition: datatypes.h:165
InternalMeshData * IMD
A pointer to the internal data this Mesh is based on.
Definition: mesh.h:75
This class is used to store the internal structures needed by the Mesh class.
Definition: mesh.cpp:58
SubMeshContainer::iterator SubMeshIterator
An iterator type for SubMeshes being stored by this class.
Definition: mesh.h:69
This class encapsulates the Skeletal animation functionality of a Mesh.
Definition: skeleton.h:63
#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