aboutsummaryrefslogtreecommitdiffstats
path: root/include/scene.hpp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2021-07-25 11:58:01 +0200
committerladevieq <ladevie.quentin@gmail.com>2021-07-25 11:58:01 +0200
commit3dd870b001bef62aaa501257352d968d1346c7f2 (patch)
treee82abc32ace01af978071b32db40e5c07c991529 /include/scene.hpp
parent6bdf3ab65a7c1e98595ad167479b94a82184a444 (diff)
Use a different buffer for scene info, geometry, bvh and load gltf
Diffstat (limited to 'include/scene.hpp')
-rw-r--r--include/scene.hpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/include/scene.hpp b/include/scene.hpp
index b7e1100..364e3a7 100644
--- a/include/scene.hpp
+++ b/include/scene.hpp
@@ -3,39 +3,48 @@
#include "vec3.hpp"
#include "sphere.hpp"
+#include "triangle.hpp"
#include "camera.hpp"
#include "bvh-node.hpp"
class scene {
-public:
- scene(uint32_t width, uint32_t height);
+ struct metadata {
+ color sky_color = { 0.5, 0.7, 1.0 };
+ color ground_color = { 1.0, 1.0, 1.0 };
+
+ camera cam;
- color sky_color = { 0.5, 0.7, 1.0 };
- color ground_color = { 1.0, 1.0, 1.0 };
+ uint32_t max_bounce = 50;
- camera cam;
+ // Output image resolution
+ uint32_t width;
+ uint32_t height;
- sphere spheres[512] = {};
- bvh_node nodes[1024] = {};
+ uint32_t sample_index = 0;
- uint32_t max_bounce = 50;
+ uint32_t spheres_count = 0;
+ // uint32_t triangles_count = 0;
+ uint32_t enable_dof = true;
+ uint32_t debug_bvh = false;
+ uint32_t padding;
- // Output image resolution
- uint32_t width;
- uint32_t height;
+ metadata(camera cam, uint32_t width, uint32_t height)
+ : cam(cam), width(width), height(height) {}
+ };
- uint32_t sample_index = 0;
+ void random_scene();
- uint32_t spheres_count = 0;
- uint32_t enable_dof = true;
- uint32_t debug_bvh = false;
- uint32_t padding;
+public:
+ scene(camera cam, uint32_t width, uint32_t height);
-private:
+ metadata meta;
- uint32_t random_scene(sphere* world);
+ // Geometry & BVH
+ std::vector<sphere> spheres;
+ // std::vector<triangle> triangles;
+ std::vector<bvh_node> nodes;
};
#endif // !__SCENE_HPP_