Added recast navmesh.

This commit is contained in:
Justin Marshall
2026-05-22 21:59:30 -07:00
parent d24553b366
commit b0788b922e
31 changed files with 11241 additions and 20 deletions
+29
View File
@@ -435,6 +435,10 @@ idAASLocal::SetAreaState
bool idAASLocal::SetAreaState( const idBounds &bounds, const int areaContents, bool disabled ) {
idBounds expBounds;
if ( recastNavMesh.IsLoaded() ) {
return recastNavMesh.SetAreaState( bounds, areaContents, disabled );
}
if ( !file ) {
return false;
}
@@ -537,6 +541,10 @@ idAASLocal::AddObstacle
aasHandle_t idAASLocal::AddObstacle( const idBounds &bounds ) {
idRoutingObstacle *obstacle;
if ( recastNavMesh.IsLoaded() ) {
return recastNavMesh.AddObstacle( bounds );
}
if ( !file ) {
return -1;
}
@@ -557,6 +565,10 @@ idAASLocal::RemoveObstacle
============
*/
void idAASLocal::RemoveObstacle( const aasHandle_t handle ) {
if ( recastNavMesh.IsLoaded() ) {
recastNavMesh.RemoveObstacle( handle );
return;
}
if ( !file ) {
return;
}
@@ -576,6 +588,11 @@ idAASLocal::RemoveAllObstacles
void idAASLocal::RemoveAllObstacles( void ) {
int i;
if ( recastNavMesh.IsLoaded() ) {
recastNavMesh.RemoveAllObstacles();
return;
}
if ( !file ) {
return;
}
@@ -1002,6 +1019,10 @@ bool idAASLocal::RouteToGoalArea( int areaNum, const idVec3 origin, int goalArea
travelTime = 0;
*reach = NULL;
if ( recastNavMesh.IsLoaded() ) {
return recastNavMesh.RouteToGoalArea( areaNum, origin, goalAreaNum, travelFlags, travelTime, reach );
}
if ( !file ) {
return false;
}
@@ -1151,6 +1172,10 @@ int idAASLocal::TravelTimeToGoalArea( int areaNum, const idVec3 &origin, int goa
int travelTime;
idReachability *reach;
if ( recastNavMesh.IsLoaded() ) {
return recastNavMesh.TravelTimeToGoalArea( areaNum, origin, goalAreaNum, travelFlags );
}
if ( !file ) {
return 0;
}
@@ -1175,6 +1200,10 @@ bool idAASLocal::FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 ori
idVec3 v1, v2, p;
float targetDist, dist;
if ( recastNavMesh.IsLoaded() ) {
return recastNavMesh.FindNearestGoal( this, goal, areaNum, origin, target, travelFlags, obstacles, numObstacles, callback );
}
if ( file == NULL || areaNum <= 0 ) {
goal.areaNum = areaNum;
goal.origin = origin;