364 Commits

Author SHA1 Message Date
Kawe Mazidjatari
9f430a455e Recast: traverse over every tile in the array
dtNavMesh::getTileCount returns the total number of added tiles, the issue with this is that if the navmesh gets pruned, that means disabling unlinked polygons and removing dead tiles, then some tile instances in the m_tiles array may become empty. Less tiles will be installed and since there are null tiles in between, we won't be traversing each tile.
2024-10-13 21:36:46 +02:00
Kawe Mazidjatari
c9c687fc73 Recast: add bounds check for sweepscan indices
Only happens on extremely large and complex geometry.
2024-10-13 14:39:52 +02:00
Kawe Mazidjatari
248a652a15 Recast: add option for collapsing linked polygon groups
This is necessary for navmeshes with more than UINT16_MAX polygon islands. Building navmeshes for mp_rr_desertlands_64k_x_64k will hit this limit.
2024-10-13 14:36:09 +02:00
Kawe Mazidjatari
c0832b91d3 SDL: fix buffer overrun in SDL_strncmp
Always check len first before dereferencing the pointers.
2024-10-12 01:47:52 +02:00
Kawe Mazidjatari
dabedb2c8b ImGui: remove extraneous print 2024-10-08 23:24:13 +02:00
Kawe Mazidjatari
455b7220f9 ImGui: load and save imgui layout configuration from user cfg directory
Keep it separate from the system configurations.
2024-10-08 23:07:24 +02:00
Kawe Mazidjatari
3974ba70bb Tier0: separate launcher and imgui configs to user directory
Keep it separate from the system configurations.
2024-10-08 23:04:45 +02:00
Kawe Mazidjatari
7e1e4e902a Recast: remove extraneous comments
Should not be flipped.
2024-09-23 12:34:00 +02:00
Kawe Mazidjatari
d21565d00f Recast: use rdSwap for rdVectorBase::swap
Headers were reorganized a while back, clean this code up.
2024-09-23 12:31:31 +02:00
Kawe Mazidjatari
da37f898cf Recast: deduplicate XX_VERTS_PER_POLYGON constant
Must be synced between Recast & Detour.
2024-09-23 12:25:25 +02:00
Kawe Mazidjatari
fa1db8f995 Recast: clamp the off-mesh connection positions as well
Allows for parsing zipline positions from BSP entity partitions and placing them whilst also having it clamp the positions correctly to the polygon the zipliner will end up or start from.
2024-09-23 12:11:44 +02:00
Kawe Mazidjatari
b37a77d547 Recast: enforce consistency in intersection code
Some code uses different timing bounds. Enforce consistency between all code utilizing this.
2024-09-21 12:26:34 +02:00
Kawe Mazidjatari
eb6a3b37d2 Recast: implement intersection test for convex hulls
Similar to the intersection test for cylindric volumes. The old convex hull intersection test in the raycast algorithm is inaccurate and also doesn't calculate the hit time, which prevents the editor from placing the cursor at the intersection. Raycast algorithm is pending a refactor and its convex hull isect test will be replaced with this.
2024-09-21 12:22:02 +02:00
Kawe Mazidjatari
3a51c4f8c9 Recast: take cylinder caps into account during intersection test
Cylinder caps were not accounted for and thus tmin/tmax were never set causing incorrect ray tracing results when intersecting with a cylinder cap.
2024-09-20 21:54:24 +02:00
Kawe Mazidjatari
32f470f2ed Recast: add functions for checking if point is in cylinder and AABB 2024-09-20 16:00:23 +02:00
Kawe Mazidjatari
4640a81d09 Recast: add cylindric and AABB intersection functions
'rdIntersectSegmentCylinder' is a new function that will be used for intersection tests on cylindric clip volumes.
'rdIntersectSegmentAABB' was already present in the library, but used and reimplemented across multiple source files (pending deduplication).
2024-09-20 14:55:45 +02:00
Kawe Mazidjatari
f98b3b9bff Recast: fix order of cylinder vertex drawing (XZY -> XYZ)
Face normals were flipped after the coordinate system change. This patch solves the issue.
2024-09-20 11:43:55 +02:00
Kawe Mazidjatari
98756f1a0b Recast: reorder function
Was in between area markers, move it above.
2024-09-20 00:30:52 +02:00
Kawe Mazidjatari
11e83769b5 Recast: also assign flags to compact height field in rcMarkCylinderArea
This function is currently not in use, but will be used.
2024-09-20 00:18:23 +02:00
Kawe Mazidjatari
4083318f83 Recast: separate box creation code from renderer
Allow usage in external code.
2024-09-20 00:07:00 +02:00
Kawe Mazidjatari
4a9bfbe79a Recast: vastly improve reliability of land-side off-mesh link tile query
Instead of a box query, just take the position in the tile grid the land-side off-mesh vert is on. This vastly improves the query reliability for off-mesh links with a larger radius to the point it never fails if it is in a valid location. The box query isn't needed here as the off-mesh vert has to be on a tile, else the polygon box query will fail (unless its bounding box does happen to overlap with the point, but in this case the off-mesh connection is placed improperly causing the only factor to have its link established being luck).
2024-09-19 15:44:23 +02:00
Kawe Mazidjatari
b2d0db40ef Recast: properly flag off-mesh connection polygons
MSET 7 or higher needs proper off-mesh connection flags.
2024-09-19 00:11:49 +02:00
Kawe Mazidjatari
30570981e1 Recast: move poly flags and area enums to Detour NavMesh header
Also needs to be used in building and query code, moved to Detour NavMesh header.
2024-09-19 00:02:37 +02:00
Kawe Mazidjatari
d5fa52499c Recast: combine off-mesh link basing and land connection logic
Combine the 2 to avoid an extra loop. Also break out of tile grid loop as soon as a link has been established to save even more processing time.
2024-09-18 17:28:10 +02:00
Kawe Mazidjatari
8eaa349dbc Recast: assign dtOffMeshConnection::userId
Was never assigned properly.
2024-09-18 17:24:08 +02:00
Kawe Mazidjatari
b042327629 Recast: fix incorrect dtOffMeshConnection::userId offset
Field offset was incorrect for MSET 7 or higher.
2024-09-18 17:23:00 +02:00
Kawe Mazidjatari
1a0b6efae5 Recast: properly set traverse type fields in off-mesh connections for MSET 7 or higher
The structure was incorrect prior to this patch for MSET 7 or higher.
2024-09-18 11:41:33 +02:00
Kawe Mazidjatari
0b568488e3 RapidJSON: fix bug when parsing NaN, Inf with fraction or exponent parts
Merge Tencent/rapidjson@7c73dd7de7
2024-09-16 17:48:25 +02:00
Kawe Mazidjatari
a6d4a53021 Recast: make proper wrappers for radians and degrees conversion
Avoid bugs where radians gets converted to radians, or degrees to degrees.
2024-09-16 16:29:46 +02:00
Kawe Mazidjatari
a9ed8f66c4 Thirdparty: add AMD Anti-Lag 2 SDK
Not implemented yet.
2024-09-14 11:35:12 +02:00
Kawe Mazidjatari
36484dbb82 Recast: increase traverse link brightness 2024-09-04 22:47:58 +02:00
Kawe Mazidjatari
0b606b21fd Recast: improve code consistency 2024-09-04 22:47:36 +02:00
Kawe Mazidjatari
e019de8dcd Recast: make detail triangle flags enum shared
The same constants are used between Recast and Detour, but Recast had to declare and match the constant locally as it couldn't access the one from the Detour library. This patch avoids duplicate definitions and potential issues during refactors.
2024-09-04 16:19:19 +02:00
Kawe Mazidjatari
6050ce5555 Recast: boilerplate code and constants deduplication 2024-09-04 13:39:05 +02:00
Kawe Mazidjatari
d1bad5c130 Recast: add logic for setting polygon flags in convex hulls
User can now define a convex hull or box area, and set polygons flags as desired from the convex volume tool or through the project files.
2024-09-04 10:30:54 +02:00
Kawe Mazidjatari
0814efe613 Recast: API improvement; move traverse link algorithm to navmesh class
The algorithm has been moved to the dtNavMesh class, and now features a parameter based design allowing code that utilizes the algorithm to define engine-specific tests such as the raycasting, traverse masking, etc. The code can now be hooked up to any level editor without changing a line of code inside the Recast & Detour library. All parameters have been documented thoroughly. The code now also properly returns errors if out of memory, or if invalid parameters were provided. This commit does not affect the results of the traverse link generation, the navmesh remains identical to the one generated on the previous design.
2024-09-04 00:31:03 +02:00
Kawe Mazidjatari
1e92548624 Recast: move common definitions to separate header
Moved to separate header so they can be used everywhere.
2024-09-03 11:08:23 +02:00
Kawe Mazidjatari
98454cceab Recast: poly mesh cells are an MSET >= 8 only feature 2024-09-03 10:57:54 +02:00
Kawe Mazidjatari
807a327b6f Recast: fix compiler warnings caused by unused local variables 2024-09-03 01:52:22 +02:00
Kawe Mazidjatari
afab9c2206 Recast: fix crash in dtPathCorridor
Must alloc the jumpTypes array, currently not fully implemented yet.
2024-09-02 18:02:47 +02:00
Kawe Mazidjatari
652d8f9da0 Recast: remove invert parameter from rdCalcEdgeNormal*
Extraneous parameter.
2024-09-02 17:26:16 +02:00
Kawe Mazidjatari
603878d413 Recast: fix heap buffer overflow in createPolyMeshCells
Must iterate up to num detail tris for current detail mesh instead of total detail tris for entire tile mesh.
2024-09-02 17:17:21 +02:00
Kawe Mazidjatari
ec741313c2 Recast: fix stack corruption caused by out-of-scope variable usage
pmin and pmax pointed to these stack arrays, but these stack arrays were inside the loop while pmin and pmax, along with their usages were outside the scope of the loop causing undefined behavior when they pointed to the currently out-of-scope stack variables. Moved the arrays outside the loop so they remain valid up to the last point they are needed.
2024-09-02 15:40:29 +02:00
Kawe Mazidjatari
3e56daf398 Recast: properly handle out-of-memory situations during build
Return false if createBVTree or createPolyMeshCells fails as a result of memory allocation failure rather than crashing the application.
2024-09-02 15:36:23 +02:00
Kawe Mazidjatari
7071de1643 Recast: BVTree build bug fix and large optimization
dtMeshHeader::bvNodeCount is always set to polycount*2, but when we have null bv nodes, then these will also be used during dtNavMeshQuery::queryPolygonsInTile, which can yield incorrect results when the null nodes overlaps query box. Also added an additional optimization to only store non-null BV nodes which can save a significant amount of memory during the runtime. After this bug fix and optimization, the resulting mesh still works as intended in-game.
2024-09-02 15:20:59 +02:00
Kawe Mazidjatari
05cc26dfe5 Recast: tag semi and fully unlinked tiles with userid's
Fully unlinked can be removed entirely, semi unlinked needs a rebuild to remove unlinked polygons (still work in progress). Added ability to automatically remove fully unlinked tiles.
2024-09-02 12:25:15 +02:00
Kawe Mazidjatari
66cf9678d2 Recast: add method for marking cells as occupied 2024-09-01 00:01:51 +02:00
Kawe Mazidjatari
3227208533 Recast: fix signed/unsigned mismatch 2024-08-31 23:40:21 +02:00
Kawe Mazidjatari
ec115d7c97 Recast: start of jump type implementation in findStraightPath 2024-08-31 23:03:44 +02:00
Kawe Mazidjatari
ab88364779 Recast: fix comment location 2024-08-31 15:59:36 +02:00