#pragma once
#include "helper.hpp"
#include "imgui.h"


class Application1 : public Application {
public:
    Application1(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 renderPixelPathTracer(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);
    Vec3fa renderPixelNextEventEstimation(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);
    Vec3fa renderPixelMIS(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler);

    void drawGUI() override {
        ImGui::InputInt("Ray depth", &ray_depth);
        if (ray_depth < 1) {
            ray_depth = 1;
        }

        ImGui::SliderFloat("beta", &beta, 0.1, 10.0);

        const char* items[] = {"Original", "Path Tracer", "Next Event Estimation", "Multiple Importance Sampling"};
        ImGui::Combo("Version", &selected, items, 4);
        
        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;

    void standardScene();

    void veachScene();

    int ray_depth = 5;
    int selected = 0;
    int scene = 0;
    float beta = 1.0;
    
};
