13 Commits

Author SHA1 Message Date
Amos
9dcb1dd86c Recast: move navmesh loading logic into single function
Make sure tools are always initialized properly whenever a navmesh is loaded.
2024-07-26 01:22:56 +02:00
Amos
034c0f07d4 Recast: fix navmesh query crash regression
Caused in commit ce4d4aa59831fbb6a2b7c32820561b321484dc56. Need to properly free and set the navmesh pointer.
2024-07-24 23:53:14 +02:00
Amos
ce4d4aa598 Recast: add ability to load navmesh from file. 2024-07-24 22:03:09 +02:00
Kawe Mazidjatari
12f39f1c44 Recast: add traverse links debug drawing
Originally taken from https://github.com/ASpoonPlaysGames/r2recast, slightly modified to use the new constants added in commit 78a632eec85ca5406adb03617084746b446b0044, and now renders white crosses if reverse links are set.
2024-07-18 14:22:14 +02:00
Kawe Mazidjatari
38f57d95ad Recast: several large improvements
The dtNavMesh structure members were marked as public, but they should be private. Made them private. Also, dtNavMesh::addTile was reconstructing all links, even when we add tiles with pre-existing links. The link building logic has been moved to a new member function 'dtNavMesh::connectTile'. This should only be called once the navmesh tile has been added succesfully during build. If we load a navmesh now, the existing links will be used from now on. The dtNavMesh::m_tileCount member is now also correctly incremented and decremented in addTile/removetile.
2024-07-17 17:51:01 +02:00
Kawe Mazidjatari
a37797d4bd Recast: disable duplicate rendering of off-mesh connections
Don't render the geom off-mesh connection, this is already done when the tool is enabled, and we don't want to render it outside the tool since it would overlap with the built off-mesh connection.
2024-07-17 00:41:35 +02:00
Kawe Mazidjatari
2888930893 Recast: explicitly init current tool
Tool states aren't always set, they are typically only set for the active tool if an option changed, but if nothing changed, then nothing will get updated (including the navmesh handle) so dangling pointers will be used. This makes sure everything gets initialized.
2024-07-16 17:03:14 +02:00
Kawe Mazidjatari
be50fa5cb5 Recast: draw original navmesh bounds if changed
This is useful when a project file (.GSET) has been loaded with predetermined navmesh bounds, which allows you to check the new bounds to the old, and also see what you will be resetting too if mistakes were made during the modification thereof.
2024-07-16 13:59:12 +02:00
Kawe Mazidjatari
62a65df532 Recast: always show the actual mesh bounds
When loading from .gset, the editor would clip anything outside the stored bounds, but we still need the outer bounds as otherwise editing the existing bounds would be a lot harder.
2024-07-16 12:39:36 +02:00
Kawe Mazidjatari
5f90ea08f2 Recast: make all math helpers shared
There was an issue where Recast's common math library was less complete than that of Detour. Some common math operations were also isolated in specific translation units causing copies everywhere. All common math operations have been moved to the Shared library ultimately fixing all the above issues.
2024-07-15 19:27:55 +02:00
Kawe Mazidjatari
a99f3f3eb3 Recast: add option to adjust navmesh bounding area
User can now define where the navmesh will be build and what would be excluded in the map. Also adjusted some colors of existing bounding boxes to make them more visible. They weren't as visible as they used to be after the UX and rendering improvements.
2024-07-15 11:58:09 +02:00
Kawe Mazidjatari
0edf5c1717 Recast: add ability to offset Recast and Detour debug drawing
New ability to adjust it in all directions, recast and detour offsets are separate. By default, the Recast mesh renders 20 units from the input geom and Detour 30 units to avoid z-fighting.
2024-07-14 18:34:13 +02:00
Kawe Mazidjatari
f95eb13ab3 Recast: tilemesh editor refactor
Move common code to Editor_Common and fix solomesh. Solomesh is useful for debugging recast as it allows for generating everything in 1 tile. Also did numerous fixes for the tilecache code, though this is still broken and won't be really used for the r5sdk project, but its nice to have for a potential project outside r5sdk that uses the xyz coordination system, which avoids having to run the navmesh through a conversion pass in runtime.
2024-07-12 13:01:47 +02:00