Files
WT-Offline/tools/navgen/bake/build.ps1
T
N0VAN0M4LY 842ee23fa4 feat(ground-ai): add offline tank navmesh and cover baking prototype
Add Stage 0 offline map geometry extraction and Recast/Detour baking tools for ground AI navigation on feat/tank-ai-nav:

- Vendor upstream recastnavigation Recast and Detour sources (zlib license) under native/third_party/recastnavigation.
- Define shared .wtogeo and .wtonav binary layouts in native/wto-nav/wto_nav_format.h.
- Add mission-bounds.mts to collect union ground battle areas, spawns, and capture zones across mission templates.
- Add Rust extractor (tools/navgen/extract) using wt-unpack and config/rendinst_dmg.blk destructionImpulse thresholds to classify hard solids, bridges, crushable objects, and tree trunks in Dagor world space.
- Add multi-threaded MSVC C++ baker (tools/navgen/bake) producing 3 vehicle-width tiled Detour navmeshes, island pruning, dual-height voxel tank covers (full, hull-down, corner peek, retreat-verified), 8m tactical grids, and spawn-to-cap connectivity checks.
- Add zero-dependency PNG top-down preview renderer (tools/navgen/render-preview.py).

Verified: Rust release build (0 warnings), MSVC x64 baker build (0 warnings), root typecheck, and end-to-end extraction/baking/100% 3-tier connectivity and preview rendering on avg_berlin, avg_poland, and avg_hurtgen (2.61.0.58).
2026-12-04 11:33:32 +08:00

33 lines
1.5 KiB
PowerShell

<#
Build tools/navgen/bake/wto_navgen_bake.exe using MSVC x64 C++ (Visual Studio).
Links vendored upstream Recast + Detour (zlib license) from native/third_party/recastnavigation.
#>
param([string]$Out = (Join-Path $PSScriptRoot '..\..\..\build\navgen'))
$ErrorActionPreference = 'Stop'
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
$vs = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if (-not $vs) { throw 'Visual Studio with x64 C++ tools was not found' }
$vcvars = Join-Path $vs 'VC\Auxiliary\Build\vcvars64.bat'
$root = Resolve-Path (Join-Path $PSScriptRoot '..\..\..')
$rc = Join-Path $root 'native\third_party\recastnavigation\Recast'
$dt = Join-Path $root 'native\third_party\recastnavigation\Detour'
$navInc = Join-Path $root 'native\wto-nav'
New-Item -ItemType Directory -Force $Out | Out-Null
$obj = Join-Path $Out 'obj'
New-Item -ItemType Directory -Force $obj | Out-Null
$sources = @(
(Join-Path $PSScriptRoot 'bake.cpp')
) + (Get-ChildItem "$rc\Source\*.cpp").FullName + (Get-ChildItem "$dt\Source\*.cpp").FullName
$quoted = $sources | ForEach-Object { '"' + $_ + '"' }
$exe = Join-Path $Out 'wto_navgen_bake.exe'
$cmd = "`"$vcvars`" >nul && cl /nologo /O2 /EHsc /std:c++17 /MT /W3 /D_CRT_SECURE_NO_WARNINGS " +
"/I`"$rc\Include`" /I`"$dt\Include`" /I`"$navInc`" " +
"/Fo`"$obj\\`" $($quoted -join ' ') /Fe`"$exe`""
cmd /c $cmd
if ($LASTEXITCODE -ne 0) { throw "cl failed with exit code $LASTEXITCODE" }
Write-Output $exe