accelerated-raytracer/src/Scene.h

43 lines
1.2 KiB
C++

#ifndef RAYTRYCPP_SCENE_H
#define RAYTRYCPP_SCENE_H
#include "Camera.h"
#include "viewerwindow.h"
#include "InfinitePlane.h"
#include "KDNode.h"
#include "KDTree.h"
#include "Sphere.h"
#include "Triangle.h"
#include <QImage>
namespace raytry {
class Scene {
public:
Scene();
~Scene() = default;
void render(ViewerWindow& window, std::function<void()> updateImage);
private:
std::list<std::pair<std::reference_wrapper<const RenderObject>, float>> findIntersections(const raytry::Ray &ray);
void rayTrace(const Ray& ray, unsigned int depth, QColor& color);
static const constexpr unsigned int maxDepth{1};
static const constexpr float globalIllumination{0.5f};
static const constexpr QColor backgroundColor{177, 190, 223};
static const constexpr QVector3D pointLight{-10, -10, 10};
size_t triangleIntersections{0};
Camera camera{};
InfinitePlane ground{};
std::array<Sphere, 11> spheres{};
std::array<Triangle, 3> triangles{};
std::vector<Triangle> teapotMesh{};
std::vector<std::reference_wrapper<RenderObject>> background{};
KD::Tree foregroundTree{};
};
}// namespace raytry
#endif//RAYTRYCPP_SCENE_H