diff --git a/main/Scene.cc b/main/Scene.cc index bd97bd8..deb3690 100644 --- a/main/Scene.cc +++ b/main/Scene.cc @@ -60,6 +60,10 @@ Scene::Scene(const map & options, { m_max_depth = atoi(it->second); } + else if (it->first == "ambient-occlusion") + { + m_ambient_occlusion_level = atoi(it->second); + } } /* view plane distance is calculated based on the field of view */ diff --git a/main/Scene.h b/main/Scene.h index eccfa08..231b2d2 100644 --- a/main/Scene.h +++ b/main/Scene.h @@ -35,11 +35,13 @@ class Scene void setVFOV(double vfov) { m_vfov = vfov; } void setAmbientLight(const Color & al) { m_ambient_light = al; } void renderPixel(int x, int y, unsigned char * pixel); + void setMaxDepth(int d) { m_max_depth = d; } int getWidth() { return m_width; } int getHeight() { return m_height; } int getMultisampleLevel() { return m_multisample_level; } int getAmbientOcclusionLevel() { return m_ambient_occlusion_level; } double getVFOV() { return m_vfov; } + int getMaxDepth() { return m_max_depth; } protected: /* private methods */ diff --git a/main/fart.cc b/main/fart.cc index 386c2ab..0030d8e 100644 --- a/main/fart.cc +++ b/main/fart.cc @@ -26,6 +26,8 @@ void usage(const char * progname) cout << " -m|--multisample " << endl; cout << " -f|--field-of-view " << endl; cout << " -d|--max-depth " << endl; + cout << " -a|--ambient-occlusion " << endl; + cout << " -p|--preview (means -w400 -h300 -m1 -d8 -a0)" << endl; cout << " --hosts " << endl; exit(42); } @@ -90,25 +92,32 @@ int main(int argc, char * argv[]) bool child = false; static const struct option long_options[] = { - { "output-file", required_argument, NULL, 'o' }, - { "width", required_argument, NULL, 'w' }, - { "height", required_argument, NULL, 'h' }, - { "multisample", required_argument, NULL, 'm' }, - { "field-of-view", required_argument, NULL, 'f' }, - { "max-depth", required_argument, NULL, 'd' }, - { "help", no_argument, NULL, 256 }, - { "host", required_argument, NULL, 257 }, - { "port", required_argument, NULL, 258 }, - { "hosts", required_argument, NULL, 259 }, - { "child", no_argument, NULL, 260 }, - { NULL, 0, NULL, 0 } + { "ambient-occlusion", required_argument, NULL, 'a' }, + { "output-file", required_argument, NULL, 'o' }, + { "width", required_argument, NULL, 'w' }, + { "height", required_argument, NULL, 'h' }, + { "multisample", required_argument, NULL, 'm' }, + { "field-of-view", required_argument, NULL, 'f' }, + { "max-depth", required_argument, NULL, 'd' }, + { "preview", no_argument, NULL, 'p' }, + { "help", no_argument, NULL, 256 }, + { "host", required_argument, NULL, 257 }, + { "port", required_argument, NULL, 258 }, + { "hosts", required_argument, NULL, 259 }, + { "child", no_argument, NULL, 260 }, + { NULL, 0, NULL, 0 } }; - while ((opt = getopt_long(argc, argv, "o:w:h:m:f:d:", + while ((opt = getopt_long(argc, argv, "a:o:w:h:m:f:d:p", long_options, &option_index)) != -1) { switch (opt) { + case 'a': + scene_options["ambient-occlusion"] = optarg; + client_options.push_back("--ambient-occlusion"); + client_options.push_back(optarg); + break; case 'o': output_file_name = optarg; break; @@ -137,6 +146,14 @@ int main(int argc, char * argv[]) client_options.push_back("--max-depth"); client_options.push_back(optarg); break; + case 'p': + scene_options["ambient-occlusion"] = "0"; + scene_options["width"] = "400"; + scene_options["height"] = "300"; + scene_options["multisample"] = "1"; + scene_options["max-depth"] = "8"; + client_options.push_back("--preview"); + break; case 256: usage(argv[0]); break; @@ -189,6 +206,7 @@ int main(int argc, char * argv[]) cout << " Multisample Level: " << scene.getMultisampleLevel() << endl; cout << " Ambient Occlusion Level: " << scene.getAmbientOcclusionLevel() << endl; cout << " Vertical Field of View: " << scene.getVFOV() << endl; + cout << " Max Depth: " << scene.getMaxDepth() << endl; cout << "----------------------------------------" << endl; }