MCPcopy Create free account
hub / github.com/KhronosGroup/glTF-IBL-Sampler / main

Function main

cli/source/cli.cpp:8–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace IBLLib;
7
8int main(int argc, char* argv[])
9{
10 const char* pathIn = nullptr;
11 const char* pathOutCubeMap = nullptr;
12 const char* pathOutLUT = nullptr;
13 unsigned int sampleCount = 1024u;
14 unsigned int mipLevelCount = 0u;
15 unsigned int cubeMapResolution = 0u;
16 OutputFormat targetFormat = OutputFormat::R16G16B16A16_SFLOAT;
17 Distribution distribution = Distribution::GGX;
18 float lodBias = 0.0f;
19 bool enableDebugOutput = false;
20
21 const char* targetFormatString = "R16G16B16A16_SFLOAT";
22 const char* distributionString = "GGX";
23
24 if (argc == 1 ||
25 strcmp(argv[1], "-h") == 0 ||
26 strcmp(argv[1], "-help") == 0)
27 {
28 printf("glTF-IBL-Sampler usage:\n");
29
30 printf("-inputPath: path to panorama image (default) or cube map (if inputIsCubeMap flag ist set) \n");
31 printf("-outCubeMap: output path for filtered cube map\n");
32 printf("-outLUT output path for BRDF LUT\n");
33 printf("-distribution NDF to sample (Lambertian, GGX, Charlie)\n");
34 printf("-sampleCount: number of samples used for filtering (default = 1024)\n");
35 printf("-mipLevelCount: number of mip levels of specular cube map. If omitted, an optimal mipmap level is chosen, based on the input panorama's resolution.\n");
36 printf("-cubeMapResolution: resolution of output cube map. If omitted, an optimal resolution is chosen, based on the input panorama's resolution.\n");
37 printf("-targetFormat: specify output texture format (R8G8B8A8_UNORM, R16G16B16A16_SFLOAT, R32G32B32A32_SFLOAT) \n");
38 printf("-lodBias: level of detail bias applied to filtering (default = 0) \n");
39
40
41 return 0;
42 }
43
44 for (int i = 1; i < argc; ++i)
45 {
46 const char* nextArg = i + 1 < argc ? argv[i+1] : nullptr;
47 if (strcmp(argv[i], "-inputPath") == 0)
48 {
49 pathIn = nextArg;
50 }
51 else if (strcmp(argv[i], "-outCubeMap") == 0)
52 {
53 pathOutCubeMap = nextArg;
54 }
55 else if (strcmp(argv[i], "-outLUT") == 0)
56 {
57 pathOutLUT = nextArg;
58 }
59 else if (strcmp(argv[i], "-sampleCount") == 0)
60 {
61 sampleCount = strtoul(nextArg, NULL, 0);
62 }
63 else if (strcmp(argv[i], "-mipLevelCount") == 0)
64 {
65 mipLevelCount = strtoul(nextArg, NULL, 0);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected