Add path tracing implementation for Assignment1.

This commit is contained in:
hal8174 2024-05-02 12:37:21 +02:00
parent 0653874165
commit 0b132ea4e7
2 changed files with 111 additions and 3 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include "helper.hpp"
#include "imgui.h"
class Application1 : public Application {
@ -9,8 +10,31 @@ public:
private:
Vec3fa renderPixel(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) override;
Vec3fa renderPixelOrig(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);
Vec3fa renderPixelPathTracer(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);
void drawGUI() override {
ImGui::ColorEdit3("Color", colorLight);
ImGui::InputInt("Ray depth", &ray_depth);
if (ray_depth < 1) {
ray_depth = 1;
}
const char* items[] = {"Original", "Path Tracer"};
ImGui::Combo("Version", &selected, items, 2);
const char* scenes[] = {"Cornell", "Veach"};
int oldscene = scene;
ImGui::Combo("Scenes", &scene, scenes, 2);
if (scene != oldscene) {
Data_Destructor(&data);
Data_Constructor(&data, 1, 8);
if (scene == 0)
standardScene();
if (scene == 1)
veachScene();
}
}
void initScene() override;
@ -20,4 +44,8 @@ private:
void veachScene();
float colorLight[3] = {1.0f, 1.0f, 1.0f};
int ray_depth = 5;
int selected = 0;
int scene = 0;
};