Add Framwork for Assignment 3

This commit is contained in:
hal8174 2024-06-13 13:53:07 +02:00
parent a2d7f5c414
commit c864d2a42f
14 changed files with 50048 additions and 48111 deletions

View file

@ -38,6 +38,7 @@
#include "camera.hpp"
#include "ray.hpp"
#include "random_sampler.hpp"
#include "random_sampler_wrapper.hpp"
class Application {
public:
@ -48,15 +49,16 @@ public:
void run();
protected:
virtual Vec3fa renderPixel(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) = 0;
virtual Vec3fa renderPixel(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSamplerWrapper& sampler) = 0;
void deviceRender(const ISPCCamera& camera);
virtual void drawGUI() = 0;
virtual void drawGUI() {
}
virtual void initScene() = 0;
void render(int* pixels, int width, int height, float time, const ISPCCamera& camera);
virtual void render(int* pixels, int width, int height, float time, const ISPCCamera& camera);
void renderTile(int taskIndex, int threadIndex, int* pixels, unsigned int width,
unsigned int height,
@ -90,6 +92,13 @@ protected:
void scrollCallback(GLFWwindow*, double xoffset, double yoffset);
// it is invoked when the scene changes
virtual void resetRender() {
data.accu_count = 0;
data.film.clear();
}
void initRayStats();
int64_t getNumRays();
@ -130,7 +139,7 @@ protected:
double clickX = 0;
double clickY = 0;
float speed = 400;
float speed = 1;
Vec3f moveDelta = {0, 0, 0};
RayStats* g_stats = nullptr;