Commit Graph

49 Commits (master)

Author SHA1 Message Date
elsid 9854d42d56
Use ESM::RefId for worldspace type 7 months ago
elsid 9e2f3fd0b4
Report stats for TileCachedRecastMeshManager 7 months ago
elsid 7a7c20d49e
Define single UpdateGuard type in a separate file 2 years ago
elsid 472a36d92a
Cleanup detournavigator includes 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 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
elsid b4ab153418
Use ESM::RefId for worldspace in detournavigator 2 years ago
elsid 843753da14
Remove unused includes 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 2885885331
Increase mutex scope in TileCachedRecastMeshManager functions
Which are called from the main thread.
2 years ago
elsid b1fb42a28c
Cleanup detournavigator includes 2 years ago
elsid 0b644a897e
Explicitly bind TileCachedRecastMeshManager with mutex 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 563f3f87dd
Reduce critical sections size 3 years ago
elsid 7ea5aa250b
Revert "Cull navmesh objects by scene bounds"
This reverts commit b0ef20c303.
3 years ago
elsid ecc654a369 Limit and filter navmesh input (#5858) 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 953a4c5550
Add a binary to generate navmesh from content files
Load content files based on the engine config files. Generate navmesh per cell
for all cells and store into SQLite database.
3 years ago
elsid 01c712d5f1
Split navigator settings into subtypes
Mostly to distinguish settings that affect properties of the generated navmesh.
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 5db4898bec
Fix tile bounds scaling
OscillatingRecastMeshObject::update should be called with tile bounds in real
coordinates not in navmesh. But proper scaling was done only in
RecastMeshManager::getMesh and RecastMeshManager::updateObject used tile bounds
in navmesh coordinates.

Add a new function to create tile bounds with proper scaling and pass correct
value into RecastMeshManager constructor through CachedRecastMeshManager
constuctor from TileCachedRecastMeshManager member functions.
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 05258ed644
Remove redundant TileCachedRecastMeshManager::hasTile function
It's used only for tests. getMesh is a valid replacement.
3 years ago
elsid 8ac8d56e8c
Mark TileCachedRecastMeshManager member functions as const where possible 3 years ago
elsid 050b7d31aa
Create RecastMesh outside critical section
To not lock main thread when it tries to update objects.
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 5d6c93566d
Rename DetourNavigator::Water -> Cell 3 years ago
elsid 753767d6d9
Store only water shift
Rotation is not used.
3 years ago
elsid da4ec31cd8
Remove redundant RecastMeshManager::Water 3 years ago
elsid 22c2f106b7
Store object tiles position as sorted vector instead of set 4 years ago
elsid d122e184cc
Report navmesh change for not posted tiles
Corresponding recast mesh tiles can be updated but navmesh tiles may never
appear for them. Report back zero navmesh version to allow oscillating recast
objects detection to work. This version is always less than any generated
navmesh tile version so any report for generated navmesh will override it.
If zero navmesh version is reported after recast mesh tile got report about
generated navmesh tile it is a no-op since generated version is always greater
than zero.
4 years ago
elsid 3e67f5ffa5
Detect and ignore updates for oscillating objects
To avoid triggering NavMesh update when RecastMesh change should not change
NavMesh.

Based on the following assumption:
Given a set of transformations and a bounding shape for all these
tranformations, a new object transformation that does not change this
bounding shape also should not change navmesh if for all of this object
transformations resulting navmesh tiles are equivalent

The idea is to report back to RecastMeshManager all changes of NavMesh if there
are any assiciated with RecastMesh version. So we know the last time when
RecastMesh change resulted into the NavMesh change. When later report shows
that there was no NavMesh change for a new RecastMesh version we can assume
that any object transformation within the same bounding box should not change
NavMesh.
4 years ago
Bret Curtis 62b0781f7d use std::optional instead of boost::optional 4 years ago
elsid df6e85b619
Use callback to handle changed tiles
Instead of collecting changed tiles into a temporary vector.
5 years ago
elsid 7ae7cb181d
Support recast mesh rendering 5 years ago
elsid da6df818ff
Fix update navmesh
Every updated object should produce a set of changed tiles where it is
placed. Before this change only current object tiles were updated. If
object was moved to another set of tiles then navmesh were not changed
in new tiles.

TileCachedRecastMeshManager::updateObject should add all new tiles if object
was moved and remove all no more used tiles. Both new and old tiles should be
marked as changed.

Also add tests to show desired result for add, update, remove.
6 years ago
elsid ae7285e960
Use ScopeGuarded instead of raw mutex 6 years ago
elsid 1a27489904
Add special type for object id 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 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