82 lines
2.5 KiB
C++
82 lines
2.5 KiB
C++
#pragma once
|
|
#include "helper.hpp"
|
|
#include "imgui.h"
|
|
#include "math/vec3fa.h"
|
|
|
|
|
|
class Application2 : public Application {
|
|
public:
|
|
Application2(int argc, char** argv) : Application(argc, argv, "Assignment 1") {
|
|
}
|
|
|
|
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 renderPixelHomogeneous(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);
|
|
Vec3fa renderPixelHeterogeneous(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);
|
|
Vec3fa renderPixelHeterogeneousNEE(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);
|
|
|
|
void drawGUI() override {
|
|
ImGui::Checkbox("Bounding Box", &boundingBox);
|
|
if (ImGui::InputInt("Ray depth", &ray_depth))
|
|
clear();
|
|
|
|
if (ray_depth < 1) {
|
|
ray_depth = 1;
|
|
}
|
|
|
|
const char* items[] = {"Original", "Homogeneous", "Heterogeneous", "HeterogeneousNEE"};
|
|
if (ImGui::Combo("Version", &selected, items, 4))
|
|
clear();
|
|
|
|
if (ImGui::SliderFloat("density", &density, 0.0, 1.0))
|
|
clear();
|
|
|
|
if (ImGui::SliderFloat("absorbtion", &absorbtion, 0.0, 1.0))
|
|
clear();
|
|
|
|
if (ImGui::SliderFloat("scattering parameter", &scattering_parameter, -1.0, 1.0))
|
|
clear();
|
|
|
|
if (ImGui::SliderFloat("temperature", &tempearture_multiplier, 1.0, 10000.0))
|
|
clear();
|
|
|
|
const char* scenes[] = {"Gnome", "Horse", "Heterogenous"};
|
|
if (ImGui::Combo("Scenes", &scene, scenes, 3)) {
|
|
Data_Destructor(&data);
|
|
Data_Constructor(&data, 1, 8);
|
|
if (scene == 0)
|
|
gnomeScene();
|
|
if (scene == 1)
|
|
horseScene();
|
|
if (scene == 2)
|
|
heterogenousScene();
|
|
}
|
|
}
|
|
|
|
void clear() {
|
|
data.accu_count = 0;;
|
|
for (size_t i = 0; i < data.accu_width * data.accu_height; i++) {
|
|
data.accu[i] = Vec3fx(0.0);
|
|
}
|
|
}
|
|
|
|
void initScene() override;
|
|
|
|
void emptyScene();
|
|
|
|
void gnomeScene();
|
|
|
|
void horseScene();
|
|
|
|
void heterogenousScene();
|
|
|
|
int ray_depth = 15;
|
|
bool boundingBox = true;
|
|
int selected = 0;
|
|
int scene = 0;
|
|
float density = 0.0;
|
|
float absorbtion = 0.0;
|
|
float tempearture_multiplier = 1000.0;
|
|
float scattering_parameter = 0.4;
|
|
};
|