Commit Graph

382 Commits (8e3576022a327c68c053f1869ff44997262aedd6)

Author SHA1 Message Date
elsid 7a7c20d49e
Define single UpdateGuard type in a separate file 2 years ago
elsid 472a36d92a
Cleanup detournavigator includes 2 years ago
elsid 3e99deb0e8
Use typed settings storage for detournavigator 2 years ago
elsid 28f7a89530
Reuse dtNavMeshQuery
To avoid redundant allocations.
2 years ago
elsid 996153f78d
Convert RefId to class 2 years ago
florent.teppe 63e44eddc9 Navigator doesn't use RefId anymore 2 years ago
florent.teppe 150e2ba885 Revert "Use ESM::RefId for worldspace in detournavigator"
This reverts commit b4ab153418.

# Conflicts:
#	apps/navmeshtool/worldspacedata.cpp
2 years ago
elsid cf1d8544e3
Check agent bounds on adding agent to navigator
Do not add agent bounds which are not supported by recastnavigation with given
settings and log such events.

To avoid reaching navmesh tile generation to find out it can't be generated for
such agent bounds.
2 years ago
elsid 44429f0393
Limit NavMeshManager update range by player tile and max tiles
Object AABB may be much larger than area currently covered by navmesh. In this
case all tiles beyond covered range should be ignored. Attempt to iterate over
them will not result in any new tile updates but can take quite a while. At
maximum this can be pow(INT_MAX - INT_MIN, 2) iterations.

Use arbitrary time limit to check for update call to finish in the test.
2 years ago
Petr Mikheev 8c7d347179 Reorganize l10n files 2 years ago
elsid c71862a8df
Reset rcPolyMeshDetail members after rcFree
To avoid double free causing by later recastnavigation versions.
2 years ago
elsid b4ab153418
Use ESM::RefId for worldspace in detournavigator 2 years ago
florent.teppe 1ef1de974d script blacklist => RefId
Applies changes from review

Fixed clang format

