4236 Commits

Author SHA1 Message Date
Amos
d669d18a86 Recast: add missing mset version directive
Not for MSET < 7.
2024-07-26 00:25:10 +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
73d0e81983 Recast: update development code
Used for debugging an unknown array.
2024-07-24 23:40:21 +02:00
Amos
c7adefa56c Recast: update poly area's for MSET >= 7
These should be the poly area enumerants for MSET version 7 or higher.
2024-07-24 23:39:39 +02:00
Amos
ce4d4aa598 Recast: add ability to load navmesh from file. 2024-07-24 22:03:09 +02:00
Amos
ebfc4ec091 Recast: implement polygon cell generation algorithm
Fully generates polygon cells for the entire navmesh. Previously we never build this which caused ai to clip into, or walk into each other in-game (this system is an MSET 8 feature).
2024-07-24 11:30:00 +02:00
Amos
0269882bea Recast: temporarily comment out development code 2024-07-24 11:21:37 +02:00
Amos
2a45ced5f4 Recast: fix compile error caused by missed version checks 2024-07-24 10:26:41 +02:00
Amos
1c637230d5 Recast: fix comment 2024-07-24 10:25:35 +02:00
Amos
aba31e5a75 Recast: add notes to duplicate functions 2024-07-24 10:25:24 +02:00
Amos
50d3e1dc32 Game: fix compile error
Caused by making dtNavMesh fields private.
2024-07-24 10:24:58 +02:00
Amos
99db511930 Recast: add option to draw tile cells
MSET 8 or higher only.
2024-07-22 18:49:12 +02:00
Amos
49a0ceb148 Recast: initial implementation of multi-set support
Allow to compile the editor for separate versions of the navmesh set. NavMesh cells are now also partially reversed and properly read out. Creating and writing them will happen in the future.
2024-07-22 18:48:41 +02:00
Amos
38223fb6f3 Recast: properly skip over intermediate poly data
Needs to be multiplied by sizeof(int).
2024-07-21 23:23:48 +02:00
Amos
bff3bfd5ea Recast: add missing prefix to utility function
Needs to be prefixed with 'dt' for consistency and to avoid cluttering the global namespace.
2024-07-21 22:27:55 +02:00
Amos
79cbf2e1dd Recast: move file types to main header
Need to be available to everything.
2024-07-21 21:46:22 +02:00
Kawe Mazidjatari
b56649facb Recast: add some debug drawing for unknown dtOffMeshLink field 2024-07-19 01:09:15 +02:00
Kawe Mazidjatari
7d5c07b2e7 Recast: fix compiler warning and floor value
Value of dtCalcLinkDistance has to be floored to match Titanfall 2 values.
2024-07-19 00:01:11 +02:00
Kawe Mazidjatari
e57e85b88a Recast: initial implementation of jump links for off-mesh links
These should set them up properly in theory. Needs testing.
2024-07-18 23:58:39 +02:00
Kawe Mazidjatari
f170e2b6f3 Recast: remove all duplicate epsilon definitions
Make a constant in the math library.
2024-07-18 19:00:53 +02:00
Kawe Mazidjatari
5ec7862b71 Recast: more missed XZY -> XYZ changes 2024-07-18 18:06:34 +02:00
Kawe Mazidjatari
98a8898a43 Recast: fix bug in dtNavMesh::findNearestPolyInTile (XZY -> XYZ)
Hight should always be on the Z axis.
2024-07-18 17:05:08 +02:00
Kawe Mazidjatari
740c593197 Recast: setup off-mesh connections properly (WIP)
Titanfall navmeshes have the dtOffMeshConnection::userId field changed from unsigned into to unsigned short, and the lower half seems to be used for the jump types and (possibly) some flag. Work in progress implementation of the jump system on off-mesh links.
2024-07-18 17:00:31 +02:00
Kawe Mazidjatari
193ec6aec7 Recast: fix compile error
Should've been pushed with commit fce53b6eed985a323846dff7dbcbd0b67cae7928
2024-07-18 15:56:36 +02:00
Kawe Mazidjatari
fce53b6eed Recast: update dtLink variable names and assignments
Light cleanup and added new names and documentation of what's currently know.
2024-07-18 15:49:51 +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
78a632eec8 Recast: add new constants for traverse links
These constants will be used for creating working jump links and debugging them.
2024-07-18 14:19:26 +02:00
Kawe Mazidjatari
31e3ddb498 Recast: make dtNavMeshQuery::getEdgeMidPoint() public
Will be used for debug drawing and jump links.
2024-07-18 14:17:25 +02:00
Kawe Mazidjatari
a7b1389e14 Recast: add tool to mark polygon by its ref 2024-07-18 00:59:39 +02:00
Kawe Mazidjatari
93439d9055 Recast: make polygon draw softening optional 2024-07-18 00:58:20 +02:00
Kawe Mazidjatari
c22675af86 Recast: rename reversed field in dtQueryFilter
Type is a 32bit integer and is used for checking traverse (jump) types.
2024-07-17 17:54:16 +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
3b10774ca4 Recast: light cleanup in off-mesh connection renderer 2024-07-17 02:03:37 +02:00
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