elsid
94e71d9b14
Avoid division by zero
2021-08-09 17:58:33 +02:00
elsid
0985d8e03d
Handle failed NavMesh allocation
2021-08-09 17:54:19 +02:00
elsid
a6260453ea
Add missing initialization
2021-08-09 17:54:19 +02:00
elsid
86e6d3dac8
Do not cache navmesh when only object transformation is changed
...
This saves cache capacity when a scene contains objects contantly transforming
by scripts and causing changes in navmesh. The probability to get cache hit for
such states is almost zero because even a constant change in a single float
value may give up to 2^32 different states.
2021-08-08 02:38:20 +02:00
elsid
3cbe93358a
Move dtNavMeshParams initialization to where it's required
2021-08-08 02:30:48 +02:00
elsid
41b02ff1aa
Copy only required RecastMeshObject fields
2021-08-07 12:38:01 +02:00
elsid
c91ef34a70
Avoid using a specific type for stored ref_ptr to extend lifetime
2021-08-07 12:20:55 +02:00
elsid
050b7d31aa
Create RecastMesh outside critical section
...
To not lock main thread when it tries to update objects.
2021-08-03 12:21:56 +02:00
elsid
c8987bda2f
Store reference to BulletShapeInstance for btCollisionShape
...
To keep btCollisionShape lifetime.
2021-08-03 12:21:56 +02:00
elsid
4574e5f565
Remove redundant Navigator API functions
2021-08-03 12:21:55 +02:00
elsid
9a5ec5fd03
Store heightfields as array of heights instead of triangles
...
To reduce size of RecastMesh and therefore cache size.
2021-07-26 00:22:21 +02:00
elsid
fdee9db20c
Consider RecastMeshManager not empty when there is water
2021-07-26 00:22:21 +02:00
elsid
24b802b3d8
Simplify adding water to recast mesh
...
Remove redundant computations and conversions.
2021-07-26 00:22:21 +02:00
elsid
5d6c93566d
Rename DetourNavigator::Water -> Cell
2021-07-26 00:22:21 +02:00
elsid
753767d6d9
Store only water shift
...
Rotation is not used.
2021-07-26 00:22:20 +02:00
elsid
da4ec31cd8
Remove redundant RecastMeshManager::Water
2021-07-26 00:22:20 +02:00
elsid
a1549321d7
Move Water struct out of RecastMesh class
2021-07-26 00:22:20 +02:00
elsid
d60edb36aa
Make RecastMesh independent from recast scale factor
...
To avoid scaling until it's required by delaying coordinates conversion until
navmesh generation.
2021-07-26 00:22:20 +02:00
elsid
af7059373c
Make RecastMesh independent from the order of RecastMeshBuilder calls
...
To make sure RecastMesh objects are equal if built with the same data but in
different order. Will be used later when there will be more than one place
building RecasMesh objects.
2021-07-26 00:22:20 +02:00
elsid
07c70dfb73
Remove unused local variables
2021-07-26 00:22:20 +02:00
elsid
d2b935684d
Add missing include
2021-07-21 11:37:50 +02:00
elsid
beeb882ea8
Do not use off mesh connections as a part of navmesh cache key
...
To reduce cache size and make it more flexible.
Adding off mesh connections to the navmesh is the last step of navmesh
generation and it's very fast comparing to other steps (microseconds vs
milliseconds). Having less cache size makes get and set operations almost 2x
times faster that also have an order of microseconds. So in total there is
no performance impact.
2021-07-14 12:19:17 +02:00
elsid
09f9075842
Use RecastMeshBuilder once to create RecastMesh
...
This allows to move all data out of the object instead of copying.
2021-07-04 22:18:05 +02:00
elsid
0193c95b26
Shrink to fit recast mesh data
2021-07-04 22:18:05 +02:00
elsid
94e460ba1e
Use proper check for distance
...
To avoid invalid results for r < 1.
2021-06-30 20:11:41 +02:00
elsid
a54c4bc2e9
Check dtNavMeshQuery::findStraightPath status
2021-06-30 20:10:57 +02:00
elsid
793c30ab8d
Check dtNavMeshQuery::getPolyHeight status
...
Otherwise when it fails a node with zero height will be added to a path.
2021-06-30 20:06:48 +02:00
elsid
7e1630a7ad
Remove redundant getPolyHeight wrapper
2021-06-30 20:04:16 +02:00
elsid
cc08a45c31
Move include where it is needed
2021-06-30 20:02:08 +02:00
elsid
a3942a1e0a
Remove redundant check for y coordinate in inRange function
2021-06-30 20:00:43 +02:00
Petr Mikheev
4b98d460da
Merge branch 'const_moar' into 'master'
...
Sprinkle some const ref
See merge request OpenMW/openmw!963
2021-06-29 17:28:51 +00:00
psi29a
67f32263b2
Merge branch 'fix_malexa_escape' into 'master'
...
Inscribe physical bounding box into navmesh agent cylinder (#6114 )
Closes #6114
See merge request OpenMW/openmw!967
2021-06-28 14:26:08 +00:00
elsid
1552e7e3e3
Add pathgrid edges as one direction off mesh connection
2021-06-27 17:48:44 +02:00
elsid
ff1af5e8ec
Use only off mesh connections starting or ending in a given tile
2021-06-27 17:48:41 +02:00
elsid
a8ba9a0e2a
Cleanup unused tile positions from OffMeshConnectionsManager
2021-06-27 17:48:07 +02:00
elsid
81e569c3d9
Move OffMeshConnectionsManager implementation into cpp
2021-06-27 17:48:07 +02:00
elsid
7f65a2c4c2
Remove unused code
2021-06-27 17:48:07 +02:00
elsid
3e98db8d60
Fix styleguide
2021-06-27 17:48:06 +02:00
elsid
84d6dea277
Inscribe physical bounding box into navmesh agent cylinder
...
To disallow too narrow navmesh for a bounding box.
2021-06-27 13:44:38 +02:00
jvoisin
9db7d0278a
Sprinkle some const ref
2021-06-25 21:54:35 +02:00
jvoisin
1123dc46ee
Add a ton of const refs
2021-06-23 23:13:59 +02:00
elsid
4a6961b365
Trigger navmesh update on moved player only when player tile has been changed
2021-05-27 16:52:42 +02:00
elsid
ed91cf9397
Replace unordered_map by map for storing objects
...
For small amount of items it gives better performance for find by key
for update.
2021-05-27 16:38:40 +02:00
elsid
22c2f106b7
Store object tiles position as sorted vector instead of set
2021-05-27 16:00:31 +02:00
elsid
f4f9fa4701
Limit oscillating recast mesh object AABB by tile bounds
...
AABB change outside recast mesh tile should not affect navmesh for this tile.
2021-05-27 12:40:29 +02:00
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.
2021-05-27 12:40:00 +02:00
elsid
a73ffc25c3
Add missing synchronization for present tiles modification
...
insert/erase can be done from multiple threads simultaneously. mMutex is
already used to synchronize reads so use it for writes too.
2021-05-17 17:44:31 +02:00
psi29a
f1f1703441
Merge branch 'fix_navmesh_wait' into 'master'
...
Fix redundant waiting until navmesh is generated
See merge request OpenMW/openmw!861
2021-05-17 10:54:23 +00:00
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.
2021-05-14 22:41:11 +02:00
elsid
d0ea9c482a
Reorder async navmesh updater jobs when player tile changes
...
When player tile changes distance to player that is part of jobs priority is
invalidated. So jobs are no longer in the right order. This can lead to
processing of farests tiles first.
Sort queue each time player tile is changed.
2021-05-14 22:41:05 +02:00
jvoisin
28d5e5e8be
Remove some superfluous includes in components/detournavigator
2021-05-14 20:45:59 +02:00
psi29a
fd89582e0c
Merge branch 'navmesh_wait' into 'master'
...
Wait until navmesh is generated within given distance around player (#5500 )
Closes #5500
See merge request OpenMW/openmw!819
2021-05-13 16:56:39 +00:00
Andrei Kortunov
8d4a374516
Add missing include for std::inserter
2021-05-07 11:30:10 +04:00
elsid
7a51d0db18
Wait until navmesh is generated within given distance around player
...
Add a setting to change this distance.
To prevent situations when there is not enough navmesh generated and actors
can't find path correctly.
2021-05-05 19:44:16 +02:00
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.
2021-05-05 19:27:49 +02:00
elsid
865ef56a09
Replace include by RecastMesh forward declaration
...
To reduce dependency between navigator interface and implementation.
2021-05-04 13:00:06 +02:00
elsid
ec87b3f8f7
Remove redundant ChunkyTriMesh
...
This AABB tree required when need to filter out input mesh that has not
influence navmesh tile output. This filtering is already done before. Each
recast mesh corresponds to a single navmesh tile and has appropriate bounds.
2021-05-04 13:00:06 +02:00
elsid
bce06df254
Add missing array header
2021-05-04 13:00:06 +02:00
elsid
22aebcea74
Remove useless rcMarkWalkableTriangles call
...
It fills areas.data with walkable triangles but right after it's overwritten
and rcClearUnwalkableTriangles is called instead that fills areas.data with
unwalkable triangles.
2021-05-04 02:23:07 +02:00
jvoisin
d4d111a709
Don't use std::move on const
2021-05-02 15:50:44 +02:00
Roman Siromakha
68ddde84fe
Merge pull request #3074 from akortunov/warnfix
...
Declare separate constructors with const reference and rvalue arguments for OscillatingRecastMeshObject
2021-04-28 17:15:29 +02:00
psi29a
16bb3919d1
Merge branch 'navmesh_cache_simplification' into 'master'
...
Simplify navmesh cache
See merge request OpenMW/openmw!691
2021-04-28 08:01:06 +00:00
Andrei Kortunov
0bc0cfce5f
Declare separate constructors with const reference and rvalue arguments for OscillatingRecastMeshObject
2021-04-28 11:49:57 +04:00
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.
2021-04-18 23:00:13 +02:00
elsid
64fb700ae9
Remove unnecessary relation between updateCompoundObject and RecastMeshObject
2021-04-18 23:00:13 +02:00
elsid
629cedb6d0
Do not track last build revision in RecastMeshManger
...
mLastBuildRevision == mRevision with current use cases does not happen. But
even if this will happen when another use case will be added it does not save
much computation. The most expensive operation is not adding objects to the
MeshBuilder but to optimize resulting navmesh that will happen anyway in
MeshBuilder::create call.
2021-04-18 22:59:16 +02:00
elsid
62f32f4543
Do not replace equivalent navmesh tiles
2021-04-18 20:04:41 +02:00
elsid
ab8d1c02d4
Set idle priority for navmesh generation thread
...
Support Linux, Windows, FreeBSD.
2021-04-14 21:39:06 +02:00
elsid
0c6d72b2d1
Consider first set element as first acquired
2021-03-25 19:28:41 +01:00
elsid
f2ebad5115
Return cached element when set existing
2021-03-25 19:28:41 +01:00
elsid
05d6f6ac25
Use single map for navmesh cache
2021-03-25 19:28:41 +01:00
elsid
b9a40bc5fc
Add NavMeshTilesCache benchmarks
2021-03-25 19:28:41 +01:00
elsid
39c0ce9ddf
Build limited path for far destinations
...
When distance between start and end point is greater than max radius of area
possibly covered by navmesh there is no way to find path via navmesh. Also if
distance is greater than cell size navmesh might not exists withing mentioned
area because cell is not loaded therefore navmesh is not generated. So minumum
of these values is used to limit max path distance. Assuming that path
actually exists it's possible to build path to the edge of a circle. When
actor reaches initial edge path is built further. However it will not be
optimal.
2021-03-23 23:23:12 +01:00
Evil Eye
eb07818f13
Ignore agents without bounding boxes
2021-03-07 20:58:09 +01:00
psi29a
937549c99e
Merge branch 'fix_still_actors' into 'master'
...
Make actor flee from a combat when cannot reach a target (#5851 )
See merge request OpenMW/openmw!601
2021-02-26 23:25:05 +00:00
elsid
bc67669a97
Comment unused argument
2021-02-15 00:22:48 +01:00
elsid
4983684fda
Fix implicit int to float conversion warning
2021-02-15 00:20:15 +01:00
elsid
bb0c478954
Add missing include and use std malloc and free
2021-02-15 00:20:15 +01:00
elsid
3a9b1ce63a
Use camel case for local constant
2021-02-15 00:20:14 +01:00
elsid
a7fe6c7ba1
Move duplicated usage patter of dtNavMeshQuery::findNearestPoly into a separate function
2021-02-14 23:54:59 +01:00
elsid
d3ab6c972f
Avoid set unused position from dtNavMeshQuery::findNearestPoly result
2021-02-14 23:54:59 +01:00
elsid
8dba61f7ae
Use navmesh raycast to find reachable position around target
2021-02-14 04:14:22 +01:00
elsid
68fe6b9114
Use only item size to check whether item fits cache
...
Item size has to be counted anyway and there is no reason to check only navmesh
data first.
2021-02-04 01:12:59 +01:00
elsid
3a2cea5271
Use raw recast mesh data and off mesh connections for navmesh key
...
Serialization into a vector of chars produces inconsistent results that leads
to reduced cache hit rate. Using a structured object is a more clear solution
and allows to remove serialization and nontrivial key compare logic with more
straigt forward structured object comparison.
2021-02-04 01:01:15 +01:00
elsid
ad1f8c1e84
Sort water and off mesh connections for recast mesh
...
Inconsisten order of these objects in navmesh cache key leads to cache misses
due to key inequality.
2021-02-04 01:00:41 +01:00
elsid
489107c5ee
Count navmesh cache key once in item size
...
Key is stored only in NavMeshTilesCache::Item, TileMap uses KeyView with
a pointer to a vector.
2021-02-04 00:44:23 +01:00
elsid
88ca4a1db6
Count navmesh cache hit rate
2021-02-04 00:35:24 +01:00
elsid
d2d8a7a940
Fix passing null to memcpy
...
/home/elsid/dev/openmw/components/detournavigator/navmeshtilescache.cpp:36:24: runtime error: null pointer passed as argument 2, which is declared to never be null
#0 0x55e37ba4cda5 in makeNavMeshKey /home/elsid/dev/openmw/components/detournavigator/navmeshtilescache.cpp:36
#1 0x55e37ba4cda5 in DetourNavigator::NavMeshTilesCache::set(osg::Vec3f const&, osg::Vec2i const&, DetourNavigator::RecastMesh const&, std::vector<DetourNavigator::OffMeshConnection, std::allocator<DetourNavigator::OffMeshConnection> > const&, DetourNavigator::NavMeshData&&) /home/elsid/dev/openmw/components/detournavigator/navmeshtilescache.cpp:81
#2 0x55e37fe3c861 in DetourNavigator::updateNavMesh(osg::Vec3f const&, DetourNavigator::RecastMesh const*, osg::Vec2i const&, osg::Vec2i const&, std::vector<DetourNavigator::OffMeshConnection, std::allocator<DetourNavigator::OffMeshConnection> > const&, DetourNavigator::Settings const&, std::shared_ptr<Misc::ScopeGuarded<DetourNavigator::NavMeshCacheItem> > const&, DetourNavigator::NavMeshTilesCache&) /home/elsid/dev/openmw/components/detournavigator/makenavmesh.cpp:582
#3 0x55e37fb796ce in DetourNavigator::AsyncNavMeshUpdater::processJob(DetourNavigator::AsyncNavMeshUpdater::Job const&) /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:178
#4 0x55e37fb9a125 in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:144
#5 0x7f013f585c23 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
#6 0x7f013f8c63e8 in start_thread (/usr/lib/libpthread.so.0+0x93e8)
#7 0x7f013e91d292 in __GI___clone (/usr/lib/libc.so.6+0x100292)
2021-01-09 22:59:24 +01:00
Andrei Kortunov
8084a336b5
Replace zeroes and nulls by nullptrs
2020-11-29 11:14:07 +04:00
elsid
9b11b8a27b
Fix boundary check
2020-11-18 18:52:00 +01:00
Bret Curtis
0e0c091e15
add more optionals and casserts for windows
2020-10-25 01:34:04 +02:00
Bret Curtis
4a54d375cc
add cassert for windows
2020-10-25 01:31:05 +02:00
Bret Curtis
f6bead88a9
purge boost/optional.hpp headers
2020-10-25 00:58:44 +02:00
Bret Curtis
62b0781f7d
use std::optional instead of boost::optional
2020-10-25 00:33:41 +02:00
Bret Curtis
5a824d0333
components/compiler cleanup; also cleaned up related cascading warnings; fixed up final/override issues
2020-10-22 23:57:53 +02:00
Assumeru
72549651e0
Rework container resolution ( #3006 )
...
* Rework container resolution
* add optional argument to getCount
* remove now-redundant changes
* undo worldimp changes
* move save-fixing code to InventoryState
* replace Rng instances with Seeds
2020-10-13 17:46:32 +02:00
psi29a
9a912486f9
Merge branch 'deprecated-exception' into 'master'
...
Use C++11 exception specification
See merge request OpenMW/openmw!343
2020-10-13 13:31:48 +00:00
fredzio
460e69e92a
Get rid of warning: dynamic exception specifications are deprecated
2020-10-10 12:12:55 +02:00
elsid
7591d45008
Use memcpy to create navmesh key
...
Implementation with memcpy is ~13 times faster.
2020-10-08 19:55:56 +02:00
elsid
f637dc38bd
Add cached flag to update navmesh status
2020-10-08 19:55:55 +02:00
elsid
eb140ed15f
Write unknown status numeric value
2020-10-08 19:55:55 +02:00
elsid
7d73e73cad
Consider tile as not removed when it is not found
2020-10-08 19:55:55 +02:00
psi29a
0dc7715c35
Merge branch 'object_paging_retry' into 'master'
...
Object Paging
See merge request OpenMW/openmw!209
2020-06-16 08:21:54 +00:00
elsid
00197e1cd9
Optimize recast mesh size by vertex deduplication
2020-06-16 00:51:36 +02:00
elsid
b095ca6c86
Use actor speed to define area cost for pathfinding
2020-06-13 02:24:52 +02:00
elsid
439588d10e
Remove unused mOffMeshConnectionIds
2020-06-13 02:24:51 +02:00
bzzt lost a hitlab login
c1ebd9474b
stop navmesh updates when ai off
...
Signed-off-by: Bret Curtis <psi29a@gmail.com>
2020-06-13 00:22:28 +02:00
elsid
c4cd3b2c4f
Add pathgrid to navmesh as off mesh connection
2020-06-12 21:04:02 +02:00
elsid
14d0ca4cd3
Cast float to btScalar
2020-05-13 18:44:11 +02:00
elsid
b150d681a9
Update same navmesh tile with limited frequency
2020-05-01 18:05:58 +02:00
elsid
10daadefbe
Add missing include
2020-04-30 21:58:00 +02:00
Bret Curtis
b7f7aabd8b
Merge pull request #2806 from elsid/detournavigator_tests
...
Add detournavigator test for multiple worker threads
2020-04-30 14:48:02 +02:00
elsid
899a6b5aa3
Workaround for GCC 5 bug
...
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636
2020-04-29 13:54:52 +02:00
elsid
bd1ef4dd6d
Add detournavigator test for multiple worker threads
2020-04-26 22:00:55 +02:00
Alexei Dobrohotov
d42cb4f16d
Merge pull request #2805 from elsid/detournavigator_update_callback
...
Use callback to handle changed tiles
2020-04-26 22:52:40 +03:00
elsid
df6e85b619
Use callback to handle changed tiles
...
Instead of collecting changed tiles into a temporary vector.
2020-04-25 17:56:41 +02:00
elsid
7502db1570
Add number of thread jobs to update jobs stats
2020-04-25 17:51:50 +02:00
elsid
208a50340d
Specialize DetourNavigator::ObjectId ctor for pointers
...
To fix msvc error:
components\detournavigator\objectid.hpp(14,13): error C2440: 'reinterpret_cast': cannot convert from 'const T' to 'size_t'
with
[
T=unsigned long
]
2020-04-13 20:48:34 +02:00
Andrei Kortunov
2e7712a390
Fix C5204 warnings by adding default virtual destructors
2020-03-26 14:49:12 +04:00
elsid
5168f2059f
Compare revisions by equality to support overflow
2020-03-14 09:38:24 +01:00
elsid
7ae7cb181d
Support recast mesh rendering
2020-03-14 09:38:24 +01:00
elsid
349040ffb2
Use status codes to handle navigator errors instead of exceptions
...
For find path use case.
2020-02-04 22:33:56 +01:00
elsid
f7caeefddb
Fallback to straight path when navmesh and pathgrind are not available
2020-01-29 11:14:07 +01:00
elsid
1e106013a0
Use navmesh to find wander destination outside pathgrid for ground based actors
...
Use dtNavMeshQuery::findRandomPointAroundCircle from recastnavigation
2020-01-21 00:01:06 +01:00
Andrei Kortunov
3704acf857
Unify streams usage to support non-ASCII paths (bug #5239 )
2020-01-03 07:10:17 +04:00
Andrei Kortunov
cd81f81fb6
Initialize variables to avoid GCC warnings
2019-12-22 10:44:14 +04:00
elsid
7ec5a20c64
Filter recast mesh triangles by global bounding box
...
Except heightfields to reduce slow down.
2019-11-30 13:19:27 +01:00
elsid
7729e396b2
Fix exceptions logging
2019-11-30 10:33:14 +01:00
Andrei Kortunov
6832a2fa9a
Remove BOM from CPP files (allows to build OpenMW with LCC on Elbrus)
2019-05-21 19:22:34 +04:00
elsid
c683dc8565
Lock navmesh tile by thread while processing
...
To avoid duplicated work on a same tile by different threads.
If tile is locked by another thread, then post job into this thread queue.
2019-04-10 22:01:50 +02:00
Andrei Kortunov
14b756a692
Use a generic logging system for RecastNavigation
2019-04-08 20:31:21 +04:00
Bret Curtis
45221418bd
Merge pull request #2260 from elsid/fix_clean_unused_navmeshes
...
Fix clean unused navmeshes
2019-03-18 08:57:46 +01:00
elsid
4624f31788
Report navigator stats
2019-03-17 22:15:18 +03:00
elsid
8adc83f6e2
Fix clean unused navmeshes
...
weak_ptr doesn't have constructor for shared_ptr&& type, so ptr wasn't
moved, just copied.
2019-03-17 21:28:34 +03:00
elsid
dd0b45ede6
Do not pass nullptr to std::memcmp
2019-03-14 22:15:57 +03:00
Bret Curtis
cb1a5f3679
Merge pull request #2245 from elsid/navigator_refactor
...
Refactor navigator related code
2019-03-11 07:51:43 +01:00
Bret Curtis
7b793b8809
Merge pull request #2244 from elsid/navmesh_cache_item_refactor
...
Make NavMeshCacheItem consistent
2019-03-11 07:51:22 +01:00
elsid
68948bc847
Avoid key allocation to find tile in cache
2019-03-11 03:01:41 +03:00
elsid
849f2078c1
Swap outside critical section
2019-03-10 23:58:49 +03:00
elsid
8d2af94b75
Use default objects for NavigatorStub methods result
2019-03-10 23:58:49 +03:00
elsid
ece111d05a
Check for jobs using predicate
2019-03-10 23:58:49 +03:00
elsid
c05fc9e054
Add missing cleanup
2019-03-10 23:58:49 +03:00
elsid
ce9aebcba1
Clear all changed tiles after post
2019-03-10 23:58:48 +03:00
elsid
9d61c49478
Store key by reference in tiles map
2019-03-10 23:56:52 +03:00
elsid
614d5243c3
Make NavMeshCacheItem consistent
...
Move all logic related to this type into its methods.
2019-03-10 23:07:36 +03:00
elsid
f6a1d3cecf
Store weak pointers to navmesh in jobs queue
...
To avoid useless processing for removed navmeshes.
2019-03-10 17:06:19 +03:00
elsid
ccc709a316
Store guarded navmesh cache item in shared_ptr
...
Remove useless SharedGuarded type.
2019-03-10 17:06:19 +03:00
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.
2019-03-10 17:06:15 +03:00
Bret Curtis
c20e69ef24
Merge pull request #2227 from elsid/fix_twitchy_massive_creatures
...
Fix twitchy movement for massive creatures (bug #4907 )
2019-03-09 02:11:11 +01:00
elsid
b9f21ec81a
Use custom steps size to make smooth path depending on half extents
2019-03-08 22:33:34 +03:00
elsid
f2e47d640d
Add option to limit max number of navmesh tiles
2019-03-08 17:39:04 +03:00
elsid
ff47df4f2c
Repost navmesh update jobs when failed because of out of memory
...
DT_OUT_OF_MEMORY error is returned when limit of tiles is reached.
2019-03-08 17:39:04 +03:00
elsid
82e2739bae
Notify workers when only at least one job is posted
2019-03-08 15:27:16 +03:00
elsid
b9b8ed177c
Store priority values as named fields
2019-03-08 15:23:36 +03:00
elsid
0c16fef285
Add navmesh update status builder
2019-03-08 15:07:07 +03:00
elsid
14c9190f49
Move tile replacement into separate function
2019-03-08 15:06:11 +03:00
elsid
b6243e7d1f
Fix name styleguide
2019-03-08 15:02:49 +03:00
elsid
27d7452267
Update scaled objects in navigator
2019-03-04 22:59:39 +03:00
Bret Curtis
14c93b3df0
Revert "Merge pull request #2204 from elsid/fix_navigator_update"
...
This reverts commit 26fb0e7a0f
, reversing
changes made to 42b2391303
.
2019-03-04 11:06:15 +01:00
elsid
133d7447f3
Update scaled objects in navigator
2019-03-03 16:46:41 +03:00
Grigory Latyshev
3872d7476b
Move makeOsgVec3f() to settingsutils.hpp
...
Remove all other makeOsgVec3f() implementations
2019-02-28 20:03:42 +00:00
Andrei Kortunov
3032b177a1
Remove redundant includes
2019-02-23 08:02:12 +04:00
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.
2019-02-22 11:48:31 +03:00
Bret Curtis
09262e0336
Merge pull request #2170 from elsid/disable_navigator_option
...
Add option to disable DetourNavigator component (feature #4833 )
2019-02-18 16:01:30 +01:00
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.
2019-02-17 01:50:53 +03:00
elsid
9626b6ec42
Add option to disable DetourNavigator component to find paths
2019-02-16 15:50:58 +03:00
elsid
34c594f01e
Add default initializators for settings fields
2019-02-16 15:39:06 +03:00
elsid
16675fd254
Return empty path when navmesh is not found for agent
2019-02-16 15:37:06 +03:00
elsid
1d3668cd22
Add Navigator interface
2019-02-16 15:37:06 +03:00
elsid
d63881e054
Make Navigator::findPath independent from class fields
2019-02-16 15:14:05 +03:00
elsid
a0ed981a7c
Fix operator ++ for OutputTransformIterator
2019-02-16 15:09:57 +03:00
elsid
c68e64a2a7
Make navigator from settings manager setting in separate function
2019-02-16 14:41:11 +03:00
elsid
da431135fa
Use pointer to check is NavMeshTilesCache::Value initialized
2018-12-10 23:51:15 +03:00
elsid
aab7f2e8b9
Don't check for equality in move assignment
...
Assume it is undefined behavior to move-assing value to itself.
2018-12-10 23:45:31 +03:00
Andrei Kortunov
4ee15ddcb9
Fix many Coverity Scan warnings
2018-11-14 11:21:49 +04:00
Bret Curtis
9ae077c033
use c++11 std::align from <memory> ( #2026 )
...
* use c++11 std::align from <memory>
* for Ubuntu, use gcc5 instead of 4.8
* use travis to set gcc to 5
eval
and sudo
* use eval in .travis.yml
* use gcc-8
* replace precise with trusty llvm toolchain, because we have been using trusty for awhile now
* push things to matrix, so we can support multiple releases if we want
* we should not be allowing for failures, we are ready to start trusting clang and its analyzer
* scan-build was pushed to another package
* use gcc-8 still but wrap in scan-build
* travis.yml cleanup, have output of scripts go to stdout, make search for substring a regex
use double []
fix missing ,
use bash to use regex
black spaces matter
* set human readable names for our various builds, split out our static analysis between openmw and openmw-cs
* test if not set, then set otherwise ignore
* use quotes
* do not eval it, set it in travis env
* no more &&
* what does clang7 have to say?
* use sourceline for now
* use clang-7 instead of clang-7.0
* yes, llvm-toolchain-trusty-7 not llvm-toolchain-trusty-7.0
* for static analysis, openmw is compiled and checked on its own while openmw-cs is build with all the rest. this might change in the future.
and actually do it the other way around
2018-11-08 17:38:09 +01:00
Bret Curtis
a8d944e756
Merge pull request #2023 from elsid/navmesh_cache_limit
...
Navmesh cache limit
2018-11-05 07:51:48 +01:00
elsid
6e78fbb538
Double key size for item cache size
2018-11-05 02:21:19 +03:00
elsid
696bb9adc8
Add missing decrease for free navmesh data size
2018-11-05 02:21:18 +03:00
elsid
d2c2bdadb5
Add align implementation
2018-11-04 21:56:15 +03:00
elsid
b477775e16
Use callback to iterate over chunks
2018-11-04 18:34:31 +03:00
elsid
db5638bf6d
Add global recast allocator to allocate temp buffers on stack
2018-11-04 18:11:15 +03:00
Andrei Kortunov
a387c6b910
Fix MSVC2015 C4503 warning
2018-11-04 11:11:55 +04:00
Bret Curtis
261bbded00
Merge pull request #2016 from elsid/navmesh_update_change_type
...
Use new change type for update object
2018-11-03 17:30:05 +01:00
elsid
41319eb2bf
Use new change type for update object
...
To perform jobs for updated animated objects and doors with lowest
priority.
2018-11-03 16:44:23 +03:00
elsid
b77684a135
Add TODOs
2018-11-03 16:15:32 +03:00
elsid
2ba026e2b2
Limit navmesh cache size by data size + key size
2018-11-03 16:14:07 +03:00
AnyOldName3
0208cb8616
Merge pull request #2001 from AnyOldName3/enable-osg-logging
...
Allow OSG objects to be sent to the debug log.
2018-10-31 22:14:36 +00:00
AnyOldName3
4489f23005
Remove recastnavigation conflicts
2018-10-31 15:15:01 +00:00
Andrei Kortunov
a615076c61
Add default return value
2018-10-31 10:18:29 +04:00
elsid
50b6ae3e10
Fix calculation for shape local AABB
2018-10-28 16:58:22 +03:00
elsid
af2f4e8424
Allow to use zero cache size
2018-10-28 16:54:06 +03:00
elsid
abc51a8a17
Add settings option to set max number of polygons per navmesh tile
2018-10-28 15:36:47 +03:00
elsid
03d4ce5e49
Log find path exception with level verbose, add more info to message
2018-10-15 23:25:42 +03:00
elsid
dc2eb2e16b
Do not write to global log async navmesh updater exceptions
2018-10-15 22:47:07 +03:00
elsid
e57504ae7c
Lower log level
2018-10-13 22:22:15 +03:00
elsid
0f6a64ad54
Split makeNavMeshTileData
2018-10-13 22:22:15 +03:00
elsid
fb655cb04f
Remove macroses to check recastnavigation functions result
2018-10-13 22:22:15 +03:00
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.
2018-10-13 22:22:12 +03:00
elsid
69b5834c64
Add doc for Navigator
2018-10-13 22:16:35 +03:00
elsid
ae7285e960
Use ScopeGuarded instead of raw mutex
2018-10-13 22:16:35 +03:00
elsid
cf4066751c
Add classes to encapsulate value guarded by mutex
2018-10-13 22:16:35 +03:00
elsid
1a27489904
Add special type for object id
2018-10-13 22:16:35 +03:00
elsid
7c80bb9411
Support multiple threads for async nav mesh updater
2018-10-13 22:16:34 +03:00
elsid
ff478aba6d
Use actor half extent for interior cells
2018-10-13 22:16:33 +03:00
elsid
346e9e3141
Add off mesh connections for doors without teleport
2018-10-13 22:16:33 +03:00
elsid
d02beae5a8
Find path for actors according to their abilities to swim and walk
2018-10-13 22:16:33 +03:00
elsid
c95cea414c
Support water for NavMesh
2018-10-13 22:16:32 +03:00
elsid
72f211ef28
Add enums for area type and flags
2018-10-13 22:16:32 +03:00
elsid
fa23b590a4
Add unwalkable areas to NavMesh
2018-10-13 22:16:32 +03:00
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.
2018-10-13 22:16:31 +03:00
elsid
b33a291a67
Log thread id
2018-10-13 22:16:31 +03:00
elsid
e24d4d7052
Explicitly use RC_NULL_AREA constant to mark unwalkable areas
2018-10-13 22:16:31 +03:00
elsid
c3298d13a6
Add log sinks (stdout and file)
2018-10-13 22:16:31 +03:00
elsid
84949bedb1
Remove and add tile in single critical section
2018-10-13 22:16:30 +03:00
elsid
144e1a063b
Support animated objects
2018-10-13 22:16:30 +03:00
elsid
4aba0fa85f
Limit number of NavMesh tiles to add by distance from player tile
2018-10-13 22:16:30 +03:00
elsid
d2fd9abd51
Split RecastMesh into tiles
2018-10-13 22:16:30 +03:00
elsid
dbb1d99bff
Add NavMeshItem generation to fix update NavMesh for render
2018-10-13 22:16:30 +03:00
elsid
f268ec5d34
Measure total time for NavMesh build from first pop
2018-10-13 22:16:29 +03:00
elsid
c26773bd29
Log update NavMesh status
2018-10-13 22:16:29 +03:00
elsid
937e8e1803
Allow to create empty RecastMesh
2018-10-13 22:16:29 +03:00
elsid
dd5f4498f6
Increment NavMesh revision on remove or add tile
2018-10-13 22:16:29 +03:00
elsid
ed3a255f65
Do not use NavMesh to find changed tiles
2018-10-13 22:16:28 +03:00
elsid
d1e71f9322
Support btBoxShape for RecastMesh
2018-10-13 22:16:28 +03:00
elsid
70a369f70e
Add command to enable NavMesh render
...
togglenavmesh or tnm
2018-10-13 22:16:28 +03:00
elsid
1caa18bb4f
Use one recast mesh for all jobs
2018-10-13 22:16:27 +03:00
elsid
794cfc4aa3
Write detournavigator log to file
2018-10-13 22:16:27 +03:00
elsid
dd5e6a61a3
Support btCompoundShape for RecastMesh
2018-10-13 22:16:27 +03:00
elsid
373adc6ec4
Option to enable/disable file names revisions
2018-10-13 22:16:27 +03:00
elsid
f8909218ee
Store recast mesh bounds
2018-10-13 22:16:27 +03:00
elsid
d1d034a1ec
Update NavMesh one by one tile in order from nearest to player
2018-10-13 22:16:26 +03:00
elsid
41caca24ee
Options to enable/disable write recast mesh and nav mesh into file
2018-10-13 22:16:26 +03:00
elsid
6d233ae868
Option in settings to enable/disable detour navigator debug log
2018-10-13 22:16:26 +03:00
elsid
430ba9d7a5
Build NavMesh tile data only for changed tiles
2018-10-13 22:16:25 +03:00
elsid
fafba8ea0c
Use recastnavigation to find path
2018-10-13 22:16:25 +03:00