Clang format + review.
2 years ago
florent.teppe 2c30575b3b CellName is now a RefId, makes more sense that way. 2 years ago
psi29a 14afde4689 Merge branch 'recast_context' into 'master'
Check input and report errors via RecastContext (#7093)

Closes #7093

See merge request OpenMW/openmw!2544
2 years ago
elsid 15e8f0b53c
Check input and report errors via RecastContext
Recast functions have preconditions for arguments they don't validate. This may
produce garbage data which may lead to crash. Check arguments and log when they
are invalid.

Do not throw exceptions when these function calls fail, capture Recast reported
errors via RecastContext inherited from rcContext and log them.
2 years ago
Evil Eye d40c09c18c Ignore non-3D agents in the navigator 2 years ago
elsid 843753da14
Remove unused includes 2 years ago
elsid 624d8bc931
Support unsigned settings values 2 years ago
elsid 1b9b61b60b
Format navmesh water vertices and indices 2 years ago
clang-format-bot ddb0522bbf
Apply clang-format to code base 2 years ago
Project579 a13709c510 Replace implicit convertions from std::filesystem::path to std::string with correctly converting functions. 2 years ago
Project579 e5c417c968 Make sure all paths are passed as std::filesystem::path instead of std::string where possible. 2 years ago
elsid 22ee592dd3
Lock TileCachedRecastMeshManager once per changing a cell
To save time on locking mutex and prevent AsyncNavMeshUpdater to use RecastMesh
for a tile in the middle of objects loading.
2 years ago
elsid d15e1dca84
Use R-tree for objects to be used for navmesh generation
Instead of storing a set of objects per tile.
2 years ago
elsid 180d609e0d
Check "wait until min distance to player" only for requiredTilesPresent wait condition
allJobsDone should wait even if "wait until min distance to player" is 0.
2 years ago
elsid 98ddc31902
Fix calculating min distance to nearest absent tile
Tile can be present in either mPushed (waiting in a queue), mProcessingTiles (
being processed or waiting in db queue), mPresentTiles (added to navmesh). It's
not enough to walk over mPushed tiles to find all not present. Need also to
check mProcessingTiles.

Otherwise if all tiles are in mProcessingTiles only
waitUntilJobsDoneForNotPresentTiles may return too early because there are none
in mPushed and therefore none tiles are considered to be absent on navmesh which
is not true.
2 years ago
elsid de80b86cc1
Use proper type to cast enum value 2 years ago
elsid 204ab6fea3
Use version instead of generation and revision for recast mesh 2 years ago
elsid 914edd1194
Make frequently called oneliners inline 2 years ago
elsid d1a294664e
Do not try to update tile to post
changedTiles contains unique set of positions and tilesToPost is empty initially
therefore it's not possible to add the same position twice.
2 years ago
elsid e2d566b89d
Store changed tiles in TileCachedRecastMeshManager 2 years ago
elsid c15848932b
Separate reading navigator stats and reporting 2 years ago
elsid e9be8b5efe
Show stats for writing and reading navmesh db queue jobs 2 years ago
elsid ab1ddc690e
Do not check getPolyHeight status
It may fail in some cases depending on a platform without obvious reason.
2 years ago
elsid aea4614240
Fix clang tidy warning 2 years ago
elsid 8147d49178
Remove redundant lock
mGeneration is const and mRevision is changed only from the same thread.
2 years ago
elsid 2885885331
Increase mutex scope in TileCachedRecastMeshManager functions
Which are called from the main thread.
2 years ago
elsid e1bed86d7e
Do single navigator update per frame
Primarily for crossing cell border case. Each Navigator::update call has a cost.
Doing it multiple times per frame increased frame duration on cell loading.

Call Navigator::wait only when cell has changed but do not use
Scene::hasCellChanged because it doesn't always indicates it.
2 years ago
elsid b1fb42a28c
Cleanup detournavigator includes 2 years ago
Andrei Kortunov e3ad30a517 Do not copy data when it is not needed 2 years ago
elsid f99ed6f1db
Split components/misc/stringops.hpp into multiple headers
Replace all ciEqual overloads with one having std::string_view as argument.
2 years ago
elsid 8b8e4f78b6
Support cylinder and rotating box collision shape types for actors
Cylinder collision shape should give the best consistency between physics
simulation and pathfinding. Rotating box is already used by some actors, so
add it to have the same collision shape type for all actors.
2 years ago
elsid 27cc901e76
Add bindings for navigator utils functions 2 years ago
Andrei Kortunov ccbb5e03fb Use YAML files to translate MyGUI's localization tags 3 years ago
psi29a 510a9b9a5e Merge branch 'navmeshtilescache_find' into 'master'
Avoid redundant copy when finding item in NavMeshTilesCache

See merge request OpenMW/openmw!2109
3 years ago
elsid 6fb7af3b63
Avoid redundant copy when finding item in NavMeshTilesCache
std::make_tuple returns a tuple for types with removed references which makes it
to copy arguments. std::tie leaves references.
3 years ago
elsid 5b9ca3b979
Avoid possible division by zero
components/detournavigator/navmeshdb.cpp:183:43: warning: Division by zero [clang-analyzer-core.DivideZero]
        setMaxPageCount(*mDb, maxFileSize / dbPageSize + static_cast<std::uint64_t>((maxFileSize % dbPageSize) != 0));
                              ~~~~~~~~~~~~^~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:182:33: note: Calling 'getPageSize'
        const auto dbPageSize = getPageSize(*mDb);
                                ^~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:144:13: note: 'value' initialized to 0
            std::uint64_t value = 0;
            ^~~~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:145:13: note: Calling 'request<DetourNavigator::(anonymous namespace)::GetPageSize, unsigned long *, >'
            request(db, statement, &value, 1);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/sqlite3/request.hpp:254:64: note: Left side of '&&' is false
            for (std::size_t i = 0; executeStep(db, statement) && i < max; ++i)
                                                               ^
components/detournavigator/navmeshdb.cpp:145:13: note: Returning from 'request<DetourNavigator::(anonymous namespace)::GetPageSize, unsigned long *, >'
            request(db, statement, &value, 1);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:146:13: note: Returning zero (loaded from 'value')
            return value;
            ^~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:182:33: note: Returning from 'getPageSize'
        const auto dbPageSize = getPageSize(*mDb);
                                ^~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:182:9: note: 'dbPageSize' initialized to 0
        const auto dbPageSize = getPageSize(*mDb);
        ^~~~~~~~~~~~~~~~~~~~~
components/detournavigator/navmeshdb.cpp:183:43: note: Division by zero
        setMaxPageCount(*mDb, maxFileSize / dbPageSize + static_cast<std::uint64_t>((maxFileSize % dbPageSize) != 0));
                              ~~~~~~~~~~~~^~~~~~~~~~~~
3 years ago
Andrei Kortunov 124db67496 Add an assert to detect possible nullptr dereference 3 years ago
elsid 8544aa481c
Fix C4459 msvc warning
declaration of 'navMeshVersion' hides global declaration
3 years ago