Atoms Crowd  4.1.0
NavigationMeshes.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsCore/Globals.h>
11 #include <Atoms/Globals.h>
12 #include <AtomsUtils/NavigationMesh/NavMesh.h>
13 #include <map>
14 #include <mutex>
15 
16 namespace Atoms
17 {
19  class ATOMS_EXPORT NavigationMeshes
20  {
21  public:
22 
25 
28 
31 
34 
37 
39 
43  AtomsPtr<AtomsUtils::NavMesh> navMesh(const std::string& name);
44 
46 
50  AtomsUtils::NavMesh* navMeshPtr(const std::string& name);
51 
53 
57  AtomsWPtr<AtomsUtils::NavMesh> navMeshWPtr(const std::string& name);
58 
60  bool hasNavMesh(const std::string& name);
61 
63 
67  void addNavMesh(const std::string& name, AtomsPtr<AtomsUtils::NavMesh>& navmesh, bool replace = false);
68 
70  void insertNavMesh(const std::string& name, AtomsPtr<AtomsUtils::NavMesh>& navmesh, bool replace = false);
71 
73 
76  void removeNavMesh(const std::string& name);
77 
79 
82  std::vector<std::string> navMeshNames();
83 
85 
89  bool navMeshExists(const std::string& name);
90 
92  unsigned int numNavMeshes();
93 
95  void clear();
96 
97  private:
98 
99  typedef std::map<std::string, AtomsPtr<AtomsUtils::NavMesh>> NavMeshMap;
100 
102 
105  NavMeshMap m_navMeshMap;
106 
108  std::mutex m_mutex;
109  };
110 }
Atoms::NavigationMeshes::navMeshExists
bool navMeshExists(const std::string &name)
Checks if a nav mesh exists.
Atoms::NavigationMeshes::NavigationMeshes
NavigationMeshes()
Constructor.
Atoms::NavigationMeshes::insertNavMesh
void insertNavMesh(const std::string &name, AtomsPtr< AtomsUtils::NavMesh > &navmesh, bool replace=false)
Adds an nav mesh to the map.
Atoms::NavigationMeshes::navMeshWPtr
AtomsWPtr< AtomsUtils::NavMesh > navMeshWPtr(const std::string &name)
Gets an nav mesh.
Atoms::NavigationMeshes::operator=
NavigationMeshes & operator=(const NavigationMeshes &)
Private assign operator.
Atoms::NavigationMeshes::navMeshNames
std::vector< std::string > navMeshNames()
Gets all nav mesh names.
Atoms::NavigationMeshes
Container for all agent types.
Definition: NavigationMeshes.h:20
Atoms::NavigationMeshes::instance
static NavigationMeshes & instance()
Singleton access.
Atoms::NavigationMeshes::addNavMesh
void addNavMesh(const std::string &name, AtomsPtr< AtomsUtils::NavMesh > &navmesh, bool replace=false)
Adds an nav mesh to the map.
Atoms::NavigationMeshes::~NavigationMeshes
~NavigationMeshes()
Destructor.
Atoms::NavigationMeshes::removeNavMesh
void removeNavMesh(const std::string &name)
Removes an nav mesh from the map.
Atoms::NavigationMeshes::NavigationMeshes
NavigationMeshes(const NavigationMeshes &)
Copy constructor.
AtomsUtils::NavMesh
Definition: NavMesh.h:45
Atoms::NavigationMeshes::hasNavMesh
bool hasNavMesh(const std::string &name)
Checks if an nav mesh with the given name exists.
Atoms::NavigationMeshes::clear
void clear()
Removes all nav meshes.
Atoms
Atoms namespace.
Definition: Agent.h:28
Atoms::NavigationMeshes::numNavMeshes
unsigned int numNavMeshes()
Gets the number of nav mesh.
Atoms::NavigationMeshes::navMesh
AtomsPtr< AtomsUtils::NavMesh > navMesh(const std::string &name)
Gets an nav mesh.
Atoms::NavigationMeshes::navMeshPtr
AtomsUtils::NavMesh * navMeshPtr(const std::string &name)
Gets an nav mesh.