diff --git a/Assignments/Assignment2/Application2.cpp b/Assignments/Assignment2/Application2.cpp index 6a2c72f..3af9b01 100644 --- a/Assignments/Assignment2/Application2.cpp +++ b/Assignments/Assignment2/Application2.cpp @@ -110,8 +110,21 @@ Vec3fa ACESFilm(Vec3fa x, float exposure) { return (x * (a * x + b)) / (x * (c * x + d) + e); } -/* task that renders a single screen tile */ +// Function that selects implementation at runtime Vec3fa Application2::renderPixel(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) { + if (selected == 0) { + return renderPixelOrig(x, y, camera, stats, sampler); + } else { + return Vec3fa(0.0f); + } +} + +Vec3fa Application2::renderPixelHomogeneous(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) { + return Vec3fa(0.0f); +} + +/* task that renders a single screen tile */ +Vec3fa Application2::renderPixelOrig(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) { /* radiance accumulator and weight */ Vec3fa L = Vec3fa(0.0f); Vec3fa Lw = Vec3fa(1.0f); diff --git a/Assignments/Assignment2/Application2.h b/Assignments/Assignment2/Application2.h index ae51d05..277940e 100644 --- a/Assignments/Assignment2/Application2.h +++ b/Assignments/Assignment2/Application2.h @@ -9,9 +9,28 @@ 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 renderPixelHomogeneous(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler); void drawGUI() override { ImGui::Checkbox("Bounding Box", &boundingBox); + + const char* items[] = {"Original", "Homogeneous"}; + ImGui::Combo("Version", &selected, items, 2); + + const char* scenes[] = {"Gnome", "Horse", "Heterogenous"}; + int oldscene = scene; + ImGui::Combo("Scenes", &scene, scenes, 3); + if (scene != oldscene) { + Data_Destructor(&data); + Data_Constructor(&data, 1, 8); + if (scene == 0) + gnomeScene(); + if (scene == 1) + horseScene(); + if (scene == 2) + heterogenousScene(); + } } void initScene() override; @@ -24,6 +43,7 @@ private: void heterogenousScene(); - float colorLight[3] = {1.0f, 1.0f, 1.0f}; bool boundingBox = true; + int selected = 0; + int scene = 0; };