Files
NODEDC_MISSION_CORE/simulation/ai-polygon/Prepare-Scene.ps1
T

17 lines
983 B
PowerShell

param([Parameter(Mandatory=$true)][string]$InputManifest,
[Parameter(Mandatory=$true)][string]$OutputPly,
[int]$Lod = -1)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$tool = 'D:\NDC_MISSIONCORE\runtime\simulation\tools\splat-transform-3.4.0\node_modules\@playcanvas\splat-transform\bin\cli.mjs'
if (!(Test-Path $InputManifest)) { throw 'Source archive missing' }
if (Test-Path $OutputPly) { throw 'Do not overwrite a prepared scene' }
$tmp = $OutputPly -replace '\.ply$', '.part.ply'
if ($tmp -eq $OutputPly -or (Test-Path $tmp)) { throw 'Invalid or unfinished output' }
$options = @('--memory', '--no-tty')
if ($Lod -ge 0) { $options += @('--select-lod', [string]$Lod) }
& node.exe $tool @options $InputManifest $tmp
if ($LASTEXITCODE -ne 0) { throw 'Scene conversion failed' }
Move-Item $tmp $OutputPly
@{file=$OutputPly;bytes=(Get-Item $OutputPly).Length;sha256=(Get-FileHash $OutputPly -Algorithm SHA256).Hash.ToLower()} | ConvertTo-Json