Debian Codegraph @

modules/navigation_3d/3d/nav_region_iteration_3d.h

raw symbols SCIP
1 /**************************************************************************/
2 /* nav_region_iteration_3d.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "../nav_utils_3d.h"
34 #include "nav_base_iteration_3d.h"
35 #include "scene/resources/navigation_mesh.h"
36
37 #include "core/math/aabb.h"
38
39 class NavRegion3D;
40 class NavRegionIteration3D;
41
42 struct NavRegionIterationBuild3D {
43 Nav3D::PerformanceData performance_data;
44
45 NavRegion3D *region = nullptr;
46
47 Vector3 map_cell_size;
48 Transform3D region_transform;
49
50 struct NavMeshData {
51 Vector<Vector3> vertices;
52 Vector<Vector<int>> polygons;
53
54 void clear() {
55 vertices.clear();
56 polygons.clear();
57 }
58 } navmesh_data;
59
60 Ref<NavRegionIteration3D> region_iteration;
61
62 HashMap<Nav3D::EdgeKey, Nav3D::EdgeConnectionPair, Nav3D::EdgeKey> iter_connection_pairs_map;
63
64 void reset() {
65 performance_data.reset();
66
67 navmesh_data.clear();
68 region_iteration = Ref<NavRegionIteration3D>();
69 iter_connection_pairs_map.clear();
70 }
71 };
72
73 class NavRegionIteration3D : public NavBaseIteration3D {
74 GDCLASS(NavRegionIteration3D, NavBaseIteration3D);
75
76 public:
77 Transform3D transform;
78 real_t surface_area = 0.0;
79 AABB bounds;
80 LocalVector<Nav3D::ConnectableEdge> external_edges;
81
82 const Transform3D &get_transform() const { return transform; }
83 real_t get_surface_area() const { return surface_area; }
84 AABB get_bounds() const { return bounds; }
85 const LocalVector<Nav3D::ConnectableEdge> &get_external_edges() const { return external_edges; }
86
87 virtual ~NavRegionIteration3D() override {
88 external_edges.clear();
89 navmesh_polygons.clear();
90 internal_connections.clear();
91 }
92 };