i6engine  1.0
WaynetManager.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_WAYNETMANAGER_H__
26 #define __I6ENGINE_API_WAYNETMANAGER_H__
27 
28 #include <map>
29 #include <string>
30 #include <vector>
31 
33 
36 
37 namespace i6e {
38 namespace api {
39 
40  class EngineController;
41 
46  friend class EngineController;
47 
48  struct Edge {
49  double length;
50  std::string targetWP;
51  Vec3 startPosition;
52  Vec3 targetPosition;
53  Quaternion targetRotation;
54  };
55 
56  public:
57  WaynetManager();
58 
62  void createWaynet();
63 
67  std::vector<Vec3> getShortestPath(const Vec3 & startPos, const std::string & targetWP);
68 
72  void showWaynet() const;
73 
77  std::string getNearestWaypoint(const Vec3 & pos) const;
78 
79  private:
80  std::map<std::string, std::vector<Edge>> _waypoints;
81  // first pair is start and end waypoint
82  std::map<std::pair<std::string, std::string>, std::vector<Vec3>> _paths;
83 
84  void reset();
85 
86  std::vector<Vec3> getShortestPath(const std::string & startWP, const std::string & targetWP);
87  };
88 
89 } /* namespace api */
90 } /* namespace i6e */
91 
92 #endif /* __I6ENGINE_API_WAYNETMANAGER_H__ */
93 
This class is used as the Controller for the whole engine Create an instance of this class and use th...
Class describing a 3d rotation.
Definition: i6eQuaternion.h:58
#define ISIXE_MODULES_API
Implements 3-dimensional vectors.
Definition: i6eVector.h:48
handles the current Waynet
Definition: WaynetManager.h:45