Add basic command line interface

This commit is contained in:
Jarrod Doyle 2024-10-28 20:40:06 +00:00
parent 0ea00fa109
commit 350a891118
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 37 additions and 15 deletions

View File

@ -8,6 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="TinyEmbree" Version="1.0.3" /> <PackageReference Include="TinyEmbree" Version="1.0.3" />
</ItemGroup> </ItemGroup>

View File

@ -1,25 +1,46 @@
using System.CommandLine;
namespace KeepersCompound.Lightmapper; namespace KeepersCompound.Lightmapper;
class Program class Program
{ {
static void Main(string[] args) private static void Main(string[] args)
{ {
Timing.Reset(); var installPathArg = new Argument<string>(
"installPath",
"The path to the root Thief installation.");
var campaignNameArg = new Argument<string>(
"campaignName",
"The folder name of the fan mission. For OMs this is blank.");
var missionNameArg = new Argument<string>(
"missionName",
"The name of the mission file including extension.");
var outputFileOption = new Option<string>(
["-o", "--output"],
() => "kc_lit",
"Name of output file excluding extension.");
var multiSamplingOption = new Option<bool>(
"--multiSampling",
() => false,
"Enables multi-sampled shadows. Higher quality but slower.");
var rootCommand = new RootCommand("Compute lightmaps for a NewDark .MIS/.COW");
rootCommand.AddArgument(installPathArg);
rootCommand.AddArgument(campaignNameArg);
rootCommand.AddArgument(missionNameArg);
rootCommand.AddOption(outputFileOption);
rootCommand.AddOption(multiSamplingOption);
rootCommand.SetHandler((installPath, campaignName, missionName, outputFile, multiSampling) =>
{
Timing.Reset();
// TODO: Read this from args var lightMapper = new LightMapper(installPath, campaignName, missionName);
var installPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/"; lightMapper.Light(multiSampling);
var campaignName = "JAYRUDE_Tests"; lightMapper.Save(outputFile);
var missionName = "lm_test.cow";
// campaignName = "JAYRUDE_1MIL_Mages"; Timing.LogAll();
// campaignName = "TDP20AC_a_burrick_in_a_room"; }, installPathArg, campaignNameArg, missionNameArg, outputFileOption, multiSamplingOption);
// campaignName = "AtdV";
// missionName = "miss20.mis";
var lightMapper = new LightMapper(installPath, campaignName, missionName); rootCommand.Invoke(args);
lightMapper.Light(false);
lightMapper.Save("kc_lit");
Timing.LogAll();
} }
} }