aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2021-01-06 00:34:02 +0100
committerladevieq <ladevie.quentin@gmail.com>2021-01-06 00:34:02 +0100
commit0d0ce0a318c6c26128f24574cbc63005dcd4a757 (patch)
treea78f5cb4d9f76bbc335607ae754578eeb7ffdf91 /include
parent8c3376c49f803e1d28e76ed100d4d417394df41f (diff)
Customisalbe camera with focus plan
Diffstat (limited to 'include')
-rw-r--r--include/camera.hpp2
-rw-r--r--include/rt.hpp12
-rw-r--r--include/vk-renderer.hpp50
3 files changed, 38 insertions, 26 deletions
diff --git a/include/camera.hpp b/include/camera.hpp
index f1b199a..858833b 100644
--- a/include/camera.hpp
+++ b/include/camera.hpp
@@ -17,7 +17,7 @@ class camera {
ray get_ray(double u, double v) const;
point3 position;
- double lens_radius;
+ float lens_radius;
float viewport_width;
float viewport_height;
diff --git a/include/rt.hpp b/include/rt.hpp
index 1961d35..09cf1b0 100644
--- a/include/rt.hpp
+++ b/include/rt.hpp
@@ -29,12 +29,12 @@ inline float clamp(float x, float min, float max) {
#include "vec3.hpp"
#include "ray.hpp"
#include "color.hpp"
-#include "sphere.hpp"
+// #include "sphere.hpp"
#include "camera.hpp"
-#include "material.hpp"
-#include "lambertian.hpp"
-#include "metal.hpp"
-#include "dielectric.hpp"
-#include "hittable_list.hpp"
+// #include "material.hpp"
+// #include "lambertian.hpp"
+// #include "metal.hpp"
+// #include "dielectric.hpp"
+// #include "hittable_list.hpp"
#endif // !__RT_HPP_
diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp
index 2e996c8..311b3e5 100644
--- a/include/vk-renderer.hpp
+++ b/include/vk-renderer.hpp
@@ -12,34 +12,46 @@ enum MATERIAL_TYPE: uint32_t {
DIELECTRIC,
};
+struct material {
+ color albedo;
+ float fuzz;
+ float ior;
+ uint32_t type;
+ uint32_t padding;
+};
+
+struct sphere {
+ vec3 position;
+ material mat;
+ float radius;
+ float padding[3];
+};
+
struct input_data {
color sky_color;
color ground_color;
- vec3 camera_pos;
- uint32_t samples_per_pixel;
- float viewport_width;
- float viewport_height;
- float proj_plane_distance;
+ struct camera {
+ vec3 position;
+ vec3 up;
+ vec3 right;
+ vec3 forward;
+ float viewport_width;
+ float viewport_height;
+ float lens_radius;
+ float focus_distance;
+ } cam;
- float random_numbers[200];
+ float random_offset[200];
+ float random_disk[200];
vec3 random_in_sphere[1000];
- struct sphere {
- vec3 position;
- struct material {
- color albedo;
- float fuzz;
- float ior;
- uint32_t type;
- uint32_t padding;
- } material;
- float radius;
- float padding[3];
- } spheres[5];
+ sphere spheres[512];
uint32_t max_bounce;
- float padding[3];
+ uint32_t samples_per_pixel;
+
+ float padding[2];
};
struct path_tracer_data {