aboutsummaryrefslogtreecommitdiff
path: root/src/render.cpp
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-01-17 00:09:15 +0100
committerJulian T <julian@jtle.dk>2021-01-17 00:09:15 +0100
commit94217187eb2785939458f08d96c7b1b9e55439ab (patch)
treeb10e4ab95f213b13b90ac5e0053ed9e92f973693 /src/render.cpp
parented14718ff073e285374fad2d3471552b9b497825 (diff)
Minor changed and draft for random samplingold_rework
Diffstat (limited to 'src/render.cpp')
-rw-r--r--src/render.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/render.cpp b/src/render.cpp
index 286cbae..5762af4 100644
--- a/src/render.cpp
+++ b/src/render.cpp
@@ -34,9 +34,7 @@ Vec3d Sampler::sample(const Vec3d &norm) {
auto theta = 2.0 * M_PI * m_src();
auto phi = acos(2.0 * m_src() - 1.0);
- auto sinphi = sin(phi);
-
- auto newvec = Vec3d(cos(theta) * sinphi, sin(theta) * sinphi, cos(phi));
+ auto newvec = Vec3d::FromSpherical(sin(theta), cos(theta), phi);
if (newvec.dot(norm) <= 0) {
newvec = -newvec;