aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/scene.hpp41
-rw-r--r--include/utils.hpp37
-rw-r--r--include/vk-api.hpp1
-rw-r--r--include/vk-renderer.hpp11
4 files changed, 52 insertions, 38 deletions
diff --git a/include/scene.hpp b/include/scene.hpp
new file mode 100644
index 0000000..b7e1100
--- /dev/null
+++ b/include/scene.hpp
@@ -0,0 +1,41 @@
+#ifndef __SCENE_HPP_
+#define __SCENE_HPP_
+
+#include "vec3.hpp"
+#include "sphere.hpp"
+#include "camera.hpp"
+#include "bvh-node.hpp"
+
+
+class scene {
+public:
+ scene(uint32_t width, uint32_t height);
+
+ color sky_color = { 0.5, 0.7, 1.0 };
+ color ground_color = { 1.0, 1.0, 1.0 };
+
+ camera cam;
+
+ sphere spheres[512] = {};
+ bvh_node nodes[1024] = {};
+
+ uint32_t max_bounce = 50;
+
+ // Output image resolution
+ uint32_t width;
+ uint32_t height;
+
+ uint32_t sample_index = 0;
+
+ uint32_t spheres_count = 0;
+ uint32_t enable_dof = true;
+ uint32_t debug_bvh = false;
+ uint32_t padding;
+
+private:
+
+ uint32_t random_scene(sphere* world);
+
+};
+
+#endif // !__SCENE_HPP_
diff --git a/include/utils.hpp b/include/utils.hpp
index 4683e86..b00db81 100644
--- a/include/utils.hpp
+++ b/include/utils.hpp
@@ -1,42 +1,11 @@
#ifndef __UTILS_HPP_
#define __UTILS_HPP_
-#include <cstdint>
-#include <cstdlib>
+#include <string>
#include <vector>
-#include "vec3.hpp"
-#include "sphere.hpp"
-#include "camera.hpp"
-#include "bvh-node.hpp"
-
-struct input_data {
- color sky_color;
- color ground_color;
-
- camera cam;
-
- sphere spheres[512];
- bvh_node nodes[1024];
-
- uint32_t max_bounce;
-
- // Output image resolution
- uint32_t width;
- uint32_t height;
-
- uint32_t sample_index;
-
- uint32_t spheres_count;
- uint32_t enable_dof;
- uint32_t debug_bvh;
- uint32_t padding;
-};
-
-std::vector<uint8_t> get_shader_code(const char* path);
-std::vector<uint8_t> get_shader_code(std::string& path);
-
-struct input_data create_inputs(uint32_t width, uint32_t height);
+std::vector<uint8_t> read_file(const char* path);
+std::vector<uint8_t> read_file(std::string& path);
#define PI 3.14159265359
diff --git a/include/vk-api.hpp b/include/vk-api.hpp
index 59d09b7..a9dc024 100644
--- a/include/vk-api.hpp
+++ b/include/vk-api.hpp
@@ -2,7 +2,6 @@
#define __VK_API_HPP_
#include <vector>
-#include <string>
#include "vk-context.hpp"
diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp
index 630588f..b478b25 100644
--- a/include/vk-renderer.hpp
+++ b/include/vk-renderer.hpp
@@ -6,12 +6,12 @@
#include "vk-api.hpp"
#include "vulkan-loader.hpp"
-class input_data;
+class scene;
class window;
class vkrenderer {
public:
- vkrenderer(window& wnd, const input_data& inputs);
+ vkrenderer(window& wnd, size_t scene_buffer_size);
~vkrenderer();
@@ -27,7 +27,9 @@ class vkrenderer {
void recreate_swapchain();
- Buffer compute_shader_buffer;
+ inline void* scene_buffer_ptr() {
+ return scene_buffer.alloc_info.pMappedData;
+ }
private:
@@ -49,6 +51,9 @@ class vkrenderer {
std::vector<VkDescriptorSet> compute_shader_sets;
Pipeline compute_pipeline;
+ Buffer scene_buffer;
+
+
std::vector<VkDescriptorSetLayoutBinding> tonemapping_sets_bindings;
std::vector<VkDescriptorSet> tonemapping_shader_sets;
Pipeline tonemapping_pipeline;