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.");
// TODO: Read this from args var rootCommand = new RootCommand("Compute lightmaps for a NewDark .MIS/.COW");
var installPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/"; rootCommand.AddArgument(installPathArg);
var campaignName = "JAYRUDE_Tests"; rootCommand.AddArgument(campaignNameArg);
var missionName = "lm_test.cow"; rootCommand.AddArgument(missionNameArg);
rootCommand.AddOption(outputFileOption);
rootCommand.AddOption(multiSamplingOption);
rootCommand.SetHandler((installPath, campaignName, missionName, outputFile, multiSampling) =>
{
Timing.Reset();
// campaignName = "JAYRUDE_1MIL_Mages"; var lightMapper = new LightMapper(installPath, campaignName, missionName);
// campaignName = "TDP20AC_a_burrick_in_a_room"; lightMapper.Light(multiSampling);
// campaignName = "AtdV"; lightMapper.Save(outputFile);
// missionName = "miss20.mis";
var lightMapper = new LightMapper(installPath, campaignName, missionName); Timing.LogAll();
lightMapper.Light(false); }, installPathArg, campaignNameArg, missionNameArg, outputFileOption, multiSamplingOption);
lightMapper.Save("kc_lit");
Timing.LogAll(); rootCommand.Invoke(args);
} }
} }