3968 Commits

Author SHA1 Message Date
Kawe Mazidjatari
71ac40cbe5 Recast: hull width should be multiplied by scale
Hull human wasn't able to reach places where it should. Multiplying it with its scale (0.5), makes them able to do so, and the navmeshes also look very similar to Titanfall 2 navmeshes around door frames and corridors now.
2024-07-15 14:21:38 +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
dbe35ce53f Recast: add rcVset and rcVequal
In the future, these common math operations needs to be shared between recast and detour so we don't need to copy them!
2024-07-15 11:56:13 +02:00
Kawe Mazidjatari
d4426ef534 Recast: adjust max slope and add detailed comment 2024-07-15 01:37:44 +02:00
Kawe Mazidjatari
3af7039df5 Recast: disable depth testing by default for navmesh
The depth testing is useful when rendering the navmesh without a background (e.g. disabling the rendering of the input geom). But when rendering with the geometry, it should be disabled as otherwise some data will overlap and become invisible (the off-mesh links or poly verts, or boundaries when looking from a tilted perspective).
2024-07-15 00:56:25 +02:00
Kawe Mazidjatari
22e25964c6 Recast: don't apply keyboard movement if imgui wants it
Fix a bug where causing the camera to still move while using the keyboard on the GUI.
2024-07-15 00:26:44 +02:00
Kawe Mazidjatari
3f2de9ac6d Recast: improve navmesh rendering
Make boundaries and vertices a bit more thin and make vertices more dark.
2024-07-14 20:43:57 +02:00
Kawe Mazidjatari
fe38aaaae6 Recast: remove deprecated function declaration
This function was originally 'duDebugDrawHeightfieldLayers', it was once renamed by the Recast authors, but the old declaration has never been removed.
2024-07-14 18:35:34 +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
ba33e46308 Recast: clamp min of cell size and cell height
Going below a cell size of 12 will cause bad artifacts during the rasterization of the navmesh as the voxel mold would be too detailed. Also clamped the min of the cell height to 0.4 since any value below that will result in no navmesh getting generated on correct topology, so no point going lower.
The original min values for size and height were 0.1, but due to the scale differences with our maps and what recast was originally configured with, adjustments had to be made.
2024-07-13 21:36:11 +02:00
Kawe Mazidjatari
218634cb7e Recast: slight rendering improvements
- Make NavMesh light blue (original color, but more solid and vibrant).
- Make Recast poly mesh and height field's darker blue, but more opaque.
- Increase render thickness of outer poly boundaries (should and will be an option in the debug class soon).
- Increase render size of poly verts (should and will be an option in the debug class soon).
- Make gradient background color slightly more uniform with the GUI.
2024-07-13 21:29:37 +02:00
Kawe Mazidjatari
e740c32066 Recast: fix typo in comment 2024-07-13 15:10:48 +02:00
Kawe Mazidjatari
aa128dfbfa Recast: proper agent definitions
Agent's height should not be multiplied by its scale, but rather the agent's climb height. It should also be lower than the agent's height. So an agent of height 75 should have a climb height of height * scale, which for human is 36 (72 * 0.5). Also increased the max clamp for the "Max Climb" slider.
2024-07-13 15:05:13 +02:00
Kawe Mazidjatari
d2b1b21183 Recast: more variable renames (XZY -> XYZ)
No logic was changed in this commit.
2024-07-13 13:42:37 +02:00
Kawe Mazidjatari
f01e7ae55a Recast: fix bug in rcMarkCylinderArea (XZY -> XYZ)
Stack variable 'miny' should be nulled if its < 0. This was missed during the XZY -> XYZ conversion.
2024-07-13 13:11:38 +02:00
Kawe Mazidjatari
975fa0ebbe Recast: fix a few more incorrect variable names (XZY -> XYZ)
Missed during XZY -> XYZ conversion. No logic in code was changed.
2024-07-13 13:09:54 +02:00
Kawe Mazidjatari
492fea89f6 Recast: fix incorrect vertex flip in dtNavMeshQuery::raycast
This shouldn't be flipped.
2024-07-13 12:04:35 +02:00
Kawe Mazidjatari
fadb53cb46 Recast: fix tile tool not rebuilding static pathing data
Static pathing data is only build when the entire navmesh is build, but if an individual tile has been created, then the data isn't rebuild to accommodate the changes. Building code has been moved to the base class as it should be used for all tile editors, and is now also called from other code paths that require it.
2024-07-13 11:43:18 +02:00
Kawe Mazidjatari
4a3beeb658 Recast: remove old code
This was properly implemented in commit dc5777145e02dc1af8af170c51b61690e30d0ab2, this code is no longer of use.
2024-07-13 11:29:56 +02:00
Kawe Mazidjatari
727a4377ba Recast: reset poly mesh area flags after build
Flags are changed to game specific flags, but never reset after build causing the recast debug draw to be incorrect. Reset area flags to fix this issue.
2024-07-13 11:27:57 +02:00
Kawe Mazidjatari
dc5777145e Recast: properly implement poly debug text overlay
Properly implemented with toggles in the tile tool.
2024-07-13 01:43:01 +02:00
Kawe Mazidjatari
6a3bc50778 Recast: dtCalcPolySurfaceArea cleanup
j -> i.
2024-07-13 00:39:58 +02:00
Kawe Mazidjatari
912a30610f Recast: fix regression causing tile size slider to not work
Regression was caused in commit f95eb13ab30c78c03c38aa20492389d0fdf39a7f. The m_tileSize member was moved to the base class as this allows us to run the navmesh type selector in the base class which is subclassed by all the other 3 editors. The member wasn't removed from the tilemesh editor class causing it to shadow the base class one.
2024-07-13 00:39:25 +02:00
Kawe Mazidjatari
b76f613bd7 Recast: double max clamp for tile size
Allow building larger tiles for test scenarios.
2024-07-13 00:34:48 +02:00
Kawe Mazidjatari
0eea1ea0ce Recast: rename convex tools
Renamed them to brushes, and renamed the ground brush to clip to be more consistent with the naming convention of the tools used for Source Engine and this particular game.
2024-07-13 00:28:21 +02:00
Kawe Mazidjatari
7c53cdca2b Recast: fix incorrect quantization for poly surface area
Factor should be 100, as 512x512 tiles with only 4 verts in Titanfall navmeshes are 5242, ours are twice as large +1. Our tiles are also 512x512 for small to medium navmeshes, and this constant results in nearly identical values, it was still off with 1 (5243 vs 5242).

