commit 0a98bc10eb4369825de4297607f833e8916e6c82
parent 825b8cbeddde16bebf2e39e95022ee0957a12682
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 6 Oct 2020 11:56:02 +0200
The htrdr_sun_sample_direction now returns the pdf
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/htrdr_sun.c b/src/htrdr_sun.c
@@ -105,7 +105,7 @@ htrdr_sun_set_direction(struct htrdr_sun* sun, const double dir[3])
d33_basis(sun->frame, dir);
}
-double*
+double
htrdr_sun_sample_direction
(struct htrdr_sun* sun,
struct ssp_rng* rng,
@@ -113,7 +113,8 @@ htrdr_sun_sample_direction
{
ASSERT(sun && rng && dir);
ssp_ran_sphere_cap_uniform_local(rng, sun->cos_half_angle, dir, NULL);
- return d33_muld3(dir, sun->frame, dir);
+ d33_muld3(dir, sun->frame, dir);
+ return 1.0 / htrdr_sun_get_solid_angle(sun);
}
double
diff --git a/src/htrdr_sun.h b/src/htrdr_sun.h
@@ -43,8 +43,8 @@ htrdr_sun_set_direction
(struct htrdr_sun* sun,
const double direction[3]); /* Must be normalized */
-/* Return a direction that points *toward* the sun */
-extern LOCAL_SYM double*
+/* Return a pdf of the sampled dir */
+extern LOCAL_SYM double
htrdr_sun_sample_direction
(struct htrdr_sun* sun,
struct ssp_rng* rng,