/**************************************************************************/ /* nav_utils.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #ifndef NAV_UTILS_H #define NAV_UTILS_H #include "core/math/vector3.h" #include "core/templates/hash_map.h" #include "core/templates/hashfuncs.h" #include "core/templates/local_vector.h" class NavBase; namespace gd { struct Polygon; PointKey; struct EdgeKey { … }; struct Point { … }; struct Edge { … }; struct Polygon { … }; struct NavigationPoly { … }; struct NavPolyTravelCostGreaterThan { … }; struct NavPolyHeapIndexer { … }; struct ClosestPointQueryResult { … }; template <typename T> struct NoopIndexer { … }; /** * A max-heap implementation that notifies of element index changes. */ template <typename T, typename LessThan = Comparator<T>, typename Indexer = NoopIndexer<T>> class Heap { LocalVector<T> _buffer; LessThan _less_than; Indexer _indexer; public: void reserve(uint32_t p_size) { … } uint32_t size() const { … } bool is_empty() const { … } void push(const T &p_element) { … } T pop() { … } /** * Update the position of the element in the heap if necessary. */ void shift(uint32_t p_index) { … } void clear() { … } Heap() { … } Heap(const LessThan &p_less_than) : … { … } Heap(const Indexer &p_indexer) : … { … } Heap(const LessThan &p_less_than, const Indexer &p_indexer) : … { … } private: bool _shift_up(uint32_t p_index) { … } bool _shift_down(uint32_t p_index) { … } }; struct PerformanceData { … }; } // namespace gd #endif // NAV_UTILS_H