commit e519d8e09aaa8650ea8eb2ea8666ff0c5b87b6aa
parent 6e07a80d9cadbbf576a1dc176202f01fbf3e6535
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 18 May 2016 10:53:21 +0200
Replace ad-hoc ran float canonical by a built-in ssp alternative
Diffstat:
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/sgf_estimator.c b/src/sgf_estimator.c
@@ -128,14 +128,9 @@ gebhart_radiative_path
f3_normalize(normal, attrib.value);
/* Uniformly sample the primitive to define the starting position of the
- * radiative path.
- *
- * TODO the generation of canonical single precision random variables should
- * be handled by the Star-Sampling library to ensure the uniformity of the
- * distribution, and to avoid numerical issues leading to "out of bound"
- * variables */
- do { u = (float)ssp_rng_canonical(rng); } while(u >= 1.f);
- do { v = (float)ssp_rng_canonical(rng); } while(v >= 1.f);
+ * radiative path. */
+ u = ssp_rng_canonical_float(rng);
+ v = ssp_rng_canonical_float(rng);
S3D(primitive_sample(&prim, u, v, st));
S3D(primitive_get_attrib(&prim, S3D_POSITION, st, &attrib));
f3_set(pos, attrib.value);