3953 Commits

Author SHA1 Message Date
Kawe Mazidjatari
81e058b1ca Recast: fix typo in comment 2024-07-17 01:48:59 +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
fd234b8550 Recast: improve rendering of off-mesh connections
Make the line always blue, and render a cross if the start and/or the end position has been set correctly.
2024-07-17 00:40:44 +02:00
Kawe Mazidjatari
444172533e Recast: numerous changes for jump links (WIP)
EditorPolyAreas::EDITOR_POLYAREA_JUMP is supposed to be right after EDITOR_POLYAREA_GROUND, this enumerant has been moved there (in exchange of water which is as far as i can tell unused). For the off-mesh connection tool the flags have to be set to EDITOR_POLYFLAGS_WALK (this is what Titanfall 2 does). Off-mesh links don't work yet, more work is needed in dtLink.
2024-07-17 00:39:25 +02:00
Kawe Mazidjatari
243bd3348e Recast: update stack variable name
Match structure field name.
2024-07-16 20:51:04 +02:00
Kawe Mazidjatari
dda4e0e1bc Recast: look for project files first
Always look for project files first.
2024-07-16 20:28:22 +02:00
Kawe Mazidjatari
3b1d880ea6 Recast: properly clamp navmesh bounds
Make sure it can never be inverted, or extruded beyond the input geom's bounds.
2024-07-16 20:25:20 +02:00
Kawe Mazidjatari
961b4e2e51 Recast: fix bugs in dtNavMesh::addTile and dtCreateNavMeshData
Some data that is in between the poly's and links weren't skipped properly. The engine skips this data in dtNavMesh::addTile, we didn't. This is now skipped properly by advancing over it before going over the links. The 2nd and 3rd bug was that the poly's end pointer, and off-mesh connections end pointer was set to the data size of the poly's and off-mesh connections rather than the poly and off-mesh con count. This small oversight has been fixed and the end pointers are now set correctly. The function dtCreateNavMeshData has also been updated to take this data into account correctly, it was using the Titanfall 2 NavMesh (NavMesh Set Version 5), structure sizes but this has been changed in Apex (NavMesh Set Version 7 and 8). These fixes did reduce the NavMesh's file size by a few kilobytes per megabyte.
2024-07-16 19:35:08 +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
b5eb23c956 Recast: improve box shading
Make voxels easier to see by making each face appear slightly lighter/darker.
2024-07-16 15:58:03 +02:00
Kawe Mazidjatari
1d2dd0a2d5 Recast: fix indices for debug box (XZY -> XYZ)
the box's shape rendered correctly, but the faces were in the wrong order. The top face was on the side, so the voxel debug view didn't render correctly.
2024-07-16 15:43:53 +02:00
Kawe Mazidjatari
f9a7b01f65 Recast: look for .GSET files first
When explicitly looking, show .GSET assets first.
2024-07-16 13:59:56 +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
2ad55ede56 Recast: fix nullptr crash on Editor::m_geom
Should be checked, can be null.
2024-07-16 11:58:51 +02:00
Kawe Mazidjatari
f64696d18b Recast: improve unlinked poly bounds color
The thickness of the bounds were increased, so the red one doesn't need to be darker anymore. Previously it was hard to see compared to the blue poly's.
2024-07-16 11:51:33 +02:00
Kawe Mazidjatari
8c4bcc13d7 Recast: move bit cell code to SharedCommon 2024-07-16 11:49:41 +02:00
Kawe Mazidjatari
abc8b0db1e Recast: fix formatting in recast debug draw 2024-07-16 02:40:32 +02:00
Kawe Mazidjatari
4605fcf227 Recast: fix variable name (XZY -> XYZ) 2024-07-16 02:34:58 +02:00
Kawe Mazidjatari
dfa5996ce1 Recast: deduplicate more math operations 2024-07-16 02:32:31 +02:00
Kawe Mazidjatari
1853b571c5 Recast: use math functions from Recast & Detour itself
Make the code base more consistent.
2024-07-16 02:08:06 +02:00
Kawe Mazidjatari
54c00591d1 Recast: update tile cache editor implementation and add to compile list
Update with recent draw offset and math sharing changes.
2024-07-16 01:50:13 +02:00
Kawe Mazidjatari
54cc73535e Recast: reorder and initialize dtPathCorridor vector members
Properly initialize them and pack them nicely into its struct.
2024-07-16 01:35:41 +02:00
Kawe Mazidjatari
cf755b286b Recast: fix missed XZY -> XYZ conversion in dtNavMesh::getPolyHeight
Should set height to Z.
2024-07-16 01:18:01 +02:00
Kawe Mazidjatari
5c467f5a49 Recast: also hook up depth test option for duDebugDrawNavMeshPoly 2024-07-16 00:58:50 +02:00
Kawe Mazidjatari
9e37300c41 Recast: fix more missed XZY -> XYZ conversions
Most/all of these functions weren't used for the game, but they should still be converted to XYZ.
2024-07-16 00:57:21 +02:00
Kawe Mazidjatari
166ecabae8 Recast: make horizontal scroll wheel move sideways
UX improvements.
2024-07-15 21:12:48 +02:00
Kawe Mazidjatari
b3ce300338 Recast: properly split PCH between library and editor
Both were using the same PCH, but the recast library doesn't need anything from SDL or ImGui, properly split them apart and cleaned up includes.
2024-07-15 20:53:38 +02:00
Kawe Mazidjatari
000703b3d9 Recast: make unexpected poly area's orange
Red is already used for unlinked polygons.
2024-07-15 20:12:31 +02:00
Kawe Mazidjatari
5a09fc39c8 Recast: fix bug in rdVisfinite2D (XZY -> XYZ)
Should be checking the x-y plane instead, issue was spotted during the creation of commit 5f90ea08f210e8a327e70e48afc770404f850fda.
2024-07-15 19:31:48 +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
13db18f700 Recast: fix crash caused by null navmesh
Make sure there is a navmesh before attempting to build static pathing data. The crash gets triggered when loading geometry, and trying to build a tile without generating the navmesh first.
2024-07-15 17:09:01 +02:00
Kawe Mazidjatari
400a71ae05 Recast: update stack variable name
It now checks for keyboard and mouse, not only mouse.
2024-07-15 16:41:05 +02:00
Kawe Mazidjatari
15c809413f Recast: add support for horizontal scroll wheels
Properly check both scroll values.
2024-07-15 16:37:54 +02:00
Kawe Mazidjatari
2db0f40ec1 Recast: fix z-fighting properly
The near clip plane has been increased significantly. This was never adjusted correctly with the large scale change that was done to make Recast work with the scale of Titanfall and Apex maps. The near clipping is still minimal but the z-fighting problem has been fixed entirely. The offset for Recast and Detour debug drawing have also been reduced significantly as a result, since they no longer need to be offset that much. Also removed a comment regarding the projection matrix since we have to adjust the projection matric for XYZ rendering.
2024-07-15 16:37:09 +02:00
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