43 std::cout <<
"ERROR, you must indicate the scene file you want to read from.\n"
44 "Usage: ./aidan [path_to_textfile]";
58 int anti_aliasing = 0;
60 std::vector<Light*> scene_lights;
61 std::vector<geo::Shape*> scene_objects;
62 std::string text_file = argv[1];
63 std::string image_name;
64 Parser scene_parser(image_name,
81 std::cout <<
"ERROR: Anti-aliasing should be 1 (no-antialising) or more." << std::endl;
82 assert(anti_aliasing > 0);
89 for(
unsigned int i = 0; i < scene_objects.size(); i++)
91 myScene_instance->
addObject(scene_objects.at(i));
95 for(
unsigned int i = 0; i < scene_lights.size(); i++)
97 myScene_instance->
addLight(scene_lights.at(i));
106 ngl::Vec3 campos(camPosX,camPosY,camPosZ);
107 ngl::Vec3 lookat(lookAtX,lookAtY,lookAtZ);
108 ngl::Vec3 diff_btw = campos - lookat; diff_btw.normalize();
109 ngl::Vec3 camdir = -diff_btw;
110 ngl::Vec3 camright = Y.cross(camdir);
111 ngl::Vec3 camdown = camright.cross(camdir);
115 myCamera_instance->
setParameters(campos,camdir,camright,camdown);
119 renderer_instance->
bind(myScene_instance, myFilm_instance, myCamera_instance, max_depth, anti_aliasing, image_name);
124 std::cout <<
"Rendering...\n";
127 renderer_instance->
render();
131 float seconds = (float)t/CLOCKS_PER_SEC;
141 std::cout << image_name <<
".ppm has been written successfully.\n";
142 std::string command =
"display " + image_name +
".ppm";
143 system(command.c_str());
void render()
Will trigger the class and start doing all the calculations.
void printOutTime(float _seconds)
Core of my program, central unit that manages all the other classes almost.
void setParameters(ngl::Vec3 _pos, ngl::Vec3 _dir, ngl::Vec3 _right, ngl::Vec3 _down)
Initialises the camera settings.
void setDimensions(int _w, int _h)
Sets the dimensions of the Film.
void bind(Scene *_scence, Film *_film, Camera *_camera, int _max_depth, int _anti_aliasing, std::string _image_name)
Grabs all the information and places it into the private interface.
void addObject(geo::Shape *_object)
Adds an shape obejct to the scene.
Holds all the operations regarding to input/output of colour information.
Hold all the objects and lights of the scene.
static void destroyInstance()
Destroys the instance thus freeing memory from the heap.
void addLight(Light *_light)
Adds a light to the scene structure.
static T * Instance()
If the instance is null it creates one, otherwise just returns the current one.
Holds camera functions which will be accessed by the Render class.
Reads from text file and iterates using boost tokenizer to "pickup" and store values based on syntax...