Probing another poly in a Titanfall 2 navmesh, resulted in a polygon surface area of 1152.0, quantized by 100 is 11.52, the value stored in the Titanfall 2 navmesh was 11 so the value needs to be floored.

The values are now identical between custom and original navmeshes.
2024-07-12 22:29:16 +02:00
Kawe Mazidjatari
f5834c6077 Recast: fix more compiler errors caused by rename mistake
Mistake was made in commit 2f9776d495f6a5c7bedccc3566b81d41d28e09f6, corrected.
2024-07-12 22:25:11 +02:00
Kawe Mazidjatari
9fa6b6c42a Recast: fix compiler error
New function wasn't renamed correctly, fixed rename error.
2024-07-12 22:14:05 +02:00
Kawe Mazidjatari
6b86c9bc1b Recast: fix comment 2024-07-12 21:40:16 +02:00
Kawe Mazidjatari
c04aa735ff Recast: code deduplication
Use new function introduced in commit 2f9776d495f6a5c7bedccc3566b81d41d28e09f6.
2024-07-12 21:39:45 +02:00
Kawe Mazidjatari
2f9776d495 Recast: properly set dtPoly::surfaceArea
This field has been reverse engineered and set correctly in this commit. The field contains the quantized surface area of the polygon.
2024-07-12 21:38:50 +02:00
Kawe Mazidjatari
61705cb85e Recast: add dtMathRoundf 2024-07-12 21:34:00 +02:00
Kawe Mazidjatari
e8753cdd14 Recast: fix more comments 2024-07-12 16:09:05 +02:00
Kawe Mazidjatari
1c748b2227 Recast: improve clarity for UI toggle
It was unclear whether this was for toggling all details at once, or showing toggled details on all crowds. It was the latter, improved checkbox naming.
2024-07-12 14:49:49 +02:00
Kawe Mazidjatari
533d6c33e1 Recast: update documentation accordingly to XZY -> XYZ change 2024-07-12 14:14:26 +02:00
Kawe Mazidjatari
67db52508b Recast: fix typo's in comments 2024-07-12 14:13:49 +02:00
Kawe Mazidjatari
88052ba558 Recast: fix poly detail height bug when height isn't found
The height couldn't be found on some edge case scenarios (typically complex geometry), but in these cases the height was still set to (unsigned short)-1, causing it to return a height very far into positive Z. The vert would therefore appears very far into the sky. This patch fixes this problem.
2024-07-12 14:13:08 +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
Kawe Mazidjatari
59a8f12e0e Recast: allow setting table count in dtNavMesh::init
Needed for pre-allocation on solo mesh.
2024-07-12 12:53:43 +02:00
Kawe Mazidjatari
5d34723773 Recast: adjustments for tile cache
Tile cache still doesn't generate properly, these fixes are the start.
2024-07-12 12:52:30 +02:00
Kawe Mazidjatari
06ba52d4e6 Recast: light cleanup 2024-07-12 12:49:41 +02:00
Kawe Mazidjatari
ba23bfa471 Recast: set font to DroidSans
The original font the navigation editor shipped with.
2024-07-11 13:55:19 +02:00
Kawe Mazidjatari
2fd3eda52a Recast: fix item ID collisions
Exclude Flags didn't work as they shared the same item ID's as Include Flags, and Include Flags was before Exclude Flags. Both have unique ID's now.
2024-07-11 13:54:39 +02:00
Kawe Mazidjatari
69ee9d07a3 Recast: remove extraneous include
Use the non-std version of isfinite instead.
2024-07-11 09:31:48 +02:00
Kawe Mazidjatari
f7d9cefc80 Recast: remove mesh import flipping code
This was initially implemented to work around a normal flipping bug caused by the BSP to OBJ converter script, and the way Blender exports assets (it flips the axis on export). Removed code as we should instead use the fixed scripts and properly export the adjusted models from the DCC tools.
2024-07-11 09:26:05 +02:00
Kawe Mazidjatari
d38bdd1abd Recast: improve text and value representation on GUI
Small UX improvement.
2024-07-11 09:22:08 +02:00
Kawe Mazidjatari
5955ac7864 Recast: fix incorrect comment (XZY -> XYZ)
Raycast ignores the z-value after the XZY to XYZ change, previously it was the y-value.
2024-07-11 09:20:55 +02:00
Kawe Mazidjatari
d386a676d2 Recast: fix regression in NavMeshTesterTool
Caused by the implementation of dtNavMesh::isGoalPolyReachable. when this was false, everything was reset, including the start polyref causing "Set Random End" to always fail. isGoalPolyReachable also wasn't supposed to be checked on every mode, e.g. the neighbourhood or poly circle mode doesn't rely on a goal polyref.
2024-07-11 09:19:51 +02:00
Kawe Mazidjatari
e999871b32 Resource: sdk resource file cleanup 2024-07-11 02:01:26 +02:00
Kawe Mazidjatari
b35266682b Recast: use SDL log wrappers for warnings/errors instead 2024-07-11 02:00:40 +02:00