mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
parse and write scene
This commit is contained in:
parent
03b6bbbb8e
commit
7d273f9420
3 changed files with 22 additions and 1 deletions
|
@ -1,6 +1,11 @@
|
|||
#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));
|
||||
|
@ -8,7 +13,14 @@ void RayTracer::parse() {
|
|||
|
||||
void RayTracer::render() {}
|
||||
|
||||
void RayTracer::output() {}
|
||||
void RayTracer::output() {
|
||||
for (auto scene : scenes) {
|
||||
int width = scene->getWidth();
|
||||
int height = scene->getHeight();
|
||||
vector<double> buffer(3 * width * height);
|
||||
save_ppm("build/" + scene->getName(), buffer, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void RayTracer::run() {
|
||||
parse();
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#include "Scene.h"
|
||||
|
||||
string Scene::getName() { return name; }
|
||||
|
||||
int Scene::getWidth() { return width; }
|
||||
|
||||
int Scene::getHeight() { return height; }
|
||||
|
||||
void Scene::setRaysPerPixel(const Eigen::VectorXi &raysPerPixel) {
|
||||
this->raysPerPixel = raysPerPixel;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@ private:
|
|||
bool globalIllum = false;
|
||||
|
||||
public:
|
||||
string getName();
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
void setRaysPerPixel(const Eigen::VectorXi &);
|
||||
void setAntialiasing(bool);
|
||||
void setTwoSideRender(bool);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue