Commit Graph

50 Commits (master)

Author SHA1 Message Date
elsid 45d62ee59f
Limit RecastMeshManager range by active cell grid 7 months ago
elsid 49db37ee29
Merge setWorldspace and updateBounds 7 months ago
elsid 9854d42d56
Use ESM::RefId for worldspace type 7 months ago
elsid 7a7c20d49e
Define single UpdateGuard type in a separate file 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 b4ab153418
Use ESM::RefId for worldspace in detournavigator 2 years ago
clang-format-bot ddb0522bbf
Apply clang-format to code base 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 e2d566b89d
Store changed tiles in TileCachedRecastMeshManager 2 years ago
elsid c15848932b
Separate reading navigator stats and reporting 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
elsid 1a12c453d6
Support different agent collision shape type for pathfinding
Actors may have different collision shapes. Currently there are axis-aligned
bounding boxes and rotating bounding boxes. With AABB it's required to use
bounding cylinder for navmesh agent to avoid providing paths where actor can't
pass. But for rotating bounding boxes cylinder with diameter equal to the front
face width should be used to not reduce of available paths. For example rats
have rotating bounding box as collision shape because of the difference between
front and side faces width.

* Add agent bounds to navmesh tile db cache key. This is required to distinguish
  tiles for agents with different bounds.
* Increase navmesh version because navmesh tile db cache key and data has changed.
* Move navmesh version to the code to avoid misconfiguration by users.
* Fix all places where wrong half extents were used for pathfinding.
3 years ago
jvoisin 72a6d1f69f Clean up bullet includes 3 years ago
elsid 05b54cbfb8
Cull navmesh objects by scene bounds
If object is too big iteration over all tiles covering it can take too much
time. Limit bounds to a square around a player position to cover only tiles
that will be present in navmesh based on max tiles number option.

Each object is associated with a set of tiles its present in. Culling can
reduce this set but it has to be update when bounds change position. Do this
in TileCachedRecastMeshManager::setBounds updating the set and adding/removing
objects to the corresponding CachedRecastMeshManagers.
3 years ago
elsid c9b8ba7b46
Read navmesh tile data from database
When tile is not found in memory cache try to find it in the database.
3 years ago
elsid 7dcb219ecf
Add raw heightfield data to navigator 3 years ago
elsid 8571c317d8
Add raw water data to navigator 3 years ago
elsid 0c8a811ad5
Render only cached recast mesh
To avoid waiting while recast mesh is generating.

Remove redundant continue.
3 years ago
elsid c8987bda2f
Store reference to BulletShapeInstance for btCollisionShape
To keep btCollisionShape lifetime.
3 years ago
elsid 9a5ec5fd03
Store heightfields as array of heights instead of triangles
To reduce size of RecastMesh and therefore cache size.
3 years ago
elsid 753767d6d9
Store only water shift
Rotation is not used.
3 years ago
jvoisin 1123dc46ee Add a ton of const refs 4 years ago
psi29a f1f1703441 Merge branch 'fix_navmesh_wait' into 'master'
Fix redundant waiting until navmesh is generated

See merge request OpenMW/openmw!861
4 years ago
elsid 59f89d22f8
Apply min distance only for not present tiles
To avoid waiting when navmesh update is triggered by transformed object for
already present tiles.
4 years ago
jvoisin 28d5e5e8be Remove some superfluous includes in components/detournavigator 4 years ago
elsid f169f8e6f0
Wait until navmesh is generated for interior cells
Add special loading progress bar.

It should be fast enough to not keep loading screen for noticably long but
will provide better pathfinding for actors inside interior cells.
4 years ago
elsid c4cd3b2c4f
Add pathgrid to navmesh as off mesh connection 5 years ago
elsid 7ae7cb181d
Support recast mesh rendering 5 years ago
elsid 4624f31788
Report navigator stats 6 years ago
elsid 0479ebf5ae
Remove unused actors and navmeshes on update
When there is only one actor (player) on a scene and it moving to other
cell first it will be removed from navigator then added. Remove cause
navmesh removing for its half extents. After it is added navmesh for
same half extents is created and added. While this all happens there are
still jobs for old navmesh are processing. Old navmesh still exists
because it is stored by shared pointer. So jobs take tiles from cache
and place them into old navmesh. After that other jobs take same tiles
from cache (half extents and coordinates are equal) and place them into
other navmesh. dtNavMesh changes tile data on add and remove. Adding tile
to two dtNavMesh corrupts tile in both nameshes.
6 years ago
elsid 16675fd254
Return empty path when navmesh is not found for agent 6 years ago
elsid ed73d130f9
Cache navmesh tiles
Use LRU modification to hold currently used items. Use RecastMesh binary
data for item key.

Store original pointer of btCollisionShape in user pointer to make available
it as an identifier within all duplicates. Use pointer to heights data array
for btHeightfieldTerrainShape.
6 years ago
elsid 1a27489904
Add special type for object id 6 years ago
elsid ff478aba6d
Use actor half extent for interior cells 6 years ago
elsid 346e9e3141
Add off mesh connections for doors without teleport 6 years ago
elsid c95cea414c
Support water for NavMesh 6 years ago
elsid 72f211ef28
Add enums for area type and flags 6 years ago
elsid fa23b590a4
Add unwalkable areas to NavMesh 6 years ago
elsid c771986c56
Prioritise NavMesh jobs first to remove and last to add
When player move fast enough, tiles update for specific area square
couldn't catch player move. Tiles to be removed are left in the queue
with lower priority then tiles to be added which are nearest to player.
This can lead to overflow for amount of tiles. So we try to do remove
first. But we detect change type approximately using mixed change type,
because even if we do it precise, change type could change while job
is in queue.
6 years ago
elsid 144e1a063b
Support animated objects 6 years ago
elsid 4aba0fa85f
Limit number of NavMesh tiles to add by distance from player tile 6 years ago
elsid d2fd9abd51
Split RecastMesh into tiles 6 years ago
elsid dbb1d99bff
Add NavMeshItem generation to fix update NavMesh for render 6 years ago
elsid 70a369f70e
Add command to enable NavMesh render
togglenavmesh or tnm
6 years ago
elsid dd5e6a61a3
Support btCompoundShape for RecastMesh 6 years ago
elsid d1d034a1ec
Update NavMesh one by one tile in order from nearest to player 6 years ago
elsid 430ba9d7a5
Build NavMesh tile data only for changed tiles 6 years ago
elsid fafba8ea0c
Use recastnavigation to find path 6 years ago