Commit Graph

57 Commits (master)

Author SHA1 Message Date
elsid 45d62ee59f
Limit RecastMeshManager range by active cell grid 7 months ago
elsid 9854d42d56
Use ESM::RefId for worldspace type 7 months ago
elsid 5d28164416
Remove recast mesh tiles outside active range 7 months ago
elsid 9e2f3fd0b4
Report stats for TileCachedRecastMeshManager 7 months ago
elsid 50f4471750
Use R-tree for dynamic priority of navmesh async job 9 months ago
elsid 69cf507db8
Fix navmesh update on player changing tile
In cases when objects are not present on the scene (e.g. generated exterior
cells) navmesh is not updated because area that suppose to be covered with it
was not updated. It was updated only during cell change. This is a regression
from d15e1dca84.

Set TileCachedRecastMeshManager range on NavMeshManager update to make sure it
always covers correct area around player.

Return a union of objects, heightfields and water ranges from
getLimitedObjectsRange intersected with range provided above.
12 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 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
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 542717394a
Remove objects, water and heightfields when no longer required 3 years ago
elsid 7ea5aa250b
Revert "Cull navmesh objects by scene bounds"
This reverts commit b0ef20c303.
3 years ago
elsid b0ef20c303
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.
3 years ago
elsid bba7beb0c5
Split tiles position range creation and iteration over 3 years ago
elsid 12ce82980c
Revert "Limit and filter navmesh input (#5858)"
This reverts commit ecc654a369.
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
jvoisin d4e3575f1d Don't use `const` for objects returned by value.
This prevents the usage of std::move semantics,
and makes clang-tidy sad.
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 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 849f2078c1
Swap outside critical section 6 years ago
elsid 73734fc04d
Fix update navmesh for not changed objects
When update method is called for not changed object befor this change
all object tiles were considered as not object tiles and were removed.
Also this marked those tiles as changed. This lead to alternation
between remove and add each tile update method was called. Problem was
detected by using Animated Containers mod.
6 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