OpenMoHAA 0.82.1
Loading...
Searching...
No Matches
navigation_recast_load_ext.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
27
28#pragma once
29
30#include "../qcommon/class.h"
31#include "../qcommon/vector.h"
32#include "../qcommon/container.h"
33
34struct rcPolyMesh;
35
40struct offMeshNavigationPoint {
41 Vector start;
42 Vector end;
43 float radius;
44 unsigned short flags;
45 unsigned char area;
46 bool bidirectional;
47 int id;
48
49 offMeshNavigationPoint()
50 : radius(0)
51 , flags(0)
52 , area(0)
53 , bidirectional(true)
54 , id(0)
55 {}
56
57 bool operator==(const offMeshNavigationPoint& other) const { return start == other.start && end == other.end; }
58
59 bool operator!=(const offMeshNavigationPoint& other) const { return !(*this == other); }
60};
61
62struct ExtensionArea {
63 float cost;
64 unsigned char number;
65
66 ExtensionArea(unsigned char number, float cost)
67 {
68 this->number = number;
69 this->cost = cost;
70 }
71};
72
73class INavigationMapExtension : public Class
74{
75private:
76 CLASS_PROTOTYPE(INavigationMapExtension);
77
78public:
79 virtual void Handle(Container<offMeshNavigationPoint>& points, const rcPolyMesh *polyMesh) {}
80
81 virtual Container<ExtensionArea> GetSupportedAreas() const { return Container<ExtensionArea>(); }
82};
83
85{
86private:
87 CLASS_PROTOTYPE(NavigationMapExtension_Ladders);
88
89public:
90 void Handle(Container<offMeshNavigationPoint>& points, const rcPolyMesh *polyMesh) override;
91 Container<ExtensionArea> GetSupportedAreas() const override;
92};
93
95{
96private:
97 CLASS_PROTOTYPE(NavigationMapExtension_JumpFall);
98
99public:
100 void Handle(Container<offMeshNavigationPoint>& points, const rcPolyMesh *polyMesh) override;
101 Container<ExtensionArea> GetSupportedAreas() const override;
102
103private:
104 void FixupPoint(vec3_t pos);
105 bool AddPoint(Container<offMeshNavigationPoint>& points, const offMeshNavigationPoint& point);
106 bool AreVertsValid(const vec3_t pos1, const vec3_t pos2) const;
107 offMeshNavigationPoint CanConnectFallPoint(const rcPolyMesh *polyMesh, const Vector& pos1, const Vector& pos2);
108 offMeshNavigationPoint CanConnectJumpPoint(const rcPolyMesh *polyMesh, const Vector& pos1, const Vector& pos2);
109 offMeshNavigationPoint CanConnectJumpOverLedgePoint(const rcPolyMesh *polyMesh, const Vector& pos1, const Vector& pos2);
110 offMeshNavigationPoint CanConnectStraightPoint(const rcPolyMesh *polyMesh, const Vector& pos1, const Vector& pos2);
111};
Definition container.h:85
Definition navigation_recast_load_ext.h:74
Definition navigation_recast_load_ext.h:95
Definition navigation_recast_load_ext.h:85
Definition vector.h:61
An offmesh point that the navigation system will use to find path.
Definition navigation_recast_load_ext.h:40