OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
navigation_path.h
1/*
2===========================================================================
3Copyright (C) 2025 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25#include "../qcommon/vector.h"
26#include "../qcommon/container.h"
27#include "../qcommon/lightclass.h"
28
29struct PathNav {
30 Vector origin;
31 vec2_t dir;
32 float dist;
33};
34
36 Vector leashHome;
37 float leashDist;
38 int fallHeight;
39 Entity *entity;
40};
41
42class IPather : public LightClass
43{
44public:
45 virtual ~IPather() = default;
46
52 static IPather *CreatePather();
53
61 virtual void FindPath(const Vector& start, const Vector& end, const PathSearchParameter& parameters) = 0;
62
71 virtual void
72 FindPathNear(const Vector& start, const Vector& end, float radius, const PathSearchParameter& parameters) = 0;
73
83 virtual void FindPathAway(
84 const Vector& start,
85 const Vector& avoid,
86 const Vector& preferredDir,
87 float radius,
88 const PathSearchParameter& parameters
89 ) = 0;
90
99 virtual bool TestPath(const Vector& start, const Vector& end, const PathSearchParameter& parameters) = 0;
100
106 virtual void UpdatePos(const Vector& origin) = 0;
107
112 virtual void Clear() = 0;
113
120 virtual PathNav GetNode(unsigned int index = 0) const = 0;
121
127 virtual int GetNodeCount() const = 0;
128
134 virtual Vector GetCurrentDelta() const = 0;
135
141 virtual Vector GetCurrentDirection() const = 0;
142
148 virtual Vector GetDestination() const = 0;
149
155 virtual bool HasReachedGoal(const Vector& origin) const = 0;
156
163 virtual bool IsQuerying() const = 0;
164};
Definition entity.h:203
Definition navigation_path.h:43
virtual Vector GetCurrentDelta() const =0
Return the current move delta.
virtual bool IsQuerying() const =0
Return true if the path is currently being calculated.
virtual void FindPath(const Vector &start, const Vector &end, const PathSearchParameter &parameters)=0
Find and set the path from start to end.
virtual void FindPathAway(const Vector &start, const Vector &avoid, const Vector &preferredDir, float radius, const PathSearchParameter &parameters)=0
Find and set the path away from the specified origin.
virtual bool TestPath(const Vector &start, const Vector &end, const PathSearchParameter &parameters)=0
Returns true if the path exists, false otherwise.
virtual bool HasReachedGoal(const Vector &origin) const =0
Return true if the origin is at the end of the goal.
virtual PathNav GetNode(unsigned int index=0) const =0
Return the node at the specified index (0 = first node, and nodecount - 1 = last node).
static IPather * CreatePather()
Create a new Pather object based on supported navigation features.
Definition navigation_path.cpp:35
virtual void UpdatePos(const Vector &origin)=0
Update path movement.
virtual void Clear()=0
Clear the path.
virtual void FindPathNear(const Vector &start, const Vector &end, float radius, const PathSearchParameter &parameters)=0
Find and set the path from start to end with the specified goal radius.
virtual int GetNodeCount() const =0
Return the number of nodes.
virtual Vector GetDestination() const =0
Return the final destination.
virtual Vector GetCurrentDirection() const =0
Return the directional vector towards the path.
Definition lightclass.h:30
Definition vector.h:61
Definition navigation_path.h:29
Definition navigation_path.h:35