Add -n option for "should render"
This commit is contained in:
parent
7e3cc3c3ed
commit
3a846ec282
1 changed files with 13 additions and 6 deletions
|
@ -42,13 +42,15 @@ main(int argc,
|
||||||
PointLight *l1 = new PointLight(Vector4(4.0, 6.0, 1.0), Color::White, 0.8);
|
PointLight *l1 = new PointLight(Vector4(4.0, 6.0, 1.0), Color::White, 0.8);
|
||||||
scene.AddLight(l1);
|
scene.AddLight(l1);
|
||||||
|
|
||||||
|
bool shouldRender = true;
|
||||||
|
|
||||||
std::string logFilename;
|
std::string logFilename;
|
||||||
unsigned int logLevel = 0;
|
unsigned int logLevel = 0;
|
||||||
|
|
||||||
std::string outfile, infile;
|
std::string outfile, infile;
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, (char *const *)argv, "hl:L:o:v:")) != -1) {
|
while ((opt = getopt(argc, (char *const *)argv, "hl:L:no:v:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
@ -60,6 +62,9 @@ main(int argc,
|
||||||
case 'L':
|
case 'L':
|
||||||
logLevel = std::stoul(optarg);
|
logLevel = std::stoul(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
shouldRender = false;
|
||||||
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
outfile = optarg;
|
outfile = optarg;
|
||||||
break;
|
break;
|
||||||
|
@ -96,12 +101,14 @@ main(int argc,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call tracer. */
|
/* Call tracer. */
|
||||||
|
if (shouldRender) {
|
||||||
LOG_INFO << "Beginning render";
|
LOG_INFO << "Beginning render";
|
||||||
scene.Render();
|
scene.Render();
|
||||||
|
|
||||||
/* Write rendered scene to PNG file. */
|
/* Write rendered scene to PNG file. */
|
||||||
PNGWriter writer;
|
PNGWriter writer;
|
||||||
scene.Write(writer, outfile);
|
scene.Write(writer, outfile);
|
||||||
|
}
|
||||||
|
|
||||||
if (logLevel > 0) {
|
if (logLevel > 0) {
|
||||||
Log::Close();
|
Log::Close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue