mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
35 lines
834 B
C++
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();
|
|
}
|