ray-tracer-comp371/src/RayTracer.cc
2024-02-18 20:52:59 -05:00

35 lines
834 B
C++

#include "RayTracer.h"
#include "../external/simpleppm.h"
#include "Parser.h"
#include <vector>
using std::vector;
void RayTracer::parse() {
for (auto i = json["output"].begin(); i != json["output"].end(); ++i)
scenes.push_back(Parser::getScene(*i));
for (auto i = json["geometry"].begin(); i != json["geometry"].end(); ++i)
geometries.push_back(Parser::getGeometry(*i));
for (auto i = json["light"].begin(); i != json["light"].end(); ++i)
lights.push_back(Parser::getLight(*i));
}
void RayTracer::render() {}
void RayTracer::output() {
for (auto scene : scenes) {
int width = scene->getWidth();
int height = scene->getHeight();
vector<double> buffer(3 * width * height);
save_ppm(scene->getName(), buffer, width, height);
}
}
void RayTracer::run() {
parse();
render();
output();
}