From 92d66138f53645f3400f633c9821a6fa36f589e0 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Mon, 21 Dec 2020 01:26:14 +0100 Subject: Add lambertian reflection to spheres --- include/vec3.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/vec3.hpp') diff --git a/include/vec3.hpp b/include/vec3.hpp index 4ab446d..7b0e469 100644 --- a/include/vec3.hpp +++ b/include/vec3.hpp @@ -28,6 +28,10 @@ class vec3 { vec3 unit() const; + static vec3 random(); + + static vec3 random(double min, double max); + double x, y, z; }; @@ -47,6 +51,12 @@ vec3 operator/(vec3 u, double scale); std::ostream& operator<<(std::ostream& out, vec3 vec); +vec3 random_in_unit_sphere(); + +vec3 random_unit_vector(); + +vec3 random_in_hemisphere(const vec3& normal); + using point3 = vec3; using color = vec3; -- cgit v1.3