From c32e826ee32b2b6722ab200b38be4dcb31486bf0 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 23 Jan 2009 14:43:49 +0000 Subject: [PATCH] added --field-of-view and m_vfov to Scene git-svn-id: svn://anubis/fart/trunk@36 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- main/Scene.cc | 5 +++++ main/Scene.h | 8 +++++++- main/fart.cc | 7 ++++++- shapes/Shape.h | 6 ++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/main/Scene.cc b/main/Scene.cc index ff7d9b4..3cde950 100644 --- a/main/Scene.cc +++ b/main/Scene.cc @@ -15,6 +15,7 @@ Scene::Scene(map options, m_height = 600; m_multisample_level = 1; m_output_file_name = "fart.bmp"; + m_vfov = 60.0; m_verbose = false; m_data = NULL; @@ -37,6 +38,10 @@ Scene::Scene(map options, { m_multisample_level = atoi(it->second); } + else if (it->first == "field-of-view") + { + m_vfov = atof(it->second); + } else if (it->first == "output-file") { m_output_file_name = it->second; diff --git a/main/Scene.h b/main/Scene.h index 685f628..ad29b8f 100755 --- a/main/Scene.h +++ b/main/Scene.h @@ -19,13 +19,19 @@ class Scene void load(const char * filename); void renderPixel(int x, int y, unsigned char * pixel); + /* rendering parameters */ int m_width; int m_height; int m_multisample_level; std::string m_output_file_name; bool m_verbose; - unsigned char * m_data; + double m_vfov; + + /* the shapes in the scene */ std::vector m_shapes; + + /* framebuffer */ + unsigned char * m_data; }; #endif diff --git a/main/fart.cc b/main/fart.cc index 2505820..f00ae65 100644 --- a/main/fart.cc +++ b/main/fart.cc @@ -17,6 +17,7 @@ void usage(const char * progname) cout << " -w|--width " << endl; cout << " -h|--height " << endl; cout << " -m|--multisample " << endl; + cout << " -f|--field-of-view " << endl; cout << " -v|--verbose" << endl; exit(42); } @@ -33,11 +34,12 @@ int main(int argc, char * argv[]) { "width", required_argument, NULL, 'w' }, { "height", required_argument, NULL, 'h' }, { "multisample", required_argument, NULL, 'm' }, + { "field-of-view", required_argument, NULL, 'f' }, { "verbose", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } }; - while ((opt = getopt_long(argc, argv, "o:w:h:m:", + while ((opt = getopt_long(argc, argv, "o:w:h:m:f:", long_options, &option_index)) != -1) { switch (opt) @@ -57,6 +59,9 @@ int main(int argc, char * argv[]) case 'm': scene_options["multisample"] = optarg; break; + case 'f': + scene_options["field-of-view"] = optarg; + break; case 'v': scene_options["verbose"] = optarg; break; diff --git a/shapes/Shape.h b/shapes/Shape.h index 8e4d6a3..5163503 100644 --- a/shapes/Shape.h +++ b/shapes/Shape.h @@ -4,11 +4,17 @@ #include "util/Solver.h" #include "util/Ray.h" +#include "util/Transform.h" class Shape { public: virtual Solver::Result intersect(const Ray & ray) = 0; + void setTransform(const Transform & t) { m_transform = t; } + Transform & getTransform() { return m_transform; } + + protected: + Transform m_transform; }; #endif