Aether3D Game Engine
Mesh.hpp
1 #ifndef MESH_H
2 #define MESH_H
3 
4 #include <type_traits>
5 #include <vector>
6 #include <string>
7 
8 namespace ae3d
9 {
10  namespace FileSystem
11  {
12  struct FileContentsData;
13  }
14 
15  struct SubMesh;
16  struct Vec3;
17 
19  class Mesh
20  {
21  public:
23  enum class LoadResult { Success, Corrupted, OutOfMemory, FileNotFound };
24 
26  Mesh();
27 
29  Mesh( const Mesh& other );
30 
32  ~Mesh();
33 
35  Mesh& operator=( const Mesh& other );
36 
38  const std::string& GetPath() const;
39 
42  LoadResult Load( const FileSystem::FileContentsData& meshData );
43 
45  const Vec3& GetAABBMin() const;
46 
48  const Vec3& GetAABBMax() const;
49 
52  const Vec3& GetSubMeshAABBMin( unsigned subMeshIndex ) const;
53 
56  const Vec3& GetSubMeshAABBMax( unsigned subMeshIndex ) const;
57 
59  unsigned GetSubMeshCount() const;
60 
63  const std::string& GetSubMeshName( unsigned index ) const;
64 
65  private:
66  friend class MeshRendererComponent;
67 
68  struct Impl;
69  Impl& m() { return reinterpret_cast<Impl&>(_storage); }
70  Impl const& m() const { return reinterpret_cast<Impl const&>(_storage); }
71 
72  static const std::size_t StorageSize = 1384;
73  static const std::size_t StorageAlign = 16;
74 
75  std::aligned_storage<StorageSize, StorageAlign>::type _storage = {};
76 
77  std::vector< SubMesh >& GetSubMeshes();
78  };
79 }
80 
81 #endif
Definition: AudioClip.hpp:4
Contains a Mesh.
Definition: MeshRendererComponent.hpp:10
Contains a mesh. Can contain submeshes.
Definition: Mesh.hpp:19
LoadResult
Result of loading the mesh.
Definition: Mesh.hpp:23
3-component vector.
Definition: Vec3.hpp:12
Definition: FileSystem.hpp:12